LLVM 22.0.0git
llvm::PPCRegisterInfo Class Reference

#include "Target/PowerPC/PPCRegisterInfo.h"

Inheritance diagram for llvm::PPCRegisterInfo:
[legend]

Public Member Functions

 PPCRegisterInfo (const PPCTargetMachine &TM)
unsigned getMappedIdxOpcForImmOpc (unsigned ImmOpcode) const
 getMappedIdxOpcForImmOpc - Return the mapped index form load/store opcode for a given imm form load/store opcode ImmFormOpcode.
const TargetRegisterClassgetPointerRegClass (unsigned Kind=0) const override
 getPointerRegClass - Return the register class to use to hold pointers.
const TargetRegisterClassgetCrossCopyRegClass (const TargetRegisterClass *RC) const override
unsigned getRegPressureLimit (const TargetRegisterClass *RC, MachineFunction &MF) const override
const TargetRegisterClassgetLargestLegalSuperClass (const TargetRegisterClass *RC, const MachineFunction &MF) const override
const MCPhysReggetCalleeSavedRegs (const MachineFunction *MF) const override
 Code Generation virtual methods...
const uint32_tgetCallPreservedMask (const MachineFunction &MF, CallingConv::ID CC) const override
const uint32_tgetNoPreservedMask () const override
void adjustStackMapLiveOutMask (uint32_t *Mask) const override
BitVector getReservedRegs (const MachineFunction &MF) const override
bool isAsmClobberable (const MachineFunction &MF, MCRegister PhysReg) const override
bool isCallerPreservedPhysReg (MCRegister PhysReg, const MachineFunction &MF) const override
bool getRegAllocationHints (Register VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const override
bool requiresRegisterScavenging (const MachineFunction &MF) const override
 We require the register scavenger.
bool requiresFrameIndexScavenging (const MachineFunction &MF) const override
bool requiresVirtualBaseRegisters (const MachineFunction &MF) const override
void lowerDynamicAlloc (MachineBasicBlock::iterator II) const
 lowerDynamicAlloc - Generate the code for allocating an object in the current frame.
void lowerDynamicAreaOffset (MachineBasicBlock::iterator II) const
void prepareDynamicAlloca (MachineBasicBlock::iterator II, Register &NegSizeReg, bool &KillNegSizeReg, Register &FramePointer) const
 To accomplish dynamic stack allocation, we have to calculate exact size subtracted from the stack pointer according alignment information and get previous frame pointer.
void lowerPrepareProbedAlloca (MachineBasicBlock::iterator II) const
void lowerCRSpilling (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerCRSpilling - Generate the code for spilling a CR register.
void lowerCRRestore (MachineBasicBlock::iterator II, unsigned FrameIndex) const
void lowerCRBitSpilling (MachineBasicBlock::iterator II, unsigned FrameIndex) const
void lowerCRBitRestore (MachineBasicBlock::iterator II, unsigned FrameIndex) const
void lowerOctWordSpilling (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 Remove any STXVP[X] instructions and split them out into a pair of STXV[X] instructions if –disable-auto-paired-vec-st is specified on the command line.
void lowerACCSpilling (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerACCSpilling - Generate the code for spilling the accumulator register.
void lowerACCRestore (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerACCRestore - Generate the code to restore the accumulator register.
void lowerWACCSpilling (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerWACCSpilling - Generate the code for spilling the wide accumulator register.
void lowerWACCRestore (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerWACCRestore - Generate the code to restore the wide accumulator register.
void lowerQuadwordSpilling (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerQuadwordSpilling - Generate code to spill paired general register.
void lowerQuadwordRestore (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerQuadwordRestore - Generate code to restore paired general register.
void lowerDMRSpilling (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerDMRSpilling - Generate the code for spilling the DMR register.
void lowerDMRRestore (MachineBasicBlock::iterator II, unsigned FrameIndex) const
 lowerDMRRestore - Generate the code to restore the DMR register.
bool hasReservedSpillSlot (const MachineFunction &MF, Register Reg, int &FrameIdx) const override
bool eliminateFrameIndex (MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
bool needsFrameBaseReg (MachineInstr *MI, int64_t Offset) const override
 Returns true if the instruction's frame index reference would be better served by a base register other than FP or SP.
Register materializeFrameBaseRegister (MachineBasicBlock *MBB, int FrameIdx, int64_t Offset) const override
 Insert defining instruction(s) for BaseReg to be a pointer to FrameIdx at the beginning of the basic block.
void resolveFrameIndex (MachineInstr &MI, Register BaseReg, int64_t Offset) const override
bool isFrameOffsetLegal (const MachineInstr *MI, Register BaseReg, int64_t Offset) const override
Register getFrameRegister (const MachineFunction &MF) const override
Register getBaseRegister (const MachineFunction &MF) const
bool hasBasePointer (const MachineFunction &MF) const
bool isNonallocatableRegisterCalleeSave (MCRegister Reg) const override
bool isVirtualFrameRegister (MCRegister Reg) const override

Static Public Member Functions

static void emitAccCopyInfo (MachineBasicBlock &MBB, MCRegister DestReg, MCRegister SrcReg)

Detailed Description

Definition at line 57 of file PPCRegisterInfo.h.

Constructor & Destructor Documentation

◆ PPCRegisterInfo()

PPCRegisterInfo::PPCRegisterInfo ( const PPCTargetMachine & TM)

Definition at line 96 of file PPCRegisterInfo.cpp.

Member Function Documentation

◆ adjustStackMapLiveOutMask()

void PPCRegisterInfo::adjustStackMapLiveOutMask ( uint32_t * Mask) const
override

Definition at line 346 of file PPCRegisterInfo.cpp.

◆ eliminateFrameIndex()

◆ emitAccCopyInfo()

void PPCRegisterInfo::emitAccCopyInfo ( MachineBasicBlock & MBB,
MCRegister DestReg,
MCRegister SrcReg )
static

Definition at line 1218 of file PPCRegisterInfo.cpp.

References llvm::dbgs(), MBB, and ReportAccMoves.

Referenced by llvm::PPCInstrInfo::copyPhysReg().

◆ getBaseRegister()

◆ getCalleeSavedRegs()

◆ getCallPreservedMask()

const uint32_t * PPCRegisterInfo::getCallPreservedMask ( const MachineFunction & MF,
CallingConv::ID CC ) const
override

◆ getCrossCopyRegClass()

const TargetRegisterClass * PPCRegisterInfo::getCrossCopyRegClass ( const TargetRegisterClass * RC) const
override

Definition at line 628 of file PPCRegisterInfo.cpp.

◆ getFrameRegister()

Register PPCRegisterInfo::getFrameRegister ( const MachineFunction & MF) const
override

Definition at line 1925 of file PPCRegisterInfo.cpp.

References llvm::TargetFrameLowering::hasFP().

Referenced by eliminateFrameIndex(), and getBaseRegister().

◆ getLargestLegalSuperClass()

◆ getMappedIdxOpcForImmOpc()

unsigned llvm::PPCRegisterInfo::getMappedIdxOpcForImmOpc ( unsigned ImmOpcode) const
inline

getMappedIdxOpcForImmOpc - Return the mapped index form load/store opcode for a given imm form load/store opcode ImmFormOpcode.

FIXME: move this to PPCInstrInfo class.

Definition at line 72 of file PPCRegisterInfo.h.

◆ getNoPreservedMask()

const uint32_t * PPCRegisterInfo::getNoPreservedMask ( ) const
override

Definition at line 342 of file PPCRegisterInfo.cpp.

◆ getPointerRegClass()

const TargetRegisterClass * PPCRegisterInfo::getPointerRegClass ( unsigned Kind = 0) const
override

getPointerRegClass - Return the register class to use to hold pointers.

This is used for addressing modes.

Definition at line 167 of file PPCRegisterInfo.cpp.

Referenced by materializeFrameBaseRegister().

◆ getRegAllocationHints()

◆ getRegPressureLimit()

◆ getReservedRegs()

◆ hasBasePointer()

bool PPCRegisterInfo::hasBasePointer ( const MachineFunction & MF) const

◆ hasReservedSpillSlot()

bool PPCRegisterInfo::hasReservedSpillSlot ( const MachineFunction & MF,
Register Reg,
int & FrameIdx ) const
override

Definition at line 1602 of file PPCRegisterInfo.cpp.

References llvm::MachineFunction::getInfo().

◆ isAsmClobberable()

bool PPCRegisterInfo::isAsmClobberable ( const MachineFunction & MF,
MCRegister PhysReg ) const
override

Definition at line 437 of file PPCRegisterInfo.cpp.

References getReservedRegs(), and llvm::BitVector::test().

◆ isCallerPreservedPhysReg()

◆ isFrameOffsetLegal()

bool PPCRegisterInfo::isFrameOffsetLegal ( const MachineInstr * MI,
Register BaseReg,
int64_t Offset ) const
override

◆ isNonallocatableRegisterCalleeSave()

bool llvm::PPCRegisterInfo::isNonallocatableRegisterCalleeSave ( MCRegister Reg) const
inlineoverride

Definition at line 189 of file PPCRegisterInfo.h.

References Reg.

◆ isVirtualFrameRegister()

bool llvm::PPCRegisterInfo::isVirtualFrameRegister ( MCRegister Reg) const
inlineoverride

Definition at line 193 of file PPCRegisterInfo.h.

References Reg.

◆ lowerACCRestore()

void PPCRegisterInfo::lowerACCRestore ( MachineBasicBlock::iterator II,
unsigned FrameIndex ) const

◆ lowerACCSpilling()

void PPCRegisterInfo::lowerACCSpilling ( MachineBasicBlock::iterator II,
unsigned FrameIndex ) const

lowerACCSpilling - Generate the code for spilling the accumulator register.

Similarly to other spills/reloads that use pseudo-ops, we do not actually eliminate the FrameIndex here nor compute the stack offset. We simply create a real instruction with an FI and rely on eliminateFrameIndex to handle the FI elimination.

Definition at line 1310 of file PPCRegisterInfo.cpp.

References llvm::addFrameReference(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), DisableAutoPairedVecSt, DL, emitAccSpillRestoreInfo(), llvm::PPCSubtarget::getInstrInfo(), llvm::getKillRegState(), llvm::MCRegisterInfo::getSubReg(), llvm::MachineFunction::getSubtarget(), II, llvm::PPCSubtarget::isLittleEndian(), MBB, MI, and TII.

Referenced by eliminateFrameIndex().

◆ lowerCRBitRestore()

◆ lowerCRBitSpilling()

◆ lowerCRRestore()

◆ lowerCRSpilling()

void PPCRegisterInfo::lowerCRSpilling ( MachineBasicBlock::iterator II,
unsigned FrameIndex ) const

lowerCRSpilling - Generate the code for spilling a CR register.

Instead of reserving a whole register (R0), we scrounge for one here. This generates code like this:

mfcr rA ; Move the conditional register into GPR rA. rlwinm rA, rA, SB, 0, 31 ; Shift the bits left so they are in CR0's slot. stw rA, FI ; Store rA to the frame.

Definition at line 956 of file PPCRegisterInfo.cpp.

References llvm::addFrameReference(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::PPCSubtarget::getInstrInfo(), llvm::getKillRegState(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), II, llvm::RegState::Kill, MBB, MI, and TII.

Referenced by eliminateFrameIndex().

◆ lowerDMRRestore()

◆ lowerDMRSpilling()

◆ lowerDynamicAlloc()

void PPCRegisterInfo::lowerDynamicAlloc ( MachineBasicBlock::iterator II) const

lowerDynamicAlloc - Generate the code for allocating an object in the current frame.

The sequence of code will be in the general form

addi R0, SP, #frameSize ; get the address of the previous frame stwxu R0, SP, Rnegsize ; add and update the SP with the negated size addi Rnew, SP, #maxCalFrameSize ; get the top of the allocation

Definition at line 736 of file PPCRegisterInfo.cpp.

References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::MachineFunction::getFrameInfo(), llvm::PPCSubtarget::getInstrInfo(), llvm::getKillRegState(), llvm::MachineFrameInfo::getMaxAlign(), llvm::MachineFrameInfo::getMaxCallFrameSize(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), II, llvm::isAligned(), llvm::RegState::Kill, MBB, MI, prepareDynamicAlloca(), and TII.

Referenced by eliminateFrameIndex().

◆ lowerDynamicAreaOffset()

◆ lowerOctWordSpilling()

void PPCRegisterInfo::lowerOctWordSpilling ( MachineBasicBlock::iterator II,
unsigned FrameIndex ) const

Remove any STXVP[X] instructions and split them out into a pair of STXV[X] instructions if –disable-auto-paired-vec-st is specified on the command line.

Definition at line 1272 of file PPCRegisterInfo.cpp.

References assert(), DisableAutoPairedVecSt, DL, llvm::PPCSubtarget::getInstrInfo(), llvm::MachineFunction::getSubtarget(), II, llvm::PPCSubtarget::isLittleEndian(), MBB, MI, and TII.

Referenced by eliminateFrameIndex().

◆ lowerPrepareProbedAlloca()

◆ lowerQuadwordRestore()

void PPCRegisterInfo::lowerQuadwordRestore ( MachineBasicBlock::iterator II,
unsigned FrameIndex ) const

lowerQuadwordRestore - Generate code to restore paired general register.

Definition at line 1487 of file PPCRegisterInfo.cpp.

References llvm::addFrameReference(), assert(), llvm::BuildMI(), DL, llvm::PPCSubtarget::getInstrInfo(), llvm::MachineFunction::getSubtarget(), II, llvm::PPCSubtarget::isLittleEndian(), MBB, MI, and TII.

Referenced by eliminateFrameIndex().

◆ lowerQuadwordSpilling()

void PPCRegisterInfo::lowerQuadwordSpilling ( MachineBasicBlock::iterator II,
unsigned FrameIndex ) const

◆ lowerWACCRestore()

◆ lowerWACCSpilling()

◆ materializeFrameBaseRegister()

Register PPCRegisterInfo::materializeFrameBaseRegister ( MachineBasicBlock * MBB,
int FrameIdx,
int64_t Offset ) const
override

Insert defining instruction(s) for BaseReg to be a pointer to FrameIdx at the beginning of the basic block.

Definition at line 2009 of file PPCRegisterInfo.cpp.

References llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), DL, llvm::PPCSubtarget::getInstrInfo(), getPointerRegClass(), llvm::MachineFunction::getSubtarget(), MBB, MRI, llvm::Offset, and TII.

◆ needsFrameBaseReg()

bool PPCRegisterInfo::needsFrameBaseReg ( MachineInstr * MI,
int64_t Offset ) const
override

Returns true if the instruction's frame index reference would be better served by a base register other than FP or SP.

Used by LocalStackFrameAllocation to determine which frame index references it should create new base registers for.

Definition at line 1964 of file PPCRegisterInfo.cpp.

References assert(), llvm::PPCFrameLowering::determineFrameLayout(), getBaseRegister(), isFrameOffsetLegal(), MBB, MI, and llvm::Offset.

◆ prepareDynamicAlloca()

◆ requiresFrameIndexScavenging()

◆ requiresRegisterScavenging()

bool llvm::PPCRegisterInfo::requiresRegisterScavenging ( const MachineFunction & MF) const
inlineoverride

We require the register scavenger.

Definition at line 119 of file PPCRegisterInfo.h.

◆ requiresVirtualBaseRegisters()

bool PPCRegisterInfo::requiresVirtualBaseRegisters ( const MachineFunction & MF) const
override

Definition at line 521 of file PPCRegisterInfo.cpp.

References llvm::MachineFunction::getSubtarget().

◆ resolveFrameIndex()

void PPCRegisterInfo::resolveFrameIndex ( MachineInstr & MI,
Register BaseReg,
int64_t Offset ) const
override

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