[llvm-commits] CVS: llvm/lib/VMCore/iCall.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Oct 31 11:52:01 PST 2003
Changes in directory llvm/lib/VMCore:
iCall.cpp updated: 1.18 -> 1.19
---
Log message:
Constant pointer refs are causing these to fail unnecessarily, which is causing
a lot of code to be pessimized. I hate CPRs. :(
---
Diffs of the changes: (+31 -0)
Index: llvm/lib/VMCore/iCall.cpp
diff -u llvm/lib/VMCore/iCall.cpp:1.18 llvm/lib/VMCore/iCall.cpp:1.19
--- llvm/lib/VMCore/iCall.cpp:1.18 Mon Oct 20 14:43:21 2003
+++ llvm/lib/VMCore/iCall.cpp Fri Oct 31 11:51:16 2003
@@ -13,6 +13,7 @@
#include "llvm/iOther.h"
#include "llvm/iTerminators.h"
+#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
@@ -78,6 +79,22 @@
Operands.push_back(Use(CI.Operands[i], this));
}
+const Function *CallInst::getCalledFunction() const {
+ if (const Function *F = dyn_cast<Function>(Operands[0]))
+ return F;
+ if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Operands[0]))
+ return cast<Function>(CPR->getValue());
+ return 0;
+}
+Function *CallInst::getCalledFunction() {
+ if (Function *F = dyn_cast<Function>(Operands[0]))
+ return F;
+ if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Operands[0]))
+ return cast<Function>(CPR->getValue());
+ return 0;
+}
+
+
//===----------------------------------------------------------------------===//
// InvokeInst Implementation
//===----------------------------------------------------------------------===//
@@ -112,3 +129,17 @@
Operands.push_back(Use(CI.Operands[i], this));
}
+const Function *InvokeInst::getCalledFunction() const {
+ if (const Function *F = dyn_cast<Function>(Operands[0]))
+ return F;
+ if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Operands[0]))
+ return cast<Function>(CPR->getValue());
+ return 0;
+}
+Function *InvokeInst::getCalledFunction() {
+ if (Function *F = dyn_cast<Function>(Operands[0]))
+ return F;
+ if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Operands[0]))
+ return cast<Function>(CPR->getValue());
+ return 0;
+}
More information about the llvm-commits
mailing list