Skip to content

Commit 4cde986

Browse files
committed
LoongArch: Sink #include llvm/BinaryFormat/ELF.h from LoongArchMCExpr.h. NFC
Remove a fishy `#undef LoongArch` and an unneeded user-provided dtor.
1 parent 7d423c0 commit 4cde986

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "LoongArchAsmBackend.h"
1414
#include "LoongArchFixupKinds.h"
15+
#include "llvm/BinaryFormat/ELF.h"
1516
#include "llvm/MC/MCAsmInfo.h"
1617
#include "llvm/MC/MCAssembler.h"
1718
#include "llvm/MC/MCContext.h"
@@ -27,6 +28,12 @@
2728

2829
using namespace llvm;
2930

31+
LoongArchAsmBackend::LoongArchAsmBackend(const MCSubtargetInfo &STI,
32+
uint8_t OSABI, bool Is64Bit,
33+
const MCTargetOptions &Options)
34+
: MCAsmBackend(llvm::endianness::little, ELF::R_LARCH_RELAX), STI(STI),
35+
OSABI(OSABI), Is64Bit(Is64Bit), TargetOptions(Options) {}
36+
3037
std::optional<MCFixupKind>
3138
LoongArchAsmBackend::getFixupKind(StringRef Name) const {
3239
if (STI.getTargetTriple().isOSBinFormatELF()) {

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ class LoongArchAsmBackend : public MCAsmBackend {
3333

3434
public:
3535
LoongArchAsmBackend(const MCSubtargetInfo &STI, uint8_t OSABI, bool Is64Bit,
36-
const MCTargetOptions &Options)
37-
: MCAsmBackend(llvm::endianness::little, ELF::R_LARCH_RELAX), STI(STI),
38-
OSABI(OSABI), Is64Bit(Is64Bit), TargetOptions(Options) {}
39-
~LoongArchAsmBackend() override {}
36+
const MCTargetOptions &Options);
4037

4138
bool handleAddSubRelocations(const MCAssembler &Asm, const MCFragment &F,
4239
const MCFixup &Fixup, const MCValue &Target,

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h

-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
#ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H
1010
#define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHFIXUPKINDS_H
1111

12-
#include "llvm/BinaryFormat/ELF.h"
1312
#include "llvm/MC/MCFixup.h"
1413

15-
#undef LoongArch
16-
1714
namespace llvm {
1815
namespace LoongArch {
1916
//

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "LoongArchFixupKinds.h"
1414
#include "MCTargetDesc/LoongArchMCExpr.h"
1515
#include "MCTargetDesc/LoongArchMCTargetDesc.h"
16+
#include "llvm/BinaryFormat/ELF.h"
1617
#include "llvm/MC/MCCodeEmitter.h"
1718
#include "llvm/MC/MCContext.h"
1819
#include "llvm/MC/MCInstBuilder.h"

0 commit comments

Comments
 (0)