aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCSection.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-06-14 10:01:36 -0700
committerGitHub <noreply@github.com>2024-06-14 10:01:36 -0700
commitb1932b8483011c2bfebbea1ef56a565634570e6b (patch)
tree4163392354f514ae8c97f806f3f72b5c55af63b5 /llvm/lib/MC/MCSection.cpp
parent72b841d016c7403ac1f7678d25b864dac80d06dc (diff)
downloadllvm-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/MCSection.cpp')
-rw-r--r--llvm/lib/MC/MCSection.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index 59fdfd7..3a7a8a0 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -82,15 +82,14 @@ void MCSection::addPendingLabel(MCSymbol *label, unsigned Subsection) {
PendingLabels.push_back(PendingLabel(label, Subsection));
}
-void MCSection::flushPendingLabels(MCFragment *F, uint64_t FOffset,
- unsigned Subsection) {
+void MCSection::flushPendingLabels(MCFragment *F, unsigned Subsection) {
// Set the fragment and fragment offset for all pending symbols in the
// specified Subsection, and remove those symbols from the pending list.
for (auto It = PendingLabels.begin(); It != PendingLabels.end(); ++It) {
PendingLabel& Label = *It;
if (Label.Subsection == Subsection) {
Label.Sym->setFragment(F);
- Label.Sym->setOffset(FOffset);
+ assert(Label.Sym->getOffset() == 0);
PendingLabels.erase(It--);
}
}
@@ -105,7 +104,7 @@ void MCSection::flushPendingLabels() {
MCFragment *F = new MCDataFragment();
addFragment(*F);
F->setParent(this);
- flushPendingLabels(F, 0, Label.Subsection);
+ flushPendingLabels(F, Label.Subsection);
}
}