MIR Serialization: Initial serialization of stack objects.

This commit implements the initial serialization of stack objects from the
MachineFrameInfo class. It can only serialize the ordinary stack objects
(including ordinary spill slots), but it doesn't serialize variable sized or
fixed stack objects yet.

The stack objects are serialized using a YAML sequence of YAML inline mappings.
Each mapping has the object's ID, type, size, offset and alignment. The stack
objects are a part of machine function's YAML mapping.

Reviewers: Duncan P. N. Exon Smith


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz
2015-07-10 18:13:57 +00:00
parent 99cb989593
commit b83896903b
4 changed files with 121 additions and 4 deletions

View File

@ -107,7 +107,7 @@ public:
const yaml::MachineFunction &YamlMF);
bool initializeFrameInfo(MachineFrameInfo &MFI,
const yaml::MachineFrameInfo &YamlMFI);
const yaml::MachineFunction &YamlMF);
private:
/// Return a MIR diagnostic converted from an MI string diagnostic.
@ -260,7 +260,7 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) {
MF.setHasInlineAsm(YamlMF.HasInlineAsm);
if (initializeRegisterInfo(MF, MF.getRegInfo(), YamlMF))
return true;
if (initializeFrameInfo(*MF.getFrameInfo(), YamlMF.FrameInfo))
if (initializeFrameInfo(*MF.getFrameInfo(), YamlMF))
return true;
PerFunctionMIParsingState PFS;
@ -354,7 +354,8 @@ bool MIRParserImpl::initializeRegisterInfo(
}
bool MIRParserImpl::initializeFrameInfo(MachineFrameInfo &MFI,
const yaml::MachineFrameInfo &YamlMFI) {
const yaml::MachineFunction &YamlMF) {
const yaml::MachineFrameInfo &YamlMFI = YamlMF.FrameInfo;
MFI.setFrameAddressIsTaken(YamlMFI.IsFrameAddressTaken);
MFI.setReturnAddressIsTaken(YamlMFI.IsReturnAddressTaken);
MFI.setHasStackMap(YamlMFI.HasStackMap);
@ -369,6 +370,16 @@ bool MIRParserImpl::initializeFrameInfo(MachineFrameInfo &MFI,
MFI.setHasOpaqueSPAdjustment(YamlMFI.HasOpaqueSPAdjustment);
MFI.setHasVAStart(YamlMFI.HasVAStart);
MFI.setHasMustTailInVarArgFunc(YamlMFI.HasMustTailInVarArgFunc);
// Initialize the frame objects.
for (const auto &Object : YamlMF.StackObjects) {
int ObjectIdx = MFI.CreateStackObject(
Object.Size, Object.Alignment,
Object.Type == yaml::MachineStackObject::SpillSlot);
MFI.setObjectOffset(ObjectIdx, Object.Offset);
// TODO: Store the mapping between object IDs and object indices to parse
// stack object references correctly.
}
return false;
}