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