[llvm] r195944 - Refactor a lot of patchpoint/stackmap related code to simplify and make it

Andrew Trick atrick at apple.com
Fri Dec 6 16:41:28 PST 2013


On Nov 28, 2013, at 7:07 PM, Lang Hames <lhames at gmail.com> wrote:

> Author: lhames
> Date: Thu Nov 28 21:07:54 2013
> New Revision: 195944
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=195944&view=rev
> Log:
> Refactor a lot of patchpoint/stackmap related code to simplify and make it
> target independent.
> 
> Most of the x86 specific stackmap/patchpoint handling was necessitated by the
> use of the native address-mode format for frame index operands. PEI has now
> been modified to treat stackmap/patchpoint similarly to DEBUG_INFO, allowing
> us to use a simple, platform independent register/offset pair for frame
> indexes on stackmap/patchpoints.
> 
> Notes:
>  - Folding is now platform independent and automatically supported.
>  - Emiting patchpoints with direct memory references now just involves calling
>    the TargetLoweringBase::emitPatchPoint utility method from the target's
>    XXXTargetLowering::EmitInstrWithCustomInserter method. (See
>    X86TargetLowering for an example).
>  - No more ugly platform-specific operand parsers.
> 
> This patch shouldn't change the generated output for X86. 

This is really great. I don't understand why in foldPatchpoint we lost the SpillOffset.

> +static MachineInstr* foldPatchpoint(MachineFunction &MF,
> +                                    MachineInstr *MI,
> +                                    const SmallVectorImpl<unsigned> &Ops,
> +                                    int FrameIndex,
> +                                    const TargetInstrInfo &TII) {
...
> +      unsigned SpillSize;
> +      unsigned SpillOffset;
> +      // Compute the spill slot size and offset.
> +      const TargetRegisterClass *RC =
> +        MF.getRegInfo().getRegClass(MO.getReg());
> +      bool Valid = TII.getStackSlotRange(RC, MO.getSubReg(), SpillSize,
> +                                         SpillOffset, &MF.getTarget());
> +      if (!Valid)
> +        report_fatal_error("cannot spill patchpoint subregister operand");
> +      MIB.addImm(StackMaps::IndirectMemRefOp);
> +      MIB.addImm(SpillSize);
> +      MIB.addFrameIndex(FrameIndex);
> +      MIB.addImm(0);

MIB.addImm(SpillOffset)?

-Andy




More information about the llvm-commits mailing list