[cfe-commits] r50694 - in /cfe/trunk/lib/CodeGen: CGBuiltin.cpp CGExprAgg.cpp CGObjCEtoile.cpp CGObjCGNU.cpp
Chris Lattner
sabre at nondot.org
Mon May 5 17:56:43 PDT 2008
Author: lattner
Date: Mon May 5 19:56:42 2008
New Revision: 50694
URL: http://llvm.org/viewvc/llvm-project?rev=50694&view=rev
Log:
simplify some builder calls.
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGObjCEtoile.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=50694&r1=50693&r2=50694&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon May 5 19:56:42 2008
@@ -140,9 +140,8 @@
DstPtr = Builder.CreateBitCast(DstPtr, Type);
SrcPtr = Builder.CreateBitCast(SrcPtr, Type);
- Value *Args[] = { DstPtr, SrcPtr };
- return RValue::get(Builder.CreateCall(CGM.getIntrinsic(Intrinsic::vacopy),
- &Args[0], &Args[2]));
+ return RValue::get(Builder.CreateCall2(CGM.getIntrinsic(Intrinsic::vacopy),
+ DstPtr, SrcPtr));
}
case Builtin::BI__builtin_classify_type: {
APSInt Result(32);
@@ -559,18 +558,16 @@
llvm::Type *PtrTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
Value *One = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
Value *Tmp = Builder.CreateAlloca(llvm::Type::Int32Ty, One, "tmp");
- One = Builder.CreateBitCast(Tmp, PtrTy);
Builder.CreateStore(Ops[0], Tmp);
return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse_ldmxcsr),
- &One, &One+1);
+ Builder.CreateBitCast(Tmp, PtrTy));
}
case X86::BI__builtin_ia32_stmxcsr: {
llvm::Type *PtrTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
Value *One = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
Value *Tmp = Builder.CreateAlloca(llvm::Type::Int32Ty, One, "tmp");
- One = Builder.CreateBitCast(Tmp, PtrTy);
One = Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse_stmxcsr),
- &One, &One+1);
+ Builder.CreateBitCast(Tmp, PtrTy));
return Builder.CreateLoad(Tmp, "stmxcsr");
}
case X86::BI__builtin_ia32_cmpordps:
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=50694&r1=50693&r2=50694&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Mon May 5 19:56:42 2008
@@ -330,14 +330,10 @@
const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
llvm::Value* DestPtr = Builder.CreateBitCast(LV.getAddress(), BP, "tmp");
-
- llvm::Value *MemSetOps[4] = {
- DestPtr, llvm::ConstantInt::get(llvm::Type::Int8Ty, 0),
- llvm::ConstantInt::get(llvm::Type::Int64Ty, Size/8),
- llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)
- };
-
- Builder.CreateCall(MemSet, MemSetOps, MemSetOps+4);
+ Builder.CreateCall4(MemSet, DestPtr,
+ llvm::ConstantInt::get(llvm::Type::Int8Ty, 0),
+ llvm::ConstantInt::get(llvm::Type::Int64Ty, Size/8),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
}
}
Modified: cfe/trunk/lib/CodeGen/CGObjCEtoile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCEtoile.cpp?rev=50694&r1=50693&r2=50694&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCEtoile.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCEtoile.cpp Mon May 5 19:56:42 2008
@@ -131,10 +131,7 @@
PtrToInt8Ty,
PtrToInt8Ty,
NULL);
- llvm::SmallVector<llvm::Value*, 2> Args;
- Args.push_back(SelName);
- Args.push_back(SelTypes);
- return Builder.CreateCall(SelFunction, Args.begin(), Args.end());
+ return Builder.CreateCall2(SelFunction, SelName, SelTypes);
}
static void SetField(llvm::IRBuilder &Builder, llvm::Value *Structure,
@@ -180,9 +177,8 @@
LookupArgs.push_back(Receiver);
LookupArgs.push_back(cmd);
LookupArgs.push_back(Sender);
- llvm::Value *Slot = Builder.CreateCall(Lookup,
- LookupArgs.begin(),
- LookupArgs.end());
+ llvm::Value *Slot = Builder.CreateCall(Lookup, LookupArgs.begin(),
+ LookupArgs.end());
// Create the call structure
llvm::Value *Call = Builder.CreateAlloca(CallTy);
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=50694&r1=50693&r2=50694&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon May 5 19:56:42 2008
@@ -108,8 +108,7 @@
PtrToInt8Ty,
PtrToInt8Ty,
NULL);
- llvm::Value *Args[] = { SelName, SelTypes };
- cmd = Builder.CreateCall(SelFunction, Args, Args+2);
+ cmd = Builder.CreateCall2(SelFunction, SelName, SelTypes);
}
return cmd;
}
@@ -142,13 +141,12 @@
TheModule.getOrInsertFunction("objc_msg_lookup",
llvm::PointerType::getUnqual(impType),
Receiver->getType(), SelectorTy, NULL);
+ llvm::Value *imp = Builder.CreateCall2(lookupFunction, Receiver, cmd);
+
+ // Call the method.
llvm::SmallVector<llvm::Value*, 16> lookupArgs;
lookupArgs.push_back(Receiver);
lookupArgs.push_back(cmd);
- llvm::Value *imp = Builder.CreateCall(lookupFunction,
- lookupArgs.begin(), lookupArgs.end());
-
- // Call the method.
lookupArgs.insert(lookupArgs.end(), ArgV, ArgV+ArgC);
return Builder.CreateCall(imp, lookupArgs.begin(), lookupArgs.end());
}
More information about the cfe-commits
mailing list