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
|
|
|
|
|
2009-04-29 23:29:43 +00:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2004-08-16 23:15:22 +00:00
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
2005-01-08 19:57:49 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2009-04-29 23:29:43 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2006-12-18 03:37:18 +00:00
|
|
|
#include <set>
|
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;
|
2008-12-22 21:14:27 +00:00
|
|
|
class ConstantInt;
|
|
|
|
class ConstantStruct;
|
|
|
|
class ConstantVector;
|
2008-08-17 12:08:44 +00:00
|
|
|
class GCMetadataPrinter;
|
2005-12-13 06:32:10 +00:00
|
|
|
class GlobalVariable;
|
2006-06-29 00:26:09 +00:00
|
|
|
class MachineConstantPoolEntry;
|
2006-09-12 21:00:35 +00:00
|
|
|
class MachineConstantPoolValue;
|
2009-01-13 21:44:10 +00:00
|
|
|
class DwarfWriter;
|
2006-09-06 18:34:40 +00:00
|
|
|
class Mangler;
|
2008-09-24 22:12:10 +00:00
|
|
|
class Section;
|
2006-09-06 18:34:40 +00:00
|
|
|
class TargetAsmInfo;
|
2007-12-31 04:13:23 +00:00
|
|
|
class Type;
|
2008-08-21 00:14:44 +00:00
|
|
|
class 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;
|
|
|
|
|
2006-12-18 03:37:18 +00:00
|
|
|
protected:
|
2009-02-18 23:12:06 +00:00
|
|
|
/// DW -This is needed because printDeclare() has to insert
|
|
|
|
/// DbgVariable entries into the dwarf table. This is a short term hack
|
|
|
|
/// that ought be fixed soon.
|
|
|
|
DwarfWriter *DW;
|
|
|
|
|
2006-12-18 03:37:18 +00:00
|
|
|
// Necessary for external weak linkage support
|
|
|
|
std::set<const GlobalValue*> ExtWeakSymbols;
|
|
|
|
|
2009-04-29 00:15:41 +00:00
|
|
|
/// OptLevel - Generating code at a specific optimization level.
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level OptLevel;
|
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.
|
|
|
|
///
|
2008-08-21 00:14:44 +00:00
|
|
|
raw_ostream &O;
|
2004-08-16 23:15:22 +00:00
|
|
|
|
|
|
|
/// Target machine description.
|
|
|
|
///
|
|
|
|
TargetMachine &TM;
|
2006-09-06 18:34:40 +00:00
|
|
|
|
|
|
|
/// Target Asm Printer information.
|
|
|
|
///
|
2006-09-07 22:06:40 +00:00
|
|
|
const TargetAsmInfo *TAI;
|
2004-08-16 23:15:22 +00:00
|
|
|
|
2008-03-15 00:03:38 +00:00
|
|
|
/// Target Register Information.
|
|
|
|
///
|
|
|
|
const TargetRegisterInfo *TRI;
|
|
|
|
|
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
|
|
|
|
2006-06-23 12:51:53 +00:00
|
|
|
/// CurrentSection - The current section we are emitting to. This is
|
|
|
|
/// controlled and used by the SwitchSection method.
|
|
|
|
std::string CurrentSection;
|
2008-09-24 22:15:21 +00:00
|
|
|
const Section* CurrentSection_;
|
2008-02-28 00:43:03 +00:00
|
|
|
|
|
|
|
/// IsInTextSection - True if the current section we are emitting to is a
|
|
|
|
/// text section.
|
|
|
|
bool IsInTextSection;
|
2009-03-25 01:47:28 +00:00
|
|
|
|
|
|
|
/// VerboseAsm - Emit comments in assembly output if this is true.
|
|
|
|
///
|
|
|
|
bool VerboseAsm;
|
|
|
|
|
2006-01-04 22:28:25 +00:00
|
|
|
protected:
|
2009-04-29 00:15:41 +00:00
|
|
|
explicit AsmPrinter(raw_ostream &o, TargetMachine &TM,
|
2009-04-29 23:29:43 +00:00
|
|
|
const TargetAsmInfo *T, CodeGenOpt::Level OL, 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-05-09 04:59:30 +00:00
|
|
|
/// SwitchToTextSection - Switch to the specified section of the executable
|
|
|
|
/// if we are not already in it! If GV is non-null and if the global has an
|
2005-11-21 07:05:42 +00:00
|
|
|
/// explicitly requested section, we switch to the section indicated for the
|
|
|
|
/// global instead of NewSection.
|
|
|
|
///
|
|
|
|
/// If the new section is an empty string, this method forgets what the
|
|
|
|
/// current section is, but does not emit a .section directive.
|
|
|
|
///
|
2006-05-09 04:59:30 +00:00
|
|
|
/// This method is used when about to emit executable code.
|
|
|
|
///
|
2006-10-31 06:11:06 +00:00
|
|
|
void SwitchToTextSection(const char *NewSection, const GlobalValue *GV = NULL);
|
2005-11-21 08:12:47 +00:00
|
|
|
|
2006-05-09 04:59:30 +00:00
|
|
|
/// SwitchToDataSection - Switch to the specified section of the executable
|
|
|
|
/// if we are not already in it! If GV is non-null and if the global has an
|
|
|
|
/// explicitly requested section, we switch to the section indicated for the
|
|
|
|
/// global instead of NewSection.
|
|
|
|
///
|
|
|
|
/// If the new section is an empty string, this method forgets what the
|
|
|
|
/// current section is, but does not emit a .section directive.
|
|
|
|
///
|
|
|
|
/// This method is used when about to emit data. For most assemblers, this
|
|
|
|
/// is the same as the SwitchToTextSection method, but not all assemblers
|
|
|
|
/// are the same.
|
|
|
|
///
|
2006-10-31 06:11:06 +00:00
|
|
|
void SwitchToDataSection(const char *NewSection, const GlobalValue *GV = NULL);
|
2008-09-24 22:12:10 +00:00
|
|
|
|
|
|
|
/// SwitchToSection - Switch to the specified section of the executable if
|
|
|
|
/// we are not already in it!
|
|
|
|
void SwitchToSection(const Section* NS);
|
|
|
|
|
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);
|
|
|
|
|
2007-09-18 01:47:22 +00:00
|
|
|
/// getCurrentFunctionEHName - Called to return (and cache) the
|
|
|
|
/// CurrentFnEHName.
|
|
|
|
///
|
2009-04-10 00:12:49 +00:00
|
|
|
const std::string &getCurrentFunctionEHName(const MachineFunction *MF,
|
|
|
|
std::string &FuncEHName) const;
|
2007-09-18 01:47:22 +00:00
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
/// getFunctionNumber - Return a unique ID for the current function.
|
|
|
|
///
|
|
|
|
unsigned getFunctionNumber() const { return FunctionNumber; }
|
|
|
|
|
|
|
|
/// 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);
|
2006-10-17 13:41:07 +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;
|
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;
|
|
|
|
|
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
|
|
|
|
|
|
|
/// printBasicBlockLabel - This method prints the label for the specified
|
|
|
|
/// MachineBasicBlock
|
2006-05-02 05:37:32 +00:00
|
|
|
virtual void printBasicBlockLabel(const MachineBasicBlock *MBB,
|
2008-02-28 00:43:03 +00:00
|
|
|
bool printAlign = false,
|
2006-05-02 05:37:32 +00:00
|
|
|
bool printColon = false,
|
|
|
|
bool printComment = true) const;
|
2006-08-12 21:29:52 +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-05-19 21:38:18 +00:00
|
|
|
/// printSuffixedName - This prints a name with preceding
|
|
|
|
/// getPrivateGlobalPrefix and the specified suffix, handling quoted names
|
|
|
|
/// correctly.
|
2008-07-08 16:40:43 +00:00
|
|
|
void printSuffixedName(const char *Name, const char *Suffix,
|
|
|
|
const char *Prefix = 0);
|
|
|
|
void printSuffixedName(const std::string &Name, const char* Suffix);
|
2008-05-19 21:38:18 +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;
|
|
|
|
|
2005-12-13 06:32:10 +00:00
|
|
|
private:
|
2008-09-03 20:34:58 +00:00
|
|
|
const GlobalValue *findGlobalValue(const Constant* CV);
|
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
|