|
LLVM 24.0.0git
|
#include "RISCV.h"#include "RISCVSubtarget.h"#include "llvm/ADT/PostOrderIterator.h"#include "llvm/ADT/SetVector.h"#include "llvm/CodeGen/MachineDominators.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/RegisterClassInfo.h"#include "llvm/InitializePasses.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "riscv-vl-optimizer" |
| #define | PASS_NAME "RISC-V VL Optimizer" |
| #define | VSEG_CASES(Prefix, EEW) |
| #define | VSSEG_CASES(EEW) |
| #define | VSSSEG_CASES(EEW) |
| #define | VSUXSEG_CASES(EEW) |
| #define | VSOXSEG_CASES(EEW) |
Functions | |
| INITIALIZE_PASS_BEGIN (RISCVVLOptimizerLegacy, DEBUG_TYPE, PASS_NAME, false, false) FunctionPass *llvm | |
| static raw_ostream & | operator<< (raw_ostream &OS, const OperandInfo &OI) |
| static raw_ostream & | operator<< (raw_ostream &OS, const std::optional< OperandInfo > &OI) |
| static std::pair< unsigned, bool > | getEMULEqualsEEWDivSEWTimesLMUL (unsigned Log2EEW, const MachineInstr &MI) |
| Return EMUL = (EEW / SEW) * LMUL where EEW comes from Log2EEW and LMUL and SEW are from the TSFlags of MI. | |
| static DemandedVL | doubleVL (DemandedVL MinimumVL) |
| static DemandedVL | halfVL (DemandedVL MinimumVL, bool Ceil=false) |
| static std::pair< unsigned, bool > | doubleEMUL (std::pair< unsigned, bool > EMUL) |
| static std::pair< unsigned, bool > | halfEMUL (std::pair< unsigned, bool > EMUL) |
| static unsigned | getIntegerExtensionOperandEEW (unsigned Factor, const MachineInstr &MI, unsigned OpIdx) |
| Dest has EEW=SEW. | |
| static std::optional< unsigned > | getOperandLog2EEW (const MachineInstr &MI, unsigned OpIdx) |
| static std::optional< OperandInfo > | getOperandInfo (const MachineInstr &MI, unsigned OpIdx) |
| static bool | isTupleInsertInstr (const MachineInstr &MI) |
| Return true if MI is an instruction used for assembling registers for segmented store instructions, namely, RISCVISD::TUPLE_INSERT. | |
| static bool | isVectorOpUsedAsScalarOp (const MachineInstr &MI, unsigned OpIdx) |
Return true if operand OpIdx of MI is a vector operand but is used as a scalar operand. | |
| static std::optional< DemandedVL > | getMinimumVLForVSLIDEDOWN_VX (const MachineInstr &MI, unsigned OpIdx, const MachineRegisterInfo *MRI) |
| Given a vslidedown.vx like: | |
| static bool | isSegmentedStoreInstr (const MachineInstr &MI) |
| static bool | isPhysical (const MachineOperand &MO) |
| #define DEBUG_TYPE "riscv-vl-optimizer" |
Definition at line 40 of file RISCVVLOptimizer.cpp.
| #define PASS_NAME "RISC-V VL Optimizer" |
Definition at line 41 of file RISCVVLOptimizer.cpp.
| #define VSEG_CASES | ( | Prefix, | |
| EEW ) |
Definition at line 277 of file RISCVVLOptimizer.cpp.
| #define VSOXSEG_CASES | ( | EEW | ) |
Definition at line 288 of file RISCVVLOptimizer.cpp.
Referenced by getOperandLog2EEW(), and isSegmentedStoreInstr().
| #define VSSEG_CASES | ( | EEW | ) |
Definition at line 285 of file RISCVVLOptimizer.cpp.
Referenced by getOperandLog2EEW(), and isSegmentedStoreInstr().
| #define VSSSEG_CASES | ( | EEW | ) |
Definition at line 286 of file RISCVVLOptimizer.cpp.
Referenced by getOperandLog2EEW(), and isSegmentedStoreInstr().
| #define VSUXSEG_CASES | ( | EEW | ) |
Definition at line 287 of file RISCVVLOptimizer.cpp.
Referenced by getOperandLog2EEW(), and isSegmentedStoreInstr().
Definition at line 245 of file RISCVVLOptimizer.cpp.
Referenced by getOperandInfo().
|
static |
Definition at line 225 of file RISCVVLOptimizer.cpp.
References llvm::MachineOperand::CreateImm(), llvm::MachineOperand::getImm(), llvm::MachineOperand::isImm(), and llvm::isUInt().
|
static |
Return EMUL = (EEW / SEW) * LMUL where EEW comes from Log2EEW and LMUL and SEW are from the TSFlags of MI.
Definition at line 201 of file RISCVVLOptimizer.cpp.
References llvm::RISCVVType::decodeVLMUL(), llvm::RISCVII::getLMul(), llvm::RISCVII::getSEWOpNum(), and MI.
Referenced by getOperandInfo().
|
static |
Dest has EEW=SEW.
Source EEW=SEW/Factor (i.e. F2 => EEW/2). SEW comes from TSFlags of MI.
Definition at line 261 of file RISCVVLOptimizer.cpp.
References llvm::RISCVII::getSEWOpNum(), llvm::Log2_32(), and MI.
Referenced by getOperandLog2EEW().
|
static |
Given a vslidedown.vx like:
slideamt = ADDI x, -1 v = PseudoVSLIDEDOWN_VX passthru, src, slideamt, avl=1
v will only read the first slideamt + 1 lanes of src, which = x. This is a common case when lowering extractelement.
Note that if x is 0, slideamt will be all ones. In this case src will be completely slid down and none of its lanes will be read (since slideamt is greater than the largest VLMAX of 65536) so we can demand any minimum VL.
Definition at line 1105 of file RISCVVLOptimizer.cpp.
References llvm::MachineOperand::getImm(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::RISCV::getRVVMCOpcode(), llvm::MachineOperand::isImm(), llvm::Register::isVirtual(), MI, and MRI.
|
static |
Definition at line 925 of file RISCVVLOptimizer.cpp.
References assert(), doubleEMUL(), getEMULEqualsEEWDivSEWTimesLMUL(), getOperandLog2EEW(), halfEMUL(), MI, and llvm::RVV.
|
static |
Dest EEW encoded in the instruction
Definition at line 290 of file RISCVVLOptimizer.cpp.
References assert(), getIntegerExtensionOperandEEW(), llvm::RISCVII::getSEWOpNum(), llvm::RISCVII::isFirstDefTiedToFirstUse(), llvm::RISCVII::isTiedPseudo(), llvm_unreachable, MI, llvm::MCOI::OPERAND_REGISTER, llvm::RVV, VSOXSEG_CASES, VSSEG_CASES, VSSSEG_CASES, and VSUXSEG_CASES.
Referenced by getOperandInfo().
Definition at line 252 of file RISCVVLOptimizer.cpp.
Referenced by getOperandInfo().
|
static |
Definition at line 235 of file RISCVVLOptimizer.cpp.
References llvm::MachineOperand::CreateImm(), llvm::MachineOperand::getImm(), llvm::MachineOperand::isImm(), and llvm::isUInt().
| INITIALIZE_PASS_BEGIN | ( | RISCVVLOptimizerLegacy | , |
| DEBUG_TYPE | , | ||
| PASS_NAME | , | ||
| false | , | ||
| false | ) |
Definition at line 173 of file RISCVVLOptimizer.cpp.
References llvm::createRISCVVLOptimizerLegacyPass(), DEBUG_TYPE, INITIALIZE_PASS_DEPENDENCY, INITIALIZE_PASS_END, and PASS_NAME.
|
static |
Definition at line 1390 of file RISCVVLOptimizer.cpp.
References llvm::MachineOperand::getReg(), llvm::Register::isPhysical(), and llvm::MachineOperand::isReg().
Referenced by llvm::PPCInstrInfo::canInsertSelect(), llvm::MachineOperand::isRenamable(), llvm::MachineOperand::print(), and llvm::MachineOperand::setIsRenamable().
|
static |
Definition at line 1216 of file RISCVVLOptimizer.cpp.
References llvm::RISCV::getRVVMCOpcode(), MI, VSOXSEG_CASES, VSSEG_CASES, VSSSEG_CASES, and VSUXSEG_CASES.
|
static |
Return true if MI is an instruction used for assembling registers for segmented store instructions, namely, RISCVISD::TUPLE_INSERT.
Currently it's lowered to INSERT_SUBREG.
Definition at line 1195 of file RISCVVLOptimizer.cpp.
References assert(), llvm::RISCVVType::decodeVLMUL(), llvm::RISCVRI::getLMul(), llvm::RISCVRI::getNF(), llvm::RISCVRI::isVRegClass(), MI, MRI, llvm::RISCV::RVVBitsPerBlock, TRI, and llvm::MCRegisterClass::TSFlags.
|
static |
Return true if operand OpIdx of MI is a vector operand but is used as a scalar operand.
Definition at line 1014 of file RISCVVLOptimizer.cpp.
|
static |
Definition at line 183 of file RISCVVLOptimizer.cpp.
|
static |
Definition at line 189 of file RISCVVLOptimizer.cpp.