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 ()
virtual const TargetInstrInfogetInstrInfo () const
virtual const TargetFrameInfogetFrameInfo () const
virtual TargetLoweringgetTargetLowering () const
virtual const TargetDatagetTargetData () const
const TargetAsmInfogetTargetAsmInfo () const
template<typename STC>
const STC & getSubtarget () const
virtual const TargetRegisterInfogetRegisterInfo () const
virtual TargetJITInfogetJITInfo ()
virtual const InstrItineraryData getInstrItineraryData () const
virtual const
TargetMachOWriterInfo
getMachOWriterInfo () const
virtual const TargetELFWriterInfogetELFWriterInfo () const
virtual bool getEnableTailMergeDefault () const
virtual FileModel::Model addPassesToEmitFile (PassManagerBase &, raw_ostream &, CodeGenFileType, bool)
virtual bool addPassesToEmitFileFinish (PassManagerBase &, MachineCodeEmitter *, bool)
virtual bool addPassesToEmitMachineCode (PassManagerBase &, MachineCodeEmitter &, bool)
virtual bool WantsWholeFile () const
virtual bool addPassesToEmitWholeFile (PassManager &, raw_ostream &, CodeGenFileType, bool)

Static Public Member Functions

static unsigned getModuleMatchQuality (const Module &)
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 ()
virtual const TargetSubtargetgetSubtargetImpl () const
virtual const TargetAsmInfocreateTargetAsmInfo () const

Protected Attributes

const TargetAsmInfoAsmInfo


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


Member Enumeration Documentation

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


Constructor & Destructor Documentation

llvm::TargetMachine::TargetMachine (  )  [inline, protected]

Definition at line 80 of file TargetMachine.h.

TargetMachine::~TargetMachine (  )  [virtual]

Definition at line 171 of file TargetMachine.cpp.

References AsmInfo.


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::ARMTargetMachine, llvm::SPUTargetMachine, llvm::MipsTargetMachine, llvm::PIC16TargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, llvm::X86TargetMachine, and llvm::XCoreTargetMachine.

Definition at line 84 of file TargetMachine.h.

Referenced by getSubtarget().

virtual const TargetAsmInfo* llvm::TargetMachine::createTargetAsmInfo (  )  const [inline, protected, virtual]

static unsigned llvm::TargetMachine::getModuleMatchQuality ( const Module  )  [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::ThumbTargetMachine, llvm::CTargetMachine, llvm::SPUTargetMachine, llvm::CPPTargetMachine, llvm::IA64TargetMachine, llvm::MipsTargetMachine, llvm::MipselTargetMachine, llvm::PPC32TargetMachine, llvm::PPC64TargetMachine, llvm::SparcTargetMachine, llvm::X86TargetMachine, llvm::X86_32TargetMachine, llvm::X86_64TargetMachine, and llvm::XCoreTargetMachine.

Definition at line 102 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::ARMTargetMachine, llvm::ThumbTargetMachine, llvm::PPC32TargetMachine, llvm::PPC64TargetMachine, llvm::X86TargetMachine, llvm::X86_32TargetMachine, and llvm::X86_64TargetMachine.

Definition at line 108 of file TargetMachine.h.

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

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

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

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

Reimplemented in llvm::AlphaTargetMachine, llvm::ARMTargetMachine, llvm::CTargetMachine, llvm::SPUTargetMachine, llvm::CPPTargetMachine, llvm::IA64TargetMachine, llvm::MipsTargetMachine, llvm::PIC16TargetMachine, llvm::PPCTargetMachine, llvm::SparcTargetMachine, llvm::X86TargetMachine, and llvm::XCoreTargetMachine.

Definition at line 119 of file TargetMachine.h.

Referenced by llvm::JIT::addModuleProvider(), llvm::X86IntelAsmPrinter::decorateName(), llvm::X86ATTAsmPrinter::decorateName(), llvm::X86IntelAsmPrinter::doFinalization(), llvm::ELFWriter::ELFWriter(), llvm::MachOCodeEmitter::emitConstantPool(), llvm::AsmPrinter::EmitConstantPool(), llvm::AsmPrinter::EmitConstantValueOnly(), llvm::JITDwarfEmitter::EmitDwarfTable(), llvm::X86RegisterInfo::emitFrameMoves(), llvm::AsmPrinter::EmitGlobalConstant(), llvm::AsmPrinter::EmitInt64(), llvm::AsmPrinter::EmitSpecialLLVMGlobal(), llvm::JITDwarfEmitter::GetDwarfTableSizeInBytes(), llvm::SelectionDAGLowering::init(), llvm::MachineFunction::MachineFunction(), llvm::MachOCodeEmitter::MachOCodeEmitter(), llvm::MachOWriter::MachOWriter(), llvm::XCoreTargetAsmInfo::MergeableConstSection(), llvm::ELFTargetAsmInfo::MergeableConstSection(), llvm::DarwinTargetAsmInfo::MergeableConstSection(), llvm::ELFTargetAsmInfo::MergeableStringSection(), llvm::DarwinTargetAsmInfo::MergeableStringSection(), llvm::AsmPrinter::printDataDirective(), llvm::X86ATTAsmPrinter::printModuleLevelGV(), llvm::MipsTargetAsmInfo::SectionKindForGlobal(), llvm::MachOCodeEmitter::startFunction(), and llvm::ELFCodeEmitter::startFunction().

const TargetAsmInfo* llvm::TargetMachine::getTargetAsmInfo (  )  const [inline]

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

References getSubtargetImpl().

Referenced by llvm::AlphaTargetLowering::AlphaTargetLowering(), llvm::ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(), llvm::ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(), llvm::ARMTargetLowering::ARMTargetLowering(), llvm::ScheduleDAGInstrs::BuildSchedGraph(), llvm::X86InstrInfo::convertToThreeAddress(), llvm::createPPCAsmPrinterPass(), llvm::createX86CodePrinterPass(), llvm::X86RegisterInfo::emitPrologue(), llvm::X86InstrInfo::foldMemoryOperandImpl(), llvm::PPCTargetLowering::getByValTypeAlignment(), llvm::X86RegisterInfo::getDwarfRegNum(), llvm::X86DarwinTargetAsmInfo::getEHGlobalPrefix(), llvm::PPCDarwinTargetAsmInfo::getEHGlobalPrefix(), llvm::X86InstrInfo::getGlobalBaseReg(), llvm::X86InstrInfo::getPointerRegClass(), isGVStub(), llvm::MipsTargetAsmInfo::MipsTargetAsmInfo(), llvm::MipsTargetLowering::MipsTargetLowering(), llvm::PPCTargetLowering::PerformDAGCombine(), llvm::PIC16TargetLowering::PIC16TargetLowering(), llvm::PPCTargetAsmInfo< llvm::ELFTargetAsmInfo >::PPCTargetAsmInfo(), llvm::PPCTargetLowering::PPCTargetLowering(), llvm::X86COFFTargetAsmInfo::PreferredEHDataFormat(), llvm::X86ELFTargetAsmInfo::PreferredEHDataFormat(), llvm::X86InstrInfo::restoreCalleeSavedRegisters(), llvm::SparcTargetLowering::SparcTargetLowering(), llvm::X86InstrInfo::spillCalleeSavedRegisters(), llvm::X86ATTAsmPrinter::X86ATTAsmPrinter(), llvm::X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(), llvm::X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(), X86FastISel::X86FastISel(), llvm::X86RegisterInfo::X86RegisterInfo(), llvm::X86TargetAsmInfo< llvm::TargetAsmInfo >::X86TargetAsmInfo(), and llvm::X86TargetLowering::X86TargetLowering().

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

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

Definition at line 148 of file TargetMachine.h.

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

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

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

Reimplemented in llvm::SPUTargetMachine, and llvm::PPCTargetMachine.

Definition at line 153 of file TargetMachine.h.

Referenced by llvm::ScheduleDAGSDNodes::ComputeLatency(), and llvm::ScheduleDAGInstrs::ComputeLatency().

virtual const TargetMachOWriterInfo* llvm::TargetMachine::getMachOWriterInfo (  )  const [inline, virtual]

getMachOWriterInfo - If this target supports a Mach-O writer, return information for it, otherwise return null.

Reimplemented in llvm::PPCTargetMachine.

Definition at line 160 of file TargetMachine.h.

Referenced by llvm::LLVMTargetMachine::addPassesToEmitFile().

virtual const TargetELFWriterInfo* llvm::TargetMachine::getELFWriterInfo (  )  const [inline, virtual]

getELFWriterInfo - If this target supports an ELF writer, return information for it, otherwise return null.

Reimplemented in llvm::X86TargetMachine.

Definition at line 165 of file TargetMachine.h.

Referenced by llvm::LLVMTargetMachine::addPassesToEmitFile(), and llvm::ELFWriter::doInitialization().

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

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

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

Definition at line 177 of file TargetMachine.cpp.

References llvm::RelocationModel.

Referenced by llvm::ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(), llvm::ARMTargetMachine::ARMTargetMachine(), llvm::MachOCodeEmitter::emitConstantPool(), llvm::AsmPrinter::EmitJumpTableInfo(), llvm::MachOCodeEmitter::emitJumpTables(), llvm::MipsRegisterInfo::emitPrologue(), llvm::X86InstrInfo::foldMemoryOperandImpl(), llvm::X86InstrInfo::getGlobalBaseReg(), llvm::X86InstrInfo::GetInstSizeInBytes(), llvm::X86Subtarget::GVRequiresExtraLoad(), llvm::X86Subtarget::GVRequiresRegister(), llvm::PPCSubtarget::hasLazyResolverStub(), LowerConstantPool(), LowerGlobalAddress(), LowerJumpTable(), llvm::MachineFunction::MachineFunction(), llvm::MipsSubtarget::MipsSubtarget(), llvm::PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(), llvm::PPCTargetMachine::PPCTargetMachine(), llvm::X86COFFTargetAsmInfo::PreferredEHDataFormat(), llvm::X86ELFTargetAsmInfo::PreferredEHDataFormat(), llvm::X86ATTAsmPrinter::printModuleLevelGV(), llvm::X86ATTAsmPrinter::printOperand(), llvm::X86ATTAsmPrinter::printPICJumpTableEntry(), llvm::AsmPrinter::printPICJumpTableEntry(), llvm::MipsRegisterInfo::processFunctionBeforeFrameFinalized(), llvm::DarwinTargetAsmInfo::SelectSectionForGlobal(), llvm::DarwinTargetAsmInfo::SelectSectionForMachineConst(), shouldPrintGOT(), shouldPrintPLT(), shouldPrintStub(), llvm::X86TargetMachine::symbolicAddressesAreRIPRel(), llvm::X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(), and llvm::X86TargetMachine::X86TargetMachine().

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

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

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

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

Definition at line 188 of file TargetMachine.cpp.

References llvm::CMModel.

Referenced by llvm::X86Subtarget::GVRequiresExtraLoad(), llvm::X86TargetLowering::isLegalAddressingMode(), llvm::MipsTargetMachine::MipsTargetMachine(), llvm::X86COFFTargetAsmInfo::PreferredEHDataFormat(), llvm::X86ELFTargetAsmInfo::PreferredEHDataFormat(), and llvm::X86TargetMachine::X86TargetMachine().

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

virtual bool llvm::TargetMachine::getEnableTailMergeDefault (  )  const [inline, virtual]

getEnableTailMergeDefault - the default setting for -enable-tail-merge on this target. User flag overrides.

Reimplemented in llvm::LLVMTargetMachine, and llvm::PPCTargetMachine.

Definition at line 189 of file TargetMachine.h.

virtual FileModel::Model llvm::TargetMachine::addPassesToEmitFile ( PassManagerBase ,
raw_ostream ,
CodeGenFileType  ,
bool   
) [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, though the generated code may be less efficient. This method should return FileModel::Error if emission of this file type is not supported.

Reimplemented in llvm::LLVMTargetMachine.

Definition at line 198 of file TargetMachine.h.

References llvm::FileModel::None.

virtual bool llvm::TargetMachine::addPassesToEmitFileFinish ( PassManagerBase ,
MachineCodeEmitter ,
bool   
) [inline, virtual]

addPassesToEmitFileFinish - If the passes to emit the specified file had to be split up (e.g., to add an object writer pass), this method can be used to finish up adding passes to emit the file, if necessary.

Reimplemented in llvm::LLVMTargetMachine.

Definition at line 209 of file TargetMachine.h.

virtual bool llvm::TargetMachine::addPassesToEmitMachineCode ( PassManagerBase ,
MachineCodeEmitter ,
bool   
) [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 returns true if machine code emission is not supported.

Reimplemented in llvm::LLVMTargetMachine.

Definition at line 220 of file TargetMachine.h.

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

virtual bool llvm::TargetMachine::WantsWholeFile (  )  const [inline, virtual]

addPassesToEmitWholeFile - This method can be implemented by targets that require having the entire module at once. This is not recommended, do not use this.

Reimplemented in llvm::CTargetMachine, and llvm::CPPTargetMachine.

Definition at line 229 of file TargetMachine.h.

virtual bool llvm::TargetMachine::addPassesToEmitWholeFile ( PassManager ,
raw_ostream ,
CodeGenFileType  ,
bool   
) [inline, virtual]

Reimplemented in llvm::CTargetMachine, and llvm::CPPTargetMachine.

Definition at line 230 of file TargetMachine.h.


Member Data Documentation

const TargetAsmInfo* llvm::TargetMachine::AsmInfo [mutable, protected]

AsmInfo - Contains target specific asm information.

Definition at line 88 of file TargetMachine.h.

Referenced by getTargetAsmInfo(), and ~TargetMachine().


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



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.