Author: greened Date: Tue Jul 31 22:44:20 2007 New Revision: 40661 URL: http://llvm.org/viewvc/llvm-project?rev=40661&view=rev Log:
Updates to CallInst constructor clients to address GLIBCXX_DEBUG errors. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-debug.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=40661&r1=40660&r2=40661&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Tue Jul 31 22:44:20 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.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=40661&r1=40660&r2=40661&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Tue Jul 31 22:44:20 2007 @@ -724,7 +724,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); @@ -1273,7 +1273,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, @@ -1289,7 +1289,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, @@ -1306,7 +1306,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); } @@ -1440,7 +1440,7 @@ lineNo }; - Builder.CreateCall(annotateFun, Ops, 4); + Builder.CreateCall(annotateFun, Ops, Ops+4); } // Get next annotate attribute. @@ -2041,7 +2041,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); } @@ -2321,7 +2321,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"); @@ -2346,7 +2346,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"); @@ -2766,7 +2766,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"); @@ -3608,7 +3608,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 @@ -4013,7 +4013,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. @@ -4334,7 +4334,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; @@ -4387,8 +4387,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"); } @@ -4521,7 +4524,7 @@ Value *Ops[3] = { Ptr, ReadWrite, Locality }; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::prefetch), - Ops, 3); + Ops, Ops+3); return true; } @@ -4681,9 +4684,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("")); @@ -4855,11 +4861,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; } @@ -4884,7 +4891,7 @@ Function *Intr = Intrinsic::getDeclaration(TheModule, Intrinsic::init_trampoline); - Builder.CreateCall(Intr, Ops, 3); + Builder.CreateCall(Intr, Ops, Ops+3); return true; } Modified: llvm-gcc-4.0/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-debug.cpp?rev=40661&r1=40660&r2=40661&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-debug.cpp Tue Jul 31 22:44:20 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. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits