LLVM API Documentation
00001 //===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- 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 // This file defines a set of enums which allow processing of intrinsic 00011 // functions. Values of these enum types are returned by 00012 // Function::getIntrinsicID. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef LLVM_INTRINSICS_H 00017 #define LLVM_INTRINSICS_H 00018 00019 #include <string> 00020 00021 namespace llvm { 00022 00023 class Type; 00024 class FunctionType; 00025 class Function; 00026 class LLVMContext; 00027 class Module; 00028 class AttrListPtr; 00029 00030 /// Intrinsic Namespace - This namespace contains an enum with a value for 00031 /// every intrinsic/builtin function known by LLVM. These enum values are 00032 /// returned by Function::getIntrinsicID(). 00033 /// 00034 namespace Intrinsic { 00035 enum ID { 00036 not_intrinsic = 0, // Must be zero 00037 00038 // Get the intrinsic enums generated from Intrinsics.td 00039 #define GET_INTRINSIC_ENUM_VALUES 00040 #include "llvm/Intrinsics.gen" 00041 #undef GET_INTRINSIC_ENUM_VALUES 00042 , num_intrinsics 00043 }; 00044 00045 /// Intrinsic::getName(ID) - Return the LLVM name for an intrinsic, such as 00046 /// "llvm.ppc.altivec.lvx". 00047 std::string getName(ID id, const Type **Tys = 0, unsigned numTys = 0); 00048 00049 /// Intrinsic::getType(ID) - Return the function type for an intrinsic. 00050 /// 00051 const FunctionType *getType(LLVMContext &Context, ID id, 00052 const Type **Tys = 0, unsigned numTys = 0); 00053 00054 /// Intrinsic::isOverloaded(ID) - Returns true if the intrinsic can be 00055 /// overloaded. 00056 bool isOverloaded(ID id); 00057 00058 /// Intrinsic::getAttributes(ID) - Return the attributes for an intrinsic. 00059 /// 00060 AttrListPtr getAttributes(ID id); 00061 00062 /// Intrinsic::getDeclaration(M, ID) - Create or insert an LLVM Function 00063 /// declaration for an intrinsic, and return it. 00064 /// 00065 /// The Tys and numTys parameters are for intrinsics with overloaded types 00066 /// (e.g., those using iAny or fAny). For a declaration for an overloaded 00067 /// intrinsic, Tys should point to an array of numTys pointers to Type, 00068 /// and must provide exactly one type for each overloaded type in the 00069 /// intrinsic. 00070 Function *getDeclaration(Module *M, ID id, const Type **Tys = 0, 00071 unsigned numTys = 0); 00072 00073 /// Map a GCC builtin name to an intrinsic ID. 00074 ID getIntrinsicForGCCBuiltin(const char *Prefix, const char *BuiltinName); 00075 00076 } // End Intrinsic namespace 00077 00078 } // End llvm namespace 00079 00080 #endif