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

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Jul 27 11:38:05 PDT 2015


> 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?

> +                                        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;





More information about the llvm-commits mailing list