1193323Sed//===-- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework --------*- C++ -*-===// 2193323Sed// 3193323Sed// The LLVM Compiler Infrastructure 4193323Sed// 5193323Sed// This file is distributed under the University of Illinois Open Source 6193323Sed// License. See LICENSE.TXT for details. 7193323Sed// 8193323Sed//===----------------------------------------------------------------------===// 9193323Sed// 10193323Sed// This file contains a class to be used as the base class for target specific 11193323Sed// asm writers. This class primarily handles common functionality used by 12193323Sed// all asm writers. 13193323Sed// 14193323Sed//===----------------------------------------------------------------------===// 15193323Sed 16193323Sed#ifndef LLVM_CODEGEN_ASMPRINTER_H 17193323Sed#define LLVM_CODEGEN_ASMPRINTER_H 18193323Sed 19193323Sed#include "llvm/CodeGen/MachineFunctionPass.h" 20249423Sdim#include "llvm/IR/InlineAsm.h" 21218893Sdim#include "llvm/Support/DataTypes.h" 22234353Sdim#include "llvm/Support/ErrorHandling.h" 23193323Sed 24193323Sednamespace llvm { 25198892Srdivacky class BlockAddress; 26193323Sed class GCStrategy; 27193323Sed class Constant; 28251662Sdim class ConstantArray; 29193323Sed class GCMetadataPrinter; 30198090Srdivacky class GlobalValue; 31193323Sed class GlobalVariable; 32198090Srdivacky class MachineBasicBlock; 33198090Srdivacky class MachineFunction; 34198090Srdivacky class MachineInstr; 35207618Srdivacky class MachineLocation; 36198090Srdivacky class MachineLoopInfo; 37198090Srdivacky class MachineLoop; 38193323Sed class MachineConstantPoolValue; 39198090Srdivacky class MachineJumpTableInfo; 40195098Sed class MachineModuleInfo; 41206274Srdivacky class MCAsmInfo; 42263508Sdim class MCCFIInstruction; 43198090Srdivacky class MCContext; 44263508Sdim class MCInstrInfo; 45198090Srdivacky class MCSection; 46198090Srdivacky class MCStreamer; 47198090Srdivacky class MCSymbol; 48218893Sdim class MDNode; 49206274Srdivacky class DwarfDebug; 50206274Srdivacky class DwarfException; 51193323Sed class Mangler; 52198090Srdivacky class TargetLoweringObjectFile; 53243830Sdim class DataLayout; 54212904Sdim class TargetMachine; 55193323Sed 56193323Sed /// AsmPrinter - This class is intended to be used as a driving class for all 57193323Sed /// asm writers. 58193323Sed class AsmPrinter : public MachineFunctionPass { 59198090Srdivacky public: 60193323Sed /// Target machine description. 61193323Sed /// 62193323Sed TargetMachine &TM; 63210299Sed 64193323Sed /// Target Asm Printer information. 65193323Sed /// 66198090Srdivacky const MCAsmInfo *MAI; 67193323Sed 68263508Sdim const MCInstrInfo *MII; 69198090Srdivacky /// OutContext - This is the context for the output file that we are 70198090Srdivacky /// streaming. This owns all of the global MC-related objects for the 71198090Srdivacky /// generated translation unit. 72198090Srdivacky MCContext &OutContext; 73210299Sed 74198090Srdivacky /// OutStreamer - This is the MCStreamer object for the file we are 75198090Srdivacky /// generating. This contains the transient state for the current 76198090Srdivacky /// translation unit that we are generating (such as the current section 77198090Srdivacky /// etc). 78198090Srdivacky MCStreamer &OutStreamer; 79210299Sed 80193323Sed /// The current machine function. 81193323Sed const MachineFunction *MF; 82193323Sed 83206274Srdivacky /// MMI - This is a pointer to the current MachineModuleInfo. 84206274Srdivacky MachineModuleInfo *MMI; 85206274Srdivacky 86193323Sed /// Name-mangler for global names. 87193323Sed /// 88193323Sed Mangler *Mang; 89193323Sed 90202878Srdivacky /// The symbol for the current function. This is recalculated at the 91193323Sed /// beginning of each call to runOnMachineFunction(). 92193323Sed /// 93202878Srdivacky MCSymbol *CurrentFnSym; 94210299Sed 95234353Sdim /// The symbol used to represent the start of the current function for the 96234353Sdim /// purpose of calculating its size (e.g. using the .size directive). By 97234353Sdim /// default, this is equal to CurrentFnSym. 98234353Sdim MCSymbol *CurrentFnSymForSize; 99234353Sdim 100206274Srdivacky private: 101206274Srdivacky // GCMetadataPrinters - The garbage collection metadata printer table. 102206274Srdivacky void *GCMetadataPrinters; // Really a DenseMap. 103210299Sed 104193323Sed /// VerboseAsm - Emit comments in assembly output if this is true. 105193323Sed /// 106193323Sed bool VerboseAsm; 107206274Srdivacky static char ID; 108210299Sed 109206274Srdivacky /// If VerboseAsm is set, a pointer to the loop info for this 110206274Srdivacky /// function. 111206274Srdivacky MachineLoopInfo *LI; 112193323Sed 113206274Srdivacky /// DD - If the target supports dwarf debug info, this pointer is non-null. 114206274Srdivacky DwarfDebug *DD; 115210299Sed 116206274Srdivacky /// DE - If the target supports dwarf exception info, this pointer is 117206274Srdivacky /// non-null. 118206274Srdivacky DwarfException *DE; 119210299Sed 120193323Sed protected: 121206274Srdivacky explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer); 122210299Sed 123193323Sed public: 124193323Sed virtual ~AsmPrinter(); 125193323Sed 126263508Sdim const DwarfDebug *getDwarfDebug() const { return DD; } 127263508Sdim 128193323Sed /// isVerbose - Return true if assembly output should contain comments. 129193323Sed /// 130193323Sed bool isVerbose() const { return VerboseAsm; } 131193323Sed 132198090Srdivacky /// getFunctionNumber - Return a unique ID for the current function. 133193323Sed /// 134203954Srdivacky unsigned getFunctionNumber() const; 135210299Sed 136206274Srdivacky /// getObjFileLowering - Return information about object file lowering. 137207618Srdivacky const TargetLoweringObjectFile &getObjFileLowering() const; 138206274Srdivacky 139243830Sdim /// getDataLayout - Return information about data layout. 140243830Sdim const DataLayout &getDataLayout() const; 141206274Srdivacky 142251662Sdim /// getTargetTriple - Return the target triple string. 143251662Sdim StringRef getTargetTriple() const; 144251662Sdim 145206274Srdivacky /// getCurrentSection() - Return the current section we are emitting to. 146206274Srdivacky const MCSection *getCurrentSection() const; 147210299Sed 148263508Sdim MCSymbol *getSymbol(const GlobalValue *GV) const; 149210299Sed 150206274Srdivacky //===------------------------------------------------------------------===// 151206274Srdivacky // MachineFunctionPass Implementation. 152206274Srdivacky //===------------------------------------------------------------------===// 153210299Sed 154193323Sed /// getAnalysisUsage - Record analysis usage. 155210299Sed /// 156193323Sed void getAnalysisUsage(AnalysisUsage &AU) const; 157210299Sed 158193323Sed /// doInitialization - Set up the AsmPrinter when we are working on a new 159193323Sed /// module. If your pass overrides this, it must make sure to explicitly 160193323Sed /// call this implementation. 161193323Sed bool doInitialization(Module &M); 162193323Sed 163193323Sed /// doFinalization - Shut down the asmprinter. If you override this in your 164193323Sed /// pass, you must make sure to call it explicitly. 165193323Sed bool doFinalization(Module &M); 166210299Sed 167203954Srdivacky /// runOnMachineFunction - Emit the specified function out to the 168203954Srdivacky /// OutStreamer. 169203954Srdivacky virtual bool runOnMachineFunction(MachineFunction &MF) { 170203954Srdivacky SetupMachineFunction(MF); 171203954Srdivacky EmitFunctionHeader(); 172203954Srdivacky EmitFunctionBody(); 173203954Srdivacky return false; 174210299Sed } 175210299Sed 176206274Srdivacky //===------------------------------------------------------------------===// 177206274Srdivacky // Coarse grained IR lowering routines. 178206274Srdivacky //===------------------------------------------------------------------===// 179210299Sed 180193323Sed /// SetupMachineFunction - This should be called when a new MachineFunction 181193323Sed /// is being processed from runOnMachineFunction. 182193323Sed void SetupMachineFunction(MachineFunction &MF); 183210299Sed 184203954Srdivacky /// EmitFunctionHeader - This method emits the header for the current 185203954Srdivacky /// function. 186203954Srdivacky void EmitFunctionHeader(); 187210299Sed 188203954Srdivacky /// EmitFunctionBody - This method emits the body and trailer for a 189203954Srdivacky /// function. 190203954Srdivacky void EmitFunctionBody(); 191203954Srdivacky 192221345Sdim void emitPrologLabel(const MachineInstr &MI); 193221345Sdim 194223017Sdim enum CFIMoveType { 195223017Sdim CFI_M_None, 196223017Sdim CFI_M_EH, 197223017Sdim CFI_M_Debug 198223017Sdim }; 199223017Sdim CFIMoveType needsCFIMoves(); 200221345Sdim 201223017Sdim bool needsSEHMoves(); 202223017Sdim 203234353Sdim /// needsRelocationsForDwarfStringPool - Specifies whether the object format 204234353Sdim /// expects to use relocations to refer to debug entries. Alternatively we 205234353Sdim /// emit section offsets in bytes from the start of the string pool. 206234353Sdim bool needsRelocationsForDwarfStringPool() const; 207234353Sdim 208193323Sed /// EmitConstantPool - Print to the current output stream assembly 209193323Sed /// representations of the constants in the constant pool MCP. This is 210193323Sed /// used to print out constants which have been "spilled to memory" by 211193323Sed /// the code generator. 212193323Sed /// 213203954Srdivacky virtual void EmitConstantPool(); 214210299Sed 215210299Sed /// EmitJumpTableInfo - Print assembly representations of the jump tables 216210299Sed /// used by the current function to the current output stream. 217193323Sed /// 218203954Srdivacky void EmitJumpTableInfo(); 219210299Sed 220202878Srdivacky /// EmitGlobalVariable - Emit the specified global variable to the .s file. 221202878Srdivacky virtual void EmitGlobalVariable(const GlobalVariable *GV); 222210299Sed 223193323Sed /// EmitSpecialLLVMGlobal - Check to see if the specified global is a 224193323Sed /// special global used by LLVM. If so, emit it and return true, otherwise 225193323Sed /// do nothing and return false. 226193323Sed bool EmitSpecialLLVMGlobal(const GlobalVariable *GV); 227198090Srdivacky 228193323Sed /// EmitAlignment - Emit an alignment directive to the specified power of 229193323Sed /// two boundary. For example, if you pass in 3 here, you will get an 8 230193323Sed /// byte alignment. If a global value is specified, and if that global has 231207618Srdivacky /// an explicit alignment requested, it will override the alignment request 232207618Srdivacky /// if required for correctness. 233193323Sed /// 234207618Srdivacky void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const; 235210299Sed 236206274Srdivacky /// EmitBasicBlockStart - This method prints the label for the specified 237206274Srdivacky /// MachineBasicBlock, an alignment (if present) and a comment describing 238206274Srdivacky /// it if appropriate. 239206274Srdivacky void EmitBasicBlockStart(const MachineBasicBlock *MBB) const; 240210299Sed 241263508Sdim /// \brief Print a general LLVM constant to the .s file. 242263508Sdim void EmitGlobalConstant(const Constant *CV); 243210299Sed 244210299Sed 245206274Srdivacky //===------------------------------------------------------------------===// 246206274Srdivacky // Overridable Hooks 247206274Srdivacky //===------------------------------------------------------------------===// 248210299Sed 249206274Srdivacky // Targets can, or in the case of EmitInstruction, must implement these to 250206274Srdivacky // customize output. 251210299Sed 252206274Srdivacky /// EmitStartOfAsmFile - This virtual method can be overridden by targets 253206274Srdivacky /// that want to emit something at the start of their file. 254206274Srdivacky virtual void EmitStartOfAsmFile(Module &) {} 255210299Sed 256206274Srdivacky /// EmitEndOfAsmFile - This virtual method can be overridden by targets that 257206274Srdivacky /// want to emit something at the end of their file. 258206274Srdivacky virtual void EmitEndOfAsmFile(Module &) {} 259210299Sed 260206274Srdivacky /// EmitFunctionBodyStart - Targets can override this to emit stuff before 261206274Srdivacky /// the first basic block in the function. 262206274Srdivacky virtual void EmitFunctionBodyStart() {} 263210299Sed 264206274Srdivacky /// EmitFunctionBodyEnd - Targets can override this to emit stuff after 265206274Srdivacky /// the last basic block in the function. 266206274Srdivacky virtual void EmitFunctionBodyEnd() {} 267210299Sed 268206274Srdivacky /// EmitInstruction - Targets should implement this to emit instructions. 269206274Srdivacky virtual void EmitInstruction(const MachineInstr *) { 270234353Sdim llvm_unreachable("EmitInstruction not implemented"); 271206274Srdivacky } 272210299Sed 273206274Srdivacky virtual void EmitFunctionEntryLabel(); 274210299Sed 275206274Srdivacky virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV); 276210299Sed 277234353Sdim /// EmitXXStructor - Targets can override this to change how global 278234353Sdim /// constants that are part of a C++ static/global constructor list are 279234353Sdim /// emitted. 280234353Sdim virtual void EmitXXStructor(const Constant *CV) { 281234353Sdim EmitGlobalConstant(CV); 282234353Sdim } 283234353Sdim 284206274Srdivacky /// isBlockOnlyReachableByFallthough - Return true if the basic block has 285206274Srdivacky /// exactly one predecessor and the control transfer mechanism between 286206274Srdivacky /// the predecessor and this block is a fall-through. 287206274Srdivacky virtual bool 288206274Srdivacky isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const; 289210299Sed 290263508Sdim /// emitImplicitDef - Targets can override this to customize the output of 291263508Sdim /// IMPLICIT_DEF instructions in verbose mode. 292263508Sdim virtual void emitImplicitDef(const MachineInstr *MI) const; 293263508Sdim 294206274Srdivacky //===------------------------------------------------------------------===// 295206274Srdivacky // Symbol Lowering Routines. 296206274Srdivacky //===------------------------------------------------------------------===// 297206274Srdivacky public: 298193323Sed 299206274Srdivacky /// GetTempSymbol - Return the MCSymbol corresponding to the assembler 300206274Srdivacky /// temporary label with the specified stem and unique ID. 301206274Srdivacky MCSymbol *GetTempSymbol(StringRef Name, unsigned ID) const; 302210299Sed 303206274Srdivacky /// GetTempSymbol - Return an assembler temporary label with the specified 304206274Srdivacky /// stem. 305206274Srdivacky MCSymbol *GetTempSymbol(StringRef Name) const; 306210299Sed 307210299Sed 308202878Srdivacky /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with 309202878Srdivacky /// global value name as its base, with the specified suffix, and where the 310202878Srdivacky /// symbol is forced to have private linkage if ForcePrivate is true. 311202878Srdivacky MCSymbol *GetSymbolWithGlobalValueBase(const GlobalValue *GV, 312202878Srdivacky StringRef Suffix, 313202878Srdivacky bool ForcePrivate = true) const; 314210299Sed 315202878Srdivacky /// GetExternalSymbolSymbol - Return the MCSymbol for the specified 316202878Srdivacky /// ExternalSymbol. 317202878Srdivacky MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const; 318210299Sed 319202878Srdivacky /// GetCPISymbol - Return the symbol for the specified constant pool entry. 320202878Srdivacky MCSymbol *GetCPISymbol(unsigned CPID) const; 321202878Srdivacky 322202878Srdivacky /// GetJTISymbol - Return the symbol for the specified jump table entry. 323202878Srdivacky MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const; 324202878Srdivacky 325203954Srdivacky /// GetJTSetSymbol - Return the symbol for the specified jump table .set 326203954Srdivacky /// FIXME: privatize to AsmPrinter. 327203954Srdivacky MCSymbol *GetJTSetSymbol(unsigned UID, unsigned MBBID) const; 328203954Srdivacky 329198892Srdivacky /// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress 330198892Srdivacky /// uses of the specified basic block. 331203954Srdivacky MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const; 332205218Srdivacky MCSymbol *GetBlockAddressSymbol(const BasicBlock *BB) const; 333198892Srdivacky 334212904Sdim //===------------------------------------------------------------------===// 335206274Srdivacky // Emission Helper Routines. 336206274Srdivacky //===------------------------------------------------------------------===// 337206274Srdivacky public: 338206274Srdivacky /// printOffset - This is just convenient handler for printing offsets. 339206274Srdivacky void printOffset(int64_t Offset, raw_ostream &OS) const; 340210299Sed 341206274Srdivacky /// EmitInt8 - Emit a byte directive and value. 342206274Srdivacky /// 343206274Srdivacky void EmitInt8(int Value) const; 344210299Sed 345206274Srdivacky /// EmitInt16 - Emit a short directive and value. 346206274Srdivacky /// 347206274Srdivacky void EmitInt16(int Value) const; 348210299Sed 349206274Srdivacky /// EmitInt32 - Emit a long directive and value. 350206274Srdivacky /// 351206274Srdivacky void EmitInt32(int Value) const; 352210299Sed 353206274Srdivacky /// EmitLabelDifference - Emit something like ".long Hi-Lo" where the size 354206274Srdivacky /// in bytes of the directive is specified by Size and Hi/Lo specify the 355206274Srdivacky /// labels. This implicitly uses .set if it is available. 356206274Srdivacky void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, 357206274Srdivacky unsigned Size) const; 358210299Sed 359210299Sed /// EmitLabelOffsetDifference - Emit something like ".long Hi+Offset-Lo" 360207618Srdivacky /// where the size in bytes of the directive is specified by Size and Hi/Lo 361207618Srdivacky /// specify the labels. This implicitly uses .set if it is available. 362207618Srdivacky void EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset, 363207618Srdivacky const MCSymbol *Lo, unsigned Size) const; 364210299Sed 365212904Sdim /// EmitLabelPlusOffset - Emit something like ".long Label+Offset" 366212904Sdim /// where the size in bytes of the directive is specified by Size and Label 367212904Sdim /// specifies the label. This implicitly uses .set if it is available. 368212904Sdim void EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, 369263508Sdim unsigned Size, 370263508Sdim bool IsSectionRelative = false) const; 371212904Sdim 372239462Sdim /// EmitLabelReference - Emit something like ".long Label" 373239462Sdim /// where the size in bytes of the directive is specified by Size and Label 374239462Sdim /// specifies the label. 375263508Sdim void EmitLabelReference(const MCSymbol *Label, unsigned Size, 376263508Sdim bool IsSectionRelative = false) const { 377263508Sdim EmitLabelPlusOffset(Label, 0, Size, IsSectionRelative); 378239462Sdim } 379239462Sdim 380206274Srdivacky //===------------------------------------------------------------------===// 381206274Srdivacky // Dwarf Emission Helper Routines 382206274Srdivacky //===------------------------------------------------------------------===// 383210299Sed 384206274Srdivacky /// EmitSLEB128 - emit the specified signed leb128 value. 385263508Sdim void EmitSLEB128(int64_t Value, const char *Desc = 0) const; 386210299Sed 387206274Srdivacky /// EmitULEB128 - emit the specified unsigned leb128 value. 388263508Sdim void EmitULEB128(uint64_t Value, const char *Desc = 0, 389206274Srdivacky unsigned PadTo = 0) const; 390210299Sed 391206274Srdivacky /// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value. 392206274Srdivacky void EmitCFAByte(unsigned Val) const; 393193323Sed 394206274Srdivacky /// EmitEncodingByte - Emit a .byte 42 directive that corresponds to an 395206274Srdivacky /// encoding. If verbose assembly output is enabled, we output comments 396206274Srdivacky /// describing the encoding. Desc is a string saying what the encoding is 397206274Srdivacky /// specifying (e.g. "LSDA"). 398206274Srdivacky void EmitEncodingByte(unsigned Val, const char *Desc = 0) const; 399210299Sed 400206274Srdivacky /// GetSizeOfEncodedValue - Return the size of the encoding in bytes. 401206274Srdivacky unsigned GetSizeOfEncodedValue(unsigned Encoding) const; 402210299Sed 403249423Sdim /// EmitReference - Emit reference to a ttype global with a specified encoding. 404249423Sdim void EmitTTypeReference(const GlobalValue *GV, unsigned Encoding) const; 405210299Sed 406206274Srdivacky /// EmitSectionOffset - Emit the 4-byte offset of Label from the start of 407206274Srdivacky /// its section. This can be done with a special directive if the target 408206274Srdivacky /// supports it (e.g. cygwin) or by emitting it as an offset from a label at 409206274Srdivacky /// the start of the section. 410206274Srdivacky /// 411206274Srdivacky /// SectionLabel is a temporary label emitted at the start of the section 412206274Srdivacky /// that Label lives in. 413206274Srdivacky void EmitSectionOffset(const MCSymbol *Label, 414206274Srdivacky const MCSymbol *SectionLabel) const; 415207618Srdivacky 416212904Sdim /// getISAEncoding - Get the value for DW_AT_APPLE_isa. Zero if no isa 417212904Sdim /// encoding specified. 418212904Sdim virtual unsigned getISAEncoding() { return 0; } 419212904Sdim 420221345Sdim /// EmitDwarfRegOp - Emit dwarf register operation. 421263508Sdim virtual void EmitDwarfRegOp(const MachineLocation &MLoc, 422263508Sdim bool Indirect) const; 423221345Sdim 424206274Srdivacky //===------------------------------------------------------------------===// 425206274Srdivacky // Dwarf Lowering Routines 426206274Srdivacky //===------------------------------------------------------------------===// 427210299Sed 428263508Sdim /// \brief Emit frame instruction to describe the layout of the frame. 429263508Sdim void emitCFIInstruction(const MCCFIInstruction &Inst) const; 430210299Sed 431206274Srdivacky //===------------------------------------------------------------------===// 432206274Srdivacky // Inline Asm Support 433206274Srdivacky //===------------------------------------------------------------------===// 434206274Srdivacky public: 435206274Srdivacky // These are hooks that targets can override to implement inline asm 436206274Srdivacky // support. These should probably be moved out of AsmPrinter someday. 437210299Sed 438206274Srdivacky /// PrintSpecial - Print information related to the specified machine instr 439206274Srdivacky /// that is independent of the operand, and may be independent of the instr 440206274Srdivacky /// itself. This can be useful for portably encoding the comment character 441206274Srdivacky /// or other bits of target-specific knowledge into the asmstrings. The 442206274Srdivacky /// syntax used is ${:comment}. Targets can override this to add support 443206274Srdivacky /// for their own strange codes. 444206274Srdivacky virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS, 445206274Srdivacky const char *Code) const; 446210299Sed 447206274Srdivacky /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM 448206274Srdivacky /// instruction, using the specified assembler variant. Targets should 449206274Srdivacky /// override this to format as appropriate. This method can return true if 450206274Srdivacky /// the operand is erroneous. 451206274Srdivacky virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, 452206274Srdivacky unsigned AsmVariant, const char *ExtraCode, 453206274Srdivacky raw_ostream &OS); 454210299Sed 455206274Srdivacky /// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM 456206274Srdivacky /// instruction, using the specified assembler variant as an address. 457206274Srdivacky /// Targets should override this to format as appropriate. This method can 458206274Srdivacky /// return true if the operand is erroneous. 459206274Srdivacky virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, 460210299Sed unsigned AsmVariant, 461263508Sdim const char *ExtraCode, raw_ostream &OS); 462210299Sed 463203954Srdivacky private: 464206274Srdivacky /// Private state for PrintSpecial() 465206274Srdivacky // Assign a unique ID to this machine instruction. 466206274Srdivacky mutable const MachineInstr *LastMI; 467206274Srdivacky mutable unsigned LastFn; 468206274Srdivacky mutable unsigned Counter; 469206274Srdivacky mutable unsigned SetCounter; 470203954Srdivacky 471206274Srdivacky /// EmitInlineAsm - Emit a blob of inline asm to the output streamer. 472243830Sdim void EmitInlineAsm(StringRef Str, const MDNode *LocMDNode = 0, 473263508Sdim InlineAsm::AsmDialect AsmDialect = 474263508Sdim InlineAsm::AD_ATT) const; 475210299Sed 476206274Srdivacky /// EmitInlineAsm - This method formats and emits the specified machine 477193323Sed /// instruction that is an inline asm. 478206274Srdivacky void EmitInlineAsm(const MachineInstr *MI) const; 479193323Sed 480206274Srdivacky //===------------------------------------------------------------------===// 481206274Srdivacky // Internal Implementation Details 482206274Srdivacky //===------------------------------------------------------------------===// 483210299Sed 484203954Srdivacky /// EmitVisibility - This emits visibility information about symbol, if 485193323Sed /// this is suported by the target. 486219077Sdim void EmitVisibility(MCSymbol *Sym, unsigned Visibility, 487219077Sdim bool IsDefinition = true) const; 488210299Sed 489263508Sdim void EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const; 490210299Sed 491203954Srdivacky void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI, 492263508Sdim const MachineBasicBlock *MBB, unsigned uid) const; 493251662Sdim void EmitLLVMUsedList(const ConstantArray *InitList); 494263508Sdim /// Emit llvm.ident metadata in an '.ident' directive. 495263508Sdim void EmitModuleIdents(Module &M); 496234353Sdim void EmitXXStructorList(const Constant *List, bool isCtor); 497193323Sed GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C); 498193323Sed }; 499193323Sed} 500193323Sed 501193323Sed#endif 502