LoongArch: Sink #include llvm/BinaryFormat/ELF.h from LoongArchMCExpr.h. NFC Remove a fishy `#undef LoongArch` and an unneeded user-provided dtor.
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp index eaf56f6..23d936b 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
@@ -12,6 +12,7 @@ #include "LoongArchAsmBackend.h" #include "LoongArchFixupKinds.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" @@ -27,6 +28,12 @@ using namespace llvm; +LoongArchAsmBackend::LoongArchAsmBackend(const MCSubtargetInfo &STI, + uint8_t OSABI, bool Is64Bit, + const MCTargetOptions &Options) + : MCAsmBackend(llvm::endianness::little, ELF::R_LARCH_RELAX), STI(STI), + OSABI(OSABI), Is64Bit(Is64Bit), TargetOptions(Options) {} + std::optional<MCFixupKind> LoongArchAsmBackend::getFixupKind(StringRef Name) const { if (STI.getTargetTriple().isOSBinFormatELF()) {
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h index ec78f34..94518ac 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
@@ -33,10 +33,7 @@ public: LoongArchAsmBackend(const MCSubtargetInfo &STI, uint8_t OSABI, bool Is64Bit, - const MCTargetOptions &Options) - : MCAsmBackend(llvm::endianness::little, ELF::R_LARCH_RELAX), STI(STI), - OSABI(OSABI), Is64Bit(Is64Bit), TargetOptions(Options) {} - ~LoongArchAsmBackend() override {} + const MCTargetOptions &Options); bool handleAddSubRelocations(const MCAssembler &Asm, const MCFragment &F, const MCFixup &Fixup, const MCValue &Target,
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h index 515eab0..d4c2323 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h
@@ -9,11 +9,8 @@ #ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H #define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H -#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCFixup.h" -#undef LoongArch - namespace llvm { namespace LoongArch { //
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp index b72d84e..fa965d1 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp
@@ -13,6 +13,7 @@ #include "LoongArchFixupKinds.h" #include "MCTargetDesc/LoongArchMCExpr.h" #include "MCTargetDesc/LoongArchMCTargetDesc.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInstBuilder.h"