2004-08-16 23:15:22 +00:00
|
|
|
//===-- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework --------*- C++ -*-===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2004-08-16 23:15:22 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2004-08-16 23:15:22 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2006-09-06 18:34:40 +00:00
|
|
|
// This file contains a class to be used as the base class for target specific
|
|
|
|
// asm writers. This class primarily handles common functionality used by
|
|
|
|
// all asm writers.
|
2004-08-16 23:15:22 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_ASMPRINTER_H
|
|
|
|
#define LLVM_CODEGEN_ASMPRINTER_H
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
2009-08-18 19:22:55 +00:00
|
|
|
#include "llvm/Support/DebugLoc.h"
|
2009-04-29 23:29:43 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2009-07-27 21:13:35 +00:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2004-08-16 23:15:22 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2008-08-17 18:44:35 +00:00
|
|
|
class GCStrategy;
|
2004-08-16 23:15:22 +00:00
|
|
|
class Constant;
|
2006-05-02 01:16:28 +00:00
|
|
|
class ConstantArray;
|
2009-08-18 19:22:55 +00:00
|
|
|
class ConstantFP;
|
2008-12-22 21:14:27 +00:00
|
|
|
class ConstantInt;
|
|
|
|
class ConstantStruct;
|
|
|
|
class ConstantVector;
|
2008-08-17 12:08:44 +00:00
|
|
|
class GCMetadataPrinter;
|
2009-08-18 19:22:55 +00:00
|
|
|
class GlobalValue;
|
2005-12-13 06:32:10 +00:00
|
|
|
class GlobalVariable;
|
2009-08-18 19:22:55 +00:00
|
|
|
class MachineBasicBlock;
|
|
|
|
class MachineFunction;
|
|
|
|
class MachineInstr;
|
2009-08-10 16:38:07 +00:00
|
|
|
class MachineLoopInfo;
|
|
|
|
class MachineLoop;
|
2009-08-18 19:22:55 +00:00
|
|
|
class MachineConstantPool;
|
2006-06-29 00:26:09 +00:00
|
|
|
class MachineConstantPoolEntry;
|
2006-09-12 21:00:35 +00:00
|
|
|
class MachineConstantPoolValue;
|
2009-08-18 19:22:55 +00:00
|
|
|
class MachineJumpTableInfo;
|
2009-06-24 19:09:55 +00:00
|
|
|
class MachineModuleInfo;
|
2009-07-13 20:25:48 +00:00
|
|
|
class MCInst;
|
2009-07-27 21:28:04 +00:00
|
|
|
class MCContext;
|
2009-07-31 18:48:30 +00:00
|
|
|
class MCSection;
|
2009-07-27 21:28:04 +00:00
|
|
|
class MCStreamer;
|
2009-09-12 23:02:08 +00:00
|
|
|
class MCSymbol;
|
2009-01-13 21:44:10 +00:00
|
|
|
class DwarfWriter;
|
2006-09-06 18:34:40 +00:00
|
|
|
class Mangler;
|
2009-08-22 20:48:53 +00:00
|
|
|
class MCAsmInfo;
|
2009-07-28 03:13:23 +00:00
|
|
|
class TargetLoweringObjectFile;
|
2007-12-31 04:13:23 +00:00
|
|
|
class Type;
|
2009-07-14 20:18:05 +00:00
|
|
|
class formatted_raw_ostream;
|
2004-08-16 23:15:22 +00:00
|
|
|
|
2006-09-06 18:34:40 +00:00
|
|
|
/// AsmPrinter - This class is intended to be used as a driving class for all
|
|
|
|
/// asm writers.
|
2004-08-16 23:15:22 +00:00
|
|
|
class AsmPrinter : public MachineFunctionPass {
|
2007-05-03 01:11:54 +00:00
|
|
|
static char ID;
|
2007-05-01 21:15:47 +00:00
|
|
|
|
2007-10-14 05:57:21 +00:00
|
|
|
/// 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;
|
|
|
|
|
2008-08-17 12:08:44 +00:00
|
|
|
// GCMetadataPrinters - The garbage collection metadata printer table.
|
2008-08-17 18:44:35 +00:00
|
|
|
typedef DenseMap<GCStrategy*,GCMetadataPrinter*> gcp_map_type;
|
2008-08-17 12:08:44 +00:00
|
|
|
typedef gcp_map_type::iterator gcp_iterator;
|
|
|
|
gcp_map_type GCMetadataPrinters;
|
2009-07-22 20:33:26 +00:00
|
|
|
|
2009-08-19 06:36:30 +00:00
|
|
|
/// If VerboseAsm is set, a pointer to the loop info for this
|
2009-08-10 16:38:07 +00:00
|
|
|
/// function.
|
|
|
|
///
|
|
|
|
MachineLoopInfo *LI;
|
|
|
|
|
2006-12-18 03:37:18 +00:00
|
|
|
protected:
|
2009-06-24 19:09:55 +00:00
|
|
|
/// MMI - If available, this is a pointer to the current MachineModuleInfo.
|
|
|
|
MachineModuleInfo *MMI;
|
|
|
|
|
|
|
|
/// DW - If available, this is a pointer to the current dwarf writer.
|
2009-02-18 23:12:06 +00:00
|
|
|
DwarfWriter *DW;
|
2009-07-13 20:25:48 +00:00
|
|
|
|
2006-01-04 22:28:25 +00:00
|
|
|
public:
|
2004-08-16 23:15:22 +00:00
|
|
|
/// Output stream on which we're printing assembly code.
|
|
|
|
///
|
2009-07-14 20:18:05 +00:00
|
|
|
formatted_raw_ostream &O;
|
2004-08-16 23:15:22 +00:00
|
|
|
|
|
|
|
/// Target machine description.
|
|
|
|
///
|
|
|
|
TargetMachine &TM;
|
2006-09-06 18:34:40 +00:00
|
|
|
|
2009-07-28 03:13:23 +00:00
|
|
|
/// getObjFileLowering - Return information about object file lowering.
|
2009-08-03 19:12:26 +00:00
|
|
|
TargetLoweringObjectFile &getObjFileLowering() const;
|
2009-07-28 03:13:23 +00:00
|
|
|
|
2006-09-06 18:34:40 +00:00
|
|
|
/// Target Asm Printer information.
|
|
|
|
///
|
2009-08-22 21:43:10 +00:00
|
|
|
const MCAsmInfo *MAI;
|
2004-08-16 23:15:22 +00:00
|
|
|
|
2008-03-15 00:03:38 +00:00
|
|
|
/// Target Register Information.
|
|
|
|
///
|
|
|
|
const TargetRegisterInfo *TRI;
|
|
|
|
|
2009-07-27 21:28:04 +00:00
|
|
|
/// OutContext - This is the context for the output file that we are
|
|
|
|
/// streaming. This owns all of the global MC-related objects for the
|
|
|
|
/// generated translation unit.
|
|
|
|
MCContext &OutContext;
|
|
|
|
|
|
|
|
/// OutStreamer - This is the MCStreamer object for the file we are
|
|
|
|
/// generating. This contains the transient state for the current
|
|
|
|
/// translation unit that we are generating (such as the current section
|
|
|
|
/// etc).
|
|
|
|
MCStreamer &OutStreamer;
|
|
|
|
|
2009-02-24 08:30:20 +00:00
|
|
|
/// The current machine function.
|
|
|
|
const MachineFunction *MF;
|
|
|
|
|
2004-08-16 23:15:22 +00:00
|
|
|
/// Name-mangler for global names.
|
|
|
|
///
|
|
|
|
Mangler *Mang;
|
|
|
|
|
|
|
|
/// Cache of mangled name for current function. This is recalculated at the
|
|
|
|
/// beginning of each call to runOnMachineFunction().
|
|
|
|
///
|
|
|
|
std::string CurrentFnName;
|
2005-11-21 08:24:11 +00:00
|
|
|
|
2009-08-03 23:20:21 +00:00
|
|
|
/// getCurrentSection() - Return the current section we are emitting to.
|
2009-08-18 06:15:16 +00:00
|
|
|
const MCSection *getCurrentSection() const;
|
2009-08-03 23:20:21 +00:00
|
|
|
|
2009-03-25 01:47:28 +00:00
|
|
|
|
|
|
|
/// VerboseAsm - Emit comments in assembly output if this is true.
|
|
|
|
///
|
|
|
|
bool VerboseAsm;
|
|
|
|
|
2009-08-10 16:38:07 +00:00
|
|
|
/// ExuberantAsm - Emit many more comments in assembly output if
|
|
|
|
/// this is true.
|
|
|
|
///
|
|
|
|
bool ExuberantAsm;
|
|
|
|
|
2009-06-24 22:28:12 +00:00
|
|
|
/// Private state for PrintSpecial()
|
|
|
|
// Assign a unique ID to this machine instruction.
|
|
|
|
mutable const MachineInstr *LastMI;
|
|
|
|
mutable const Function *LastFn;
|
|
|
|
mutable unsigned Counter;
|
2009-06-25 16:55:32 +00:00
|
|
|
|
|
|
|
// Private state for processDebugLock()
|
|
|
|
mutable DebugLocTuple PrevDLT;
|
2009-06-24 22:28:12 +00:00
|
|
|
|
2006-01-04 22:28:25 +00:00
|
|
|
protected:
|
2009-07-14 20:18:05 +00:00
|
|
|
explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
|
2009-08-22 20:48:53 +00:00
|
|
|
const MCAsmInfo *T, bool V);
|
2005-12-13 06:32:10 +00:00
|
|
|
|
2006-01-04 13:52:30 +00:00
|
|
|
public:
|
2008-08-17 12:08:44 +00:00
|
|
|
virtual ~AsmPrinter();
|
2009-03-25 01:47:28 +00:00
|
|
|
|
|
|
|
/// isVerbose - Return true if assembly output should contain comments.
|
|
|
|
///
|
|
|
|
bool isVerbose() const { return VerboseAsm; }
|
|
|
|
|
2006-10-17 13:41:07 +00:00
|
|
|
/// getGlobalLinkName - Returns the asm/link name of of the specified
|
|
|
|
/// global variable. Should be overridden by each target asm printer to
|
|
|
|
/// generate the appropriate value.
|
2009-04-10 00:12:49 +00:00
|
|
|
virtual const std::string &getGlobalLinkName(const GlobalVariable *GV,
|
|
|
|
std::string &LinkName) const;
|
2006-10-17 13:41:07 +00:00
|
|
|
|
2007-02-21 22:47:38 +00:00
|
|
|
/// EmitExternalGlobal - Emit the external reference to a global variable.
|
|
|
|
/// Should be overridden if an indirect reference should be used.
|
|
|
|
virtual void EmitExternalGlobal(const GlobalVariable *GV);
|
|
|
|
|
2009-07-17 20:46:40 +00:00
|
|
|
/// getCurrentFunctionEHName - Called to return the CurrentFnEHName.
|
2007-09-18 01:47:22 +00:00
|
|
|
///
|
2009-07-17 20:46:40 +00:00
|
|
|
std::string getCurrentFunctionEHName(const MachineFunction *MF) const;
|
2007-09-18 01:47:22 +00:00
|
|
|
|
2009-09-01 01:57:56 +00:00
|
|
|
/// getFunctionNumber - Return a unique ID for the current function.
|
|
|
|
///
|
|
|
|
unsigned getFunctionNumber() const { return FunctionNumber; }
|
|
|
|
|
2006-01-04 13:52:30 +00:00
|
|
|
protected:
|
2008-01-07 01:30:38 +00:00
|
|
|
/// getAnalysisUsage - Record analysis usage.
|
|
|
|
///
|
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const;
|
|
|
|
|
2004-08-16 23:15:22 +00:00
|
|
|
/// doInitialization - Set up the AsmPrinter when we are working on a new
|
|
|
|
/// module. If your pass overrides this, it must make sure to explicitly
|
|
|
|
/// call this implementation.
|
|
|
|
bool doInitialization(Module &M);
|
|
|
|
|
|
|
|
/// doFinalization - Shut down the asmprinter. If you override this in your
|
|
|
|
/// pass, you must make sure to call it explicitly.
|
|
|
|
bool doFinalization(Module &M);
|
2006-09-26 23:59:50 +00:00
|
|
|
|
|
|
|
/// PrintSpecial - Print information related to the specified machine instr
|
|
|
|
/// that is independent of the operand, and may be independent of the instr
|
|
|
|
/// itself. This can be useful for portably encoding the comment character
|
|
|
|
/// or other bits of target-specific knowledge into the asmstrings. The
|
|
|
|
/// syntax used is ${:comment}. Targets can override this to add support
|
|
|
|
/// for their own strange codes.
|
2009-03-10 05:37:13 +00:00
|
|
|
virtual void PrintSpecial(const MachineInstr *MI, const char *Code) const;
|
2006-02-01 22:39:30 +00:00
|
|
|
|
|
|
|
/// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
|
|
|
|
/// instruction, using the specified assembler variant. Targets should
|
2006-02-24 20:21:12 +00:00
|
|
|
/// override this to format as appropriate. This method can return true if
|
2006-02-01 22:39:30 +00:00
|
|
|
/// the operand is erroneous.
|
|
|
|
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
2006-02-06 22:16:41 +00:00
|
|
|
unsigned AsmVariant, const char *ExtraCode);
|
2006-01-04 22:28:25 +00:00
|
|
|
|
2006-02-24 20:21:12 +00:00
|
|
|
/// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM
|
|
|
|
/// instruction, using the specified assembler variant as an address.
|
|
|
|
/// Targets should override this to format as appropriate. This method can
|
|
|
|
/// return true if the operand is erroneous.
|
|
|
|
virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
|
|
|
unsigned AsmVariant,
|
|
|
|
const char *ExtraCode);
|
|
|
|
|
2009-07-21 18:38:57 +00:00
|
|
|
/// PrintGlobalVariable - Emit the specified global variable and its
|
|
|
|
/// initializer to the output stream.
|
|
|
|
virtual void PrintGlobalVariable(const GlobalVariable *GV) = 0;
|
2009-07-31 21:57:10 +00:00
|
|
|
|
2005-11-21 07:51:06 +00:00
|
|
|
/// SetupMachineFunction - This should be called when a new MachineFunction
|
2004-08-16 23:15:22 +00:00
|
|
|
/// is being processed from runOnMachineFunction.
|
2005-11-21 07:51:06 +00:00
|
|
|
void SetupMachineFunction(MachineFunction &MF);
|
2005-11-21 08:24:11 +00:00
|
|
|
|
2007-10-14 05:57:21 +00:00
|
|
|
/// IncrementFunctionNumber - Increase Function Number. AsmPrinters should
|
|
|
|
/// not normally call this, as the counter is automatically bumped by
|
|
|
|
/// SetupMachineFunction.
|
|
|
|
void IncrementFunctionNumber() { FunctionNumber++; }
|
|
|
|
|
2005-12-13 06:32:10 +00:00
|
|
|
/// 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.
|
|
|
|
///
|
2006-06-29 00:26:09 +00:00
|
|
|
void EmitConstantPool(MachineConstantPool *MCP);
|
2004-08-16 23:15:22 +00:00
|
|
|
|
2006-04-22 18:53:45 +00:00
|
|
|
/// EmitJumpTableInfo - Print assembly representations of the jump tables
|
|
|
|
/// used by the current function to the current output stream.
|
|
|
|
///
|
2006-10-05 03:01:21 +00:00
|
|
|
void EmitJumpTableInfo(MachineJumpTableInfo *MJTI, MachineFunction &MF);
|
2006-04-22 18:53:45 +00:00
|
|
|
|
2005-12-13 06:32:10 +00:00
|
|
|
/// EmitSpecialLLVMGlobal - Check to see if the specified global is a
|
|
|
|
/// special global used by LLVM. If so, emit it and return true, otherwise
|
|
|
|
/// do nothing and return false.
|
|
|
|
bool EmitSpecialLLVMGlobal(const GlobalVariable *GV);
|
2009-07-13 21:48:26 +00:00
|
|
|
|
2007-01-24 13:12:32 +00:00
|
|
|
public:
|
2007-01-25 15:12:02 +00:00
|
|
|
//===------------------------------------------------------------------===//
|
|
|
|
/// 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(int 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'.
|
2007-02-21 22:47:38 +00:00
|
|
|
void EOL() const;
|
2007-01-25 15:12:02 +00:00
|
|
|
void EOL(const std::string &Comment) const;
|
2008-07-01 21:16:27 +00:00
|
|
|
void EOL(const char* Comment) const;
|
2009-08-29 12:17:53 +00:00
|
|
|
void EOL(const char *Comment, unsigned Encoding) const;
|
|
|
|
|
2007-01-25 15:12:02 +00:00
|
|
|
/// 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;
|
|
|
|
|
|
|
|
/// EmitInt16 - Emit a short directive and value.
|
|
|
|
///
|
|
|
|
void EmitInt16(int Value) const;
|
|
|
|
|
|
|
|
/// EmitInt32 - Emit a long directive and value.
|
|
|
|
///
|
|
|
|
void EmitInt32(int Value) const;
|
|
|
|
|
|
|
|
/// EmitInt64 - Emit a long long directive and value.
|
|
|
|
///
|
|
|
|
void EmitInt64(uint64_t Value) const;
|
|
|
|
|
|
|
|
/// EmitString - Emit a string with quotes and a null terminator.
|
|
|
|
/// Special characters are emitted properly.
|
2007-08-05 20:06:04 +00:00
|
|
|
/// @verbatim (Eg. '\t') @endverbatim
|
2007-01-25 15:12:02 +00:00
|
|
|
void EmitString(const std::string &String) const;
|
2009-04-09 23:51:31 +00:00
|
|
|
void EmitString(const char *String, unsigned Size) const;
|
|
|
|
|
2007-09-24 20:58:13 +00:00
|
|
|
/// EmitFile - Emit a .file directive.
|
|
|
|
void EmitFile(unsigned Number, const std::string &Name) const;
|
|
|
|
|
2007-01-25 15:12:02 +00:00
|
|
|
//===------------------------------------------------------------------===//
|
|
|
|
|
2005-11-21 07:51:06 +00:00
|
|
|
/// EmitAlignment - Emit an alignment directive to the specified power of
|
2004-08-17 19:14:29 +00:00
|
|
|
/// two boundary. For example, if you pass in 3 here, you will get an 8
|
2005-11-14 19:00:06 +00:00
|
|
|
/// byte alignment. If a global value is specified, and if that global has
|
2007-05-31 18:57:45 +00:00
|
|
|
/// an explicit alignment requested, it will unconditionally override the
|
|
|
|
/// alignment request. However, if ForcedAlignBits is specified, this value
|
|
|
|
/// has final say: the ultimate alignment will be the max of ForcedAlignBits
|
2008-02-29 19:36:59 +00:00
|
|
|
/// and the alignment computed with NumBits and the global. If UseFillExpr
|
|
|
|
/// is true, it also emits an optional second value FillValue which the
|
|
|
|
/// assembler uses to fill gaps to match alignment for text sections if the
|
|
|
|
/// has specified a non-zero fill value.
|
2007-05-31 18:57:45 +00:00
|
|
|
///
|
|
|
|
/// The algorithm is:
|
|
|
|
/// Align = NumBits;
|
|
|
|
/// if (GV && GV->hasalignment) Align = GV->getalignment();
|
|
|
|
/// Align = std::max(Align, ForcedAlignBits);
|
|
|
|
///
|
|
|
|
void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0,
|
2008-02-29 19:36:59 +00:00
|
|
|
unsigned ForcedAlignBits = 0,
|
|
|
|
bool UseFillExpr = true) const;
|
2004-08-17 19:14:29 +00:00
|
|
|
|
2008-02-01 09:10:45 +00:00
|
|
|
/// printLabel - This method prints a local label used by debug and
|
|
|
|
/// exception handling tables.
|
|
|
|
void printLabel(const MachineInstr *MI) const;
|
|
|
|
void printLabel(unsigned Id) const;
|
|
|
|
|
2008-02-02 04:07:54 +00:00
|
|
|
/// printDeclare - This method prints a local variable declaration used by
|
|
|
|
/// debug tables.
|
|
|
|
void printDeclare(const MachineInstr *MI) const;
|
|
|
|
|
2009-07-15 18:24:03 +00:00
|
|
|
/// EmitComments - Pretty-print comments for instructions
|
|
|
|
void EmitComments(const MachineInstr &MI) const;
|
2009-08-10 16:38:07 +00:00
|
|
|
/// EmitComments - Pretty-print comments for basic blocks
|
|
|
|
void EmitComments(const MachineBasicBlock &MBB) const;
|
2009-07-15 18:24:03 +00:00
|
|
|
|
2009-08-14 03:43:57 +00:00
|
|
|
/// printMCInst - Print an MCInst for this target.
|
|
|
|
///
|
|
|
|
/// Note, this is only a temporary hack to allow the MCStreamer to print
|
|
|
|
/// instructions, do not use this function outside of llvm-mc.
|
|
|
|
virtual void printMCInst(const MCInst *MI);
|
|
|
|
|
2009-09-12 23:02:08 +00:00
|
|
|
/// GetMBBSymbol - Return the MCSymbol corresponding to the specified basic
|
|
|
|
/// block label.
|
|
|
|
MCSymbol *GetMBBSymbol(unsigned MBBID) const;
|
|
|
|
|
2009-09-13 18:25:37 +00:00
|
|
|
/// EmitBasicBlockStart - This method prints the label for the specified
|
|
|
|
/// MachineBasicBlock, an alignment (if present) and a comment describing
|
|
|
|
/// it if appropriate.
|
|
|
|
void EmitBasicBlockStart(const MachineBasicBlock *MBB,
|
|
|
|
bool printColon = true) const;
|
2007-01-24 13:12:32 +00:00
|
|
|
protected:
|
2005-11-21 07:51:06 +00:00
|
|
|
/// EmitZeros - Emit a block of zeros.
|
2004-08-17 21:38:51 +00:00
|
|
|
///
|
2009-01-30 04:25:10 +00:00
|
|
|
void EmitZeros(uint64_t NumZeros, unsigned AddrSpace = 0) const;
|
2006-05-02 01:16:28 +00:00
|
|
|
|
|
|
|
/// EmitString - Emit a zero-byte-terminated string constant.
|
|
|
|
///
|
|
|
|
virtual void EmitString(const ConstantArray *CVA) const;
|
2004-08-17 21:38:51 +00:00
|
|
|
|
2005-11-21 07:51:06 +00:00
|
|
|
/// EmitConstantValueOnly - Print out the specified constant, without a
|
2004-08-16 23:15:22 +00:00
|
|
|
/// storage class. Only constants of first-class type are allowed here.
|
2009-01-16 05:06:35 +00:00
|
|
|
void EmitConstantValueOnly(const Constant *CV);
|
2004-08-17 06:36:27 +00:00
|
|
|
|
2005-11-21 07:51:06 +00:00
|
|
|
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
|
2009-01-30 04:25:10 +00:00
|
|
|
void EmitGlobalConstant(const Constant* CV, unsigned AddrSpace = 0);
|
2006-09-12 21:00:35 +00:00
|
|
|
|
|
|
|
virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
|
2009-05-07 13:55:51 +00:00
|
|
|
|
|
|
|
/// processDebugLoc - Processes the debug information of each machine
|
|
|
|
/// instruction's DebugLoc.
|
|
|
|
void processDebugLoc(DebugLoc DL);
|
2005-12-13 06:32:10 +00:00
|
|
|
|
2006-01-27 02:09:16 +00:00
|
|
|
/// printInlineAsm - This method formats and prints the specified machine
|
|
|
|
/// instruction that is an inline asm.
|
|
|
|
void printInlineAsm(const MachineInstr *MI) const;
|
2008-03-15 00:03:38 +00:00
|
|
|
|
|
|
|
/// printImplicitDef - This method prints the specified machine instruction
|
|
|
|
/// that is an implicit def.
|
|
|
|
virtual void printImplicitDef(const MachineInstr *MI) const;
|
2006-04-22 18:53:45 +00:00
|
|
|
|
2009-09-12 23:02:08 +00:00
|
|
|
|
Much improved pic jumptable codegen:
Then:
call "L1$pb"
"L1$pb":
popl %eax
...
LBB1_1: # entry
imull $4, %ecx, %ecx
leal LJTI1_0-"L1$pb"(%eax), %edx
addl LJTI1_0-"L1$pb"(%ecx,%eax), %edx
jmpl *%edx
.align 2
.set L1_0_set_3,LBB1_3-LJTI1_0
.set L1_0_set_2,LBB1_2-LJTI1_0
.set L1_0_set_5,LBB1_5-LJTI1_0
.set L1_0_set_4,LBB1_4-LJTI1_0
LJTI1_0:
.long L1_0_set_3
.long L1_0_set_2
Now:
call "L1$pb"
"L1$pb":
popl %eax
...
LBB1_1: # entry
addl LJTI1_0-"L1$pb"(%eax,%ecx,4), %eax
jmpl *%eax
.align 2
.set L1_0_set_3,LBB1_3-"L1$pb"
.set L1_0_set_2,LBB1_2-"L1$pb"
.set L1_0_set_5,LBB1_5-"L1$pb"
.set L1_0_set_4,LBB1_4-"L1$pb"
LJTI1_0:
.long L1_0_set_3
.long L1_0_set_2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43924 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 01:32:10 +00:00
|
|
|
/// 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;
|
2007-11-14 09:18:41 +00:00
|
|
|
virtual void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
|
|
|
const MachineBasicBlock *MBB,
|
|
|
|
unsigned uid) const;
|
|
|
|
|
2006-09-12 21:00:35 +00:00
|
|
|
/// printDataDirective - This method prints the asm directive for the
|
|
|
|
/// specified type.
|
2009-01-30 04:25:10 +00:00
|
|
|
void printDataDirective(const Type *type, unsigned AddrSpace = 0);
|
2006-09-12 21:00:35 +00:00
|
|
|
|
2008-08-08 18:25:07 +00:00
|
|
|
/// printVisibility - This prints visibility information about symbol, if
|
|
|
|
/// this is suported by the target.
|
|
|
|
void printVisibility(const std::string& Name, unsigned Visibility) const;
|
|
|
|
|
2008-11-22 16:15:34 +00:00
|
|
|
/// printOffset - This is just convenient handler for printing offsets.
|
|
|
|
void printOffset(int64_t Offset) const;
|
2009-07-13 20:25:48 +00:00
|
|
|
|
2005-12-13 06:32:10 +00:00
|
|
|
private:
|
2006-09-26 03:38:18 +00:00
|
|
|
void EmitLLVMUsedList(Constant *List);
|
2005-12-13 06:32:10 +00:00
|
|
|
void EmitXXStructorList(Constant *List);
|
2009-01-30 04:25:10 +00:00
|
|
|
void EmitGlobalConstantStruct(const ConstantStruct* CVS,
|
|
|
|
unsigned AddrSpace);
|
2009-04-28 16:34:20 +00:00
|
|
|
void EmitGlobalConstantArray(const ConstantArray* CVA, unsigned AddrSpace);
|
2008-12-22 21:14:27 +00:00
|
|
|
void EmitGlobalConstantVector(const ConstantVector* CP);
|
2009-01-30 04:25:10 +00:00
|
|
|
void EmitGlobalConstantFP(const ConstantFP* CFP, unsigned AddrSpace);
|
|
|
|
void EmitGlobalConstantLargeInt(const ConstantInt* CI, unsigned AddrSpace);
|
2008-08-17 18:44:35 +00:00
|
|
|
GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
|
2004-08-16 23:15:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|