This is an archive of the discontinued LLVM Phabricator instance.

[Outliner] Add simple stack fixup support in X86
AbandonedPublic

Authored by paquette on Mar 9 2017, 4:07 PM.

Details

Summary

This commit adds support for simple stack fixups to the MachineOutliner pass. There are certain instructions that use, say, the stack pointer in x86-64 that can safely be outlined by modifying their offsets inside outlined functions. By making these instructions legal, it's possible to find longer sequences of instructions to outline.

As a start, commit adds support for outlining MOV64mr and MOV64rm MachineInstrs that use RSP to the x86-64 outliner.

This relies on https://reviews.llvm.org/D30670.

Diff Detail

Event Timeline

paquette created this revision.Mar 9 2017, 4:07 PM
MatzeB edited edge metadata.Mar 9 2017, 5:06 PM

This looks good, just a bunch of nitpicks.

lib/Target/X86/X86InstrInfo.cpp
10418

We don't add extra indentation to case labels (only to the code after the case).

10426–10427

Seems unnecessary.

10499

Maybe rename the whole insertOutlinerEpilogue function to fixupPostOutline, because well this isn't just inserting the epilogue anymore.

10541

Could go in a separate cleanup commit without review.

lib/Target/X86/X86InstrInfo.h
550–559

The usual way is to put the doxygen comments above or behind the enum members:

/// This is my Enum.
enum MyEnum {
  /// The best choice.
  A,
  /// Also good.
  B,
  C, ///< This is a more compact alternative style to document C
};
MatzeB added a comment.Mar 9 2017, 5:08 PM

Oh and there is no test!

majnemer added inline comments.
lib/Target/X86/X86InstrInfo.cpp
10519

spacing after switch

lib/Target/X86/X86InstrInfo.h
569

const MachineInstr &MI ?

paquette abandoned this revision.Mar 13 2017, 2:43 PM
paquette marked 7 inline comments as done.

This is too hard to write a test for because it only handles two instructions. It was intended as a proof of concept for the AArch64 target for the outliner which I'm about to put up. I'm just going to create a patch for that instead, since it can be tested easily there. The logic here can be used for reference.