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

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
virtual const TargetDatagetTargetData () const
template<typename STC>
const STC & getSubtarget () const
virtual const MRegisterInfogetRegisterInfo () const
virtual TargetJITInfogetJITInfo ()
virtual const InstrItineraryData getInstrItineraryData () 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.
static CodeModel::Model getCodeModel ()
static void setCodeModel (CodeModel::Model Model)
 setCodeModel - Sets the code model.

Protected Member Functions

 TargetMachine (const std::string &name)
 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 64 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 155 of file TargetMachine.h.


Constructor & Destructor Documentation

llvm::TargetMachine::TargetMachine ( const std::string &  name  )  [inline, protected]

Definition at line 70 of file TargetMachine.h.

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 98 of file TargetMachine.cpp.

TargetMachine::~TargetMachine (  )  [virtual]

Definition at line 102 of file TargetMachine.cpp.


Member Function Documentation

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 80 of file TargetMachine.h.

Referenced by getSubtarget().

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::ARMTargetMachine, llvm::CTargetMachine, llvm::IA64TargetMachine, llvm::PPC32TargetMachine, llvm::PPC64TargetMachine, llvm::SparcTargetMachine, and llvm::X86TargetMachine.

Definition at line 89 of file TargetMachine.h.

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::PPC32TargetMachine, llvm::PPC64TargetMachine, and llvm::X86TargetMachine.

Definition at line 95 of file TargetMachine.h.

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

Definition at line 98 of file TargetMachine.h.

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

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

Definition at line 106 of file TargetMachine.h.

Referenced by llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineInstr::print(), RemoveVRSaveCode(), llvm::ScheduleDAG::Run(), llvm::LiveVariables::runOnMachineFunction(), and llvm::LiveIntervals::runOnMachineFunction().

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

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

Definition at line 107 of file TargetMachine.h.

Referenced by 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(), hasFP(), llvm::MachineFrameInfo::print(), and llvm::SelectionDAGLowering::visitAlloca().

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

Reimplemented in llvm::IA64TargetMachine, llvm::PPCTargetMachine, and llvm::X86TargetMachine.

Definition at line 108 of file TargetMachine.h.

virtual const TargetData* llvm::TargetMachine::getTargetData (  )  const [inline, virtual]

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

Definition at line 109 of file TargetMachine.h.

Referenced by llvm::X86IntelAsmPrinter::doFinalization(), llvm::X86SharedAsmPrinter::doFinalization(), llvm::ELFWriter::ELFWriter(), llvm::AsmPrinter::EmitConstantPool(), llvm::AsmPrinter::EmitConstantValueOnly(), llvm::AsmPrinter::EmitGlobalConstant(), llvm::AsmPrinter::EmitJumpTableInfo(), llvm::AsmPrinter::getPreferredAlignmentLog(), and llvm::MachineFunction::MachineFunction().

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 114 of file TargetMachine.h.

References getSubtargetImpl().

Referenced by llvm::AlphaTargetLowering::AlphaTargetLowering(), llvm::X86InstrInfo::convertToThreeAddress(), llvm::X86RegisterInfo::emitPrologue(), LowerConstantPool(), LowerGlobalAddress(), LowerJumpTable(), llvm::PPCTargetLowering::PerformDAGCombine(), llvm::PPCTargetLowering::PPCTargetLowering(), llvm::X86SharedAsmPrinter::X86SharedAsmPrinter(), and llvm::X86TargetLowering::X86TargetLowering().

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::ARMTargetMachine, llvm::IA64TargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, and llvm::X86TargetMachine.

Definition at line 125 of file TargetMachine.h.

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

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, and llvm::X86TargetMachine.

Definition at line 130 of file TargetMachine.h.

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

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 135 of file TargetMachine.h.

Referenced by llvm::ScheduleDAG::BuildSchedUnits().

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 107 of file TargetMachine.cpp.

References llvm::RelocationModel.

Referenced by llvm::AsmPrinter::EmitJumpTableInfo(), llvm::X86TargetLowering::isLegalAddressImmediate(), LowerConstantPool(), LowerGlobalAddress(), LowerJumpTable(), llvm::PPCTargetMachine::PPCTargetMachine(), llvm::X86ATTAsmPrinter::printOperand(), llvm::SelectionDAGLowering::visitJumpTable(), llvm::SelectionDAGLowering::visitSwitch(), and llvm::X86TargetMachine::X86TargetMachine().

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

setRelocationModel - Sets the code generation relocation model.

Definition at line 112 of file TargetMachine.cpp.

References llvm::RelocationModel.

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

CodeModel::Model TargetMachine::getCodeModel (  )  [static]

getCodeModel - Returns the code model. The choices are small, kernel, medium, large, and target default.

Definition at line 118 of file TargetMachine.cpp.

References llvm::CMModel.

void TargetMachine::setCodeModel ( CodeModel::Model  Model  )  [static]

setCodeModel - Sets the code model.

Definition at line 123 of file TargetMachine.cpp.

References llvm::CMModel.

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.

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

Definition at line 165 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, and llvm::X86TargetMachine.

Definition at line 176 of file TargetMachine.h.


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