LLVM 20.0.0git
AArch64ELFStreamer.cpp
Go to the documentation of this file.
1//===- lib/MC/AArch64ELFStreamer.cpp - ELF Object Output for AArch64 ------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file assembles .s files and emits AArch64 ELF .o object files. Different
10// from generic ELF streamer in emitting mapping symbols ($x and $d) to delimit
11// regions of data and code.
12//
13//===----------------------------------------------------------------------===//
14
15#include "AArch64ELFStreamer.h"
16#include "AArch64MCTargetDesc.h"
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/ADT/Twine.h"
23#include "llvm/MC/MCAssembler.h"
25#include "llvm/MC/MCContext.h"
28#include "llvm/MC/MCExpr.h"
29#include "llvm/MC/MCInst.h"
31#include "llvm/MC/MCStreamer.h"
33#include "llvm/MC/MCSymbolELF.h"
40
41using namespace llvm;
42
43namespace {
44
45class AArch64ELFStreamer;
46
47class AArch64TargetAsmStreamer : public AArch64TargetStreamer {
49 std::string VendorTag;
50
51 void emitInst(uint32_t Inst) override;
52
53 void emitDirectiveVariantPCS(MCSymbol *Symbol) override {
54 OS << "\t.variant_pcs\t" << Symbol->getName() << "\n";
55 }
56
57 void emitARM64WinCFIAllocStack(unsigned Size) override {
58 OS << "\t.seh_stackalloc\t" << Size << "\n";
59 }
60 void emitARM64WinCFISaveR19R20X(int Offset) override {
61 OS << "\t.seh_save_r19r20_x\t" << Offset << "\n";
62 }
63 void emitARM64WinCFISaveFPLR(int Offset) override {
64 OS << "\t.seh_save_fplr\t" << Offset << "\n";
65 }
66 void emitARM64WinCFISaveFPLRX(int Offset) override {
67 OS << "\t.seh_save_fplr_x\t" << Offset << "\n";
68 }
69 void emitARM64WinCFISaveReg(unsigned Reg, int Offset) override {
70 OS << "\t.seh_save_reg\tx" << Reg << ", " << Offset << "\n";
71 }
72 void emitARM64WinCFISaveRegX(unsigned Reg, int Offset) override {
73 OS << "\t.seh_save_reg_x\tx" << Reg << ", " << Offset << "\n";
74 }
75 void emitARM64WinCFISaveRegP(unsigned Reg, int Offset) override {
76 OS << "\t.seh_save_regp\tx" << Reg << ", " << Offset << "\n";
77 }
78 void emitARM64WinCFISaveRegPX(unsigned Reg, int Offset) override {
79 OS << "\t.seh_save_regp_x\tx" << Reg << ", " << Offset << "\n";
80 }
81 void emitARM64WinCFISaveLRPair(unsigned Reg, int Offset) override {
82 OS << "\t.seh_save_lrpair\tx" << Reg << ", " << Offset << "\n";
83 }
84 void emitARM64WinCFISaveFReg(unsigned Reg, int Offset) override {
85 OS << "\t.seh_save_freg\td" << Reg << ", " << Offset << "\n";
86 }
87 void emitARM64WinCFISaveFRegX(unsigned Reg, int Offset) override {
88 OS << "\t.seh_save_freg_x\td" << Reg << ", " << Offset << "\n";
89 }
90 void emitARM64WinCFISaveFRegP(unsigned Reg, int Offset) override {
91 OS << "\t.seh_save_fregp\td" << Reg << ", " << Offset << "\n";
92 }
93 void emitARM64WinCFISaveFRegPX(unsigned Reg, int Offset) override {
94 OS << "\t.seh_save_fregp_x\td" << Reg << ", " << Offset << "\n";
95 }
96 void emitARM64WinCFISetFP() override { OS << "\t.seh_set_fp\n"; }
97 void emitARM64WinCFIAddFP(unsigned Size) override {
98 OS << "\t.seh_add_fp\t" << Size << "\n";
99 }
100 void emitARM64WinCFINop() override { OS << "\t.seh_nop\n"; }
101 void emitARM64WinCFISaveNext() override { OS << "\t.seh_save_next\n"; }
102 void emitARM64WinCFIPrologEnd() override { OS << "\t.seh_endprologue\n"; }
103 void emitARM64WinCFIEpilogStart() override { OS << "\t.seh_startepilogue\n"; }
104 void emitARM64WinCFIEpilogEnd() override { OS << "\t.seh_endepilogue\n"; }
105 void emitARM64WinCFITrapFrame() override { OS << "\t.seh_trap_frame\n"; }
106 void emitARM64WinCFIMachineFrame() override { OS << "\t.seh_pushframe\n"; }
107 void emitARM64WinCFIContext() override { OS << "\t.seh_context\n"; }
108 void emitARM64WinCFIECContext() override { OS << "\t.seh_ec_context\n"; }
109 void emitARM64WinCFIClearUnwoundToCall() override {
110 OS << "\t.seh_clear_unwound_to_call\n";
111 }
112 void emitARM64WinCFIPACSignLR() override {
113 OS << "\t.seh_pac_sign_lr\n";
114 }
115
116 void emitARM64WinCFISaveAnyRegI(unsigned Reg, int Offset) override {
117 OS << "\t.seh_save_any_reg\tx" << Reg << ", " << Offset << "\n";
118 }
119 void emitARM64WinCFISaveAnyRegIP(unsigned Reg, int Offset) override {
120 OS << "\t.seh_save_any_reg_p\tx" << Reg << ", " << Offset << "\n";
121 }
122 void emitARM64WinCFISaveAnyRegD(unsigned Reg, int Offset) override {
123 OS << "\t.seh_save_any_reg\td" << Reg << ", " << Offset << "\n";
124 }
125 void emitARM64WinCFISaveAnyRegDP(unsigned Reg, int Offset) override {
126 OS << "\t.seh_save_any_reg_p\td" << Reg << ", " << Offset << "\n";
127 }
128 void emitARM64WinCFISaveAnyRegQ(unsigned Reg, int Offset) override {
129 OS << "\t.seh_save_any_reg\tq" << Reg << ", " << Offset << "\n";
130 }
131 void emitARM64WinCFISaveAnyRegQP(unsigned Reg, int Offset) override {
132 OS << "\t.seh_save_any_reg_p\tq" << Reg << ", " << Offset << "\n";
133 }
134 void emitARM64WinCFISaveAnyRegIX(unsigned Reg, int Offset) override {
135 OS << "\t.seh_save_any_reg_x\tx" << Reg << ", " << Offset << "\n";
136 }
137 void emitARM64WinCFISaveAnyRegIPX(unsigned Reg, int Offset) override {
138 OS << "\t.seh_save_any_reg_px\tx" << Reg << ", " << Offset << "\n";
139 }
140 void emitARM64WinCFISaveAnyRegDX(unsigned Reg, int Offset) override {
141 OS << "\t.seh_save_any_reg_x\td" << Reg << ", " << Offset << "\n";
142 }
143 void emitARM64WinCFISaveAnyRegDPX(unsigned Reg, int Offset) override {
144 OS << "\t.seh_save_any_reg_px\td" << Reg << ", " << Offset << "\n";
145 }
146 void emitARM64WinCFISaveAnyRegQX(unsigned Reg, int Offset) override {
147 OS << "\t.seh_save_any_reg_x\tq" << Reg << ", " << Offset << "\n";
148 }
149 void emitARM64WinCFISaveAnyRegQPX(unsigned Reg, int Offset) override {
150 OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n";
151 }
152
153 void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value,
154 std::string String, bool Override) override {
155
156 // AArch64 build attributes for assembly attribute form:
157 // .aeabi_attribute tag, value
158 if (unsigned(-1) == Value && "" == String) {
159 assert(0 && "Arguments error");
160 return;
161 }
162
163 unsigned VendorID = AArch64BuildAttributes::getVendorID(VendorName);
164
165 switch (VendorID) {
166 default:
167 assert(0 && "Subsection name error");
168 break;
170 if (unsigned(-1) != Value) {
171 OS << "\t.aeabi_attribute" << "\t" << Tag << ", " << Value;
172 AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
173 Override);
174 }
175 if ("" != String) {
176 OS << "\t.aeabi_attribute" << "\t" << Tag << ", " << String;
177 AArch64TargetStreamer::emitAttribute(VendorName, Tag, unsigned(-1),
178 String, Override);
179 }
180 break;
181 // Note: AEABI_FEATURE_AND_BITS takes only unsigned values
183 switch (Tag) {
184 default: // allow emitting any attribute by number
185 OS << "\t.aeabi_attribute" << "\t" << Tag << ", " << Value;
186 // Keep the data structure consistent with the case of ELF emission
187 // (important for llvm-mc asm parsing)
188 AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
189 Override);
190 break;
194 OS << "\t.aeabi_attribute" << "\t"
196 << Value;
197 AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
198 Override);
199 break;
200 }
201 break;
202 // Note: AEABI_PAUTHABI takes only unsigned values
204 switch (Tag) {
205 default: // allow emitting any attribute by number
206 OS << "\t.aeabi_attribute" << "\t" << Tag << ", " << Value;
207 // Keep the data structure consistent with the case of ELF emission
208 // (important for llvm-mc asm parsing)
209 AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
210 Override);
211 break;
214 OS << "\t.aeabi_attribute" << "\t"
216 AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
217 Override);
218 break;
219 }
220 break;
221 }
222 OS << "\n";
223 }
224
226 StringRef SubsectionName,
228 AArch64BuildAttributes::SubsectionType ParameterType) override {
229 // The AArch64 build attributes assembly subsection header format:
230 // ".aeabi_subsection name, optional, parameter type"
231 // optional: required (0) optional (1)
232 // parameter type: uleb128 or ULEB128 (0) ntbs or NTBS (1)
233 unsigned SubsectionID = AArch64BuildAttributes::getVendorID(SubsectionName);
234
235 assert((0 == Optional || 1 == Optional) &&
237 assert((0 == ParameterType || 1 == ParameterType) &&
239
240 std::string SubsectionTag = ".aeabi_subsection";
241 StringRef OptionalStr = getOptionalStr(Optional);
242 StringRef ParameterStr = getTypeStr(ParameterType);
243
244 switch (SubsectionID) {
245 default: {
246 // Treated as a private subsection
247 break;
248 }
251 "subsection .aeabi-pauthabi should be marked as "
252 "required and not as optional");
253 assert(AArch64BuildAttributes::ULEB128 == ParameterType &&
254 "subsection .aeabi-pauthabi should be "
255 "marked as uleb128 and not as ntbs");
256 break;
257 }
260 "subsection .aeabi_feature_and_bits should be "
261 "marked as optional and not as required");
262 assert(AArch64BuildAttributes::ULEB128 == ParameterType &&
263 "subsection .aeabi_feature_and_bits should "
264 "be marked as uleb128 and not as ntbs");
265 break;
266 }
267 }
268 OS << "\t" << SubsectionTag << "\t" << SubsectionName << ", " << OptionalStr
269 << ", " << ParameterStr;
270 // Keep the data structure consistent with the case of ELF emission
271 // (important for llvm-mc asm parsing)
272 AArch64TargetStreamer::emitAtributesSubsection(SubsectionName, Optional,
273 ParameterType);
274 OS << "\n";
275 }
276
277public:
278 AArch64TargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
279};
280
281AArch64TargetAsmStreamer::AArch64TargetAsmStreamer(MCStreamer &S,
283 : AArch64TargetStreamer(S), OS(OS) {}
284
285void AArch64TargetAsmStreamer::emitInst(uint32_t Inst) {
286 OS << "\t.inst\t0x" << Twine::utohexstr(Inst) << "\n";
287}
288
289/// Extend the generic ELFStreamer class so that it can emit mapping symbols at
290/// the appropriate points in the object files. These symbols are defined in the
291/// AArch64 ELF ABI:
292/// infocenter.arm.com/help/topic/com.arm.doc.ihi0056a/IHI0056A_aaelf64.pdf
293///
294/// In brief: $x or $d should be emitted at the start of each contiguous region
295/// of A64 code or data in a section. In practice, this emission does not rely
296/// on explicit assembler directives but on inherent properties of the
297/// directives doing the emission (e.g. ".byte" is data, "add x0, x0, x0" an
298/// instruction).
299///
300/// As a result this system is orthogonal to the DataRegion infrastructure used
301/// by MachO. Beware!
302class AArch64ELFStreamer : public MCELFStreamer {
303public:
305 AArch64ELFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
306 std::unique_ptr<MCObjectWriter> OW,
307 std::unique_ptr<MCCodeEmitter> Emitter)
308 : MCELFStreamer(Context, std::move(TAB), std::move(OW),
309 std::move(Emitter)),
310 LastEMS(EMS_None) {
311 auto *TO = getContext().getTargetOptions();
312 ImplicitMapSyms = TO && TO->ImplicitMapSyms;
313 }
314
315 void changeSection(MCSection *Section, uint32_t Subsection = 0) override {
316 // Save the mapping symbol state for potential reuse when revisiting the
317 // section. When ImplicitMapSyms is true, the initial state is
318 // EMS_A64 for text sections and EMS_Data for the others.
319 LastMappingSymbols[getCurrentSection().first] = LastEMS;
320 auto It = LastMappingSymbols.find(Section);
321 if (It != LastMappingSymbols.end())
322 LastEMS = It->second;
323 else if (ImplicitMapSyms)
324 LastEMS = Section->isText() ? EMS_A64 : EMS_Data;
325 else
326 LastEMS = EMS_None;
327
328 MCELFStreamer::changeSection(Section, Subsection);
329 }
330
331 // Reset state between object emissions
332 void reset() override {
334 LastMappingSymbols.clear();
335 LastEMS = EMS_None;
336 }
337
338 /// This function is the one used to emit instruction data into the ELF
339 /// streamer. We override it to add the appropriate mapping symbol if
340 /// necessary.
341 void emitInstruction(const MCInst &Inst,
342 const MCSubtargetInfo &STI) override {
343 emitA64MappingSymbol();
345 }
346
347 /// Emit a 32-bit value as an instruction. This is only used for the .inst
348 /// directive, EmitInstruction should be used in other cases.
349 void emitInst(uint32_t Inst) {
350 char Buffer[4];
351
352 // We can't just use EmitIntValue here, as that will emit a data mapping
353 // symbol, and swap the endianness on big-endian systems (instructions are
354 // always little-endian).
355 for (char &C : Buffer) {
356 C = uint8_t(Inst);
357 Inst >>= 8;
358 }
359
360 emitA64MappingSymbol();
362 }
363
364 /// This is one of the functions used to emit data into an ELF section, so the
365 /// AArch64 streamer overrides it to add the appropriate mapping symbol ($d)
366 /// if necessary.
367 void emitBytes(StringRef Data) override {
368 emitDataMappingSymbol();
370 }
371
372 /// This is one of the functions used to emit data into an ELF section, so the
373 /// AArch64 streamer overrides it to add the appropriate mapping symbol ($d)
374 /// if necessary.
375 void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override {
376 emitDataMappingSymbol();
378 }
379
380 void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
381 SMLoc Loc) override {
382 emitDataMappingSymbol();
383 MCObjectStreamer::emitFill(NumBytes, FillValue, Loc);
384 }
385
386private:
387 enum ElfMappingSymbol {
388 EMS_None,
389 EMS_A64,
390 EMS_Data
391 };
392
393 void emitDataMappingSymbol() {
394 if (LastEMS == EMS_Data)
395 return;
396 emitMappingSymbol("$d");
397 LastEMS = EMS_Data;
398 }
399
400 void emitA64MappingSymbol() {
401 if (LastEMS == EMS_A64)
402 return;
403 emitMappingSymbol("$x");
404 LastEMS = EMS_A64;
405 }
406
407 MCSymbol *emitMappingSymbol(StringRef Name) {
408 auto *Symbol = cast<MCSymbolELF>(getContext().createLocalSymbol(Name));
409 emitLabel(Symbol);
410 return Symbol;
411 }
412
414 ElfMappingSymbol LastEMS;
415 bool ImplicitMapSyms;
416};
417} // end anonymous namespace
418
419AArch64ELFStreamer &AArch64TargetELFStreamer::getStreamer() {
420 return static_cast<AArch64ELFStreamer &>(Streamer);
421}
422
423void AArch64TargetELFStreamer::emitAtributesSubsection(
427 ParameterType);
428}
429
430void AArch64TargetELFStreamer::emitAttribute(StringRef VendorName, unsigned Tag,
431 unsigned Value, std::string String,
432 bool Override) {
433 if (unsigned(-1) != Value)
434 AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "", Override);
435 if ("" != String)
436 AArch64TargetStreamer::emitAttribute(VendorName, Tag, unsigned(-1), String,
437 Override);
438}
439
440void AArch64TargetELFStreamer::emitInst(uint32_t Inst) {
441 getStreamer().emitInst(Inst);
442}
443
444void AArch64TargetELFStreamer::emitDirectiveVariantPCS(MCSymbol *Symbol) {
445 getStreamer().getAssembler().registerSymbol(*Symbol);
446 cast<MCSymbolELF>(Symbol)->setOther(ELF::STO_AARCH64_VARIANT_PCS);
447}
448
449void AArch64TargetELFStreamer::finish() {
451 AArch64ELFStreamer &S = getStreamer();
452 MCContext &Ctx = S.getContext();
453 auto &Asm = S.getAssembler();
454
455 S.emitAttributesSection(AttributeSection, ".ARM.attributes",
457
458 // If ImplicitMapSyms is specified, ensure that text sections end with
459 // the A64 state while non-text sections end with the data state. When
460 // sections are combined by the linker, the subsequent section will start with
461 // the right state. The ending mapping symbol is added right after the last
462 // symbol relative to the section. When a dumb linker combines (.text.0; .word
463 // 0) and (.text.1; .word 0), the ending $x of .text.0 precedes the $d of
464 // .text.1, even if they have the same address.
465 if (S.ImplicitMapSyms) {
466 auto &Syms = Asm.getSymbols();
467 const size_t NumSyms = Syms.size();
469 for (MCSection &Sec : Asm) {
470 S.switchSection(&Sec);
471 if (S.LastEMS == (Sec.isText() ? AArch64ELFStreamer::EMS_Data
472 : AArch64ELFStreamer::EMS_A64))
473 EndMapSym.insert(
474 {&Sec, {NumSyms, S.emitMappingSymbol(Sec.isText() ? "$x" : "$d")}});
475 }
476 if (Syms.size() != NumSyms) {
479 Syms.truncate(NumSyms);
480 // Find the last symbol index for each candidate section.
481 for (auto [I, Sym] : llvm::enumerate(Syms)) {
482 if (!Sym->isInSection())
483 continue;
484 auto It = EndMapSym.find(&Sym->getSection());
485 if (It != EndMapSym.end())
486 It->second.first = I;
487 }
489 for (auto [I, Sym] : llvm::enumerate(Syms)) {
490 NewSyms.push_back(Sym);
491 if (!Sym->isInSection())
492 continue;
493 auto It = EndMapSym.find(&Sym->getSection());
494 // If `Sym` is the last symbol relative to the section, add the ending
495 // mapping symbol after `Sym`.
496 if (It != EndMapSym.end() && I == It->second.first) {
497 NewSyms.push_back(It->second.second);
498 Idx.push_back(I);
499 }
500 }
501 Syms = std::move(NewSyms);
502 // F.second holds the number of symbols added before the FILE symbol.
503 // Take into account the inserted mapping symbols.
504 for (auto &F : S.getWriter().getFileNames())
505 F.second += llvm::lower_bound(Idx, F.second) - Idx.begin();
506 }
507 }
508
509 MCSectionELF *MemtagSec = nullptr;
510 for (const MCSymbol &Symbol : Asm.symbols()) {
511 const auto &Sym = cast<MCSymbolELF>(Symbol);
512 if (Sym.isMemtag()) {
513 MemtagSec = Ctx.getELFSection(".memtag.globals.static",
515 break;
516 }
517 }
518 if (!MemtagSec)
519 return;
520
521 // switchSection registers the section symbol and invalidates symbols(). We
522 // need a separate symbols() loop.
523 S.switchSection(MemtagSec);
524 const auto *Zero = MCConstantExpr::create(0, Ctx);
525 for (const MCSymbol &Symbol : Asm.symbols()) {
526 const auto &Sym = cast<MCSymbolELF>(Symbol);
527 if (!Sym.isMemtag())
528 continue;
530 (void)S.emitRelocDirective(*Zero, "BFD_RELOC_NONE", SRE, SMLoc(),
531 *Ctx.getSubtargetInfo());
532 }
533}
534
537 MCInstPrinter *InstPrint) {
538 return new AArch64TargetAsmStreamer(S, OS);
539}
540
543 std::unique_ptr<MCAsmBackend> TAB,
544 std::unique_ptr<MCObjectWriter> OW,
545 std::unique_ptr<MCCodeEmitter> Emitter) {
546 AArch64ELFStreamer *S = new AArch64ELFStreamer(
547 Context, std::move(TAB), std::move(OW), std::move(Emitter));
548 return S;
549}
dxil DXContainer Global Emitter
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
std::string Name
uint64_t Size
Symbol * Sym
Definition: ELF_riscv.cpp:479
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
virtual void emitARM64WinCFISaveAnyRegIX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveRegP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegDPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegDX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveRegPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQ(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegD(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveFReg(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegI(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveFRegPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveRegX(unsigned Reg, int Offset)
virtual void emitARM64WinCFIAllocStack(unsigned Size)
virtual void emitARM64WinCFISaveFPLRX(int Offset)
virtual void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value, std::string String, bool Override)
virtual void emitDirectiveVariantPCS(MCSymbol *Symbol)
Callback used to implement the .variant_pcs directive.
virtual void emitARM64WinCFISaveR19R20X(int Offset)
virtual void emitARM64WinCFIAddFP(unsigned Size)
virtual void emitARM64WinCFISaveFPLR(int Offset)
virtual void emitARM64WinCFIClearUnwoundToCall()
virtual void emitARM64WinCFISaveFRegP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegQPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveFRegX(unsigned Reg, int Offset)
SmallVector< MCELFStreamer::AttributeSubSection, 64 > AttributeSubSections
virtual void emitARM64WinCFISaveAnyRegDP(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveAnyRegIPX(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveReg(unsigned Reg, int Offset)
virtual void emitARM64WinCFISaveLRPair(unsigned Reg, int Offset)
virtual void emitAtributesSubsection(StringRef VendorName, AArch64BuildAttributes::SubsectionOptional IsOptional, AArch64BuildAttributes::SubsectionType ParameterType)
Build attributes implementation.
virtual void emitInst(uint32_t Inst)
Callback used to implement the .inst directive.
virtual void emitARM64WinCFISaveAnyRegIP(unsigned Reg, int Offset)
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:156
iterator end()
Definition: DenseMap.h:84
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:211
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition: MCExpr.cpp:222
Context object for machine code objects.
Definition: MCContext.h:83
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:551
const MCTargetOptions * getTargetOptions() const
Definition: MCContext.h:420
const MCSubtargetInfo * getSubtargetInfo() const
Definition: MCContext.h:418
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
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.
void reset() override
state management
Definition: MCELFStreamer.h:41
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:46
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:185
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override
Emit Size bytes worth of the value specified by FillValue.
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
This represents a section on linux, lots of unix variants and some bare metal systems.
Definition: MCSectionELF.h:27
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:36
Streaming machine code generation interface.
Definition: MCStreamer.h:213
MCContext & getContext() const
Definition: MCStreamer.h:300
MCSectionSubPair getCurrentSection() const
Return the current section that the streamer is emitting code to.
Definition: MCStreamer.h:395
Generic base class for all target subtargets.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:398
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Target specific streamer interface.
Definition: MCStreamer.h:94
MCStreamer & Streamer
Definition: MCStreamer.h:96
Represents a location in source code.
Definition: SMLoc.h:23
void push_back(const T &Elt)
Definition: SmallVector.h:413
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
static Twine utohexstr(const uint64_t &Val)
Definition: Twine.h:416
LLVM Value Representation.
Definition: Value.h:74
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
StringRef getPauthABITagsStr(unsigned PauthABITag)
StringRef getOptionalStr(unsigned Optional)
VendorID
AArch64 build attributes vendors IDs (a.k.a subsection name)
VendorID getVendorID(StringRef const Vendor)
StringRef getTypeStr(unsigned Type)
StringRef getFeatureAndBitsTagsStr(unsigned FeatureAndBitsTag)
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
@ STO_AARCH64_VARIANT_PCS
Definition: ELF.h:435
@ SHT_AARCH64_MEMTAG_GLOBALS_STATIC
Definition: ELF.h:1168
@ SHT_AARCH64_ATTRIBUTES
Definition: ELF.h:1162
Reg
All possible values of the reg field in the ModR/M byte.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
MCTargetStreamer * createAArch64AsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint)
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
Definition: STLExtras.h:2448
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1978
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1873
MCELFStreamer * createAArch64ELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858