@@ -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);
@@ -231,7 +232,7 @@ void MIRPrinter::print(const MachineFunction &MF) {
231232 YamlMF.NoVRegs = MF.getProperties ().hasProperty (
232233 MachineFunctionProperties::Property::NoVRegs);
233234
234- convert (YamlMF, MF.getRegInfo (), MF.getSubtarget ().getRegisterInfo ());
235+ convert (YamlMF, MF, MF .getRegInfo (), MF.getSubtarget ().getRegisterInfo ());
235236 MachineModuleSlotTracker MST (MMI, &MF);
236237 MST.incorporateFunction (MF.getFunction ());
237238 convert (MST, YamlMF.FrameInfo , MF.getFrameInfo ());
@@ -316,10 +317,21 @@ printStackObjectDbgInfo(const MachineFunction::VariableDbgInfo &DebugVar,
316317 }
317318}
318319
319- void MIRPrinter::convert (yaml::MachineFunction &MF,
320+ static void printRegFlags (Register Reg,
321+ std::vector<yaml::FlowStringValue> &RegisterFlags,
322+ const MachineFunction &MF,
323+ const TargetRegisterInfo *TRI) {
324+ auto FlagValues = TRI->getVRegFlagsOfReg (Reg, MF);
325+ for (auto &Flag : FlagValues) {
326+ RegisterFlags.push_back (yaml::FlowStringValue (Flag.str ()));
327+ }
328+ }
329+
330+ void MIRPrinter::convert (yaml::MachineFunction &YamlMF,
331+ const MachineFunction &MF,
320332 const MachineRegisterInfo &RegInfo,
321333 const TargetRegisterInfo *TRI) {
322- MF .TracksRegLiveness = RegInfo.tracksLiveness ();
334+ YamlMF .TracksRegLiveness = RegInfo.tracksLiveness ();
323335
324336 // Print the virtual register definitions.
325337 for (unsigned I = 0 , E = RegInfo.getNumVirtRegs (); I < E; ++I) {
@@ -332,7 +344,8 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
332344 Register PreferredReg = RegInfo.getSimpleHint (Reg);
333345 if (PreferredReg)
334346 printRegMIR (PreferredReg, VReg.PreferredRegister , TRI);
335- MF.VirtualRegisters .push_back (VReg);
347+ printRegFlags (Reg, VReg.RegisterFlags , MF, TRI);
348+ YamlMF.VirtualRegisters .push_back (VReg);
336349 }
337350
338351 // Print the live ins.
@@ -341,7 +354,7 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
341354 printRegMIR (LI.first , LiveIn.Register , TRI);
342355 if (LI.second )
343356 printRegMIR (LI.second , LiveIn.VirtualRegister , TRI);
344- MF .LiveIns .push_back (LiveIn);
357+ YamlMF .LiveIns .push_back (LiveIn);
345358 }
346359
347360 // Prints the callee saved registers.
@@ -353,7 +366,7 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
353366 printRegMIR (*I, Reg, TRI);
354367 CalleeSavedRegisters.push_back (Reg);
355368 }
356- MF .CalleeSavedRegisters = CalleeSavedRegisters;
369+ YamlMF .CalleeSavedRegisters = CalleeSavedRegisters;
357370 }
358371}
359372
0 commit comments