<div dir="ltr">Thanks, r244548.</div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 9:32 GMT-07:00 Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
> On 2015-Aug-05, at 16:26, Alex L <<a href="mailto:arphaman@gmail.com">arphaman@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> 2015-08-05 14:17 GMT-07:00 Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>>:<br>
><br>
> > On 2015-Jul-30, at 16:47, Alex L <<a href="mailto:arphaman@gmail.com">arphaman@gmail.com</a>> wrote:<br>
> ><br>
> > Hi,<br>
> ><br>
> > This patch serializes the UsesPhysRegMask register mask from the machine register<br>
> > information class. The mask is serialized as an inverted 'calleeSavedRegisters' mask<br>
> > to keep the output minimal. It uses the following syntax:<br>
> ><br>
> > calleeSavedRegisters: [ '%bh', '%bl', '%bp', '%bpl', '%bx', '%ebp', '%ebx',<br>
> >                         '%rbp', '%rbx', '%r12', '%r13', '%r14', '%r15',<br>
> >                         '%r12b', '%r13b', '%r14b', '%r15b', '%r12d', '%r13d',<br>
> >                         '%r14d', '%r15d', '%r12w', '%r13w', '%r14w', '%r15w' ]<br>
> ><br>
> > As you can see, the sub registers are included in this mask as well.<br>
> ><br>
> > This patch also allows the MIR parser to infer this mask from the register mask<br>
> > operands if the machine function doesn't specify it.<br>
> ><br>
> > Cheers,<br>
> > Alex<br>
> > <0001-MIR-Serialization-serialize-the-UsesPhysRegMask-from.patch><br>
><br>
> > From ca446d1f7a90691ffcc0c1ac16855e5b0eb7a9d0 Mon Sep 17 00:00:00 2001<br>
> > From: Alex Lorenz <<a href="mailto:arphaman@gmail.com">arphaman@gmail.com</a>><br>
> > Date: Thu, 30 Jul 2015 16:37:25 -0700<br>
> > Subject: [PATCH] MIR Serialization: serialize the UsesPhysRegMask from<br>
> >  register info<br>
> ><br>
> > ---<br>
> >  include/llvm/CodeGen/MIRYamlMapping.h              |  2 +<br>
> >  include/llvm/CodeGen/MachineRegisterInfo.h         |  4 +<br>
> >  lib/CodeGen/MIRParser/MIRParser.cpp                | 31 ++++++++<br>
> >  lib/CodeGen/MIRPrinter.cpp                         | 12 +++<br>
> >  .../MIR/X86/used-physical-register-info.mir        | 89 ++++++++++++++++++++++<br>
> >  5 files changed, 138 insertions(+)<br>
> >  create mode 100644 test/CodeGen/MIR/X86/used-physical-register-info.mir<br>
> ><br>
> > diff --git a/lib/CodeGen/MIRPrinter.cpp b/lib/CodeGen/MIRPrinter.cpp<br>
> > index f34cef7..9ce7e19 100644<br>
> > --- a/lib/CodeGen/MIRPrinter.cpp<br>
> > +++ b/lib/CodeGen/MIRPrinter.cpp<br>
> > @@ -213,6 +213,18 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,<br>
> >        printReg(I->second, LiveIn.VirtualRegister, TRI);<br>
> >      MF.LiveIns.push_back(LiveIn);<br>
> >    }<br>
> > +  // The used physical register mask is printed as an inverted callee saved<br>
> > +  // register mask.<br>
> > +  const BitVector &UsedPhysRegMask = RegInfo.getUsedPhysRegsMask();<br>
> > +  if (UsedPhysRegMask.none())<br>
> > +    return;<br>
><br>
> Will this cause a problem on the parsing side?  In particular, won't the<br>
> reader infer "the default set" here?  To put it another way, how do you<br>
> express in MIR that no registers should be marked callee-saved?<br>
><br>
> So, this none condition is triggered only when the machine function<br>
> doesn't have any register mask operands. Because of that, we don't<br>
> really want to serialize it as this mask isn't really active in this case.<br>
> And the parser will try to infer it when parsing it back in this case,<br>
> but I think it's better if it will do that - if the MIR file wasn't modified<br>
> the result mask will stay exactly the same as it was before it was<br>
> serialized, and otherwise, if the user modified the MIR file and added<br>
> some instructions with register mask operands then the parser will<br>
> compute the mask correctly.<br>
><br>
> But I have updated the patch anyway with a related feature - so now the<br>
> parser won't infer the mask when you specify an empty array of<br>
> callee-saved registers. Although I'm not sure if it's really that useful,<br>
> you wouldn't normally want to have an empty array here anyway.<br>
><br>
><br>
> > +  for (unsigned I = 0, E = UsedPhysRegMask.size(); I != E; ++I) {<br>
> > +    if (!UsedPhysRegMask[I]) {<br>
> > +      yaml::FlowStringValue Reg;<br>
> > +      printReg(I, Reg, TRI);<br>
> > +      MF.CalleeSavedRegisters.push_back(Reg);<br>
> > +    }<br>
> > +  }<br>
> >  }<br>
> ><br>
> >  void MIRPrinter::convert(ModuleSlotTracker &MST,<br>
><br>
><br>
</div></div>> <0001-MIR-Serialization-serialize-the-UsesPhysRegMask-from.patch><br>
<br>
Okay, LGTM.</blockquote></div><br></div>