LLVM: include/llvm/Transforms/Scalar/ConstantHoisting.h 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#ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H

37#define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H

38

47#include

48#include

49

50namespace llvm {

51

64

65

66

67

69

70

71

78

80

81

100

101

102

111

113

114

123

124}

125

127public:

129

130

134

136 ClonedCastMap.clear();

137 ConstIntCandVec.clear();

138 for (auto MapEntry : ConstGEPCandMap)

139 MapEntry.second.clear();

140 ConstGEPCandMap.clear();

141 ConstIntInfoVec.clear();

142 for (auto MapEntry : ConstGEPInfoMap)

143 MapEntry.second.clear();

144 ConstGEPInfoMap.clear();

145 }

146

147private:

150

158 bool OptForSize;

159

160

161 using ConstCandVecType = std::vectorconsthoist::ConstantCandidate;

163 ConstCandVecType ConstIntCandVec;

164 GVCandVecMapType ConstGEPCandMap;

165

166

169 ConstInfoVecType ConstIntInfoVec;

170 GVInfoVecMapType ConstGEPInfoMap;

171

172

174

175 void collectMatInsertPts(

179 unsigned Idx = ~0U) const;

183 void collectConstantCandidates(ConstCandMapType &ConstCandMap,

186 void collectConstantCandidates(ConstCandMapType &ConstCandMap,

189 void collectConstantCandidates(ConstCandMapType &ConstCandMap,

191 void collectConstantCandidates(ConstCandMapType &ConstCandMap,

193 void collectConstantCandidates(Function &Fn);

194 void findAndMakeBaseConstant(ConstCandVecType::iterator S,

195 ConstCandVecType::iterator E,

197 unsigned maximizeConstantsInRange(ConstCandVecType::iterator S,

198 ConstCandVecType::iterator E,

199 ConstCandVecType::iterator &MaxCostItr);

200

201

203

204

205

206 struct UserAdjustment {

213 : Offset(O), Ty(T), MatInsertPt(I), User(U) {}

214 };

215 void emitBaseConstants(Instruction *Base, UserAdjustment *Adj);

216

217

218 bool emitBaseConstants(GlobalVariable *BaseGV);

219 void deleteDeadCastInst() const;

220};

221

222}

223

224#endif

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

This file defines the DenseMap class.

This header defines various interfaces for pass management in LLVM.

This file implements a map that provides insertion order iteration.

This file defines the PointerUnion class, which is a discriminated union of pointer types.

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

This file defines the SmallVector class.

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

LLVM Basic Block Representation.

InstListType::iterator iterator

Instruction iterators...

BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...

A constant value that is initialized with an expression using other constant values.

Definition ConstantHoisting.h:126

void cleanup()

Definition ConstantHoisting.h:135

bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry, ProfileSummaryInfo *PSI)

Optimize expensive integer constants in the given function.

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)

This is the shared class of boolean and integer constants.

This is an important base class in LLVM.

A parsed version of the target data layout string in and methods for querying it.

Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.

This is an important class for using LLVM in a threaded context.

This class implements a map that also provides access to all stored values in a deterministic order.

A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...

A set of analyses that are preserved following a run of a transformation pass.

Analysis providing profile information.

A vector that has set insertion semantics.

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

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

This pass provides access to the codegen interfaces that are needed for IR-level transformations.

The instances of the Type class are immutable: once they are created, they are never changed.

A private "module" namespace for types and utilities used by ConstantHoisting.

Definition ConstantHoisting.h:68

SmallVector< ConstantUser, 8 > ConstantUseListType

Definition ConstantHoisting.h:79

SmallVector< RebasedConstantInfo, 4 > RebasedConstantListType

Definition ConstantHoisting.h:112

This is an optimization pass for GlobalISel generic memory operations.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

AnalysisManager< Function > FunctionAnalysisManager

Convenience typedef for the Function analysis manager.

Implement std::hash so that hash_code can be used in STL containers.

A CRTP mix-in to automatically provide informational APIs needed for passes.

ConstantUseListType Uses

Definition ConstantHoisting.h:83

unsigned CumulativeCost

Definition ConstantHoisting.h:89

void addUser(Instruction *Inst, unsigned Idx, unsigned Cost)

Add the user to the use list and update the cost.

Definition ConstantHoisting.h:95

ConstantExpr * ConstExpr

Definition ConstantHoisting.h:88

ConstantInt * ConstInt

Definition ConstantHoisting.h:87

ConstantCandidate(ConstantInt *ConstInt, ConstantExpr *ConstExpr=nullptr)

Definition ConstantHoisting.h:91

A base constant and all its rebased constants.

Definition ConstantHoisting.h:115

ConstantExpr * BaseExpr

Definition ConstantHoisting.h:120

RebasedConstantListType RebasedConstants

Definition ConstantHoisting.h:121

ConstantInt * BaseInt

Definition ConstantHoisting.h:119

Keeps track of the user of a constant and the operand index where the constant is used.

Definition ConstantHoisting.h:72

unsigned OpndIdx

Definition ConstantHoisting.h:74

ConstantUser(Instruction *Inst, unsigned Idx)

Definition ConstantHoisting.h:76

Instruction * Inst

Definition ConstantHoisting.h:73

ConstantUseListType Uses

Definition ConstantHoisting.h:104

RebasedConstantInfo(ConstantUseListType &&Uses, Constant *Offset, Type *Ty=nullptr)

Definition ConstantHoisting.h:108

Type * Ty

Definition ConstantHoisting.h:106

Constant * Offset

Definition ConstantHoisting.h:105