44 class AArch64ELFStreamer;
49 void emitInst(
uint32_t Inst)
override;
55 AArch64TargetAsmStreamer::AArch64TargetAsmStreamer(
MCStreamer &S,
59 void AArch64TargetAsmStreamer::emitInst(
uint32_t Inst) {
79 std::unique_ptr<MCObjectWriter> OW,
80 std::unique_ptr<MCCodeEmitter> Emitter)
83 MappingSymbolCounter(0), LastEMS(EMS_None) {}
89 LastMappingSymbols[getPreviousSection().first] = LastEMS;
90 LastEMS = LastMappingSymbols.lookup(Section);
96 void reset()
override {
97 MappingSymbolCounter = 0;
99 LastMappingSymbols.clear();
108 EmitA64MappingSymbol();
120 for (
unsigned I = 0;
I < 4; ++
I) {
121 Buffer[
I] = uint8_t(Inst);
125 EmitA64MappingSymbol();
133 EmitDataMappingSymbol();
141 EmitDataMappingSymbol();
145 void emitFill(
const MCExpr &NumBytes, uint64_t FillValue,
146 SMLoc Loc)
override {
147 EmitDataMappingSymbol();
151 enum ElfMappingSymbol {
157 void EmitDataMappingSymbol() {
158 if (LastEMS == EMS_Data)
160 EmitMappingSymbol(
"$d");
164 void EmitA64MappingSymbol() {
165 if (LastEMS == EMS_A64)
167 EmitMappingSymbol(
"$x");
172 auto *
Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
173 Name +
"." +
Twine(MappingSymbolCounter++)));
177 Symbol->setExternal(
false);
180 int64_t MappingSymbolCounter;
183 ElfMappingSymbol LastEMS;
190 AArch64ELFStreamer &AArch64TargetELFStreamer::getStreamer() {
191 return static_cast<AArch64ELFStreamer &
>(Streamer);
194 void AArch64TargetELFStreamer::emitInst(
uint32_t Inst) {
195 getStreamer().emitInst(Inst);
202 return new AArch64TargetAsmStreamer(S, OS);
206 std::unique_ptr<MCAsmBackend> TAB,
207 std::unique_ptr<MCObjectWriter> OW,
208 std::unique_ptr<MCCodeEmitter> Emitter,
210 AArch64ELFStreamer *S =
new AArch64ELFStreamer(
211 Context, std::move(TAB), std::move(OW), std::move(Emitter));
213 S->getAssembler().setRelaxAll(
true);
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.
This class represents lattice values for constants.
void reset() override
state management
Target specific streamer interface.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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 emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override
Emit Size bytes worth of the value specified by FillValue.
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.
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.
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.