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