mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-18 10:24:45 +00:00
MIR Serialization: Serialize MachineFrameInfo's callee saved information.
This commit serializes the callee saved information from the class 'MachineFrameInfo'. This commit extends the YAML mappings for the fixed and the ordinary stack objects and adds an optional 'callee-saved-register' attribute. This attribute is used to serialize the callee save information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243173 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -79,7 +79,8 @@ public:
|
||||
void convert(ModuleSlotTracker &MST, yaml::MachineBasicBlock &YamlMBB,
|
||||
const MachineBasicBlock &MBB);
|
||||
void convertStackObjects(yaml::MachineFunction &MF,
|
||||
const MachineFrameInfo &MFI);
|
||||
const MachineFrameInfo &MFI,
|
||||
const TargetRegisterInfo *TRI);
|
||||
|
||||
private:
|
||||
void initRegisterMaskIds(const MachineFunction &MF);
|
||||
@@ -156,7 +157,8 @@ void MIRPrinter::print(const MachineFunction &MF) {
|
||||
YamlMF.HasInlineAsm = MF.hasInlineAsm();
|
||||
convert(YamlMF, MF.getRegInfo(), MF.getSubtarget().getRegisterInfo());
|
||||
convert(YamlMF.FrameInfo, *MF.getFrameInfo());
|
||||
convertStackObjects(YamlMF, *MF.getFrameInfo());
|
||||
convertStackObjects(YamlMF, *MF.getFrameInfo(),
|
||||
MF.getSubtarget().getRegisterInfo());
|
||||
if (const auto *ConstantPool = MF.getConstantPool())
|
||||
convert(YamlMF, *ConstantPool);
|
||||
|
||||
@@ -219,7 +221,8 @@ void MIRPrinter::convert(yaml::MachineFrameInfo &YamlMFI,
|
||||
}
|
||||
|
||||
void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF,
|
||||
const MachineFrameInfo &MFI) {
|
||||
const MachineFrameInfo &MFI,
|
||||
const TargetRegisterInfo *TRI) {
|
||||
// Process fixed stack objects.
|
||||
unsigned ID = 0;
|
||||
for (int I = MFI.getObjectIndexBegin(); I < 0; ++I) {
|
||||
@@ -265,6 +268,19 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF,
|
||||
StackObjectOperandMapping.insert(std::make_pair(
|
||||
I, FrameIndexOperand::create(YamlObject.Name.Value, ID++)));
|
||||
}
|
||||
|
||||
for (const auto &CSInfo : MFI.getCalleeSavedInfo()) {
|
||||
yaml::StringValue Reg;
|
||||
printReg(CSInfo.getReg(), Reg, TRI);
|
||||
auto StackObjectInfo = StackObjectOperandMapping.find(CSInfo.getFrameIdx());
|
||||
assert(StackObjectInfo != StackObjectOperandMapping.end() &&
|
||||
"Invalid stack object index");
|
||||
const FrameIndexOperand &StackObject = StackObjectInfo->second;
|
||||
if (StackObject.IsFixed)
|
||||
MF.FixedStackObjects[StackObject.ID].CalleeSavedRegister = Reg;
|
||||
else
|
||||
MF.StackObjects[StackObject.ID].CalleeSavedRegister = Reg;
|
||||
}
|
||||
}
|
||||
|
||||
void MIRPrinter::convert(yaml::MachineFunction &MF,
|
||||
|
Reference in New Issue
Block a user