diff options
Diffstat (limited to 'llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp index 0a085fc..9b7caf15 100644 --- a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp +++ b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp @@ -1,4 +1,4 @@ -//===- FunctionPropertiesAnalysis.cpp - Function properties extraction ----===// +//===- FunctionPropertiesAnalysis.cpp - Function Properties Analysis ------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// // -// This file implements an analysis extracting function properties, which may be -// used by ML-driven policies, for example. +// This file defines the FunctionPropertiesInfo and FunctionPropertiesAnalysis +// classes used to extract function properties. // //===----------------------------------------------------------------------===// @@ -45,9 +45,27 @@ FunctionPropertiesInfo::getFunctionPropertiesInfo(const Function &F) { return FPI; } +void FunctionPropertiesInfo::print(raw_ostream &OS) const { + OS << "BasicBlockCount: " << BasicBlockCount << "\n" + << "BlocksReachedFromConditionalInstruction: " + << BlocksReachedFromConditionalInstruction << "\n" + << "Uses: " << Uses << "\n" + << "DirectCallsToDefinedFunctions: " << DirectCallsToDefinedFunctions + << "\n\n"; +} + AnalysisKey FunctionPropertiesAnalysis::Key; FunctionPropertiesInfo FunctionPropertiesAnalysis::run(Function &F, FunctionAnalysisManager &FAM) { return FunctionPropertiesInfo::getFunctionPropertiesInfo(F); +} + +PreservedAnalyses +FunctionPropertiesPrinterPass::run(Function &F, FunctionAnalysisManager &AM) { + OS << "Printing analysis results of CFA for function " + << "'" << F.getName() << "':" + << "\n"; + AM.getResult<FunctionPropertiesAnalysis>(F).print(OS); + return PreservedAnalyses::all(); }
\ No newline at end of file |