mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Constant pointer refs are causing these to fail unnecessarily, which is causing
a lot of code to be pessimized. I hate CPRs. :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9635 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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 @@ CallInst::CallInst(const CallInst &CI)
|
||||
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 @@ InvokeInst::InvokeInst(const InvokeInst &CI)
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user