mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
LLVM-1163: AAPCS-VFP violation when CPRC allocated to stack
According to the AAPCS, when a CPRC is allocated to the stack, all other VFP registers should be marked as unavailable. I have also modified the rules for allocating non-CPRCs to the stack, to make it more explicit that all GPRs must be made unavailable. I cannot think of a case where the old version would produce incorrect answers, so there is no test for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -185,12 +185,34 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
||||
else
|
||||
O << "\n" << IndentStr << " State.getTarget().getDataLayout()"
|
||||
"->getABITypeAlignment(EVT(LocVT).getTypeForEVT(State.getContext()))";
|
||||
if (Action->isSubClassOf("CCAssignToStackWithShadow"))
|
||||
O << ", " << getQualifiedName(Action->getValueAsDef("ShadowReg"));
|
||||
O << ");\n" << IndentStr
|
||||
<< "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
|
||||
<< Counter << ", LocVT, LocInfo));\n";
|
||||
O << IndentStr << "return false;\n";
|
||||
} else if (Action->isSubClassOf("CCAssignToStackWithShadow")) {
|
||||
int Size = Action->getValueAsInt("Size");
|
||||
int Align = Action->getValueAsInt("Align");
|
||||
ListInit *ShadowRegList = Action->getValueAsListInit("ShadowRegList");
|
||||
|
||||
unsigned ShadowRegListNumber = ++Counter;
|
||||
|
||||
O << IndentStr << "static const uint16_t ShadowRegList"
|
||||
<< ShadowRegListNumber << "[] = {\n";
|
||||
O << IndentStr << " ";
|
||||
for (unsigned i = 0, e = ShadowRegList->getSize(); i != e; ++i) {
|
||||
if (i != 0) O << ", ";
|
||||
O << getQualifiedName(ShadowRegList->getElementAsRecord(i));
|
||||
}
|
||||
O << "\n" << IndentStr << "};\n";
|
||||
|
||||
O << IndentStr << "unsigned Offset" << ++Counter
|
||||
<< " = State.AllocateStack("
|
||||
<< Size << ", " << Align << ", "
|
||||
<< "ShadowRegList" << ShadowRegListNumber << ", "
|
||||
<< ShadowRegList->getSize() << ");\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");
|
||||
MVT::SimpleValueType DestVT = getValueType(DestTy);
|
||||
|
Reference in New Issue
Block a user