SVF
Public Types | Public Member Functions | Private Attributes | List of all members
SVF::PTACFInfoBuilder Class Reference

#include <DataFlowUtil.h>

Public Types

typedef Map< const Function *, DominatorTree * > FunToDTMap
 map a function to its dominator tree More...
 
typedef Map< const Function *, PostDominatorTree * > FunToPostDTMap
 map a function to its post dominator tree More...
 
typedef Map< const Function *, LoopInfo * > FunToLoopInfoMap
 map a function to its loop info More...
 

Public Member Functions

 PTACFInfoBuilder ()
 Constructor. More...
 
 ~PTACFInfoBuilder ()
 
LoopInfogetLoopInfo (const Function *f)
 Get loop info of a function. More...
 
PostDominatorTreegetPostDT (const Function *f)
 Get post dominator tree of a function. More...
 
DominatorTreegetDT (const Function *f)
 Get dominator tree of a function. More...
 

Private Attributes

FunToLoopInfoMap funToLoopInfoMap
 map a function to its loop info More...
 
FunToDTMap funToDTMap
 map a function to its dominator tree More...
 
FunToPostDTMap funToPDTMap
 map a function to its post dominator tree More...
 

Detailed Description

Definition at line 121 of file DataFlowUtil.h.

Member Typedef Documentation

◆ FunToDTMap

map a function to its dominator tree

Definition at line 123 of file DataFlowUtil.h.

◆ FunToLoopInfoMap

map a function to its loop info

Definition at line 125 of file DataFlowUtil.h.

◆ FunToPostDTMap

map a function to its post dominator tree

Definition at line 124 of file DataFlowUtil.h.

Constructor & Destructor Documentation

◆ PTACFInfoBuilder()

PTACFInfoBuilder::PTACFInfoBuilder ( )

Constructor.

Definition at line 41 of file DataFlowUtil.cpp.

42 {
43 // Module* mod = LLVMModuleSet::getLLVMModuleSet()->getMainLLVMModule();
44 // llvm::legacy::PassManager PM;
45 // PM.add(new llvm::PTACFInfoBuilderPass());
46 // PM.run(*mod);
47 }

◆ ~PTACFInfoBuilder()

PTACFInfoBuilder::~PTACFInfoBuilder ( )

Definition at line 49 of file DataFlowUtil.cpp.

49  {
50  for(FunToLoopInfoMap::iterator it = funToLoopInfoMap.begin(), eit = funToLoopInfoMap.end(); it!=eit; ++it)
51  {
52  if(it->second != nullptr)
53  {
54  delete it->second;
55  }
56  }
57  for(FunToDTMap::iterator it = funToDTMap.begin(), eit = funToDTMap.end(); it!=eit; ++it)
58  {
59  if(it->second != nullptr)
60  {
61  delete it->second;
62  }
63  }
64  for(FunToPostDTMap::iterator it = funToPDTMap.begin(), eit = funToPDTMap.end(); it!=eit; ++it)
65  {
66  if(it->second != nullptr)
67  {
68  delete it->second;
69  }
70  }
71 }
FunToPostDTMap funToPDTMap
map a function to its post dominator tree
Definition: DataFlowUtil.h:144
FunToLoopInfoMap funToLoopInfoMap
map a function to its loop info
Definition: DataFlowUtil.h:142
FunToDTMap funToDTMap
map a function to its dominator tree
Definition: DataFlowUtil.h:143

Member Function Documentation

◆ getDT()

DominatorTree * PTACFInfoBuilder::getDT ( const Function f)

Get dominator tree of a function.

Definition at line 110 of file DataFlowUtil.cpp.

111 {
112  Function* fun = const_cast<Function*>(f);
113  FunToDTMap::iterator it = funToDTMap.find(fun);
114  if(it==funToDTMap.end())
115  {
116  DominatorTree* dt = new DominatorTree(*fun);
117  funToDTMap[fun] = dt;
118  return dt;
119  }
120  else
121  return it->second;
122 }
llvm::Function Function
Definition: BasicTypes.h:76
llvm::DominatorTree DominatorTree
Definition: BasicTypes.h:193
FunToDTMap funToDTMap
map a function to its dominator tree
Definition: DataFlowUtil.h:143

◆ getLoopInfo()

LoopInfo * PTACFInfoBuilder::getLoopInfo ( const Function f)

Get loop info of a function.

Definition at line 74 of file DataFlowUtil.cpp.

75 {
76  assert(f->isDeclaration()==false && "external function (without body) does not have a loopInfo");
77  Function* fun = const_cast<Function*>(f);
78  FunToLoopInfoMap::iterator it = funToLoopInfoMap.find(fun);
79  if(it==funToLoopInfoMap.end())
80  {
81  DominatorTree* dt = new DominatorTree(*fun);
82  LoopInfo* loopInfo = new LoopInfo(*dt);
83  funToLoopInfoMap[fun] = loopInfo;
84  return loopInfo;
85  }
86  else
87  return it->second;
88 }
#define assert(ex)
Definition: util.h:141
llvm::LoopInfo LoopInfo
Definition: BasicTypes.h:89
FunToLoopInfoMap funToLoopInfoMap
map a function to its loop info
Definition: DataFlowUtil.h:142
llvm::Function Function
Definition: BasicTypes.h:76
llvm::DominatorTree DominatorTree
Definition: BasicTypes.h:193

◆ getPostDT()

PostDominatorTree * PTACFInfoBuilder::getPostDT ( const Function f)

Get post dominator tree of a function.

Definition at line 91 of file DataFlowUtil.cpp.

92 {
93  assert(f->isDeclaration()==false && "external function (without body) does not have a PostDominatorTree");
94 
95  Function* fun = const_cast<Function*>(f);
96  if(f->isDeclaration())
97  return nullptr;
98  FunToPostDTMap::iterator it = funToPDTMap.find(fun);
99  if(it==funToPDTMap.end())
100  {
101  PostDominatorTree * PDT = new PostDominatorTree(*fun);
102  funToPDTMap[fun] = PDT;
103  return PDT;
104  }
105  else
106  return it->second;
107 }
FunToPostDTMap funToPDTMap
map a function to its post dominator tree
Definition: DataFlowUtil.h:144
#define assert(ex)
Definition: util.h:141
llvm::PostDominatorTree PostDominatorTree
Definition: BasicTypes.h:194
llvm::Function Function
Definition: BasicTypes.h:76

Member Data Documentation

◆ funToDTMap

FunToDTMap SVF::PTACFInfoBuilder::funToDTMap
private

map a function to its dominator tree

Definition at line 143 of file DataFlowUtil.h.

◆ funToLoopInfoMap

FunToLoopInfoMap SVF::PTACFInfoBuilder::funToLoopInfoMap
private

map a function to its loop info

Definition at line 142 of file DataFlowUtil.h.

◆ funToPDTMap

FunToPostDTMap SVF::PTACFInfoBuilder::funToPDTMap
private

map a function to its post dominator tree

Definition at line 144 of file DataFlowUtil.h.


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