LLVM: include/llvm/Analysis/AliasSetTracker.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18#ifndef LLVM_ANALYSIS_ALIASSETTRACKER_H

19#define LLVM_ANALYSIS_ALIASSETTRACKER_H

20

29#include

30#include

31

32namespace llvm {

33

48

51

52

54

55

57

58

59 std::vector<AssertingVH> UnknownInsts;

60

61

62

63 unsigned RefCount : 27;

64

65

66

67 unsigned AliasAny : 1;

68

69

70

71

72

73

74

75 enum AccessLattice {

76 NoAccess = 0,

77 RefAccess = 1,

78 ModAccess = 2,

79 ModRefAccess = RefAccess | ModAccess

80 };

82

83

84

85

86

87

88

89 enum AliasLattice {

90 SetMustAlias = 0, SetMayAlias = 1

91 };

92 unsigned Alias : 1;

93

94 void addRef() { ++RefCount; }

95

97 assert(RefCount >= 1 && "Invalid reference count detected!");

98 if (--RefCount == 0)

99 removeFromTracker(AST);

100 }

101

102public:

105

106

107 bool isRef() const { return Access & RefAccess; }

108 bool isMod() const { return Access & ModAccess; }

109 bool isMustAlias() const { return Alias == SetMustAlias; }

110 bool isMayAlias() const { return Alias == SetMayAlias; }

111

112

113

115

116

119

120

121

125

126 unsigned size() const { return MemoryLocs.size(); }

127

128

129

130

133

136

137private:

138

140 : RefCount(0), AliasAny(false), Access(NoAccess), Alias(SetMustAlias) {}

141

143

145 bool KnownMustAlias = false);

147

148public:

149

150

153

156};

157

162

166

168

169

170

171 PointerMapType PointerMap;

172

173public:

174

175

178

179

180

181

182

183

184

185

186

187

195 add(Instruction *I);

198 add(const AliasSetTracker &AST);

200

202

203

205

206

207

208

209

211

212

214

217

220

223

226

227private:

229

230

231 unsigned TotalAliasSetSize = 0;

232

233

234

235 AliasSet *AliasAnyAS = nullptr;

236

237 void removeAliasSet(AliasSet *AS);

238

239

240

241

242

243

244

245 void collapseForwardingIn(AliasSet *&AS) {

246 if (AS->Forward) {

247 collapseForwardingIn(AS->Forward);

248

249 AliasSet *NewAS = AS->Forward;

250 NewAS->addRef();

251 AS->dropRef(*this);

252 AS = NewAS;

253 }

254 }

255

256 AliasSet &addMemoryLocation(MemoryLocation Loc, AliasSet::AccessLattice E);

257 AliasSet *mergeAliasSetsForMemoryLocation(const MemoryLocation &MemLoc,

259 bool &MustAliasAll);

260

261

262

263 AliasSet &mergeAllAliasSets();

264

265 AliasSet *findAliasSetForUnknownInst(Instruction *Inst);

266};

267

272

281

282}

283

284#endif

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

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 provides utility analysis objects describing memory locations.

This file defines the SmallVector class.

The possible results of an alias query.

Definition AliasSetTracker.h:163

ilist< AliasSet >::iterator iterator

Definition AliasSetTracker.h:215

LLVM_ABI void dump() const

const ilist< AliasSet > & getAliasSets() const

Return the alias sets that are active.

Definition AliasSetTracker.h:204

BatchAAResults & getAliasAnalysis() const

Return the underlying alias analysis object used by this tracker.

Definition AliasSetTracker.h:213

LLVM_ABI AliasSet & getAliasSetFor(const MemoryLocation &MemLoc)

Return the alias set which contains the specified memory location.

LLVM_ABI void addUnknown(Instruction *I)

AliasSetTracker(BatchAAResults &AA)

Create an empty collection of AliasSets, and use the specified alias analysis object to disambiguate ...

Definition AliasSetTracker.h:176

const_iterator end() const

Definition AliasSetTracker.h:219

ilist< AliasSet >::const_iterator const_iterator

Definition AliasSetTracker.h:216

const_iterator begin() const

Definition AliasSetTracker.h:218

LLVM_ABI void print(raw_ostream &OS) const

iterator end()

Definition AliasSetTracker.h:222

LLVM_ABI void add(const MemoryLocation &Loc)

These methods are used to add different types of instructions to the alias sets.

friend class AliasSet

Definition AliasSetTracker.h:228

iterator begin()

Definition AliasSetTracker.h:221

~AliasSetTracker()

Definition AliasSetTracker.h:177

Definition AliasSetTracker.h:49

unsigned size() const

Definition AliasSetTracker.h:126

iterator begin() const

Definition AliasSetTracker.h:123

LLVM_ABI void mergeSetIn(AliasSet &AS, AliasSetTracker &AST, BatchAAResults &BatchAA)

Merge the specified alias set into this alias set.

LLVM_ABI void print(raw_ostream &OS) const

AliasSet(const AliasSet &)=delete

iterator end() const

Definition AliasSetTracker.h:124

bool isMayAlias() const

Definition AliasSetTracker.h:110

bool isForwardingAliasSet() const

Return true if this alias set should be ignored as part of the AliasSetTracker object.

Definition AliasSetTracker.h:114

AliasSet & operator=(const AliasSet &)=delete

LLVM_ABI ModRefInfo aliasesUnknownInst(const Instruction *Inst, BatchAAResults &AA) const

bool isMustAlias() const

Definition AliasSetTracker.h:109

LLVM_ABI AliasResult aliasesMemoryLocation(const MemoryLocation &MemLoc, BatchAAResults &AA) const

If the specified memory location "may" (or must) alias one of the members in the set return the appro...

friend class AliasSetTracker

Definition AliasSetTracker.h:50

SmallVectorImpl< MemoryLocation >::const_iterator iterator

Definition AliasSetTracker.h:122

bool isMod() const

Definition AliasSetTracker.h:108

bool isRef() const

Accessors...

Definition AliasSetTracker.h:107

LLVM_ABI PointerVector getPointers() const

LLVM_ABI void dump() const

SmallVector< const Value *, 8 > PointerVector

Retrieve the pointer values for the memory locations in this alias set.

Definition AliasSetTracker.h:131

LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)

static bool isRequired()

Definition AliasSetTracker.h:279

LLVM_ABI AliasSetsPrinterPass(raw_ostream &OS)

This class represents any memset intrinsic.

LLVM Basic Block Representation.

This class is a wrapper over an AAResults, and it is intended to be used only when there are no IR ch...

An instruction for reading from memory.

Representation for a specific memory location.

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

typename SuperClass::const_iterator const_iterator

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

An instruction for storing to memory.

This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...

LLVM Value Representation.

typename base_list_type::iterator iterator

typename base_list_type::const_iterator const_iterator

This class implements an extremely fast bulk output stream that can only output to a stream.

This file defines classes to implement an intrusive doubly linked list class (i.e.

This file defines the ilist_node class template, which is a convenient base class for creating classe...

Abstract Attribute helper functions.

This is an optimization pass for GlobalISel generic memory operations.

iplist< T, Options... > ilist

ModRefInfo

Flags indicating whether a memory access modifies or references memory.

raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)

AnalysisManager< Function > FunctionAnalysisManager

Convenience typedef for the Function analysis manager.

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