Eliminate the recently introduced CCAssignToStackABISizeAlign
in favour of teaching CCAssignToStack that size 0 and/or align
0 means to use the ABI values. This seems a neater solution.
It is safe since no legal value type has size 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44107 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/CallingConvEmitter.cpp b/utils/TableGen/CallingConvEmitter.cpp
index 79e3a9c..82013c9 100644
--- a/utils/TableGen/CallingConvEmitter.cpp
+++ b/utils/TableGen/CallingConvEmitter.cpp
@@ -114,19 +114,21 @@
} else if (Action->isSubClassOf("CCAssignToStack")) {
int Size = Action->getValueAsInt("Size");
int Align = Action->getValueAsInt("Align");
-
+
O << IndentStr << "unsigned Offset" << ++Counter
- << " = State.AllocateStack(" << Size << ", " << Align << ");\n";
- 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"
+ << " = State.AllocateStack(";
+ if (Size)
+ O << Size << ", ";
+ else
+ O << "\n" << IndentStr << " State.getTarget().getTargetData()"
+ "->getABITypeSize(MVT::getTypeForValueType(LocVT)), ";
+ if (Align)
+ O << Align;
+ else
+ O << "\n" << IndentStr << " State.getTarget().getTargetData()"
+ "->getABITypeAlignment(MVT::getTypeForValueType(LocVT))";
+ O << ");\n" << IndentStr
+ << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
<< Counter << ", LocVT, LocInfo));\n";
O << IndentStr << "return false;\n";
} else if (Action->isSubClassOf("CCPromoteToType")) {