[PATCH] D97982: [MC] Introduce NeverAlign fragment type
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 21:35:38 PDT 2021
Amir updated this revision to Diff 351058.
Amir added a comment.
@efriedma:
Addressed the concern that NeverAlign may introduce infinite loops in layout,
checked the case if there's an MCRelaxableFragment that gets relaxed after
we invoke computeFragmentSize().
Added the test case confirming that this case is handled correctly:
1. NeverAlign is added before cmp+jcc, initially no padding.
2. cmp+jcc are both relaxable, initially short form and are split by
an alignment boundary,
3. Which triggers NeverAlign padding, one byte is added before cmp+jcc.
4. Which triggers jcc relaxation (pushes out jcc to long form)
5. Which triggers cmp relaxation (pushes out cmp to long form)
6. Which makes NeverAlign redundant as cmp+jcc are not longer split by an alignment boundary.
7. Which disables NeverAlign padding (0 bytes)
8. Which in theory could shrink cmp+jcc to short forms causing an infinite loop,
but as long as relaxation only increases instruction sizes, it converges
at this point, leaving cmp and jcc in relaxed form.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97982/new/
https://reviews.llvm.org/D97982
Files:
llvm/include/llvm/MC/MCFragment.h
llvm/include/llvm/MC/MCObjectStreamer.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCFragment.cpp
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/test/MC/X86/directive-avoid_end_align.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97982.351058.patch
Type: text/x-patch
Size: 15408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210610/6edc59eb/attachment.bin>
More information about the llvm-commits
mailing list