summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetABIInfo.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-06-06 09:36:29 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-06-06 09:36:29 +0000
commit18adbf5f07af12bb6fbc87b25740a0d5ce46eefc (patch)
tree97b1935740bdfd489409e59e5333545ed0d8d6ed /clang/lib/CodeGen/TargetABIInfo.cpp
parent6813eb125f2d819548e85685059bdda2ee86b04f (diff)
downloadbcm5719-llvm-18adbf5f07af12bb6fbc87b25740a0d5ce46eefc.tar.gz
bcm5719-llvm-18adbf5f07af12bb6fbc87b25740a0d5ce46eefc.zip
Add new ABIArgInfo kind: Extend. This allows target to implement its own argument
zero/sign extension logic (consider, e.g. target has only 64 bit registers and thus i32's should be extended as well). llvm-svn: 72998
Diffstat (limited to 'clang/lib/CodeGen/TargetABIInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetABIInfo.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/TargetABIInfo.cpp b/clang/lib/CodeGen/TargetABIInfo.cpp
index 573ffed10a0..6f7bea2340a 100644
--- a/clang/lib/CodeGen/TargetABIInfo.cpp
+++ b/clang/lib/CodeGen/TargetABIInfo.cpp
@@ -28,6 +28,9 @@ void ABIArgInfo::dump() const {
case Direct:
fprintf(stderr, "Direct");
break;
+ case Extend:
+ fprintf(stderr, "Extend");
+ break;
case Ignore:
fprintf(stderr, "Ignore");
break;
@@ -342,7 +345,8 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy,
return ABIArgInfo::getIndirect(0);
} else {
- return ABIArgInfo::getDirect();
+ return (RetTy->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
}
}
@@ -371,7 +375,8 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty,
return ABIArgInfo::getIndirect(0);
} else {
- return ABIArgInfo::getDirect();
+ return (Ty->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
}
}
@@ -750,8 +755,8 @@ ABIArgInfo X86_64ABIInfo::getCoerceResult(QualType Ty,
// Integer and pointer types will end up in a general purpose
// register.
if (Ty->isIntegralType() || Ty->isPointerType())
- return ABIArgInfo::getDirect();
-
+ return (Ty->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
} else if (CoerceTo == llvm::Type::DoubleTy) {
// FIXME: It would probably be better to make CGFunctionInfo only map using
// canonical types than to canonize here.
@@ -771,7 +776,8 @@ ABIArgInfo X86_64ABIInfo::getIndirectResult(QualType Ty,
// If this is a scalar LLVM value then assume LLVM will pass it in the right
// place naturally.
if (!CodeGenFunction::hasAggregateLLVMType(Ty))
- return ABIArgInfo::getDirect();
+ return (Ty->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
// FIXME: Set alignment correctly.
return ABIArgInfo::getIndirect(0);
@@ -1267,7 +1273,8 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI, ASTContext &Context) const {
ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
ASTContext &Context) const {
if (!CodeGenFunction::hasAggregateLLVMType(Ty)) {
- return ABIArgInfo::getDirect();
+ return (Ty->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
}
// FIXME: This is kind of nasty... but there isn't much choice because the ARM
// backend doesn't support byval.
@@ -1299,7 +1306,8 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy,
return ABIArgInfo::getCoerce(llvm::Type::Int32Ty);
return ABIArgInfo::getIndirect(0);
} else {
- return ABIArgInfo::getDirect();
+ return (RetTy->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
}
}
@@ -1335,7 +1343,8 @@ ABIArgInfo DefaultABIInfo::classifyReturnType(QualType RetTy,
} else if (CodeGenFunction::hasAggregateLLVMType(RetTy)) {
return ABIArgInfo::getIndirect(0);
} else {
- return ABIArgInfo::getDirect();
+ return (RetTy->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
}
}
@@ -1344,7 +1353,8 @@ ABIArgInfo DefaultABIInfo::classifyArgumentType(QualType Ty,
if (CodeGenFunction::hasAggregateLLVMType(Ty)) {
return ABIArgInfo::getIndirect(0);
} else {
- return ABIArgInfo::getDirect();
+ return (Ty->isPromotableIntegerType() ?
+ ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
}
}
OpenPOWER on IntegriCloud