LLVM API Documentation
00001 //===-- llvm/Target/TargetIntrinsicInfo.h - Instruction Info ----*- 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 describes the target intrinsic instructions to the code generator. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_TARGET_TARGETINTRINSICINFO_H 00015 #define LLVM_TARGET_TARGETINTRINSICINFO_H 00016 00017 #include "llvm/Support/Compiler.h" 00018 #include <string> 00019 00020 namespace llvm { 00021 00022 class Function; 00023 class Module; 00024 class Type; 00025 00026 //--------------------------------------------------------------------------- 00027 /// 00028 /// TargetIntrinsicInfo - Interface to description of machine instruction set 00029 /// 00030 class TargetIntrinsicInfo { 00031 TargetIntrinsicInfo(const TargetIntrinsicInfo &) LLVM_DELETED_FUNCTION; 00032 void operator=(const TargetIntrinsicInfo &) LLVM_DELETED_FUNCTION; 00033 public: 00034 TargetIntrinsicInfo(); 00035 virtual ~TargetIntrinsicInfo(); 00036 00037 /// Return the name of a target intrinsic, e.g. "llvm.bfin.ssync". 00038 /// The Tys and numTys parameters are for intrinsics with overloaded types 00039 /// (e.g., those using iAny or fAny). For a declaration for an overloaded 00040 /// intrinsic, Tys should point to an array of numTys pointers to Type, 00041 /// and must provide exactly one type for each overloaded type in the 00042 /// intrinsic. 00043 virtual std::string getName(unsigned IID, Type **Tys = nullptr, 00044 unsigned numTys = 0) const = 0; 00045 00046 /// Look up target intrinsic by name. Return intrinsic ID or 0 for unknown 00047 /// names. 00048 virtual unsigned lookupName(const char *Name, unsigned Len) const =0; 00049 00050 /// Return the target intrinsic ID of a function, or 0. 00051 virtual unsigned getIntrinsicID(Function *F) const; 00052 00053 /// Returns true if the intrinsic can be overloaded. 00054 virtual bool isOverloaded(unsigned IID) const = 0; 00055 00056 /// Create or insert an LLVM Function declaration for an intrinsic, 00057 /// and return it. The Tys and numTys are for intrinsics with overloaded 00058 /// types. See above for more information. 00059 virtual Function *getDeclaration(Module *M, unsigned ID, Type **Tys = nullptr, 00060 unsigned numTys = 0) const = 0; 00061 }; 00062 00063 } // End llvm namespace 00064 00065 #endif