44 class AArch64ELFStreamer;
49 void emitInst(
uint32_t Inst)
override;
55 AArch64TargetAsmStreamer::AArch64TargetAsmStreamer(
MCStreamer &S,
59 void AArch64TargetAsmStreamer::emitInst(
uint32_t Inst) {
65 AArch64ELFStreamer &getStreamer();
67 void emitInst(
uint32_t Inst)
override;
88 friend class AArch64TargetELFStreamer;
91 std::unique_ptr<MCObjectWriter> OW,
92 std::unique_ptr<MCCodeEmitter> Emitter)
95 MappingSymbolCounter(0), LastEMS(EMS_None) {}
101 LastMappingSymbols[getPreviousSection().first] = LastEMS;
102 LastEMS = LastMappingSymbols.lookup(Section);
108 void reset()
override {
109 MappingSymbolCounter = 0;
111 LastMappingSymbols.clear();
120 EmitA64MappingSymbol();
132 for (
unsigned I = 0;
I < 4; ++
I) {
133 Buffer[
I] = uint8_t(Inst);
137 EmitA64MappingSymbol();
145 EmitDataMappingSymbol();
153 EmitDataMappingSymbol();
158 enum ElfMappingSymbol {
164 void EmitDataMappingSymbol() {
165 if (LastEMS == EMS_Data)
167 EmitMappingSymbol(
"$d");
171 void EmitA64MappingSymbol() {
172 if (LastEMS == EMS_A64)
174 EmitMappingSymbol(
"$x");
179 auto *
Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
180 Name +
"." +
Twine(MappingSymbolCounter++)));
184 Symbol->setExternal(
false);
187 int64_t MappingSymbolCounter;
190 ElfMappingSymbol LastEMS;
195 AArch64ELFStreamer &AArch64TargetELFStreamer::getStreamer() {
196 return static_cast<AArch64ELFStreamer &
>(Streamer);
199 void AArch64TargetELFStreamer::emitInst(
uint32_t Inst) {
200 getStreamer().emitInst(Inst);
209 return new AArch64TargetAsmStreamer(S, OS);
213 std::unique_ptr<MCAsmBackend> TAB,
214 std::unique_ptr<MCObjectWriter> OW,
215 std::unique_ptr<MCCodeEmitter> Emitter,
217 AArch64ELFStreamer *S =
new AArch64ELFStreamer(
218 Context, std::move(TAB), std::move(OW), std::move(Emitter));
220 S->getAssembler().setRelaxAll(
true);
228 return new AArch64TargetELFStreamer(S);
230 return new AArch64TargetWinCOFFStreamer(S);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void EmitBytes(StringRef Data) override
Emit the bytes in Data into the output.
Compute iterated dominance frontiers using a linear time algorithm.
void reset() override
state management
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Target specific streamer interface.
const Triple & getTargetTriple() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Base class for the full range of assembler expressions which are needed for parsing.
Context object for machine code objects.
void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) override
Emit the expression Value into the output as a native integer of the given Size bytes.
MCELFStreamer * createAArch64ELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter, bool RelaxAll)
Instances of this class represent a single low-level machine instruction.
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
Streaming machine code generation interface.
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Triple - Helper class for working with autoconf configuration names.
MCTargetStreamer * createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
static Twine utohexstr(const uint64_t &Val)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
MCTargetStreamer * createAArch64AsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Generic base class for all target subtargets.
LLVM Value Representation.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
StringRef - Represent a constant reference to a string, i.e.
Represents a location in source code.
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool=false) override
Emit the given Instruction into the current section.