diff options
author | Nate Begeman <natebegeman@mac.com> | 2009-02-04 19:47:21 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2009-02-04 19:47:21 +0000 |
commit | d24479730a8790d82c4859dc477bc2416d7a6bda (patch) | |
tree | 7e0310ae5edc0f659e09b9d67efe437da9d4e6f9 /include | |
parent | e5ab34e05d701da042619bf540046efc3c7bc41f (diff) | |
download | external_llvm-d24479730a8790d82c4859dc477bc2416d7a6bda.zip external_llvm-d24479730a8790d82c4859dc477bc2416d7a6bda.tar.gz external_llvm-d24479730a8790d82c4859dc477bc2416d7a6bda.tar.bz2 |
New feature: add support for target intrinsics being defined in the
target directories themselves. This also means that VMCore no longer
needs to know about every target's list of intrinsics. Future work
will include converting the PowerPC target to this interface as an
example implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Function.h | 2 | ||||
-rw-r--r-- | include/llvm/Intrinsics.h | 3 | ||||
-rw-r--r-- | include/llvm/Intrinsics.td | 2 | ||||
-rw-r--r-- | include/llvm/Module.h | 4 | ||||
-rw-r--r-- | include/llvm/Target/TargetIntrinsicInfo.h | 48 | ||||
-rw-r--r-- | include/llvm/Target/TargetMachine.h | 7 |
6 files changed, 64 insertions, 2 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 689d0e6..942a5f0 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -129,7 +129,7 @@ public: /// The particular intrinsic functions which correspond to this value are /// defined in llvm/Intrinsics.h. /// - unsigned getIntrinsicID(bool noAssert = false) const; + unsigned getIntrinsicID() const; bool isIntrinsic() const { return getIntrinsicID() != 0; } /// getCallingConv()/setCallingConv(uint) - These method get and set the diff --git a/include/llvm/Intrinsics.h b/include/llvm/Intrinsics.h index b15b021..2433599 100644 --- a/include/llvm/Intrinsics.h +++ b/include/llvm/Intrinsics.h @@ -63,6 +63,9 @@ namespace Intrinsic { /// intrinsic. Function *getDeclaration(Module *M, ID id, const Type **Tys = 0, unsigned numTys = 0); + + /// Map a GCC builtin name to an intrinsic ID. + ID getIntrinsicForGCCBuiltin(const char *Prefix, const char *BuiltinName); } // End Intrinsic namespace diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td index 8145700..4ecc1a7 100644 --- a/include/llvm/Intrinsics.td +++ b/include/llvm/Intrinsics.td @@ -144,6 +144,8 @@ class Intrinsic<list<LLVMType> ret_types, list<LLVMType> RetTypes = ret_types; list<LLVMType> ParamTypes = param_types; list<IntrinsicProperty> Properties = properties; + + bit isTarget = 0; } /// GCCBuiltin - If this intrinsic exactly corresponds to a GCC builtin, this diff --git a/include/llvm/Module.h b/include/llvm/Module.h index b0db50a..aa2c449 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -213,6 +213,10 @@ public: Constant *getOrInsertFunction(const std::string &Name, const Type *RetTy, ...) END_WITH_NULL; + Constant *getOrInsertTargetIntrinsic(const std::string &Name, + const FunctionType *Ty, + AttrListPtr AttributeList); + /// getFunction - Look up the specified function in the module symbol table. /// If it does not exist, return null. Function *getFunction(const std::string &Name) const; diff --git a/include/llvm/Target/TargetIntrinsicInfo.h b/include/llvm/Target/TargetIntrinsicInfo.h new file mode 100644 index 0000000..323e29a --- /dev/null +++ b/include/llvm/Target/TargetIntrinsicInfo.h @@ -0,0 +1,48 @@ +//===-- llvm/Target/TargetIntrinsicInfo.h - Instruction Info ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file describes the target intrinsic instructions to the code generator. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TARGET_TARGETINTRINSICINFO_H +#define LLVM_TARGET_TARGETINTRINSICINFO_H + +namespace llvm { + +class Function; +class Module; + +//--------------------------------------------------------------------------- +/// +/// TargetIntrinsicInfo - Interface to description of machine instruction set +/// +class TargetIntrinsicInfo { + + const char **Intrinsics; // Raw array to allow static init'n + unsigned NumIntrinsics; // Number of entries in the desc array + + TargetIntrinsicInfo(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT + void operator=(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT +public: + TargetIntrinsicInfo(const char **desc, unsigned num); + virtual ~TargetIntrinsicInfo(); + + unsigned getNumIntrinsics() const { return NumIntrinsics; } + + virtual Function *getDeclaration(Module *M, const char *BuiltinName) const { + return 0; + } + + virtual unsigned getIntrinsicID(Function *F) const { return 0; } +}; + +} // End llvm namespace + +#endif diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index b8bfc83..0be3286 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -23,6 +23,7 @@ class TargetAsmInfo; class TargetData; class TargetSubtarget; class TargetInstrInfo; +class TargetIntrinsicInfo; class TargetJITInfo; class TargetLowering; class TargetFrameInfo; @@ -118,7 +119,6 @@ public: virtual TargetLowering *getTargetLowering() const { return 0; } virtual const TargetData *getTargetData() const { return 0; } - /// getTargetAsmInfo - Return target specific asm information. /// const TargetAsmInfo *getTargetAsmInfo() const { @@ -141,6 +141,11 @@ public: /// details of graph coloring register allocation removed from it. /// virtual const TargetRegisterInfo *getRegisterInfo() const { return 0; } + + /// getIntrinsicInfo - If intrinsic information is available, return it. If + /// not, return null. + /// + virtual const TargetIntrinsicInfo *getIntrinsicInfo() const { return 0; } /// getJITInfo - If this target supports a JIT, return information for it, /// otherwise return null. |