#include "RISCV.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVSubtarget.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/InitializePasses.h"
usingnamespacellvm;
#define DEBUG_TYPE …
#define PASS_NAME …
namespace {
class RISCVVLOptimizer : public MachineFunctionPass { … };
}
char RISCVVLOptimizer::ID = …;
INITIALIZE_PASS_BEGIN(RISCVVLOptimizer, DEBUG_TYPE, PASS_NAME, false, false)
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
INITIALIZE_PASS_END(RISCVVLOptimizer, DEBUG_TYPE, PASS_NAME, false, false)
FunctionPass *llvm::createRISCVVLOptimizerPass() { … }
static bool isVectorRegClass(Register R, const MachineRegisterInfo *MRI) { … }
struct OperandInfo { … };
LLVM_ATTRIBUTE_UNUSED
static raw_ostream &operator<<(raw_ostream &OS, const OperandInfo &OI) { … }
namespace llvm {
namespace RISCVVType {
static RISCVII::VLMUL twoTimesVLMUL(RISCVII::VLMUL VLMul) { … }
static std::pair<unsigned, bool>
getEMULEqualsEEWDivSEWTimesLMUL(unsigned Log2EEW, const MachineInstr &MI) { … }
}
}
static OperandInfo getIntegerExtensionOperandInfo(unsigned Factor,
const MachineInstr &MI,
const MachineOperand &MO) { … }
static bool isMaskOperand(const MachineInstr &MI, const MachineOperand &MO,
const MachineRegisterInfo *MRI) { … }
static OperandInfo getOperandInfo(const MachineInstr &MI,
const MachineOperand &MO,
const MachineRegisterInfo *MRI) { … }
static bool isSupportedInstr(const MachineInstr &MI) { … }
static bool isVectorOpUsedAsScalarOp(MachineOperand &MO) { … }
static bool mayReadPastVL(const MachineInstr &MI) { … }
bool RISCVVLOptimizer::isCandidate(const MachineInstr &MI) const { … }
bool RISCVVLOptimizer::checkUsers(std::optional<Register> &CommonVL,
MachineInstr &MI) { … }
bool RISCVVLOptimizer::tryReduceVL(MachineInstr &OrigMI) { … }
bool RISCVVLOptimizer::runOnMachineFunction(MachineFunction &MF) { … }