[cfe-commits] r41467 - /cfe/trunk/CodeGen/CGExpr.cpp
Chris Lattner
sabre at nondot.org
Sun Aug 26 15:55:13 PDT 2007
Author: lattner
Date: Sun Aug 26 17:55:13 2007
New Revision: 41467
URL: http://llvm.org/viewvc/llvm-project?rev=41467&view=rev
Log:
eliminate use of EmitAnyExpr.
Modified:
cfe/trunk/CodeGen/CGExpr.cpp
Modified: cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExpr.cpp?rev=41467&r1=41466&r2=41467&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Sun Aug 26 17:55:13 2007
@@ -428,27 +428,35 @@
for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
QualType ArgTy = E->getArg(i)->getType();
- RValue ArgVal = EmitAnyExpr(E->getArg(i));
- // If this argument has prototype information, convert it.
- if (ArgTyIt == ArgTyEnd) {
- // Otherwise, if passing through "..." or to a function with no prototype,
- // perform the "default argument promotions" (C99 6.5.2.2p6), which
- // includes the usual unary conversions, but also promotes float to
- // double.
- // FIXME: remove this when the impcast is in place.
- if (const BuiltinType *BT =
- dyn_cast<BuiltinType>(ArgTy.getCanonicalType())) {
- if (BT->getKind() == BuiltinType::Float)
- ArgVal = RValue::get(Builder.CreateFPExt(ArgVal.getVal(),
- llvm::Type::DoubleTy,"tmp"));
+ if (!hasAggregateLLVMType(ArgTy)) {
+ // Scalar argument is passed by-value.
+ Args.push_back(EmitScalarExpr(E->getArg(i)));
+
+ if (ArgTyIt == ArgTyEnd) {
+ // Otherwise, if passing through "..." or to a function with no prototype,
+ // perform the "default argument promotions" (C99 6.5.2.2p6), which
+ // includes the usual unary conversions, but also promotes float to
+ // double.
+ // FIXME: remove this when the impcast is in place.
+ if (Args.back()->getType() == llvm::Type::FloatTy)
+ Args.back() = Builder.CreateFPExt(Args.back(), llvm::Type::DoubleTy,
+ "tmp");
+ // FIXME: Remove ArgIt when this is gone.
}
+ } else if (ArgTy->isComplexType()) {
+ // Make a temporary alloca to pass the argument.
+ llvm::Value *DestMem = CreateTempAlloca(ConvertType(ArgTy));
+ EmitComplexExprIntoAddr(E->getArg(i), DestMem, false);
+ Args.push_back(DestMem);
+ } else {
+ llvm::Value *DestMem = CreateTempAlloca(ConvertType(ArgTy));
+ EmitAggExpr(E->getArg(i), DestMem, false);
+ Args.push_back(DestMem);
}
- if (ArgVal.isScalar())
- Args.push_back(ArgVal.getVal());
- else // Pass by-address. FIXME: Set attribute bit on call.
- Args.push_back(ArgVal.getAggregateAddr());
+ if (ArgTyIt != ArgTyEnd)
+ ++ArgTyIt;
}
llvm::Value *V = Builder.CreateCall(Callee, &Args[0], &Args[0]+Args.size());
More information about the cfe-commits
mailing list