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