2004-08-17 01:15:22 +02:00
|
|
|
//===-- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework --------*- C++ -*-===//
|
2005-04-21 22:39:54 +02:00
|
|
|
//
|
2004-08-17 01:15:22 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:59:42 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 22:39:54 +02:00
|
|
|
//
|
2004-08-17 01:15:22 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2006-09-06 20:34:40 +02: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-17 01:15:22 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_ASMPRINTER_H
|
|
|
|
#define LLVM_CODEGEN_ASMPRINTER_H
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
2010-01-16 07:09:35 +01:00
|
|
|
#include "llvm/Analysis/DebugInfo.h"
|
2009-08-18 21:22:55 +02:00
|
|
|
#include "llvm/Support/DebugLoc.h"
|
2009-04-30 01:29:43 +02:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2009-07-27 23:13:35 +02:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2004-08-17 01:15:22 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
2009-10-30 02:27:03 +01:00
|
|
|
class BlockAddress;
|
2008-08-17 20:44:35 +02:00
|
|
|
class GCStrategy;
|
2004-08-17 01:15:22 +02:00
|
|
|
class Constant;
|
2006-05-02 03:16:28 +02:00
|
|
|
class ConstantArray;
|
2009-08-18 21:22:55 +02:00
|
|
|
class ConstantFP;
|
2008-12-22 22:14:27 +01:00
|
|
|
class ConstantInt;
|
|
|
|
class ConstantStruct;
|
|
|
|
class ConstantVector;
|
2008-08-17 14:08:44 +02:00
|
|
|
class GCMetadataPrinter;
|
2009-08-18 21:22:55 +02:00
|
|
|
class GlobalValue;
|
2005-12-13 07:32:10 +01:00
|
|
|
class GlobalVariable;
|
2009-08-18 21:22:55 +02:00
|
|
|
class MachineBasicBlock;
|
|
|
|
class MachineFunction;
|
|
|
|
class MachineInstr;
|
2009-08-10 18:38:07 +02:00
|
|
|
class MachineLoopInfo;
|
|
|
|
class MachineLoop;
|
2009-08-18 21:22:55 +02:00
|
|
|
class MachineConstantPool;
|
2006-06-29 02:26:09 +02:00
|
|
|
class MachineConstantPoolEntry;
|
2006-09-12 23:00:35 +02:00
|
|
|
class MachineConstantPoolValue;
|
2009-08-18 21:22:55 +02:00
|
|
|
class MachineJumpTableInfo;
|
2009-06-24 21:09:55 +02:00
|
|
|
class MachineModuleInfo;
|
2009-07-13 22:25:48 +02:00
|
|
|
class MCInst;
|
2009-07-27 23:28:04 +02:00
|
|
|
class MCContext;
|
2009-07-31 20:48:30 +02:00
|
|
|
class MCSection;
|
2009-07-27 23:28:04 +02:00
|
|
|
class MCStreamer;
|
2009-09-13 01:02:08 +02:00
|
|
|
class MCSymbol;
|
2009-01-13 22:44:10 +01:00
|
|
|
class DwarfWriter;
|
2006-09-06 20:34:40 +02:00
|
|
|
class Mangler;
|
2009-08-22 22:48:53 +02:00
|
|
|
class MCAsmInfo;
|
2009-07-28 05:13:23 +02:00
|
|
|
class TargetLoweringObjectFile;
|
2010-01-17 08:46:39 +01:00
|
|
|
class Twine;
|
2007-12-31 05:13:23 +01:00
|
|
|
class Type;
|
2009-07-14 22:18:05 +02:00
|
|
|
class formatted_raw_ostream;
|
2004-08-17 01:15:22 +02:00
|
|
|
|
2006-09-06 20:34:40 +02:00
|
|
|
/// AsmPrinter - This class is intended to be used as a driving class for all
|
|
|
|
/// asm writers.
|
2004-08-17 01:15:22 +02:00
|
|
|
class AsmPrinter : public MachineFunctionPass {
|
2007-05-03 03:11:54 +02:00
|
|
|
static char ID;
|
2007-05-01 23:15:47 +02:00
|
|
|
|
2007-10-14 07:57:21 +02: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 14:08:44 +02:00
|
|
|
// GCMetadataPrinters - The garbage collection metadata printer table.
|
2008-08-17 20:44:35 +02:00
|
|
|
typedef DenseMap<GCStrategy*,GCMetadataPrinter*> gcp_map_type;
|
2008-08-17 14:08:44 +02:00
|
|
|
typedef gcp_map_type::iterator gcp_iterator;
|
|
|
|
gcp_map_type GCMetadataPrinters;
|
2009-07-22 22:33:26 +02:00
|
|
|
|
2009-08-19 08:36:30 +02:00
|
|
|
/// If VerboseAsm is set, a pointer to the loop info for this
|
2009-08-10 18:38:07 +02:00
|
|
|
/// function.
|
|
|
|
///
|
|
|
|
MachineLoopInfo *LI;
|
|
|
|
|
2009-09-16 08:25:03 +02:00
|
|
|
public:
|
2009-06-24 21:09:55 +02:00
|
|
|
/// MMI - If available, this is a pointer to the current MachineModuleInfo.
|
|
|
|
MachineModuleInfo *MMI;
|
|
|
|
|
2009-09-16 08:25:03 +02:00
|
|
|
protected:
|
2009-06-24 21:09:55 +02:00
|
|
|
/// DW - If available, this is a pointer to the current dwarf writer.
|
2009-02-19 00:12:06 +01:00
|
|
|
DwarfWriter *DW;
|
2009-07-13 22:25:48 +02:00
|
|
|
|
2006-01-04 23:28:25 +01:00
|
|
|
public:
|
2009-11-12 21:13:34 +01:00
|
|
|
/// Flags to specify different kinds of comments to output in
|
|
|
|
/// assembly code. These flags carry semantic information not
|
|
|
|
/// otherwise easily derivable from the IR text.
|
|
|
|
///
|
|
|
|
enum CommentFlag {
|
|
|
|
ReloadReuse = 0x1
|
|
|
|
};
|
|
|
|
|
2004-08-17 01:15:22 +02:00
|
|
|
/// Output stream on which we're printing assembly code.
|
|
|
|
///
|
2009-07-14 22:18:05 +02:00
|
|
|
formatted_raw_ostream &O;
|
2004-08-17 01:15:22 +02:00
|
|
|
|
|
|
|
/// Target machine description.
|
|
|
|
///
|
|
|
|
TargetMachine &TM;
|
2006-09-06 20:34:40 +02:00
|
|
|
|
2009-07-28 05:13:23 +02:00
|
|
|
/// getObjFileLowering - Return information about object file lowering.
|
2009-08-03 21:12:26 +02:00
|
|
|
TargetLoweringObjectFile &getObjFileLowering() const;
|
2009-07-28 05:13:23 +02:00
|
|
|
|
2006-09-06 20:34:40 +02:00
|
|
|
/// Target Asm Printer information.
|
|
|
|
///
|
2009-08-22 23:43:10 +02:00
|
|
|
const MCAsmInfo *MAI;
|
2004-08-17 01:15:22 +02:00
|
|
|
|
2008-03-15 01:03:38 +01:00
|
|
|
/// Target Register Information.
|
|
|
|
///
|
|
|
|
const TargetRegisterInfo *TRI;
|
|
|
|
|
2009-07-27 23:28:04 +02: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 09:30:20 +01:00
|
|
|
/// The current machine function.
|
|
|
|
const MachineFunction *MF;
|
|
|
|
|
2004-08-17 01:15:22 +02:00
|
|
|
/// Name-mangler for global names.
|
|
|
|
///
|
|
|
|
Mangler *Mang;
|
|
|
|
|
2010-01-16 02:24:10 +01:00
|
|
|
/// The symbol for the current function. This is recalculated at the
|
2004-08-17 01:15:22 +02:00
|
|
|
/// beginning of each call to runOnMachineFunction().
|
|
|
|
///
|
2010-01-18 01:59:24 +01:00
|
|
|
MCSymbol *CurrentFnSym;
|
2005-11-21 09:24:11 +01:00
|
|
|
|
2009-08-04 01:20:21 +02:00
|
|
|
/// getCurrentSection() - Return the current section we are emitting to.
|
2009-08-18 08:15:16 +02:00
|
|
|
const MCSection *getCurrentSection() const;
|
2009-08-04 01:20:21 +02:00
|
|
|
|
2009-03-25 02:47:28 +01:00
|
|
|
|
|
|
|
/// VerboseAsm - Emit comments in assembly output if this is true.
|
|
|
|
///
|
|
|
|
bool VerboseAsm;
|
|
|
|
|
2009-06-25 00:28:12 +02: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 18:55:32 +02:00
|
|
|
|
2009-10-06 04:19:11 +02:00
|
|
|
// Private state for processDebugLoc()
|
2010-01-16 07:09:35 +01:00
|
|
|
mutable DILocation PrevDLT;
|
2009-06-25 00:28:12 +02:00
|
|
|
|
2006-01-04 23:28:25 +01:00
|
|
|
protected:
|
2009-07-14 22:18:05 +02:00
|
|
|
explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
|
2009-08-22 22:48:53 +02:00
|
|
|
const MCAsmInfo *T, bool V);
|
2005-12-13 07:32:10 +01:00
|
|
|
|
2006-01-04 14:52:30 +01:00
|
|
|
public:
|
2008-08-17 14:08:44 +02:00
|
|
|
virtual ~AsmPrinter();
|
2009-03-25 02:47:28 +01:00
|
|
|
|
|
|
|
/// isVerbose - Return true if assembly output should contain comments.
|
|
|
|
///
|
|
|
|
bool isVerbose() const { return VerboseAsm; }
|
|
|
|
|
2009-09-01 03:57:56 +02:00
|
|
|
/// getFunctionNumber - Return a unique ID for the current function.
|
|
|
|
///
|
|
|
|
unsigned getFunctionNumber() const { return FunctionNumber; }
|
|
|
|
|
2006-01-04 14:52:30 +01:00
|
|
|
protected:
|
2008-01-07 02:30:38 +01:00
|
|
|
/// getAnalysisUsage - Record analysis usage.
|
|
|
|
///
|
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const;
|
|
|
|
|
2004-08-17 01:15:22 +02: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);
|
|
|
|
|
2009-10-01 00:06:26 +02:00
|
|
|
/// EmitStartOfAsmFile - This virtual method can be overridden by targets
|
|
|
|
/// that want to emit something at the start of their file.
|
2009-11-16 23:34:32 +01:00
|
|
|
virtual void EmitStartOfAsmFile(Module &) {}
|
2009-10-01 00:06:26 +02:00
|
|
|
|
2009-09-18 22:17:03 +02:00
|
|
|
/// EmitEndOfAsmFile - This virtual method can be overridden by targets that
|
|
|
|
/// want to emit something at the end of their file.
|
2009-11-16 23:34:32 +01:00
|
|
|
virtual void EmitEndOfAsmFile(Module &) {}
|
2009-09-18 22:17:03 +02:00
|
|
|
|
2004-08-17 01:15:22 +02:00
|
|
|
/// 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-27 01:59:50 +02: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 06:37:13 +01:00
|
|
|
virtual void PrintSpecial(const MachineInstr *MI, const char *Code) const;
|
2006-02-01 23:39:30 +01:00
|
|
|
|
|
|
|
/// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
|
|
|
|
/// instruction, using the specified assembler variant. Targets should
|
2006-02-24 21:21:12 +01:00
|
|
|
/// override this to format as appropriate. This method can return true if
|
2006-02-01 23:39:30 +01:00
|
|
|
/// the operand is erroneous.
|
|
|
|
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
2006-02-06 23:16:41 +01:00
|
|
|
unsigned AsmVariant, const char *ExtraCode);
|
2006-01-04 23:28:25 +01:00
|
|
|
|
2006-02-24 21:21:12 +01: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);
|
|
|
|
|
2005-11-21 08:51:06 +01:00
|
|
|
/// SetupMachineFunction - This should be called when a new MachineFunction
|
2004-08-17 01:15:22 +02:00
|
|
|
/// is being processed from runOnMachineFunction.
|
2005-11-21 08:51:06 +01:00
|
|
|
void SetupMachineFunction(MachineFunction &MF);
|
2005-11-21 09:24:11 +01:00
|
|
|
|
2007-10-14 07:57:21 +02: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 07:32:10 +01: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 02:26:09 +02:00
|
|
|
void EmitConstantPool(MachineConstantPool *MCP);
|
2004-08-17 01:15:22 +02:00
|
|
|
|
2006-04-22 20:53:45 +02:00
|
|
|
/// EmitJumpTableInfo - Print assembly representations of the jump tables
|
|
|
|
/// used by the current function to the current output stream.
|
|
|
|
///
|
2006-10-05 05:01:21 +02:00
|
|
|
void EmitJumpTableInfo(MachineJumpTableInfo *MJTI, MachineFunction &MF);
|
2006-04-22 20:53:45 +02:00
|
|
|
|
2010-01-19 05:39:15 +01:00
|
|
|
/// EmitGlobalVariable - Emit the specified global variable to the .s file.
|
2010-01-19 06:38:33 +01:00
|
|
|
virtual void EmitGlobalVariable(const GlobalVariable *GV);
|
2010-01-19 05:39:15 +01:00
|
|
|
|
2005-12-13 07:32:10 +01: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 23:48:26 +02:00
|
|
|
|
2007-01-24 14:12:32 +01:00
|
|
|
public:
|
2007-01-25 16:12:02 +01: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.
|
|
|
|
///
|
2010-01-17 08:46:39 +01:00
|
|
|
void PrintHex(uint64_t Value) const;
|
2007-01-25 16:12:02 +01:00
|
|
|
|
|
|
|
/// 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 23:47:38 +01:00
|
|
|
void EOL() const;
|
2010-01-17 08:46:39 +01:00
|
|
|
void EOL(const Twine &Comment) const;
|
|
|
|
void EOL(const Twine &Comment, unsigned Encoding) const;
|
2009-08-29 14:17:53 +02:00
|
|
|
|
2007-01-25 16:12:02 +01: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 22:06:04 +02:00
|
|
|
/// @verbatim (Eg. '\t') @endverbatim
|
2009-11-24 20:42:17 +01:00
|
|
|
void EmitString(const StringRef String) const;
|
2009-04-10 01:51:31 +02:00
|
|
|
void EmitString(const char *String, unsigned Size) const;
|
|
|
|
|
2007-09-24 22:58:13 +02:00
|
|
|
/// EmitFile - Emit a .file directive.
|
2010-01-17 08:46:39 +01:00
|
|
|
void EmitFile(unsigned Number, StringRef Name) const;
|
2007-09-24 22:58:13 +02:00
|
|
|
|
2007-01-25 16:12:02 +01:00
|
|
|
//===------------------------------------------------------------------===//
|
|
|
|
|
2005-11-21 08:51:06 +01:00
|
|
|
/// EmitAlignment - Emit an alignment directive to the specified power of
|
2004-08-17 21:14:29 +02:00
|
|
|
/// two boundary. For example, if you pass in 3 here, you will get an 8
|
2005-11-14 20:00:06 +01:00
|
|
|
/// byte alignment. If a global value is specified, and if that global has
|
2007-05-31 20:57:45 +02: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 20:36:59 +01: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 20:57:45 +02: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 20:36:59 +01:00
|
|
|
unsigned ForcedAlignBits = 0,
|
|
|
|
bool UseFillExpr = true) const;
|
2004-08-17 21:14:29 +02:00
|
|
|
|
2008-02-01 10:10:45 +01: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 05:07:54 +01:00
|
|
|
/// printDeclare - This method prints a local variable declaration used by
|
|
|
|
/// debug tables.
|
|
|
|
void printDeclare(const MachineInstr *MI) const;
|
|
|
|
|
2009-07-15 20:24:03 +02:00
|
|
|
/// EmitComments - Pretty-print comments for instructions
|
|
|
|
void EmitComments(const MachineInstr &MI) const;
|
2009-08-10 18:38:07 +02:00
|
|
|
/// EmitComments - Pretty-print comments for basic blocks
|
|
|
|
void EmitComments(const MachineBasicBlock &MBB) const;
|
2009-07-15 20:24:03 +02:00
|
|
|
|
2010-01-16 00:18:17 +01:00
|
|
|
/// GetGlobalValueSymbol - Return the MCSymbol for the specified global
|
|
|
|
/// value.
|
|
|
|
MCSymbol *GetGlobalValueSymbol(const GlobalValue *GV) const;
|
|
|
|
|
2010-01-16 19:37:32 +01:00
|
|
|
/// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with
|
2010-01-16 00:25:11 +01:00
|
|
|
/// global value name as its base, with the specified suffix, and where the
|
2010-01-16 19:37:32 +01:00
|
|
|
/// symbol is forced to have private linkage if ForcePrivate is true.
|
|
|
|
MCSymbol *GetSymbolWithGlobalValueBase(const GlobalValue *GV,
|
|
|
|
StringRef Suffix,
|
|
|
|
bool ForcePrivate = true) const;
|
2010-01-16 00:25:11 +01:00
|
|
|
|
2010-01-16 00:18:17 +01:00
|
|
|
/// GetExternalSymbolSymbol - Return the MCSymbol for the specified
|
|
|
|
/// ExternalSymbol.
|
|
|
|
MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const;
|
|
|
|
|
2009-09-13 01:02:08 +02:00
|
|
|
/// GetMBBSymbol - Return the MCSymbol corresponding to the specified basic
|
|
|
|
/// block label.
|
|
|
|
MCSymbol *GetMBBSymbol(unsigned MBBID) const;
|
|
|
|
|
2009-10-30 02:27:03 +01:00
|
|
|
/// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress
|
|
|
|
/// uses of the specified basic block.
|
2009-11-21 00:18:13 +01:00
|
|
|
MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA,
|
|
|
|
const char *Suffix = "") const;
|
2009-10-30 02:27:03 +01:00
|
|
|
MCSymbol *GetBlockAddressSymbol(const Function *F,
|
2009-11-21 00:18:13 +01:00
|
|
|
const BasicBlock *BB,
|
|
|
|
const char *Suffix = "") const;
|
2009-10-30 02:27:03 +01:00
|
|
|
|
2009-09-13 20:25:37 +02:00
|
|
|
/// EmitBasicBlockStart - This method prints the label for the specified
|
|
|
|
/// MachineBasicBlock, an alignment (if present) and a comment describing
|
|
|
|
/// it if appropriate.
|
2009-09-14 05:15:54 +02:00
|
|
|
void EmitBasicBlockStart(const MachineBasicBlock *MBB) const;
|
2007-01-24 14:12:32 +01:00
|
|
|
protected:
|
2005-11-21 08:51:06 +01:00
|
|
|
/// EmitZeros - Emit a block of zeros.
|
2004-08-17 23:38:51 +02:00
|
|
|
///
|
2009-01-30 05:25:10 +01:00
|
|
|
void EmitZeros(uint64_t NumZeros, unsigned AddrSpace = 0) const;
|
2006-05-02 03:16:28 +02:00
|
|
|
|
|
|
|
/// EmitString - Emit a zero-byte-terminated string constant.
|
|
|
|
///
|
|
|
|
virtual void EmitString(const ConstantArray *CVA) const;
|
2004-08-17 23:38:51 +02:00
|
|
|
|
2005-11-21 08:51:06 +01:00
|
|
|
/// EmitConstantValueOnly - Print out the specified constant, without a
|
2004-08-17 01:15:22 +02:00
|
|
|
/// storage class. Only constants of first-class type are allowed here.
|
2009-01-16 06:06:35 +01:00
|
|
|
void EmitConstantValueOnly(const Constant *CV);
|
2004-08-17 08:36:27 +02:00
|
|
|
|
2005-11-21 08:51:06 +01:00
|
|
|
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
|
2009-01-30 05:25:10 +01:00
|
|
|
void EmitGlobalConstant(const Constant* CV, unsigned AddrSpace = 0);
|
2006-09-12 23:00:35 +02:00
|
|
|
|
|
|
|
virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
|
2009-05-07 15:55:51 +02:00
|
|
|
|
|
|
|
/// processDebugLoc - Processes the debug information of each machine
|
2009-10-06 04:19:11 +02:00
|
|
|
/// instruction's DebugLoc.
|
|
|
|
void processDebugLoc(const MachineInstr *MI, bool BeforePrintingInsn);
|
2005-12-13 07:32:10 +01:00
|
|
|
|
2006-01-27 03:09:16 +01: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 01:03:38 +01:00
|
|
|
|
|
|
|
/// printImplicitDef - This method prints the specified machine instruction
|
|
|
|
/// that is an implicit def.
|
2009-11-06 01:04:05 +01:00
|
|
|
void printImplicitDef(const MachineInstr *MI) const;
|
2009-11-04 20:24:37 +01:00
|
|
|
|
|
|
|
/// printKill - This method prints the specified kill machine instruction.
|
2009-11-06 01:04:05 +01:00
|
|
|
void printKill(const MachineInstr *MI) const;
|
2009-11-04 20:24:37 +01: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
llvm-svn: 43924
2007-11-09 02:32:10 +01: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 10:18:41 +01:00
|
|
|
virtual void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
|
|
|
const MachineBasicBlock *MBB,
|
|
|
|
unsigned uid) const;
|
|
|
|
|
2006-09-12 23:00:35 +02:00
|
|
|
/// printDataDirective - This method prints the asm directive for the
|
|
|
|
/// specified type.
|
2009-01-30 05:25:10 +01:00
|
|
|
void printDataDirective(const Type *type, unsigned AddrSpace = 0);
|
2006-09-12 23:00:35 +02:00
|
|
|
|
2008-08-08 20:25:07 +02:00
|
|
|
/// printVisibility - This prints visibility information about symbol, if
|
|
|
|
/// this is suported by the target.
|
2010-01-16 00:38:51 +01:00
|
|
|
void printVisibility(const MCSymbol *Sym, unsigned Visibility) const;
|
|
|
|
|
2008-11-22 17:15:34 +01:00
|
|
|
/// printOffset - This is just convenient handler for printing offsets.
|
|
|
|
void printOffset(int64_t Offset) const;
|
2009-07-13 22:25:48 +02:00
|
|
|
|
2005-12-13 07:32:10 +01:00
|
|
|
private:
|
2006-09-26 05:38:18 +02:00
|
|
|
void EmitLLVMUsedList(Constant *List);
|
2005-12-13 07:32:10 +01:00
|
|
|
void EmitXXStructorList(Constant *List);
|
2009-01-30 05:25:10 +01:00
|
|
|
void EmitGlobalConstantStruct(const ConstantStruct* CVS,
|
|
|
|
unsigned AddrSpace);
|
2009-04-28 18:34:20 +02:00
|
|
|
void EmitGlobalConstantArray(const ConstantArray* CVA, unsigned AddrSpace);
|
2008-12-22 22:14:27 +01:00
|
|
|
void EmitGlobalConstantVector(const ConstantVector* CP);
|
2009-01-30 05:25:10 +01:00
|
|
|
void EmitGlobalConstantFP(const ConstantFP* CFP, unsigned AddrSpace);
|
|
|
|
void EmitGlobalConstantLargeInt(const ConstantInt* CI, unsigned AddrSpace);
|
2008-08-17 20:44:35 +02:00
|
|
|
GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
|
2004-08-17 01:15:22 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|