LLVM 24.0.0git
RISCVMergeBaseOffset.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "riscv-merge-base-offset"
#define RISCV_MERGE_BASE_OFFSET_NAME   "RISC-V Merge Base Offset"

Functions

 INITIALIZE_PASS (RISCVMergeBaseOffsetLegacy, DEBUG_TYPE, RISCV_MERGE_BASE_OFFSET_NAME, false, false) static bool detectFoldable(MachineInstr &Hi
 if (HiOpc !=RISCV::LUI &&HiOpc !=RISCV::AUIPC &&HiOpc !=RISCV::PseudoMovAddr &&HiOpc !=RISCV::QC_E_LI) return false
 if (HiOp1.getTargetFlags() !=ExpectedFlags) return false
 if (!(HiOp1.isGlobal()||HiOp1.isCPI()||HiOp1.isBlockAddress())||HiOp1.getOffset() !=0) return false
 if (HiOpc==RISCV::PseudoMovAddr||HiOpc==RISCV::QC_E_LI)
 if (!MRI->hasOneUse(HiDestReg)) return false
 if (Lo->getOpcode() !=RISCV::ADDI) return false
 if (HiOp1.isGlobal())
static bool foldOffset (MachineInstr &Hi, MachineInstr &Lo, MachineInstr &Tail, int64_t Offset, MachineRegisterInfo *MRI)
static bool foldLargeOffset (MachineInstr &Hi, MachineInstr &Lo, MachineInstr &TailAdd, Register GAReg, MachineRegisterInfo *MRI, const RISCVSubtarget *ST)
static bool foldShiftedOffset (MachineInstr &Hi, MachineInstr &Lo, MachineInstr &TailShXAdd, Register GAReg, MachineRegisterInfo *MRI)
static bool detectAndFoldOffset (MachineInstr &Hi, MachineInstr &Lo, MachineRegisterInfo *MRI, const RISCVSubtarget *ST)
static void overwriteMachineOperandInPlace (MachineOperand &MO, const MachineOperand &ImmOp)
static bool foldIntoMemoryOps (MachineInstr &Hi, MachineInstr &Lo, MachineRegisterInfo *MRI, const RISCVSubtarget *ST)
static bool foldShxaddIntoScaledMemory (MachineInstr &Hi, MachineInstr &Lo, MachineRegisterInfo *MRI, const RISCVSubtarget *ST)
static bool runMergeBaseOffset (MachineFunction &Fn)

Variables

MachineInstr *& Lo = &*MRI->use_instr_begin(HiDestReg)
MachineInstr MachineRegisterInfo * MRI
const MachineOperand & HiOp1 = Hi.getOperand(1)
unsigned ExpectedFlags
 else
return true

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "riscv-merge-base-offset"

Definition at line 30 of file RISCVMergeBaseOffset.cpp.

◆ RISCV_MERGE_BASE_OFFSET_NAME

#define RISCV_MERGE_BASE_OFFSET_NAME   "RISC-V Merge Base Offset"

Definition at line 31 of file RISCVMergeBaseOffset.cpp.

Referenced by INITIALIZE_PASS().

Function Documentation

◆ detectAndFoldOffset()

◆ foldIntoMemoryOps()

◆ foldLargeOffset()

◆ foldOffset()

◆ foldShiftedOffset()

◆ foldShxaddIntoScaledMemory()

◆ if() [1/7]

if ( !(HiOp1.isGlobal()||HiOp1.isCPI()||HiOp1.isBlockAddress())||HiOp1.getOffset() ! = 0)

References HiOp1, and if().

◆ if() [2/7]

if ( !MRI-> hasOneUseHiDestReg)

References Lo, and MRI.

◆ if() [3/7]

if ( HiOp1.getTargetFlags() ! = ExpectedFlags)

References ExpectedFlags, and HiOp1.

◆ if() [4/7]

else if ( HiOp1. isGlobal())

Definition at line 125 of file RISCVMergeBaseOffset.cpp.

References HiOp1, and if().

◆ if() [5/7]

◆ if() [6/7]

if ( HiOpc = = RISCV::PseudoMovAddr || HiOpc == RISCV::QC_E_LI)

Definition at line 96 of file RISCVMergeBaseOffset.cpp.

References llvm::Hi, if(), and Lo.

◆ if() [7/7]

if ( Lo->getOpcode() ! = RISCV::ADDI)

References Lo.

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( RISCVMergeBaseOffsetLegacy ,
DEBUG_TYPE ,
RISCV_MERGE_BASE_OFFSET_NAME ,
false ,
false  ) &

◆ overwriteMachineOperandInPlace()

◆ runMergeBaseOffset()

Variable Documentation

◆ else

else
Initial value:
{
Register HiDestReg = Hi.getOperand(0).getReg()
Wrapper class representing virtual and physical registers.
Definition Register.h:20

Definition at line 100 of file RISCVMergeBaseOffset.cpp.

◆ ExpectedFlags

unsigned ExpectedFlags
Initial value:
= HiOpc == RISCV::AUIPC ? RISCVII::MO_PCREL_HI
: HiOpc == RISCV::QC_E_LI ? RISCVII::MO_None

Definition at line 86 of file RISCVMergeBaseOffset.cpp.

Referenced by if().

◆ HiOp1

const MachineOperand& HiOp1 = Hi.getOperand(1)

Definition at line 85 of file RISCVMergeBaseOffset.cpp.

Referenced by if(), if(), and if().

◆ Lo

Lo = &*MRI->use_instr_begin(HiDestReg)

Definition at line 78 of file RISCVMergeBaseOffset.cpp.

Referenced by absoluteSymbolDiff(), AddCombineTo64BitSMLAL16(), buildGPRPair(), buildSplatPartsS64WithVL(), canonicalizeShuffleMaskWithHorizOp(), checkImmOpForPKF32InstrReplicatesLower32BitsOfScalarOperand(), collectConcatOps(), combineAddMulh(), combineAddPackedByteDot(), combineArithReduction(), combineExtractWithShuffle(), combineHorizOpWithShuffle(), combineINSERT_SUBVECTOR(), combinePExtTruncate(), combineShiftRightLogical(), combineStore(), combineTargetShuffle(), combineVECREDUCE_LOGIC(), combineVECREDUCE_MUL(), combineVectorInsert(), combineVPMADD(), combineX86ShuffleChain(), combineX86ShufflesRecursively(), computeKnownBitsForPMADDUBSW(), computeKnownBitsForPMADDWD(), convertShiftLeftToScale(), createPermlane16(), createPermlaneX16(), createVariablePermute(), detectAndFoldOffset(), eat12Bytes(), eat16Bytes(), emitPseudoVMSKCOND(), Expand64BitShift(), expandBitCastF128ToI128(), expandBitCastI128ToF128(), expandBufferLoadIntrinsic(), expandMulWithOverflow(), extractGPRPair(), extractLOHI(), foldIntoMemoryOps(), foldLargeOffset(), foldOffset(), foldShiftedOffset(), foldShxaddIntoScaledMemory(), getBaseWithOffsetUsingSplitOR(), getCopyFromParts(), getFauxShuffleMask(), getMaskNode(), getMOVMSK(), getMul64(), getv64i1Argument(), getVectorBitwiseReduce(), if(), if(), if(), if(), isI32SignExtended(), LLVMDIBuilderGetOrCreateSubrange(), LowerAVXCONCAT_VECTORS(), LowerBITCAST(), LowerBITREVERSE(), lowerBUILD_VECTOR(), LowerBUILD_VECTORvXi1(), LowerCONCAT_VECTORSvXi1(), LowerCVTPS2PH(), LowerEXTEND_VECTOR_INREG(), LowerFunnelShift(), lowerGR128ToI128(), lowerI128ToGR128(), LowerLabelRef(), LowerMINMAX_REDUCE(), lowerMUL_LOHI(), lowerMUL_LOHI32(), LowerMULH(), LowerMULO(), LowerNTStore(), LowerPARITY(), LowerRotate(), LowerShift(), LowerShiftParts(), lowerShuffleAsBlend(), lowerShuffleAsByteRotate(), lowerShuffleAsByteRotateAndPermute(), lowerShuffleAsSpecificExtension(), lowerShuffleAsUNPCKAndPermute(), lowerShuffleAsVALIGN(), LowerTruncate(), LowerTruncateVecI1(), LowerTruncateVecPack(), LowerTruncateVecPackWithSignBits(), LowerVECREDUCE(), LowerVecReduceMinMax(), LowerVECTOR_SHUFFLE(), lowerVECTOR_SHUFFLE_XVPERMIQ(), lowerVECTOR_SHUFFLEAsByteRotate(), lowerVECTOR_SHUFFLEAsPSlide1(), LowerVectorAllEqual(), LowerVectorCTLZInRegLUT(), LowerWRITE_REGISTER(), matchBinaryPermuteShuffle(), matchOrConcat(), matchShuffleAsByteRotate(), matchShuffleAsElementRotate(), MergeBlocksConvert(), mostAlignedValueInRange(), Passv64i1ArgInRegs(), performADDCombine(), performBITCASTCombine(), performExtBinopLoadFold(), PerformInsertSubvectorCombine(), performInsertSubvectorCombine(), performSPLIT_PAIR_F64Combine(), readInstruction64(), ReplaceATOMIC_LOAD_128Results(), ReplaceCMP_SWAP_128Results(), ReplaceCMP_SWAP_64Results(), ReplaceLongIntrinsic(), ReplaceReductionResults(), runMergeBaseOffset(), selectImm(), simplifyX86pmadd(), splatPartsI64WithVL(), splatSplitI64WithVL(), SplitAndExtendv16i1(), splitAndLowerShuffle(), splitVector(), SplitVectorReductionOp(), truncateVectorWithNARROW(), truncateVectorWithPACK(), tryCombineExtendRShTrunc(), TryWideExtMulCombine(), unpack64(), unpackF64OnLA32DSoftABI(), unpackF64OnRV32DSoftABI(), unpackGPRVecOnRV32(), visitORCommutative(), and WinDBZCheckDenominator().

◆ MRI

Initial value:
{
auto HiOpc = Hi.getOpcode()

Definition at line 79 of file RISCVMergeBaseOffset.cpp.

◆ true

return true

Definition at line 136 of file RISCVMergeBaseOffset.cpp.