This is an archive of the discontinued LLVM Phabricator instance.

[MC] Add MCSubtargetInfo to MCPaddingFragment [NFC]
AcceptedPublic

Authored by peter.smith on Apr 23 2018, 7:13 AM.

Details

Summary

In preparation for passing the MCSubtargetInfo (STI) through to writeNops so that it can use the STI in operation at the time, we need to record the STI in operation when a MCPaddingFragment is created. The STI is currently unused, a further patch will pass it through to writeNops.

This is part 2 of 4 of a patch series to pass MCSubtargetInfo to writeNops so that the ARM and X86 AsmBackends can remove the per-module STI that is used to decide which nop encodings can be used.
1 [MC] Move bundling and MCSubtargetInfo to MCEncodedFragment [NFC]
2 [MC] Add MCSubtargetInfo to MCPaddingFragment [NFC]
3 [MC] Add MCSubtargetInfo to MCAlignFragment [NFC]
4 [MC] Use local MCSubtargetInfo in writeNops

This patch depends on D44928.

Diff Detail

Event Timeline

peter.smith created this revision.Apr 23 2018, 7:13 AM

Rebased [NFC]

asb accepted this revision.Aug 15 2018, 6:37 AM

Other than two tiny formatting issues, this looks good to me.

include/llvm/MC/MCFragment.h
382

Normal LLVM style would be const MCSubtargetInfo &STI

include/llvm/MC/MCObjectStreamer.h
79

Normal LLVM style would be const MCSubtargetInfo &STI

This revision is now accepted and ready to land.Aug 15 2018, 6:37 AM
asb added a comment.Nov 12 2018, 6:54 AM

Just a ping on landing this. Are you awaiting additional reviews?

Yes, my apologies for not following up.
This is an enabling patch for allowing writeNops() to use a passed in Subtarget. There are 3 parts:

  • Add STI to MCPaddingFragment (This review)
  • Add STI to MCAlignFragment D45961
  • Actually use the STI in the fragments to pass to writeNops() D45962

This and D45961 have no users without D45962 . I'm happy to rebase and work on D45961, D45962 but it would probably be worth committing all or none of them.

asb added a comment.Nov 12 2018, 7:42 AM

Ah - I was waiting for this to be committed before returning to review the rest!

I'll circle back to reviewing the remaining two patches this week.