LLVM API Documentation

llvm::SparcV9RegInfo Class Reference

#include <SparcV9RegInfo.h>

Collaboration diagram for llvm::SparcV9RegInfo:

Collaboration graph
[legend]
List of all members.

Public Types

 IntRegType
 FPSingleRegType
 FPDoubleRegType
 IntCCRegType
 FloatCCRegType
 SpecialRegType
 IntRegClassID
 FloatRegClassID
 IntCCRegClassID
 FloatCCRegClassID
 SpecialRegClassID
enum  RegTypes {
  IntRegType, FPSingleRegType, FPDoubleRegType, IntCCRegType,
  FloatCCRegType, SpecialRegType
}
enum  RegClassIDs {
  IntRegClassID, FloatRegClassID, IntCCRegClassID, FloatCCRegClassID,
  SpecialRegClassID
}

Public Member Functions

unsigned getRegClassIDOfType (const Type *type, bool isCCReg=false) const
unsigned getRegClassIDOfRegType (int regType) const
unsigned getRegClassIDOfReg (int unifiedRegNum) const
unsigned int getNumOfRegClasses () const
const TargetRegClassInfogetMachineRegClass (unsigned i) const
unsigned getZeroRegNum () const
void suggestRegs4MethodArgs (const Function *Func, LiveRangeInfo &LRI) const
void suggestRegs4CallArgs (MachineInstr *CallI, LiveRangeInfo &LRI) const
void suggestReg4RetValue (MachineInstr *RetI, LiveRangeInfo &LRI) const
void colorMethodArgs (const Function *Func, LiveRangeInfo &LRI, std::vector< MachineInstr * > &InstrnsBefore, std::vector< MachineInstr * > &InstrnsAfter) const
bool isRegVolatile (int RegClassID, int Reg) const
bool modifiedByCall (int RegClassID, int Reg) const
unsigned getCallAddressReg () const
int getUnifiedRegNum (unsigned regClassID, int reg) const
int getClassRegNum (int uRegNum, unsigned &regClassID) const
const char *const getUnifiedRegName (int UnifiedRegNum) const
int getSpilledRegSize (int RegType) const
 SparcV9RegInfo (const SparcV9TargetMachine &tgt)
 ~SparcV9RegInfo ()
unsigned getReturnAddressReg () const
unsigned const getNumOfIntArgRegs () const
unsigned const getNumOfFloatArgRegs () const
int regNumForIntArg (bool inCallee, bool isVarArgsCall, unsigned argNo, unsigned &regClassId) const
int regNumForFPArg (unsigned RegType, bool inCallee, bool isVarArgsCall, unsigned argNo, unsigned &regClassId) const
void printReg (const V9LiveRange *LR) const
const ValuegetCallInstRetVal (const MachineInstr *CallMI) const
const ValuegetCallInstIndirectAddrVal (const MachineInstr *CallMI) const
bool regTypeNeedsScratchReg (int RegType, int &scratchRegClassId) const
void cpReg2RegMI (std::vector< MachineInstr * > &mvec, unsigned SrcReg, unsigned DestReg, int RegType) const
void cpReg2MemMI (std::vector< MachineInstr * > &mvec, unsigned SrcReg, unsigned DestPtrReg, int Offset, int RegType, int scratchReg=-1) const
void cpMem2RegMI (std::vector< MachineInstr * > &mvec, unsigned SrcPtrReg, int Offset, unsigned DestReg, int RegType, int scratchReg=-1) const
void cpValue2Value (Value *Src, Value *Dest, std::vector< MachineInstr * > &mvec) const
int getRegTypeForDataType (const Type *type) const
int getRegTypeForLR (const V9LiveRange *LR) const
int getRegType (int unifiedRegNum) const
unsigned getFramePointer () const
unsigned getStackPointer () const

Static Public Member Functions

static int getInvalidRegNum ()

Public Attributes

const TargetMachinetarget

Protected Attributes

std::vector< const TargetRegClassInfo * > MachineRegClassArr

Detailed Description

SparcV9RegInfo - Interface to register info of SparcV9 target machine

Definition at line 106 of file SparcV9RegInfo.h.


Member Enumeration Documentation

enum llvm::SparcV9RegInfo::RegClassIDs

Enumerator:
IntRegClassID 
FloatRegClassID 
IntCCRegClassID 
FloatCCRegClassID 
SpecialRegClassID 

Definition at line 289 of file SparcV9RegInfo.h.

enum llvm::SparcV9RegInfo::RegTypes

Enumerator:
IntRegType 
FPSingleRegType 
FPDoubleRegType 
IntCCRegType 
FloatCCRegType 
SpecialRegType 

Definition at line 274 of file SparcV9RegInfo.h.


Constructor & Destructor Documentation

llvm::SparcV9RegInfo::SparcV9RegInfo ( const SparcV9TargetMachine tgt  ) 

Definition at line 39 of file SparcV9RegInfo.cpp.

References FloatCCRegClassID, FloatRegClassID, IntCCRegClassID, IntRegClassID, MachineRegClassArr, SpecialRegClassID, and llvm::SparcV9FloatRegClass::StartOfNonVolatileRegs.

llvm::SparcV9RegInfo::~SparcV9RegInfo (  )  [inline]

Definition at line 299 of file SparcV9RegInfo.h.

References MachineRegClassArr.


Member Function Documentation

void llvm::SparcV9RegInfo::colorMethodArgs ( const Function Func,
LiveRangeInfo LRI,
std::vector< MachineInstr * > &  InstrnsBefore,
std::vector< MachineInstr * > &  InstrnsAfter 
) const

Definition at line 401 of file SparcV9RegInfo.cpp.

References llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::BadRegClass, cpMem2RegMI(), cpReg2MemMI(), cpReg2RegMI(), E, FloatRegClassID, FPSingleRegType, llvm::MachineFunction::get(), llvm::TargetMachine::getFrameInfo(), getFramePointer(), llvm::TargetFrameInfo::getIncomingArgOffset(), llvm::MachineFunction::getInfo(), getInvalidRegNum(), llvm::LiveRangeInfo::getLiveRangeForValue(), getRegTypeForLR(), getSpilledRegSize(), llvm::TargetMachine::getTargetData(), llvm::GlobalValue::getType(), llvm::TargetData::getTypeSize(), getUnifiedRegNum(), I, IntRegClassID, IntRegType, llvm::isVarArgsFunction(), regNumForFPArg(), regNumForIntArg(), llvm::SparcV9FrameInfo::SizeOfEachArgOnStack, and target.

void llvm::SparcV9RegInfo::cpMem2RegMI ( std::vector< MachineInstr * > &  mvec,
unsigned  PtrReg,
int  Offset,
unsigned  DestReg,
int  RegType,
int  scratchReg = -1 
) const

cpMem2RegMI - Generate SparcV9 MachineInstrs to load a register (DestReg) from memory, at [PtrReg + Offset]. Register numbers must be the unified register numbers. RegType must be the SparcV9 register type of DestReg. When DestReg is ccr, scratchReg must be the number of a free integer register. The newly-generated MachineInstrs are appended to mvec.

Definition at line 836 of file SparcV9RegInfo.cpp.

References llvm::MachineInstrBuilder::addMReg(), llvm::MachineInstrBuilder::addSImm(), llvm::MachineInstrBuilder::addZImm(), llvm::BuildMI(), llvm::SparcV9::ccr, llvm::TargetInstrInfo::constantFitsInImmedField(), llvm::MachineOperand::Def, FloatCCRegType, FPDoubleRegType, FPSingleRegType, llvm::SparcV9::fsr, llvm::SparcV9::g0, llvm::SparcV9::g4, llvm::TargetMachine::getInstrInfo(), llvm::MachineInstr::getOperand(), getRegType(), IntCCRegType, IntRegType, llvm::MachineOperand::markHi32(), llvm::MachineOperand::markLo32(), MI, SpecialRegType, and target.

Referenced by colorMethodArgs().

void llvm::SparcV9RegInfo::cpReg2MemMI ( std::vector< MachineInstr * > &  mvec,
unsigned  SrcReg,
unsigned  PtrReg,
int  Offset,
int  RegType,
int  scratchReg = -1 
) const

cpReg2MemMI - Generate SparcV9 MachineInstrs to store a register (SrcReg) to memory, at [PtrReg + Offset]. Register numbers must be the unified register numbers. RegType must be the SparcV9 register type of SrcReg. When SrcReg is ccr, scratchReg must be the number of a free integer register. The newly-generated MachineInstrs are appended to mvec.

Definition at line 754 of file SparcV9RegInfo.cpp.

References llvm::MachineInstrBuilder::addMReg(), llvm::MachineInstrBuilder::addSImm(), llvm::MachineInstrBuilder::addZImm(), llvm::BuildMI(), llvm::SparcV9::ccr, llvm::TargetInstrInfo::constantFitsInImmedField(), llvm::MachineOperand::Def, FloatCCRegType, FPDoubleRegType, FPSingleRegType, llvm::SparcV9::fsr, llvm::SparcV9::g4, llvm::TargetMachine::getInstrInfo(), llvm::MachineInstr::getOperand(), getRegType(), IntCCRegType, IntRegType, llvm::MachineOperand::markHi32(), llvm::MachineOperand::markLo32(), MI, SpecialRegType, and target.

Referenced by colorMethodArgs().

void llvm::SparcV9RegInfo::cpReg2RegMI ( std::vector< MachineInstr * > &  mvec,
unsigned  SrcReg,
unsigned  DestReg,
int  RegType 
) const

Definition at line 687 of file SparcV9RegInfo.cpp.

References llvm::MachineInstrBuilder::addMReg(), llvm::BuildMI(), llvm::SparcV9IntCCRegClass::ccr, llvm::MachineOperand::Def, FloatCCRegType, FPDoubleRegType, FPSingleRegType, llvm::SparcV9IntRegClass::g0, getInvalidRegNum(), getRegType(), getUnifiedRegNum(), getZeroRegNum(), IntCCRegClassID, IntCCRegType, IntRegType, and MI.

Referenced by colorMethodArgs().

void llvm::SparcV9RegInfo::cpValue2Value ( Value Src,
Value Dest,
std::vector< MachineInstr * > &  mvec 
) const

Definition at line 922 of file SparcV9RegInfo.cpp.

References llvm::MachineInstrBuilder::addMReg(), llvm::MachineInstrBuilder::addReg(), llvm::MachineInstrBuilder::addRegDef(), llvm::BuildMI(), Dest, FPDoubleRegType, FPSingleRegType, getRegTypeForDataType(), getZeroRegNum(), IntRegType, MI, and Src.

unsigned llvm::SparcV9RegInfo::getCallAddressReg (  )  const

Definition at line 64 of file SparcV9RegInfo.cpp.

References getUnifiedRegNum(), IntRegClassID, and llvm::SparcV9IntRegClass::o7.

const Value* llvm::SparcV9RegInfo::getCallInstIndirectAddrVal ( const MachineInstr CallMI  )  const

const Value* llvm::SparcV9RegInfo::getCallInstRetVal ( const MachineInstr CallMI  )  const

int llvm::SparcV9RegInfo::getClassRegNum ( int  uRegNum,
unsigned &  regClassID 
) const [inline]

Definition at line 210 of file SparcV9RegInfo.h.

References getInvalidRegNum(), getNumOfRegClasses(), and MachineRegClassArr.

Referenced by llvm::LiveRangeInfo::constructLiveRanges(), getRegClassIDOfReg(), getUnifiedRegName(), and llvm::markRegisterUsed().

unsigned llvm::SparcV9RegInfo::getFramePointer (  )  const

Definition at line 138 of file SparcV9RegInfo.cpp.

References getUnifiedRegNum(), llvm::SparcV9IntRegClass::i6, and IntRegClassID.

Referenced by colorMethodArgs().

static int llvm::SparcV9RegInfo::getInvalidRegNum (  )  [inline, static]

Definition at line 120 of file SparcV9RegInfo.h.

Referenced by colorMethodArgs(), cpReg2RegMI(), getClassRegNum(), getUnifiedRegNum(), regNumForFPArg(), regNumForIntArg(), suggestRegs4CallArgs(), and suggestRegs4MethodArgs().

const TargetRegClassInfo* llvm::SparcV9RegInfo::getMachineRegClass ( unsigned  i  )  const [inline]

Definition at line 148 of file SparcV9RegInfo.h.

References MachineRegClassArr.

Referenced by llvm::PhyRegAlloc::runOnFunction().

unsigned const llvm::SparcV9RegInfo::getNumOfFloatArgRegs (  )  const [inline]

Definition at line 314 of file SparcV9RegInfo.h.

unsigned const llvm::SparcV9RegInfo::getNumOfIntArgRegs (  )  const [inline]

Definition at line 313 of file SparcV9RegInfo.h.

unsigned int llvm::SparcV9RegInfo::getNumOfRegClasses (  )  const [inline]

Definition at line 144 of file SparcV9RegInfo.h.

References MachineRegClassArr.

Referenced by getClassRegNum(), getUnifiedRegName(), and getUnifiedRegNum().

unsigned llvm::SparcV9RegInfo::getRegClassIDOfReg ( int  unifiedRegNum  )  const [inline]

Definition at line 138 of file SparcV9RegInfo.h.

References getClassRegNum().

unsigned llvm::SparcV9RegInfo::getRegClassIDOfRegType ( int  regType  )  const

Definition at line 297 of file SparcV9RegInfo.cpp.

References FloatCCRegClassID, FloatCCRegType, FloatRegClassID, FPDoubleRegType, FPSingleRegType, IntCCRegClassID, IntCCRegType, IntRegClassID, IntRegType, SpecialRegClassID, and SpecialRegType.

unsigned llvm::SparcV9RegInfo::getRegClassIDOfType ( const Type type,
bool  isCCReg = false 
) const

Definition at line 274 of file SparcV9RegInfo.cpp.

References llvm::Type::DoubleTyID, FloatRegClassID, llvm::Type::FunctionTyID, llvm::Type::getTypeID(), IntRegClassID, llvm::Type::LabelTyID, llvm::Type::LongTyID, and llvm::Type::PointerTyID.

Referenced by getRegTypeForDataType().

int llvm::SparcV9RegInfo::getRegType ( int  unifiedRegNum  )  const

Definition at line 252 of file SparcV9RegInfo.cpp.

References FloatCCRegType, FPDoubleRegType, FPSingleRegType, IntCCRegType, IntRegType, and SpecialRegType.

Referenced by cpMem2RegMI(), cpReg2MemMI(), and cpReg2RegMI().

int llvm::SparcV9RegInfo::getRegTypeForDataType ( const Type type  )  const

Definition at line 242 of file SparcV9RegInfo.cpp.

References getRegClassIDOfType().

Referenced by cpValue2Value().

int llvm::SparcV9RegInfo::getRegTypeForLR ( const V9LiveRange LR  )  const

Definition at line 247 of file SparcV9RegInfo.cpp.

References llvm::V9LiveRange::getRegClassID(), and llvm::V9LiveRange::getType().

Referenced by llvm::LiveRangeInfo::coalesceLRs(), colorMethodArgs(), suggestRegs4CallArgs(), and suggestRegs4MethodArgs().

unsigned llvm::SparcV9RegInfo::getReturnAddressReg (  )  const

Definition at line 73 of file SparcV9RegInfo.cpp.

References getUnifiedRegNum(), llvm::SparcV9IntRegClass::i7, and IntRegClassID.

int llvm::SparcV9RegInfo::getSpilledRegSize ( int  RegType  )  const [inline]

Definition at line 244 of file SparcV9RegInfo.h.

Referenced by colorMethodArgs().

unsigned llvm::SparcV9RegInfo::getStackPointer (  )  const

Definition at line 144 of file SparcV9RegInfo.cpp.

References getUnifiedRegNum(), IntRegClassID, and llvm::SparcV9IntRegClass::o6.

const char* const llvm::SparcV9RegInfo::getUnifiedRegName ( int  UnifiedRegNum  )  const [inline]

Definition at line 230 of file SparcV9RegInfo.h.

References getClassRegNum(), getNumOfRegClasses(), and MachineRegClassArr.

Referenced by printReg().

int llvm::SparcV9RegInfo::getUnifiedRegNum ( unsigned  regClassID,
int  reg 
) const [inline]

Definition at line 199 of file SparcV9RegInfo.h.

References getInvalidRegNum(), getNumOfRegClasses(), and MachineRegClassArr.

Referenced by colorMethodArgs(), cpReg2RegMI(), getCallAddressReg(), getFramePointer(), getReturnAddressReg(), getStackPointer(), getZeroRegNum(), and printReg().

unsigned llvm::SparcV9RegInfo::getZeroRegNum (  )  const

Definition at line 56 of file SparcV9RegInfo.cpp.

References llvm::SparcV9IntRegClass::g0, getUnifiedRegNum(), and IntRegClassID.

Referenced by cpReg2RegMI(), cpValue2Value(), and llvm::IsUselessCopy().

bool llvm::SparcV9RegInfo::isRegVolatile ( int  RegClassID,
int  Reg 
) const [inline]

Definition at line 178 of file SparcV9RegInfo.h.

References MachineRegClassArr.

bool llvm::SparcV9RegInfo::modifiedByCall ( int  RegClassID,
int  Reg 
) const [inline]

Definition at line 184 of file SparcV9RegInfo.h.

References MachineRegClassArr.

void llvm::SparcV9RegInfo::printReg ( const V9LiveRange LR  )  const

Definition at line 951 of file SparcV9RegInfo.cpp.

References llvm::Type::DoubleTy, FloatRegClassID, llvm::V9LiveRange::getColor(), llvm::V9LiveRange::getRegClassID(), llvm::V9LiveRange::getType(), getUnifiedRegName(), getUnifiedRegNum(), and llvm::V9LiveRange::hasColor().

int llvm::SparcV9RegInfo::regNumForFPArg ( unsigned  RegType,
bool  inCallee,
bool  isVarArgsCall,
unsigned  argNo,
unsigned &  regClassId 
) const

Definition at line 197 of file SparcV9RegInfo.cpp.

References llvm::SparcV9FloatRegClass::f0, FloatRegClassID, FPDoubleRegType, FPSingleRegType, getInvalidRegNum(), and regNumForIntArg().

Referenced by colorMethodArgs(), suggestRegs4CallArgs(), and suggestRegs4MethodArgs().

int llvm::SparcV9RegInfo::regNumForIntArg ( bool  inCallee,
bool  isVarArgsCall,
unsigned  argNo,
unsigned &  regClassId 
) const

Definition at line 178 of file SparcV9RegInfo.cpp.

References getInvalidRegNum(), llvm::SparcV9IntRegClass::i0, IntRegClassID, and llvm::SparcV9IntRegClass::o0.

Referenced by colorMethodArgs(), regNumForFPArg(), suggestRegs4CallArgs(), and suggestRegs4MethodArgs().

bool llvm::SparcV9RegInfo::regTypeNeedsScratchReg ( int  RegType,
int &  scratchRegClassId 
) const

Definition at line 670 of file SparcV9RegInfo.cpp.

References IntCCRegType, and IntRegType.

void llvm::SparcV9RegInfo::suggestReg4RetValue ( MachineInstr RetI,
LiveRangeInfo LRI 
) const

Definition at line 642 of file SparcV9RegInfo.cpp.

References llvm::SparcV9FloatRegClass::f0, llvm::TargetMachine::getInstrInfo(), llvm::LiveRangeInfo::getLiveRangeForValue(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::ReturnInst::getReturnValue(), llvm::MachineOperand::getVRegValue(), llvm::SparcV9IntRegClass::i0, IntRegClassID, llvm::TargetInstrInfo::isReturn(), and target.

void llvm::SparcV9RegInfo::suggestRegs4CallArgs ( MachineInstr CallI,
LiveRangeInfo LRI 
) const

Definition at line 574 of file SparcV9RegInfo.cpp.

References llvm::BadRegClass, llvm::SparcV9FloatRegClass::f0, FloatRegClassID, llvm::CallArgsDescriptor::get(), llvm::CallArgsDescriptor::getArgInfo(), llvm::CallArgInfo::getArgVal(), llvm::TargetMachine::getInstrInfo(), getInvalidRegNum(), llvm::LiveRangeInfo::getLiveRangeForValue(), llvm::CallArgsDescriptor::getNumArgs(), llvm::MachineInstr::getOpcode(), getRegTypeForLR(), llvm::CallArgsDescriptor::getReturnValue(), IntRegClassID, IntRegType, llvm::SparcV9IntRegClass::o0, regNumForFPArg(), regNumForIntArg(), llvm::V9LiveRange::setSuggestedColor(), and target.

void llvm::SparcV9RegInfo::suggestRegs4MethodArgs ( const Function Func,
LiveRangeInfo LRI 
) const

Definition at line 368 of file SparcV9RegInfo.cpp.

References llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::BadRegClass, E, getInvalidRegNum(), llvm::LiveRangeInfo::getLiveRangeForValue(), getRegTypeForLR(), llvm::GlobalValue::getType(), I, IntRegType, llvm::isVarArgsFunction(), regNumForFPArg(), and regNumForIntArg().

Referenced by llvm::LiveRangeInfo::constructLiveRanges().


Member Data Documentation

std::vector<const TargetRegClassInfo *> llvm::SparcV9RegInfo::MachineRegClassArr [protected]

Definition at line 112 of file SparcV9RegInfo.h.

Referenced by getClassRegNum(), getMachineRegClass(), getNumOfRegClasses(), getUnifiedRegName(), getUnifiedRegNum(), isRegVolatile(), modifiedByCall(), SparcV9RegInfo(), and ~SparcV9RegInfo().

const TargetMachine& llvm::SparcV9RegInfo::target

Definition at line 115 of file SparcV9RegInfo.h.

Referenced by colorMethodArgs(), cpMem2RegMI(), cpReg2MemMI(), suggestReg4RetValue(), and suggestRegs4CallArgs().


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