|
LLVM 24.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/ADT/Statistic.h"#include "llvm/Analysis/MemoryLocation.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/CodeGen/LiveIntervals.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/MCDwarf.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 , MachineOutlinerRegSave } |
| #define CASE_FP_WIDEOP_CHANGE_OPCODE_COMMON | ( | OP, | |
| LMUL, | |||
| SEW ) |
Definition at line 4993 of file RISCVInstrInfo.cpp.
| #define CASE_FP_WIDEOP_CHANGE_OPCODE_LMULS | ( | OP | ) |
Definition at line 4998 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::convertToThreeAddress().
| #define CASE_FP_WIDEOP_CHANGE_OPCODE_LMULS_ALT | ( | OP | ) |
Definition at line 5016 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::convertToThreeAddress().
| #define CASE_FP_WIDEOP_OPCODE_COMMON | ( | OP, | |
| LMUL, | |||
| SEW ) |
Definition at line 4979 of file RISCVInstrInfo.cpp.
| #define CASE_FP_WIDEOP_OPCODE_LMULS | ( | OP | ) |
Definition at line 4982 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::convertToThreeAddress().
| #define CASE_FP_WIDEOP_OPCODE_LMULS_ALT | ( | OP | ) |
Definition at line 5009 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::convertToThreeAddress().
| #define CASE_OPERAND_SIMM | ( | NUM | ) |
Referenced by llvm::RISCVInstrInfo::verifyInstruction().
| #define CASE_OPERAND_UIMM | ( | NUM | ) |
Referenced by llvm::RISCVInstrInfo::verifyInstruction().
| #define CASE_OPERAND_UIMM_LSB_ZEROS | ( | BITS, | |
| SUFFIX ) |
Referenced by llvm::RISCVInstrInfo::verifyInstruction().
| #define CASE_RVV_OPCODE | ( | OP | ) |
Definition at line 4258 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_RVV_OPCODE_LMUL | ( | OP, | |
| LMUL ) |
Definition at line 4226 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_RVV_OPCODE_MASK | ( | OP | ) |
Definition at line 4250 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_RVV_OPCODE_MASK_LMUL | ( | OP, | |
| LMUL ) |
Definition at line 4223 of file RISCVInstrInfo.cpp.
| #define CASE_RVV_OPCODE_MASK_WIDEN | ( | OP | ) |
Definition at line 4242 of file RISCVInstrInfo.cpp.
| #define CASE_RVV_OPCODE_UNMASK | ( | OP | ) |
Definition at line 4238 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_RVV_OPCODE_UNMASK_LMUL | ( | OP, | |
| LMUL ) |
Definition at line 4220 of file RISCVInstrInfo.cpp.
| #define CASE_RVV_OPCODE_UNMASK_WIDEN | ( | OP | ) |
Definition at line 4230 of file RISCVInstrInfo.cpp.
| #define CASE_RVV_OPCODE_WIDEN | ( | OP | ) |
Definition at line 4254 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_VFMA_CHANGE_OPCODE_COMMON | ( | OLDOP, | |
| NEWOP, | |||
| TYPE, | |||
| LMUL, | |||
| SEW ) |
| #define CASE_VFMA_CHANGE_OPCODE_LMULS_M1 | ( | OLDOP, | |
| NEWOP, | |||
| TYPE, | |||
| SEW ) |
Definition at line 4524 of file RISCVInstrInfo.cpp.
| #define CASE_VFMA_CHANGE_OPCODE_LMULS_MF2 | ( | OLDOP, | |
| NEWOP, | |||
| TYPE, | |||
| SEW ) |
Definition at line 4530 of file RISCVInstrInfo.cpp.
| #define CASE_VFMA_CHANGE_OPCODE_LMULS_MF4 | ( | OLDOP, | |
| NEWOP, | |||
| TYPE, | |||
| SEW ) |
Definition at line 4534 of file RISCVInstrInfo.cpp.
| #define CASE_VFMA_CHANGE_OPCODE_SPLATS | ( | OLDOP, | |
| NEWOP ) |
Definition at line 4544 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::commuteInstructionImpl().
| #define CASE_VFMA_CHANGE_OPCODE_VV | ( | OLDOP, | |
| NEWOP ) |
Definition at line 4538 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::commuteInstructionImpl().
| #define CASE_VFMA_OPCODE_COMMON | ( | OP, | |
| TYPE, | |||
| LMUL, | |||
| SEW ) |
| #define CASE_VFMA_OPCODE_LMULS_M1 | ( | OP, | |
| TYPE, | |||
| SEW ) |
Definition at line 4280 of file RISCVInstrInfo.cpp.
| #define CASE_VFMA_OPCODE_LMULS_MF2 | ( | OP, | |
| TYPE, | |||
| SEW ) |
Definition at line 4286 of file RISCVInstrInfo.cpp.
| #define CASE_VFMA_OPCODE_LMULS_MF4 | ( | OP, | |
| TYPE, | |||
| SEW ) |
Definition at line 4290 of file RISCVInstrInfo.cpp.
| #define CASE_VFMA_OPCODE_VV | ( | OP | ) |
Definition at line 4294 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::commuteInstructionImpl(), and llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_VFMA_SPLATS | ( | OP | ) |
Definition at line 4300 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::commuteInstructionImpl(), and llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_VMA_CHANGE_OPCODE_COMMON | ( | OLDOP, | |
| NEWOP, | |||
| TYPE, | |||
| LMUL ) |
| #define CASE_VMA_CHANGE_OPCODE_LMULS | ( | OLDOP, | |
| NEWOP, | |||
| TYPE ) |
Definition at line 4509 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::commuteInstructionImpl().
| #define CASE_VMA_OPCODE_COMMON | ( | OP, | |
| TYPE, | |||
| LMUL ) |
Definition at line 4264 of file RISCVInstrInfo.cpp.
| #define CASE_VMA_OPCODE_LMULS | ( | OP, | |
| TYPE ) |
Definition at line 4267 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::commuteInstructionImpl(), and llvm::RISCVInstrInfo::findCommutedOpIndices().
| #define CASE_WIDEOP_CHANGE_OPCODE_COMMON | ( | OP, | |
| LMUL ) |
| #define CASE_WIDEOP_CHANGE_OPCODE_LMULS | ( | OP | ) |
Definition at line 4970 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::convertToThreeAddress().
| #define CASE_WIDEOP_OPCODE_COMMON | ( | OP, | |
| LMUL ) |
Definition at line 4954 of file RISCVInstrInfo.cpp.
| #define CASE_WIDEOP_OPCODE_LMULS | ( | OP | ) |
Definition at line 4957 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::convertToThreeAddress().
| #define DEBUG_TYPE "riscv-instr-info" |
Definition at line 46 of file RISCVInstrInfo.cpp.
| #define GEN_CHECK_COMPRESS_INSTR |
Definition at line 40 of file RISCVInstrInfo.cpp.
| #define GET_INSTRINFO_CTOR_DTOR |
Definition at line 43 of file RISCVInstrInfo.cpp.
| #define GET_INSTRINFO_HELPERS |
Definition at line 73 of file RISCVInstrInfo.cpp.
| #define GET_RISCVMaskedPseudosTable_IMPL |
Definition at line 63 of file RISCVInstrInfo.cpp.
| #define GET_RISCVVPseudosTable_IMPL |
Definition at line 56 of file RISCVInstrInfo.cpp.
| #define OPCODE_LMUL_CASE | ( | OPC | ) |
| #define OPCODE_LMUL_MASK_CASE | ( | OPC | ) |
| #define RVV_OPC_LMUL_CASE | ( | OPC, | |
| INV ) |
Referenced by llvm::RISCVInstrInfo::getInverseOpcode().
| #define RVV_OPC_LMUL_MASK_CASE | ( | OPC, | |
| INV ) |
Referenced by llvm::RISCVInstrInfo::getInverseOpcode().
| Enumerator | |
|---|---|
| MachineOutlinerTailCall | |
| MachineOutlinerDefault | |
| MachineOutlinerRegSave | |
Definition at line 3780 of file RISCVInstrInfo.cpp.
|
static |
Utility routine that checks if.
| MO | is defined by an |
| CombineOpc | instruction in the basic block |
| MBB |
Definition at line 2819 of file RISCVInstrInfo.cpp.
References llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getUniqueVRegDef(), llvm::MachineRegisterInfo::hasOneNonDBGUse(), llvm::MachineOperand::isReg(), llvm::Register::isVirtual(), MBB, and MI.
|
static |
Definition at line 2761 of file RISCVInstrInfo.cpp.
References llvm::MachineInstr::FmContract, llvm::MachineInstr::getFlag(), llvm::MachineInstr::getMF(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::getVRegDef(), llvm::RISCV::hasEqualFRM(), llvm::MachineRegisterInfo::hasOneNonDBGUse(), isFMUL(), llvm::MachineOperand::isReg(), llvm::Register::isVirtual(), and MI.
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 2840 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 1994 of file RISCVInstrInfo.cpp.
References llvm::drop_begin(), getPredicatedOpcode(), llvm::MachineRegisterInfo::getVRegDef(), llvm::MachineRegisterInfo::hasOneNonDBGUse(), llvm::MachineRegisterInfo::isConstantPhysReg(), MI, Reg, and TII.
Referenced by llvm::RISCVInstrInfo::optimizeSelect().
|
static |
Definition at line 3810 of file RISCVInstrInfo.cpp.
References llvm::MCSubtargetInfo::getFeatureBits(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::RISCVII::getTailExpandUseRegNo(), llvm::RISCVMachineFunctionInfo::hasCFProtectionBranch(), isCandidatePatchable(), isMIModifiesReg(), isMIReadsReg(), MBB, and MI.
Referenced by llvm::RISCVInstrInfo::analyzeCandidate(), and llvm::RISCVInstrInfo::getOutliningTypeImpl().
|
static |
Definition at line 2972 of file RISCVInstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineRegisterInfo::clearKillFlags(), 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::MachineRegisterInfo::hasOneNonDBGUse(), llvm::MachineOperand::isKill(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MachineInstrBuilder::setMIFlags(), and TII.
Referenced by llvm::RISCVInstrInfo::genAlternativeCodeSequence().
|
static |
Definition at line 3838 of file RISCVInstrInfo.cpp.
References C(), llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::isReserved(), Reg, Register, and TRI.
Referenced by llvm::RISCVInstrInfo::analyzeCandidate(), and llvm::RISCVInstrInfo::insertOutlinedCall().
Definition at line 236 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::copyPhysRegVector().
|
static |
Definition at line 3018 of file RISCVInstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), 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::MachineRegisterInfo::getUniqueVRegDef(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::Kill, llvm_unreachable, llvm::SmallVectorTemplateBase< T, bool >::push_back(), TII, X, and Y.
Referenced by llvm::RISCVInstrInfo::genAlternativeCodeSequence().
Definition at line 2959 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 5455 of file RISCVInstrInfo.cpp.
References assert(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getVRegDef(), Imm, llvm::MachineOperand::isImm(), isLoadImm(), and llvm::Register::isVirtual().
Referenced by llvm::RISCV::isVLKnownLE().
| std::optional< unsigned > getFoldedOpcode | ( | MachineFunction & | MF, |
| MachineInstr & | MI, | ||
| ArrayRef< unsigned > | Ops, | ||
| const RISCVSubtarget & | ST ) |
Definition at line 845 of file RISCVInstrInfo.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, llvm::MachineFunction::getDataLayout(), llvm::RISCV::getRVVMCOpcode(), llvm::RISCVII::getSEWOpNum(), llvm::DataLayout::isBigEndian(), llvm_unreachable, and MI.
Referenced by llvm::RISCVInstrInfo::foldMemoryOperandImpl().
Definition at line 2937 of file RISCVInstrInfo.cpp.
References llvm::FMSUB, and llvm_unreachable.
Referenced by combineFPFusedMultiply().
|
static |
Definition at line 2788 of file RISCVInstrInfo.cpp.
References canCombineFPFusedMultiply(), llvm::FMADD_AX, llvm::FMADD_XA, llvm::FMSUB, llvm::FNMSUB, llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), isFADD(), isFSUB(), Opc, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by getFPPatterns().
|
static |
Definition at line 2811 of file RISCVInstrInfo.cpp.
References getFPFusedMultiplyPatterns().
Referenced by llvm::RISCVInstrInfo::getMachineCombinerPatterns().
Definition at line 1151 of file RISCVInstrInfo.cpp.
References llvm_unreachable.
Referenced by llvm::RISCVInstrInfo::commuteInstructionImpl().
|
static |
Definition at line 1825 of file RISCVInstrInfo.cpp.
References llvm::MachineRegisterInfo::getUniqueVRegDef(), MI, and Reg.
Referenced by llvm::RISCVInstrInfo::getJumpTableIndex(), and getJumpTableIndexFromLoadAddr().
|
static |
Definition at line 1842 of file RISCVInstrInfo.cpp.
References getJumpTableIndexFromBase(), llvm::MachineRegisterInfo::getUniqueVRegDef(), MI, and Reg.
Definition at line 91 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::isLoadFromStackSlot(), llvm::RISCV::isRVVSpill(), and llvm::RISCVInstrInfo::isStoreToStackSlot().
Definition at line 932 of file RISCVInstrInfo.cpp.
Referenced by llvm::RISCVInstrInfo::foldMemoryOperandImpl().
Definition at line 1941 of file RISCVInstrInfo.cpp.
Referenced by canFoldAsPredicatedOp(), and llvm::RISCVInstrInfo::optimizeSelect().
|
static |
Definition at line 2886 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 2856 of file RISCVInstrInfo.cpp.
References Opc.
Referenced by genShXAddAddShift(), getSHXADDPatterns(), and llvm::RISCVInstrInfo::simplifyInstruction().
Definition at line 2871 of file RISCVInstrInfo.cpp.
References Opc.
Referenced by llvm::RISCVInstrInfo::simplifyInstruction().
|
static |
Definition at line 3791 of file RISCVInstrInfo.cpp.
References F, llvm::MachineFunction::getFunction(), and MBB.
Referenced by cannotInsertTailCall().
|
static |
Definition at line 241 of file RISCVInstrInfo.cpp.
References assert(), llvm::RISCVSubtarget::getCLOpts(), llvm::RISCVSubtarget::getRegisterInfo(), llvm::RISCVVType::getSEW(), llvm::RISCVVType::getVLMUL(), llvm::RISCVII::hasSEWOp(), llvm::RISCVII::hasVLOp(), llvm::RISCVII::isRVVWideningReduction(), llvm::RISCVVType::isTailAgnostic(), MBB, MBBI, TRI, and uint64_t.
Referenced by llvm::RISCVInstrInfo::copyPhysRegVector().
Definition at line 2362 of file RISCVInstrInfo.cpp.
References Opc.
Referenced by getFPFusedMultiplyPatterns(), and llvm::RISCVInstrInfo::isAssociativeAndCommutative().
Definition at line 2384 of file RISCVInstrInfo.cpp.
References Opc.
Referenced by canCombineFPFusedMultiply(), and llvm::RISCVInstrInfo::isAssociativeAndCommutative().
Definition at line 2373 of file RISCVInstrInfo.cpp.
References Opc.
Referenced by getFPFusedMultiplyPatterns().
|
static |
Definition at line 1816 of file RISCVInstrInfo.cpp.
References llvm::any_of(), and MI.
|
static |
Definition at line 1602 of file RISCVInstrInfo.cpp.
Referenced by getEffectiveImm(), llvm::RISCVInstrInfo::isFromLoadImm(), and llvm::RISCVInstrInfo::optimizeCondBranch().
|
static |
Definition at line 3804 of file RISCVInstrInfo.cpp.
Referenced by cannotInsertTailCall(), and llvm::RISCVInstrInfo::getOutliningTypeImpl().
|
static |
Definition at line 3798 of file RISCVInstrInfo.cpp.
Referenced by cannotInsertTailCall().
|
static |
Definition at line 3606 of file RISCVInstrInfo.cpp.
References llvm::ArrayRef< T >::front(), llvm::getUnderlyingObject(), llvm::MachineInstr::hasOneMemOperand(), llvm::isa(), and llvm::MachineInstr::memoperands_begin().
|
static |
Definition at line 1140 of file RISCVInstrInfo.cpp.
References assert(), Cond, llvm::MachineOperand::CreateImm(), llvm::MachineInstr::getDesc(), llvm::MachineOperand::getMBB(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), and llvm::MCInstrDesc::isConditionalBranch().
| STATISTIC | ( | NumVRegReloaded | , |
| "Number of registers within vector register groups reloaded" | ) |
| STATISTIC | ( | NumVRegSpilled | , |
| "Number of registers within vector register groups spilled" | ) |