|
LLVM 24.0.0git
|
#include "RISCV.h"#include "llvm/ADT/Statistic.h"#include "llvm/CodeGen/MachineFunctionAnalysisManager.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachinePassManager.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/RegisterClassInfo.h"#include "llvm/CodeGen/TargetInstrInfo.h"#include "llvm/CodeGen/TargetRegisterInfo.h"#include "llvm/IR/Analysis.h"#include "llvm/Support/Debug.h"#include <optional>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 |
| #define DEBUG_TYPE "riscv-redundant-copy-elimination" |
Definition at line 43 of file RISCVRedundantCopyElimination.cpp.
| assert | ( | TBB ! | = nullptr &&"Expected branch target basic block" | ) |
References TBB.
Referenced by guaranteesRegEqualsImmInBlock(), and optimizeBlockForRedundantCopies().
|
static |
Definition at line 127 of file RISCVRedundantCopyElimination.cpp.
References I, llvm::RegImmPair::Imm, matchRegKnownVal(), MBB, MI, llvm::RegImmPair::Reg, Reg, and TRI.
Referenced by optimizeBlockForRedundantCopies().
|
static |
Definition at line 93 of file RISCVRedundantCopyElimination.cpp.
References assert(), Cond, llvm::getImm(), MBB, Opc, and TBB.
Referenced by optimizeBlockForRedundantCopies().
| INITIALIZE_PASS | ( | RISCVRedundantCopyEliminationLegacy | , |
| "riscv-copyelim" | , | ||
| "RISC-V Redundant Copy Elimination" | , | ||
| false | , | ||
| false | ) & |
References MBB.
|
static |
Definition at line 112 of file RISCVRedundantCopyElimination.cpp.
Referenced by getRegImmediateBeforeTerminator(), and optimizeBlockForRedundantCopies().
|
static |
Definition at line 146 of file RISCVRedundantCopyElimination.cpp.
References assert(), Changed, Cond, llvm::dbgs(), E(), llvm::MachineBasicBlock::getFirstTerminator(), getReg(), getRegImmediateBeforeTerminator(), guaranteesRegEqualsImmInBlock(), I, Imm, llvm::RegImmPair::Imm, LLVM_DEBUG, llvm::make_range(), matchRegKnownVal(), MBB, MI, MRI, llvm::RegImmPair::Reg, llvm::MachineBasicBlock::succ_size(), TBB, TII, and TRI.
Referenced by runRedundantCopyElimination().
|
static |
Definition at line 261 of file RISCVRedundantCopyElimination.cpp.
References Changed, llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), MBB, MRI, optimizeBlockForRedundantCopies(), TII, and TRI.
Referenced by llvm::RISCVRedundantCopyEliminationPass::run().
| STATISTIC | ( | NumCopiesRemoved | , |
| "Number of copies removed." | ) |
| const SmallVectorImpl<MachineOperand>& Cond |
Definition at line 78 of file RISCVRedundantCopyElimination.cpp.
| return false |
Definition at line 89 of file RISCVRedundantCopyElimination.cpp.
| auto Opc = Cond[0].getImm() |
Definition at line 82 of file RISCVRedundantCopyElimination.cpp.
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().