[cfe-commits] r130700 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGCall.h CGExprCXX.cpp
Eli Friedman
eli.friedman at gmail.com
Mon May 2 11:05:27 PDT 2011
Author: efriedma
Date: Mon May 2 13:05:27 2011
New Revision: 130700
URL: http://llvm.org/viewvc/llvm-project?rev=130700&view=rev
Log:
Switch CallArgList from an std::pair to a new CallArg struct (which will eventually gain more members). Working towards modifying call emission to avoid unnecessary copies.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGCall.h
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=130700&r1=130699&r2=130700&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon May 2 13:05:27 2011
@@ -218,7 +218,7 @@
llvm::SmallVector<CanQualType, 16> ArgTys;
for (CallArgList::const_iterator i = Args.begin(), e = Args.end();
i != e; ++i)
- ArgTys.push_back(Context.getCanonicalParamType(i->second));
+ ArgTys.push_back(Context.getCanonicalParamType(i->Ty));
return getFunctionInfo(GetReturnType(ResTy), ArgTys, Info);
}
@@ -1217,18 +1217,18 @@
for (CallArgList::const_iterator I = CallArgs.begin(), E = CallArgs.end();
I != E; ++I, ++info_it) {
const ABIArgInfo &ArgInfo = info_it->info;
- RValue RV = I->first;
+ RValue RV = I->RV;
unsigned Alignment =
- getContext().getTypeAlignInChars(I->second).getQuantity();
+ getContext().getTypeAlignInChars(I->Ty).getQuantity();
switch (ArgInfo.getKind()) {
case ABIArgInfo::Indirect: {
if (RV.isScalar() || RV.isComplex()) {
// Make a temporary alloca to pass the argument.
- Args.push_back(CreateMemTemp(I->second));
+ Args.push_back(CreateMemTemp(I->Ty));
if (RV.isScalar())
EmitStoreOfScalar(RV.getScalarVal(), Args.back(), false,
- Alignment, I->second);
+ Alignment, I->Ty);
else
StoreComplexToAddr(RV.getComplexVal(), Args.back(), false);
} else {
@@ -1255,11 +1255,10 @@
// FIXME: Avoid the conversion through memory if possible.
llvm::Value *SrcPtr;
if (RV.isScalar()) {
- SrcPtr = CreateMemTemp(I->second, "coerce");
- EmitStoreOfScalar(RV.getScalarVal(), SrcPtr, false, Alignment,
- I->second);
+ SrcPtr = CreateMemTemp(I->Ty, "coerce");
+ EmitStoreOfScalar(RV.getScalarVal(), SrcPtr, false, Alignment, I->Ty);
} else if (RV.isComplex()) {
- SrcPtr = CreateMemTemp(I->second, "coerce");
+ SrcPtr = CreateMemTemp(I->Ty, "coerce");
StoreComplexToAddr(RV.getComplexVal(), SrcPtr, false);
} else
SrcPtr = RV.getAggregateAddr();
@@ -1297,7 +1296,7 @@
}
case ABIArgInfo::Expand:
- ExpandTypeToArgs(I->second, RV, Args);
+ ExpandTypeToArgs(I->Ty, RV, Args);
break;
}
}
Modified: cfe/trunk/lib/CodeGen/CGCall.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.h?rev=130700&r1=130699&r2=130700&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.h (original)
+++ cfe/trunk/lib/CodeGen/CGCall.h Mon May 2 13:05:27 2011
@@ -44,13 +44,21 @@
namespace CodeGen {
typedef llvm::SmallVector<llvm::AttributeWithIndex, 8> AttributeListType;
+ struct CallArg {
+ RValue RV;
+ QualType Ty;
+ CallArg(RValue rv, QualType ty)
+ : RV(rv), Ty(ty)
+ { }
+ };
+
/// CallArgList - Type for representing both the value and type of
/// arguments in a call.
class CallArgList :
- public llvm::SmallVector<std::pair<RValue, QualType>, 16> {
+ public llvm::SmallVector<CallArg, 16> {
public:
void add(RValue rvalue, QualType type) {
- push_back(std::pair<RValue,QualType>(rvalue,type));
+ push_back(CallArg(rvalue, type));
}
};
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=130700&r1=130699&r2=130700&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Mon May 2 13:05:27 2011
@@ -931,7 +931,7 @@
E->getOperatorDelete(),
NewPtr, AllocSize);
for (unsigned I = 0, N = E->getNumPlacementArgs(); I != N; ++I)
- Cleanup->setPlacementArg(I, NewArgs[I+1].first);
+ Cleanup->setPlacementArg(I, NewArgs[I+1].RV);
return;
}
@@ -950,7 +950,7 @@
SavedAllocSize);
for (unsigned I = 0, N = E->getNumPlacementArgs(); I != N; ++I)
Cleanup->setPlacementArg(I,
- DominatingValue<RValue>::save(CGF, NewArgs[I+1].first));
+ DominatingValue<RValue>::save(CGF, NewArgs[I+1].RV));
CGF.ActivateCleanupBlock(CGF.EHStack.stable_begin());
}
More information about the cfe-commits
mailing list