LLVM 20.0.0git
Public Member Functions | Protected Member Functions | List of all members
llvm::SystemZInstrInfo Class Reference

#include "Target/SystemZ/SystemZInstrInfo.h"

Inheritance diagram for llvm::SystemZInstrInfo:
Inheritance graph
[legend]

Public Member Functions

 SystemZInstrInfo (SystemZSubtarget &STI)
 
Register isLoadFromStackSlot (const MachineInstr &MI, int &FrameIndex) const override
 
Register isStoreToStackSlot (const MachineInstr &MI, int &FrameIndex) const override
 
bool isStackSlotCopy (const MachineInstr &MI, int &DestFrameIndex, int &SrcFrameIndex) const override
 
bool analyzeBranch (MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
 
unsigned removeBranch (MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
 
unsigned insertBranch (MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
 
bool analyzeCompare (const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &Mask, int64_t &Value) const override
 
bool canInsertSelect (const MachineBasicBlock &, ArrayRef< MachineOperand > Cond, Register, Register, Register, int &, int &, int &) const override
 
void insertSelect (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DstReg, ArrayRef< MachineOperand > Cond, Register TrueReg, Register FalseReg) const override
 
MachineInstroptimizeLoadInstr (MachineInstr &MI, const MachineRegisterInfo *MRI, Register &FoldAsLoadDefReg, MachineInstr *&DefMI) const override
 
bool foldImmediate (MachineInstr &UseMI, MachineInstr &DefMI, Register Reg, MachineRegisterInfo *MRI) const override
 
bool isPredicable (const MachineInstr &MI) const override
 
bool isProfitableToIfCvt (MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
 
bool isProfitableToIfCvt (MachineBasicBlock &TMBB, unsigned NumCyclesT, unsigned ExtraPredCyclesT, MachineBasicBlock &FMBB, unsigned NumCyclesF, unsigned ExtraPredCyclesF, BranchProbability Probability) const override
 
bool isProfitableToDupForIfCvt (MachineBasicBlock &MBB, unsigned NumCycles, BranchProbability Probability) const override
 
bool PredicateInstruction (MachineInstr &MI, ArrayRef< MachineOperand > Pred) const override
 
void copyPhysReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc) const override
 
void storeRegToStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg) const override
 
void loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIdx, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg) const override
 
MachineInstrconvertToThreeAddress (MachineInstr &MI, LiveVariables *LV, LiveIntervals *LIS) const override
 
bool useMachineCombiner () const override
 
bool isAssociativeAndCommutative (const MachineInstr &Inst, bool Invert) const override
 
std::optional< unsignedgetInverseOpcode (unsigned Opcode) const override
 
MachineInstrfoldMemoryOperandImpl (MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const override
 
MachineInstrfoldMemoryOperandImpl (MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, MachineInstr &LoadMI, LiveIntervals *LIS=nullptr) const override
 
bool expandPostRAPseudo (MachineInstr &MBBI) const override
 
bool reverseBranchCondition (SmallVectorImpl< MachineOperand > &Cond) const override
 
const SystemZRegisterInfogetRegisterInfo () const
 
unsigned getInstSizeInBytes (const MachineInstr &MI) const override
 
SystemZII::Branch getBranchInfo (const MachineInstr &MI) const
 
void getLoadStoreOpcodes (const TargetRegisterClass *RC, unsigned &LoadOpcode, unsigned &StoreOpcode) const
 
unsigned getOpcodeForOffset (unsigned Opcode, int64_t Offset, const MachineInstr *MI=nullptr) const
 
bool hasDisplacementPairInsn (unsigned Opcode) const
 
unsigned getLoadAndTest (unsigned Opcode) const
 
bool isRxSBGMask (uint64_t Mask, unsigned BitSize, unsigned &Start, unsigned &End) const
 
unsigned getFusedCompare (unsigned Opcode, SystemZII::FusedCompareType Type, const MachineInstr *MI=nullptr) const
 
bool prepareCompareSwapOperands (MachineBasicBlock::iterator MBBI) const
 
unsigned getLoadAndTrap (unsigned Opcode) const
 
void loadImmediate (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned Reg, uint64_t Value) const
 
bool verifyInstruction (const MachineInstr &MI, StringRef &ErrInfo) const override
 
bool areMemAccessesTriviallyDisjoint (const MachineInstr &MIa, const MachineInstr &MIb) const override
 
bool getConstValDefinedInReg (const MachineInstr &MI, const Register Reg, int64_t &ImmVal) const override
 

Protected Member Functions

MachineInstrcommuteInstructionImpl (MachineInstr &MI, bool NewMI, unsigned CommuteOpIdx1, unsigned CommuteOpIdx2) const override
 Commutes the operands in the given instruction by changing the operands order and/or changing the instruction's opcode and/or the immediate value operand.
 

Detailed Description

Definition at line 185 of file SystemZInstrInfo.h.

Constructor & Destructor Documentation

◆ SystemZInstrInfo()

SystemZInstrInfo::SystemZInstrInfo ( SystemZSubtarget STI)
explicit

Definition at line 61 of file SystemZInstrInfo.cpp.

Member Function Documentation

◆ analyzeBranch()

bool SystemZInstrInfo::analyzeBranch ( MachineBasicBlock MBB,
MachineBasicBlock *&  TBB,
MachineBasicBlock *&  FBB,
SmallVectorImpl< MachineOperand > &  Cond,
bool  AllowModify 
) const
override

◆ analyzeCompare()

bool SystemZInstrInfo::analyzeCompare ( const MachineInstr MI,
Register SrcReg,
Register SrcReg2,
int64_t &  Mask,
int64_t &  Value 
) const
override

Definition at line 533 of file SystemZInstrInfo.cpp.

References assert(), and MI.

◆ areMemAccessesTriviallyDisjoint()

bool SystemZInstrInfo::areMemAccessesTriviallyDisjoint ( const MachineInstr MIa,
const MachineInstr MIb 
) const
override

◆ canInsertSelect()

bool SystemZInstrInfo::canInsertSelect ( const MachineBasicBlock MBB,
ArrayRef< MachineOperand Cond,
Register  DstReg,
Register  TrueReg,
Register  FalseReg,
int &  CondCycles,
int &  TrueCycles,
int &  FalseCycles 
) const
override

◆ commuteInstructionImpl()

MachineInstr * SystemZInstrInfo::commuteInstructionImpl ( MachineInstr MI,
bool  NewMI,
unsigned  CommuteOpIdx1,
unsigned  CommuteOpIdx2 
) const
overrideprotected

Commutes the operands in the given instruction by changing the operands order and/or changing the instruction's opcode and/or the immediate value operand.

The arguments 'CommuteOpIdx1' and 'CommuteOpIdx2' specify the operands to be commuted.

Do not call this method for a non-commutable instruction or non-commutable operands. Even though the instruction is commutable, the method may still fail to commute the operands, null pointer is returned in such cases.

Definition at line 290 of file SystemZInstrInfo.cpp.

References llvm::TargetInstrInfo::commuteInstructionImpl(), and MI.

◆ convertToThreeAddress()

MachineInstr * SystemZInstrInfo::convertToThreeAddress ( MachineInstr MI,
LiveVariables LV,
LiveIntervals LIS 
) const
override

◆ copyPhysReg()

void SystemZInstrInfo::copyPhysReg ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MBBI,
const DebugLoc DL,
MCRegister  DestReg,
MCRegister  SrcReg,
bool  KillSrc 
) const
override

◆ expandPostRAPseudo()

bool SystemZInstrInfo::expandPostRAPseudo ( MachineInstr MBBI) const
override

Definition at line 1602 of file SystemZInstrInfo.cpp.

References llvm::get(), llvm::SystemZ::isHighReg(), and MI.

◆ foldImmediate()

bool SystemZInstrInfo::foldImmediate ( MachineInstr UseMI,
MachineInstr DefMI,
Register  Reg,
MachineRegisterInfo MRI 
) const
override

◆ foldMemoryOperandImpl() [1/2]

MachineInstr * SystemZInstrInfo::foldMemoryOperandImpl ( MachineFunction MF,
MachineInstr MI,
ArrayRef< unsigned Ops,
MachineBasicBlock::iterator  InsertPt,
int  FrameIndex,
LiveIntervals LIS = nullptr,
VirtRegMap VRM = nullptr 
) const
override

Definition at line 1189 of file SystemZInstrInfo.cpp.

References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addReg(), llvm::MachineInstr::addRegisterDead(), assert(), llvm::BuildMI(), contains(), llvm::LiveRange::createDeadDef(), llvm::MachineInstr::definesRegister(), llvm::MachineInstr::findRegisterDefOperand(), llvm::MCRegister::from(), llvm::get(), llvm::SystemZII::getAccessSize(), llvm::MachineFunction::getFrameInfo(), llvm::SlotIndexes::getInstructionIndex(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineFrameInfo::getObjectSize(), llvm::VirtRegMap::getPhys(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::SlotIndex::getRegSlot(), llvm::LiveIntervals::getRegUnit(), llvm::MachineMemOperand::getSize(), llvm::LiveIntervals::getSlotIndexes(), llvm::MachineFunction::getSubtarget(), llvm::SystemZ::getTargetMemOpcode(), llvm::LiveIntervals::getVNInfoAllocator(), llvm::SystemZII::HasIndex, I, llvm::MachineMemOperand::isAtomic(), isSimpleBD12Move(), llvm::Register::isVirtual(), llvm::MachineMemOperand::isVolatile(), llvm::LiveRange::liveAt(), MI, MRI, llvm::MachineInstr::NoFPExcept, llvm::MachineInstr::NoSWrap, llvm::Offset, llvm::MCOI::OPERAND_REGISTER, llvm::MachineInstr::operands(), llvm::MCInstrDesc::operands(), llvm::MCOperandInfo::OperandType, prepareCompareSwapOperands(), llvm::range_size(), llvm::MCOperandInfo::RegClass, llvm::MachineOperand::setIsDead(), llvm::SystemZII::SimpleBDXLoad, llvm::SystemZII::SimpleBDXStore, llvm::ArrayRef< T >::size(), Size, transferDeadCC(), transferMIFlag(), TRI, and llvm::MCInstrDesc::TSFlags.

◆ foldMemoryOperandImpl() [2/2]

MachineInstr * SystemZInstrInfo::foldMemoryOperandImpl ( MachineFunction MF,
MachineInstr MI,
ArrayRef< unsigned Ops,
MachineBasicBlock::iterator  InsertPt,
MachineInstr LoadMI,
LiveIntervals LIS = nullptr 
) const
override

◆ getBranchInfo()

SystemZII::Branch SystemZInstrInfo::getBranchInfo ( const MachineInstr MI) const

◆ getConstValDefinedInReg()

bool SystemZInstrInfo::getConstValDefinedInReg ( const MachineInstr MI,
const Register  Reg,
int64_t &  ImmVal 
) const
override

Definition at line 2295 of file SystemZInstrInfo.cpp.

References MI.

◆ getFusedCompare()

unsigned SystemZInstrInfo::getFusedCompare ( unsigned  Opcode,
SystemZII::FusedCompareType  Type,
const MachineInstr MI = nullptr 
) const

◆ getInstSizeInBytes()

unsigned SystemZInstrInfo::getInstSizeInBytes ( const MachineInstr MI) const
override

◆ getInverseOpcode()

std::optional< unsigned > SystemZInstrInfo::getInverseOpcode ( unsigned  Opcode) const
override

Definition at line 1160 of file SystemZInstrInfo.cpp.

Referenced by isAssociativeAndCommutative().

◆ getLoadAndTest()

unsigned SystemZInstrInfo::getLoadAndTest ( unsigned  Opcode) const

Definition at line 1946 of file SystemZInstrInfo.cpp.

◆ getLoadAndTrap()

unsigned SystemZInstrInfo::getLoadAndTrap ( unsigned  Opcode) const

Definition at line 2187 of file SystemZInstrInfo.cpp.

◆ getLoadStoreOpcodes()

void SystemZInstrInfo::getLoadStoreOpcodes ( const TargetRegisterClass RC,
unsigned LoadOpcode,
unsigned StoreOpcode 
) const

Definition at line 1850 of file SystemZInstrInfo.cpp.

References llvm_unreachable.

Referenced by loadRegFromStackSlot(), and storeRegToStackSlot().

◆ getOpcodeForOffset()

unsigned SystemZInstrInfo::getOpcodeForOffset ( unsigned  Opcode,
int64_t  Offset,
const MachineInstr MI = nullptr 
) const

◆ getRegisterInfo()

const SystemZRegisterInfo & llvm::SystemZInstrInfo::getRegisterInfo ( ) const
inline

Definition at line 314 of file SystemZInstrInfo.h.

Referenced by llvm::SystemZSubtarget::getRegisterInfo().

◆ hasDisplacementPairInsn()

bool SystemZInstrInfo::hasDisplacementPairInsn ( unsigned  Opcode) const

◆ insertBranch()

unsigned SystemZInstrInfo::insertBranch ( MachineBasicBlock MBB,
MachineBasicBlock TBB,
MachineBasicBlock FBB,
ArrayRef< MachineOperand Cond,
const DebugLoc DL,
int *  BytesAdded = nullptr 
) const
override

◆ insertSelect()

void SystemZInstrInfo::insertSelect ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
const DebugLoc DL,
Register  DstReg,
ArrayRef< MachineOperand Cond,
Register  TrueReg,
Register  FalseReg 
) const
override

◆ isAssociativeAndCommutative()

bool SystemZInstrInfo::isAssociativeAndCommutative ( const MachineInstr Inst,
bool  Invert 
) const
override

◆ isLoadFromStackSlot()

Register SystemZInstrInfo::isLoadFromStackSlot ( const MachineInstr MI,
int &  FrameIndex 
) const
override

Definition at line 338 of file SystemZInstrInfo.cpp.

References isSimpleMove(), MI, and llvm::SystemZII::SimpleBDXLoad.

◆ isPredicable()

bool SystemZInstrInfo::isPredicable ( const MachineInstr MI) const
override

Definition at line 757 of file SystemZInstrInfo.cpp.

References MI.

◆ isProfitableToDupForIfCvt()

bool SystemZInstrInfo::isProfitableToDupForIfCvt ( MachineBasicBlock MBB,
unsigned  NumCycles,
BranchProbability  Probability 
) const
override

Definition at line 797 of file SystemZInstrInfo.cpp.

◆ isProfitableToIfCvt() [1/2]

bool SystemZInstrInfo::isProfitableToIfCvt ( MachineBasicBlock MBB,
unsigned  NumCycles,
unsigned  ExtraPredCycles,
BranchProbability  Probability 
) const
override

◆ isProfitableToIfCvt() [2/2]

bool SystemZInstrInfo::isProfitableToIfCvt ( MachineBasicBlock TMBB,
unsigned  NumCyclesT,
unsigned  ExtraPredCyclesT,
MachineBasicBlock FMBB,
unsigned  NumCyclesF,
unsigned  ExtraPredCyclesF,
BranchProbability  Probability 
) const
override

Definition at line 787 of file SystemZInstrInfo.cpp.

◆ isRxSBGMask()

bool SystemZInstrInfo::isRxSBGMask ( uint64_t  Mask,
unsigned  BitSize,
unsigned Start,
unsigned End 
) const

Definition at line 1970 of file SystemZInstrInfo.cpp.

References allOnes(), assert(), End, llvm::isShiftedMask_64(), and llvm::Length.

Referenced by convertToThreeAddress().

◆ isStackSlotCopy()

bool SystemZInstrInfo::isStackSlotCopy ( const MachineInstr MI,
int &  DestFrameIndex,
int &  SrcFrameIndex 
) const
override

Definition at line 348 of file SystemZInstrInfo.cpp.

References llvm::MachineFrameInfo::getObjectSize(), llvm::Length, and MI.

◆ isStoreToStackSlot()

Register SystemZInstrInfo::isStoreToStackSlot ( const MachineInstr MI,
int &  FrameIndex 
) const
override

Definition at line 343 of file SystemZInstrInfo.cpp.

References isSimpleMove(), MI, and llvm::SystemZII::SimpleBDXStore.

◆ loadImmediate()

void SystemZInstrInfo::loadImmediate ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MBBI,
unsigned  Reg,
uint64_t  Value 
) const

◆ loadRegFromStackSlot()

void SystemZInstrInfo::loadRegFromStackSlot ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MBBI,
Register  DestReg,
int  FrameIdx,
const TargetRegisterClass RC,
const TargetRegisterInfo TRI,
Register  VReg 
) const
override

◆ optimizeLoadInstr()

MachineInstr * SystemZInstrInfo::optimizeLoadInstr ( MachineInstr MI,
const MachineRegisterInfo MRI,
Register FoldAsLoadDefReg,
MachineInstr *&  DefMI 
) const
override

Definition at line 626 of file SystemZInstrInfo.cpp.

References assert(), DefMI, llvm::MachineInstr::isSafeToMove(), MI, and MRI.

◆ PredicateInstruction()

bool SystemZInstrInfo::PredicateInstruction ( MachineInstr MI,
ArrayRef< MachineOperand Pred 
) const
override

◆ prepareCompareSwapOperands()

bool SystemZInstrInfo::prepareCompareSwapOperands ( MachineBasicBlock::iterator  MBBI) const

◆ removeBranch()

unsigned SystemZInstrInfo::removeBranch ( MachineBasicBlock MBB,
int *  BytesRemoved = nullptr 
) const
override

◆ reverseBranchCondition()

bool SystemZInstrInfo::reverseBranchCondition ( SmallVectorImpl< MachineOperand > &  Cond) const
override

Definition at line 487 of file SystemZInstrInfo.cpp.

References assert(), and Cond.

◆ storeRegToStackSlot()

void SystemZInstrInfo::storeRegToStackSlot ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MBBI,
Register  SrcReg,
bool  isKill,
int  FrameIndex,
const TargetRegisterClass RC,
const TargetRegisterInfo TRI,
Register  VReg 
) const
override

◆ useMachineCombiner()

bool llvm::SystemZInstrInfo::useMachineCombiner ( ) const
inlineoverride

Definition at line 294 of file SystemZInstrInfo.h.

◆ verifyInstruction()

bool SystemZInstrInfo::verifyInstruction ( const MachineInstr MI,
StringRef ErrInfo 
) const
override

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