[llvm] 2235e20 - MCAsmBackend: Remove redundant relaxInstruction overrides
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 6 15:30:41 PDT 2025
Author: Fangrui Song
Date: 2025-07-06T15:30:36-07:00
New Revision: 2235e20885b45a9954ddb866cc810ce9a4ab8e97
URL: https://github.com/llvm/llvm-project/commit/2235e20885b45a9954ddb866cc810ce9a4ab8e97
DIFF: https://github.com/llvm/llvm-project/commit/2235e20885b45a9954ddb866cc810ce9a4ab8e97.diff
LOG: MCAsmBackend: Remove redundant relaxInstruction overrides
Added:
Modified:
llvm/include/llvm/MC/MCAsmBackend.h
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
llvm/lib/Target/VE/MCTargetDesc/VEAsmBackend.cpp
llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h
index 890b0fd6abe07..ebc98ebfce9f7 100644
--- a/llvm/include/llvm/MC/MCAsmBackend.h
+++ b/llvm/include/llvm/MC/MCAsmBackend.h
@@ -174,7 +174,11 @@ class LLVM_ABI MCAsmBackend {
/// instruction.
/// \param STI the subtarget information for the associated instruction.
virtual void relaxInstruction(MCInst &Inst,
- const MCSubtargetInfo &STI) const {};
+ const MCSubtargetInfo &STI) const {
+ llvm_unreachable(
+ "Needed if fixupNeedsRelaxation/fixupNeedsRelaxationAdvanced may "
+ "return true");
+ }
// Defined by linker relaxation targets.
virtual bool relaxDwarfLineAddr(MCDwarfLineAddrFragment &DF,
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
index c3392d3968e92..84884d98e6f9c 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
@@ -84,8 +84,6 @@ class AArch64AsmBackend : public MCAsmBackend {
bool fixupNeedsRelaxation(const MCFixup &Fixup,
uint64_t Value) const override;
- void relaxInstruction(MCInst &Inst,
- const MCSubtargetInfo &STI) const override;
bool writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const override;
@@ -509,11 +507,6 @@ bool AArch64AsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
return int64_t(Value) != int64_t(int8_t(Value));
}
-void AArch64AsmBackend::relaxInstruction(MCInst &Inst,
- const MCSubtargetInfo &STI) const {
- llvm_unreachable("AArch64AsmBackend::relaxInstruction() unimplemented");
-}
-
bool AArch64AsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const {
// If the count is not 4-byte aligned, we must be writing data into the text
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
index 00bb2471c0d2d..5779d4e8ca8cc 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
@@ -128,12 +128,6 @@ class PPCAsmBackend : public MCAsmBackend {
}
}
- void relaxInstruction(MCInst &Inst,
- const MCSubtargetInfo &STI) const override {
- // FIXME.
- llvm_unreachable("relaxInstruction() unimplemented");
- }
-
bool writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const override {
uint64_t NumNops = Count / 4;
diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEAsmBackend.cpp b/llvm/lib/Target/VE/MCTargetDesc/VEAsmBackend.cpp
index 4a7ec5beefb5c..270c1e08397bd 100644
--- a/llvm/lib/Target/VE/MCTargetDesc/VEAsmBackend.cpp
+++ b/llvm/lib/Target/VE/MCTargetDesc/VEAsmBackend.cpp
@@ -123,12 +123,6 @@ class VEAsmBackend : public MCAsmBackend {
return false;
}
- void relaxInstruction(MCInst &Inst,
- const MCSubtargetInfo &STI) const override {
- // Aurora VE doesn't support relaxInstruction yet.
- llvm_unreachable("relaxInstruction() should not be called");
- }
-
bool writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const override {
if ((Count % 8) != 0)
diff --git a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp
index 3c171b59c035d..8ae48d51891e5 100644
--- a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp
+++ b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp
@@ -41,8 +41,6 @@ class XtensaAsmBackend : public MCAsmBackend {
bool IsResolved) override;
bool mayNeedRelaxation(const MCInst &Inst,
const MCSubtargetInfo &STI) const override;
- void relaxInstruction(MCInst &Inst,
- const MCSubtargetInfo &STI) const override;
bool writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const override;
@@ -185,9 +183,6 @@ bool XtensaAsmBackend::mayNeedRelaxation(const MCInst &Inst,
return false;
}
-void XtensaAsmBackend::relaxInstruction(MCInst &Inst,
- const MCSubtargetInfo &STI) const {}
-
bool XtensaAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const {
uint64_t NumNops24b = Count / 3;
More information about the llvm-commits
mailing list