diff options
author | Fangrui Song <i@maskray.me> | 2024-06-14 10:01:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-14 10:01:36 -0700 |
commit | b1932b8483011c2bfebbea1ef56a565634570e6b (patch) | |
tree | 4163392354f514ae8c97f806f3f72b5c55af63b5 /llvm/lib/MC/MCAssembler.cpp | |
parent | 72b841d016c7403ac1f7678d25b864dac80d06dc (diff) | |
download | llvm-b1932b8483011c2bfebbea1ef56a565634570e6b.zip llvm-b1932b8483011c2bfebbea1ef56a565634570e6b.tar.gz llvm-b1932b8483011c2bfebbea1ef56a565634570e6b.tar.bz2 |
[MC] Aligned bundling: remove special handling for RelaxAll
When both aligned bundling and RelaxAll are enabled, bundle padding is
directly written into fragments (https://reviews.llvm.org/D8072).
(The original motivation was memory usage, which has been achieved from
different angles with recent assembler improvement).
The code presents challenges with the work to replace fragment
representation (e.g. #94950 #95077). This patch removes the special
handling. RelaxAll still works but the behavior seems slightly different
as revealed by 2 changed tests. However, most `-mc-relax-all` tests are
unchanged.
RelaxAll used to be the default for clang -O0. This mode has significant
code size drawbacks and newer Clang doesn't use it (#90013).
---
flushPendingLabels: The FOffset parameter can be removed: pending labels
will be assigned to the incoming fragment at offset 0.
Pull Request: https://github.com/llvm/llvm-project/pull/95188
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 08420ed..17f0900 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -420,12 +420,6 @@ void MCAsmLayout::layoutBundle(MCFragment *F) { // The fragment's offset will point to after the padding, and its computed // size won't include the padding. // - // When the -mc-relax-all flag is used, we optimize bundling by writting the - // padding directly into fragments when the instructions are emitted inside - // the streamer. When the fragment is larger than the bundle size, we need to - // ensure that it's bundle aligned. This means that if we end up with - // multiple fragments, we must emit bundle padding between fragments. - // // ".align N" is an example of a directive that introduces multiple // fragments. We could add a special case to handle ".align N" by emitting // within-fragment padding (which would produce less padding when N is less @@ -436,7 +430,7 @@ void MCAsmLayout::layoutBundle(MCFragment *F) { MCEncodedFragment *EF = cast<MCEncodedFragment>(F); uint64_t FSize = Assembler.computeFragmentSize(*this, *EF); - if (!Assembler.getRelaxAll() && FSize > Assembler.getBundleAlignSize()) + if (FSize > Assembler.getBundleAlignSize()) report_fatal_error("Fragment can't be larger than a bundle size"); uint64_t RequiredBundlePadding = |