TargetIntrinsicInfo.h revision 226633
1243115Ssjg//===-- llvm/Target/TargetIntrinsicInfo.h - Instruction Info ----*- C++ -*-===// 2236769Sobrien// 3236769Sobrien// The LLVM Compiler Infrastructure 4236769Sobrien// 5236769Sobrien// This file is distributed under the University of Illinois Open Source 6236769Sobrien// License. See LICENSE.TXT for details. 7236769Sobrien// 8236769Sobrien//===----------------------------------------------------------------------===// 9236769Sobrien// 10236769Sobrien// This file describes the target intrinsic instructions to the code generator. 11236769Sobrien// 12236769Sobrien//===----------------------------------------------------------------------===// 13236769Sobrien 14236769Sobrien#ifndef LLVM_TARGET_TARGETINTRINSICINFO_H 15236769Sobrien#define LLVM_TARGET_TARGETINTRINSICINFO_H 16236769Sobrien 17236769Sobrien#include <string> 18236769Sobrien 19236769Sobriennamespace llvm { 20236769Sobrien 21236769Sobrienclass Function; 22236769Sobrienclass Module; 23236769Sobrienclass Type; 24236769Sobrien 25236769Sobrien//--------------------------------------------------------------------------- 26236769Sobrien/// 27236769Sobrien/// TargetIntrinsicInfo - Interface to description of machine instruction set 28236769Sobrien/// 29236769Sobrienclass TargetIntrinsicInfo { 30236769Sobrien TargetIntrinsicInfo(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT 31236769Sobrien void operator=(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT 32236769Sobrienpublic: 33236769Sobrien TargetIntrinsicInfo(); 34236769Sobrien virtual ~TargetIntrinsicInfo(); 35236769Sobrien 36236769Sobrien /// Return the name of a target intrinsic, e.g. "llvm.bfin.ssync". 37236769Sobrien /// The Tys and numTys parameters are for intrinsics with overloaded types 38236769Sobrien /// (e.g., those using iAny or fAny). For a declaration for an overloaded 39236769Sobrien /// intrinsic, Tys should point to an array of numTys pointers to Type, 40236769Sobrien /// and must provide exactly one type for each overloaded type in the 41236769Sobrien /// intrinsic. 42236769Sobrien virtual std::string getName(unsigned IID, Type **Tys = 0, 43236769Sobrien unsigned numTys = 0) const = 0; 44236769Sobrien 45236769Sobrien /// Look up target intrinsic by name. Return intrinsic ID or 0 for unknown 46236769Sobrien /// names. 47236769Sobrien virtual unsigned lookupName(const char *Name, unsigned Len) const =0; 48236769Sobrien 49236769Sobrien /// Return the target intrinsic ID of a function, or 0. 50236769Sobrien virtual unsigned getIntrinsicID(Function *F) const; 51236769Sobrien 52236769Sobrien /// Returns true if the intrinsic can be overloaded. 53236769Sobrien virtual bool isOverloaded(unsigned IID) const = 0; 54236769Sobrien 55236769Sobrien /// Create or insert an LLVM Function declaration for an intrinsic, 56236769Sobrien /// and return it. The Tys and numTys are for intrinsics with overloaded 57236769Sobrien /// types. See above for more information. 58236769Sobrien virtual Function *getDeclaration(Module *M, unsigned ID, Type **Tys = 0, 59236769Sobrien unsigned numTys = 0) const = 0; 60236769Sobrien}; 61236769Sobrien 62236769Sobrien} // End llvm namespace 63236769Sobrien 64236769Sobrien#endif 65236769Sobrien