From 7e1e57103e5bff82a3b009383c5c30bd3108744e Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 30 Aug 2008 16:17:45 +0000 Subject: [PATCH] Simplify some calls to Builder.CreateCall llvm-svn: 55567 --- clang/lib/CodeGen/CGBuiltin.cpp | 9 ++++----- clang/lib/CodeGen/CGExprAgg.cpp | 30 +++++++++++++----------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 1b6a3ff8a3da..e89997afa1b3 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -351,15 +351,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { 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); diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 11eb9fc11575..13c07c959655 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -125,15 +125,13 @@ void AggExprEmitter::EmitAggregateClear(llvm::Value *DestPtr, QualType Ty) { // 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 @@ void AggExprEmitter::EmitAggregateCopy(llvm::Value *DestPtr, // 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)); }