rename printVisibility to EmitVisibility and make it private,
[oota-llvm.git] / include / llvm / CodeGen / AsmPrinter.h
index 07f2ae5c96e8c7db87c0a581fd94a9fc6c686fdc..589788a7cc4dca4f3edfed1d1ce65e8300e3a747 100644 (file)
@@ -19,7 +19,6 @@
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/Support/DebugLoc.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/ADT/DenseMap.h"
 
 namespace llvm {
   class BlockAddress;
@@ -62,13 +61,6 @@ namespace llvm {
   class AsmPrinter : public MachineFunctionPass {
     static char ID;
 
-    /// FunctionNumber - This provides a unique ID for each function emitted in
-    /// this translation unit.  It is autoincremented by SetupMachineFunction,
-    /// and can be accessed with getFunctionNumber() and 
-    /// IncrementFunctionNumber().
-    ///
-    unsigned FunctionNumber;
-
     // GCMetadataPrinters - The garbage collection metadata printer table.
     typedef DenseMap<GCStrategy*,GCMetadataPrinter*> gcp_map_type;
     typedef gcp_map_type::iterator gcp_iterator;
@@ -168,7 +160,7 @@ namespace llvm {
 
     /// getFunctionNumber - Return a unique ID for the current function.
     ///
-    unsigned getFunctionNumber() const { return FunctionNumber; }
+    unsigned getFunctionNumber() const;
     
   protected:
     /// getAnalysisUsage - Record analysis usage.
@@ -219,22 +211,21 @@ namespace llvm {
     /// is being processed from runOnMachineFunction.
     void SetupMachineFunction(MachineFunction &MF);
     
-    /// IncrementFunctionNumber - Increase Function Number.  AsmPrinters should
-    /// not normally call this, as the counter is automatically bumped by
-    /// SetupMachineFunction.
-    void IncrementFunctionNumber() { FunctionNumber++; }
-    
+    /// EmitFunctionHeader - This method emits the header for the current
+    /// function.
+    void EmitFunctionHeader();
+
     /// EmitConstantPool - Print to the current output stream assembly
     /// representations of the constants in the constant pool MCP. This is
     /// used to print out constants which have been "spilled to memory" by
     /// the code generator.
     ///
-    void EmitConstantPool(MachineConstantPool *MCP);
+    void EmitConstantPool(const MachineConstantPool *MCP);
 
     /// EmitJumpTableInfo - Print assembly representations of the jump tables 
     /// used by the current function to the current output stream.  
     ///
-    void EmitJumpTableInfo(MachineJumpTableInfo *MJTI, MachineFunction &MF);
+    void EmitJumpTableInfo(MachineFunction &MF);
     
     /// EmitGlobalVariable - Emit the specified global variable to the .s file.
     virtual void EmitGlobalVariable(const GlobalVariable *GV);
@@ -245,39 +236,10 @@ namespace llvm {
     bool EmitSpecialLLVMGlobal(const GlobalVariable *GV);
 
   public:
-    //===------------------------------------------------------------------===//
-    /// LEB 128 number encoding.
-
-    /// PrintULEB128 - Print a series of hexidecimal values(separated by commas)
-    /// representing an unsigned leb128 value.
-    void PrintULEB128(unsigned Value) const;
-
-    /// PrintSLEB128 - Print a series of hexidecimal values(separated by commas)
-    /// representing a signed leb128 value.
-    void PrintSLEB128(int Value) const;
-
     //===------------------------------------------------------------------===//
     // Emission and print routines
     //
 
-    /// PrintHex - Print a value as a hexidecimal value.
-    ///
-    void PrintHex(uint64_t Value) const;
-
-    /// EOL - Print a newline character to asm stream.  If a comment is present
-    /// then it will be printed first.  Comments should not contain '\n'.
-    void EOL() const;
-    void EOL(const Twine &Comment) const;
-    void EOL(const Twine &Comment, unsigned Encoding) const;
-
-    /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
-    /// unsigned leb128 value.
-    void EmitULEB128Bytes(unsigned Value) const;
-    
-    /// EmitSLEB128Bytes - print an assembler byte data directive to compose a
-    /// signed leb128 value.
-    void EmitSLEB128Bytes(int Value) const;
-    
     /// EmitInt8 - Emit a byte directive and value.
     ///
     void EmitInt8(int Value) const;
@@ -294,15 +256,6 @@ namespace llvm {
     ///
     void EmitInt64(uint64_t Value) const;
 
-    /// EmitString - Emit a string with quotes and a null terminator.
-    /// Special characters are emitted properly.
-    /// @verbatim (Eg. '\t') @endverbatim
-    void EmitString(const StringRef String) const;
-    void EmitString(const char *String, unsigned Size) const;
-
-    /// EmitFile - Emit a .file directive.
-    void EmitFile(unsigned Number, StringRef Name) const;
-
     //===------------------------------------------------------------------===//
 
     /// EmitAlignment - Emit an alignment directive to the specified power of
@@ -336,8 +289,6 @@ namespace llvm {
 
     /// EmitComments - Pretty-print comments for instructions
     void EmitComments(const MachineInstr &MI) const;
-    /// EmitComments - Pretty-print comments for basic blocks
-    void EmitComments(const MachineBasicBlock &MBB) const;
 
     /// GetGlobalValueSymbol - Return the MCSymbol for the specified global
     /// value.
@@ -354,10 +305,16 @@ namespace llvm {
     /// ExternalSymbol.
     MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const;
     
-    /// GetMBBSymbol - Return the MCSymbol corresponding to the specified basic
-    /// block label.
-    MCSymbol *GetMBBSymbol(unsigned MBBID) const;
-    
+    /// GetCPISymbol - Return the symbol for the specified constant pool entry.
+    MCSymbol *GetCPISymbol(unsigned CPID) const;
+
+    /// GetJTISymbol - Return the symbol for the specified jump table entry.
+    MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
+
+    /// GetJTSetSymbol - Return the symbol for the specified jump table .set
+    /// FIXME: privatize to AsmPrinter.
+    MCSymbol *GetJTSetSymbol(unsigned UID, unsigned MBBID) const;
+
     /// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress
     /// uses of the specified basic block.
     MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA,
@@ -377,15 +334,9 @@ namespace llvm {
     /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
     void EmitGlobalConstant(const Constant* CV, unsigned AddrSpace = 0);
     
-    /// EmitString - Emit a zero-byte-terminated string constant.
-    ///
-    virtual void EmitString(const ConstantArray *CVA) const;
-
   protected:
-    /// EmitConstantValueOnly - Print out the specified constant, without a
-    /// storage class.  Only constants of first-class type are allowed here.
-    void EmitConstantValueOnly(const Constant *CV);
-
+    virtual void EmitFunctionEntryLabel();
+    
     virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
 
     /// processDebugLoc - Processes the debug information of each machine
@@ -403,32 +354,21 @@ namespace llvm {
     /// printKill - This method prints the specified kill machine instruction.
     void printKill(const MachineInstr *MI) const;
 
-    /// printPICJumpTableSetLabel - This method prints a set label for the
-    /// specified MachineBasicBlock for a jumptable entry.
-    virtual void printPICJumpTableSetLabel(unsigned uid,
-                                           const MachineBasicBlock *MBB) const;
-    virtual void printPICJumpTableSetLabel(unsigned uid, unsigned uid2,
-                                           const MachineBasicBlock *MBB) const;
-    virtual void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
-                                        const MachineBasicBlock *MBB,
-                                        unsigned uid) const;
-    
-    /// printDataDirective - This method prints the asm directive for the
-    /// specified type.
-    void printDataDirective(const Type *type, unsigned AddrSpace = 0);
-
-    /// printVisibility - This prints visibility information about symbol, if
-    /// this is suported by the target.
-    void printVisibility(const MCSymbol *Sym, unsigned Visibility) const;
-    
     /// printOffset - This is just convenient handler for printing offsets.
     void printOffset(int64_t Offset) const;
  
   private:
+    /// EmitVisibility - This emits visibility information about symbol, if
+    /// this is suported by the target.
+    void EmitVisibility(MCSymbol *Sym, unsigned Visibility) const;
+    
+    void EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const;
+    
+    void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
+                            const MachineBasicBlock *MBB,
+                            unsigned uid) const;
     void EmitLLVMUsedList(Constant *List);
     void EmitXXStructorList(Constant *List);
-    void EmitGlobalConstantLargeInt(const ConstantInt* CI, unsigned AddrSpace);
-    void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace);
     GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
   };
 }