[llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Wed Jun 22 14:04:57 PDT 2005



Changes in directory llvm/lib/Bytecode/Reader:

ReaderWrappers.cpp updated: 1.49 -> 1.50
---
Log message:

If we support structs as va_list, we must pass pointers to them to va_copy
See last commit for LangRef, this implements it on all targets.




---
Diffs of the changes:  (+8 -4)

 ReaderWrappers.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)


Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp
diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.49 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.50
--- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.49	Sun Jun 19 09:04:55 2005
+++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp	Wed Jun 22 16:04:42 2005
@@ -221,20 +221,24 @@
     //foo = vacopy(bar)
     // ->
     //a = alloca 1 of typeof(foo)
-    //vacopy(a, bar)
+    //b = alloca 1 of typeof(foo)
+    //store bar -> b
+    //vacopy(a, b)
     //foo = load a
     
     const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
     const Type* ArgTy = F->getFunctionType()->getReturnType();
     const Type* ArgTyPtr = PointerType::get(ArgTy);
     Function* NF = M->getOrInsertFunction("llvm.va_copy", 
-                                          RetTy, ArgTyPtr, ArgTy, 0);
+                                          RetTy, ArgTyPtr, ArgTyPtr, 0);
     
     for(Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E;)
       if (CallInst* CI = dyn_cast<CallInst>(*I++)) {
         AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
-        new CallInst(NF, a, CI->getOperand(1), "", CI);
-        Value* foo = new LoadInst(a, "vacopy.fix.2", CI);
+        AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
+        new StoreInst(CI->getOperand(1), b, CI);
+        new CallInst(NF, a, b, "", CI);
+        Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
         CI->replaceAllUsesWith(foo);
         CI->getParent()->getInstList().erase(CI);
       }






More information about the llvm-commits mailing list