LLVM: lib/Target/NVPTX/NVPTXForwardParams.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

49

50using namespace llvm;

51

55 switch (U.getOpcode()) {

56 case NVPTX::LD_i16:

57 case NVPTX::LD_i32:

58 case NVPTX::LD_i64:

59 case NVPTX::LDV_i16_v2:

60 case NVPTX::LDV_i16_v4:

61 case NVPTX::LDV_i32_v2:

62 case NVPTX::LDV_i32_v4:

63 case NVPTX::LDV_i64_v2:

64 case NVPTX::LDV_i64_v4: {

66 return true;

67 }

68 case NVPTX::cvta_local:

69 case NVPTX::cvta_local_64:

70 case NVPTX::cvta_to_local:

71 case NVPTX::cvta_to_local_64: {

72 for (auto &U2 : MRI.use_instructions(U.operands_begin()->getReg()))

74 return false;

75

77 return true;

78 }

79 default:

80 return false;

81 }

82}

83

88

91 return false;

92

93 RemoveList.append(MaybeRemoveList);

95

98

99 constexpr unsigned LDInstBasePtrOpIdx = 6;

100 constexpr unsigned LDInstAddrSpaceOpIdx = 2;

101 for (auto *LI : LoadInsts) {

102 (LI->uses().begin() + LDInstBasePtrOpIdx)

104 (LI->uses().begin() + LDInstAddrSpaceOpIdx)

106 }

107 return true;

108}

109

112

116 if (MI.getOpcode() == NVPTX::MOV32_PARAM ||

117 MI.getOpcode() == NVPTX::MOV64_PARAM)

119

120 for (auto *MI : RemoveList)

121 MI->eraseFromParent();

122

124}

125

126

127

128

129

130namespace {

132 static char ID;

133 NVPTXForwardParamsPass() : MachineFunctionPass(ID) {}

134

135 bool runOnMachineFunction(MachineFunction &MF) override;

136

137 void getAnalysisUsage(AnalysisUsage &AU) const override {

139 }

140};

141}

142

143char NVPTXForwardParamsPass::ID = 0;

144

146 "NVPTX Forward Params", false, false)

147

150}

151

153 return new NVPTXForwardParamsPass();

154}

unsigned const MachineRegisterInfo * MRI

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static bool forwardDeviceParams(MachineFunction &MF)

Definition NVPTXForwardParams.cpp:110

static bool traverseMoveUse(MachineInstr &U, const MachineRegisterInfo &MRI, SmallVectorImpl< MachineInstr * > &RemoveList, SmallVectorImpl< MachineInstr * > &LoadInsts)

Definition NVPTXForwardParams.cpp:52

static bool eliminateMove(MachineInstr &Mov, const MachineRegisterInfo &MRI, SmallVectorImpl< MachineInstr * > &RemoveList)

Definition NVPTXForwardParams.cpp:84

#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)

This file defines the SmallVector class.

MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...

void getAnalysisUsage(AnalysisUsage &AU) const override

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.

MachineRegisterInfo & getRegInfo()

getRegInfo - Return information about the registers currently in use.

Representation of each machine instruction.

mop_iterator operands_begin()

mop_range uses()

Returns all operands which may be register uses.

MachineOperand class - Representation of each machine instruction operand.

bool isSymbol() const

isSymbol - Tests if this is a MO_ExternalSymbol operand.

const char * getSymbolName() const

Register getReg() const

getReg - Returns the register number.

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

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

void append(ItTy in_start, ItTy in_end)

Add the specified range to the end of the SmallVector.

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

This is an optimization pass for GlobalISel generic memory operations.

iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)

Make a range that does early increment to allow mutation of the underlying range without disrupting i...

MachineFunctionPass * createNVPTXForwardParamsPass()

Definition NVPTXForwardParams.cpp:152