LLVM: lib/MC/MCAsmBackend.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
21#include
22#include
23#include
24
25using namespace llvm;
26
28 : Endian(Endian), RelaxFixupKind(RelaxFixupKind) {}
29
31
32std::unique_ptr
36 switch (TW->getFormat()) {
38 return std::make_unique(
39 cast(std::move(TW)), OS, IsLE);
42 cast(std::move(TW)), OS);
44 return std::make_unique(
45 cast(std::move(TW)), OS, IsLE);
48 cast(std::move(TW)), OS);
57 cast(std::move(TW)), OS);
59 return std::make_unique(
60 cast(std::move(TW)), OS);
61 default:
63 }
64}
65
66std::unique_ptr
70 switch (TW->getFormat()) {
73 cast(std::move(TW)), OS, DwoOS);
75 return std::make_unique(
76 cast(std::move(TW)), OS, DwoOS,
80 cast(std::move(TW)), OS, DwoOS);
81 default:
83 }
84}
85
87 return std::nullopt;
88}
89
92 {"FK_NONE", 0, 0, 0},
93 {"FK_Data_1", 0, 8, 0},
94 {"FK_Data_2", 0, 16, 0},
95 {"FK_Data_4", 0, 32, 0},
96 {"FK_Data_8", 0, 64, 0},
97 {"FK_Data_leb128", 0, 0, 0},
102 {"FK_GPRel_1", 0, 8, 0},
103 {"FK_GPRel_2", 0, 16, 0},
104 {"FK_GPRel_4", 0, 32, 0},
105 {"FK_GPRel_8", 0, 64, 0},
106 {"FK_DTPRel_4", 0, 32, 0},
107 {"FK_DTPRel_8", 0, 64, 0},
108 {"FK_TPRel_4", 0, 32, 0},
109 {"FK_TPRel_8", 0, 64, 0},
110 {"FK_SecRel_1", 0, 8, 0},
111 {"FK_SecRel_2", 0, 16, 0},
112 {"FK_SecRel_4", 0, 32, 0},
113 {"FK_SecRel_8", 0, 64, 0},
114 };
115
116 assert((size_t)Kind <= std::size(Builtins) && "Unknown fixup kind");
117 return Builtins[Kind];
118}
119
124 const bool WasForced) const {
125 if (!Resolved)
126 return true;
128}
129
131
132
133 if ()
134 return true;
135
136 if (->isMachO())
138
140
141
142
143 return name == "___gxx_personality_v0" || name == "___objc_personality_v0";
144}
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::unique_ptr< MCObjectWriter > createObjectWriter(raw_pwrite_stream &OS) const
Create a new MCObjectWriter instance for use by the assembler backend to emit the final object file.
std::unique_ptr< MCObjectWriter > createDwoObjectWriter(raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS) const
Create an MCObjectWriter that writes two object files: a .o file which is linked into the final progr...
const llvm::endianness Endian
MCAsmBackend(llvm::endianness Endian, unsigned RelaxFixupKind=MaxFixupKind)
virtual bool fixupNeedsRelaxationAdvanced(const MCAssembler &Asm, const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, const bool WasForced) const
Target specific predicate for whether a given fixup requires the associated instruction to be relaxed...
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value) const
Simple predicate for targets where !Resolved implies requiring relaxation.
bool isDarwinCanonicalPersonality(const MCSymbol *Sym) const
virtual std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const =0
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
virtual std::optional< MCFixupKind > getFixupKind(StringRef Name) const
Map a relocation name used in .reloc to a fixup kind.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
An abstract base class for streams implementations that also support a pwrite operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectWriter > createGOFFObjectWriter(std::unique_ptr< MCGOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new GOFF writer instance.
std::unique_ptr< MCObjectWriter > createWasmObjectWriter(std::unique_ptr< MCWasmObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new Wasm writer instance.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
std::unique_ptr< MCObjectWriter > createWinCOFFDwoObjectWriter(std::unique_ptr< MCWinCOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS)
MCFixupKind
Extensible enumeration to represent the type of a fixup.
std::unique_ptr< MCObjectWriter > createWinCOFFObjectWriter(std::unique_ptr< MCWinCOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new Win COFF writer instance.
std::unique_ptr< MCObjectWriter > createSPIRVObjectWriter(std::unique_ptr< MCSPIRVObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new SPIR-V writer instance.
std::unique_ptr< MCObjectWriter > createXCOFFObjectWriter(std::unique_ptr< MCXCOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
std::unique_ptr< MCObjectWriter > createWasmDwoObjectWriter(std::unique_ptr< MCWasmObjectTargetWriter > MOTW, raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS)
Target independent information on a fixup kind.
@ FKF_IsPCRel
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...