LLVM 20.0.0git
|
#include "RISCVInstrInfo.h"
#include "MCTargetDesc/RISCVBaseInfo.h"
#include "MCTargetDesc/RISCVMatInt.h"
#include "RISCV.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVSubtarget.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineCombinerPattern.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/MachineTraceMetrics.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCInstBuilder.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/ErrorHandling.h"
#include "RISCVGenCompressInstEmitter.inc"
#include "RISCVGenInstrInfo.inc"
#include "RISCVGenSearchableTables.inc"
Go to the source code of this file.
Namespaces | |
namespace | llvm |
This is an optimization pass for GlobalISel generic memory operations. | |
namespace | llvm::RISCVVPseudosTable |
namespace | llvm::RISCV |
Enumerations | |
enum | MachineOutlinerConstructionID { MachineOutlinerTailCall , MachineOutlinerDefault } |
Variables | |
static cl::opt< bool > | PreferWholeRegisterMove ("riscv-prefer-whole-register-move", cl::init(false), cl::Hidden, cl::desc("Prefer whole register move for vector registers.")) |
static cl::opt< MachineTraceStrategy > | ForceMachineCombinerStrategy ("riscv-force-machine-combiner-strategy", cl::Hidden, cl::desc("Force machine combiner to use a specific strategy for machine " "trace metrics evaluation."), cl::init(MachineTraceStrategy::TS_NumStrategies), cl::values(clEnumValN(MachineTraceStrategy::TS_Local, "local", "Local strategy."), clEnumValN(MachineTraceStrategy::TS_MinInstrCount, "min-instr", "MinInstrCount strategy."))) |
#define CASE_FP_WIDEOP_CHANGE_OPCODE_COMMON | ( | OP, | |
LMUL, | |||
SEW | |||
) |
Definition at line 3741 of file RISCVInstrInfo.cpp.
#define CASE_FP_WIDEOP_CHANGE_OPCODE_LMULS | ( | OP | ) | CASE_FP_WIDEOP_CHANGE_OPCODE_LMULS_MF4(OP) |
Definition at line 3757 of file RISCVInstrInfo.cpp.
#define CASE_FP_WIDEOP_CHANGE_OPCODE_LMULS_MF4 | ( | OP | ) |
Definition at line 3746 of file RISCVInstrInfo.cpp.
Definition at line 3727 of file RISCVInstrInfo.cpp.
#define CASE_FP_WIDEOP_OPCODE_LMULS_MF4 | ( | OP | ) |
Definition at line 3730 of file RISCVInstrInfo.cpp.
#define CASE_OPERAND_UIMM | ( | NUM | ) |
#define CASE_RVV_OPCODE | ( | OP | ) |
Definition at line 3277 of file RISCVInstrInfo.cpp.
#define CASE_RVV_OPCODE_LMUL | ( | OP, | |
LMUL | |||
) |
Definition at line 3245 of file RISCVInstrInfo.cpp.
#define CASE_RVV_OPCODE_MASK | ( | OP | ) |
Definition at line 3269 of file RISCVInstrInfo.cpp.
Definition at line 3242 of file RISCVInstrInfo.cpp.
#define CASE_RVV_OPCODE_MASK_WIDEN | ( | OP | ) |
Definition at line 3261 of file RISCVInstrInfo.cpp.
#define CASE_RVV_OPCODE_UNMASK | ( | OP | ) |
Definition at line 3257 of file RISCVInstrInfo.cpp.
Definition at line 3239 of file RISCVInstrInfo.cpp.
#define CASE_RVV_OPCODE_UNMASK_WIDEN | ( | OP | ) |
Definition at line 3249 of file RISCVInstrInfo.cpp.
#define CASE_RVV_OPCODE_WIDEN | ( | OP | ) |
Definition at line 3273 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_CHANGE_OPCODE_COMMON | ( | OLDOP, | |
NEWOP, | |||
TYPE, | |||
LMUL, | |||
SEW | |||
) |
#define CASE_VFMA_CHANGE_OPCODE_LMULS | ( | OLDOP, | |
NEWOP, | |||
TYPE, | |||
SEW | |||
) |
Definition at line 3549 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_CHANGE_OPCODE_LMULS_M1 | ( | OLDOP, | |
NEWOP, | |||
TYPE, | |||
SEW | |||
) |
Definition at line 3530 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_CHANGE_OPCODE_LMULS_MF2 | ( | OLDOP, | |
NEWOP, | |||
TYPE, | |||
SEW | |||
) |
Definition at line 3536 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_CHANGE_OPCODE_LMULS_MF4 | ( | OLDOP, | |
NEWOP, | |||
TYPE, | |||
SEW | |||
) |
Definition at line 3545 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_CHANGE_OPCODE_SPLATS | ( | OLDOP, | |
NEWOP | |||
) |
Definition at line 3553 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_CHANGE_OPCODE_VV | ( | OLDOP, | |
NEWOP | |||
) |
Definition at line 3540 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_OPCODE_COMMON | ( | OP, | |
TYPE, | |||
LMUL, | |||
SEW | |||
) | RISCV::PseudoV##OP##_##TYPE##_##LMUL##_##SEW |
Definition at line 3305 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_OPCODE_LMULS_M1 | ( | OP, | |
TYPE, | |||
SEW | |||
) |
Definition at line 3308 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_OPCODE_LMULS_MF2 | ( | OP, | |
TYPE, | |||
SEW | |||
) |
Definition at line 3314 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_OPCODE_LMULS_MF4 | ( | OP, | |
TYPE, | |||
SEW | |||
) |
Definition at line 3318 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_OPCODE_VV | ( | OP | ) |
Definition at line 3322 of file RISCVInstrInfo.cpp.
#define CASE_VFMA_SPLATS | ( | OP | ) |
Definition at line 3327 of file RISCVInstrInfo.cpp.
#define CASE_VMA_CHANGE_OPCODE_COMMON | ( | OLDOP, | |
NEWOP, | |||
TYPE, | |||
LMUL | |||
) |
#define CASE_VMA_CHANGE_OPCODE_LMULS | ( | OLDOP, | |
NEWOP, | |||
TYPE | |||
) |
Definition at line 3515 of file RISCVInstrInfo.cpp.
#define CASE_VMA_CHANGE_OPCODE_LMULS_M1 | ( | OLDOP, | |
NEWOP, | |||
TYPE | |||
) |
Definition at line 3501 of file RISCVInstrInfo.cpp.
#define CASE_VMA_CHANGE_OPCODE_LMULS_MF2 | ( | OLDOP, | |
NEWOP, | |||
TYPE | |||
) |
Definition at line 3507 of file RISCVInstrInfo.cpp.
#define CASE_VMA_CHANGE_OPCODE_LMULS_MF4 | ( | OLDOP, | |
NEWOP, | |||
TYPE | |||
) |
Definition at line 3511 of file RISCVInstrInfo.cpp.
#define CASE_VMA_CHANGE_OPCODE_SPLATS | ( | OLDOP, | |
NEWOP | |||
) |
Definition at line 3519 of file RISCVInstrInfo.cpp.
Definition at line 3283 of file RISCVInstrInfo.cpp.
#define CASE_VMA_OPCODE_LMULS | ( | OP, | |
TYPE | |||
) |
Definition at line 3300 of file RISCVInstrInfo.cpp.
#define CASE_VMA_OPCODE_LMULS_M1 | ( | OP, | |
TYPE | |||
) |
Definition at line 3286 of file RISCVInstrInfo.cpp.
#define CASE_VMA_OPCODE_LMULS_MF2 | ( | OP, | |
TYPE | |||
) |
Definition at line 3292 of file RISCVInstrInfo.cpp.
#define CASE_VMA_OPCODE_LMULS_MF4 | ( | OP, | |
TYPE | |||
) |
Definition at line 3296 of file RISCVInstrInfo.cpp.
#define CASE_WIDEOP_CHANGE_OPCODE_COMMON | ( | OP, | |
LMUL | |||
) |
#define CASE_WIDEOP_CHANGE_OPCODE_LMULS | ( | OP | ) |
Definition at line 3722 of file RISCVInstrInfo.cpp.
#define CASE_WIDEOP_CHANGE_OPCODE_LMULS_MF4 | ( | OP | ) |
Definition at line 3715 of file RISCVInstrInfo.cpp.
Definition at line 3696 of file RISCVInstrInfo.cpp.
#define CASE_WIDEOP_OPCODE_LMULS | ( | OP | ) |
Definition at line 3706 of file RISCVInstrInfo.cpp.
#define CASE_WIDEOP_OPCODE_LMULS_MF4 | ( | OP | ) |
Definition at line 3699 of file RISCVInstrInfo.cpp.
#define GEN_CHECK_COMPRESS_INSTR |
Definition at line 39 of file RISCVInstrInfo.cpp.
#define GET_INSTRINFO_CTOR_DTOR |
Definition at line 42 of file RISCVInstrInfo.cpp.
#define GET_INSTRINFO_NAMED_OPS |
Definition at line 43 of file RISCVInstrInfo.cpp.
#define GET_RISCVMaskedPseudosTable_IMPL |
Definition at line 71 of file RISCVInstrInfo.cpp.
#define GET_RISCVVPseudosTable_IMPL |
Definition at line 64 of file RISCVInstrInfo.cpp.
#define OPCODE_LMUL_CASE | ( | OPC | ) |
#define OPCODE_LMUL_MASK_CASE | ( | OPC | ) |
#define RVV_OPC_LMUL_CASE | ( | OPC, | |
INV | |||
) |
#define RVV_OPC_LMUL_MASK_CASE | ( | OPC, | |
INV | |||
) |
Enumerator | |
---|---|
MachineOutlinerTailCall | |
MachineOutlinerDefault |
Definition at line 2959 of file RISCVInstrInfo.cpp.
|
static |
Definition at line 3010 of file RISCVInstrInfo.cpp.
References assert(), llvm::CallingConv::C, cannotInsertTailCall(), MachineOutlinerDefault, MachineOutlinerTailCall, MI, and TRI.
Referenced by llvm::RISCVInstrInfo::getOutliningCandidateInfo().
|
static |
Utility routine that checks if.
MO | is defined by an |
CombineOpc | instruction in the basic block |
MBB |
Definition at line 2171 of file RISCVInstrInfo.cpp.
References llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineOperand::isReg(), llvm::Register::isVirtual(), MBB, MI, and MRI.
|
static |
Definition at line 2113 of file RISCVInstrInfo.cpp.
References llvm::MachineInstr::FmContract, llvm::MachineInstr::getFlag(), llvm::MachineInstr::getMF(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::RISCV::hasEqualFRM(), isFMUL(), llvm::MachineOperand::isReg(), llvm::Register::isVirtual(), MI, and MRI.
Referenced by getFPFusedMultiplyPatterns().
|
static |
Utility routine that checks if.
MO | is defined by a SLLI in |
MBB | that can be combined by splitting across 2 SHXADD instructions. The first SHXADD shift amount is given by |
OuterShiftAmt. |
Definition at line 2192 of file RISCVInstrInfo.cpp.
References canCombine(), llvm::MachineOperand::getImm(), llvm::MachineInstr::getOperand(), and MBB.
Referenced by getSHXADDPatterns().
|
static |
Identify instructions that can be folded into a CCMOV instruction, and return the defining instruction.
Definition at line 1403 of file RISCVInstrInfo.cpp.
References llvm::drop_begin(), getPredicatedOpcode(), MI, and MRI.
Referenced by llvm::RISCVInstrInfo::optimizeSelect().
|
static |
Definition at line 2988 of file RISCVInstrInfo.cpp.
References llvm::MachineBasicBlock::back(), llvm::MCSubtargetInfo::getFeatureBits(), llvm::MachineBasicBlock::getParent(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::RISCVII::getTailExpandUseRegNo(), isCandidatePatchable(), isMIModifiesReg(), isMIReadsReg(), llvm::MachineInstr::isReturn(), MBB, and MI.
Referenced by analyzeCandidate(), and llvm::RISCVInstrInfo::getOutliningTypeImpl().
|
static |
Definition at line 2309 of file RISCVInstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), getAddendOperandIdx(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getFlags(), getFPFusedMultiplyOpcode(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::getKillRegState(), llvm::DILocation::getMergedLocation(), llvm::MachineInstr::getMF(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineOperand::isKill(), MRI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MachineInstrBuilder::setMIFlags(), and TII.
Referenced by llvm::RISCVInstrInfo::genAlternativeCodeSequence().
|
static |
Definition at line 187 of file RISCVInstrInfo.cpp.
|
static |
Definition at line 2355 of file RISCVInstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::MachineOperand::getImm(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::getKillRegState(), llvm::MachineInstr::getMF(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), getSHXADDShiftAmount(), llvm::MachineFunction::getSubtarget(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::RegState::Kill, llvm_unreachable, MRI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), TII, X, and Y.
Referenced by llvm::RISCVInstrInfo::genAlternativeCodeSequence().
Definition at line 2296 of file RISCVInstrInfo.cpp.
References llvm::FMADD_AX, llvm::FMADD_XA, llvm::FMSUB, llvm::FNMSUB, and llvm_unreachable.
Referenced by combineFPFusedMultiply().
|
static |
Definition at line 914 of file RISCVInstrInfo.cpp.
References llvm::RISCVCC::COND_EQ, llvm::RISCVCC::COND_GE, llvm::RISCVCC::COND_GEU, llvm::RISCVCC::COND_INVALID, llvm::RISCVCC::COND_LT, llvm::RISCVCC::COND_LTU, and llvm::RISCVCC::COND_NE.
Definition at line 2274 of file RISCVInstrInfo.cpp.
References llvm::FMSUB, and llvm_unreachable.
Referenced by combineFPFusedMultiply().
|
static |
Definition at line 2140 of file RISCVInstrInfo.cpp.
References canCombineFPFusedMultiply(), llvm::FMADD_AX, llvm::FMADD_XA, llvm::FMSUB, llvm::FNMSUB, llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), isFADD(), isFSUB(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by getFPPatterns().
|
static |
Definition at line 2163 of file RISCVInstrInfo.cpp.
References getFPFusedMultiplyPatterns().
Referenced by llvm::RISCVInstrInfo::getMachineCombinerPatterns().
Definition at line 1363 of file RISCVInstrInfo.cpp.
Referenced by canFoldAsPredicatedOp(), and llvm::RISCVInstrInfo::optimizeSelect().
|
static |
Definition at line 2223 of file RISCVInstrInfo.cpp.
References canCombine(), canCombineShiftIntoShXAdd(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), getSHXADDShiftAmount(), MBB, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SHXADD_ADD_SLLI_OP1, and llvm::SHXADD_ADD_SLLI_OP2.
Referenced by llvm::RISCVInstrInfo::getMachineCombinerPatterns().
Definition at line 2208 of file RISCVInstrInfo.cpp.
Referenced by genShXAddAddShift(), and getSHXADDPatterns().
|
static |
Definition at line 2969 of file RISCVInstrInfo.cpp.
References F, llvm::MachineFunction::getFunction(), llvm::MachineBasicBlock::getParent(), and MBB.
Referenced by cannotInsertTailCall().
|
static |
Definition at line 192 of file RISCVInstrInfo.cpp.
References assert(), llvm::MachineBasicBlock::begin(), llvm::RISCVSubtarget::getRegisterInfo(), llvm::RISCVVType::getSEW(), llvm::RISCVVType::getVLMUL(), llvm::RISCVII::hasSEWOp(), llvm::RISCVII::hasVLOp(), llvm::RISCVII::isRVVWideningReduction(), llvm::RISCVVType::isTailAgnostic(), MBB, MBBI, PreferWholeRegisterMove, and TRI.
Referenced by llvm::RISCVInstrInfo::copyPhysRegVector().
Definition at line 1715 of file RISCVInstrInfo.cpp.
Referenced by getFPFusedMultiplyPatterns(), and llvm::RISCVInstrInfo::isAssociativeAndCommutative().
Definition at line 1737 of file RISCVInstrInfo.cpp.
Referenced by canCombineFPFusedMultiply(), and llvm::RISCVInstrInfo::isAssociativeAndCommutative().
Definition at line 1726 of file RISCVInstrInfo.cpp.
Referenced by getFPFusedMultiplyPatterns().
|
static |
Definition at line 2982 of file RISCVInstrInfo.cpp.
Referenced by cannotInsertTailCall(), and llvm::RISCVInstrInfo::getOutliningTypeImpl().
|
static |
Definition at line 2976 of file RISCVInstrInfo.cpp.
Referenced by cannotInsertTailCall().
Definition at line 4010 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCV::isRVVSpill().
|
static |
Definition at line 2787 of file RISCVInstrInfo.cpp.
References llvm::ArrayRef< T >::front(), llvm::getUnderlyingObject(), llvm::MachineInstr::hasOneMemOperand(), and llvm::MachineInstr::memoperands_begin().
|
static |
Definition at line 940 of file RISCVInstrInfo.cpp.
References assert(), CC, Cond, llvm::MachineOperand::CreateImm(), getCondFromBranchOpc(), llvm::MachineInstr::getDesc(), llvm::MachineOperand::getMBB(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), and llvm::MCInstrDesc::isConditionalBranch().
|
static |
Referenced by llvm::RISCVInstrInfo::getMachineCombinerTraceStrategy().
|
static |
Referenced by isConvertibleToVMV_V_V().