LLVM: include/llvm/CodeGen/LiveRangeEdit.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17#ifndef LLVM_CODEGEN_LIVERANGEEDIT_H

18#define LLVM_CODEGEN_LIVERANGEEDIT_H

19

30#include

31

32namespace llvm {

33

41

43public:

44

46 virtual void anchor();

47

48 public:

50

51

53

54

55

57

58

60

61

62

64 };

65

66private:

73 Delegate *const TheDelegate;

74

75

76 const unsigned FirstNew;

77

78

79

81

82

83

85

86

87

89

91

92

93 void eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink);

94

95

96

97 void MRI_NoteNewVirtualRegister(Register VReg) override;

98

99

100

102

103

104 LiveInterval &createEmptyIntervalFrom(Register OldReg, bool createSubRanges);

105

106public:

107

108

109

110

111

112

113

114

115

116

117

120 Delegate *delegate = nullptr,

122 : Parent(parent), NewRegs(newRegs), MRI(MF.getRegInfo()), LIS(lis),

123 VRM(vrm), TII(*MF.getSubtarget().getInstrInfo()), TheDelegate(delegate),

124 FirstNew(newRegs.size()), DeadRemats(deadRemats) {

125 MRI.addDelegate(this);

126 }

127

129

131 assert(Parent && "No parent LiveInterval");

132 return *Parent;

133 }

134

136

137

139 iterator begin() const { return NewRegs.begin() + FirstNew; }

141 unsigned size() const { return NewRegs.size() - FirstNew; }

143 Register get(unsigned idx) const { return NewRegs[idx + FirstNew]; }

144

145

146

147

148

149

150

151

152

154

156

157

159

160

161

163 return createEmptyIntervalFrom(getReg(), true);

164 }

165

167

168

176

177

178

180

181

182

183

184

185

189 bool Late = false, unsigned SubIdx = 0,

191

192

193

195 Rematted.insert(ParentVNI);

196 }

197

198

200 return Rematted.count(ParentVNI);

201 }

202

203

204

206

207

208

209

210

211

212

215

216

217

219};

220

221}

222

223#endif

unsigned const MachineRegisterInfo * MRI

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

const TargetInstrInfo & TII

This file implements a set that has insertion order iteration characteristics.

This file defines the SmallPtrSet class.

This file defines the SmallVector class.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

LiveInterval - This class represents the liveness of a register, or stack slot.

Callback methods for LiveRangeEdit owners.

Definition LiveRangeEdit.h:45

virtual ~Delegate()=default

virtual bool LRE_CanEraseVirtReg(Register)

Called when a virtual register is no longer used.

Definition LiveRangeEdit.h:56

virtual void LRE_WillEraseInstruction(MachineInstr *MI)

Called immediately before erasing a dead machine instruction.

Definition LiveRangeEdit.h:52

virtual void LRE_WillShrinkVirtReg(Register)

Called before shrinking the live range of a virtual register.

Definition LiveRangeEdit.h:59

virtual void LRE_DidCloneVirtReg(Register New, Register Old)

Called after cloning a virtual register.

Definition LiveRangeEdit.h:63

Register create()

Definition LiveRangeEdit.h:166

void eraseVirtReg(Register Reg)

eraseVirtReg - Notify the delegate that Reg is no longer in use, and try to erase it from LIS.

bool empty() const

Definition LiveRangeEdit.h:142

~LiveRangeEdit() override

Definition LiveRangeEdit.h:128

unsigned size() const

Definition LiveRangeEdit.h:141

Register get(unsigned idx) const

Definition LiveRangeEdit.h:143

Register createFrom(Register OldReg)

createFrom - Create a new virtual register based on OldReg.

LiveInterval & createEmptyInterval()

create - Create a new register with the same class and original slot as parent.

Definition LiveRangeEdit.h:162

void calculateRegClassAndHint(MachineFunction &, VirtRegAuxInfo &)

calculateRegClassAndHint - Recompute register class and hint for each new register.

LiveRangeEdit(const LiveInterval *parent, SmallVectorImpl< Register > &newRegs, MachineFunction &MF, LiveIntervals &lis, VirtRegMap *vrm, Delegate *delegate=nullptr, SmallPtrSet< MachineInstr *, 32 > *deadRemats=nullptr)

Create a LiveRangeEdit for breaking down parent into smaller pieces.

Definition LiveRangeEdit.h:118

SmallVectorImpl< Register >::const_iterator iterator

Iterator for accessing the new registers added by this edit.

Definition LiveRangeEdit.h:138

const LiveInterval & getParent() const

Definition LiveRangeEdit.h:130

bool canRematerializeAt(Remat &RM, SlotIndex UseIdx)

canRematerializeAt - Determine if RM.Orig can be rematerialized at UseIdx.

ArrayRef< Register > regs() const

Definition LiveRangeEdit.h:155

iterator end() const

Definition LiveRangeEdit.h:140

iterator begin() const

Definition LiveRangeEdit.h:139

Register getReg() const

Definition LiveRangeEdit.h:135

SlotIndex rematerializeAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, const Remat &RM, const TargetRegisterInfo &, bool Late=false, unsigned SubIdx=0, MachineInstr *ReplaceIndexMI=nullptr)

rematerializeAt - Rematerialize RM.ParentVNI into DestReg by inserting an instruction into MBB before...

void eliminateDeadDefs(SmallVectorImpl< MachineInstr * > &Dead, ArrayRef< Register > RegsBeingSpilled={})

eliminateDeadDefs - Try to delete machine instructions that are now dead (allDefsAreDead returns true...

void pop_back()

pop_back - It allows LiveRangeEdit users to drop new registers.

Definition LiveRangeEdit.h:153

void markRematerialized(const VNInfo *ParentVNI)

markRematerialized - explicitly mark a value as rematerialized after doing it manually.

Definition LiveRangeEdit.h:194

bool didRematerialize(const VNInfo *ParentVNI) const

didRematerialize - Return true if ParentVNI was rematerialized anywhere.

Definition LiveRangeEdit.h:199

MachineInstrBundleIterator< MachineInstr > iterator

Representation of each machine instruction.

MachineOperand class - Representation of each machine instruction operand.

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

Wrapper class representing virtual and physical registers.

SlotIndex - An opaque wrapper around machine indexes.

SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.

A SetVector that performs no allocations if smaller than a certain size.

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

typename SuperClass::const_iterator const_iterator

TargetInstrInfo - Interface to description of machine instruction set.

TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...

VNInfo - Value Number Information.

Calculate auxiliary information for a virtual register such as its spill weight and allocation hint.

This is an optimization pass for GlobalISel generic memory operations.

ArrayRef(const T &OneElt) -> ArrayRef< T >

const VNInfo *const ParentVNI

Definition LiveRangeEdit.h:170

MachineInstr * OrigMI

Definition LiveRangeEdit.h:171

Remat(const VNInfo *ParentVNI)

Definition LiveRangeEdit.h:174