1 //===--- TargetBuiltins.h - Target specific builtin IDs -------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 /// 10 /// \file 11 /// \brief Enumerates target-specific builtins in their own namespaces within 12 /// namespace ::clang. 13 /// 14 //===----------------------------------------------------------------------===// 15 16 #ifndef LLVM_CLANG_BASIC_TARGET_BUILTINS_H 17 #define LLVM_CLANG_BASIC_TARGET_BUILTINS_H 18 19 #include "clang/Basic/Builtins.h" 20 #undef PPC 21 22 namespace clang { 23 24 /// \brief ARM builtins 25 namespace ARM { 26 enum { 27 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 28 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 29 #include "clang/Basic/BuiltinsARM.def" 30 LastTSBuiltin 31 }; 32 } 33 34 /// \brief PPC builtins 35 namespace PPC { 36 enum { 37 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 38 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 39 #include "clang/Basic/BuiltinsPPC.def" 40 LastTSBuiltin 41 }; 42 } 43 44 /// \brief NVPTX builtins 45 namespace NVPTX { 46 enum { 47 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 48 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 49 #include "clang/Basic/BuiltinsNVPTX.def" 50 LastTSBuiltin 51 }; 52 } 53 54 55 /// \brief X86 builtins 56 namespace X86 { 57 enum { 58 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 59 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 60 #include "clang/Basic/BuiltinsX86.def" 61 LastTSBuiltin 62 }; 63 } 64 65 /// \brief Flags to identify the types for overloaded Neon builtins. 66 /// 67 /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h. 68 class NeonTypeFlags { 69 enum { 70 EltTypeMask = 0xf, 71 UnsignedFlag = 0x10, 72 QuadFlag = 0x20 73 }; 74 uint32_t Flags; 75 76 public: 77 enum EltType { 78 Int8, 79 Int16, 80 Int32, 81 Int64, 82 Poly8, 83 Poly16, 84 Float16, 85 Float32 86 }; 87 88 NeonTypeFlags(unsigned F) : Flags(F) {} 89 NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) { 90 if (IsUnsigned) 91 Flags |= UnsignedFlag; 92 if (IsQuad) 93 Flags |= QuadFlag; 94 } 95 96 EltType getEltType() const { return (EltType)(Flags & EltTypeMask); } 97 bool isPoly() const { 98 EltType ET = getEltType(); 99 return ET == Poly8 || ET == Poly16; 100 } 101 bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; } 102 bool isQuad() const { return (Flags & QuadFlag) != 0; } 103 }; 104 105 /// \brief Hexagon builtins 106 namespace Hexagon { 107 enum { 108 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 109 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 110 #include "clang/Basic/BuiltinsHexagon.def" 111 LastTSBuiltin 112 }; 113 } 114 115 /// \brief MIPS builtins 116 namespace Mips { 117 enum { 118 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 119 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 120 #include "clang/Basic/BuiltinsMips.def" 121 LastTSBuiltin 122 }; 123 } 124 } // end namespace clang. 125 126 #endif 127