LLVM 20.0.0git
AsmPrinter.h
Go to the documentation of this file.
1//===- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework ---------*- C++ -*-===//
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 contains a class to be used as the base class for target specific
10// asm writers. This class primarily handles common functionality used by
11// all asm writers.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CODEGEN_ASMPRINTER_H
16#define LLVM_CODEGEN_ASMPRINTER_H
17
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/MapVector.h"
26#include "llvm/IR/InlineAsm.h"
28#include <cstdint>
29#include <memory>
30#include <utility>
31#include <vector>
32
33namespace llvm {
34
35class AddrLabelMap;
36class AsmPrinterHandler;
37class BasicBlock;
38class BlockAddress;
39class Constant;
40class ConstantArray;
41class ConstantPtrAuth;
42class DataLayout;
43class DebugHandlerBase;
44class DIE;
45class DIEAbbrev;
46class DwarfDebug;
47class GCMetadataPrinter;
48class GCStrategy;
49class GlobalAlias;
50class GlobalObject;
51class GlobalValue;
52class GlobalVariable;
53class MachineBasicBlock;
54class MachineConstantPoolValue;
55class MachineDominatorTree;
56class MachineFunction;
57class MachineInstr;
58class MachineJumpTableInfo;
59class MachineLoopInfo;
60class MachineModuleInfo;
61class MachineOptimizationRemarkEmitter;
62class MCAsmInfo;
63class MCCFIInstruction;
64class MCContext;
65class MCExpr;
66class MCInst;
67class MCSection;
68class MCStreamer;
69class MCSubtargetInfo;
70class MCSymbol;
71class MCTargetOptions;
72class MDNode;
73class Module;
74class PseudoProbeHandler;
75class raw_ostream;
76class StringRef;
77class TargetLoweringObjectFile;
78class TargetMachine;
79class Twine;
80
81namespace remarks {
82class RemarkStreamer;
83}
84
85/// This class is intended to be used as a driving class for all asm writers.
87public:
88 /// Target machine description.
90
91 /// Target Asm Printer information.
92 const MCAsmInfo *MAI = nullptr;
93
94 /// This is the context for the output file that we are streaming. This owns
95 /// all of the global MC-related objects for the generated translation unit.
97
98 /// This is the MCStreamer object for the file we are generating. This
99 /// contains the transient state for the current translation unit that we are
100 /// generating (such as the current section etc).
101 std::unique_ptr<MCStreamer> OutStreamer;
102
103 /// The current machine function.
104 MachineFunction *MF = nullptr;
105
106 /// This is a pointer to the current MachineModuleInfo.
108
109 /// This is a pointer to the current MachineDominatorTree.
111
112 /// This is a pointer to the current MachineLoopInfo.
114
115 /// Optimization remark emitter.
117
118 /// The symbol for the entry in __patchable_function_entires.
120
121 /// The symbol for the current function. This is recalculated at the beginning
122 /// of each call to runOnMachineFunction().
124
125 /// The symbol for the current function descriptor on AIX. This is created
126 /// at the beginning of each call to SetupMachineFunction().
128
129 /// The symbol used to represent the start of the current function for the
130 /// purpose of calculating its size (e.g. using the .size directive). By
131 /// default, this is equal to CurrentFnSym.
133
134 /// Map a basic block section ID to the begin and end symbols of that section
135 /// which determine the section's range.
138 };
139
141
142 /// Map global GOT equivalent MCSymbols to GlobalVariables and keep track of
143 /// its number of uses by other globals.
144 using GOTEquivUsePair = std::pair<const GlobalVariable *, unsigned>;
146
147 // Flags representing which CFI section is required for a function/module.
148 enum class CFISection : unsigned {
149 None = 0, ///< Do not emit either .eh_frame or .debug_frame
150 EH = 1, ///< Emit .eh_frame
151 Debug = 2 ///< Emit .debug_frame
152 };
153
154private:
155 MCSymbol *CurrentFnEnd = nullptr;
156
157 /// Map a basic block section ID to the exception symbol associated with that
158 /// section. Map entries are assigned and looked up via
159 /// AsmPrinter::getMBBExceptionSym.
160 DenseMap<MBBSectionID, MCSymbol *> MBBSectionExceptionSyms;
161
162 // The symbol used to represent the start of the current BB section of the
163 // function. This is used to calculate the size of the BB section.
164 MCSymbol *CurrentSectionBeginSym = nullptr;
165
166 /// This map keeps track of which symbol is being used for the specified basic
167 /// block's address of label.
168 std::unique_ptr<AddrLabelMap> AddrLabelSymbols;
169
170 /// The garbage collection metadata printer table.
172
173 /// Emit comments in assembly output if this is true.
174 bool VerboseAsm;
175
176 /// Output stream for the stack usage file (i.e., .su file).
177 std::unique_ptr<raw_fd_ostream> StackUsageStream;
178
179 /// List of symbols to be inserted into PC sections.
181
182 static char ID;
183
184protected:
186
187 /// For dso_local functions, the current $local alias for the function.
189
190 /// A vector of all debug/EH info emitters we should use. This vector
191 /// maintains ownership of the emitters.
193 size_t NumUserHandlers = 0;
194
195 /// Debuginfo handler. Protected so that targets can add their own.
198
200
201private:
202 /// If generated on the fly this own the instance.
203 std::unique_ptr<MachineDominatorTree> OwnedMDT;
204
205 /// If generated on the fly this own the instance.
206 std::unique_ptr<MachineLoopInfo> OwnedMLI;
207
208 /// If the target supports dwarf debug info, this pointer is non-null.
209 DwarfDebug *DD = nullptr;
210
211 /// A handler that supports pseudo probe emission with embedded inline
212 /// context.
213 std::unique_ptr<PseudoProbeHandler> PP;
214
215 /// CFISection type the module needs i.e. either .eh_frame or .debug_frame.
216 CFISection ModuleCFISection = CFISection::None;
217
218 /// True if the module contains split-stack functions. This is used to
219 /// emit .note.GNU-split-stack section as required by the linker for
220 /// special handling split-stack function calling no-split-stack function.
221 bool HasSplitStack = false;
222
223 /// True if the module contains no-split-stack functions. This is used to emit
224 /// .note.GNU-no-split-stack section when it also contains functions without a
225 /// split stack prologue.
226 bool HasNoSplitStack = false;
227
228 /// True if debugging information is available in this module.
229 bool DbgInfoAvailable = false;
230
231protected:
232 explicit AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer);
233
234public:
235 ~AsmPrinter() override;
236
237 DwarfDebug *getDwarfDebug() { return DD; }
238 DwarfDebug *getDwarfDebug() const { return DD; }
239
242
243 bool isDwarf64() const;
244
245 /// Returns 4 for DWARF32 and 8 for DWARF64.
246 unsigned int getDwarfOffsetByteSize() const;
247
248 /// Returns 4 for DWARF32 and 12 for DWARF64.
249 unsigned int getUnitLengthFieldByteSize() const;
250
251 /// Returns information about the byte size of DW_FORM values.
253
254 bool isPositionIndependent() const;
255
256 /// Return true if assembly output should contain comments.
257 bool isVerbose() const { return VerboseAsm; }
258
259 /// Return a unique ID for the current function.
260 unsigned getFunctionNumber() const;
261
262 /// Return symbol for the function pseudo stack if the stack frame is not a
263 /// register based.
264 virtual const MCSymbol *getFunctionFrameSymbol() const { return nullptr; }
265
267 MCSymbol *getFunctionEnd() const { return CurrentFnEnd; }
268
269 // Return the exception symbol associated with the MBB section containing a
270 // given basic block.
272
273 /// Return the symbol to be used for the specified basic block when its
274 /// address is taken. This cannot be its normal LBB label because the block
275 /// may be accessed outside its containing function.
277 return getAddrLabelSymbolToEmit(BB).front();
278 }
279
280 /// Return the symbol to be used for the specified basic block when its
281 /// address is taken. If other blocks were RAUW'd to this one, we may have
282 /// to emit them as well, return the whole set.
284
285 /// If the specified function has had any references to address-taken blocks
286 /// generated, but the block got deleted, return the symbol now so we can
287 /// emit it. This prevents emitting a reference to a symbol that has no
288 /// definition.
290 std::vector<MCSymbol *> &Result);
291
292 /// Return information about object file lowering.
294
295 /// Return information about data layout.
296 const DataLayout &getDataLayout() const;
297
298 /// Return the pointer size from the TargetMachine
299 unsigned getPointerSize() const;
300
301 /// Return information about subtarget.
302 const MCSubtargetInfo &getSubtargetInfo() const;
303
304 void EmitToStreamer(MCStreamer &S, const MCInst &Inst);
305
306 /// Emits inital debug location directive.
308
309 /// Return the current section we are emitting to.
310 const MCSection *getCurrentSection() const;
311
313 const GlobalValue *GV) const;
314
315 MCSymbol *getSymbol(const GlobalValue *GV) const;
316
317 /// Similar to getSymbol() but preferred for references. On ELF, this uses a
318 /// local symbol if a reference to GV is guaranteed to be resolved to the
319 /// definition in the same module.
320 MCSymbol *getSymbolPreferLocal(const GlobalValue &GV) const;
321
323 return DwarfUsesRelocationsAcrossSections;
324 }
325
327 DwarfUsesRelocationsAcrossSections = Enable;
328 }
329
330 //===------------------------------------------------------------------===//
331 // XRay instrumentation implementation.
332 //===------------------------------------------------------------------===//
333public:
334 // This describes the kind of sled we're storing in the XRay table.
335 enum class SledKind : uint8_t {
336 FUNCTION_ENTER = 0,
337 FUNCTION_EXIT = 1,
338 TAIL_CALL = 2,
339 LOG_ARGS_ENTER = 3,
340 CUSTOM_EVENT = 4,
341 TYPED_EVENT = 5,
342 };
343
344 // The table will contain these structs that point to the sled, the function
345 // containing the sled, and what kind of sled (and whether they should always
346 // be instrumented). We also use a version identifier that the runtime can use
347 // to decide what to do with the sled, depending on the version of the sled.
353 const class Function *Fn;
354 uint8_t Version;
355
356 void emit(int, MCStreamer *) const;
357 };
358
359 // All the sleds to be emitted.
361
362 // Helper function to record a given XRay sled.
363 void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind,
364 uint8_t Version = 0);
365
366 /// Emit a table with all XRay instrumentation points.
367 void emitXRayTable();
368
370
371 //===------------------------------------------------------------------===//
372 // MachineFunctionPass Implementation.
373 //===------------------------------------------------------------------===//
374
375 /// Record analysis usage.
376 void getAnalysisUsage(AnalysisUsage &AU) const override;
377
378 /// Set up the AsmPrinter when we are working on a new module. If your pass
379 /// overrides this, it must make sure to explicitly call this implementation.
380 bool doInitialization(Module &M) override;
381
382 /// Shut down the asmprinter. If you override this in your pass, you must make
383 /// sure to call it explicitly.
384 bool doFinalization(Module &M) override;
385
386 /// Emit the specified function out to the OutStreamer.
390 return false;
391 }
392
393 //===------------------------------------------------------------------===//
394 // Coarse grained IR lowering routines.
395 //===------------------------------------------------------------------===//
396
397 /// This should be called when a new MachineFunction is being processed from
398 /// runOnMachineFunction.
400
401 /// This method emits the body and trailer for a function.
402 void emitFunctionBody();
403
405
406 void emitFrameAlloc(const MachineInstr &MI);
407
409
410 void emitStackUsage(const MachineFunction &MF);
411
413
414 void emitKCFITrapEntry(const MachineFunction &MF, const MCSymbol *Symbol);
415 virtual void emitKCFITypeId(const MachineFunction &MF);
416
417 void emitPseudoProbe(const MachineInstr &MI);
418
420
421 /// Emits a label as reference for PC sections.
422 void emitPCSectionsLabel(const MachineFunction &MF, const MDNode &MD);
423
424 /// Emits the PC sections collected from instructions.
425 void emitPCSections(const MachineFunction &MF);
426
427 /// Get the CFISection type for a function.
429
430 /// Get the CFISection type for a function.
432
433 /// Get the CFISection type for the module.
434 CFISection getModuleCFISectionType() const { return ModuleCFISection; }
435
436 /// Returns true if valid debug info is present.
437 bool hasDebugInfo() const { return DbgInfoAvailable; }
438
439 bool needsSEHMoves();
440
441 /// Since emitting CFI unwind information is entangled with supporting the
442 /// exceptions, this returns true for platforms which use CFI unwind
443 /// information for other purposes (debugging, sanitizers, ...) when
444 /// `MCAsmInfo::ExceptionsType == ExceptionHandling::None`.
445 bool usesCFIWithoutEH() const;
446
447 /// Print to the current output stream assembly representations of the
448 /// constants in the constant pool MCP. This is used to print out constants
449 /// which have been "spilled to memory" by the code generator.
450 virtual void emitConstantPool();
451
452 /// Print assembly representations of the jump tables used by the current
453 /// function to the current output stream.
454 virtual void emitJumpTableInfo();
455
456 /// Emit the specified global variable to the .s file.
457 virtual void emitGlobalVariable(const GlobalVariable *GV);
458
459 /// Check to see if the specified global is a special global used by LLVM. If
460 /// so, emit it and return true, otherwise do nothing and return false.
462
463 /// `llvm.global_ctors` and `llvm.global_dtors` are arrays of Structor
464 /// structs.
465 ///
466 /// Priority - init priority
467 /// Func - global initialization or global clean-up function
468 /// ComdatKey - associated data
469 struct Structor {
470 int Priority = 0;
471 Constant *Func = nullptr;
473
474 Structor() = default;
475 };
476
477 /// This method gathers an array of Structors and then sorts them out by
478 /// Priority.
479 /// @param List The initializer of `llvm.global_ctors` or `llvm.global_dtors`
480 /// array.
481 /// @param[out] Structors Sorted Structor structs by Priority.
483 SmallVector<Structor, 8> &Structors);
484
485 /// This method emits `llvm.global_ctors` or `llvm.global_dtors` list.
486 virtual void emitXXStructorList(const DataLayout &DL, const Constant *List,
487 bool IsCtor);
488
489 /// Emit an alignment directive to the specified power of two boundary. If a
490 /// global value is specified, and if that global has an explicit alignment
491 /// requested, it will override the alignment request if required for
492 /// correctness.
493 void emitAlignment(Align Alignment, const GlobalObject *GV = nullptr,
494 unsigned MaxBytesToEmit = 0) const;
495
496 /// Lower the specified LLVM Constant to an MCExpr.
497 virtual const MCExpr *lowerConstant(const Constant *CV);
498
499 /// Print a general LLVM constant to the .s file.
500 /// On AIX, when an alias refers to a sub-element of a global variable, the
501 /// label of that alias needs to be emitted before the corresponding element.
503 void emitGlobalConstant(const DataLayout &DL, const Constant *CV,
504 AliasMapTy *AliasList = nullptr);
505
506 /// Unnamed constant global variables solely contaning a pointer to
507 /// another globals variable act like a global variable "proxy", or GOT
508 /// equivalents, i.e., it's only used to hold the address of the latter. One
509 /// optimization is to replace accesses to these proxies by using the GOT
510 /// entry for the final global instead. Hence, we select GOT equivalent
511 /// candidates among all the module global variables, avoid emitting them
512 /// unnecessarily and finally replace references to them by pc relative
513 /// accesses to GOT entries.
515
516 /// Constant expressions using GOT equivalent globals may not be
517 /// eligible for PC relative GOT entry conversion, in such cases we need to
518 /// emit the proxies we previously omitted in EmitGlobalVariable.
519 void emitGlobalGOTEquivs();
520
521 /// Emit the stack maps.
522 void emitStackMaps();
523
524 //===------------------------------------------------------------------===//
525 // Overridable Hooks
526 //===------------------------------------------------------------------===//
527
528 void addAsmPrinterHandler(std::unique_ptr<AsmPrinterHandler> Handler);
529
530 void addDebugHandler(std::unique_ptr<DebugHandlerBase> Handler);
531
532 // Targets can, or in the case of EmitInstruction, must implement these to
533 // customize output.
534
535 /// This virtual method can be overridden by targets that want to emit
536 /// something at the start of their file.
537 virtual void emitStartOfAsmFile(Module &) {}
538
539 /// This virtual method can be overridden by targets that want to emit
540 /// something at the end of their file.
541 virtual void emitEndOfAsmFile(Module &) {}
542
543 /// Targets can override this to emit stuff before the first basic block in
544 /// the function.
545 virtual void emitFunctionBodyStart() {}
546
547 /// Targets can override this to emit stuff after the last basic block in the
548 /// function.
549 virtual void emitFunctionBodyEnd() {}
550
551 /// Targets can override this to emit stuff at the start of a basic block.
552 /// By default, this method prints the label for the specified
553 /// MachineBasicBlock, an alignment (if present) and a comment describing it
554 /// if appropriate.
555 virtual void emitBasicBlockStart(const MachineBasicBlock &MBB);
556
557 /// Targets can override this to emit stuff at the end of a basic block.
558 virtual void emitBasicBlockEnd(const MachineBasicBlock &MBB);
559
560 /// Targets should implement this to emit instructions.
561 virtual void emitInstruction(const MachineInstr *) {
562 llvm_unreachable("EmitInstruction not implemented");
563 }
564
565 /// Return the symbol for the specified constant pool entry.
566 virtual MCSymbol *GetCPISymbol(unsigned CPID) const;
567
568 virtual void emitFunctionEntryLabel();
569
570 virtual void emitFunctionDescriptor() {
571 llvm_unreachable("Function descriptor is target-specific.");
572 }
573
575
576 /// Targets can override this to change how global constants that are part of
577 /// a C++ static/global constructor list are emitted.
578 virtual void emitXXStructor(const DataLayout &DL, const Constant *CV) {
580 }
581
582 virtual const MCExpr *lowerConstantPtrAuth(const ConstantPtrAuth &CPA) {
583 report_fatal_error("ptrauth constant lowering not implemented");
584 }
585
586 /// Lower the specified BlockAddress to an MCExpr.
587 virtual const MCExpr *lowerBlockAddressConstant(const BlockAddress &BA);
588
589 /// Return true if the basic block has exactly one predecessor and the control
590 /// transfer mechanism between the predecessor and this block is a
591 /// fall-through.
592 virtual bool
594
595 /// Targets can override this to customize the output of IMPLICIT_DEF
596 /// instructions in verbose mode.
597 virtual void emitImplicitDef(const MachineInstr *MI) const;
598
599 /// getSubtargetInfo() cannot be used where this is needed because we don't
600 /// have a MachineFunction when we're lowering a GlobalIFunc, and
601 /// getSubtargetInfo requires one. Override the implementation in targets
602 /// that support the Mach-O IFunc lowering.
604 return nullptr;
605 }
606
607 virtual void emitMachOIFuncStubBody(Module &M, const GlobalIFunc &GI,
608 MCSymbol *LazyPointer) {
610 "Mach-O IFunc lowering is not yet supported on this target");
611 }
612
614 MCSymbol *LazyPointer) {
616 "Mach-O IFunc lowering is not yet supported on this target");
617 }
618
619 /// Emit N NOP instructions.
620 void emitNops(unsigned N);
621
622 //===------------------------------------------------------------------===//
623 // Symbol Lowering Routines.
624 //===------------------------------------------------------------------===//
625
626 MCSymbol *createTempSymbol(const Twine &Name) const;
627
628 /// Return the MCSymbol for a private symbol with global value name as its
629 /// base, with the specified suffix.
631 StringRef Suffix) const;
632
633 /// Return the MCSymbol for the specified ExternalSymbol.
635
636 /// Return the symbol for the specified jump table entry.
637 MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
638
639 /// Return the symbol for the specified jump table .set
640 /// FIXME: privatize to AsmPrinter.
641 MCSymbol *GetJTSetSymbol(unsigned UID, unsigned MBBID) const;
642
643 /// Return the MCSymbol used to satisfy BlockAddress uses of the specified
644 /// basic block.
646 MCSymbol *GetBlockAddressSymbol(const BasicBlock *BB) const;
647
648 //===------------------------------------------------------------------===//
649 // Emission Helper Routines.
650 //===------------------------------------------------------------------===//
651
652 /// This is just convenient handler for printing offsets.
653 void printOffset(int64_t Offset, raw_ostream &OS) const;
654
655 /// Emit a byte directive and value.
656 void emitInt8(int Value) const;
657
658 /// Emit a short directive and value.
659 void emitInt16(int Value) const;
660
661 /// Emit a long directive and value.
662 void emitInt32(int Value) const;
663
664 /// Emit a long long directive and value.
665 void emitInt64(uint64_t Value) const;
666
667 /// Emit the specified signed leb128 value.
668 void emitSLEB128(int64_t Value, const char *Desc = nullptr) const;
669
670 /// Emit the specified unsigned leb128 value.
671 void emitULEB128(uint64_t Value, const char *Desc = nullptr,
672 unsigned PadTo = 0) const;
673
674 /// Emit something like ".long Hi-Lo" where the size in bytes of the directive
675 /// is specified by Size and Hi/Lo specify the labels. This implicitly uses
676 /// .set if it is available.
677 void emitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
678 unsigned Size) const;
679
680 /// Emit something like ".uleb128 Hi-Lo".
682 const MCSymbol *Lo) const;
683
684 /// Emit something like ".long Label+Offset" where the size in bytes of the
685 /// directive is specified by Size and Label specifies the label. This
686 /// implicitly uses .set if it is available.
687 void emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
688 unsigned Size, bool IsSectionRelative = false) const;
689
690 /// Emit something like ".long Label" where the size in bytes of the directive
691 /// is specified by Size and Label specifies the label.
692 void emitLabelReference(const MCSymbol *Label, unsigned Size,
693 bool IsSectionRelative = false) const {
694 emitLabelPlusOffset(Label, 0, Size, IsSectionRelative);
695 }
696
697 //===------------------------------------------------------------------===//
698 // Dwarf Emission Helper Routines
699 //===------------------------------------------------------------------===//
700
701 /// Emit a .byte 42 directive that corresponds to an encoding. If verbose
702 /// assembly output is enabled, we output comments describing the encoding.
703 /// Desc is a string saying what the encoding is specifying (e.g. "LSDA").
704 void emitEncodingByte(unsigned Val, const char *Desc = nullptr) const;
705
706 /// Return the size of the encoding in bytes.
707 unsigned GetSizeOfEncodedValue(unsigned Encoding) const;
708
709 /// Emit reference to a ttype global with a specified encoding.
710 virtual void emitTTypeReference(const GlobalValue *GV, unsigned Encoding);
711
712 /// Emit a reference to a symbol for use in dwarf. Different object formats
713 /// represent this in different ways. Some use a relocation others encode
714 /// the label offset in its section.
715 void emitDwarfSymbolReference(const MCSymbol *Label,
716 bool ForceOffset = false) const;
717
718 /// Emit the 4- or 8-byte offset of a string from the start of its section.
719 ///
720 /// When possible, emit a DwarfStringPool section offset without any
721 /// relocations, and without using the symbol. Otherwise, defers to \a
722 /// emitDwarfSymbolReference().
723 ///
724 /// The length of the emitted value depends on the DWARF format.
726
727 /// Emit the 4-or 8-byte offset of a string from the start of its section.
730 }
731
732 /// Emit something like ".long Label + Offset" or ".quad Label + Offset"
733 /// depending on the DWARF format.
734 void emitDwarfOffset(const MCSymbol *Label, uint64_t Offset) const;
735
736 /// Emit 32- or 64-bit value depending on the DWARF format.
738
739 /// Emit a unit length field. The actual format, DWARF32 or DWARF64, is chosen
740 /// according to the settings.
741 void emitDwarfUnitLength(uint64_t Length, const Twine &Comment) const;
742
743 /// Emit a unit length field. The actual format, DWARF32 or DWARF64, is chosen
744 /// according to the settings.
745 /// Return the end symbol generated inside, the caller needs to emit it.
746 MCSymbol *emitDwarfUnitLength(const Twine &Prefix,
747 const Twine &Comment) const;
748
749 /// Emit reference to a call site with a specified encoding
750 void emitCallSiteOffset(const MCSymbol *Hi, const MCSymbol *Lo,
751 unsigned Encoding) const;
752 /// Emit an integer value corresponding to the call site encoding
753 void emitCallSiteValue(uint64_t Value, unsigned Encoding) const;
754
755 /// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
756 virtual unsigned getISAEncoding() { return 0; }
757
758 /// Emit the directive and value for debug thread local expression
759 ///
760 /// \p Value - The value to emit.
761 /// \p Size - The size of the integer (in bytes) to emit.
762 virtual void emitDebugValue(const MCExpr *Value, unsigned Size) const;
763
764 //===------------------------------------------------------------------===//
765 // Dwarf Lowering Routines
766 //===------------------------------------------------------------------===//
767
768 /// Emit frame instruction to describe the layout of the frame.
769 void emitCFIInstruction(const MCCFIInstruction &Inst) const;
770
771 /// Emit Dwarf abbreviation table.
772 template <typename T> void emitDwarfAbbrevs(const T &Abbrevs) const {
773 // For each abbreviation.
774 for (const auto &Abbrev : Abbrevs)
775 emitDwarfAbbrev(*Abbrev);
776
777 // Mark end of abbreviations.
778 emitULEB128(0, "EOM(3)");
779 }
780
781 void emitDwarfAbbrev(const DIEAbbrev &Abbrev) const;
782
783 /// Recursively emit Dwarf DIE tree.
784 void emitDwarfDIE(const DIE &Die) const;
785
786 //===------------------------------------------------------------------===//
787 // CodeView Helper Routines
788 //===------------------------------------------------------------------===//
789
790 /// Gets information required to create a CodeView debug symbol for a jump
791 /// table.
792 /// Return value is <Base Address, Base Offset, Branch Address, Entry Size>
793 virtual std::tuple<const MCSymbol *, uint64_t, const MCSymbol *,
795 getCodeViewJumpTableInfo(int JTI, const MachineInstr *BranchInstr,
796 const MCSymbol *BranchLabel) const;
797
798 //===------------------------------------------------------------------===//
799 // Inline Asm Support
800 //===------------------------------------------------------------------===//
801
802 // These are hooks that targets can override to implement inline asm
803 // support. These should probably be moved out of AsmPrinter someday.
804
805 /// Print information related to the specified machine instr that is
806 /// independent of the operand, and may be independent of the instr itself.
807 /// This can be useful for portably encoding the comment character or other
808 /// bits of target-specific knowledge into the asmstrings. The syntax used is
809 /// ${:comment}. Targets can override this to add support for their own
810 /// strange codes.
811 virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
812 StringRef Code) const;
813
814 /// Print the MachineOperand as a symbol. Targets with complex handling of
815 /// symbol references should override the base implementation.
816 virtual void PrintSymbolOperand(const MachineOperand &MO, raw_ostream &OS);
817
818 /// Print the specified operand of MI, an INLINEASM instruction, using the
819 /// specified assembler variant. Targets should override this to format as
820 /// appropriate. This method can return true if the operand is erroneous.
821 virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
822 const char *ExtraCode, raw_ostream &OS);
823
824 /// Print the specified operand of MI, an INLINEASM instruction, using the
825 /// specified assembler variant as an address. Targets should override this to
826 /// format as appropriate. This method can return true if the operand is
827 /// erroneous.
828 virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
829 const char *ExtraCode, raw_ostream &OS);
830
831 /// Let the target do anything it needs to do before emitting inlineasm.
832 /// \p StartInfo - the subtarget info before parsing inline asm
833 virtual void emitInlineAsmStart() const;
834
835 /// Let the target do anything it needs to do after emitting inlineasm.
836 /// This callback can be used restore the original mode in case the
837 /// inlineasm contains directives to switch modes.
838 /// \p StartInfo - the original subtarget info before inline asm
839 /// \p EndInfo - the final subtarget info after parsing the inline asm,
840 /// or NULL if the value is unknown.
841 virtual void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
842 const MCSubtargetInfo *EndInfo) const;
843
844 /// This emits visibility information about symbol, if this is supported by
845 /// the target.
846 void emitVisibility(MCSymbol *Sym, unsigned Visibility,
847 bool IsDefinition = true) const;
848
849 /// This emits linkage information about \p GVSym based on \p GV, if this is
850 /// supported by the target.
851 virtual void emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const;
852
853 /// Return the alignment for the specified \p GV.
854 static Align getGVAlignment(const GlobalObject *GV, const DataLayout &DL,
855 Align InAlign = Align(1));
856
857private:
858 /// Private state for PrintSpecial()
859 // Assign a unique ID to this machine instruction.
860 mutable const MachineInstr *LastMI = nullptr;
861 mutable unsigned LastFn = 0;
862 mutable unsigned Counter = ~0U;
863
864 bool DwarfUsesRelocationsAcrossSections = false;
865
866 /// This method emits the header for the current function.
867 virtual void emitFunctionHeader();
868
869 /// This method emits a comment next to header for the current function.
870 virtual void emitFunctionHeaderComment();
871
872 /// This method emits prefix-like data before the current function.
873 void emitFunctionPrefix(ArrayRef<const Constant *> Prefix);
874
875 /// Emit a blob of inline asm to the output streamer.
876 void
877 emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
878 const MCTargetOptions &MCOptions,
879 const MDNode *LocMDNode = nullptr,
880 InlineAsm::AsmDialect AsmDialect = InlineAsm::AD_ATT) const;
881
882 /// This method formats and emits the specified machine instruction that is an
883 /// inline asm.
884 void emitInlineAsm(const MachineInstr *MI) const;
885
886 /// Add inline assembly info to the diagnostics machinery, so we can
887 /// emit file and position info. Returns SrcMgr memory buffer position.
888 unsigned addInlineAsmDiagBuffer(StringRef AsmStr,
889 const MDNode *LocMDNode) const;
890
891 //===------------------------------------------------------------------===//
892 // Internal Implementation Details
893 //===------------------------------------------------------------------===//
894
895 void emitJumpTableEntry(const MachineJumpTableInfo *MJTI,
896 const MachineBasicBlock *MBB, unsigned uid) const;
897 void emitLLVMUsedList(const ConstantArray *InitList);
898 /// Emit llvm.ident metadata in an '.ident' directive.
899 void emitModuleIdents(Module &M);
900 /// Emit bytes for llvm.commandline metadata.
901 virtual void emitModuleCommandLines(Module &M);
902
903 GCMetadataPrinter *getOrCreateGCPrinter(GCStrategy &S);
904 void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
905
906private:
907 /// This method decides whether the specified basic block requires a label.
908 bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
909
910protected:
911 virtual void emitGlobalAlias(const Module &M, const GlobalAlias &GA);
913 return false;
914 }
915};
916
917} // end namespace llvm
918
919#endif // LLVM_CODEGEN_ASMPRINTER_H
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file defines the DenseMap class.
This file contains constants used for implementing Dwarf debug support.
std::string Name
uint64_t Size
Symbol * Sym
Definition: ELF_riscv.cpp:479
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
This file implements a map that provides insertion order iteration.
raw_pwrite_stream & OS
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:86
virtual void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo, const MCSubtargetInfo *EndInfo) const
Let the target do anything it needs to do after emitting inlineasm.
virtual void emitInstruction(const MachineInstr *)
Targets should implement this to emit instructions.
Definition: AsmPrinter.h:561
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
Definition: AsmPrinter.cpp:383
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
MCSymbol * getSymbol(const GlobalValue *GV) const
Definition: AsmPrinter.cpp:676
void emitULEB128(uint64_t Value, const char *Desc=nullptr, unsigned PadTo=0) const
Emit the specified unsigned leb128 value.
SmallVector< XRayFunctionEntry, 4 > Sleds
Definition: AsmPrinter.h:360
void emitDwarfSymbolReference(const MCSymbol *Label, bool ForceOffset=false) const
Emit a reference to a symbol for use in dwarf.
MapVector< MBBSectionID, MBBSectionRange > MBBSectionRanges
Definition: AsmPrinter.h:140
bool isDwarf64() const
CFISection getModuleCFISectionType() const
Get the CFISection type for the module.
Definition: AsmPrinter.h:434
void emitNops(unsigned N)
Emit N NOP instructions.
MCSymbol * CurrentFnBegin
Definition: AsmPrinter.h:185
unsigned GetSizeOfEncodedValue(unsigned Encoding) const
Return the size of the encoding in bytes.
MachineLoopInfo * MLI
This is a pointer to the current MachineLoopInfo.
Definition: AsmPrinter.h:113
virtual void emitDebugValue(const MCExpr *Value, unsigned Size) const
Emit the directive and value for debug thread local expression.
Definition: AsmPrinter.cpp:895
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
Definition: AsmPrinter.cpp:403
virtual void emitConstantPool()
Print to the current output stream assembly representations of the constants in the constant pool MCP...
void emitDwarfDIE(const DIE &Die) const
Recursively emit Dwarf DIE tree.
DwarfDebug * getDwarfDebug()
Definition: AsmPrinter.h:237
virtual void emitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
Definition: AsmPrinter.cpp:698
virtual const MCExpr * lowerConstantPtrAuth(const ConstantPtrAuth &CPA)
Definition: AsmPrinter.h:582
void emitDwarfLengthOrOffset(uint64_t Value) const
Emit 32- or 64-bit value depending on the DWARF format.
unsigned int getUnitLengthFieldByteSize() const
Returns 4 for DWARF32 and 12 for DWARF64.
void emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, unsigned Size, bool IsSectionRelative=false) const
Emit something like ".long Label+Offset" where the size in bytes of the directive is specified by Siz...
~AsmPrinter() override
Definition: AsmPrinter.cpp:369
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:89
void emitXRayTable()
Emit a table with all XRay instrumentation points.
virtual void emitGlobalAlias(const Module &M, const GlobalAlias &GA)
virtual void emitBasicBlockEnd(const MachineBasicBlock &MBB)
Targets can override this to emit stuff at the end of a basic block.
DwarfDebug * getDwarfDebug() const
Definition: AsmPrinter.h:238
MCSymbol * CurrentFnDescSym
The symbol for the current function descriptor on AIX.
Definition: AsmPrinter.h:127
MCSymbol * CurrentFnBeginLocal
For dso_local functions, the current $local alias for the function.
Definition: AsmPrinter.h:188
MapVector< const MCSymbol *, GOTEquivUsePair > GlobalGOTEquivs
Definition: AsmPrinter.h:145
void emitDwarfStringOffset(DwarfStringPoolEntry S) const
Emit the 4- or 8-byte offset of a string from the start of its section.
virtual MCSymbol * GetCPISymbol(unsigned CPID) const
Return the symbol for the specified constant pool entry.
void emitGlobalGOTEquivs()
Constant expressions using GOT equivalent globals may not be eligible for PC relative GOT entry conve...
virtual void PrintSymbolOperand(const MachineOperand &MO, raw_ostream &OS)
Print the MachineOperand as a symbol.
MCSymbol * getFunctionBegin() const
Definition: AsmPrinter.h:266
void emitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) const
Emit something like ".long Hi-Lo" where the size in bytes of the directive is specified by Size and H...
void emitKCFITrapEntry(const MachineFunction &MF, const MCSymbol *Symbol)
virtual void emitMachOIFuncStubHelperBody(Module &M, const GlobalIFunc &GI, MCSymbol *LazyPointer)
Definition: AsmPrinter.h:613
MCSymbol * getMBBExceptionSym(const MachineBasicBlock &MBB)
MCSymbol * getAddrLabelSymbol(const BasicBlock *BB)
Return the symbol to be used for the specified basic block when its address is taken.
Definition: AsmPrinter.h:276
virtual void emitTTypeReference(const GlobalValue *GV, unsigned Encoding)
Emit reference to a ttype global with a specified encoding.
const MCAsmInfo * MAI
Target Asm Printer information.
Definition: AsmPrinter.h:92
SmallVector< std::unique_ptr< AsmPrinterHandler >, 2 > Handlers
A vector of all debug/EH info emitters we should use.
Definition: AsmPrinter.h:192
bool emitSpecialLLVMGlobal(const GlobalVariable *GV)
Check to see if the specified global is a special global used by LLVM.
MachineFunction * MF
The current machine function.
Definition: AsmPrinter.h:104
void emitDwarfOffset(const MCSymbol *Label, uint64_t Offset) const
Emit something like ".long Label + Offset" or ".quad Label + Offset" depending on the DWARF format.
virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS, StringRef Code) const
Print information related to the specified machine instr that is independent of the operand,...
virtual void emitJumpTableInfo()
Print assembly representations of the jump tables used by the current function to the current output ...
void computeGlobalGOTEquivs(Module &M)
Unnamed constant global variables solely contaning a pointer to another globals variable act like a g...
static Align getGVAlignment(const GlobalObject *GV, const DataLayout &DL, Align InAlign=Align(1))
Return the alignment for the specified GV.
Definition: AsmPrinter.cpp:336
void emitInt8(int Value) const
Emit a byte directive and value.
CFISection getFunctionCFISectionType(const Function &F) const
Get the CFISection type for a function.
void addDebugHandler(std::unique_ptr< DebugHandlerBase > Handler)
virtual void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
void emitFunctionBody()
This method emits the body and trailer for a function.
virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
size_t NumUserDebugHandlers
Definition: AsmPrinter.h:197
void emitBBAddrMapSection(const MachineFunction &MF)
void emitPCSections(const MachineFunction &MF)
Emits the PC sections collected from instructions.
MachineDominatorTree * MDT
This is a pointer to the current MachineDominatorTree.
Definition: AsmPrinter.h:110
virtual void emitStartOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the start of their fi...
Definition: AsmPrinter.h:537
MCSymbol * GetJTISymbol(unsigned JTID, bool isLinkerPrivate=false) const
Return the symbol for the specified jump table entry.
virtual void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV)
SmallVector< std::unique_ptr< DebugHandlerBase >, 1 > DebugHandlers
Debuginfo handler. Protected so that targets can add their own.
Definition: AsmPrinter.h:196
void emitStackMaps()
Emit the stack maps.
bool hasDebugInfo() const
Returns true if valid debug info is present.
Definition: AsmPrinter.h:437
void emitDwarfUnitLength(uint64_t Length, const Twine &Comment) const
Emit a unit length field.
virtual void emitFunctionBodyStart()
Targets can override this to emit stuff before the first basic block in the function.
Definition: AsmPrinter.h:545
std::pair< const GlobalVariable *, unsigned > GOTEquivUsePair
Map global GOT equivalent MCSymbols to GlobalVariables and keep track of its number of uses by other ...
Definition: AsmPrinter.h:144
void emitPatchableFunctionEntries()
void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind, uint8_t Version=0)
virtual void emitEndOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the end of their file...
Definition: AsmPrinter.h:541
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
Definition: AsmPrinter.cpp:434
MCSymbol * GetJTSetSymbol(unsigned UID, unsigned MBBID) const
Return the symbol for the specified jump table .set FIXME: privatize to AsmPrinter.
virtual void emitMachOIFuncStubBody(Module &M, const GlobalIFunc &GI, MCSymbol *LazyPointer)
Definition: AsmPrinter.h:607
void emitEncodingByte(unsigned Val, const char *Desc=nullptr) const
Emit a .byte 42 directive that corresponds to an encoding.
virtual void emitImplicitDef(const MachineInstr *MI) const
Targets can override this to customize the output of IMPLICIT_DEF instructions in verbose mode.
virtual void emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const
This emits linkage information about GVSym based on GV, if this is supported by the target.
Definition: AsmPrinter.cpp:631
void getAnalysisUsage(AnalysisUsage &AU) const override
Record analysis usage.
Definition: AsmPrinter.cpp:425
unsigned getFunctionNumber() const
Return a unique ID for the current function.
Definition: AsmPrinter.cpp:379
MachineOptimizationRemarkEmitter * ORE
Optimization remark emitter.
Definition: AsmPrinter.h:116
virtual bool shouldEmitWeakSwiftAsyncExtendedFramePointerFlags() const
Definition: AsmPrinter.h:912
void printOffset(int64_t Offset, raw_ostream &OS) const
This is just convenient handler for printing offsets.
void emitGlobalConstant(const DataLayout &DL, const Constant *CV, AliasMapTy *AliasList=nullptr)
EmitGlobalConstant - Print a general LLVM constant to the .s file.
virtual const MCSymbol * getFunctionFrameSymbol() const
Return symbol for the function pseudo stack if the stack frame is not a register based.
Definition: AsmPrinter.h:264
void emitFrameAlloc(const MachineInstr &MI)
void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const
Emit the 4-or 8-byte offset of a string from the start of its section.
Definition: AsmPrinter.h:728
void emitStackSizeSection(const MachineFunction &MF)
MCSymbol * getSymbolPreferLocal(const GlobalValue &GV) const
Similar to getSymbol() but preferred for references.
Definition: AsmPrinter.cpp:680
MCSymbol * CurrentFnSym
The symbol for the current function.
Definition: AsmPrinter.h:123
MachineModuleInfo * MMI
This is a pointer to the current MachineModuleInfo.
Definition: AsmPrinter.h:107
void emitDwarfAbbrevs(const T &Abbrevs) const
Emit Dwarf abbreviation table.
Definition: AsmPrinter.h:772
void emitSLEB128(int64_t Value, const char *Desc=nullptr) const
Emit the specified signed leb128 value.
void emitAlignment(Align Alignment, const GlobalObject *GV=nullptr, unsigned MaxBytesToEmit=0) const
Emit an alignment directive to the specified power of two boundary.
MCContext & OutContext
This is the context for the output file that we are streaming.
Definition: AsmPrinter.h:96
void emitCFIInstruction(const MachineInstr &MI)
MCSymbol * createTempSymbol(const Twine &Name) const
bool doFinalization(Module &M) override
Shut down the asmprinter.
MCSymbol * GetExternalSymbolSymbol(Twine Sym) const
Return the MCSymbol for the specified ExternalSymbol.
virtual const MCSubtargetInfo * getIFuncMCSubtargetInfo() const
getSubtargetInfo() cannot be used where this is needed because we don't have a MachineFunction when w...
Definition: AsmPrinter.h:603
void emitStackUsage(const MachineFunction &MF)
virtual void emitKCFITypeId(const MachineFunction &MF)
bool isPositionIndependent() const
Definition: AsmPrinter.cpp:374
virtual void emitXXStructorList(const DataLayout &DL, const Constant *List, bool IsCtor)
This method emits llvm.global_ctors or llvm.global_dtors list.
void emitPCSectionsLabel(const MachineFunction &MF, const MDNode &MD)
Emits a label as reference for PC sections.
void emitCallSiteOffset(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Encoding) const
Emit reference to a call site with a specified encoding.
MCSymbol * CurrentPatchableFunctionEntrySym
The symbol for the entry in __patchable_function_entires.
Definition: AsmPrinter.h:119
virtual void emitBasicBlockStart(const MachineBasicBlock &MBB)
Targets can override this to emit stuff at the start of a basic block.
void takeDeletedSymbolsForFunction(const Function *F, std::vector< MCSymbol * > &Result)
If the specified function has had any references to address-taken blocks generated,...
Definition: AsmPrinter.cpp:269
void emitVisibility(MCSymbol *Sym, unsigned Visibility, bool IsDefinition=true) const
This emits visibility information about symbol, if this is supported by the target.
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
Definition: AsmPrinter.h:387
void emitDwarfAbbrev(const DIEAbbrev &Abbrev) const
void setDwarfUsesRelocationsAcrossSections(bool Enable)
Definition: AsmPrinter.h:326
void emitInt32(int Value) const
Emit a long directive and value.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition: AsmPrinter.h:101
virtual const MCExpr * lowerConstant(const Constant *CV)
Lower the specified LLVM Constant to an MCExpr.
void emitLabelReference(const MCSymbol *Label, unsigned Size, bool IsSectionRelative=false) const
Emit something like ".long Label" where the size in bytes of the directive is specified by Size and L...
Definition: AsmPrinter.h:692
virtual void emitFunctionDescriptor()
Definition: AsmPrinter.h:570
const MCSection * getCurrentSection() const
Return the current section we are emitting to.
Definition: AsmPrinter.cpp:421
unsigned int getDwarfOffsetByteSize() const
Returns 4 for DWARF32 and 8 for DWARF64.
virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
size_t NumUserHandlers
Definition: AsmPrinter.h:193
MCSymbol * CurrentFnSymForSize
The symbol used to represent the start of the current function for the purpose of calculating its siz...
Definition: AsmPrinter.h:132
virtual unsigned getISAEncoding()
Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
Definition: AsmPrinter.h:756
bool isVerbose() const
Return true if assembly output should contain comments.
Definition: AsmPrinter.h:257
MCSymbol * getFunctionEnd() const
Definition: AsmPrinter.h:267
virtual void emitXXStructor(const DataLayout &DL, const Constant *CV)
Targets can override this to change how global constants that are part of a C++ static/global constru...
Definition: AsmPrinter.h:578
void preprocessXXStructorList(const DataLayout &DL, const Constant *List, SmallVector< Structor, 8 > &Structors)
This method gathers an array of Structors and then sorts them out by Priority.
void emitInt16(int Value) const
Emit a short directive and value.
void setDwarfVersion(uint16_t Version)
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
Definition: AsmPrinter.cpp:671
void emitPseudoProbe(const MachineInstr &MI)
unsigned getPointerSize() const
Return the pointer size from the TargetMachine.
Definition: AsmPrinter.cpp:394
void emitRemarksSection(remarks::RemarkStreamer &RS)
StackMaps SM
Definition: AsmPrinter.h:199
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
ArrayRef< MCSymbol * > getAddrLabelSymbolToEmit(const BasicBlock *BB)
Return the symbol to be used for the specified basic block when its address is taken.
Definition: AsmPrinter.cpp:261
virtual void emitFunctionBodyEnd()
Targets can override this to emit stuff after the last basic block in the function.
Definition: AsmPrinter.h:549
const DataLayout & getDataLayout() const
Return information about data layout.
Definition: AsmPrinter.cpp:387
virtual void emitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
void emitInitialRawDwarfLocDirective(const MachineFunction &MF)
Emits inital debug location directive.
Definition: AsmPrinter.cpp:407
void emitInt64(uint64_t Value) const
Emit a long long directive and value.
uint16_t getDwarfVersion() const
dwarf::FormParams getDwarfFormParams() const
Returns information about the byte size of DW_FORM values.
const MCSubtargetInfo & getSubtargetInfo() const
Return information about subtarget.
Definition: AsmPrinter.cpp:398
bool usesCFIWithoutEH() const
Since emitting CFI unwind information is entangled with supporting the exceptions,...
bool doesDwarfUseRelocationsAcrossSections() const
Definition: AsmPrinter.h:322
virtual void emitInlineAsmStart() const
Let the target do anything it needs to do before emitting inlineasm.
@ None
Do not emit either .eh_frame or .debug_frame.
@ Debug
Emit .debug_frame.
void addAsmPrinterHandler(std::unique_ptr< AsmPrinterHandler > Handler)
virtual std::tuple< const MCSymbol *, uint64_t, const MCSymbol *, codeview::JumpTableEntrySize > getCodeViewJumpTableInfo(int JTI, const MachineInstr *BranchInstr, const MCSymbol *BranchLabel) const
Gets information required to create a CodeView debug symbol for a jump table.
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant.
void emitCallSiteValue(uint64_t Value, unsigned Encoding) const
Emit an integer value corresponding to the call site encoding.
void emitLabelDifferenceAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) const
Emit something like ".uleb128 Hi-Lo".
virtual const MCExpr * lowerBlockAddressConstant(const BlockAddress &BA)
Lower the specified BlockAddress to an MCExpr.
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
The address of a basic block.
Definition: Constants.h:890
ConstantArray - Constant Array Declarations.
Definition: Constants.h:424
A signed pointer, in the ptrauth sense.
Definition: Constants.h:1012
This is an important base class in LLVM.
Definition: Constant.h:42
Dwarf abbreviation, describes the organization of a debug information object.
Definition: DIE.h:79
A structured debug information entry.
Definition: DIE.h:819
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
Collects and handles dwarf debug information.
Definition: DwarfDebug.h:351
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
const DwarfStringPoolEntry & getEntry() const
GCMetadataPrinter - Emits GC metadata as assembly code.
GCStrategy describes a garbage collector algorithm's code generation requirements,...
Definition: GCStrategy.h:63
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Context object for machine code objects.
Definition: MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
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
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Metadata node.
Definition: Metadata.h:1069
Abstract base class for all machine specific constantpool value subclasses.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Representation of each machine instruction.
Definition: MachineInstr.h:69
This class contains meta information specific to a module.
MachineOperand class - Representation of each machine instruction operand.
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:36
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:586
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
LLVM Value Representation.
Definition: Value.h:74
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
@ BlockAddress
Definition: ISDOpcodes.h:84
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
@ Length
Definition: DWP.cpp:480
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:167
@ Enable
Enable colors.
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
Map a basic block section ID to the begin and end symbols of that section which determine the section...
Definition: AsmPrinter.h:136
llvm.global_ctors and llvm.global_dtors are arrays of Structor structs.
Definition: AsmPrinter.h:469
const class Function * Fn
Definition: AsmPrinter.h:353
void emit(int, MCStreamer *) const
Description of the encoding of one expression Op.
Data for a string pool entry.
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:1077