[DAGCombiner] Eliminate dead stores to stack.
[llvm-complete.git] / include / llvm / CodeGen / AsmPrinter.h
blobfb12bb26b3ea632d7abc735fd18506d33657398c
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.
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/ADT/StringRef.h"
21 #include "llvm/ADT/Twine.h"
22 #include "llvm/CodeGen/DwarfStringPoolEntry.h"
23 #include "llvm/CodeGen/MachineFunctionPass.h"
24 #include "llvm/IR/InlineAsm.h"
25 #include "llvm/IR/LLVMContext.h"
26 #include "llvm/Support/ErrorHandling.h"
27 #include "llvm/Support/SourceMgr.h"
28 #include <cstdint>
29 #include <memory>
30 #include <utility>
31 #include <vector>
33 namespace llvm {
35 class AsmPrinterHandler;
36 class BasicBlock;
37 class BlockAddress;
38 class Constant;
39 class ConstantArray;
40 class DataLayout;
41 class DIE;
42 class DIEAbbrev;
43 class DwarfDebug;
44 class GCMetadataPrinter;
45 class GCStrategy;
46 class GlobalIndirectSymbol;
47 class GlobalObject;
48 class GlobalValue;
49 class GlobalVariable;
50 class MachineBasicBlock;
51 class MachineConstantPoolValue;
52 class MachineDominatorTree;
53 class MachineFunction;
54 class MachineInstr;
55 class MachineJumpTableInfo;
56 class MachineLoopInfo;
57 class MachineModuleInfo;
58 class MachineOptimizationRemarkEmitter;
59 class MCAsmInfo;
60 class MCCFIInstruction;
61 struct MCCodePaddingContext;
62 class MCContext;
63 class MCExpr;
64 class MCInst;
65 class MCSection;
66 class MCStreamer;
67 class MCSubtargetInfo;
68 class MCSymbol;
69 class MCTargetOptions;
70 class MDNode;
71 class Module;
72 class raw_ostream;
73 class StackMaps;
74 class TargetLoweringObjectFile;
75 class TargetMachine;
77 /// This class is intended to be used as a driving class for all asm writers.
78 class AsmPrinter : public MachineFunctionPass {
79 public:
80 /// Target machine description.
81 TargetMachine &TM;
83 /// Target Asm Printer information.
84 const MCAsmInfo *MAI;
86 /// This is the context for the output file that we are streaming. This owns
87 /// all of the global MC-related objects for the generated translation unit.
88 MCContext &OutContext;
90 /// This is the MCStreamer object for the file we are generating. This
91 /// contains the transient state for the current translation unit that we are
92 /// generating (such as the current section etc).
93 std::unique_ptr<MCStreamer> OutStreamer;
95 /// The current machine function.
96 MachineFunction *MF = nullptr;
98 /// This is a pointer to the current MachineModuleInfo.
99 MachineModuleInfo *MMI = nullptr;
101 /// This is a pointer to the current MachineLoopInfo.
102 MachineDominatorTree *MDT = nullptr;
104 /// This is a pointer to the current MachineLoopInfo.
105 MachineLoopInfo *MLI = nullptr;
107 /// Optimization remark emitter.
108 MachineOptimizationRemarkEmitter *ORE;
110 /// The symbol for the current function. This is recalculated at the beginning
111 /// of each call to runOnMachineFunction().
112 MCSymbol *CurrentFnSym = nullptr;
114 /// The symbol used to represent the start of the current function for the
115 /// purpose of calculating its size (e.g. using the .size directive). By
116 /// default, this is equal to CurrentFnSym.
117 MCSymbol *CurrentFnSymForSize = nullptr;
119 /// Map global GOT equivalent MCSymbols to GlobalVariables and keep track of
120 /// its number of uses by other globals.
121 using GOTEquivUsePair = std::pair<const GlobalVariable *, unsigned>;
122 MapVector<const MCSymbol *, GOTEquivUsePair> GlobalGOTEquivs;
124 private:
125 MCSymbol *CurrentFnBegin = nullptr;
126 MCSymbol *CurrentFnEnd = nullptr;
127 MCSymbol *CurExceptionSym = nullptr;
129 // The garbage collection metadata printer table.
130 void *GCMetadataPrinters = nullptr; // Really a DenseMap.
132 /// Emit comments in assembly output if this is true.
133 bool VerboseAsm;
135 static char ID;
137 protected:
138 /// Protected struct HandlerInfo and Handlers permit target extended
139 /// AsmPrinter adds their own handlers.
140 struct HandlerInfo {
141 AsmPrinterHandler *Handler;
142 const char *TimerName;
143 const char *TimerDescription;
144 const char *TimerGroupName;
145 const char *TimerGroupDescription;
147 HandlerInfo(AsmPrinterHandler *Handler, const char *TimerName,
148 const char *TimerDescription, const char *TimerGroupName,
149 const char *TimerGroupDescription)
150 : Handler(Handler), TimerName(TimerName),
151 TimerDescription(TimerDescription), TimerGroupName(TimerGroupName),
152 TimerGroupDescription(TimerGroupDescription) {}
155 /// A vector of all debug/EH info emitters we should use. This vector
156 /// maintains ownership of the emitters.
157 SmallVector<HandlerInfo, 1> Handlers;
159 public:
160 struct SrcMgrDiagInfo {
161 SourceMgr SrcMgr;
162 std::vector<const MDNode *> LocInfos;
163 LLVMContext::InlineAsmDiagHandlerTy DiagHandler;
164 void *DiagContext;
167 private:
168 /// If generated on the fly this own the instance.
169 std::unique_ptr<MachineDominatorTree> OwnedMDT;
171 /// If generated on the fly this own the instance.
172 std::unique_ptr<MachineLoopInfo> OwnedMLI;
174 /// Structure for generating diagnostics for inline assembly. Only initialised
175 /// when necessary.
176 mutable std::unique_ptr<SrcMgrDiagInfo> DiagInfo;
178 /// If the target supports dwarf debug info, this pointer is non-null.
179 DwarfDebug *DD = nullptr;
181 /// If the current module uses dwarf CFI annotations strictly for debugging.
182 bool isCFIMoveForDebugging = false;
184 protected:
185 explicit AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer);
187 public:
188 ~AsmPrinter() override;
190 DwarfDebug *getDwarfDebug() { return DD; }
191 DwarfDebug *getDwarfDebug() const { return DD; }
193 uint16_t getDwarfVersion() const;
194 void setDwarfVersion(uint16_t Version);
196 bool isPositionIndependent() const;
198 /// Return true if assembly output should contain comments.
199 bool isVerbose() const { return VerboseAsm; }
201 /// Return a unique ID for the current function.
202 unsigned getFunctionNumber() const;
204 /// Return symbol for the function pseudo stack if the stack frame is not a
205 /// register based.
206 virtual const MCSymbol *getFunctionFrameSymbol() const { return nullptr; }
208 MCSymbol *getFunctionBegin() const { return CurrentFnBegin; }
209 MCSymbol *getFunctionEnd() const { return CurrentFnEnd; }
210 MCSymbol *getCurExceptionSym();
212 /// Return information about object file lowering.
213 const TargetLoweringObjectFile &getObjFileLowering() const;
215 /// Return information about data layout.
216 const DataLayout &getDataLayout() const;
218 /// Return the pointer size from the TargetMachine
219 unsigned getPointerSize() const;
221 /// Return information about subtarget.
222 const MCSubtargetInfo &getSubtargetInfo() const;
224 void EmitToStreamer(MCStreamer &S, const MCInst &Inst);
226 /// Emits inital debug location directive.
227 void emitInitialRawDwarfLocDirective(const MachineFunction &MF);
229 /// Return the current section we are emitting to.
230 const MCSection *getCurrentSection() const;
232 void getNameWithPrefix(SmallVectorImpl<char> &Name,
233 const GlobalValue *GV) const;
235 MCSymbol *getSymbol(const GlobalValue *GV) const;
237 //===------------------------------------------------------------------===//
238 // XRay instrumentation implementation.
239 //===------------------------------------------------------------------===//
240 public:
241 // This describes the kind of sled we're storing in the XRay table.
242 enum class SledKind : uint8_t {
243 FUNCTION_ENTER = 0,
244 FUNCTION_EXIT = 1,
245 TAIL_CALL = 2,
246 LOG_ARGS_ENTER = 3,
247 CUSTOM_EVENT = 4,
248 TYPED_EVENT = 5,
251 // The table will contain these structs that point to the sled, the function
252 // containing the sled, and what kind of sled (and whether they should always
253 // be instrumented). We also use a version identifier that the runtime can use
254 // to decide what to do with the sled, depending on the version of the sled.
255 struct XRayFunctionEntry {
256 const MCSymbol *Sled;
257 const MCSymbol *Function;
258 SledKind Kind;
259 bool AlwaysInstrument;
260 const class Function *Fn;
261 uint8_t Version;
263 void emit(int, MCStreamer *, const MCSymbol *) const;
266 // All the sleds to be emitted.
267 SmallVector<XRayFunctionEntry, 4> Sleds;
269 // A unique ID used for ELF sections associated with a particular function.
270 unsigned XRayFnUniqueID = 0;
272 // Helper function to record a given XRay sled.
273 void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind,
274 uint8_t Version = 0);
276 /// Emit a table with all XRay instrumentation points.
277 void emitXRayTable();
279 //===------------------------------------------------------------------===//
280 // MachineFunctionPass Implementation.
281 //===------------------------------------------------------------------===//
283 /// Record analysis usage.
284 void getAnalysisUsage(AnalysisUsage &AU) const override;
286 /// Set up the AsmPrinter when we are working on a new module. If your pass
287 /// overrides this, it must make sure to explicitly call this implementation.
288 bool doInitialization(Module &M) override;
290 /// Shut down the asmprinter. If you override this in your pass, you must make
291 /// sure to call it explicitly.
292 bool doFinalization(Module &M) override;
294 /// Emit the specified function out to the OutStreamer.
295 bool runOnMachineFunction(MachineFunction &MF) override {
296 SetupMachineFunction(MF);
297 EmitFunctionBody();
298 return false;
301 //===------------------------------------------------------------------===//
302 // Coarse grained IR lowering routines.
303 //===------------------------------------------------------------------===//
305 /// This should be called when a new MachineFunction is being processed from
306 /// runOnMachineFunction.
307 void SetupMachineFunction(MachineFunction &MF);
309 /// This method emits the body and trailer for a function.
310 void EmitFunctionBody();
312 void emitCFIInstruction(const MachineInstr &MI);
314 void emitFrameAlloc(const MachineInstr &MI);
316 void emitStackSizeSection(const MachineFunction &MF);
318 enum CFIMoveType { CFI_M_None, CFI_M_EH, CFI_M_Debug };
319 CFIMoveType needsCFIMoves() const;
321 /// Returns false if needsCFIMoves() == CFI_M_EH for any function
322 /// in the module.
323 bool needsOnlyDebugCFIMoves() const { return isCFIMoveForDebugging; }
325 bool needsSEHMoves();
327 /// Print to the current output stream assembly representations of the
328 /// constants in the constant pool MCP. This is used to print out constants
329 /// which have been "spilled to memory" by the code generator.
330 virtual void EmitConstantPool();
332 /// Print assembly representations of the jump tables used by the current
333 /// function to the current output stream.
334 virtual void EmitJumpTableInfo();
336 /// Emit the specified global variable to the .s file.
337 virtual void EmitGlobalVariable(const GlobalVariable *GV);
339 /// Check to see if the specified global is a special global used by LLVM. If
340 /// so, emit it and return true, otherwise do nothing and return false.
341 bool EmitSpecialLLVMGlobal(const GlobalVariable *GV);
343 /// Emit an alignment directive to the specified power of two boundary. For
344 /// example, if you pass in 3 here, you will get an 8 byte alignment. If a
345 /// global value is specified, and if that global has an explicit alignment
346 /// requested, it will override the alignment request if required for
347 /// correctness.
348 void EmitAlignment(unsigned NumBits, const GlobalObject *GV = nullptr) const;
350 /// Lower the specified LLVM Constant to an MCExpr.
351 virtual const MCExpr *lowerConstant(const Constant *CV);
353 /// Print a general LLVM constant to the .s file.
354 void EmitGlobalConstant(const DataLayout &DL, const Constant *CV);
356 /// Unnamed constant global variables solely contaning a pointer to
357 /// another globals variable act like a global variable "proxy", or GOT
358 /// equivalents, i.e., it's only used to hold the address of the latter. One
359 /// optimization is to replace accesses to these proxies by using the GOT
360 /// entry for the final global instead. Hence, we select GOT equivalent
361 /// candidates among all the module global variables, avoid emitting them
362 /// unnecessarily and finally replace references to them by pc relative
363 /// accesses to GOT entries.
364 void computeGlobalGOTEquivs(Module &M);
366 /// Constant expressions using GOT equivalent globals may not be
367 /// eligible for PC relative GOT entry conversion, in such cases we need to
368 /// emit the proxies we previously omitted in EmitGlobalVariable.
369 void emitGlobalGOTEquivs();
371 /// Emit the stack maps.
372 void emitStackMaps(StackMaps &SM);
374 //===------------------------------------------------------------------===//
375 // Overridable Hooks
376 //===------------------------------------------------------------------===//
378 // Targets can, or in the case of EmitInstruction, must implement these to
379 // customize output.
381 /// This virtual method can be overridden by targets that want to emit
382 /// something at the start of their file.
383 virtual void EmitStartOfAsmFile(Module &) {}
385 /// This virtual method can be overridden by targets that want to emit
386 /// something at the end of their file.
387 virtual void EmitEndOfAsmFile(Module &) {}
389 /// Targets can override this to emit stuff before the first basic block in
390 /// the function.
391 virtual void EmitFunctionBodyStart() {}
393 /// Targets can override this to emit stuff after the last basic block in the
394 /// function.
395 virtual void EmitFunctionBodyEnd() {}
397 /// Targets can override this to emit stuff at the start of a basic block.
398 /// By default, this method prints the label for the specified
399 /// MachineBasicBlock, an alignment (if present) and a comment describing it
400 /// if appropriate.
401 virtual void EmitBasicBlockStart(const MachineBasicBlock &MBB) const;
403 /// Targets can override this to emit stuff at the end of a basic block.
404 virtual void EmitBasicBlockEnd(const MachineBasicBlock &MBB);
406 /// Targets should implement this to emit instructions.
407 virtual void EmitInstruction(const MachineInstr *) {
408 llvm_unreachable("EmitInstruction not implemented");
411 /// Return the symbol for the specified constant pool entry.
412 virtual MCSymbol *GetCPISymbol(unsigned CPID) const;
414 virtual void EmitFunctionEntryLabel();
416 virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
418 /// Targets can override this to change how global constants that are part of
419 /// a C++ static/global constructor list are emitted.
420 virtual void EmitXXStructor(const DataLayout &DL, const Constant *CV) {
421 EmitGlobalConstant(DL, CV);
424 /// Return true if the basic block has exactly one predecessor and the control
425 /// transfer mechanism between the predecessor and this block is a
426 /// fall-through.
427 virtual bool
428 isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
430 /// Targets can override this to customize the output of IMPLICIT_DEF
431 /// instructions in verbose mode.
432 virtual void emitImplicitDef(const MachineInstr *MI) const;
434 //===------------------------------------------------------------------===//
435 // Symbol Lowering Routines.
436 //===------------------------------------------------------------------===//
438 MCSymbol *createTempSymbol(const Twine &Name) const;
440 /// Return the MCSymbol for a private symbol with global value name as its
441 /// base, with the specified suffix.
442 MCSymbol *getSymbolWithGlobalValueBase(const GlobalValue *GV,
443 StringRef Suffix) const;
445 /// Return the MCSymbol for the specified ExternalSymbol.
446 MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const;
448 /// Return the symbol for the specified jump table entry.
449 MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
451 /// Return the symbol for the specified jump table .set
452 /// FIXME: privatize to AsmPrinter.
453 MCSymbol *GetJTSetSymbol(unsigned UID, unsigned MBBID) const;
455 /// Return the MCSymbol used to satisfy BlockAddress uses of the specified
456 /// basic block.
457 MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const;
458 MCSymbol *GetBlockAddressSymbol(const BasicBlock *BB) const;
460 //===------------------------------------------------------------------===//
461 // Emission Helper Routines.
462 //===------------------------------------------------------------------===//
464 /// This is just convenient handler for printing offsets.
465 void printOffset(int64_t Offset, raw_ostream &OS) const;
467 /// Emit a byte directive and value.
468 void emitInt8(int Value) const;
470 /// Emit a short directive and value.
471 void emitInt16(int Value) const;
473 /// Emit a long directive and value.
474 void emitInt32(int Value) const;
476 /// Emit a long long directive and value.
477 void emitInt64(uint64_t Value) const;
479 /// Emit something like ".long Hi-Lo" where the size in bytes of the directive
480 /// is specified by Size and Hi/Lo specify the labels. This implicitly uses
481 /// .set if it is available.
482 void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
483 unsigned Size) const;
485 /// Emit something like ".uleb128 Hi-Lo".
486 void EmitLabelDifferenceAsULEB128(const MCSymbol *Hi,
487 const MCSymbol *Lo) const;
489 /// Emit something like ".long Label+Offset" where the size in bytes of the
490 /// directive is specified by Size and Label specifies the label. This
491 /// implicitly uses .set if it is available.
492 void EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
493 unsigned Size, bool IsSectionRelative = false) const;
495 /// Emit something like ".long Label" where the size in bytes of the directive
496 /// is specified by Size and Label specifies the label.
497 void EmitLabelReference(const MCSymbol *Label, unsigned Size,
498 bool IsSectionRelative = false) const {
499 EmitLabelPlusOffset(Label, 0, Size, IsSectionRelative);
502 /// Emit something like ".long Label + Offset".
503 void EmitDwarfOffset(const MCSymbol *Label, uint64_t Offset) const;
505 //===------------------------------------------------------------------===//
506 // Dwarf Emission Helper Routines
507 //===------------------------------------------------------------------===//
509 /// Emit the specified signed leb128 value.
510 void EmitSLEB128(int64_t Value, const char *Desc = nullptr) const;
512 /// Emit the specified unsigned leb128 value.
513 void EmitULEB128(uint64_t Value, const char *Desc = nullptr) const;
515 /// Emit a .byte 42 directive that corresponds to an encoding. If verbose
516 /// assembly output is enabled, we output comments describing the encoding.
517 /// Desc is a string saying what the encoding is specifying (e.g. "LSDA").
518 void EmitEncodingByte(unsigned Val, const char *Desc = nullptr) const;
520 /// Return the size of the encoding in bytes.
521 unsigned GetSizeOfEncodedValue(unsigned Encoding) const;
523 /// Emit reference to a ttype global with a specified encoding.
524 void EmitTTypeReference(const GlobalValue *GV, unsigned Encoding) const;
526 /// Emit a reference to a symbol for use in dwarf. Different object formats
527 /// represent this in different ways. Some use a relocation others encode
528 /// the label offset in its section.
529 void emitDwarfSymbolReference(const MCSymbol *Label,
530 bool ForceOffset = false) const;
532 /// Emit the 4-byte offset of a string from the start of its section.
534 /// When possible, emit a DwarfStringPool section offset without any
535 /// relocations, and without using the symbol. Otherwise, defers to \a
536 /// emitDwarfSymbolReference().
537 void emitDwarfStringOffset(DwarfStringPoolEntry S) const;
539 /// Emit the 4-byte offset of a string from the start of its section.
540 void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const {
541 emitDwarfStringOffset(S.getEntry());
544 /// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
545 virtual unsigned getISAEncoding() { return 0; }
547 /// Emit the directive and value for debug thread local expression
549 /// \p Value - The value to emit.
550 /// \p Size - The size of the integer (in bytes) to emit.
551 virtual void EmitDebugValue(const MCExpr *Value, unsigned Size) const;
553 //===------------------------------------------------------------------===//
554 // Dwarf Lowering Routines
555 //===------------------------------------------------------------------===//
557 /// Emit frame instruction to describe the layout of the frame.
558 void emitCFIInstruction(const MCCFIInstruction &Inst) const;
560 /// Emit Dwarf abbreviation table.
561 template <typename T> void emitDwarfAbbrevs(const T &Abbrevs) const {
562 // For each abbreviation.
563 for (const auto &Abbrev : Abbrevs)
564 emitDwarfAbbrev(*Abbrev);
566 // Mark end of abbreviations.
567 EmitULEB128(0, "EOM(3)");
570 void emitDwarfAbbrev(const DIEAbbrev &Abbrev) const;
572 /// Recursively emit Dwarf DIE tree.
573 void emitDwarfDIE(const DIE &Die) const;
575 //===------------------------------------------------------------------===//
576 // Inline Asm Support
577 //===------------------------------------------------------------------===//
579 // These are hooks that targets can override to implement inline asm
580 // support. These should probably be moved out of AsmPrinter someday.
582 /// Print information related to the specified machine instr that is
583 /// independent of the operand, and may be independent of the instr itself.
584 /// This can be useful for portably encoding the comment character or other
585 /// bits of target-specific knowledge into the asmstrings. The syntax used is
586 /// ${:comment}. Targets can override this to add support for their own
587 /// strange codes.
588 virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
589 const char *Code) const;
591 /// Print the specified operand of MI, an INLINEASM instruction, using the
592 /// specified assembler variant. Targets should override this to format as
593 /// appropriate. This method can return true if the operand is erroneous.
594 virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
595 unsigned AsmVariant, const char *ExtraCode,
596 raw_ostream &OS);
598 /// Print the specified operand of MI, an INLINEASM instruction, using the
599 /// specified assembler variant as an address. Targets should override this to
600 /// format as appropriate. This method can return true if the operand is
601 /// erroneous.
602 virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
603 unsigned AsmVariant, const char *ExtraCode,
604 raw_ostream &OS);
606 /// Let the target do anything it needs to do before emitting inlineasm.
607 /// \p StartInfo - the subtarget info before parsing inline asm
608 virtual void emitInlineAsmStart() const;
610 /// Let the target do anything it needs to do after emitting inlineasm.
611 /// This callback can be used restore the original mode in case the
612 /// inlineasm contains directives to switch modes.
613 /// \p StartInfo - the original subtarget info before inline asm
614 /// \p EndInfo - the final subtarget info after parsing the inline asm,
615 /// or NULL if the value is unknown.
616 virtual void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
617 const MCSubtargetInfo *EndInfo) const;
619 private:
620 /// Private state for PrintSpecial()
621 // Assign a unique ID to this machine instruction.
622 mutable const MachineInstr *LastMI = nullptr;
623 mutable unsigned LastFn = 0;
624 mutable unsigned Counter = ~0U;
626 /// This method emits the header for the current function.
627 virtual void EmitFunctionHeader();
629 /// Emit a blob of inline asm to the output streamer.
630 void
631 EmitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
632 const MCTargetOptions &MCOptions,
633 const MDNode *LocMDNode = nullptr,
634 InlineAsm::AsmDialect AsmDialect = InlineAsm::AD_ATT) const;
636 /// This method formats and emits the specified machine instruction that is an
637 /// inline asm.
638 void EmitInlineAsm(const MachineInstr *MI) const;
640 /// Add inline assembly info to the diagnostics machinery, so we can
641 /// emit file and position info. Returns SrcMgr memory buffer position.
642 unsigned addInlineAsmDiagBuffer(StringRef AsmStr,
643 const MDNode *LocMDNode) const;
645 //===------------------------------------------------------------------===//
646 // Internal Implementation Details
647 //===------------------------------------------------------------------===//
649 /// This emits visibility information about symbol, if this is supported by
650 /// the target.
651 void EmitVisibility(MCSymbol *Sym, unsigned Visibility,
652 bool IsDefinition = true) const;
654 void EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const;
656 void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
657 const MachineBasicBlock *MBB, unsigned uid) const;
658 void EmitLLVMUsedList(const ConstantArray *InitList);
659 /// Emit llvm.ident metadata in an '.ident' directive.
660 void EmitModuleIdents(Module &M);
661 /// Emit bytes for llvm.commandline metadata.
662 void EmitModuleCommandLines(Module &M);
663 void EmitXXStructorList(const DataLayout &DL, const Constant *List,
664 bool isCtor);
666 GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy &S);
667 /// Emit GlobalAlias or GlobalIFunc.
668 void emitGlobalIndirectSymbol(Module &M, const GlobalIndirectSymbol &GIS);
669 void setupCodePaddingContext(const MachineBasicBlock &MBB,
670 MCCodePaddingContext &Context) const;
673 } // end namespace llvm
675 #endif // LLVM_CODEGEN_ASMPRINTER_H