retdec
constants.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_BIN2LLVMIR_OPTIMIZATIONS_CONSTANTS_CONSTANTS_H
8 #define RETDEC_BIN2LLVMIR_OPTIMIZATIONS_CONSTANTS_CONSTANTS_H
9 
10 #include <set>
11 #include <unordered_set>
12 #include <vector>
13 
14 #include <llvm/IR/Function.h>
15 #include <llvm/IR/Module.h>
16 #include <llvm/Pass.h>
17 
18 #include "retdec/common/address.h"
24 
25 namespace retdec {
26 namespace bin2llvmir {
27 
28 class ConstantsAnalysis : public llvm::ModulePass
29 {
30  public:
31  static char ID;
33  virtual bool runOnModule(llvm::Module& m) override;
34  bool runOnModuleCustom(
35  llvm::Module& m,
36  Config* c,
37  Abi* a,
38  FileImage* i,
39  DebugFormat* d);
40 
41  private:
42  bool run();
45  llvm::Instruction* inst,
46  llvm::Value* val,
47  bool storeValue = false);
49 
50  private:
51  llvm::Module * _module = nullptr;
52  Config* _config = nullptr;
53  Abi* _abi = nullptr;
54  FileImage* _image = nullptr;
55  DebugFormat* _dbgf = nullptr;
56 
57  std::unordered_set<llvm::Value*> _toRemove;
58 };
59 
60 } // namespace bin2llvmir
61 } // namespace retdec
62 
63 #endif
ABI information.
Config DB provider for bin2llvmirl.
Debug format provider for bin2llvmirl.
Definition: abi.h:27
Definition: config.h:24
Definition: constants.h:29
FileImage * _image
Definition: constants.h:54
Config * _config
Definition: constants.h:52
static char ID
Definition: constants.h:31
Abi * _abi
Definition: constants.h:53
std::unordered_set< llvm::Value * > _toRemove
Definition: constants.h:57
llvm::Module * _module
Definition: constants.h:51
virtual bool runOnModule(llvm::Module &m) override
Definition: constants.cpp:50
bool run()
Definition: constants.cpp:75
void checkForGlobalInInstruction(ReachingDefinitionsAnalysis &RDA, llvm::Instruction *inst, llvm::Value *val, bool storeValue=false)
Definition: constants.cpp:118
ConstantsAnalysis()
Definition: constants.cpp:44
DebugFormat * _dbgf
Definition: constants.h:55
bool runOnModuleCustom(llvm::Module &m, Config *c, Abi *a, FileImage *i, DebugFormat *d)
Definition: constants.cpp:60
Definition: debugformat.h:20
Definition: fileimage.h:27
Definition: reaching_definitions.h:121
Address, address pair and other derived class representation.
File image provider for bin2llvmirl.
The frontend-end part of the decompiler.
Definition: archive_wrapper.h:19
Reaching definitions analysis (RDA) builds UD and DU chains.