@@ -113,7 +113,8 @@ class MIRPrinter {
113113
114114 void print (const MachineFunction &MF);
115115
116- void convert (yaml::MachineFunction &MF, const MachineRegisterInfo &RegInfo,
116+ void convert (yaml::MachineFunction &YamlMF, const MachineFunction &MF,
117+ const MachineRegisterInfo &RegInfo,
117118 const TargetRegisterInfo *TRI);
118119 void convert (ModuleSlotTracker &MST, yaml::MachineFrameInfo &YamlMFI,
119120 const MachineFrameInfo &MFI);
@@ -230,7 +231,7 @@ void MIRPrinter::print(const MachineFunction &MF) {
230231 YamlMF.NoVRegs = MF.getProperties ().hasProperty (
231232 MachineFunctionProperties::Property::NoVRegs);
232233
233- convert (YamlMF, MF.getRegInfo (), MF.getSubtarget ().getRegisterInfo ());
234+ convert (YamlMF, MF, MF .getRegInfo (), MF.getSubtarget ().getRegisterInfo ());
234235 MachineModuleSlotTracker MST (MMI, &MF);
235236 MST.incorporateFunction (MF.getFunction ());
236237 convert (MST, YamlMF.FrameInfo , MF.getFrameInfo ());
@@ -315,10 +316,21 @@ printStackObjectDbgInfo(const MachineFunction::VariableDbgInfo &DebugVar,
315316 }
316317}
317318
318- void MIRPrinter::convert (yaml::MachineFunction &MF,
319+ static void printRegFlags (Register Reg,
320+ std::vector<yaml::FlowStringValue> &RegisterFlags,
321+ const MachineFunction &MF,
322+ const TargetRegisterInfo *TRI) {
323+ SmallVector<std::string> FlagValues = TRI->getVRegFlagsOfReg (Reg, MF);
324+ for (auto &Flag : FlagValues) {
325+ RegisterFlags.push_back (yaml::FlowStringValue (Flag));
326+ }
327+ }
328+
329+ void MIRPrinter::convert (yaml::MachineFunction &YamlMF,
330+ const MachineFunction &MF,
319331 const MachineRegisterInfo &RegInfo,
320332 const TargetRegisterInfo *TRI) {
321- MF .TracksRegLiveness = RegInfo.tracksLiveness ();
333+ YamlMF .TracksRegLiveness = RegInfo.tracksLiveness ();
322334
323335 // Print the virtual register definitions.
324336 for (unsigned I = 0 , E = RegInfo.getNumVirtRegs (); I < E; ++I) {
@@ -331,7 +343,8 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
331343 Register PreferredReg = RegInfo.getSimpleHint (Reg);
332344 if (PreferredReg)
333345 printRegMIR (PreferredReg, VReg.PreferredRegister , TRI);
334- MF.VirtualRegisters .push_back (VReg);
346+ printRegFlags (Reg, VReg.RegisterFlags , MF, TRI);
347+ YamlMF.VirtualRegisters .push_back (VReg);
335348 }
336349
337350 // Print the live ins.
@@ -340,7 +353,7 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
340353 printRegMIR (LI.first , LiveIn.Register , TRI);
341354 if (LI.second )
342355 printRegMIR (LI.second , LiveIn.VirtualRegister , TRI);
343- MF .LiveIns .push_back (LiveIn);
356+ YamlMF .LiveIns .push_back (LiveIn);
344357 }
345358
346359 // Prints the callee saved registers.
@@ -352,7 +365,7 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
352365 printRegMIR (*I, Reg, TRI);
353366 CalleeSavedRegisters.push_back (Reg);
354367 }
355- MF .CalleeSavedRegisters = CalleeSavedRegisters;
368+ YamlMF .CalleeSavedRegisters = CalleeSavedRegisters;
356369 }
357370}
358371
0 commit comments