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
30#include "CFL/CFLVF.h"
31
32using namespace SVF;
33using namespace SVFUtil;
34
36{
37 // Build CFL Graph
39 if (Options::CFLGraph().empty()) // built from svfir
40 {
43 svfg = memSSA.buildFullSVFG(ander);
45 }
46 else
48
49 // Check CFL Graph and Grammar are accordance with grammar
52}
53
55{
56 // Parameter Checking
58
59 // Build CFL Grammar
61
62 // Build CFL Graph
64
65 // Normalize grammar
67
68 // Initialize solver
70}
71
73{
74 // Check for valid grammar file before parsing other options
75 std::string filename = Options::GrammarFilename();
76 bool vfgfile = (filename.rfind("VFGGrammar.txt") == filename.length() - std::string("VFGGrammar.txt").length());
78 {
79 SVFUtil::errs() << "Invalid VFG grammar file: " << Options::GrammarFilename() << "\n"
80 << "Please use a file that ends with 'VFG.txt', "
81 << "or use the -customized flag to allow custom grammar files.\n";
82 assert(false && "grammar loading failed!"); // exit with error
83 }
84}
85
86
88{
90 {
91 if (Options::CFLGraph().empty())
92 svfir->dump("IR");
93 grammar->dump("Grammar");
94 graph->dump("CFLGraph");
95 }
96}
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:113
virtual void normalizeCFLGrammar()
Normalize grammar.
Definition CFLBase.cpp:105
virtual void buildCFLGrammar()
Build Grammar from text file.
Definition CFLBase.cpp:65
CFLGraph * graph
Definition CFLBase.h:110
CFGrammar * grammar
Definition CFLBase.h:112
SVFIR * svfir
Definition CFLBase.h:109
GrammarBase * grammarBase
Definition CFLBase.h:111
void dump(const std::string &filename)
Definition CFLGraph.cpp:73
virtual void checkParameter()
Parameter Checking.
Definition CFLVF.cpp:72
virtual void finalize()
Print grammar and graph.
Definition CFLVF.cpp:87
virtual void initialize()
Initialize the grammar, graph, solver.
Definition CFLVF.cpp:54
CFLSVFGBuilder memSSA
Definition CFLVF.h:62
void buildCFLGraph()
Build CFLGraph via VFG.
Definition CFLVF.cpp:35
SVFG * svfg
Definition CFLVF.h:63
Kind getStartKind()
Definition CFGrammar.h:205
void dump(std::string name)
Dump SVFIR.
Definition IRGraph.cpp:102
static const Option< bool > Customized
Definition Options.h:239
static const Option< std::string > CFLGraph
Definition Options.h:232
static const Option< bool > PrintCFL
Definition Options.h:233
static const Option< std::string > GrammarFilename
Definition Options.h:231
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:56
for isBitcode
Definition BasicTypes.h:68
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74