clang API Documentation

TargetBuiltins.h
Go to the documentation of this file.
00001 //===--- TargetBuiltins.h - Target specific builtin IDs -------------------===//
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 #ifndef LLVM_CLANG_BASIC_TARGET_BUILTINS_H
00011 #define LLVM_CLANG_BASIC_TARGET_BUILTINS_H
00012 
00013 #include "clang/Basic/Builtins.h"
00014 #undef PPC
00015 
00016 namespace clang {
00017 
00018   /// ARM builtins
00019   namespace ARM {
00020     enum {
00021         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
00022 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
00023 #include "clang/Basic/BuiltinsARM.def"
00024         LastTSBuiltin
00025     };
00026   }
00027 
00028   /// PPC builtins
00029   namespace PPC {
00030     enum {
00031         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
00032 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
00033 #include "clang/Basic/BuiltinsPPC.def"
00034         LastTSBuiltin
00035     };
00036   }
00037 
00038   /// PTX builtins
00039   namespace PTX {
00040     enum {
00041         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
00042 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
00043 #include "clang/Basic/BuiltinsPTX.def"
00044         LastTSBuiltin
00045     };
00046   }
00047 
00048 
00049   /// X86 builtins
00050   namespace X86 {
00051     enum {
00052         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
00053 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
00054 #include "clang/Basic/BuiltinsX86.def"
00055         LastTSBuiltin
00056     };
00057   }
00058 
00059   /// NeonTypeFlags - Flags to identify the types for overloaded Neon
00060   /// builtins.  These must be kept in sync with the flags in
00061   /// utils/TableGen/NeonEmitter.h.
00062   class NeonTypeFlags {
00063     enum {
00064       EltTypeMask = 0xf,
00065       UnsignedFlag = 0x10,
00066       QuadFlag = 0x20
00067     };
00068     uint32_t Flags;
00069 
00070   public:
00071     enum EltType {
00072       Int8,
00073       Int16,
00074       Int32,
00075       Int64,
00076       Poly8,
00077       Poly16,
00078       Float16,
00079       Float32
00080     };
00081 
00082     NeonTypeFlags(unsigned F) : Flags(F) {}
00083     NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
00084       if (IsUnsigned)
00085         Flags |= UnsignedFlag;
00086       if (IsQuad)
00087         Flags |= QuadFlag;
00088     }
00089 
00090     EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
00091     bool isPoly() const {
00092       EltType ET = getEltType();
00093       return ET == Poly8 || ET == Poly16;
00094     }
00095     bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
00096     bool isQuad() const { return (Flags & QuadFlag) != 0; }
00097   };
00098 
00099   /// Hexagon builtins
00100   namespace Hexagon {
00101     enum {
00102         LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
00103 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
00104 #include "clang/Basic/BuiltinsHexagon.def"
00105         LastTSBuiltin
00106     };
00107   }
00108 } // end namespace clang.
00109 
00110 #endif