[PATCH] D75268: A light-weight solution to align branches within 32B boundary by prefix padding

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 13:47:04 PST 2020


reames added a comment.

My prototyping resulted in a POC patch (D75300 <https://reviews.llvm.org/D75300>) which nicely demonstrates that we can prefix pad MCRelaxableFragment instructions with zero additional memory overhead.  Note that this approach *only* covers relaxable instructions, not those currently combined into DataFragments.

This patch goes several steps further in choosing instructions to insert prefixes before without making them relaxable.  We could either a) just make more instructions relaxable, or b) support both mechanisms.  This mechanism - particularly after splitting out a 'MCPrefixPaddingFragment' - will require less memory per potentially padded instruction than converting every instruction we might wish to pad into a RelxableFragment of it's own.

Another idea to explore would be trying to frame prefix padding insertion as something analogous to a fixup.  Today, all of our fixups are fixed size (I think), but having a fixup which inserts a set of bytes might be reasonable.  If we did that, we could use a single DataFragment for a block of instructions and still insert padding later if needed.

To be clear, I think it's fine to iterate on this design (for non-relaxable instructions) in tree.  We could potentially start simple by simply making more instructions relaxable, and then implement the fixup like scheme just mentioned or something like this patch does.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75268/new/

https://reviews.llvm.org/D75268





More information about the llvm-commits mailing list