43 class AArch64ELFStreamer;
48 void emitInst(
uint32_t Inst)
override;
54 AArch64TargetAsmStreamer::AArch64TargetAsmStreamer(
MCStreamer &S,
58 void AArch64TargetAsmStreamer::emitInst(
uint32_t Inst) {
78 std::unique_ptr<MCObjectWriter> OW,
79 std::unique_ptr<MCCodeEmitter> Emitter)
82 MappingSymbolCounter(0), LastEMS(EMS_None) {}
88 LastMappingSymbols[getPreviousSection().first] = LastEMS;
89 LastEMS = LastMappingSymbols.lookup(Section);
95 void reset()
override {
96 MappingSymbolCounter = 0;
98 LastMappingSymbols.clear();
105 void EmitInstruction(
const MCInst &Inst,
107 EmitA64MappingSymbol();
119 for (
unsigned I = 0;
I < 4; ++
I) {
120 Buffer[
I] = uint8_t(Inst);
124 EmitA64MappingSymbol();
132 EmitDataMappingSymbol();
140 EmitDataMappingSymbol();
144 void emitFill(
const MCExpr &NumBytes, uint64_t FillValue,
145 SMLoc Loc)
override {
146 EmitDataMappingSymbol();
150 enum ElfMappingSymbol {
156 void EmitDataMappingSymbol() {
157 if (LastEMS == EMS_Data)
159 EmitMappingSymbol(
"$d");
163 void EmitA64MappingSymbol() {
164 if (LastEMS == EMS_A64)
166 EmitMappingSymbol(
"$x");
171 auto *
Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
172 Name +
"." +
Twine(MappingSymbolCounter++)));
176 Symbol->setExternal(
false);
179 int64_t MappingSymbolCounter;
182 ElfMappingSymbol LastEMS;
189 AArch64ELFStreamer &AArch64TargetELFStreamer::getStreamer() {
190 return static_cast<AArch64ELFStreamer &
>(Streamer);
193 void AArch64TargetELFStreamer::emitInst(
uint32_t Inst) {
194 getStreamer().emitInst(Inst);
201 return new AArch64TargetAsmStreamer(S, OS);
205 std::unique_ptr<MCAsmBackend> TAB,
206 std::unique_ptr<MCObjectWriter> OW,
207 std::unique_ptr<MCCodeEmitter> Emitter,
209 AArch64ELFStreamer *S =
new AArch64ELFStreamer(
210 Context, std::move(TAB), std::move(OW), std::move(Emitter));
212 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
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Target specific streamer interface.
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.
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
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.