AsmPrinter.h revision 5129bdecd87c518713765acd6998c80f9eef36a2
1a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner//===-- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework --------*- C++ -*-===// 2ea61c358720aa6c7a159d51658b34276316aa841Misha Brukman// 3a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner// The LLVM Compiler Infrastructure 4a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner// 57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source 67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details. 7ea61c358720aa6c7a159d51658b34276316aa841Misha Brukman// 8a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner//===----------------------------------------------------------------------===// 9a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner// 10563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey// This file contains a class to be used as the base class for target specific 11563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey// asm writers. This class primarily handles common functionality used by 12563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey// all asm writers. 13a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner// 14a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner//===----------------------------------------------------------------------===// 15a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 16a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner#ifndef LLVM_CODEGEN_ASMPRINTER_H 17a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner#define LLVM_CODEGEN_ASMPRINTER_H 18a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 19a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner#include "llvm/CodeGen/MachineFunctionPass.h" 201f6efa3996dd1929fbc129203ce5009b620e6969Michael J. Spencer#include "llvm/Support/DataTypes.h" 21a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 22a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattnernamespace llvm { 238c2b52552c90f39e4b2fed43e309e599e742b6acDan Gohman class BlockAddress; 245eca075b74d62c621b160aa216b4cd50829a2cc7Gordon Henriksen class GCStrategy; 25a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner class Constant; 26c884db47f1a1d5449b749e6528292451e49025e4Jeff Cohen class ConstantArray; 27fe37ab335be5632eab561d49984c95cb06b946d4David Greene class ConstantFP; 2800d448a341175556ebd86af68219f5b90b7145a3Dan Gohman class ConstantInt; 2900d448a341175556ebd86af68219f5b90b7145a3Dan Gohman class ConstantStruct; 3000d448a341175556ebd86af68219f5b90b7145a3Dan Gohman class ConstantVector; 31c317a60c2714a5b90700a11ba646285cb754a5d3Gordon Henriksen class GCMetadataPrinter; 32fe37ab335be5632eab561d49984c95cb06b946d4David Greene class GlobalValue; 33ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner class GlobalVariable; 34fe37ab335be5632eab561d49984c95cb06b946d4David Greene class MachineBasicBlock; 35fe37ab335be5632eab561d49984c95cb06b946d4David Greene class MachineFunction; 36fe37ab335be5632eab561d49984c95cb06b946d4David Greene class MachineInstr; 3728ff35d030e2f49ff4e4b1544c015ebe011a530bDevang Patel class MachineLocation; 38b71d1b2fe2c0673005283b48be2f37c750ce367bDavid Greene class MachineLoopInfo; 39b71d1b2fe2c0673005283b48be2f37c750ce367bDavid Greene class MachineLoop; 40fe37ab335be5632eab561d49984c95cb06b946d4David Greene class MachineConstantPool; 412d2cec1e9e93a388bd8448f4bad661ac89a49de3Evan Cheng class MachineConstantPoolEntry; 42d6594ae54cfde4db4d30272192645c0a45fb9902Evan Cheng class MachineConstantPoolValue; 43fe37ab335be5632eab561d49984c95cb06b946d4David Greene class MachineJumpTableInfo; 440de1fc4f416b3e94749ca84cdaede55b040a8b60Chris Lattner class MachineModuleInfo; 4502b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner class MachineMove; 4649cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner class MCAsmInfo; 47014700c1a8cba203fd21ff129426ba8a426ab244David Greene class MCInst; 482b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner class MCContext; 49a87dea4f8c546ca748f1777a8d1cabcc06515d91Chris Lattner class MCSection; 502b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner class MCStreamer; 517cb384dcca3f1ccfc993182ee4b972f7fffc8ffaChris Lattner class MCSymbol; 52a38941d458273946594d3592ed5debdc9730db08Chris Lattner class MDNode; 5349cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner class DwarfDebug; 5449cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner class DwarfException; 55563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey class Mangler; 56f0144127b98425d214e59e4a1a4b342b78e3642bChris Lattner class TargetLoweringObjectFile; 57d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner class TargetData; 5811112e0d7b1fb2741ed65a5085037918d1425916Dan Gohman class TargetMachine; 591efd4fd56b3bc21b85ab921c6f77807afc02ecb5Benjamin Kramer class Twine; 6084bc5427d6883f73cfeae3da640acd011d35c006Chris Lattner class Type; 61a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 62563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey /// AsmPrinter - This class is intended to be used as a driving class for all 63563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey /// asm writers. 64a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner class AsmPrinter : public MachineFunctionPass { 653f53c8398d81065736a784469c9dd5afff85673fChris Lattner public: 66a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// Target machine description. 67a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// 68a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner TargetMachine &TM; 69dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 70563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey /// Target Asm Printer information. 71563321a2582851c653d0863e8e0bba3d483734f9Jim Laskey /// 7233adcfb4d217f5f23d9bde8ba02b8e48f9605fc5Chris Lattner const MCAsmInfo *MAI; 73a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 742b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner /// OutContext - This is the context for the output file that we are 752b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner /// streaming. This owns all of the global MC-related objects for the 762b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner /// generated translation unit. 772b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner MCContext &OutContext; 78dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 792b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner /// OutStreamer - This is the MCStreamer object for the file we are 802b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner /// generating. This contains the transient state for the current 812b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner /// translation unit that we are generating (such as the current section 822b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner /// etc). 832b2954f00ba02ca1a902f47080cd9f06aebc0378Chris Lattner MCStreamer &OutStreamer; 84dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 8557f0db833dc30404f1f5d28b23df326e520698ecBill Wendling /// The current machine function. 8657f0db833dc30404f1f5d28b23df326e520698ecBill Wendling const MachineFunction *MF; 8757f0db833dc30404f1f5d28b23df326e520698ecBill Wendling 88300a4c5640fb1c717ba0d7108d15aec1bd7eb396Chris Lattner /// MMI - This is a pointer to the current MachineModuleInfo. 89300a4c5640fb1c717ba0d7108d15aec1bd7eb396Chris Lattner MachineModuleInfo *MMI; 90300a4c5640fb1c717ba0d7108d15aec1bd7eb396Chris Lattner 91a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// Name-mangler for global names. 92a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// 93a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner Mangler *Mang; 94a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 95412c3a5bc9e70fe8579551216786e70d323a3dd5Chris Lattner /// The symbol for the current function. This is recalculated at the 96a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// beginning of each call to runOnMachineFunction(). 97a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// 985957c84e09b177aecf8b430c33fd75a36575fb57Chris Lattner MCSymbol *CurrentFnSym; 99dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 100e00b59f954c7e27d9d34abf90bfac969fb12f19aChris Lattner private: 101e00b59f954c7e27d9d34abf90bfac969fb12f19aChris Lattner // GCMetadataPrinters - The garbage collection metadata printer table. 102e00b59f954c7e27d9d34abf90bfac969fb12f19aChris Lattner void *GCMetadataPrinters; // Really a DenseMap. 103dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 1043f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// VerboseAsm - Emit comments in assembly output if this is true. 1053f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// 1063f53c8398d81065736a784469c9dd5afff85673fChris Lattner bool VerboseAsm; 1073f53c8398d81065736a784469c9dd5afff85673fChris Lattner static char ID; 108dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 1093f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// If VerboseAsm is set, a pointer to the loop info for this 1103f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// function. 1113f53c8398d81065736a784469c9dd5afff85673fChris Lattner MachineLoopInfo *LI; 11249cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner 11349cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner /// DD - If the target supports dwarf debug info, this pointer is non-null. 11449cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner DwarfDebug *DD; 115dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 11649cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner /// DE - If the target supports dwarf exception info, this pointer is 11749cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner /// non-null. 11849cd6649e1246c05896fadefe2fcbc4bc1f5d221Chris Lattner DwarfException *DE; 119dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 120b2efb853f00d45b1c8d57f92acd0028fbdeffda6Jim Laskey protected: 121b23569aff0a6d2b231cb93cc4acd0ac060ba560fChris Lattner explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer); 122dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 123a7cea6f599418a579ab5ce66413fba7efa8bf581Jim Laskey public: 124c317a60c2714a5b90700a11ba646285cb754a5d3Gordon Henriksen virtual ~AsmPrinter(); 12542bf74be1402df7409efbea089310d4c276fde37Evan Cheng 12642bf74be1402df7409efbea089310d4c276fde37Evan Cheng /// isVerbose - Return true if assembly output should contain comments. 12742bf74be1402df7409efbea089310d4c276fde37Evan Cheng /// 12842bf74be1402df7409efbea089310d4c276fde37Evan Cheng bool isVerbose() const { return VerboseAsm; } 12942bf74be1402df7409efbea089310d4c276fde37Evan Cheng 1303fb2b1ede30193b59a651328a946174196b20610Jim Grosbach /// getFunctionNumber - Return a unique ID for the current function. 1313fb2b1ede30193b59a651328a946174196b20610Jim Grosbach /// 132b84822fb7b64977c16e97b870891da1d6c9736feChris Lattner unsigned getFunctionNumber() const; 133dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 134d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner /// getObjFileLowering - Return information about object file lowering. 1350d805c33d134d88169e3dc4a3272cff9a5713ce7Dan Gohman const TargetLoweringObjectFile &getObjFileLowering() const; 136d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner 137d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner /// getTargetData - Return information about data layout. 138d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner const TargetData &getTargetData() const; 139d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner 140d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner /// getCurrentSection() - Return the current section we are emitting to. 141d38fee8ddc6597555904b82b6471a446cc5fe183Chris Lattner const MCSection *getCurrentSection() const; 142dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 143dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 1443f53c8398d81065736a784469c9dd5afff85673fChris Lattner //===------------------------------------------------------------------===// 1453f53c8398d81065736a784469c9dd5afff85673fChris Lattner // MachineFunctionPass Implementation. 1463f53c8398d81065736a784469c9dd5afff85673fChris Lattner //===------------------------------------------------------------------===// 147dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 148ce2247755e56f99a2377b64a1a9d393726582b85Gordon Henriksen /// getAnalysisUsage - Record analysis usage. 149dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov /// 150ce2247755e56f99a2377b64a1a9d393726582b85Gordon Henriksen void getAnalysisUsage(AnalysisUsage &AU) const; 151dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 152a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// doInitialization - Set up the AsmPrinter when we are working on a new 153a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// module. If your pass overrides this, it must make sure to explicitly 154a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// call this implementation. 155a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner bool doInitialization(Module &M); 156a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 157a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// doFinalization - Shut down the asmprinter. If you override this in your 158a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// pass, you must make sure to call it explicitly. 159a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner bool doFinalization(Module &M); 160dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 161d49fe1b6bc4615684c2ec71140a21e9c4cd69ce3Chris Lattner /// runOnMachineFunction - Emit the specified function out to the 162d49fe1b6bc4615684c2ec71140a21e9c4cd69ce3Chris Lattner /// OutStreamer. 163d49fe1b6bc4615684c2ec71140a21e9c4cd69ce3Chris Lattner virtual bool runOnMachineFunction(MachineFunction &MF) { 164d49fe1b6bc4615684c2ec71140a21e9c4cd69ce3Chris Lattner SetupMachineFunction(MF); 165d49fe1b6bc4615684c2ec71140a21e9c4cd69ce3Chris Lattner EmitFunctionHeader(); 166d49fe1b6bc4615684c2ec71140a21e9c4cd69ce3Chris Lattner EmitFunctionBody(); 167d49fe1b6bc4615684c2ec71140a21e9c4cd69ce3Chris Lattner return false; 168dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov } 169dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 1703f53c8398d81065736a784469c9dd5afff85673fChris Lattner //===------------------------------------------------------------------===// 1713f53c8398d81065736a784469c9dd5afff85673fChris Lattner // Coarse grained IR lowering routines. 1723f53c8398d81065736a784469c9dd5afff85673fChris Lattner //===------------------------------------------------------------------===// 173dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 1746fe3acce749ee2b3714009064626f6c53b06dfb4Chris Lattner /// SetupMachineFunction - This should be called when a new MachineFunction 175a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner /// is being processed from runOnMachineFunction. 1766fe3acce749ee2b3714009064626f6c53b06dfb4Chris Lattner void SetupMachineFunction(MachineFunction &MF); 177dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 178b11caedd6f36afc6518cf0ea9bbff6500fd77334Chris Lattner /// EmitFunctionHeader - This method emits the header for the current 179b11caedd6f36afc6518cf0ea9bbff6500fd77334Chris Lattner /// function. 180b11caedd6f36afc6518cf0ea9bbff6500fd77334Chris Lattner void EmitFunctionHeader(); 181dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 18214c38ec2afeaf25c53a50c2c65116aca8c889401Chris Lattner /// EmitFunctionBody - This method emits the body and trailer for a 18314c38ec2afeaf25c53a50c2c65116aca8c889401Chris Lattner /// function. 18414c38ec2afeaf25c53a50c2c65116aca8c889401Chris Lattner void EmitFunctionBody(); 185b11caedd6f36afc6518cf0ea9bbff6500fd77334Chris Lattner 186ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// EmitConstantPool - Print to the current output stream assembly 187ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// representations of the constants in the constant pool MCP. This is 188ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// used to print out constants which have been "spilled to memory" by 189ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// the code generator. 190ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// 191a2406190ca28dc5901dfe747849c8eda9c29d7eeChris Lattner virtual void EmitConstantPool(); 192dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 193dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov /// EmitJumpTableInfo - Print assembly representations of the jump tables 194dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov /// used by the current function to the current output stream. 19537efe6764568a3829fee26aba532283131d1a104Nate Begeman /// 19614c38ec2afeaf25c53a50c2c65116aca8c889401Chris Lattner void EmitJumpTableInfo(); 197dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 19848d64ba9d846229339b2431b298620cb8a01ffc5Chris Lattner /// EmitGlobalVariable - Emit the specified global variable to the .s file. 19974bfe21b50c14c15f55ce3bd5857d65b588fae3cChris Lattner virtual void EmitGlobalVariable(const GlobalVariable *GV); 200dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 201ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// EmitSpecialLLVMGlobal - Check to see if the specified global is a 202ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// special global used by LLVM. If so, emit it and return true, otherwise 203ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner /// do nothing and return false. 204ed13893ff729bc3b91697f6d80a3ba303782efccChris Lattner bool EmitSpecialLLVMGlobal(const GlobalVariable *GV); 20587370b8301fa39ee54bdcaae0618fd565e808466Devang Patel 206c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// EmitAlignment - Emit an alignment directive to the specified power of 207c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// two boundary. For example, if you pass in 3 here, you will get an 8 208c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// byte alignment. If a global value is specified, and if that global has 209e87f7bb50e1d08a09e29252806f6502dcff0539dChris Lattner /// an explicit alignment requested, it will override the alignment request 210e87f7bb50e1d08a09e29252806f6502dcff0539dChris Lattner /// if required for correctness. 211c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// 212a7b611c10d0e5fef5870d854518e639ce3d3c6beChris Lattner void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const; 213dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 214c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// EmitBasicBlockStart - This method prints the label for the specified 215c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// MachineBasicBlock, an alignment (if present) and a comment describing 216c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// it if appropriate. 217c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner void EmitBasicBlockStart(const MachineBasicBlock *MBB) const; 218dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 219c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// EmitGlobalConstant - Print a general LLVM constant to the .s file. 220c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner void EmitGlobalConstant(const Constant *CV, unsigned AddrSpace = 0); 221dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 222dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 223f1cdea1d021068f5c9e118d68321ce28fcea63faJim Laskey //===------------------------------------------------------------------===// 2243f53c8398d81065736a784469c9dd5afff85673fChris Lattner // Overridable Hooks 2253f53c8398d81065736a784469c9dd5afff85673fChris Lattner //===------------------------------------------------------------------===// 226dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2273f53c8398d81065736a784469c9dd5afff85673fChris Lattner // Targets can, or in the case of EmitInstruction, must implement these to 2283f53c8398d81065736a784469c9dd5afff85673fChris Lattner // customize output. 229dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2303f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitStartOfAsmFile - This virtual method can be overridden by targets 2313f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// that want to emit something at the start of their file. 2323f53c8398d81065736a784469c9dd5afff85673fChris Lattner virtual void EmitStartOfAsmFile(Module &) {} 233dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2343f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitEndOfAsmFile - This virtual method can be overridden by targets that 2353f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// want to emit something at the end of their file. 2363f53c8398d81065736a784469c9dd5afff85673fChris Lattner virtual void EmitEndOfAsmFile(Module &) {} 237dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2383f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitFunctionBodyStart - Targets can override this to emit stuff before 2393f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// the first basic block in the function. 2403f53c8398d81065736a784469c9dd5afff85673fChris Lattner virtual void EmitFunctionBodyStart() {} 241dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2423f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitFunctionBodyEnd - Targets can override this to emit stuff after 2433f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// the last basic block in the function. 2443f53c8398d81065736a784469c9dd5afff85673fChris Lattner virtual void EmitFunctionBodyEnd() {} 245dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2463f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitInstruction - Targets should implement this to emit instructions. 2473f53c8398d81065736a784469c9dd5afff85673fChris Lattner virtual void EmitInstruction(const MachineInstr *) { 2483f53c8398d81065736a784469c9dd5afff85673fChris Lattner assert(0 && "EmitInstruction not implemented"); 2493f53c8398d81065736a784469c9dd5afff85673fChris Lattner } 250dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 25117fedf216bc10c66e02694854f522cb602097005Chris Lattner virtual void EmitFunctionEntryLabel(); 252dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 25317fedf216bc10c66e02694854f522cb602097005Chris Lattner virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV); 254dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 25517fedf216bc10c66e02694854f522cb602097005Chris Lattner /// isBlockOnlyReachableByFallthough - Return true if the basic block has 25617fedf216bc10c66e02694854f522cb602097005Chris Lattner /// exactly one predecessor and the control transfer mechanism between 25717fedf216bc10c66e02694854f522cb602097005Chris Lattner /// the predecessor and this block is a fall-through. 25817fedf216bc10c66e02694854f522cb602097005Chris Lattner virtual bool 25917fedf216bc10c66e02694854f522cb602097005Chris Lattner isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const; 260dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 261f1cdea1d021068f5c9e118d68321ce28fcea63faJim Laskey //===------------------------------------------------------------------===// 262c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner // Symbol Lowering Routines. 2633f53c8398d81065736a784469c9dd5afff85673fChris Lattner //===------------------------------------------------------------------===// 2643f53c8398d81065736a784469c9dd5afff85673fChris Lattner public: 265f1cdea1d021068f5c9e118d68321ce28fcea63faJim Laskey 266c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// GetTempSymbol - Return the MCSymbol corresponding to the assembler 267c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// temporary label with the specified stem and unique ID. 268c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner MCSymbol *GetTempSymbol(StringRef Name, unsigned ID) const; 269dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 270c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// GetTempSymbol - Return an assembler temporary label with the specified 271c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner /// stem. 272c021572511f08372ae52fe8e31d3c307cab448fdChris Lattner MCSymbol *GetTempSymbol(StringRef Name) const; 273dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 274dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2757a2ba94d03b43f41b54872dacd7b2250dde4c7bdChris Lattner /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with 276d588b97cc9acf778282ab10efa4f298cead1215aChris Lattner /// global value name as its base, with the specified suffix, and where the 2777a2ba94d03b43f41b54872dacd7b2250dde4c7bdChris Lattner /// symbol is forced to have private linkage if ForcePrivate is true. 2787a2ba94d03b43f41b54872dacd7b2250dde4c7bdChris Lattner MCSymbol *GetSymbolWithGlobalValueBase(const GlobalValue *GV, 2797a2ba94d03b43f41b54872dacd7b2250dde4c7bdChris Lattner StringRef Suffix, 2807a2ba94d03b43f41b54872dacd7b2250dde4c7bdChris Lattner bool ForcePrivate = true) const; 281dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2826b04edee11c2bb35a48b1c42f867b4ba8cdfff97Chris Lattner /// GetExternalSymbolSymbol - Return the MCSymbol for the specified 2836b04edee11c2bb35a48b1c42f867b4ba8cdfff97Chris Lattner /// ExternalSymbol. 2846b04edee11c2bb35a48b1c42f867b4ba8cdfff97Chris Lattner MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const; 285dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 2863924868a957d5a6d468b61741cbb7db77324d1f6Chris Lattner /// GetCPISymbol - Return the symbol for the specified constant pool entry. 2873924868a957d5a6d468b61741cbb7db77324d1f6Chris Lattner MCSymbol *GetCPISymbol(unsigned CPID) const; 2883924868a957d5a6d468b61741cbb7db77324d1f6Chris Lattner 2893924868a957d5a6d468b61741cbb7db77324d1f6Chris Lattner /// GetJTISymbol - Return the symbol for the specified jump table entry. 29007d317711781d8c9268f7d6afcf1ba7eadf1d127Bill Wendling MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const; 2913924868a957d5a6d468b61741cbb7db77324d1f6Chris Lattner 292798d1256595dcc0f5d4423572f856d239f7de0e6Chris Lattner /// GetJTSetSymbol - Return the symbol for the specified jump table .set 293798d1256595dcc0f5d4423572f856d239f7de0e6Chris Lattner /// FIXME: privatize to AsmPrinter. 294798d1256595dcc0f5d4423572f856d239f7de0e6Chris Lattner MCSymbol *GetJTSetSymbol(unsigned UID, unsigned MBBID) const; 295798d1256595dcc0f5d4423572f856d239f7de0e6Chris Lattner 2968c2b52552c90f39e4b2fed43e309e599e742b6acDan Gohman /// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress 2978c2b52552c90f39e4b2fed43e309e599e742b6acDan Gohman /// uses of the specified basic block. 298951755445821b92c3dc38f32b5c36e9875fa4318Chris Lattner MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const; 2993b9d6216a41cfd43759e787db26d797e1f0ba0a8Chris Lattner MCSymbol *GetBlockAddressSymbol(const BasicBlock *BB) const; 3008c2b52552c90f39e4b2fed43e309e599e742b6acDan Gohman 3016215109cd967190a3d005d1e2e284cd51e45eadcJim Grosbach //===------------------------------------------------------------------===// 3023f53c8398d81065736a784469c9dd5afff85673fChris Lattner // Emission Helper Routines. 3033f53c8398d81065736a784469c9dd5afff85673fChris Lattner //===------------------------------------------------------------------===// 3043f53c8398d81065736a784469c9dd5afff85673fChris Lattner public: 30517fedf216bc10c66e02694854f522cb602097005Chris Lattner /// printOffset - This is just convenient handler for printing offsets. 30617fedf216bc10c66e02694854f522cb602097005Chris Lattner void printOffset(int64_t Offset, raw_ostream &OS) const; 307dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3083f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitInt8 - Emit a byte directive and value. 3093f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// 3103f53c8398d81065736a784469c9dd5afff85673fChris Lattner void EmitInt8(int Value) const; 311dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3123f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitInt16 - Emit a short directive and value. 3133f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// 3143f53c8398d81065736a784469c9dd5afff85673fChris Lattner void EmitInt16(int Value) const; 315dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3163f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitInt32 - Emit a long directive and value. 3173f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// 3183f53c8398d81065736a784469c9dd5afff85673fChris Lattner void EmitInt32(int Value) const; 319dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3203f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// EmitLabelDifference - Emit something like ".long Hi-Lo" where the size 3213f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// in bytes of the directive is specified by Size and Hi/Lo specify the 3223f53c8398d81065736a784469c9dd5afff85673fChris Lattner /// labels. This implicitly uses .set if it is available. 3233f53c8398d81065736a784469c9dd5afff85673fChris Lattner void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, 3243f53c8398d81065736a784469c9dd5afff85673fChris Lattner unsigned Size) const; 325dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 326dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov /// EmitLabelOffsetDifference - Emit something like ".long Hi+Offset-Lo" 327f2548caaa8b290aa598bf49c27dff72f7751ba5cDevang Patel /// where the size in bytes of the directive is specified by Size and Hi/Lo 328f2548caaa8b290aa598bf49c27dff72f7751ba5cDevang Patel /// specify the labels. This implicitly uses .set if it is available. 329f2548caaa8b290aa598bf49c27dff72f7751ba5cDevang Patel void EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset, 330f2548caaa8b290aa598bf49c27dff72f7751ba5cDevang Patel const MCSymbol *Lo, unsigned Size) const; 331dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 332b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel /// EmitLabelPlusOffset - Emit something like ".long Label+Offset" 333b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel /// where the size in bytes of the directive is specified by Size and Label 334b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel /// specifies the label. This implicitly uses .set if it is available. 335b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel void EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, 336b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel unsigned Size) const; 337b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel 3387e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner //===------------------------------------------------------------------===// 3397e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner // Dwarf Emission Helper Routines 3407e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner //===------------------------------------------------------------------===// 341dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3427e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner /// EmitSLEB128 - emit the specified signed leb128 value. 3437e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner void EmitSLEB128(int Value, const char *Desc = 0) const; 344dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3457e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner /// EmitULEB128 - emit the specified unsigned leb128 value. 3467e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner void EmitULEB128(unsigned Value, const char *Desc = 0, 3477e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3eaChris Lattner unsigned PadTo = 0) const; 348dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3499be49131363f79ad58a5deb4daf175a7b1c0ec66Chris Lattner /// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value. 3509be49131363f79ad58a5deb4daf175a7b1c0ec66Chris Lattner void EmitCFAByte(unsigned Val) const; 3519be49131363f79ad58a5deb4daf175a7b1c0ec66Chris Lattner 3529be49131363f79ad58a5deb4daf175a7b1c0ec66Chris Lattner /// EmitEncodingByte - Emit a .byte 42 directive that corresponds to an 3539be49131363f79ad58a5deb4daf175a7b1c0ec66Chris Lattner /// encoding. If verbose assembly output is enabled, we output comments 3549be49131363f79ad58a5deb4daf175a7b1c0ec66Chris Lattner /// describing the encoding. Desc is a string saying what the encoding is 3559be49131363f79ad58a5deb4daf175a7b1c0ec66Chris Lattner /// specifying (e.g. "LSDA"). 35602b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner void EmitEncodingByte(unsigned Val, const char *Desc = 0) const; 357dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 358d2af7853e377bce40cbf3e0632a4608484b6aba4Chris Lattner /// GetSizeOfEncodedValue - Return the size of the encoding in bytes. 359d2af7853e377bce40cbf3e0632a4608484b6aba4Chris Lattner unsigned GetSizeOfEncodedValue(unsigned Encoding) const; 360dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 361d2af7853e377bce40cbf3e0632a4608484b6aba4Chris Lattner /// EmitReference - Emit a reference to a label with a specified encoding. 362d2af7853e377bce40cbf3e0632a4608484b6aba4Chris Lattner /// 363d2af7853e377bce40cbf3e0632a4608484b6aba4Chris Lattner void EmitReference(const MCSymbol *Sym, unsigned Encoding) const; 364d2af7853e377bce40cbf3e0632a4608484b6aba4Chris Lattner void EmitReference(const GlobalValue *GV, unsigned Encoding) const; 365dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 3663c754aa81564727805be94089694abeb8fe65160Chris Lattner /// EmitSectionOffset - Emit the 4-byte offset of Label from the start of 3673c754aa81564727805be94089694abeb8fe65160Chris Lattner /// its section. This can be done with a special directive if the target 3683c754aa81564727805be94089694abeb8fe65160Chris Lattner /// supports it (e.g. cygwin) or by emitting it as an offset from a label at 3693c754aa81564727805be94089694abeb8fe65160Chris Lattner /// the start of the section. 3703c754aa81564727805be94089694abeb8fe65160Chris Lattner /// 3713c754aa81564727805be94089694abeb8fe65160Chris Lattner /// SectionLabel is a temporary label emitted at the start of the section 3723c754aa81564727805be94089694abeb8fe65160Chris Lattner /// that Label lives in. 3733c754aa81564727805be94089694abeb8fe65160Chris Lattner void EmitSectionOffset(const MCSymbol *Label, 3743c754aa81564727805be94089694abeb8fe65160Chris Lattner const MCSymbol *SectionLabel) const; 37528ff35d030e2f49ff4e4b1544c015ebe011a530bDevang Patel 37628ff35d030e2f49ff4e4b1544c015ebe011a530bDevang Patel /// getDebugValueLocation - Get location information encoded by DBG_VALUE 37728ff35d030e2f49ff4e4b1544c015ebe011a530bDevang Patel /// operands. 37828ff35d030e2f49ff4e4b1544c015ebe011a530bDevang Patel virtual MachineLocation getDebugValueLocation(const MachineInstr *MI) const; 37928ff35d030e2f49ff4e4b1544c015ebe011a530bDevang Patel 380917290043f87b8efa6ba540bec5963013c517912Jim Grosbach /// getISAEncoding - Get the value for DW_AT_APPLE_isa. Zero if no isa 381917290043f87b8efa6ba540bec5963013c517912Jim Grosbach /// encoding specified. 382917290043f87b8efa6ba540bec5963013c517912Jim Grosbach virtual unsigned getISAEncoding() { return 0; } 383917290043f87b8efa6ba540bec5963013c517912Jim Grosbach 38402b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner //===------------------------------------------------------------------===// 38502b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner // Dwarf Lowering Routines 38602b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner //===------------------------------------------------------------------===// 387dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 38802b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner /// EmitFrameMoves - Emit frame instructions to describe the layout of the 38902b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner /// frame. 390dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov void EmitFrameMoves(const std::vector<MachineMove> &Moves, 39102b86b93dc4616571fed3473c6da9421c10f2fccChris Lattner MCSymbol *BaseLabel, bool isEH) const; 3929a1ef4ef36cfa2d8d9ebd52d601283ae6e7466cdAnton Korobeynikov void EmitCFIFrameMoves(const std::vector<MachineMove> &Moves) const; 393dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 394736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner //===------------------------------------------------------------------===// 395736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner // Inline Asm Support 396736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner //===------------------------------------------------------------------===// 397736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner public: 398736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner // These are hooks that targets can override to implement inline asm 399736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner // support. These should probably be moved out of AsmPrinter someday. 400dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 401736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// PrintSpecial - Print information related to the specified machine instr 402736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// that is independent of the operand, and may be independent of the instr 403736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// itself. This can be useful for portably encoding the comment character 404736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// or other bits of target-specific knowledge into the asmstrings. The 405736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// syntax used is ${:comment}. Targets can override this to add support 406736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// for their own strange codes. 407736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS, 408736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner const char *Code) const; 409dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 410736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM 411736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// instruction, using the specified assembler variant. Targets should 412736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// override this to format as appropriate. This method can return true if 413736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// the operand is erroneous. 414736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, 415736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner unsigned AsmVariant, const char *ExtraCode, 416736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner raw_ostream &OS); 417dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 418736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM 419736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// instruction, using the specified assembler variant as an address. 420736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// Targets should override this to format as appropriate. This method can 421736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// return true if the operand is erroneous. 422736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, 423dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov unsigned AsmVariant, 424736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner const char *ExtraCode, 425736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner raw_ostream &OS); 426dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 427736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner private: 428736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// Private state for PrintSpecial() 429736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner // Assign a unique ID to this machine instruction. 430736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner mutable const MachineInstr *LastMI; 431736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner mutable unsigned LastFn; 432736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner mutable unsigned Counter; 433736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner mutable unsigned SetCounter; 434736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner 435736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// EmitInlineAsm - Emit a blob of inline asm to the output streamer. 436a38941d458273946594d3592ed5debdc9730db08Chris Lattner void EmitInlineAsm(StringRef Str, const MDNode *LocMDNode = 0) const; 437dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 438736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// EmitInlineAsm - This method formats and emits the specified machine 439736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner /// instruction that is an inline asm. 440736e31d0cfd8a28c31741f39be606a11e7fc0036Chris Lattner void EmitInlineAsm(const MachineInstr *MI) const; 44117fedf216bc10c66e02694854f522cb602097005Chris Lattner 44217fedf216bc10c66e02694854f522cb602097005Chris Lattner //===------------------------------------------------------------------===// 44317fedf216bc10c66e02694854f522cb602097005Chris Lattner // Internal Implementation Details 44417fedf216bc10c66e02694854f522cb602097005Chris Lattner //===------------------------------------------------------------------===// 445dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 44617fedf216bc10c66e02694854f522cb602097005Chris Lattner /// EmitVisibility - This emits visibility information about symbol, if 44717fedf216bc10c66e02694854f522cb602097005Chris Lattner /// this is suported by the target. 4485129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings void EmitVisibility(MCSymbol *Sym, unsigned Visibility, 4495129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings bool IsDefinition = true) const; 450dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 45117fedf216bc10c66e02694854f522cb602097005Chris Lattner void EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const; 452dd2ad8432f104282ff43c94457f474ea0a264175Mikhail Glushenkov 45317fedf216bc10c66e02694854f522cb602097005Chris Lattner void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI, 45417fedf216bc10c66e02694854f522cb602097005Chris Lattner const MachineBasicBlock *MBB, 45517fedf216bc10c66e02694854f522cb602097005Chris Lattner unsigned uid) const; 45617fedf216bc10c66e02694854f522cb602097005Chris Lattner void EmitLLVMUsedList(Constant *List); 45717fedf216bc10c66e02694854f522cb602097005Chris Lattner void EmitXXStructorList(Constant *List); 45817fedf216bc10c66e02694854f522cb602097005Chris Lattner GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C); 459a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner }; 460a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner} 461a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner 462a80ba71efe5be5012128e2db0dd29b024e00105aChris Lattner#endif 463