1 //===- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework ---------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
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
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_ASMPRINTER_H
16 #define LLVM_CODEGEN_ASMPRINTER_H
18 #include "llvm/ADT/MapVector.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/CodeGen/AsmPrinterHandler.h"
21 #include "llvm/CodeGen/DwarfStringPoolEntry.h"
22 #include "llvm/CodeGen/MachineFunctionPass.h"
23 #include "llvm/IR/InlineAsm.h"
24 #include "llvm/IR/LLVMContext.h"
25 #include "llvm/Support/ErrorHandling.h"
26 #include "llvm/Support/SourceMgr.h"
42 class GCMetadataPrinter;
44 class GlobalIndirectSymbol;
48 class MachineBasicBlock;
49 class MachineConstantPoolValue;
50 class MachineDominatorTree;
51 class MachineFunction;
53 class MachineJumpTableInfo;
54 class MachineLoopInfo;
55 class MachineModuleInfo;
56 class MachineOptimizationRemarkEmitter;
58 class MCCFIInstruction;
64 class MCSubtargetInfo;
66 class MCTargetOptions;
72 class TargetLoweringObjectFile;
80 /// This class is intended to be used as a driving class for all asm writers.
81 class AsmPrinter : public MachineFunctionPass {
83 /// Target machine description.
86 /// Target Asm Printer information.
89 /// This is the context for the output file that we are streaming. This owns
90 /// all of the global MC-related objects for the generated translation unit.
91 MCContext &OutContext;
93 /// This is the MCStreamer object for the file we are generating. This
94 /// contains the transient state for the current translation unit that we are
95 /// generating (such as the current section etc).
96 std::unique_ptr<MCStreamer> OutStreamer;
98 /// The current machine function.
99 MachineFunction *MF = nullptr;
101 /// This is a pointer to the current MachineModuleInfo.
102 MachineModuleInfo *MMI = nullptr;
104 /// This is a pointer to the current MachineDominatorTree.
105 MachineDominatorTree *MDT = nullptr;
107 /// This is a pointer to the current MachineLoopInfo.
108 MachineLoopInfo *MLI = nullptr;
110 /// Optimization remark emitter.
111 MachineOptimizationRemarkEmitter *ORE;
113 /// The symbol for the entry in __patchable_function_entires.
114 MCSymbol *CurrentPatchableFunctionEntrySym = nullptr;
116 /// The symbol for the current function. This is recalculated at the beginning
117 /// of each call to runOnMachineFunction().
118 MCSymbol *CurrentFnSym = nullptr;
120 /// The symbol for the current function descriptor on AIX. This is created
121 /// at the beginning of each call to SetupMachineFunction().
122 MCSymbol *CurrentFnDescSym = nullptr;
124 /// The symbol used to represent the start of the current function for the
125 /// purpose of calculating its size (e.g. using the .size directive). By
126 /// default, this is equal to CurrentFnSym.
127 MCSymbol *CurrentFnSymForSize = nullptr;
129 /// Map a basic block section ID to the begin and end symbols of that section
130 /// which determine the section's range.
131 struct MBBSectionRange {
132 MCSymbol *BeginLabel, *EndLabel;
135 MapVector<unsigned, MBBSectionRange> MBBSectionRanges;
137 /// Map global GOT equivalent MCSymbols to GlobalVariables and keep track of
138 /// its number of uses by other globals.
139 using GOTEquivUsePair = std::pair<const GlobalVariable *, unsigned>;
140 MapVector<const MCSymbol *, GOTEquivUsePair> GlobalGOTEquivs;
143 MCSymbol *CurrentFnEnd = nullptr;
144 MCSymbol *CurExceptionSym = nullptr;
146 // The symbol used to represent the start of the current BB section of the
147 // function. This is used to calculate the size of the BB section.
148 MCSymbol *CurrentSectionBeginSym = nullptr;
150 // The garbage collection metadata printer table.
151 void *GCMetadataPrinters = nullptr; // Really a DenseMap.
153 /// Emit comments in assembly output if this is true.
159 MCSymbol *CurrentFnBegin = nullptr;
161 /// Protected struct HandlerInfo and Handlers permit target extended
162 /// AsmPrinter adds their own handlers.
164 std::unique_ptr<AsmPrinterHandler> Handler;
165 const char *TimerName;
166 const char *TimerDescription;
167 const char *TimerGroupName;
168 const char *TimerGroupDescription;
170 HandlerInfo(std::unique_ptr<AsmPrinterHandler> Handler,
171 const char *TimerName, const char *TimerDescription,
172 const char *TimerGroupName, const char *TimerGroupDescription)
173 : Handler(std::move(Handler)), TimerName(TimerName),
174 TimerDescription(TimerDescription), TimerGroupName(TimerGroupName),
175 TimerGroupDescription(TimerGroupDescription) {}
178 /// A vector of all debug/EH info emitters we should use. This vector
179 /// maintains ownership of the emitters.
180 SmallVector<HandlerInfo, 1> Handlers;
183 struct SrcMgrDiagInfo {
185 std::vector<const MDNode *> LocInfos;
186 LLVMContext::InlineAsmDiagHandlerTy DiagHandler;
191 /// If generated on the fly this own the instance.
192 std::unique_ptr<MachineDominatorTree> OwnedMDT;
194 /// If generated on the fly this own the instance.
195 std::unique_ptr<MachineLoopInfo> OwnedMLI;
197 /// Structure for generating diagnostics for inline assembly. Only initialised
199 mutable std::unique_ptr<SrcMgrDiagInfo> DiagInfo;
201 /// If the target supports dwarf debug info, this pointer is non-null.
202 DwarfDebug *DD = nullptr;
204 /// If the current module uses dwarf CFI annotations strictly for debugging.
205 bool isCFIMoveForDebugging = false;
208 explicit AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer);
211 ~AsmPrinter() override;
213 DwarfDebug *getDwarfDebug() { return DD; }
214 DwarfDebug *getDwarfDebug() const { return DD; }
216 uint16_t getDwarfVersion() const;
217 void setDwarfVersion(uint16_t Version);
219 bool isPositionIndependent() const;
221 /// Return true if assembly output should contain comments.
222 bool isVerbose() const { return VerboseAsm; }
224 /// Return a unique ID for the current function.
225 unsigned getFunctionNumber() const;
227 /// Return symbol for the function pseudo stack if the stack frame is not a
229 virtual const MCSymbol *getFunctionFrameSymbol() const { return nullptr; }
231 MCSymbol *getFunctionBegin() const { return CurrentFnBegin; }
232 MCSymbol *getFunctionEnd() const { return CurrentFnEnd; }
233 MCSymbol *getCurExceptionSym();
235 /// Return information about object file lowering.
236 const TargetLoweringObjectFile &getObjFileLowering() const;
238 /// Return information about data layout.
239 const DataLayout &getDataLayout() const;
241 /// Return the pointer size from the TargetMachine
242 unsigned getPointerSize() const;
244 /// Return information about subtarget.
245 const MCSubtargetInfo &getSubtargetInfo() const;
247 void EmitToStreamer(MCStreamer &S, const MCInst &Inst);
249 /// Emits inital debug location directive.
250 void emitInitialRawDwarfLocDirective(const MachineFunction &MF);
252 /// Return the current section we are emitting to.
253 const MCSection *getCurrentSection() const;
255 void getNameWithPrefix(SmallVectorImpl<char> &Name,
256 const GlobalValue *GV) const;
258 MCSymbol *getSymbol(const GlobalValue *GV) const;
260 /// Similar to getSymbol() but preferred for references. On ELF, this uses a
261 /// local symbol if a reference to GV is guaranteed to be resolved to the
262 /// definition in the same module.
263 MCSymbol *getSymbolPreferLocal(const GlobalValue &GV) const;
265 //===------------------------------------------------------------------===//
266 // XRay instrumentation implementation.
267 //===------------------------------------------------------------------===//
269 // This describes the kind of sled we're storing in the XRay table.
270 enum class SledKind : uint8_t {
279 // The table will contain these structs that point to the sled, the function
280 // containing the sled, and what kind of sled (and whether they should always
281 // be instrumented). We also use a version identifier that the runtime can use
282 // to decide what to do with the sled, depending on the version of the sled.
283 struct XRayFunctionEntry {
284 const MCSymbol *Sled;
285 const MCSymbol *Function;
287 bool AlwaysInstrument;
288 const class Function *Fn;
291 void emit(int, MCStreamer *) const;
294 // All the sleds to be emitted.
295 SmallVector<XRayFunctionEntry, 4> Sleds;
297 // Helper function to record a given XRay sled.
298 void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind,
299 uint8_t Version = 0);
301 /// Emit a table with all XRay instrumentation points.
302 void emitXRayTable();
304 void emitPatchableFunctionEntries();
306 //===------------------------------------------------------------------===//
307 // MachineFunctionPass Implementation.
308 //===------------------------------------------------------------------===//
310 /// Record analysis usage.
311 void getAnalysisUsage(AnalysisUsage &AU) const override;
313 /// Set up the AsmPrinter when we are working on a new module. If your pass
314 /// overrides this, it must make sure to explicitly call this implementation.
315 bool doInitialization(Module &M) override;
317 /// Shut down the asmprinter. If you override this in your pass, you must make
318 /// sure to call it explicitly.
319 bool doFinalization(Module &M) override;
321 /// Emit the specified function out to the OutStreamer.
322 bool runOnMachineFunction(MachineFunction &MF) override {
323 SetupMachineFunction(MF);
328 //===------------------------------------------------------------------===//
329 // Coarse grained IR lowering routines.
330 //===------------------------------------------------------------------===//
332 /// This should be called when a new MachineFunction is being processed from
333 /// runOnMachineFunction.
334 virtual void SetupMachineFunction(MachineFunction &MF);
336 /// This method emits the body and trailer for a function.
337 void emitFunctionBody();
339 void emitCFIInstruction(const MachineInstr &MI);
341 void emitFrameAlloc(const MachineInstr &MI);
343 void emitStackSizeSection(const MachineFunction &MF);
345 void emitRemarksSection(remarks::RemarkStreamer &RS);
347 enum CFIMoveType { CFI_M_None, CFI_M_EH, CFI_M_Debug };
348 CFIMoveType needsCFIMoves() const;
350 /// Returns false if needsCFIMoves() == CFI_M_EH for any function
352 bool needsOnlyDebugCFIMoves() const { return isCFIMoveForDebugging; }
354 bool needsSEHMoves();
356 /// Print to the current output stream assembly representations of the
357 /// constants in the constant pool MCP. This is used to print out constants
358 /// which have been "spilled to memory" by the code generator.
359 virtual void emitConstantPool();
361 /// Print assembly representations of the jump tables used by the current
362 /// function to the current output stream.
363 virtual void emitJumpTableInfo();
365 /// Emit the specified global variable to the .s file.
366 virtual void emitGlobalVariable(const GlobalVariable *GV);
368 /// Check to see if the specified global is a special global used by LLVM. If
369 /// so, emit it and return true, otherwise do nothing and return false.
370 bool emitSpecialLLVMGlobal(const GlobalVariable *GV);
372 /// Emit an alignment directive to the specified power of two boundary. If a
373 /// global value is specified, and if that global has an explicit alignment
374 /// requested, it will override the alignment request if required for
376 void emitAlignment(Align Alignment, const GlobalObject *GV = nullptr) const;
378 /// Lower the specified LLVM Constant to an MCExpr.
379 virtual const MCExpr *lowerConstant(const Constant *CV);
381 /// Print a general LLVM constant to the .s file.
382 void emitGlobalConstant(const DataLayout &DL, const Constant *CV);
384 /// Unnamed constant global variables solely contaning a pointer to
385 /// another globals variable act like a global variable "proxy", or GOT
386 /// equivalents, i.e., it's only used to hold the address of the latter. One
387 /// optimization is to replace accesses to these proxies by using the GOT
388 /// entry for the final global instead. Hence, we select GOT equivalent
389 /// candidates among all the module global variables, avoid emitting them
390 /// unnecessarily and finally replace references to them by pc relative
391 /// accesses to GOT entries.
392 void computeGlobalGOTEquivs(Module &M);
394 /// Constant expressions using GOT equivalent globals may not be
395 /// eligible for PC relative GOT entry conversion, in such cases we need to
396 /// emit the proxies we previously omitted in EmitGlobalVariable.
397 void emitGlobalGOTEquivs();
399 /// Emit the stack maps.
400 void emitStackMaps(StackMaps &SM);
402 //===------------------------------------------------------------------===//
404 //===------------------------------------------------------------------===//
406 // Targets can, or in the case of EmitInstruction, must implement these to
409 /// This virtual method can be overridden by targets that want to emit
410 /// something at the start of their file.
411 virtual void emitStartOfAsmFile(Module &) {}
413 /// This virtual method can be overridden by targets that want to emit
414 /// something at the end of their file.
415 virtual void emitEndOfAsmFile(Module &) {}
417 /// Targets can override this to emit stuff before the first basic block in
419 virtual void emitFunctionBodyStart() {}
421 /// Targets can override this to emit stuff after the last basic block in the
423 virtual void emitFunctionBodyEnd() {}
425 /// Targets can override this to emit stuff at the start of a basic block.
426 /// By default, this method prints the label for the specified
427 /// MachineBasicBlock, an alignment (if present) and a comment describing it
429 virtual void emitBasicBlockStart(const MachineBasicBlock &MBB);
431 /// Targets can override this to emit stuff at the end of a basic block.
432 virtual void emitBasicBlockEnd(const MachineBasicBlock &MBB);
434 /// Targets should implement this to emit instructions.
435 virtual void emitInstruction(const MachineInstr *) {
436 llvm_unreachable("EmitInstruction not implemented");
439 /// Return the symbol for the specified constant pool entry.
440 virtual MCSymbol *GetCPISymbol(unsigned CPID) const;
442 virtual void emitFunctionEntryLabel();
444 virtual void emitFunctionDescriptor() {
445 llvm_unreachable("Function descriptor is target-specific.");
448 virtual void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
450 /// Targets can override this to change how global constants that are part of
451 /// a C++ static/global constructor list are emitted.
452 virtual void emitXXStructor(const DataLayout &DL, const Constant *CV) {
453 emitGlobalConstant(DL, CV);
456 /// Return true if the basic block has exactly one predecessor and the control
457 /// transfer mechanism between the predecessor and this block is a
460 isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
462 /// Targets can override this to customize the output of IMPLICIT_DEF
463 /// instructions in verbose mode.
464 virtual void emitImplicitDef(const MachineInstr *MI) const;
466 /// Emit N NOP instructions.
467 void emitNops(unsigned N);
469 //===------------------------------------------------------------------===//
470 // Symbol Lowering Routines.
471 //===------------------------------------------------------------------===//
473 MCSymbol *createTempSymbol(const Twine &Name) const;
475 /// Return the MCSymbol for a private symbol with global value name as its
476 /// base, with the specified suffix.
477 MCSymbol *getSymbolWithGlobalValueBase(const GlobalValue *GV,
478 StringRef Suffix) const;
480 /// Return the MCSymbol for the specified ExternalSymbol.
481 MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const;
483 /// Return the symbol for the specified jump table entry.
484 MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
486 /// Return the symbol for the specified jump table .set
487 /// FIXME: privatize to AsmPrinter.
488 MCSymbol *GetJTSetSymbol(unsigned UID, unsigned MBBID) const;
490 /// Return the MCSymbol used to satisfy BlockAddress uses of the specified
492 MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const;
493 MCSymbol *GetBlockAddressSymbol(const BasicBlock *BB) const;
495 //===------------------------------------------------------------------===//
496 // Emission Helper Routines.
497 //===------------------------------------------------------------------===//
499 /// This is just convenient handler for printing offsets.
500 void printOffset(int64_t Offset, raw_ostream &OS) const;
502 /// Emit a byte directive and value.
503 void emitInt8(int Value) const;
505 /// Emit a short directive and value.
506 void emitInt16(int Value) const;
508 /// Emit a long directive and value.
509 void emitInt32(int Value) const;
511 /// Emit a long long directive and value.
512 void emitInt64(uint64_t Value) const;
514 /// Emit something like ".long Hi-Lo" where the size in bytes of the directive
515 /// is specified by Size and Hi/Lo specify the labels. This implicitly uses
516 /// .set if it is available.
517 void emitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
518 unsigned Size) const;
520 /// Emit something like ".uleb128 Hi-Lo".
521 void emitLabelDifferenceAsULEB128(const MCSymbol *Hi,
522 const MCSymbol *Lo) const;
524 /// Emit something like ".long Label+Offset" where the size in bytes of the
525 /// directive is specified by Size and Label specifies the label. This
526 /// implicitly uses .set if it is available.
527 void emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
528 unsigned Size, bool IsSectionRelative = false) const;
530 /// Emit something like ".long Label" where the size in bytes of the directive
531 /// is specified by Size and Label specifies the label.
532 void emitLabelReference(const MCSymbol *Label, unsigned Size,
533 bool IsSectionRelative = false) const {
534 emitLabelPlusOffset(Label, 0, Size, IsSectionRelative);
537 /// Emit something like ".long Label + Offset".
538 void emitDwarfOffset(const MCSymbol *Label, uint64_t Offset) const;
540 //===------------------------------------------------------------------===//
541 // Dwarf Emission Helper Routines
542 //===------------------------------------------------------------------===//
544 /// Emit the specified signed leb128 value.
545 void emitSLEB128(int64_t Value, const char *Desc = nullptr) const;
547 /// Emit the specified unsigned leb128 value.
548 void emitULEB128(uint64_t Value, const char *Desc = nullptr,
549 unsigned PadTo = 0) const;
551 /// Emit a .byte 42 directive that corresponds to an encoding. If verbose
552 /// assembly output is enabled, we output comments describing the encoding.
553 /// Desc is a string saying what the encoding is specifying (e.g. "LSDA").
554 void emitEncodingByte(unsigned Val, const char *Desc = nullptr) const;
556 /// Return the size of the encoding in bytes.
557 unsigned GetSizeOfEncodedValue(unsigned Encoding) const;
559 /// Emit reference to a ttype global with a specified encoding.
560 void emitTTypeReference(const GlobalValue *GV, unsigned Encoding) const;
562 /// Emit a reference to a symbol for use in dwarf. Different object formats
563 /// represent this in different ways. Some use a relocation others encode
564 /// the label offset in its section.
565 void emitDwarfSymbolReference(const MCSymbol *Label,
566 bool ForceOffset = false) const;
568 /// Emit the 4-byte offset of a string from the start of its section.
570 /// When possible, emit a DwarfStringPool section offset without any
571 /// relocations, and without using the symbol. Otherwise, defers to \a
572 /// emitDwarfSymbolReference().
573 void emitDwarfStringOffset(DwarfStringPoolEntry S) const;
575 /// Emit the 4-byte offset of a string from the start of its section.
576 void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const {
577 emitDwarfStringOffset(S.getEntry());
580 /// Emit reference to a call site with a specified encoding
581 void emitCallSiteOffset(const MCSymbol *Hi, const MCSymbol *Lo,
582 unsigned Encoding) const;
583 /// Emit an integer value corresponding to the call site encoding
584 void emitCallSiteValue(uint64_t Value, unsigned Encoding) const;
586 /// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
587 virtual unsigned getISAEncoding() { return 0; }
589 /// Emit the directive and value for debug thread local expression
591 /// \p Value - The value to emit.
592 /// \p Size - The size of the integer (in bytes) to emit.
593 virtual void emitDebugValue(const MCExpr *Value, unsigned Size) const;
595 //===------------------------------------------------------------------===//
596 // Dwarf Lowering Routines
597 //===------------------------------------------------------------------===//
599 /// Emit frame instruction to describe the layout of the frame.
600 void emitCFIInstruction(const MCCFIInstruction &Inst) const;
602 /// Emit Dwarf abbreviation table.
603 template <typename T> void emitDwarfAbbrevs(const T &Abbrevs) const {
604 // For each abbreviation.
605 for (const auto &Abbrev : Abbrevs)
606 emitDwarfAbbrev(*Abbrev);
608 // Mark end of abbreviations.
609 emitULEB128(0, "EOM(3)");
612 void emitDwarfAbbrev(const DIEAbbrev &Abbrev) const;
614 /// Recursively emit Dwarf DIE tree.
615 void emitDwarfDIE(const DIE &Die) const;
617 //===------------------------------------------------------------------===//
618 // Inline Asm Support
619 //===------------------------------------------------------------------===//
621 // These are hooks that targets can override to implement inline asm
622 // support. These should probably be moved out of AsmPrinter someday.
624 /// Print information related to the specified machine instr that is
625 /// independent of the operand, and may be independent of the instr itself.
626 /// This can be useful for portably encoding the comment character or other
627 /// bits of target-specific knowledge into the asmstrings. The syntax used is
628 /// ${:comment}. Targets can override this to add support for their own
630 virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
631 const char *Code) const;
633 /// Print the MachineOperand as a symbol. Targets with complex handling of
634 /// symbol references should override the base implementation.
635 virtual void PrintSymbolOperand(const MachineOperand &MO, raw_ostream &OS);
637 /// Print the specified operand of MI, an INLINEASM instruction, using the
638 /// specified assembler variant. Targets should override this to format as
639 /// appropriate. This method can return true if the operand is erroneous.
640 virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
641 const char *ExtraCode, raw_ostream &OS);
643 /// Print the specified operand of MI, an INLINEASM instruction, using the
644 /// specified assembler variant as an address. Targets should override this to
645 /// format as appropriate. This method can return true if the operand is
647 virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
648 const char *ExtraCode, raw_ostream &OS);
650 /// Let the target do anything it needs to do before emitting inlineasm.
651 /// \p StartInfo - the subtarget info before parsing inline asm
652 virtual void emitInlineAsmStart() const;
654 /// Let the target do anything it needs to do after emitting inlineasm.
655 /// This callback can be used restore the original mode in case the
656 /// inlineasm contains directives to switch modes.
657 /// \p StartInfo - the original subtarget info before inline asm
658 /// \p EndInfo - the final subtarget info after parsing the inline asm,
659 /// or NULL if the value is unknown.
660 virtual void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
661 const MCSubtargetInfo *EndInfo) const;
663 /// This emits visibility information about symbol, if this is supported by
665 void emitVisibility(MCSymbol *Sym, unsigned Visibility,
666 bool IsDefinition = true) const;
668 /// This emits linkage information about \p GVSym based on \p GV, if this is
669 /// supported by the target.
670 virtual void emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const;
672 /// Return the alignment for the specified \p GV.
673 static Align getGVAlignment(const GlobalObject *GV, const DataLayout &DL,
674 Align InAlign = Align(1));
677 /// Private state for PrintSpecial()
678 // Assign a unique ID to this machine instruction.
679 mutable const MachineInstr *LastMI = nullptr;
680 mutable unsigned LastFn = 0;
681 mutable unsigned Counter = ~0U;
683 /// This method emits the header for the current function.
684 virtual void emitFunctionHeader();
686 /// This method emits a comment next to header for the current function.
687 virtual void emitFunctionHeaderComment();
689 /// Emit a blob of inline asm to the output streamer.
691 emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
692 const MCTargetOptions &MCOptions,
693 const MDNode *LocMDNode = nullptr,
694 InlineAsm::AsmDialect AsmDialect = InlineAsm::AD_ATT) const;
696 /// This method formats and emits the specified machine instruction that is an
698 void emitInlineAsm(const MachineInstr *MI) const;
700 /// Add inline assembly info to the diagnostics machinery, so we can
701 /// emit file and position info. Returns SrcMgr memory buffer position.
702 unsigned addInlineAsmDiagBuffer(StringRef AsmStr,
703 const MDNode *LocMDNode) const;
705 //===------------------------------------------------------------------===//
706 // Internal Implementation Details
707 //===------------------------------------------------------------------===//
709 void emitJumpTableEntry(const MachineJumpTableInfo *MJTI,
710 const MachineBasicBlock *MBB, unsigned uid) const;
711 void emitLLVMUsedList(const ConstantArray *InitList);
712 /// Emit llvm.ident metadata in an '.ident' directive.
713 void emitModuleIdents(Module &M);
714 /// Emit bytes for llvm.commandline metadata.
715 void emitModuleCommandLines(Module &M);
716 void emitXXStructorList(const DataLayout &DL, const Constant *List,
719 GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy &S);
720 /// Emit GlobalAlias or GlobalIFunc.
721 void emitGlobalIndirectSymbol(Module &M, const GlobalIndirectSymbol &GIS);
724 } // end namespace llvm
726 #endif // LLVM_CODEGEN_ASMPRINTER_H