about summary refs log tree commit diff homepage
path: root/lib/Module/Passes.h
diff options
context:
space:
mode:
authorJulian Büning <julian.buening@rwth-aachen.de>2018-10-27 22:14:50 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2019-05-30 09:45:21 +0100
commit3629e3ef0fc999ba9c1e0f43db061bdcc875d735 (patch)
tree3f35cecfc8f1139f113b7f2fc76b6a2ba9be9b81 /lib/Module/Passes.h
parent4b93a3ecf7514d181730f5a8f8bfe7e086160b4c (diff)
downloadklee-3629e3ef0fc999ba9c1e0f43db061bdcc875d735.tar.gz
implement FunctionAliasPass
Diffstat (limited to 'lib/Module/Passes.h')
-rw-r--r--lib/Module/Passes.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Module/Passes.h b/lib/Module/Passes.h
index d5f8d821..4fb0cfd7 100644
--- a/lib/Module/Passes.h
+++ b/lib/Module/Passes.h
@@ -167,6 +167,24 @@ public:
   bool checkPassed() const { return instructionOperandsConform; }
 };
 
+/// FunctionAliasPass - Enables a user of KLEE to specify aliases to functions
+/// using -function-alias=<name|pattern>:<replacement> which are injected as
+/// GlobalAliases into the module. The replaced function is removed.
+class FunctionAliasPass : public llvm::ModulePass {
+
+public:
+  static char ID;
+  FunctionAliasPass() : llvm::ModulePass(ID) {}
+  bool runOnModule(llvm::Module &M) override;
+
+private:
+  static const llvm::FunctionType *getFunctionType(const llvm::GlobalValue *gv);
+  static bool checkType(const llvm::GlobalValue *match, const llvm::GlobalValue *replacement);
+  static bool tryToReplace(llvm::GlobalValue *match, llvm::GlobalValue *replacement);
+  static bool isFunctionOrGlobalFunctionAlias(const llvm::GlobalValue *gv);
+
+};
+
 #ifdef USE_WORKAROUND_LLVM_PR39177
 /// WorkaroundLLVMPR39177Pass - Workaround for LLVM PR39177 within KLEE repo.
 /// For more information on this, please refer to the comments in