[llvm-commits] [llvm] r43988 - in /llvm/trunk: lib/Target/TargetCallingConv.td lib/Target/X86/X86CallingConv.td utils/TableGen/CallingConvEmitter.cpp
Dale Johannesen
dalej at apple.com
Sat Nov 10 14:07:16 PST 2007
Author: johannes
Date: Sat Nov 10 16:07:15 2007
New Revision: 43988
URL: http://llvm.org/viewvc/llvm-project?rev=43988&view=rev
Log:
Add CCAssignToStackABISizeAlign for convenience in
dealing with types whose size & alignment are
different on different subtargets. Use it for x86 f80.
Modified:
llvm/trunk/lib/Target/TargetCallingConv.td
llvm/trunk/lib/Target/X86/X86CallingConv.td
llvm/trunk/utils/TableGen/CallingConvEmitter.cpp
Modified: llvm/trunk/lib/Target/TargetCallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetCallingConv.td?rev=43988&r1=43987&r2=43988&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetCallingConv.td (original)
+++ llvm/trunk/lib/Target/TargetCallingConv.td Sat Nov 10 16:07:15 2007
@@ -66,6 +66,13 @@
int Align = align;
}
+/// CCAssignToStackABISizeAlign - This action always matches: it assigns
+/// the value to a stack slot of the ABISize and ABIAlignment for the type,
+/// which may depend on the target or subtarget.
+/// "ignored" is here because an empty arg list does not work.
+class CCAssignToStackABISizeAlign<int ignored> : CCAction {
+}
+
/// CCStructAssign - This action always matches: it will use the C ABI and
/// the register availability to decided whether to assign to a set of
/// registers or to a stack slot.
Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=43988&r1=43987&r2=43988&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Sat Nov 10 16:07:15 2007
@@ -118,10 +118,12 @@
// 8-byte aligned if there are no more registers to hold them.
CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>,
- // Long doubles get 16-byte stack slots that are 16-byte aligned.
+ // Long doubles get stack slots whose size and alignment depends on the
+ // subtarget.
+ CCIfType<[f80], CCAssignToStackABISizeAlign<0>>,
+
// Vectors get 16-byte stack slots that are 16-byte aligned.
- CCIfType<[f80, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
- CCAssignToStack<16, 16>>,
+ CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack<16, 16>>,
// __m64 vectors get 8-byte stack slots that are 8-byte aligned.
CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 8>>
@@ -177,8 +179,9 @@
// Doubles get 8-byte slots that are 4-byte aligned.
CCIfType<[f64], CCAssignToStack<8, 4>>,
- // Long doubles get 16-byte slots that are 4-byte aligned.
- CCIfType<[f80], CCAssignToStack<16, 4>>,
+ // Long doubles get slots whose size and alignment depends on the
+ // subtarget.
+ CCIfType<[f80], CCAssignToStackABISizeAlign<0>>,
// The first 4 vector arguments are passed in XMM registers.
CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
Modified: llvm/trunk/utils/TableGen/CallingConvEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CallingConvEmitter.cpp?rev=43988&r1=43987&r2=43988&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CallingConvEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/CallingConvEmitter.cpp Sat Nov 10 16:07:15 2007
@@ -120,6 +120,15 @@
O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
<< Counter << ", LocVT, LocInfo));\n";
O << IndentStr << "return false;\n";
+ } else if (Action->isSubClassOf("CCAssignToStackABISizeAlign")) {
+ O << IndentStr << "unsigned Offset" << ++Counter
+ << " = State.AllocateStack(State.getTarget().getTargetData()"
+ "->getABITypeSize(MVT::getTypeForValueType(LocVT)),\n";
+ O << IndentStr << " State.getTarget().getTargetData()"
+ "->getABITypeAlignment(MVT::getTypeForValueType(LocVT)));\n";
+ O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
+ << Counter << ", LocVT, LocInfo));\n";
+ O << IndentStr << "return false;\n";
} else if (Action->isSubClassOf("CCPromoteToType")) {
Record *DestTy = Action->getValueAsDef("DestTy");
O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) <<";\n";
More information about the llvm-commits
mailing list