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