@@ -192,6 +192,8 @@ class Dependences final {
192192 const AnalysisLevel Level;
193193};
194194
195+ extern Dependences::AnalysisLevel OptAnalysisLevel;
196+
195197struct DependenceAnalysis final : public AnalysisInfoMixin<DependenceAnalysis> {
196198 static AnalysisKey Key;
197199 struct Result {
@@ -232,108 +234,7 @@ struct DependenceInfoPrinterPass final
232234 raw_ostream &OS;
233235};
234236
235- class DependenceInfo final : public ScopPass {
236- public:
237- static char ID;
238-
239- // / Construct a new DependenceInfo pass.
240- DependenceInfo () : ScopPass(ID) {}
241-
242- // / Return the dependence information for the current SCoP.
243- // /
244- // / @param Level The granularity of dependence analysis result.
245- // /
246- // / @return The dependence analysis result
247- // /
248- const Dependences &getDependences (Dependences::AnalysisLevel Level);
249-
250- // / Recompute dependences from schedule and memory accesses.
251- const Dependences &recomputeDependences (Dependences::AnalysisLevel Level);
252-
253- // / Invalidate the dependence information and recompute it when needed again.
254- // / May be required when the underlying Scop was changed in a way that would
255- // / add new dependencies (e.g. between new statement instances insierted into
256- // / the SCoP) or intentionally breaks existing ones. It is not required when
257- // / updating the schedule that conforms the existing dependencies.
258- void abandonDependences ();
259-
260- // / Compute the dependence information for the SCoP @p S.
261- bool runOnScop (Scop &S) override ;
262-
263- // / Print the dependences for the given SCoP to @p OS.
264- void printScop (raw_ostream &OS, Scop &) const override ;
265-
266- // / Release the internal memory.
267- void releaseMemory () override {
268- for (auto &d : D)
269- d.reset ();
270- }
271-
272- // / Register all analyses and transformation required.
273- void getAnalysisUsage (AnalysisUsage &AU) const override ;
274-
275- private:
276- Scop *S;
277-
278- // / Dependences struct for the current SCoP.
279- std::unique_ptr<Dependences> D[Dependences::NumAnalysisLevels];
280- };
281-
282- llvm::Pass *createDependenceInfoPass ();
283- llvm::Pass *createDependenceInfoPrinterLegacyPass (llvm::raw_ostream &OS);
284-
285- // / Construct a new DependenceInfoWrapper pass.
286- class DependenceInfoWrapperPass final : public FunctionPass {
287- public:
288- static char ID;
289-
290- // / Construct a new DependenceInfoWrapper pass.
291- DependenceInfoWrapperPass () : FunctionPass(ID) {}
292-
293- // / Return the dependence information for the given SCoP.
294- // /
295- // / @param S SCoP object.
296- // / @param Level The granularity of dependence analysis result.
297- // /
298- // / @return The dependence analysis result
299- // /
300- const Dependences &getDependences (Scop *S, Dependences::AnalysisLevel Level);
301-
302- // / Recompute dependences from schedule and memory accesses.
303- const Dependences &recomputeDependences (Scop *S,
304- Dependences::AnalysisLevel Level);
305-
306- // / Compute the dependence information on-the-fly for the function.
307- bool runOnFunction (Function &F) override ;
308-
309- // / Print the dependences for the current function to @p OS.
310- void print (raw_ostream &OS, const Module *M = nullptr ) const override ;
311-
312- // / Release the internal memory.
313- void releaseMemory () override { ScopToDepsMap.clear (); }
314-
315- // / Register all analyses and transformation required.
316- void getAnalysisUsage (AnalysisUsage &AU) const override ;
317-
318- private:
319- using ScopToDepsMapTy = DenseMap<Scop *, std::unique_ptr<Dependences>>;
320-
321- // / Scop to Dependence map for the current function.
322- ScopToDepsMapTy ScopToDepsMap;
323- };
324-
325- llvm::Pass *createDependenceInfoWrapperPassPass ();
326- llvm::Pass *
327- createDependenceInfoPrinterLegacyFunctionPass (llvm::raw_ostream &OS);
328-
237+ DependenceAnalysis::Result runDependenceAnalysis (Scop &S);
329238} // namespace polly
330239
331- namespace llvm {
332- void initializeDependenceInfoPass (llvm::PassRegistry &);
333- void initializeDependenceInfoPrinterLegacyPassPass (llvm::PassRegistry &);
334- void initializeDependenceInfoWrapperPassPass (llvm::PassRegistry &);
335- void initializeDependenceInfoPrinterLegacyFunctionPassPass (
336- llvm::PassRegistry &);
337- } // namespace llvm
338-
339240#endif
0 commit comments