From b62d4d318ea4aa177d86fe265b9f4f960cf91d40 Mon Sep 17 00:00:00 2001 From: Christian Eichler <code@christian-eichler.de> Date: Wed, 23 Aug 2017 08:51:16 +0200 Subject: [PATCH] Adopt metrics to changes introduced by LLVM 3.8 --- CMakeLists.txt | 2 +- bin/calc-mccabe.cpp | 17 +++++++++-------- bin/call-stack.cpp | 24 ++++++++++++------------ bin/find-inputs.cpp | 18 +++++++++--------- bin/is-recursive.cpp | 24 ++++++++++++------------ bin/loop-stats.cpp | 18 +++++++++--------- bin/metrics.cpp | 18 +++++++++--------- bin/uses-fptr.cpp | 20 ++++++++++---------- bin/uses-fpu.cpp | 17 +++++++++-------- lib/FInputsPass.cpp | 4 +++- lib/FInputsPass.h | 2 +- lib/LoopStatsPass.cpp | 2 +- lib/LoopStatsPass.h | 4 ++-- lib/McCabePass.cpp | 2 +- lib/printing/CallStackPrinter.h | 7 +++---- lib/printing/FInputPrinter.h | 1 - lib/printing/FunctionPointerPrinter.h | 3 +-- lib/printing/LoopStatsPrinter.h | 1 - lib/printing/RecursionPrinter.h | 7 +++---- 19 files changed, 95 insertions(+), 96 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97d31fe..0e071a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ set(METRICS_TEST_DIR ${CMAKE_BINARY_DIR}/tools/find-inputs) configure_lit_site_cfg(${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in ${METRICS_TEST_DIR}/lit.site.cfg) -set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} bitreader asmparser irreader) +set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} analysis core bitreader asmparser irreader passes support option libdriver) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") diff --git a/bin/calc-mccabe.cpp b/bin/calc-mccabe.cpp index c1dba60..89913fa 100644 --- a/bin/calc-mccabe.cpp +++ b/bin/calc-mccabe.cpp @@ -27,6 +27,7 @@ #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -76,25 +77,25 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::FunctionPassManager FPM(M.get()); diff --git a/bin/call-stack.cpp b/bin/call-stack.cpp index 9e8f1fd..1bda73e 100644 --- a/bin/call-stack.cpp +++ b/bin/call-stack.cpp @@ -20,7 +20,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/IR/Function.h" @@ -30,6 +29,7 @@ #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -62,7 +62,7 @@ struct CallStackPrinter : ModulePass { CallStackPrinter(raw_ostream &out, const Function *Func) : ModulePass(ID), Out(out), F(Func) { - initializeCallGraphPass(*PassRegistry::getPassRegistry()); + initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry()); } bool runOnModule(Module &M) override { getRecursions(F); @@ -110,11 +110,11 @@ struct CallStackPrinter : ModulePass { void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); - AU.addRequired<CallGraph>(); + AU.addRequired<CallGraphWrapperPass>(); } void getRecursions(const Function *F) { - const auto CGN = getAnalysis<CallGraph>()[F]; + const auto CGN = getAnalysis<CallGraphWrapperPass>().getCallGraph()[F]; for (auto SI = scc_begin(CGN), SE = scc_end(CGN); SI != SE; ++SI) if (SI.hasLoop()) { @@ -141,25 +141,25 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::PassManager PM; diff --git a/bin/find-inputs.cpp b/bin/find-inputs.cpp index b5d2a76..54d947d 100644 --- a/bin/find-inputs.cpp +++ b/bin/find-inputs.cpp @@ -20,7 +20,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManagers.h" @@ -29,6 +28,7 @@ #include "llvm/IR/Value.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -135,25 +135,25 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::FunctionPassManager FPM(M.get()); diff --git a/bin/is-recursive.cpp b/bin/is-recursive.cpp index 708c431..62bc99c 100644 --- a/bin/is-recursive.cpp +++ b/bin/is-recursive.cpp @@ -18,7 +18,6 @@ */ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/IR/Function.h" @@ -28,6 +27,7 @@ #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -59,7 +59,7 @@ struct RecursionPrinter : ModulePass { RecursionPrinter(raw_ostream &out, const Function *Func) : ModulePass(ID), Out(out), F(Func) { - initializeCallGraphPass(*PassRegistry::getPassRegistry()); + initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry()); } bool runOnModule(Module &M) override { getRecursions(F); @@ -90,11 +90,11 @@ struct RecursionPrinter : ModulePass { void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); - AU.addRequired<CallGraph>(); + AU.addRequired<CallGraphWrapperPass>(); } void getRecursions(const Function *F) { - const auto CGN = getAnalysis<CallGraph>()[F]; + const auto CGN = getAnalysis<CallGraphWrapperPass>().getCallGraph()[F]; for (auto SI = scc_begin(CGN), SE = scc_end(CGN); SI != SE; ++SI) if (SI.hasLoop()) { @@ -121,25 +121,25 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::PassManager PM; diff --git a/bin/loop-stats.cpp b/bin/loop-stats.cpp index 5c4d36f..878a0f4 100644 --- a/bin/loop-stats.cpp +++ b/bin/loop-stats.cpp @@ -20,7 +20,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManagers.h" @@ -28,6 +27,7 @@ #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -85,25 +85,25 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::PassManager PM; diff --git a/bin/metrics.cpp b/bin/metrics.cpp index 2805aaa..20f8274 100644 --- a/bin/metrics.cpp +++ b/bin/metrics.cpp @@ -29,7 +29,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManagers.h" @@ -38,6 +37,7 @@ #include "llvm/IR/Value.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -105,25 +105,25 @@ int main(int argc, char **argv) { if (debug::opt::DumpRegisteredPasses) debug::DumpRegisteredPasses(); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::PassManager PM; diff --git a/bin/uses-fptr.cpp b/bin/uses-fptr.cpp index e8aedcd..073c0ad 100644 --- a/bin/uses-fptr.cpp +++ b/bin/uses-fptr.cpp @@ -20,7 +20,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManagers.h" @@ -28,6 +27,7 @@ #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -59,7 +59,7 @@ struct FunctionPointerPrinter : ModulePass { FunctionPointerPrinter(raw_ostream &out, const Function *Func) : ModulePass(ID), Out(out), F(Func) { - initializeCallGraphPass(*PassRegistry::getPassRegistry()); + initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry()); } bool runOnModule(Module &M) override { @@ -115,25 +115,25 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::PassManager PM; diff --git a/bin/uses-fpu.cpp b/bin/uses-fpu.cpp index bc3e9da..a009f49 100644 --- a/bin/uses-fpu.cpp +++ b/bin/uses-fpu.cpp @@ -28,6 +28,7 @@ #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -115,25 +116,25 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - std::string ErrorInfo; - OwningPtr<tool_output_file> Out; - Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo, - sys::fs::F_Append)); + std::error_code ErrorInfo; + auto Out = std::unique_ptr<tool_output_file>( + new tool_output_file(OutputFilename, ErrorInfo, sys::fs::F_Append) + ); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << "\n"; + if (ErrorInfo) { + errs() << ErrorInfo.message() << "\n"; exit(EXIT_FAILURE); } SMDiagnostic Err; - OwningPtr<Module> M; + std::unique_ptr<Module> M; if (!sys::fs::exists(InputFilename)) { errs() << "File '" << InputFilename << "' not found.\n"; exit(EXIT_FAILURE); } - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); assert(M.get() != nullptr && "Could not initialize module"); legacy::FunctionPassManager FPM(M.get()); diff --git a/lib/FInputsPass.cpp b/lib/FInputsPass.cpp index eb73bb5..84d95bd 100644 --- a/lib/FInputsPass.cpp +++ b/lib/FInputsPass.cpp @@ -19,12 +19,14 @@ #include "lib/FInputsPass.h" #include "lib/Util.h" +#include "llvm-c/Core.h" + #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Operator.h" #include "llvm/IR/User.h" -#include "llvm/Support/CFG.h" +#include "llvm/Analysis/CFG.h" #include "llvm/Support/Format.h" #include "llvm/Support/FormattedStream.h" diff --git a/lib/FInputsPass.h b/lib/FInputsPass.h index ecc5bf9..42214e9 100644 --- a/lib/FInputsPass.h +++ b/lib/FInputsPass.h @@ -20,7 +20,7 @@ #include "FInputsResult.h" -#include "llvm/InstVisitor.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/Pass.h" //#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/IR/Function.h" diff --git a/lib/LoopStatsPass.cpp b/lib/LoopStatsPass.cpp index 67bc3a9..c09e0ee 100644 --- a/lib/LoopStatsPass.cpp +++ b/lib/LoopStatsPass.cpp @@ -62,7 +62,7 @@ LoopStats LoopStatsPass::examineFunction(Function &F, visited.insert(&F); std::map<unsigned, unsigned> depths; - LoopInfo &LI = getAnalysis<LoopInfo>(F); + LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>(F).getLoopInfo(); auto It = LI.begin(); auto Et = LI.end(); unsigned int loops = std::distance(It, Et); diff --git a/lib/LoopStatsPass.h b/lib/LoopStatsPass.h index 7d4587a..2e643b4 100644 --- a/lib/LoopStatsPass.h +++ b/lib/LoopStatsPass.h @@ -33,13 +33,13 @@ class LoopStatsPass : public ModulePass { public: static char ID; LoopStatsPass() : ModulePass(ID) { - initializeLoopInfoPass(*PassRegistry::getPassRegistry()); + initializeLoopInfoWrapperPassPass(*PassRegistry::getPassRegistry()); } bool runOnModule(Module &M) override; void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); - AU.addRequired<LoopInfo>(); + AU.addRequired<LoopInfoWrapperPass>(); } LoopStats loopStats(Function &F); diff --git a/lib/McCabePass.cpp b/lib/McCabePass.cpp index b4d7863..92ff51f 100644 --- a/lib/McCabePass.cpp +++ b/lib/McCabePass.cpp @@ -21,7 +21,7 @@ #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Instructions.h" -#include "llvm/Support/CFG.h" +#include "llvm/Analysis/CFG.h" #include "llvm/Support/FormattedStream.h" using namespace llvm; diff --git a/lib/printing/CallStackPrinter.h b/lib/printing/CallStackPrinter.h index a1478d7..e53a974 100644 --- a/lib/printing/CallStackPrinter.h +++ b/lib/printing/CallStackPrinter.h @@ -20,7 +20,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/IR/Function.h" @@ -51,7 +50,7 @@ struct CallStackPrinter : ModulePass { CallStackPrinter(raw_ostream &out, const Function *Func) : ModulePass(ID), Out(out), F(Func) { - initializeCallGraphPass(*PassRegistry::getPassRegistry()); + initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry()); } bool runOnModule(Module &M) override { getRecursions(F); @@ -99,11 +98,11 @@ struct CallStackPrinter : ModulePass { void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); - AU.addRequired<CallGraph>(); + AU.addRequired<CallGraphWrapperPass>(); } void getRecursions(const Function *F) { - const auto CGN = getAnalysis<CallGraph>()[F]; + const auto CGN = getAnalysis<CallGraphWrapperPass>().getCallGraph()[F]; for (auto SI = scc_begin(CGN), SE = scc_end(CGN); SI != SE; ++SI) if (SI.hasLoop()) { diff --git a/lib/printing/FInputPrinter.h b/lib/printing/FInputPrinter.h index edcfa0c..44d675c 100644 --- a/lib/printing/FInputPrinter.h +++ b/lib/printing/FInputPrinter.h @@ -18,7 +18,6 @@ */ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManagers.h" diff --git a/lib/printing/FunctionPointerPrinter.h b/lib/printing/FunctionPointerPrinter.h index 3307e05..6704ca6 100644 --- a/lib/printing/FunctionPointerPrinter.h +++ b/lib/printing/FunctionPointerPrinter.h @@ -20,7 +20,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManagers.h" @@ -48,7 +47,7 @@ struct FunctionPointerPrinter : ModulePass { FunctionPointerPrinter(raw_ostream &out, const Function *Func) : ModulePass(ID), Out(out), F(Func) { - initializeCallGraphPass(*PassRegistry::getPassRegistry()); + initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry()); } bool runOnModule(Module &M) override { diff --git a/lib/printing/LoopStatsPrinter.h b/lib/printing/LoopStatsPrinter.h index 44459b9..5d557e3 100644 --- a/lib/printing/LoopStatsPrinter.h +++ b/lib/printing/LoopStatsPrinter.h @@ -22,7 +22,6 @@ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManagers.h" diff --git a/lib/printing/RecursionPrinter.h b/lib/printing/RecursionPrinter.h index 1e15b86..ea5b30e 100644 --- a/lib/printing/RecursionPrinter.h +++ b/lib/printing/RecursionPrinter.h @@ -18,7 +18,6 @@ */ #include "llvm/Pass.h" #include "llvm/PassRegistry.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/IR/Function.h" @@ -48,7 +47,7 @@ struct RecursionPrinter : ModulePass { RecursionPrinter(raw_ostream &out, const Function *Func) : ModulePass(ID), Out(out), F(Func) { - initializeCallGraphPass(*PassRegistry::getPassRegistry()); + initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry()); } bool runOnModule(Module &M) override { getRecursions(F); @@ -80,11 +79,11 @@ struct RecursionPrinter : ModulePass { void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); - AU.addRequired<CallGraph>(); + AU.addRequired<CallGraphWrapperPass>(); } void getRecursions(const Function *F) { - const auto CGN = getAnalysis<CallGraph>()[F]; + const auto CGN = getAnalysis<CallGraphWrapperPass>().getCallGraph()[F]; for (auto SI = scc_begin(CGN), SE = scc_end(CGN); SI != SE; ++SI) if (SI.hasLoop()) { -- GitLab