Static Value-Flow Analysis
Loading...
Searching...
No Matches
CFLVF.cpp
Go to the documentation of this file.
1//===----- CFLVF.cpp -- CFL Value Flow Client--------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23/*
24 * CFLAlias.cpp
25 *
26 * Created on: September 7 , 2022
27 * Author: Pei Xu
28 */
29
31#include "CFL/CFLVF.h"
33#include "WPA/Andersen.h"
34
35using namespace SVF;
36using namespace SVFUtil;
37
39{
40 // Build CFL Graph
42 if (Options::CFLGraph().empty()) // built from svfir
43 {
46 svfg = memSSA.buildFullSVFG(ander);
48 }
49 else
51
52 // Check CFL Graph and Grammar are accordance with grammar
55}
56
58{
59 // Parameter Checking
61
62 // Build CFL Grammar
64
65 // Build CFL Graph
67
68 // Normalize grammar
70
71 // Initialize solver
73}
74
76{
77 // Check for valid grammar file before parsing other options
78 std::string filename = Options::GrammarFilename();
79 bool vfgfile = (filename.rfind("VFGGrammar.txt") == filename.length() - std::string("VFGGrammar.txt").length());
81 {
82 SVFUtil::errs() << "Invalid VFG grammar file: " << Options::GrammarFilename() << "\n"
83 << "Please use a file that ends with 'VFG.txt', "
84 << "or use the -customized flag to allow custom grammar files.\n";
85 assert(false && "grammar loading failed!"); // exit with error
86 }
87}
88
89
91{
93 {
94 if (Options::CFLGraph().empty())
95 svfir->dump("IR");
96 grammar->dump("Grammar");
97 graph->dump("CFLGraph");
98 }
99}
static AndersenWaveDiff * createAndersenWaveDiff(SVFIR *_pag)
Create an singleton instance directly instead of invoking llvm pass manager.
Definition Andersen.h:408
void dump() const
CFLSolver * solver
Definition CFLBase.h:110
virtual void normalizeCFLGrammar()
Normalize grammar.
Definition CFLBase.cpp:111
virtual void buildCFLGrammar()
Build Grammar from text file.
Definition CFLBase.cpp:71
CFLGraph * graph
Definition CFLBase.h:107
CFGrammar * grammar
Definition CFLBase.h:109
SVFIR * svfir
Definition CFLBase.h:106
GrammarBase * grammarBase
Definition CFLBase.h:108
void dump(const std::string &filename)
Definition CFLGraph.cpp:73
virtual void checkParameter()
Parameter Checking.
Definition CFLVF.cpp:75
virtual void finalize()
Print grammar and graph.
Definition CFLVF.cpp:90
virtual void initialize()
Initialize the grammar, graph, solver.
Definition CFLVF.cpp:57
CFLSVFGBuilder memSSA
Definition CFLVF.h:65
void buildCFLGraph()
Build CFLGraph via VFG.
Definition CFLVF.cpp:38
SVFG * svfg
Definition CFLVF.h:66
Kind getStartKind()
Definition CFGrammar.h:209
void dump(std::string name)
Dump SVFIR.
Definition IRGraph.cpp:320
static const Option< bool > Customized
Definition Options.h:229
static const Option< std::string > CFLGraph
Definition Options.h:222
static const Option< bool > PrintCFL
Definition Options.h:223
static const Option< std::string > GrammarFilename
Definition Options.h:221
virtual void initialize()
Initialization of a pointer analysis, including building symbol table and SVFIR etc.
static SVFIR * pag
SVFIR.
SVFG * buildFullSVFG(BVDataPTAImpl *pta)
VFCFLGraphBuilder: a CFLGraphBuilder specialized for handling value-flow.
std::ostream & errs()
Overwrite llvm::errs()
Definition SVFUtil.h:58
for isBitcode
Definition BasicTypes.h:70
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76