LLVM 24.0.0git
RISCVRedundantCopyElimination.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "riscv-redundant-copy-elimination"

Functions

 STATISTIC (NumCopiesRemoved, "Number of copies removed.")
 INITIALIZE_PASS (RISCVRedundantCopyEliminationLegacy, "riscv-copyelim", "RISC-V Redundant Copy Elimination", false, false) static bool guaranteesZeroRegInBlock(MachineBasicBlock &MBB
 assert (TBB !=nullptr &&"Expected branch target basic block")
 if (Opc==RISCV::BEQ &&Cond[2].isReg() &&Cond[2].getReg()==RISCV::X0 &&TBB==&MBB) return true
static bool guaranteesRegEqualsImmInBlock (MachineBasicBlock &MBB, const SmallVectorImpl< MachineOperand > &Cond, MachineBasicBlock *TBB)
static RegImmPair matchRegKnownVal (const MachineInstr &MI)
static std::optional< int64_t > getRegImmediateBeforeTerminator (MachineBasicBlock &MBB, Register Reg, const TargetRegisterInfo *TRI)
static bool optimizeBlockForRedundantCopies (MachineBasicBlock &MBB, const MachineRegisterInfo *MRI, const TargetRegisterInfo *TRI, const TargetInstrInfo *TII)
static bool runRedundantCopyElimination (MachineFunction &MF)

Variables

const SmallVectorImpl< MachineOperand > & Cond
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
auto Opc = Cond[0].getImm()
return false

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "riscv-redundant-copy-elimination"

Definition at line 43 of file RISCVRedundantCopyElimination.cpp.

Function Documentation

◆ assert()

assert ( TBB ! = nullptr &&"Expected branch target basic block")

◆ getRegImmediateBeforeTerminator()

std::optional< int64_t > getRegImmediateBeforeTerminator ( MachineBasicBlock & MBB,
Register Reg,
const TargetRegisterInfo * TRI )
static

◆ guaranteesRegEqualsImmInBlock()

bool guaranteesRegEqualsImmInBlock ( MachineBasicBlock & MBB,
const SmallVectorImpl< MachineOperand > & Cond,
MachineBasicBlock * TBB )
static

Definition at line 93 of file RISCVRedundantCopyElimination.cpp.

References assert(), Cond, llvm::getImm(), MBB, Opc, and TBB.

Referenced by optimizeBlockForRedundantCopies().

◆ if()

if ( Opc = =RISCV::BEQ &&Cond[2].isReg() &&Cond[2].getReg()==RISCV::X0 &&TBB==&MBB)

References Cond, MBB, Opc, and TBB.

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( RISCVRedundantCopyEliminationLegacy ,
"riscv-copyelim" ,
"RISC-V Redundant Copy Elimination" ,
false ,
false  ) &

References MBB.

◆ matchRegKnownVal()

RegImmPair matchRegKnownVal ( const MachineInstr & MI)
static

◆ optimizeBlockForRedundantCopies()

◆ runRedundantCopyElimination()

◆ STATISTIC()

STATISTIC ( NumCopiesRemoved ,
"Number of copies removed."  )

Variable Documentation

◆ Cond

◆ false

return false

Definition at line 89 of file RISCVRedundantCopyElimination.cpp.

◆ Opc

auto Opc = Cond[0].getImm()

Definition at line 82 of file RISCVRedundantCopyElimination.cpp.

◆ TBB

Initial value:
{
assert(Cond.size() == 3 && "Unexpected number of operands")
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
SmallVector< MachineOperand, 4 > Cond

Definition at line 79 of file RISCVRedundantCopyElimination.cpp.

Referenced by llvm::MipsInstrInfo::adjustStackPtr(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::ARCInstrInfo::analyzeBranch(), llvm::ARMBaseInstrInfo::analyzeBranch(), llvm::AVRInstrInfo::analyzeBranch(), llvm::BPFInstrInfo::analyzeBranch(), llvm::CSKYInstrInfo::analyzeBranch(), llvm::HexagonInstrInfo::analyzeBranch(), llvm::LoongArchInstrInfo::analyzeBranch(), llvm::M68kInstrInfo::analyzeBranch(), llvm::MipsInstrInfo::analyzeBranch(), llvm::MipsInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::NVPTXInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::R600InstrInfo::analyzeBranch(), llvm::RISCVInstrInfo::analyzeBranch(), llvm::SIInstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::SPIRVInstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::TargetInstrInfo::analyzeBranch(), llvm::TargetInstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::WebAssemblyInstrInfo::analyzeBranch(), llvm::X86InstrInfo::analyzeBranch(), llvm::XCoreInstrInfo::analyzeBranch(), llvm::XtensaInstrInfo::analyzeBranch(), llvm::M68kInstrInfo::AnalyzeBranchImpl(), llvm::SIInstrInfo::analyzeBranchImpl(), llvm::AArch64InstrInfo::analyzeBranchPredicate(), llvm::AArch64InstrInfo::analyzeLoopForPipelining(), llvm::RISCVInstrInfo::analyzeLoopForPipelining(), llvm::SIInstrInfo::analyzeLoopForPipelining(), assert(), llvm::MachineBasicBlock::canSplitCriticalEdge(), createDedicatedExit(), llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), llvm::SelectionDAGBuilder::EmitBranchForMergedCondition(), llvm::SelectionDAGBuilder::FindMergedConditions(), FixTail(), getBBFallenThrough(), getBranchHint(), llvm::MachineBasicBlock::getFallThrough(), getFallThroughMBB(), guaranteesRegEqualsImmInBlock(), if(), if(), if(), if(), if(), INITIALIZE_PASS(), llvm::AArch64InstrInfo::insertBranch(), llvm::ARCInstrInfo::insertBranch(), llvm::ARMBaseInstrInfo::insertBranch(), llvm::AVRInstrInfo::insertBranch(), llvm::BPFInstrInfo::insertBranch(), llvm::CSKYInstrInfo::insertBranch(), llvm::HexagonInstrInfo::insertBranch(), llvm::LoongArchInstrInfo::insertBranch(), llvm::M68kInstrInfo::insertBranch(), llvm::MipsInstrInfo::insertBranch(), llvm::MSP430InstrInfo::insertBranch(), llvm::NVPTXInstrInfo::insertBranch(), llvm::PPCInstrInfo::insertBranch(), llvm::R600InstrInfo::insertBranch(), llvm::RISCVInstrInfo::insertBranch(), llvm::SIInstrInfo::insertBranch(), llvm::SparcInstrInfo::insertBranch(), llvm::SPIRVInstrInfo::insertBranch(), llvm::SystemZInstrInfo::insertBranch(), llvm::TargetInstrInfo::insertBranch(), llvm::VEInstrInfo::insertBranch(), llvm::WebAssemblyInstrInfo::insertBranch(), llvm::X86InstrInfo::insertBranch(), llvm::XCoreInstrInfo::insertBranch(), llvm::XtensaInstrInfo::insertBranch(), llvm::XtensaInstrInfo::insertBranchAtInst(), isAnalyzableBB(), llvm::ARMBaseInstrInfo::isProfitableToIfCvt(), optimizeBlockForRedundantCopies(), llvm::AArch64InstrInfo::optimizeCondBranch(), llvm::RISCVInstrInfo::optimizeCondBranch(), llvm::PeelSingleBlockLoop(), STATISTIC(), switch(), updateBranches(), and llvm::MachineBasicBlock::updateTerminator().