Static Value-Flow Analysis
BreakConstantExpr.h
Go to the documentation of this file.
1 //===- BreakConstantGEPs.h - Change constant GEPs into GEP instructions --- --//
2 //
3 // The SAFECode Compiler
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This pass changes all GEP constant expressions into GEP instructions. This
11 // permits the rest of SAFECode to put run-time checks on them if necessary.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef BREAKCONSTANTGEPS_H
16 #define BREAKCONSTANTGEPS_H
17 
18 #include "SVFIR/SVFValue.h"
19 
20 namespace SVF
21 {
22 
23 //
24 // Pass: BreakConstantGEPs
25 //
26 // Description:
27 // This pass modifies a function so that it uses GEP instructions instead of
28 // GEP constant expressions.
29 //
31 {
32 private:
33  // Private methods
34 
35  // Private variables
36 
37 public:
38  static char ID;
40  llvm::StringRef getPassName() const
41  {
42  return "Remove Constant GEP Expressions";
43  }
44  virtual bool runOnModule (Module & M);
45 };
46 
47 
48 //
49 // Pass: MergeFunctionRets
50 //
51 // Description:
52 // This pass modifies a function so that each function only have one unified exit basic block
53 //
55 {
56 private:
57  // Private methods
58 
59  // Private variables
60 
61 public:
62  static char ID;
64  llvm::StringRef getPassName() const
65  {
66  return "unify function exit into one dummy exit basic block";
67  }
68  virtual bool runOnModule (Module & M)
69  {
71  return true;
72  }
73  inline void UnifyFunctionExit(Module& module)
74  {
75  for (Module::const_iterator iter = module.begin(), eiter = module.end();
76  iter != eiter; ++iter)
77  {
78  const Function& fun = *iter;
79  if(fun.isDeclaration())
80  continue;
81  getUnifyExit(fun)->runOnFunction(const_cast<Function&>(fun));
82  }
83  }
86  {
87  assert(!fn.isDeclaration() && "external function does not have DF");
88  return &getAnalysis<UnifyFunctionExitNodes>(const_cast<Function&>(fn));
89  }
90 };
91 
92 } // End namespace SVF
93 
94 #endif
llvm::StringRef getPassName() const
virtual bool runOnModule(Module &M)
UnifyFunctionExitNodes * getUnifyExit(const Function &fn)
Get Unified Exit basic block node.
llvm::StringRef getPassName() const
void UnifyFunctionExit(Module &module)
virtual bool runOnModule(Module &M)
for isBitcode
Definition: BasicTypes.h:68
llvm::Function Function
Definition: BasicTypes.h:85
llvm::Module Module
Definition: BasicTypes.h:84
llvm::ModulePass ModulePass
Definition: BasicTypes.h:73
llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes
Definition: BasicTypes.h:78