aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-02-03 05:59:18 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-02-03 05:59:18 +0000
commitb225be44aaab85a603e80dbe0eb3d81638b20d23 (patch)
tree29cadbd21f531662196dda93a33d301206d98a2b /lib/CodeGen/CGCall.cpp
parent88c2fa96be989571b4afb6229f0ef5a3ef4450cb (diff)
Always use CGFunctionInfo to access ABI information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r--lib/CodeGen/CGCall.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index dfbd7bfce0..b3237c96ec 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -819,7 +819,7 @@ static llvm::Value *CreateCoercedLoad(llvm::Value *SrcPtr,
uint64_t SrcSize = CGF.CGM.getTargetData().getTypePaddedSize(SrcTy);
uint64_t DstSize = CGF.CGM.getTargetData().getTypePaddedSize(Ty);
- // If load is legal, just bitcase the src pointer.
+ // If load is legal, just bitcast the src pointer.
if (SrcSize == DstSize) {
llvm::Value *Casted =
CGF.Builder.CreateBitCast(SrcPtr, llvm::PointerType::getUnqual(Ty));
@@ -873,7 +873,7 @@ static void CreateCoercedStore(llvm::Value *Src,
/***/
bool CodeGenModule::ReturnTypeUsesSret(const CGFunctionInfo &FI) {
- return getABIReturnInfo(FI.getReturnType(), getTypes()).isStructRet();
+ return FI.getReturnInfo().isStructRet();
}
const llvm::FunctionType *
@@ -883,7 +883,7 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) {
const llvm::Type *ResultType = 0;
QualType RetTy = FI.getReturnType();
- ABIArgInfo RetAI = getABIReturnInfo(RetTy, *this);
+ const ABIArgInfo &RetAI = FI.getReturnInfo();
switch (RetAI.getKind()) {
case ABIArgInfo::ByVal:
case ABIArgInfo::Expand:
@@ -964,7 +964,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
QualType RetTy = FI.getReturnType();
unsigned Index = 1;
- ABIArgInfo RetAI = getABIReturnInfo(RetTy, getTypes());
+ const ABIArgInfo &RetAI = FI.getReturnInfo();
switch (RetAI.getKind()) {
case ABIArgInfo::Default:
if (RetTy->isPromotableIntegerType()) {
@@ -1055,12 +1055,13 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
AI->setName("agg.result");
++AI;
}
-
+
+ CGFunctionInfo::const_arg_iterator info_it = FI.arg_begin();
for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
- i != e; ++i) {
+ i != e; ++i, ++info_it) {
const VarDecl *Arg = i->first;
- QualType Ty = i->second;
- ABIArgInfo ArgI = getABIArgumentInfo(Ty, CGM.getTypes());
+ QualType Ty = info_it->type;
+ const ABIArgInfo &ArgI = info_it->info;
switch (ArgI.getKind()) {
case ABIArgInfo::ByVal:
@@ -1077,7 +1078,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
}
case ABIArgInfo::Expand: {
- // If this was structure was expand into multiple arguments then
+ // If this structure was expanded into multiple arguments then
// we need to create a temporary and reconstruct it from the
// arguments.
std::string Name = Arg->getNameAsString();
@@ -1115,7 +1116,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,
// Functions with no result always return void.
if (ReturnValue) {
QualType RetTy = FI.getReturnType();
- ABIArgInfo RetAI = getABIReturnInfo(RetTy, CGM.getTypes());
+ const ABIArgInfo &RetAI = FI.getReturnInfo();
switch (RetAI.getKind()) {
case ABIArgInfo::StructRet:
@@ -1164,7 +1165,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
// Handle struct-return functions by passing a pointer to the
// location that we would like to return into.
QualType RetTy = CallInfo.getReturnType();
- ABIArgInfo RetAI = getABIReturnInfo(RetTy, CGM.getTypes());
+ const ABIArgInfo &RetAI = CallInfo.getReturnInfo();
switch (RetAI.getKind()) {
case ABIArgInfo::StructRet:
// Create a temporary alloca to hold the result of the call. :(
@@ -1178,12 +1179,13 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
case ABIArgInfo::ByVal:
case ABIArgInfo::Expand:
- assert(0 && "Invalid ABI kind for return argument");
+ assert(0 && "Invalid ABI kind for return argument");
}
+ CGFunctionInfo::const_arg_iterator info_it = CallInfo.arg_begin();
for (CallArgList::const_iterator I = CallArgs.begin(), E = CallArgs.end();
- I != E; ++I) {
- ABIArgInfo ArgInfo = getABIArgumentInfo(I->second, CGM.getTypes());
+ I != E; ++I, ++info_it) {
+ const ABIArgInfo &ArgInfo = info_it->info;
RValue RV = I->first;
switch (ArgInfo.getKind()) {