diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2003-11-07 19:59:08 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-11-07 19:59:08 +0000 |
commit | ae2495a9210257a9d4c430df20952c34034828c8 (patch) | |
tree | 97783f84faf3cb217eb9783d145235341afcce83 /lib | |
parent | 00c73d2e2110e957c5e9395efadbd73cbac3a05b (diff) | |
download | external_llvm-ae2495a9210257a9d4c430df20952c34034828c8.zip external_llvm-ae2495a9210257a9d4c430df20952c34034828c8.tar.gz external_llvm-ae2495a9210257a9d4c430df20952c34034828c8.tar.bz2 |
Make the operation of visitCallInst() only depend on the CallSite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9787 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Execution.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 739e57c..6eb0324 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -641,15 +641,17 @@ void Interpreter::visitCallInst(CallInst &I) { ExecutionContext &SF = ECStack.back(); SF.Caller = CallSite(&I); std::vector<GenericValue> ArgVals; - ArgVals.reserve(I.getNumOperands()-1); - for (unsigned i = 1; i < I.getNumOperands(); ++i) { - ArgVals.push_back(getOperandValue(I.getOperand(i), SF)); + const unsigned NumArgs = SF.Caller.arg_size(); + ArgVals.reserve(NumArgs); + for (CallSite::arg_iterator i = SF.Caller.arg_begin(), + e = SF.Caller.arg_end(); i != e; ++i) { + Value *V = *i; + ArgVals.push_back(getOperandValue(V, SF)); // Promote all integral types whose size is < sizeof(int) into ints. We do // this by zero or sign extending the value as appropriate according to the // source type. - if (I.getOperand(i)->getType()->isIntegral() && - I.getOperand(i)->getType()->getPrimitiveSize() < 4) { - const Type *Ty = I.getOperand(i)->getType(); + const Type *Ty = V->getType(); + if (Ty->isIntegral() && Ty->getPrimitiveSize() < 4) { if (Ty == Type::ShortTy) ArgVals.back().IntVal = ArgVals.back().ShortVal; else if (Ty == Type::UShortTy) @@ -667,7 +669,7 @@ void Interpreter::visitCallInst(CallInst &I) { // To handle indirect calls, we must get the pointer value from the argument // and treat it as a function pointer. - GenericValue SRC = getOperandValue(I.getCalledValue(), SF); + GenericValue SRC = getOperandValue(SF.Caller.getCalledValue(), SF); callFunction((Function*)GVTOP(SRC), ArgVals); } |