MCPcopy Create free account
hub / github.com/Samsung/UTopia / analyze

Method analyze

lib/target_analysis/TargetLibAnalyzer.cpp:37–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37bool TargetLibAnalyzer::analyze() {
38 if (!SL || !AL)
39 return false;
40
41 AC = AL->load();
42 SC = SL->load();
43 if (!SC)
44 return false;
45
46 auto &M = *const_cast<llvm::Module *>(&SC->getLLVMModule());
47 std::vector<clang::ASTUnit *> ASTUnits;
48 for (auto *ASTUnit : SC->getASTUnits()) {
49 assert(ASTUnit && "Unexpected Program State");
50 ASTUnits.push_back(ASTUnit);
51 }
52
53 AnalyzedTargetLib = std::make_unique<TargetLib>(AC);
54 if (!AnalyzedTargetLib)
55 return false;
56
57 prepareLLVMAnalysis(M);
58
59 auto Funcs = collectAnalyzableIRFunctions();
60 Analyzers.emplace_back(
61 std::make_unique<AllocSizeAnalyzer>(&Solver, Funcs, &AllocSizeReport));
62 Analyzers.emplace_back(
63 std::make_unique<ArrayAnalyzer>(&Solver, Funcs, FAM, &ArrayReport));
64 Analyzers.emplace_back(std::make_unique<ConstAnalyzer>(ASTUnits));
65 Analyzers.emplace_back(
66 std::make_unique<DirectionAnalyzer>(&Solver, Funcs, &DirectionReport));
67 Analyzers.emplace_back(
68 std::make_unique<FilePathAnalyzer>(&Solver, Funcs, &FilePathReport));
69 Analyzers.emplace_back(
70 std::make_unique<LoopAnalyzer>(&Solver, Funcs, FAM, &LoopReport));
71 Analyzers.emplace_back(
72 std::make_unique<ParamNumberAnalyzer>(ASTUnits, M, AC));
73 Analyzers.emplace_back(std::make_unique<TypeAnalyzer>(ASTUnits));
74
75 for (auto &Analyzer : Analyzers) {
76 if (!Analyzer)
77 continue;
78
79 Reports.emplace_back(Analyzer->getReport());
80 }
81 return true;
82}
83
84bool TargetLibAnalyzer::dump(std::string OutputFilePath) const {
85 if (!AnalyzedTargetLib)

Callers

nothing calls this directly

Calls 4

getLLVMModuleMethod · 0.80
loadMethod · 0.45
getASTUnitsMethod · 0.45
getReportMethod · 0.45

Tested by

no test coverage detected