[llvm] r243173 - MIR Serialization: Serialize MachineFrameInfo's callee saved information.

Alex L arphaman at gmail.com
Mon Jul 27 11:43:19 PDT 2015


2015-07-27 11:38 GMT-07:00 Duncan P. N. Exon Smith <dexonsmith at apple.com>:

>
> > On 2015-Jul-24, at 15:22, Alex Lorenz <arphaman at gmail.com> wrote:
> >
> > Author: arphaman
> > Date: Fri Jul 24 17:22:50 2015
> > New Revision: 243173
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=243173&view=rev
> > Log:
> > 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.
> >
> > Added:
> >    llvm/trunk/test/CodeGen/MIR/X86/callee-saved-info.mir
> >
> llvm/trunk/test/CodeGen/MIR/X86/expected-named-register-in-callee-saved-register.mir
> > Modified:
> >    llvm/trunk/include/llvm/CodeGen/MIRYamlMapping.h
> >    llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
> >    llvm/trunk/lib/CodeGen/MIRPrinter.cpp
> >
> > Modified: llvm/trunk/include/llvm/CodeGen/MIRYamlMapping.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp?rev=243173&r1=243172&r2=243173&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp Fri Jul 24 17:22:50
> 2015
> > @@ -273,8 +278,7 @@ bool MIRParserImpl::initializeMachineFun
> >   PerFunctionMIParsingState PFS;
> >   if (initializeRegisterInfo(MF, MF.getRegInfo(), YamlMF, PFS))
> >     return true;
> > -  if (initializeFrameInfo(*MF.getFunction(), *MF.getFrameInfo(), YamlMF,
> > -                          PFS.StackObjectSlots,
> PFS.FixedStackObjectSlots))
> > +  if (initializeFrameInfo(MF, *MF.getFrameInfo(), YamlMF, PFS))
>
> Why doesn't the callee call `MF.getFrameInfo()`?
>
> >     return true;
> >   if (!YamlMF.Constants.empty()) {
> >     auto *ConstantPool = MF.getConstantPool();
> > @@ -401,11 +405,11 @@ bool MIRParserImpl::initializeRegisterIn
> >   return false;
> > }
> >
> > -bool MIRParserImpl::initializeFrameInfo(
> > -    const Function &F, MachineFrameInfo &MFI,
> > -    const yaml::MachineFunction &YamlMF,
> > -    DenseMap<unsigned, int> &StackObjectSlots,
> > -    DenseMap<unsigned, int> &FixedStackObjectSlots) {
> > +bool MIRParserImpl::initializeFrameInfo(MachineFunction &MF,
> > +                                        MachineFrameInfo &MFI,
>
> Can't `MFI` be trivially derived from `MF`?  Do you need both parameters?
>

The two parameters aren't needed, but I decided to go for this approach
in order to be consistent with the method 'initializeRegisterInfo',
which also takes in a machine function and the machine function's
register information.

It's probably better to use just a single machine function parameter for
both of these methods. I will commit a fix later.

Alex


>
> > +                                        const yaml::MachineFunction
> &YamlMF,
> > +                                        PerFunctionMIParsingState &PFS)
> {
> > +  const Function &F = *MF.getFunction();
> >   const yaml::MachineFrameInfo &YamlMFI = YamlMF.FrameInfo;
> >   MFI.setFrameAddressIsTaken(YamlMFI.IsFrameAddressTaken);
> >   MFI.setReturnAddressIsTaken(YamlMFI.IsReturnAddressTaken);
> > @@ -422,6 +426,7 @@ bool MIRParserImpl::initializeFrameInfo(
> >   MFI.setHasVAStart(YamlMFI.HasVAStart);
> >   MFI.setHasMustTailInVarArgFunc(YamlMFI.HasMustTailInVarArgFunc);
> >
> > +  std::vector<CalleeSavedInfo> CSIInfo;
> >   // Initialize the fixed frame objects.
> >   for (const auto &Object : YamlMF.FixedStackObjects) {
> >     int ObjectIdx;
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150727/89e3be3f/attachment.html>


More information about the llvm-commits mailing list