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