[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp ExternalFunctions.cpp Interpreter.h

Chris Lattner lattner at cs.uiuc.edu
Sat Oct 18 00:56:01 PDT 2003


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Execution.cpp updated: 1.100 -> 1.101
ExternalFunctions.cpp updated: 1.63 -> 1.64
Interpreter.h updated: 1.43 -> 1.44

---
Log message:

Interpret the new varargs intrinsics correctly


---
Diffs of the changes:  (+13 -28)

Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.100 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.101
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.100	Fri Oct 10 12:42:19 2003
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp	Sat Oct 18 00:55:25 2003
@@ -845,27 +845,17 @@
   SetValue(&I, executeCastOperation(I.getOperand(0), I.getType(), SF), SF);
 }
 
-void Interpreter::visitVarArgInst(VarArgInst &I) {
+void Interpreter::visitVANextInst(VANextInst &I) {
   ExecutionContext &SF = ECStack.back();
 
-  // Get the pointer to the valist element.  LLI treats the valist in memory as
-  // an integer.
-  GenericValue VAListPtr = getOperandValue(I.getOperand(0), SF);
-
-  // Load the pointer
-  GenericValue VAList = 
-    TheEE->LoadValueFromMemory((GenericValue *)GVTOP(VAListPtr), Type::UIntTy);
-
+  // Get the incoming valist element.  LLI treats the valist as an integer.
+  GenericValue VAList = getOperandValue(I.getOperand(0), SF);
+  
+  // Move to the next operand.
   unsigned Argument = VAList.IntVal++;
-
-  // Update the valist to point to the next argument...
-  TheEE->StoreValueToMemory(VAList, (GenericValue *)GVTOP(VAListPtr),
-                            Type::UIntTy);
-
-  // Set the value...
   assert(Argument < SF.VarArgs.size() &&
          "Accessing past the last vararg argument!");
-  SetValue(&I, SF.VarArgs[Argument], SF);
+  SetValue(&I, VAList, SF);
 }
 
 //===----------------------------------------------------------------------===//


Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.63 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.64
--- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.63	Tue Oct 14 16:42:11 2003
+++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp	Sat Oct 18 00:55:25 2003
@@ -687,14 +687,12 @@
 // LLVM Intrinsic Functions...
 //===----------------------------------------------------------------------===//
 
-// void llvm.va_start(<va_list> *) - Implement the va_start operation...
+// <va_list> llvm.va_start() - Implement the va_start operation...
 GenericValue llvm_va_start(FunctionType *F, const vector<GenericValue> &Args) {
-  assert(Args.size() == 1);
-  GenericValue *VAListP = (GenericValue *)GVTOP(Args[0]);
+  assert(Args.size() == 0);
   GenericValue Val;
   Val.UIntVal = 0;   // Start at the first '...' argument...
-  TheInterpreter->StoreValueToMemory(Val, VAListP, Type::UIntTy);
-  return GenericValue();
+  return Val;
 }
 
 // void llvm.va_end(<va_list> *) - Implement the va_end operation...
@@ -703,13 +701,10 @@
   return GenericValue();    // Noop!
 }
 
-// void llvm.va_copy(<va_list> *, <va_list>) - Implement the va_copy
-// operation...
+// <va_list> llvm.va_copy(<va_list>) - Implement the va_copy operation...
 GenericValue llvm_va_copy(FunctionType *F, const vector<GenericValue> &Args) {
-  assert(Args.size() == 2);
-  GenericValue *DestVAList = (GenericValue*)GVTOP(Args[0]);
-  TheInterpreter->StoreValueToMemory(Args[1], DestVAList, Type::UIntTy);
-  return GenericValue();
+  assert(Args.size() == 1);
+  return Args[0];
 }
 
 } // End extern "C"


Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.43 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.44
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.43	Wed Sep 17 12:26:22 2003
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h	Sat Oct 18 00:55:25 2003
@@ -131,7 +131,7 @@
   void visitCallInst(CallInst &I);
   void visitShl(ShiftInst &I);
   void visitShr(ShiftInst &I);
-  void visitVarArgInst(VarArgInst &I);
+  void visitVANextInst(VANextInst &I);
   void visitInstruction(Instruction &I) {
     std::cerr << I;
     assert(0 && "Instruction not interpretable yet!");





More information about the llvm-commits mailing list