1 //===----- SemaPPC.h ------- PPC target-specific routines -----*- C++ -*---===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 /// \file 9 /// This file declares semantic analysis functions specific to PowerPC. 10 /// 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_CLANG_SEMA_SEMAPPC_H 14 #define LLVM_CLANG_SEMA_SEMAPPC_H 15 16 #include "clang/AST/ASTFwd.h" 17 #include "clang/AST/Type.h" 18 #include "clang/Basic/SourceLocation.h" 19 #include "clang/Sema/SemaBase.h" 20 21 namespace clang { 22 class TargetInfo; 23 24 class SemaPPC : public SemaBase { 25 public: 26 SemaPPC(Sema &S); 27 28 bool CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, 29 CallExpr *TheCall); 30 // 16 byte ByVal alignment not due to a vector member is not honoured by XL 31 // on AIX. Emit a warning here that users are generating binary incompatible 32 // code to be safe. 33 // Here we try to get information about the alignment of the struct member 34 // from the struct passed to the caller function. We only warn when the struct 35 // is passed byval, hence the series of checks and early returns if we are a 36 // not passing a struct byval. 37 void checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg); 38 39 /// BuiltinPPCMMACall - Check the call to a PPC MMA builtin for validity. 40 /// Emit an error and return true on failure; return false on success. 41 /// TypeStr is a string containing the type descriptor of the value returned 42 /// by the builtin and the descriptors of the expected type of the arguments. 43 bool BuiltinPPCMMACall(CallExpr *TheCall, unsigned BuiltinID, 44 const char *TypeDesc); 45 46 bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc); 47 48 // Customized Sema Checking for VSX builtins that have the following 49 // signature: vector [...] builtinName(vector [...], vector [...], const int); 50 // Which takes the same type of vectors (any legal vector type) for the first 51 // two arguments and takes compile time constant for the third argument. 52 // Example builtins are : 53 // vector double vec_xxpermdi(vector double, vector double, int); 54 // vector short vec_xxsldwi(vector short, vector short, int); 55 bool BuiltinVSX(CallExpr *TheCall); 56 }; 57 } // namespace clang 58 59 #endif // LLVM_CLANG_SEMA_SEMAPPC_H 60