Static Value-Flow Analysis
Public Member Functions | Private Attributes | List of all members
SVF::MTA Class Reference

#include <MTA.h>

Public Member Functions

 MTA ()
 Constructor. More...
 
virtual ~MTA ()
 Destructor. More...
 
virtual bool runOnModule (SVFIR *module)
 We start the pass here. More...
 
virtual MHPcomputeMHP (SVFModule *module)
 Compute MHP. More...
 
virtual LockAnalysiscomputeLocksets (TCT *tct)
 Compute locksets. More...
 
virtual void detect (SVFModule *module)
 Perform detection. More...
 
MHPgetMHP ()
 
LockAnalysisgetLockAnalysis ()
 

Private Attributes

ThreadCallGraphtcg
 
std::unique_ptr< TCTtct
 
std::unique_ptr< MTAStatstat
 
MHPmhp
 
LockAnalysislsa
 

Detailed Description

Base data race detector

Definition at line 56 of file MTA.h.

Constructor & Destructor Documentation

◆ MTA()

MTA::MTA ( )

Constructor.

Definition at line 43 of file MTA.cpp.

43  : tcg(nullptr), tct(nullptr), mhp(nullptr), lsa(nullptr)
44 {
45  stat = std::make_unique<MTAStat>();
46 }
ThreadCallGraph * tcg
Definition: MTA.h:89
std::unique_ptr< TCT > tct
Definition: MTA.h:90
LockAnalysis * lsa
Definition: MTA.h:93
MHP * mhp
Definition: MTA.h:92
std::unique_ptr< MTAStat > stat
Definition: MTA.h:91

◆ ~MTA()

MTA::~MTA ( )
virtual

Destructor.

Definition at line 48 of file MTA.cpp.

49 {
50  if (tcg)
51  delete tcg;
52  //if (tct)
53  // delete tct;
54  delete mhp;
55  delete lsa;
56 }

Member Function Documentation

◆ computeLocksets()

LockAnalysis * MTA::computeLocksets ( TCT tct)
virtual

Compute locksets.

Compute lock sets

Definition at line 75 of file MTA.cpp.

76 {
78  lsa->analyze();
79  return lsa;
80 }

◆ computeMHP()

MHP * MTA::computeMHP ( SVFModule module)
virtual

Compute MHP.

Definition at line 82 of file MTA.cpp.

83 {
84 
85  DBOUT(DGENERAL, outs() << pasMsg("MTA analysis\n"));
86  DBOUT(DMTA, outs() << pasMsg("MTA analysis\n"));
87  SVFIR* pag = PAG::getPAG();
89  pta->getCallGraph()->dump("ptacg");
90 
91  DBOUT(DGENERAL, outs() << pasMsg("Build TCT\n"));
92  DBOUT(DMTA, outs() << pasMsg("Build TCT\n"));
93  DOTIMESTAT(double tctStart = stat->getClk());
94  tct = std::make_unique<TCT>(pta);
95  tcg = tct->getThreadCallGraph();
96  DOTIMESTAT(double tctEnd = stat->getClk());
97  DOTIMESTAT(stat->TCTTime += (tctEnd - tctStart) / TIMEINTERVAL);
98 
99  if (pta->printStat())
100  {
101  stat->performThreadCallGraphStat(tcg);
102  stat->performTCTStat(tct.get());
103  }
104 
105  tcg->dump("tcg");
106 
107  DBOUT(DGENERAL, outs() << pasMsg("MHP analysis\n"));
108  DBOUT(DMTA, outs() << pasMsg("MHP analysis\n"));
109 
110  DOTIMESTAT(double mhpStart = stat->getClk());
111  MHP* mhp = new MHP(tct.get());
112  mhp->analyze();
113  DOTIMESTAT(double mhpEnd = stat->getClk());
114  DOTIMESTAT(stat->MHPTime += (mhpEnd - mhpStart) / TIMEINTERVAL);
115 
116  DBOUT(DGENERAL, outs() << pasMsg("MHP analysis finish\n"));
117  DBOUT(DMTA, outs() << pasMsg("MHP analysis finish\n"));
118  return mhp;
119 }
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
Definition: SVFType.h:484
#define TIMEINTERVAL
Definition: SVFType.h:512
#define DMTA
Definition: SVFType.h:505
#define DGENERAL
Definition: SVFType.h:490
#define DOTIMESTAT(X)
Definition: SVFType.h:486
static AndersenWaveDiff * createAndersenWaveDiff(SVFIR *_pag)
Create an singleton instance directly instead of invoking llvm pass manager.
Definition: Andersen.h:408
Definition: MHP.h:46
void analyze()
Start analysis here.
Definition: MHP.cpp:62
void dump(const std::string &filename)
Dump the graph.
bool printStat()
Whether print statistics.
PTACallGraph * getCallGraph() const
Return call graph.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition: SVFIR.h:115
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
Definition: SVFUtil.cpp:99
std::ostream & outs()
Overwrite llvm::outs()
Definition: SVFUtil.h:50

◆ detect()

virtual void SVF::MTA::detect ( SVFModule module)
virtual

Perform detection.

◆ getLockAnalysis()

LockAnalysis* SVF::MTA::getLockAnalysis ( )
inline

Definition at line 84 of file MTA.h.

85  {
86  return lsa;
87  }

◆ getMHP()

MHP* SVF::MTA::getMHP ( )
inline

Definition at line 79 of file MTA.h.

80  {
81  return mhp;
82  }

◆ runOnModule()

bool MTA::runOnModule ( SVFIR pag)
virtual

We start the pass here.

Perform data race detection

Definition at line 61 of file MTA.cpp.

62 {
63  mhp = computeMHP(pag->getModule());
65 
66  if(Options::RaceCheck())
67  detect(pag->getModule());
68 
69  return false;
70 }
TCT * getTCT() const
Get Thread Creation Tree.
Definition: MHP.h:80
virtual LockAnalysis * computeLocksets(TCT *tct)
Compute locksets.
Definition: MTA.cpp:75
virtual MHP * computeMHP(SVFModule *module)
Compute MHP.
Definition: MTA.cpp:82
virtual void detect(SVFModule *module)
Perform detection.
static const Option< bool > RaceCheck
data race checker, Default: false
Definition: Options.h:260
SVFModule * getModule()
Definition: SVFIR.h:161

Member Data Documentation

◆ lsa

LockAnalysis* SVF::MTA::lsa
private

Definition at line 93 of file MTA.h.

◆ mhp

MHP* SVF::MTA::mhp
private

Definition at line 92 of file MTA.h.

◆ stat

std::unique_ptr<MTAStat> SVF::MTA::stat
private

Definition at line 91 of file MTA.h.

◆ tcg

ThreadCallGraph* SVF::MTA::tcg
private

Definition at line 89 of file MTA.h.

◆ tct

std::unique_ptr<TCT> SVF::MTA::tct
private

Definition at line 90 of file MTA.h.


The documentation for this class was generated from the following files: