#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/ADT/DenseMap.h"
namespace llvm {
class BlockAddress;
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;
/// getFunctionNumber - Return a unique ID for the current function.
///
- unsigned getFunctionNumber() const { return FunctionNumber; }
+ unsigned getFunctionNumber() const;
protected:
/// getAnalysisUsage - Record analysis usage.
/// 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++; }
-
/// 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
/// 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);
///
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
/// 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,
/// 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 EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
/// processDebugLoc - Processes the debug information of each machine
/// 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;
-
/// printVisibility - This prints visibility information about symbol, if
/// this is suported by the target.
- void printVisibility(const MCSymbol *Sym, unsigned Visibility) const;
+ void printVisibility(MCSymbol *Sym, unsigned Visibility) const;
/// printOffset - This is just convenient handler for printing offsets.
void printOffset(int64_t Offset) const;
private:
+ void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
+ const MachineBasicBlock *MBB,
+ unsigned uid) const;
void EmitLLVMUsedList(Constant *List);
void EmitXXStructorList(Constant *List);
GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);