LLVM API Documentation

Intrinsics.h

Go to the documentation of this file.
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 Module;
00027 class AttrListPtr;
00028 
00029 /// Intrinsic Namespace - This namespace contains an enum with a value for
00030 /// every intrinsic/builtin function known by LLVM.  These enum values are
00031 /// returned by Function::getIntrinsicID().
00032 ///
00033 namespace Intrinsic {
00034   enum ID {
00035     not_intrinsic = 0,   // Must be zero
00036 
00037     // Get the intrinsic enums generated from Intrinsics.td
00038 #define GET_INTRINSIC_ENUM_VALUES
00039 #include "llvm/Intrinsics.gen"    
00040 #undef GET_INTRINSIC_ENUM_VALUES
00041     , num_intrinsics
00042   };
00043   
00044   /// Intrinsic::getName(ID) - Return the LLVM name for an intrinsic, such as
00045   /// "llvm.ppc.altivec.lvx".
00046   std::string getName(ID id, const Type **Tys = 0, unsigned numTys = 0);
00047   
00048   /// Intrinsic::getType(ID) - Return the function type for an intrinsic.
00049   ///
00050   const FunctionType *getType(ID id, const Type **Tys = 0, unsigned numTys = 0);
00051 
00052   /// Intrinsic::getAttributes(ID) - Return the attributes for an intrinsic.
00053   ///
00054   AttrListPtr getAttributes(ID id);
00055 
00056   /// Intrinsic::getDeclaration(M, ID) - Create or insert an LLVM Function
00057   /// declaration for an intrinsic, and return it.
00058   ///
00059   /// The Tys and numTys parameters are for intrinsics with overloaded types
00060   /// (i.e., those using iAny or fAny). For a declaration for an overloaded
00061   /// intrinsic, Tys should point to an array of numTys pointers to Type,
00062   /// and must provide exactly one type for each overloaded type in the
00063   /// intrinsic.
00064   Function *getDeclaration(Module *M, ID id, const Type **Tys = 0, 
00065                            unsigned numTys = 0);
00066   
00067 } // End Intrinsic namespace
00068 
00069 } // End llvm namespace
00070 
00071 #endif