aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-01 00:24:35 +0000
committerChris Lattner <sabre@nondot.org>2010-09-01 00:24:35 +0000
commit645406a3d3405ad0f4b5a0e46a34ae92d9d23bd3 (patch)
tree12a01b40b4f1fab48d5db85bd2f7052454c9ba0f /lib/CodeGen/TargetInfo.cpp
parent3db4dde12de84269c8f803f9dfca37a2d14f9898 (diff)
same refactoring as before, this time on the argument side.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112684 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
-rw-r--r--lib/CodeGen/TargetInfo.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index e9ce20d3db..389fa110fa 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -1550,7 +1550,8 @@ classifyReturnType(QualType RetTy) const {
}
// If a high part was specified, merge it together with the low part. It is
- // known to pass in the high eightbyte of the result.
+ // known to pass in the high eightbyte of the result. We do this by forming a
+ // first class struct aggregate with the high and low part: {low, high}
if (HighPart)
ResType = llvm::StructType::get(getVMContext(), ResType, HighPart, NULL);
@@ -1626,6 +1627,7 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned &neededInt,
break;
}
+ const llvm::Type *HighPart = 0;
switch (Hi) {
// Memory was handled previously, ComplexX87 and X87 should
// never occur as hi classes, and X87Up must be preceed by X87,
@@ -1638,33 +1640,26 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned &neededInt,
case NoClass: break;
- case Integer: {
+ case Integer:
++neededInt;
// Pick an 8-byte type based on the preferred type.
- const llvm::Type *HiType =
- GetINTEGERTypeAtOffset(CGT.ConvertTypeRecursive(Ty), 8, Ty, 8);
-
- if (Lo == NoClass) // Pass HiType at offset 8 in memory.
- return ABIArgInfo::getDirect(HiType, 8);
+ HighPart = GetINTEGERTypeAtOffset(CGT.ConvertTypeRecursive(Ty), 8, Ty, 8);
- ResType = llvm::StructType::get(getVMContext(), ResType, HiType, NULL);
+ if (Lo == NoClass) // Pass HighPart at offset 8 in memory.
+ return ABIArgInfo::getDirect(HighPart, 8);
break;
- }
// X87Up generally doesn't occur here (long double is passed in
// memory), except in situations involving unions.
case X87Up:
- case SSE: {
- const llvm::Type *HiType =
- GetSSETypeAtOffset(CGT.ConvertTypeRecursive(Ty), 8, Ty, 8);
+ case SSE:
+ HighPart = GetSSETypeAtOffset(CGT.ConvertTypeRecursive(Ty), 8, Ty, 8);
- if (Lo == NoClass) // Pass HiType at offset 8 in memory.
- return ABIArgInfo::getDirect(HiType, 8);
+ if (Lo == NoClass) // Pass HighPart at offset 8 in memory.
+ return ABIArgInfo::getDirect(HighPart, 8);
- ResType = llvm::StructType::get(getVMContext(), ResType, HiType, NULL);
++neededSSE;
break;
- }
// AMD64-ABI 3.2.3p3: Rule 4. If the class is SSEUP, the
// eightbyte is passed in the upper half of the last used SSE
@@ -1675,6 +1670,12 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned &neededInt,
break;
}
+ // If a high part was specified, merge it together with the low part. It is
+ // known to pass in the high eightbyte of the result. We do this by forming a
+ // first class struct aggregate with the high and low part: {low, high}
+ if (HighPart)
+ ResType = llvm::StructType::get(getVMContext(), ResType, HighPart, NULL);
+
return ABIArgInfo::getDirect(ResType);
}