mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
ByVal arguments are passed on stack. Make sure to allocate a slot using size and alignment information on the parameter attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45897 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
144ad580fd
commit
01b8fccca0
@ -115,19 +115,32 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
|||||||
int Size = Action->getValueAsInt("Size");
|
int Size = Action->getValueAsInt("Size");
|
||||||
int Align = Action->getValueAsInt("Align");
|
int Align = Action->getValueAsInt("Align");
|
||||||
|
|
||||||
O << IndentStr << "unsigned Offset" << ++Counter
|
O << IndentStr << "unsigned Size = ";
|
||||||
<< " = State.AllocateStack(";
|
|
||||||
if (Size)
|
if (Size)
|
||||||
O << Size << ", ";
|
O << Size;
|
||||||
else
|
else
|
||||||
O << "\n" << IndentStr << " State.getTarget().getTargetData()"
|
O << "State.getTarget().getTargetData()"
|
||||||
"->getABITypeSize(MVT::getTypeForValueType(LocVT)), ";
|
"->getABITypeSize(MVT::getTypeForValueType(LocVT))";
|
||||||
|
O << ";\n"
|
||||||
|
<< IndentStr << "unsigned Align = ";
|
||||||
if (Align)
|
if (Align)
|
||||||
O << Align;
|
O << Align;
|
||||||
else
|
else
|
||||||
O << "\n" << IndentStr << " State.getTarget().getTargetData()"
|
O << "State.getTarget().getTargetData()"
|
||||||
"->getABITypeAlignment(MVT::getTypeForValueType(LocVT))";
|
"->getABITypeAlignment(MVT::getTypeForValueType(LocVT))";
|
||||||
O << ");\n" << IndentStr
|
O << ";\n";
|
||||||
|
O << IndentStr << "if (ArgFlags & ISD::ParamFlags::ByVal) {\n";
|
||||||
|
O << IndentStr << " " <<
|
||||||
|
"Size = (ArgFlags & ISD::ParamFlags::ByValSize) >> "
|
||||||
|
"ISD::ParamFlags::ByValSizeOffs;\n";
|
||||||
|
O << IndentStr << " " <<
|
||||||
|
"unsigned ParamAlign = 1 << ((ArgFlags & ISD::ParamFlags::ByValAlign) "
|
||||||
|
">> ISD::ParamFlags::ByValAlignOffs);\n";
|
||||||
|
O << IndentStr << " Align = std::max(Align, ParamAlign);\n"
|
||||||
|
<< IndentStr << "}\n";
|
||||||
|
O << IndentStr << "unsigned Offset" << ++Counter
|
||||||
|
<< " = State.AllocateStack(Size, Align);\n";
|
||||||
|
O << IndentStr
|
||||||
<< "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
|
<< "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
|
||||||
<< Counter << ", LocVT, LocInfo));\n";
|
<< Counter << ", LocVT, LocInfo));\n";
|
||||||
O << IndentStr << "return false;\n";
|
O << IndentStr << "return false;\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user