[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp
Jim Laskey
jlaskey at apple.com
Wed Feb 7 12:38:49 PST 2007
Changes in directory llvm/lib/VMCore:
Function.cpp updated: 1.111 -> 1.112
---
Log message:
Automatically generating intrinsic declarations from Dan Gohman. Modified
to construct FunctionType in separate function, and, have getDeclaration
return a Function instead of a Constant.
---
Diffs of the changes: (+19 -0)
Function.cpp | 19 +++++++++++++++++++
1 files changed, 19 insertions(+)
Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.111 llvm/lib/VMCore/Function.cpp:1.112
--- llvm/lib/VMCore/Function.cpp:1.111 Mon Feb 5 14:47:20 2007
+++ llvm/lib/VMCore/Function.cpp Wed Feb 7 14:38:26 2007
@@ -183,6 +183,25 @@
return Table[id];
}
+const FunctionType *Intrinsic::getType(ID id) {
+ const Type *ResultTy = NULL;
+ std::vector<const Type*> ArgTys;
+ std::vector<FunctionType::ParameterAttributes> Attrs;
+ bool IsVarArg = false;
+
+#define GET_INTRINSIC_GENERATOR
+#include "llvm/Intrinsics.gen"
+#undef GET_INTRINSIC_GENERATOR
+
+ return FunctionType::get(ResultTy, ArgTys, IsVarArg, Attrs);
+}
+
+Function *Intrinsic::getDeclaration(Module *M, ID id) {
+// There can never be multiple globals with the same name of different types,
+// because intrinsics must be a specific type.
+ return cast<Function>(M->getOrInsertFunction(getName(id), getType(id)));
+}
+
Value *IntrinsicInst::StripPointerCasts(Value *Ptr) {
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr)) {
if (CE->getOpcode() == Instruction::BitCast) {
More information about the llvm-commits
mailing list