LLVM 22.0.0git
Macros | Functions
RISCVVLOptimizer.cpp File Reference
#include "RISCV.h"
#include "RISCVSubtarget.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.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"
 

Functions

static LLVM_ATTRIBUTE_UNUSED raw_ostreamoperator<< (raw_ostream &OS, const OperandInfo &OI)
 
static LLVM_ATTRIBUTE_UNUSED raw_ostreamoperator<< (raw_ostream &OS, const std::optional< OperandInfo > &OI)
 
static std::pair< unsigned, boolgetEMULEqualsEEWDivSEWTimesLMUL (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 unsigned getIntegerExtensionOperandEEW (unsigned Factor, const MachineInstr &MI, const MachineOperand &MO)
 Dest has EEW=SEW.
 
static std::optional< unsignedgetOperandLog2EEW (const MachineOperand &MO, const MachineRegisterInfo *MRI)
 
static std::optional< OperandInfo > getOperandInfo (const MachineOperand &MO, const MachineRegisterInfo *MRI)
 
static bool isSupportedInstr (const MachineInstr &MI)
 Return true if this optimization should consider MI for VL reduction.
 
static bool isVectorOpUsedAsScalarOp (const MachineOperand &MO)
 Return true if MO is a vector operand but is used as a scalar operand.
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "riscv-vl-optimizer"

Definition at line 28 of file RISCVVLOptimizer.cpp.

◆ PASS_NAME

#define PASS_NAME   "RISC-V VL Optimizer"

Definition at line 29 of file RISCVVLOptimizer.cpp.

Function Documentation

◆ getEMULEqualsEEWDivSEWTimesLMUL()

static std::pair< unsigned, bool > getEMULEqualsEEWDivSEWTimesLMUL ( unsigned  Log2EEW,
const MachineInstr MI 
)
static

Return EMUL = (EEW / SEW) * LMUL where EEW comes from Log2EEW and LMUL and SEW are from the TSFlags of MI.

Definition at line 139 of file RISCVVLOptimizer.cpp.

References llvm::RISCVVType::decodeVLMUL(), llvm::RISCVII::getLMul(), llvm::RISCVII::getSEWOpNum(), and MI.

Referenced by getOperandInfo().

◆ getIntegerExtensionOperandEEW()

static unsigned getIntegerExtensionOperandEEW ( unsigned  Factor,
const MachineInstr MI,
const MachineOperand MO 
)
static

Dest has EEW=SEW.

Source EEW=SEW/Factor (i.e. F2 => EEW/2). SEW comes from TSFlags of MI.

Definition at line 165 of file RISCVVLOptimizer.cpp.

References llvm::MachineOperand::getOperandNo(), llvm::RISCVII::getSEWOpNum(), llvm::Log2_32(), and MI.

Referenced by getOperandLog2EEW().

◆ getOperandInfo()

static std::optional< OperandInfo > getOperandInfo ( const MachineOperand MO,
const MachineRegisterInfo MRI 
)
static

◆ getOperandLog2EEW()

static std::optional< unsigned > getOperandLog2EEW ( const MachineOperand MO,
const MachineRegisterInfo MRI 
)
static

◆ isSupportedInstr()

static bool isSupportedInstr ( const MachineInstr MI)
static

Return true if this optimization should consider MI for VL reduction.

This white-list approach simplifies this optimization for instructions that may have more complex semantics with relation to how it uses VL.

Definition at line 823 of file RISCVVLOptimizer.cpp.

References MI, and llvm::RVV.

◆ isVectorOpUsedAsScalarOp()

static bool isVectorOpUsedAsScalarOp ( const MachineOperand MO)
static

Return true if MO is a vector operand but is used as a scalar operand.

Definition at line 1234 of file RISCVVLOptimizer.cpp.

References llvm::MachineOperand::getOperandNo(), llvm::MachineOperand::getParent(), MI, and llvm::RVV.

◆ operator<<() [1/2]

static LLVM_ATTRIBUTE_UNUSED raw_ostream & operator<< ( raw_ostream OS,
const OperandInfo &  OI 
)
static

Definition at line 121 of file RISCVVLOptimizer.cpp.

References OS.

◆ operator<<() [2/2]

static LLVM_ATTRIBUTE_UNUSED raw_ostream & operator<< ( raw_ostream OS,
const std::optional< OperandInfo > &  OI 
)
static

Definition at line 127 of file RISCVVLOptimizer.cpp.

References OS.