# Changeset View

Changeset View

# Standalone View

Standalone View

# include/llvm/Analysis/BasicAliasAnalysis.h

Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 65 | public: | |||
---|---|---|---|---|---|

76 | BasicAAResult(BasicAAResult &&Arg) | 76 | BasicAAResult(BasicAAResult &&Arg) | ||

77 | : AAResultBase(std::move(Arg)), DL(Arg.DL), F(Arg.F), TLI(Arg.TLI), | 77 | : AAResultBase(std::move(Arg)), DL(Arg.DL), F(Arg.F), TLI(Arg.TLI), | ||

78 | AC(Arg.AC), DT(Arg.DT), LI(Arg.LI), PV(Arg.PV) {} | 78 | AC(Arg.AC), DT(Arg.DT), LI(Arg.LI), PV(Arg.PV) {} | ||

79 | 79 | | |||

80 | /// Handle invalidation events in the new pass manager. | 80 | /// Handle invalidation events in the new pass manager. | ||

81 | bool invalidate(Function &Fn, const PreservedAnalyses &PA, | 81 | bool invalidate(Function &Fn, const PreservedAnalyses &PA, | ||

82 | FunctionAnalysisManager::Invalidator &Inv); | 82 | FunctionAnalysisManager::Invalidator &Inv); | ||

83 | 83 | | |||

84 | AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB); | 84 | AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, | ||

85 | AAQueryInfo &AAQI); | ||||

85 | 86 | | |||

86 | ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc); | 87 | ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, | ||

88 | AAQueryInfo &AAQI); | ||||

87 | 89 | | |||

88 | ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2); | 90 | ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2, | ||

91 | AAQueryInfo &AAQI); | ||||

89 | 92 | | |||

90 | /// Chases pointers until we find a (constant global) or not. | 93 | /// Chases pointers until we find a (constant global) or not. | ||

91 | bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal); | 94 | bool pointsToConstantMemory(const MemoryLocation &Loc, AAQueryInfo &AAQI, | ||

95 | bool OrLocal); | ||||

92 | 96 | | |||

93 | /// Get the location associated with a pointer argument of a callsite. | 97 | /// Get the location associated with a pointer argument of a callsite. | ||

94 | ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx); | 98 | ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx); | ||

95 | 99 | | |||

96 | /// Returns the behavior when calling the given call site. | 100 | /// Returns the behavior when calling the given call site. | ||

97 | FunctionModRefBehavior getModRefBehavior(const CallBase *Call); | 101 | FunctionModRefBehavior getModRefBehavior(const CallBase *Call); | ||

98 | 102 | | |||

99 | /// Returns the behavior when calling the given function. For use when the | 103 | /// Returns the behavior when calling the given function. For use when the | ||

Show All 35 Lines | 135 | struct DecomposedGEP { | |||

135 | APInt StructOffset; | 139 | APInt StructOffset; | ||

136 | // Total constant offset w.r.t the base from indexing through | 140 | // Total constant offset w.r.t the base from indexing through | ||

137 | // pointers/arrays/vectors | 141 | // pointers/arrays/vectors | ||

138 | APInt OtherOffset; | 142 | APInt OtherOffset; | ||

139 | // Scaled variable (non-constant) indices. | 143 | // Scaled variable (non-constant) indices. | ||

140 | SmallVector<VariableGEPIndex, 4> VarIndices; | 144 | SmallVector<VariableGEPIndex, 4> VarIndices; | ||

141 | }; | 145 | }; | ||

142 | 146 | | |||

143 | /// Track alias queries to guard against recursion. | | |||

144 | using LocPair = std::pair<MemoryLocation, MemoryLocation>; | | |||

145 | using AliasCacheTy = SmallDenseMap<LocPair, AliasResult, 8>; | | |||

146 | AliasCacheTy AliasCache; | | |||

147 | using IsCapturedCacheTy = SmallDenseMap<const Value *, bool, 8>; | | |||

148 | IsCapturedCacheTy IsCapturedCache; | | |||

149 | | ||||

150 | /// Tracks phi nodes we have visited. | 147 | /// Tracks phi nodes we have visited. | ||

151 | /// | 148 | /// | ||

152 | /// When interpret "Value" pointer equality as value equality we need to make | 149 | /// When interpret "Value" pointer equality as value equality we need to make | ||

153 | /// sure that the "Value" is not part of a cycle. Otherwise, two uses could | 150 | /// sure that the "Value" is not part of a cycle. Otherwise, two uses could | ||

154 | /// come from different "iterations" of a cycle and see different values for | 151 | /// come from different "iterations" of a cycle and see different values for | ||

155 | /// the same "Value" pointer. | 152 | /// the same "Value" pointer. | ||

156 | /// | 153 | /// | ||

157 | /// The following example shows the problem: | 154 | /// The following example shows the problem: | ||

Show All 38 Lines | |||||

196 | bool isValueEqualInPotentialCycles(const Value *V1, const Value *V2); | 193 | bool isValueEqualInPotentialCycles(const Value *V1, const Value *V2); | ||

197 | 194 | | |||

198 | void GetIndexDifference(SmallVectorImpl<VariableGEPIndex> &Dest, | 195 | void GetIndexDifference(SmallVectorImpl<VariableGEPIndex> &Dest, | ||

199 | const SmallVectorImpl<VariableGEPIndex> &Src); | 196 | const SmallVectorImpl<VariableGEPIndex> &Src); | ||

200 | 197 | | |||

201 | AliasResult aliasGEP(const GEPOperator *V1, LocationSize V1Size, | 198 | AliasResult aliasGEP(const GEPOperator *V1, LocationSize V1Size, | ||

202 | const AAMDNodes &V1AAInfo, const Value *V2, | 199 | const AAMDNodes &V1AAInfo, const Value *V2, | ||

203 | LocationSize V2Size, const AAMDNodes &V2AAInfo, | 200 | LocationSize V2Size, const AAMDNodes &V2AAInfo, | ||

204 | const Value *UnderlyingV1, const Value *UnderlyingV2); | 201 | const Value *UnderlyingV1, const Value *UnderlyingV2, | ||

202 | AAQueryInfo &AAQI); | ||||

205 | 203 | | |||

206 | AliasResult aliasPHI(const PHINode *PN, LocationSize PNSize, | 204 | AliasResult aliasPHI(const PHINode *PN, LocationSize PNSize, | ||

207 | const AAMDNodes &PNAAInfo, const Value *V2, | 205 | const AAMDNodes &PNAAInfo, const Value *V2, | ||

208 | LocationSize V2Size, const AAMDNodes &V2AAInfo, | 206 | LocationSize V2Size, const AAMDNodes &V2AAInfo, | ||

209 | const Value *UnderV2); | 207 | const Value *UnderV2, AAQueryInfo &AAQI); | ||

210 | 208 | | |||

211 | AliasResult aliasSelect(const SelectInst *SI, LocationSize SISize, | 209 | AliasResult aliasSelect(const SelectInst *SI, LocationSize SISize, | ||

212 | const AAMDNodes &SIAAInfo, const Value *V2, | 210 | const AAMDNodes &SIAAInfo, const Value *V2, | ||

213 | LocationSize V2Size, const AAMDNodes &V2AAInfo, | 211 | LocationSize V2Size, const AAMDNodes &V2AAInfo, | ||

214 | const Value *UnderV2); | 212 | const Value *UnderV2, AAQueryInfo &AAQI); | ||

215 | 213 | | |||

216 | AliasResult aliasCheck(const Value *V1, LocationSize V1Size, | 214 | AliasResult aliasCheck(const Value *V1, LocationSize V1Size, | ||

217 | AAMDNodes V1AATag, const Value *V2, | 215 | AAMDNodes V1AATag, const Value *V2, | ||

218 | LocationSize V2Size, AAMDNodes V2AATag, | 216 | LocationSize V2Size, AAMDNodes V2AATag, | ||

219 | const Value *O1 = nullptr, const Value *O2 = nullptr); | 217 | AAQueryInfo &AAQI, const Value *O1 = nullptr, | ||

218 | const Value *O2 = nullptr); | ||||

220 | }; | 219 | }; | ||

221 | 220 | | |||

222 | /// Analysis pass providing a never-invalidated alias analysis result. | 221 | /// Analysis pass providing a never-invalidated alias analysis result. | ||

223 | class BasicAA : public AnalysisInfoMixin<BasicAA> { | 222 | class BasicAA : public AnalysisInfoMixin<BasicAA> { | ||

224 | friend AnalysisInfoMixin<BasicAA>; | 223 | friend AnalysisInfoMixin<BasicAA>; | ||

225 | 224 | | |||

226 | static AnalysisKey Key; | 225 | static AnalysisKey Key; | ||

227 | 226 | | |||

▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |