xref: /freebsd/contrib/llvm-project/clang/include/clang/Sema/SemaPPC.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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/Expr.h"
17 #include "clang/AST/Type.h"
18 #include "clang/Basic/SourceLocation.h"
19 #include "clang/Basic/TargetInfo.h"
20 #include "clang/Sema/SemaBase.h"
21 
22 namespace clang {
23 class SemaPPC : public SemaBase {
24 public:
25   SemaPPC(Sema &S);
26 
27   bool CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
28                                    CallExpr *TheCall);
29   // 16 byte ByVal alignment not due to a vector member is not honoured by XL
30   // on AIX. Emit a warning here that users are generating binary incompatible
31   // code to be safe.
32   // Here we try to get information about the alignment of the struct member
33   // from the struct passed to the caller function. We only warn when the struct
34   // is passed byval, hence the series of checks and early returns if we are a
35   // not passing a struct byval.
36   void checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg);
37 
38   /// BuiltinPPCMMACall - Check the call to a PPC MMA builtin for validity.
39   /// Emit an error and return true on failure; return false on success.
40   /// TypeStr is a string containing the type descriptor of the value returned
41   /// by the builtin and the descriptors of the expected type of the arguments.
42   bool BuiltinPPCMMACall(CallExpr *TheCall, unsigned BuiltinID,
43                          const char *TypeDesc);
44 
45   bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc);
46 
47   // Customized Sema Checking for VSX builtins that have the following
48   // signature: vector [...] builtinName(vector [...], vector [...], const int);
49   // Which takes the same type of vectors (any legal vector type) for the first
50   // two arguments and takes compile time constant for the third argument.
51   // Example builtins are :
52   // vector double vec_xxpermdi(vector double, vector double, int);
53   // vector short vec_xxsldwi(vector short, vector short, int);
54   bool BuiltinVSX(CallExpr *TheCall);
55 };
56 } // namespace clang
57 
58 #endif // LLVM_CLANG_SEMA_SEMAPPC_H
59