[llvm-commits] [parallel] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Interpreter.cpp Interpreter.h
Misha Brukman
brukman at cs.uiuc.edu
Mon Mar 1 18:02:14 PST 2004
Changes in directory llvm/lib/ExecutionEngine/Interpreter:
Execution.cpp updated: 1.121 -> 1.121.2.1
Interpreter.cpp updated: 1.20 -> 1.20.2.1
Interpreter.h updated: 1.59 -> 1.59.2.1
---
Log message:
Merge from trunk
---
Diffs of the changes: (+23 -17)
Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.121 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.121.2.1
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.121 Wed Jan 14 00:02:53 2004
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Mon Mar 1 17:58:13 2004
@@ -523,6 +523,10 @@
//===----------------------------------------------------------------------===//
void Interpreter::exitCalled(GenericValue GV) {
+ // runAtExitHandlers() assumes there are no stack frames, but
+ // if exit() was called, then it had a stack frame. Blow away
+ // the stack before interpreting atexit handlers.
+ ECStack.clear ();
runAtExitHandlers ();
exit (GV.IntVal);
}
@@ -589,8 +593,7 @@
InvokingSF.Caller = CallSite ();
// Go to exceptional destination BB of invoke instruction
- SwitchToNewBasicBlock (cast<InvokeInst> (Inst)->getExceptionalDest (),
- InvokingSF);
+ SwitchToNewBasicBlock(cast<InvokeInst>(Inst)->getUnwindDest(), InvokingSF);
}
void Interpreter::visitBranchInst(BranchInst &I) {
@@ -771,9 +774,13 @@
switch (F->getIntrinsicID()) {
case Intrinsic::not_intrinsic:
break;
- case Intrinsic::va_start: // va_start: implemented by getFirstVarArg()
- SetValue(CS.getInstruction(), getFirstVarArg(), SF);
+ case Intrinsic::va_start: { // va_start
+ GenericValue ArgIndex;
+ ArgIndex.UIntPairVal.first = ECStack.size() - 1;
+ ArgIndex.UIntPairVal.second = 0;
+ SetValue(CS.getInstruction(), ArgIndex, SF);
return;
+ }
case Intrinsic::va_end: // va_end is a noop for the interpreter
return;
case Intrinsic::va_copy: // va_copy: dest = src
@@ -957,14 +964,12 @@
void Interpreter::visitVANextInst(VANextInst &I) {
ExecutionContext &SF = ECStack.back();
- // Get the incoming valist parameter. LLI treats the valist as a pointer
- // to the next argument.
+ // Get the incoming valist parameter. LLI treats the valist as a
+ // (ec-stack-depth var-arg-index) pair.
GenericValue VAList = getOperandValue(I.getOperand(0), SF);
// Move the pointer to the next vararg.
- GenericValue *ArgPtr = (GenericValue *) GVTOP (VAList);
- ++ArgPtr;
- VAList = PTOGV (ArgPtr);
+ ++VAList.UIntPairVal.second;
SetValue(&I, VAList, SF);
}
@@ -974,11 +979,12 @@
void Interpreter::visitVAArgInst(VAArgInst &I) {
ExecutionContext &SF = ECStack.back();
- // Get the incoming valist parameter. LLI treats the valist as a pointer
- // to the next argument.
+ // Get the incoming valist parameter. LLI treats the valist as a
+ // (ec-stack-depth var-arg-index) pair.
GenericValue VAList = getOperandValue(I.getOperand(0), SF);
- assert (GVTOP (VAList) != 0 && "VAList was null in vaarg instruction");
- GenericValue Dest, Src = *(GenericValue *) GVTOP (VAList);
+ GenericValue Dest;
+ GenericValue Src = ECStack[VAList.UIntPairVal.first]
+ .VarArgs[VAList.UIntPairVal.second];
const Type *Ty = I.getType();
switch (Ty->getPrimitiveID()) {
IMPLEMENT_VAARG(UByte);
Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.20 llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.20.2.1
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.20 Sun Dec 28 03:44:37 2003
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp Mon Mar 1 17:58:13 2004
@@ -89,9 +89,9 @@
// take into account gratuitous differences in declared types,
// though.
std::vector<GenericValue> ActualArgs;
- const unsigned ArgCount = F->getFunctionType()->getParamTypes().size();
+ const unsigned ArgCount = F->getFunctionType()->getNumParams();
for (unsigned i = 0; i < ArgCount; ++i)
- ActualArgs.push_back (ArgValues[i]);
+ ActualArgs.push_back(ArgValues[i]);
// Set up the function call.
callFunction(F, ActualArgs);
Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.59 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.59.2.1
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.59 Sun Dec 28 03:44:37 2003
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h Mon Mar 1 17:58:13 2004
@@ -24,7 +24,7 @@
namespace llvm {
-struct FunctionInfo; // Defined in ExecutionAnnotations.h
+struct FunctionInfo;
class gep_type_iterator;
class ConstantExpr;
@@ -159,7 +159,7 @@
}
GenericValue *getFirstVarArg () {
- return &(ECStack[ECStack.size () - 2].VarArgs[0]);
+ return &(ECStack.back ().VarArgs[0]);
}
//FIXME: private:
More information about the llvm-commits
mailing list