LLVM: lib/CodeGen/GlobalISel/GIMatchTableExecutor.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

19

20#define DEBUG_TYPE "gi-match-table-executor"

21

22using namespace llvm;

23

26

28

32 bool Splat) const {

35 return VRegVal->Value.getSExtValue() == Value;

36

39 return VRegVal->getSExtValue() == Value;

40 }

41 }

42 return false;

43}

44

47 if (!Root.isReg())

48 return false;

49

51 if (RootI->getOpcode() != TargetOpcode::G_PTR_ADD)

52 return false;

53

56 if (RHSI->getOpcode() != TargetOpcode::G_CONSTANT)

57 return false;

58

59 return true;

60}

61

65

66

67 if (MI.getParent() == IntoMI.getParent() &&

68 std::next(MI.getIterator()) == IntoMIIter)

69 return true;

70

71

72 if (MI.isConvergent() && MI.getParent() != IntoMI.getParent())

73 return false;

74

75 if (MI.isLoadFoldBarrier())

76 return false;

77

78

79 if (MI.mayLoad() && MI.getParent() == IntoMI.getParent()) {

80 if (MI.memoperands_empty())

81 return false;

82 auto &MMO = **(MI.memoperands_begin());

83 if (MMO.isAtomic() || MMO.isVolatile())

84 return false;

85

86

87 unsigned Iter = 0;

88 const unsigned MaxIter = 20;

89 for (auto &CurrMI :

91 if (CurrMI.isLoadFoldBarrier())

92 return false;

93

94 if (Iter++ == MaxIter)

95 return false;

96 }

97

98 return true;

99 }

100

101 return MI.mayLoad();

102}

unsigned const MachineRegisterInfo * MRI

LLVM_ABI GIMatchTableExecutor()

LLVM_ABI bool isBaseWithConstantOffset(const MachineOperand &Root, const MachineRegisterInfo &MRI) const

Return true if the specified operand is a G_PTR_ADD with a G_CONSTANT on the right-hand side.

Definition GIMatchTableExecutor.cpp:45

LLVM_ABI bool isOperandImmEqual(const MachineOperand &MO, int64_t Value, const MachineRegisterInfo &MRI, bool Splat=false) const

Definition GIMatchTableExecutor.cpp:29

LLVM_ABI bool isObviouslySafeToFold(MachineInstr &MI, MachineInstr &IntoMI) const

Return true if MI can obviously be folded into IntoMI.

Definition GIMatchTableExecutor.cpp:62

Representation of each machine instruction.

unsigned getOpcode() const

Returns the opcode of this MachineInstr.

const MachineBasicBlock * getParent() const

const MachineOperand & getOperand(unsigned i) const

MachineOperand class - Representation of each machine instruction operand.

bool isReg() const

isReg - Tests if this is a MO_Register operand.

Register getReg() const

getReg - Returns the register number.

MachineRegisterInfo - Keep track of information for virtual and physical registers,...

LLVM Value Representation.

self_iterator getIterator()

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI std::optional< APInt > getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI)

auto instructionsWithoutDebug(IterT It, IterT End, bool SkipPseudoOp=true)

Construct a range iterator which begins at It and moves forwards until End is reached,...

LLVM_ABI std::optional< ValueAndVReg > getIConstantVRegValWithLookThrough(Register VReg, const MachineRegisterInfo &MRI, bool LookThroughInstrs=true)

If VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT returns its...

LLVM_ABI MatcherState(unsigned MaxRenderers)

Definition GIMatchTableExecutor.cpp:24

std::vector< ComplexRendererFns::value_type > Renderers