[llvm-commits] [llvm-gcc-4.2] r40662 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp llvm-convert.cpp llvm-debug.cpp

David Greene greened at obbligato.org
Tue Jul 31 20:46:49 PDT 2007


Author: greened
Date: Tue Jul 31 22:46:49 2007
New Revision: 40662

URL: http://llvm.org/viewvc/llvm-project?rev=40662&view=rev
Log:

Update CallInst constructor clients to address GLIBCXX_DEBUG errors.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=40662&r1=40661&r2=40662&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Jul 31 22:46:49 2007
@@ -79,7 +79,7 @@
     Function *psllw =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psll_w);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(psllw, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psllw, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -88,7 +88,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psll_w);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(psllw, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psllw, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -96,7 +96,7 @@
     Function *pslld =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psll_d);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(pslld, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(pslld, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -105,7 +105,7 @@
       = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psll_d);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(pslld, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(pslld, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -113,7 +113,7 @@
     Function *psllq =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psll_q);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(psllq, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psllq, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -122,7 +122,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psll_q);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(psllq, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psllq, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -130,7 +130,7 @@
     Function *psrlw =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psrl_w);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(psrlw, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrlw, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -139,7 +139,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psrl_w);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(psrlw, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrlw, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -147,7 +147,7 @@
     Function *psrld =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psrl_d);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(psrld, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrld, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -156,7 +156,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psrl_d);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(psrld, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrld, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -164,7 +164,7 @@
     Function *psrlq =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psrl_q);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(psrlq, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrlq, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -173,7 +173,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psrl_q);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(psrlq, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrlq, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -181,7 +181,7 @@
     Function *psraw =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psra_w);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(psraw, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psraw, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -190,7 +190,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psra_w);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(psraw, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psraw, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -198,7 +198,7 @@
     Function *psrad =
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psra_d);
     Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL);
-    Result = Builder.CreateCall(psrad, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrad, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -207,7 +207,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psra_d);
     Value *Undef = UndefValue::get(Type::Int32Ty);
     Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL);
-    Result = Builder.CreateCall(psrad, Ops[0], Ops[1], "tmp");
+    Result = Builder.CreateCall(psrad, Ops.begin(), Ops.begin()+2, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -489,7 +489,7 @@
     Value *Arg1 = Ops[1];
     if (flip) std::swap(Arg0, Arg1);
     Value *CallOps[3] = { Arg0, Arg1, Pred };
-    Result = Builder.CreateCall(cmpps, CallOps, 3, "tmp");
+    Result = Builder.CreateCall(cmpps, CallOps, CallOps+3, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -519,7 +519,7 @@
     }
     Value *Pred = ConstantInt::get(Type::Int8Ty, PredCode);
     Value *CallOps[3] = { Ops[0], Ops[1], Pred };
-    Result = Builder.CreateCall(cmpss, CallOps, 3, "tmp");
+    Result = Builder.CreateCall(cmpss, CallOps, CallOps+3, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -560,7 +560,7 @@
     if (flip) std::swap(Arg0, Arg1);
 
     Value *CallOps[3] = { Arg0, Arg1, Pred };
-    Result = Builder.CreateCall(cmppd, CallOps, 3, "tmp");
+    Result = Builder.CreateCall(cmppd, CallOps, CallOps+3, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
@@ -588,7 +588,7 @@
     }
     Value *Pred = ConstantInt::get(Type::Int8Ty, PredCode);
     Value *CallOps[3] = { Ops[0], Ops[1], Pred };
-    Result = Builder.CreateCall(cmpsd, CallOps, 3, "tmp");
+    Result = Builder.CreateCall(cmpsd, CallOps, CallOps+3, "tmp");
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=40662&r1=40661&r2=40662&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jul 31 22:46:49 2007
@@ -739,7 +739,7 @@
     if (ExceptionValue) {
       // Fetch and store exception handler.
       Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr");
-      Builder.CreateCall(FuncUnwindResume, &Arg, 1);
+      Builder.CreateCall(FuncUnwindResume, Arg);
       Builder.CreateUnreachable();
     } else {
       new UnwindInst(UnwindBB);
@@ -1320,7 +1320,7 @@
 
   Intrinsic::ID IID = 
     (IntPtr == Type::Int32Ty) ? Intrinsic::memcpy_i32 : Intrinsic::memcpy_i64;
-  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, 4);
+  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4);
 }
 
 void TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, 
@@ -1336,7 +1336,7 @@
 
   Intrinsic::ID IID = 
     (IntPtr == Type::Int32Ty) ? Intrinsic::memmove_i32 : Intrinsic::memmove_i64;
-  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, 4);
+  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4);
 }
 
 void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, 
@@ -1353,7 +1353,7 @@
   Intrinsic::ID IID = 
     (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : Intrinsic::memset_i64;
   
-  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, 4);
+  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4);
 }
 
 
@@ -1487,7 +1487,7 @@
         lineNo
       };
       
-      Builder.CreateCall(annotateFun, Ops, 4);
+      Builder.CreateCall(annotateFun, Ops, Ops+4);
     }
     
     // Get next annotate attribute.
@@ -2091,7 +2091,7 @@
     }
   }
 
-  Value *Select = Builder.CreateCall(FuncEHSelector, &Args[0], Args.size(),
+  Value *Select = Builder.CreateCall(FuncEHSelector, Args.begin(), Args.end(),
                                      "eh_select");
   Builder.CreateStore(Select, ExceptionSelectorValue);
 }
@@ -2371,7 +2371,7 @@
     TypeInfo = BitCastToType(TypeInfo, PointerType::get(Type::Int8Ty));
 
     // Call get eh type id.
-    Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &TypeInfo, 1,
+    Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, TypeInfo,
                                        "eh_typeid");
     Value *Select = Builder.CreateLoad(ExceptionSelectorValue, "tmp");
 
@@ -2396,7 +2396,7 @@
       TypeInfo = BitCastToType(TypeInfo, PointerType::get(Type::Int8Ty));
 
       // Call get eh type id.
-      Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &TypeInfo, 1,
+      Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, TypeInfo,
                                          "eh_typeid");
       Value *Select = Builder.CreateLoad(ExceptionSelectorValue, "tmp");
 
@@ -2810,7 +2810,7 @@
   
   Value *Call;
   if (!UnwindBlock) {
-    Call = Builder.CreateCall(Callee, &CallOperands[0], CallOperands.size());
+    Call = Builder.CreateCall(Callee, CallOperands.begin(), CallOperands.end());
     cast<CallInst>(Call)->setCallingConv(CallingConvention);
   } else {
     BasicBlock *NextBlock = new BasicBlock("invcont");
@@ -3652,7 +3652,7 @@
   
   const char *Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl));
   InlineAsm *IA = InlineAsm::get(FTy, "", "{"+std::string(Name)+"}", true);
-  Builder.CreateCall(IA, &RHS, 1);
+  Builder.CreateCall(IA, RHS);
 }
 
 /// ConvertInlineAsmStr - Convert the specified inline asm string to an LLVM
@@ -4058,7 +4058,7 @@
   
   Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr,
                               ASM_VOLATILE_P(exp) || !ASM_OUTPUTS(exp));   
-  CallInst *CV = Builder.CreateCall(Asm, &CallOps[0], CallOps.size(),
+  CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(),
                                     StoreCallResultAddr ? "tmp" : "");
   
   // If the call produces a value, store it into the destination.
@@ -4381,7 +4381,7 @@
     InVal->getType()
   };
   Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, Tys, 
-                                                    sizeof(Tys)/sizeof(Tys[0])),
+                                                        sizeof(Tys)/sizeof(Tys[0])),
                               InVal, "tmp");
   
   return true;
@@ -4434,8 +4434,11 @@
   case Type::DoubleTyID: Id = Intrinsic::powi_f64; break;
   }
   
+  SmallVector<Value *,2> Args;
+  Args.push_back(Val);
+  Args.push_back(Pow);
   return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id),
-                            Val, Pow, "tmp");
+                            Args.begin(), Args.end(), "tmp");
 }
 
 
@@ -4558,7 +4561,7 @@
   
   Value *Ops[3] = { Ptr, ReadWrite, Locality };
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::prefetch),
-                     Ops, 3);
+                     Ops, Ops+3);
   return true;
 }
 
@@ -4720,9 +4723,12 @@
   Handler = CastToType(Instruction::BitCast, Handler,
                        PointerType::get(Type::Int8Ty));
 
+  SmallVector<Value *, 2> Args;
+  Args.push_back(Offset);
+  Args.push_back(Handler);
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                Intrinsic::eh_return),
-                     Offset, Handler);
+                     Args.begin(), Args.end());
   Result = Builder.CreateUnreachable();
   EmitBlock(new BasicBlock(""));
 
@@ -4897,11 +4903,12 @@
   
   static const Type *VPTy = PointerType::get(Type::Int8Ty);
 
-  Arg1 = CastToType(Instruction::BitCast, Arg1, VPTy);
-  Arg2 = CastToType(Instruction::BitCast, Arg2, VPTy);
+  SmallVector<Value *, 2> Args;
+  Args.push_back(CastToType(Instruction::BitCast, Arg1, VPTy));
+  Args.push_back(CastToType(Instruction::BitCast, Arg2, VPTy));
   
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::vacopy),
-                     Arg1, Arg2);
+                     Args.begin(), Args.end());
   return true;
 }
 

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=40662&r1=40661&r2=40662&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Tue Jul 31 22:46:49 2007
@@ -36,6 +36,7 @@
 #include "llvm/Support/Dwarf.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 
 #include <iostream>
@@ -346,7 +347,10 @@
   Value *AllocACast = new BitCastInst(AI, EmpPtr, Name, CurBB);
 
   // Call llvm.dbg.declare.
-  new CallInst(DeclareFn, AllocACast, getCastValueFor(Variable), "", CurBB);
+  SmallVector<Value *, 2> Args;
+  Args.push_back(AllocACast);
+  Args.push_back(getCastValueFor(Variable));
+  new CallInst(DeclareFn, Args.begin(), Args.end(), "", CurBB);
 }
 
 /// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of 
@@ -377,7 +381,7 @@
     ConstantInt::get(Type::Int32Ty, 0),
     getCastValueFor(Unit)
   };
-  new CallInst(StopPointFn, Args, 3, "", CurBB);
+  new CallInst(StopPointFn, Args, Args+3, "", CurBB);
 }
 
 /// EmitGlobalVariable - Emit information about a global variable.





More information about the llvm-commits mailing list