[cfe-commits] r55567 - in /cfe/trunk/lib/CodeGen: CGBuiltin.cpp CGExprAgg.cpp
Anders Carlsson
andersca at mac.com
Sat Aug 30 09:17:46 PDT 2008
Author: andersca
Date: Sat Aug 30 11:17:45 2008
New Revision: 55567
URL: http://llvm.org/viewvc/llvm-project?rev=55567&view=rev
Log:
Simplify some calls to Builder.CreateCall
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=55567&r1=55566&r2=55567&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sat Aug 30 11:17:45 2008
@@ -351,15 +351,14 @@
case Builtin::BI__sync_fetch_and_xor:
return EmitBinaryAtomic(*this, Intrinsic::atomic_load_xor, E);
case Builtin::BI__sync_val_compare_and_swap: {
- Value *Args[3];
- Args[0]= EmitScalarExpr(E->getArg(0));
- Args[1] = EmitScalarExpr(E->getArg(1));
- Args[2] = EmitScalarExpr(E->getArg(2));
const llvm::Type *ResType[2];
ResType[0]= ConvertType(E->getType());
ResType[1] = ConvertType(E->getArg(0)->getType());
Value *AtomF = CGM.getIntrinsic(Intrinsic::atomic_cmp_swap, ResType, 2);
- return RValue::get(Builder.CreateCall(AtomF, &Args[0], &Args[1]+2));
+ return RValue::get(Builder.CreateCall3(AtomF,
+ EmitScalarExpr(E->getArg(0)),
+ EmitScalarExpr(E->getArg(1)),
+ EmitScalarExpr(E->getArg(2))));
}
case Builtin::BI__sync_lock_test_and_set:
return EmitBinaryAtomic(*this, Intrinsic::atomic_swap, E);
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=55567&r1=55566&r2=55567&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sat Aug 30 11:17:45 2008
@@ -125,15 +125,13 @@
// FIXME: Handle variable sized types.
const llvm::Type *IntPtr = llvm::IntegerType::get(CGF.LLVMPointerWidth);
- llvm::Value *MemSetOps[4] = {
- DestPtr,
- llvm::ConstantInt::getNullValue(llvm::Type::Int8Ty),
- // TypeInfo.first describes size in bits.
- llvm::ConstantInt::get(IntPtr, TypeInfo.first/8),
- llvm::ConstantInt::get(llvm::Type::Int32Ty, TypeInfo.second/8)
- };
-
- Builder.CreateCall(CGF.CGM.getMemSetFn(), MemSetOps, MemSetOps+4);
+ Builder.CreateCall4(CGF.CGM.getMemSetFn(),
+ DestPtr,
+ llvm::ConstantInt::getNullValue(llvm::Type::Int8Ty),
+ // TypeInfo.first describes size in bits.
+ llvm::ConstantInt::get(IntPtr, TypeInfo.first/8),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty,
+ TypeInfo.second/8));
}
void AggExprEmitter::EmitAggregateCopy(llvm::Value *DestPtr,
@@ -153,14 +151,12 @@
// FIXME: Handle variable sized types.
const llvm::Type *IntPtr = llvm::IntegerType::get(CGF.LLVMPointerWidth);
- llvm::Value *MemMoveOps[4] = {
- DestPtr, SrcPtr,
- // TypeInfo.first describes size in bits.
- llvm::ConstantInt::get(IntPtr, TypeInfo.first/8),
- llvm::ConstantInt::get(llvm::Type::Int32Ty, TypeInfo.second/8)
- };
-
- Builder.CreateCall(CGF.CGM.getMemMoveFn(), MemMoveOps, MemMoveOps+4);
+ Builder.CreateCall4(CGF.CGM.getMemMoveFn(),
+ DestPtr, SrcPtr,
+ // TypeInfo.first describes size in bits.
+ llvm::ConstantInt::get(IntPtr, TypeInfo.first/8),
+ llvm::ConstantInt::get(llvm::Type::Int32Ty,
+ TypeInfo.second/8));
}
More information about the cfe-commits
mailing list