clang API Documentation
00001 //===--- TargetBuiltins.h - Target specific builtin IDs ---------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 /// 00010 /// \file 00011 /// \brief Enumerates target-specific builtins in their own namespaces within 00012 /// namespace ::clang. 00013 /// 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef LLVM_CLANG_BASIC_TARGETBUILTINS_H 00017 #define LLVM_CLANG_BASIC_TARGETBUILTINS_H 00018 00019 #include "clang/Basic/Builtins.h" 00020 #undef PPC 00021 00022 namespace clang { 00023 00024 namespace NEON { 00025 enum { 00026 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, 00027 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00028 #include "clang/Basic/BuiltinsNEON.def" 00029 FirstTSBuiltin 00030 }; 00031 } 00032 00033 /// \brief ARM builtins 00034 namespace ARM { 00035 enum { 00036 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 00037 LastNEONBuiltin = NEON::FirstTSBuiltin - 1, 00038 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00039 #include "clang/Basic/BuiltinsARM.def" 00040 LastTSBuiltin 00041 }; 00042 } 00043 00044 /// \brief AArch64 builtins 00045 namespace AArch64 { 00046 enum { 00047 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, 00048 LastNEONBuiltin = NEON::FirstTSBuiltin - 1, 00049 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00050 #include "clang/Basic/BuiltinsAArch64.def" 00051 LastTSBuiltin 00052 }; 00053 } 00054 00055 /// \brief PPC builtins 00056 namespace PPC { 00057 enum { 00058 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 00059 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00060 #include "clang/Basic/BuiltinsPPC.def" 00061 LastTSBuiltin 00062 }; 00063 } 00064 00065 /// \brief NVPTX builtins 00066 namespace NVPTX { 00067 enum { 00068 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 00069 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00070 #include "clang/Basic/BuiltinsNVPTX.def" 00071 LastTSBuiltin 00072 }; 00073 } 00074 00075 /// \brief R600 builtins 00076 namespace R600 { 00077 enum { 00078 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, 00079 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00080 #include "clang/Basic/BuiltinsR600.def" 00081 LastTSBuiltin 00082 }; 00083 } 00084 00085 /// \brief X86 builtins 00086 namespace X86 { 00087 enum { 00088 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 00089 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00090 #include "clang/Basic/BuiltinsX86.def" 00091 LastTSBuiltin 00092 }; 00093 } 00094 00095 /// \brief Flags to identify the types for overloaded Neon builtins. 00096 /// 00097 /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h. 00098 class NeonTypeFlags { 00099 enum { 00100 EltTypeMask = 0xf, 00101 UnsignedFlag = 0x10, 00102 QuadFlag = 0x20 00103 }; 00104 uint32_t Flags; 00105 00106 public: 00107 enum EltType { 00108 Int8, 00109 Int16, 00110 Int32, 00111 Int64, 00112 Poly8, 00113 Poly16, 00114 Poly64, 00115 Poly128, 00116 Float16, 00117 Float32, 00118 Float64 00119 }; 00120 00121 NeonTypeFlags(unsigned F) : Flags(F) {} 00122 NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) { 00123 if (IsUnsigned) 00124 Flags |= UnsignedFlag; 00125 if (IsQuad) 00126 Flags |= QuadFlag; 00127 } 00128 00129 EltType getEltType() const { return (EltType)(Flags & EltTypeMask); } 00130 bool isPoly() const { 00131 EltType ET = getEltType(); 00132 return ET == Poly8 || ET == Poly16; 00133 } 00134 bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; } 00135 bool isQuad() const { return (Flags & QuadFlag) != 0; } 00136 }; 00137 00138 /// \brief Hexagon builtins 00139 namespace Hexagon { 00140 enum { 00141 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 00142 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00143 #include "clang/Basic/BuiltinsHexagon.def" 00144 LastTSBuiltin 00145 }; 00146 } 00147 00148 /// \brief MIPS builtins 00149 namespace Mips { 00150 enum { 00151 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 00152 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00153 #include "clang/Basic/BuiltinsMips.def" 00154 LastTSBuiltin 00155 }; 00156 } 00157 00158 /// \brief XCore builtins 00159 namespace XCore { 00160 enum { 00161 LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, 00162 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00163 #include "clang/Basic/BuiltinsXCore.def" 00164 LastTSBuiltin 00165 }; 00166 } 00167 00168 /// \brief Le64 builtins 00169 namespace Le64 { 00170 enum { 00171 LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, 00172 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 00173 #include "clang/Basic/BuiltinsLe64.def" 00174 LastTSBuiltin 00175 }; 00176 } 00177 00178 } // end namespace clang. 00179 00180 #endif