aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCSection.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-07-21 15:42:27 -0700
committerFangrui Song <i@maskray.me>2024-07-21 15:42:27 -0700
commit1a47f3f3db66589c11f8ddacfeaecc03fb80c510 (patch)
tree330ffed41d0e82743f27e6fda3d3e2c0d93e0fca /llvm/lib/MC/MCSection.cpp
parent0387cd052b081d6bc9856ef756942a5df1a2a301 (diff)
downloadllvm-1a47f3f3db66589c11f8ddacfeaecc03fb80c510.zip
llvm-1a47f3f3db66589c11f8ddacfeaecc03fb80c510.tar.gz
llvm-1a47f3f3db66589c11f8ddacfeaecc03fb80c510.tar.bz2
[MC] Compute fragment offsets eagerly
This builds on top of commit 9d0754ada5dbbc0c009bcc2f7824488419cc5530 ("[MC] Relax fragments eagerly") and relaxes fragments eagerly to eliminate MCSection::HasLayout and `getFragmentOffset` overhead. Note: The removed `#ifndef NDEBUG` code (disabled by default) in X86AsmBackend::finishLayout was problematic, as (a) !NDEBUG and NDEBUG builds evaluated fragment offsets at different times before this patch (b) one iteration might not be sufficient to converge. There might be some edge cases that it did not handle. Anyhow, this patch probably makes it work for more cases.
Diffstat (limited to 'llvm/lib/MC/MCSection.cpp')
-rw-r--r--llvm/lib/MC/MCSection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index 8c2ee56..97e87a4 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -23,8 +23,8 @@ using namespace llvm;
MCSection::MCSection(SectionVariant V, StringRef Name, bool IsText,
bool IsVirtual, MCSymbol *Begin)
: Begin(Begin), BundleGroupBeforeFirstInst(false), HasInstructions(false),
- HasLayout(false), IsRegistered(false), IsText(IsText),
- IsVirtual(IsVirtual), Name(Name), Variant(V) {
+ IsRegistered(false), IsText(IsText), IsVirtual(IsVirtual), Name(Name),
+ Variant(V) {
DummyFragment.setParent(this);
// The initial subsection number is 0. Create a fragment list.
CurFragList = &Subsections.emplace_back(0u, FragList{}).second;