LLVM API Documentation

llvm::TargetMachine Class Reference

#include <TargetMachine.h>

Inheritance diagram for llvm::TargetMachine:

Inheritance graph
[legend]
Collaboration diagram for llvm::TargetMachine:

Collaboration graph
[legend]
List of all members.

Public Types

 AssemblyFile
 ObjectFile
 DynamicLibrary
enum  CodeGenFileType { AssemblyFile, ObjectFile, DynamicLibrary }

Public Member Functions

virtual ~TargetMachine ()
const std::string & getName () const
virtual const TargetInstrInfogetInstrInfo () const
virtual const TargetFrameInfogetFrameInfo () const
virtual TargetLoweringgetTargetLowering () const
const TargetDatagetTargetData () const
template<typename STC>
const STC & getSubtarget () const
virtual const MRegisterInfogetRegisterInfo () const
virtual TargetJITInfogetJITInfo ()
virtual const InstrItineraryData getInstrItineraryData () const
virtual const TargetSchedInfogetSchedInfo () const
virtual const SparcV9RegInfogetRegInfo () const
virtual bool addPassesToEmitFile (PassManager &PM, std::ostream &Out, CodeGenFileType FileType, bool Fast)
virtual bool addPassesToEmitMachineCode (FunctionPassManager &PM, MachineCodeEmitter &MCE)

Static Public Member Functions

static unsigned getModuleMatchQuality (const Module &M)
static unsigned getJITMatchQuality ()
static Reloc::Model getRelocationModel ()
static void setRelocationModel (Reloc::Model Model)
 setRelocationModel - Sets the code generation relocation model.

Protected Member Functions

 TargetMachine (const std::string &name, bool LittleEndian=false, unsigned char PtrSize=8, unsigned char PtrAl=8, unsigned char DoubleAl=8, unsigned char FloatAl=4, unsigned char LongAl=8, unsigned char IntAl=4, unsigned char ShortAl=2, unsigned char ByteAl=1, unsigned char BoolAl=1)
 TargetMachine (const std::string &name, const TargetData &TD)
 TargetMachine (const std::string &name, const Module &M)
virtual const TargetSubtargetgetSubtargetImpl () const

Detailed Description

TargetMachine - Primary interface to the complete machine description for the target machine. All target-specific information should be accessible through this interface.

Definition at line 53 of file TargetMachine.h.


Member Enumeration Documentation

enum llvm::TargetMachine::CodeGenFileType

CodeGenFileType - These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit.

Enumerator:
AssemblyFile 
ObjectFile 
DynamicLibrary 

Definition at line 149 of file TargetMachine.h.


Constructor & Destructor Documentation

TargetMachine::TargetMachine ( const std::string &  name,
bool  LittleEndian = false,
unsigned char  PtrSize = 8,
unsigned char  PtrAl = 8,
unsigned char  DoubleAl = 8,
unsigned char  FloatAl = 4,
unsigned char  LongAl = 8,
unsigned char  IntAl = 4,
unsigned char  ShortAl = 2,
unsigned char  ByteAl = 1,
unsigned char  BoolAl = 1 
) [protected]

Definition at line 72 of file TargetMachine.cpp.

TargetMachine::TargetMachine ( const std::string &  name,
const TargetData TD 
) [protected]

Definition at line 83 of file TargetMachine.cpp.

TargetMachine::TargetMachine ( const std::string &  name,
const Module M 
) [protected]

This constructor is used for targets that support arbitrary TargetData layouts, like the C backend. It initializes the TargetData to match that of the specified module.

Definition at line 87 of file TargetMachine.cpp.

TargetMachine::~TargetMachine (  )  [virtual]

Definition at line 91 of file TargetMachine.cpp.


Member Function Documentation

virtual bool llvm::TargetMachine::addPassesToEmitFile ( PassManager PM,
std::ostream &  Out,
CodeGenFileType  FileType,
bool  Fast 
) [inline, virtual]

addPassesToEmitFile - Add passes to the specified pass manager to get the specified file emitted. Typically this will involve several steps of code generation. If Fast is set to true, the code generator should emit code as fast as possible, without regard for compile time. This method should return true if emission of this file type is not supported.

Definition at line 159 of file TargetMachine.h.

virtual bool llvm::TargetMachine::addPassesToEmitMachineCode ( FunctionPassManager PM,
MachineCodeEmitter MCE 
) [inline, virtual]

addPassesToEmitMachineCode - Add passes to the specified pass manager to get machine code emitted. This uses a MachineCodeEmitter object to handle actually outputting the machine code and resolving things like the address of functions. This method should returns true if machine code emission is not supported.

Reimplemented in llvm::AlphaTargetMachine, llvm::PPCTargetMachine, llvm::SparcV9TargetMachine, and llvm::X86TargetMachine.

Definition at line 170 of file TargetMachine.h.

virtual const TargetFrameInfo* llvm::TargetMachine::getFrameInfo (  )  const [inline, virtual]

Reimplemented in llvm::AlphaTargetMachine, llvm::IA64TargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, llvm::SparcV9TargetMachine, and llvm::X86TargetMachine.

Definition at line 104 of file TargetMachine.h.

Referenced by llvm::SparcV9FunctionInfo::allocateSpilledValue(), llvm::SparcV9RegInfo::colorMethodArgs(), llvm::SparcV9FunctionInfo::computeOffsetforLocalVar(), llvm::X86RegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPCRegisterInfo::eliminateCallFramePseudoInstr(), llvm::IA64RegisterInfo::eliminateCallFramePseudoInstr(), llvm::AlphaRegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPCRegisterInfo::emitEpilogue(), llvm::X86RegisterInfo::emitPrologue(), llvm::PPCRegisterInfo::emitPrologue(), llvm::IA64RegisterInfo::emitPrologue(), llvm::AlphaRegisterInfo::emitPrologue(), llvm::getStaticStackSize(), hasFP(), llvm::MachineFrameInfo::print(), llvm::SparcV9FunctionInfo::pushTempValue(), and llvm::SelectionDAGLowering::visitAlloca().

virtual const TargetInstrInfo* llvm::TargetMachine::getInstrInfo (  )  const [inline, virtual]

Reimplemented in llvm::AlphaTargetMachine, llvm::IA64TargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, llvm::SparcV9TargetMachine, and llvm::X86TargetMachine.

Definition at line 103 of file TargetMachine.h.

Referenced by llvm::LiveRangeInfo::constructLiveRanges(), llvm::SparcV9RegInfo::cpMem2RegMI(), llvm::SparcV9RegInfo::cpReg2MemMI(), llvm::DeleteInstruction(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MSchedGraphSB::MSchedGraphSB(), llvm::MachineInstr::print(), llvm::ScheduleDAG::Run(), llvm::LiveVariables::runOnMachineFunction(), llvm::LiveIntervals::runOnMachineFunction(), llvm::SparcV9RegInfo::suggestReg4RetValue(), and llvm::SparcV9RegInfo::suggestRegs4CallArgs().

virtual const InstrItineraryData llvm::TargetMachine::getInstrItineraryData (  )  const [inline, virtual]

getInstrItineraryData - Returns instruction itinerary data for the target or specific subtarget.

Reimplemented in llvm::PPCTargetMachine.

Definition at line 132 of file TargetMachine.h.

virtual TargetJITInfo* llvm::TargetMachine::getJITInfo (  )  [inline, virtual]

getJITInfo - If this target supports a JIT, return information for it, otherwise return null.

Reimplemented in llvm::AlphaTargetMachine, llvm::PPCTargetMachine, llvm::SparcV9TargetMachine, and llvm::X86TargetMachine.

Definition at line 127 of file TargetMachine.h.

Referenced by llvm::JIT::create().

static unsigned llvm::TargetMachine::getJITMatchQuality (  )  [inline, static]

getJITMatchQuality - This static method should be implemented by targets that provide JIT capabilities to indicate how suitable they are for execution on the current host. If a value of 0 is returned, the target will not be used unless an explicit -march option is used.

Reimplemented in llvm::AlphaTargetMachine, llvm::PPCTargetMachine, llvm::SparcV9TargetMachine, and llvm::X86TargetMachine.

Definition at line 92 of file TargetMachine.h.

static unsigned llvm::TargetMachine::getModuleMatchQuality ( const Module M  )  [inline, static]

getModuleMatchQuality - This static method should be implemented by targets to indicate how closely they match the specified module. This is used by the LLC tool to determine which target to use when an explicit -march option is not specified. If a target returns zero, it will never be chosen without an explicit -march option.

Reimplemented in llvm::AlphaTargetMachine, llvm::CTargetMachine, llvm::IA64TargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, llvm::SparcV9TargetMachine, and llvm::X86TargetMachine.

Definition at line 86 of file TargetMachine.h.

const std::string& llvm::TargetMachine::getName (  )  const [inline]

Definition at line 95 of file TargetMachine.h.

virtual const SparcV9RegInfo* llvm::TargetMachine::getRegInfo (  )  const [inline, virtual]

Reimplemented in llvm::SparcV9TargetMachine.

Definition at line 138 of file TargetMachine.h.

Referenced by llvm::IsUselessCopy(), and llvm::PhyRegAlloc::runOnFunction().

virtual const MRegisterInfo* llvm::TargetMachine::getRegisterInfo (  )  const [inline, virtual]

getRegisterInfo - If register information is available, return it. If not, return null. This is kept separate from RegInfo until RegInfo has details of graph coloring register allocation removed from it.

Reimplemented in llvm::AlphaTargetMachine, llvm::IA64TargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, llvm::SparcV9TargetMachine, and llvm::X86TargetMachine.

Definition at line 122 of file TargetMachine.h.

Referenced by llvm::SelectionDAGLowering::GetRegistersForValue(), llvm::VirtRegMap::print(), print(), llvm::MachineFunction::print(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86IntelAsmPrinter::printOperand(), llvm::X86ATTAsmPrinter::printOperand(), llvm::ScheduleDAG::Run(), llvm::LiveVariables::runOnMachineFunction(), and llvm::LiveIntervals::runOnMachineFunction().

Reloc::Model TargetMachine::getRelocationModel (  )  [static]

getRelocationModel - Returns the code generation relocation model. The choices are static, PIC, and dynamic-no-pic, and target default.

Definition at line 96 of file TargetMachine.cpp.

References llvm::RelocationModel.

Referenced by llvm::X86TargetLowering::isLegalAddressImmediate(), llvm::PPCTargetMachine::PPCTargetMachine(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86ATTAsmPrinter::printOperand(), and llvm::X86TargetMachine::X86TargetMachine().

virtual const TargetSchedInfo* llvm::TargetMachine::getSchedInfo (  )  const [inline, virtual]

Reimplemented in llvm::SparcV9TargetMachine.

Definition at line 137 of file TargetMachine.h.

template<typename STC>
const STC& llvm::TargetMachine::getSubtarget (  )  const [inline]

getSubtarget - This method returns a pointer to the specified type of TargetSubtarget. In debug builds, it verifies that the object being returned is of the correct type.

Definition at line 111 of file TargetMachine.h.

References getSubtargetImpl().

Referenced by llvm::AlphaTargetLowering::AlphaTargetLowering(), llvm::X86SharedAsmPrinter::doInitialization(), llvm::PPCTargetLowering::PerformDAGCombine(), llvm::PPCTargetLowering::PPCTargetLowering(), and llvm::X86TargetLowering::X86TargetLowering().

virtual const TargetSubtarget* llvm::TargetMachine::getSubtargetImpl (  )  const [inline, protected, virtual]

getSubtargetImpl - virtual method implemented by subclasses that returns a reference to that target's TargetSubtarget-derived member variable.

Reimplemented in llvm::AlphaTargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, and llvm::X86TargetMachine.

Definition at line 77 of file TargetMachine.h.

Referenced by getSubtarget().

const TargetData& llvm::TargetMachine::getTargetData (  )  const [inline]

Definition at line 106 of file TargetMachine.h.

Referenced by llvm::SparcV9FunctionInfo::allocateSpilledValue(), llvm::SparcV9RegInfo::colorMethodArgs(), llvm::SparcV9FunctionInfo::computeOffsetforLocalVar(), llvm::ConvertConstantToIntType(), llvm::X86SharedAsmPrinter::doFinalization(), llvm::ELFWriter::ELFWriter(), llvm::AsmPrinter::EmitConstantPool(), llvm::AsmPrinter::EmitConstantValueOnly(), llvm::AsmPrinter::EmitGlobalConstant(), findOptimalStorageSize(), llvm::AsmPrinter::getPreferredAlignmentLog(), llvm::MachineFunction::MachineFunction(), and SizeToAlignment().

virtual TargetLowering* llvm::TargetMachine::getTargetLowering (  )  const [inline, virtual]

Definition at line 105 of file TargetMachine.h.

void TargetMachine::setRelocationModel ( Reloc::Model  Model  )  [static]

setRelocationModel - Sets the code generation relocation model.

Definition at line 101 of file TargetMachine.cpp.

References llvm::RelocationModel.

Referenced by llvm::X86JITInfo::addPassesToJITCompile(), llvm::PPCJITInfo::addPassesToJITCompile(), llvm::PPCTargetMachine::PPCTargetMachine(), and llvm::X86TargetMachine::X86TargetMachine().


The documentation for this class was generated from the following files: