@@ -889,206 +889,3 @@ DependenceAnalysis::Result polly::runDependenceAnalysis(Scop &S) {
889889 DependenceAnalysis::Result Result{S, {}};
890890 return Result;
891891}
892-
893- const Dependences &
894- DependenceInfo::recomputeDependences (Dependences::AnalysisLevel Level) {
895- D[Level].reset (new Dependences (S->getSharedIslCtx (), Level));
896- D[Level]->calculateDependences (*S);
897- return *D[Level];
898- }
899-
900- void DependenceInfo::abandonDependences () {
901- for (std::unique_ptr<Dependences> &Deps : D)
902- Deps.release ();
903- }
904-
905- bool DependenceInfo::runOnScop (Scop &ScopVar) {
906- S = &ScopVar;
907- return false ;
908- }
909-
910- // / Print the dependences for the given SCoP to @p OS.
911-
912- void polly::DependenceInfo::printScop (raw_ostream &OS, Scop &S) const {
913- if (auto d = D[OptAnalysisLevel].get ()) {
914- d->print (OS);
915- return ;
916- }
917-
918- // Otherwise create the dependences on-the-fly and print it
919- Dependences D (S.getSharedIslCtx (), OptAnalysisLevel);
920- D.calculateDependences (S);
921- D.print (OS);
922- }
923-
924- void DependenceInfo::getAnalysisUsage (AnalysisUsage &AU) const {
925- AU.addRequiredTransitive <ScopInfoRegionPass>();
926- AU.setPreservesAll ();
927- }
928-
929- char DependenceInfo::ID = 0 ;
930-
931- Pass *polly::createDependenceInfoPass () { return new DependenceInfo (); }
932-
933- INITIALIZE_PASS_BEGIN (DependenceInfo, " polly-dependences" ,
934- " Polly - Calculate dependences" , false , false );
935- INITIALIZE_PASS_DEPENDENCY (ScopInfoRegionPass);
936- INITIALIZE_PASS_END (DependenceInfo, " polly-dependences" ,
937- " Polly - Calculate dependences" , false , false )
938-
939- // ===----------------------------------------------------------------------===//
940-
941- namespace {
942- // / Print result from DependenceAnalysis.
943- class DependenceInfoPrinterLegacyPass final : public ScopPass {
944- public:
945- static char ID;
946-
947- DependenceInfoPrinterLegacyPass () : DependenceInfoPrinterLegacyPass(outs()) {}
948-
949- explicit DependenceInfoPrinterLegacyPass (llvm::raw_ostream &OS)
950- : ScopPass(ID), OS(OS) {}
951-
952- bool runOnScop (Scop &S) override {
953- DependenceInfo &P = getAnalysis<DependenceInfo>();
954-
955- OS << " Printing analysis '" << P.getPassName () << " ' for "
956- << " region: '" << S.getRegion ().getNameStr () << " ' in function '"
957- << S.getFunction ().getName () << " ':\n " ;
958- P.printScop (OS, S);
959-
960- return false ;
961- }
962-
963- void getAnalysisUsage (AnalysisUsage &AU) const override {
964- ScopPass::getAnalysisUsage (AU);
965- AU.addRequired <DependenceInfo>();
966- AU.setPreservesAll ();
967- }
968-
969- private:
970- llvm::raw_ostream &OS;
971- };
972-
973- char DependenceInfoPrinterLegacyPass::ID = 0 ;
974- } // namespace
975-
976- Pass *polly::createDependenceInfoPrinterLegacyPass (raw_ostream &OS) {
977- return new DependenceInfoPrinterLegacyPass (OS);
978- }
979-
980- INITIALIZE_PASS_BEGIN (DependenceInfoPrinterLegacyPass,
981- " polly-print-dependences" , " Polly - Print dependences" ,
982- false , false );
983- INITIALIZE_PASS_DEPENDENCY (DependenceInfo);
984- INITIALIZE_PASS_END (DependenceInfoPrinterLegacyPass, " polly-print-dependences" ,
985- " Polly - Print dependences" , false , false )
986-
987- // ===----------------------------------------------------------------------===//
988-
989- const Dependences &
990- DependenceInfoWrapperPass::getDependences(Scop *S,
991- Dependences::AnalysisLevel Level) {
992- auto It = ScopToDepsMap.find (S);
993- if (It != ScopToDepsMap.end ())
994- if (It->second ) {
995- if (It->second ->getDependenceLevel () == Level)
996- return *It->second ;
997- }
998- return recomputeDependences (S, Level);
999- }
1000-
1001- const Dependences &DependenceInfoWrapperPass::recomputeDependences (
1002- Scop *S, Dependences::AnalysisLevel Level) {
1003- std::unique_ptr<Dependences> D (new Dependences (S->getSharedIslCtx (), Level));
1004- D->calculateDependences (*S);
1005- auto Inserted = ScopToDepsMap.insert (std::make_pair (S, std::move (D)));
1006- return *Inserted.first ->second ;
1007- }
1008-
1009- bool DependenceInfoWrapperPass::runOnFunction (Function &F) {
1010- auto &SI = *getAnalysis<ScopInfoWrapperPass>().getSI ();
1011- for (auto &It : SI) {
1012- assert (It.second && " Invalid SCoP object!" );
1013- recomputeDependences (It.second .get (), Dependences::AL_Access);
1014- }
1015- return false ;
1016- }
1017-
1018- void DependenceInfoWrapperPass::print (raw_ostream &OS, const Module *M) const {
1019- for (auto &It : ScopToDepsMap) {
1020- assert ((It.first && It.second ) && " Invalid Scop or Dependence object!\n " );
1021- It.second ->print (OS);
1022- }
1023- }
1024-
1025- void DependenceInfoWrapperPass::getAnalysisUsage (AnalysisUsage &AU) const {
1026- AU.addRequiredTransitive <ScopInfoWrapperPass>();
1027- AU.setPreservesAll ();
1028- }
1029-
1030- char DependenceInfoWrapperPass::ID = 0 ;
1031-
1032- Pass *polly::createDependenceInfoWrapperPassPass () {
1033- return new DependenceInfoWrapperPass ();
1034- }
1035-
1036- INITIALIZE_PASS_BEGIN (
1037- DependenceInfoWrapperPass, " polly-function-dependences" ,
1038- " Polly - Calculate dependences for all the SCoPs of a function" , false ,
1039- false )
1040- INITIALIZE_PASS_DEPENDENCY(ScopInfoWrapperPass);
1041- INITIALIZE_PASS_END (
1042- DependenceInfoWrapperPass, " polly-function-dependences" ,
1043- " Polly - Calculate dependences for all the SCoPs of a function" , false ,
1044- false )
1045-
1046- // ===----------------------------------------------------------------------===//
1047-
1048- namespace {
1049- // / Print result from DependenceInfoWrapperPass.
1050- class DependenceInfoPrinterLegacyFunctionPass final : public FunctionPass {
1051- public:
1052- static char ID;
1053-
1054- DependenceInfoPrinterLegacyFunctionPass ()
1055- : DependenceInfoPrinterLegacyFunctionPass(outs()) {}
1056-
1057- explicit DependenceInfoPrinterLegacyFunctionPass (llvm::raw_ostream &OS)
1058- : FunctionPass(ID), OS(OS) {}
1059-
1060- bool runOnFunction (Function &F) override {
1061- DependenceInfoWrapperPass &P = getAnalysis<DependenceInfoWrapperPass>();
1062-
1063- OS << " Printing analysis '" << P.getPassName () << " ' for function '"
1064- << F.getName () << " ':\n " ;
1065- P.print (OS);
1066-
1067- return false ;
1068- }
1069-
1070- void getAnalysisUsage (AnalysisUsage &AU) const override {
1071- FunctionPass::getAnalysisUsage (AU);
1072- AU.addRequired <DependenceInfoWrapperPass>();
1073- AU.setPreservesAll ();
1074- }
1075-
1076- private:
1077- llvm::raw_ostream &OS;
1078- };
1079-
1080- char DependenceInfoPrinterLegacyFunctionPass::ID = 0 ;
1081- } // namespace
1082-
1083- Pass *polly::createDependenceInfoPrinterLegacyFunctionPass (raw_ostream &OS) {
1084- return new DependenceInfoPrinterLegacyFunctionPass (OS);
1085- }
1086-
1087- INITIALIZE_PASS_BEGIN (
1088- DependenceInfoPrinterLegacyFunctionPass, " polly-print-function-dependences" ,
1089- " Polly - Print dependences for all the SCoPs of a function" , false , false );
1090- INITIALIZE_PASS_DEPENDENCY (DependenceInfoWrapperPass);
1091- INITIALIZE_PASS_END (DependenceInfoPrinterLegacyFunctionPass,
1092- " polly-print-function-dependences" ,
1093- " Polly - Print dependences for all the SCoPs of a function" ,
1094- false , false )
0 commit comments