Skip to content

Commit 3e0f15a

Browse files
MaskRaycpiaseque
authored andcommitted
[MC] Remove MCAsmLayout::invalidateFragmentsFrom
The simplification is enabled by 9d0754a ("[MC] Relax fragments eagerly").
1 parent d6fc6fc commit 3e0f15a

File tree

4 files changed

+2
-19
lines changed

4 files changed

+2
-19
lines changed

llvm/include/llvm/MC/MCAsmLayout.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ class MCAsmLayout {
4040
/// Get the assembler object this is a layout for.
4141
MCAssembler &getAssembler() const { return Assembler; }
4242

43-
/// Invalidate the fragments starting with F because it has been
44-
/// resized. The fragment's size should have already been updated, but
45-
/// its bundle padding will be recomputed.
46-
void invalidateFragmentsFrom(MCFragment *F);
47-
4843
void layoutBundle(MCFragment *Prev, MCFragment *F);
4944

5045
/// \name Section Access (in layout order)

llvm/lib/MC/MCFragment.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ MCAsmLayout::MCAsmLayout(MCAssembler &Asm) : Assembler(Asm) {
4040
SectionOrder.push_back(&Sec);
4141
}
4242

43-
void MCAsmLayout::invalidateFragmentsFrom(MCFragment *F) {
44-
F->getParent()->setHasLayout(false);
45-
}
46-
4743
// Simple getSymbolOffset helper for the non-variable case.
4844
static bool getLabelOffset(const MCAsmLayout &Layout, const MCSymbol &S,
4945
bool ReportError, uint64_t &Val) {

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ class HexagonAsmBackend : public MCAsmBackend {
756756
//assert(!Error);
757757
(void)Error;
758758
ReplaceInstruction(Asm.getEmitter(), RF, Inst);
759-
Layout.invalidateFragmentsFrom(&RF);
759+
I->setHasLayout(false);
760760
Size = 0; // Only look back one instruction
761761
break;
762762
}

llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -925,15 +925,14 @@ void X86AsmBackend::finishLayout(MCAssembler const &Asm,
925925
// the align directive. This is purely about human understandability
926926
// of the resulting code. If we later find a reason to expand
927927
// particular instructions over others, we can adjust.
928-
MCFragment *FirstChangedFragment = nullptr;
929928
unsigned RemainingSize = OrigSize;
930929
while (!Relaxable.empty() && RemainingSize != 0) {
931930
auto &RF = *Relaxable.pop_back_val();
932931
// Give the backend a chance to play any tricks it wishes to increase
933932
// the encoding size of the given instruction. Target independent code
934933
// will try further relaxation, but target's may play further tricks.
935934
if (padInstructionEncoding(RF, Asm.getEmitter(), RemainingSize))
936-
FirstChangedFragment = &RF;
935+
Sec.setHasLayout(false);
937936

938937
// If we have an instruction which hasn't been fully relaxed, we can't
939938
// skip past it and insert bytes before it. Changing its starting
@@ -946,13 +945,6 @@ void X86AsmBackend::finishLayout(MCAssembler const &Asm,
946945
}
947946
Relaxable.clear();
948947

949-
if (FirstChangedFragment) {
950-
// Make sure the offsets for any fragments in the effected range get
951-
// updated. Note that this (conservatively) invalidates the offsets of
952-
// those following, but this is not required.
953-
Layout.invalidateFragmentsFrom(FirstChangedFragment);
954-
}
955-
956948
// BoundaryAlign explicitly tracks it's size (unlike align)
957949
if (F.getKind() == MCFragment::FT_BoundaryAlign)
958950
cast<MCBoundaryAlignFragment>(F).setSize(RemainingSize);

0 commit comments

Comments
 (0)