diff options
author | Gabor Greif <ggreif@gmail.com> | 2009-03-13 18:27:29 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2009-03-13 18:27:29 +0000 |
commit | b14cda3c0dea98bdd44c2f209afaf4fb36d42a8a (patch) | |
tree | c65232c6e234198481772e94f867a498fba7cfd6 /lib/VMCore/Instructions.cpp | |
parent | 6dc3a8fd40a8c1bf6a12d6389506c4db9a497730 (diff) |
Second installment of "BasicBlock operands to the back"
changes.
For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().
This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.
This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index fe30271f84..2549f6ef3a 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -93,6 +93,13 @@ bool CallSite::hasArgument(const Value *Arg) const { return false; } +User::op_iterator CallSite::getCallee() const { + Instruction *II(getInstruction()); + return isCall() + ? cast<CallInst>(II)->op_begin() + : cast<InvokeInst>(II)->op_end() - 3; // Skip BB, BB, Function +} + #undef CALLSITE_DELEGATE_GETTER #undef CALLSITE_DELEGATE_SETTER @@ -431,10 +438,9 @@ bool CallInst::paramHasAttr(unsigned i, Attributes attr) const { void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, Value* const *Args, unsigned NumArgs) { assert(NumOperands == 3+NumArgs && "NumOperands not set up?"); - Use *OL = OperandList; - OL[0] = Fn; - OL[1] = IfNormal; - OL[2] = IfException; + Op<-3>() = Fn; + Op<-2>() = IfNormal; + Op<-1>() = IfException; const FunctionType *FTy = cast<FunctionType>(cast<PointerType>(Fn->getType())->getElementType()); FTy = FTy; // silence warning. @@ -443,12 +449,13 @@ void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, (FTy->isVarArg() && NumArgs > FTy->getNumParams())) && "Calling a function with bad signature"); + Use *OL = OperandList; for (unsigned i = 0, e = NumArgs; i != e; i++) { assert((i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Invoking a function with a bad signature!"); - OL[i+3] = Args[i]; + OL[i] = Args[i]; } } |