retdec
pessim_call_info_obtainer.h
Go to the documentation of this file.
1 
8 #ifndef RETDEC_LLVMIR2HLL_OBTAINER_CALL_INFO_OBTAINERS_PESSIM_CALL_INFO_OBTAINER_H
9 #define RETDEC_LLVMIR2HLL_OBTAINER_CALL_INFO_OBTAINERS_PESSIM_CALL_INFO_OBTAINER_H
10 
11 #include <string>
12 
15 
16 namespace retdec {
17 namespace llvmir2hll {
18 
26 class PessimCallInfo: public CallInfo {
27  friend class PessimCallInfoObtainer;
28 
29 public:
31 
32  virtual bool isNeverRead(ShPtr<Variable> var) const override;
33  virtual bool mayBeRead(ShPtr<Variable> var) const override;
34  virtual bool isAlwaysRead(ShPtr<Variable> var) const override;
35 
36  virtual bool isNeverModified(ShPtr<Variable> var) const override;
37  virtual bool mayBeModified(ShPtr<Variable> var) const override;
38  virtual bool isAlwaysModified(ShPtr<Variable> var) const override;
39 
40  virtual bool valueIsNeverChanged(ShPtr<Variable> var) const override;
41  virtual bool isAlwaysModifiedBeforeRead(ShPtr<Variable> var) const override;
42 };
43 
51 class PessimFuncInfo: public FuncInfo {
52  friend class PessimCallInfoObtainer;
53 
54 public:
56 
57  virtual bool isNeverRead(ShPtr<Variable> var) const override;
58  virtual bool mayBeRead(ShPtr<Variable> var) const override;
59  virtual bool isAlwaysRead(ShPtr<Variable> var) const override;
60 
61  virtual bool isNeverModified(ShPtr<Variable> var) const override;
62  virtual bool mayBeModified(ShPtr<Variable> var) const override;
63  virtual bool isAlwaysModified(ShPtr<Variable> var) const override;
64 
65  virtual bool valueIsNeverChanged(ShPtr<Variable> var) const override;
66  virtual bool isAlwaysModifiedBeforeRead(ShPtr<Variable> var) const override;
67 };
68 
79 public:
81 
82  virtual std::string getId() const override;
84  ShPtr<Function> caller) override;
85  virtual ShPtr<FuncInfo> getFuncInfo(ShPtr<Function> func) override;
86 
87 private:
89 };
90 
91 } // namespace llvmir2hll
92 } // namespace retdec
93 
94 #endif
A base class of all obtainers of information about functions and function calls.
A base class of all obtainers of information about functions and function calls.
Definition: call_info_obtainer.h:218
Base class for all classes storing information about a function call.
Definition: call_info_obtainer.h:34
ShPtr< CallExpr > call
Function call for which this piece of information is computed.
Definition: call_info_obtainer.h:111
Base class for all classes storing information about a function.
Definition: call_info_obtainer.h:119
ShPtr< Function > func
Function for which this piece of information is computed.
Definition: call_info_obtainer.h:197
Obtainer of information about functions and function calls that assumes nothing.
Definition: pessim_call_info_obtainer.h:78
virtual ShPtr< CallInfo > getCallInfo(ShPtr< CallExpr > call, ShPtr< Function > caller) override
Computes and returns information about the given function call which occurs in caller.
Definition: pessim_call_info_obtainer.cpp:130
virtual ShPtr< FuncInfo > getFuncInfo(ShPtr< Function > func) override
Computes and returns information about the given function.
Definition: pessim_call_info_obtainer.cpp:140
PessimCallInfoObtainer()
Constructs a new obtainer.
Definition: pessim_call_info_obtainer.cpp:25
virtual std::string getId() const override
Returns the ID of the obtainer.
Definition: pessim_call_info_obtainer.cpp:126
static ShPtr< CallInfoObtainer > create()
Creates a new obtainer.
Definition: pessim_call_info_obtainer.cpp:122
Pessimistic information about a function call.
Definition: pessim_call_info_obtainer.h:26
virtual bool mayBeModified(ShPtr< Variable > var) const override
Returns true if the value of var may be changed in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:47
virtual bool isAlwaysModified(ShPtr< Variable > var) const override
Returns true if the value of var is always changed in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:52
virtual bool mayBeRead(ShPtr< Variable > var) const override
Returns true if var may be read in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:32
virtual bool isAlwaysRead(ShPtr< Variable > var) const override
Returns true if var is always read in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:37
virtual bool isNeverRead(ShPtr< Variable > var) const override
Returns true if var is never read in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:27
virtual bool isAlwaysModifiedBeforeRead(ShPtr< Variable > var) const override
Returns true if the given variable is modified prior to being read in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:62
PessimCallInfo(ShPtr< CallExpr > call)
Constructs a new pessimistic piece of information about the given function call.
Definition: pessim_call_info_obtainer.cpp:117
virtual bool isNeverModified(ShPtr< Variable > var) const override
Returns true if there is no assign into var in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:42
virtual bool valueIsNeverChanged(ShPtr< Variable > var) const override
Returns true if the value of var is never changed in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:57
Pessimistic information about a function.
Definition: pessim_call_info_obtainer.h:51
virtual bool isNeverModified(ShPtr< Variable > var) const override
Returns true if there is no assign into var in the function, false otherwise.
Definition: pessim_call_info_obtainer.cpp:88
virtual bool isAlwaysModifiedBeforeRead(ShPtr< Variable > var) const override
Returns true if the given variable is modified prior to being read in the function,...
Definition: pessim_call_info_obtainer.cpp:108
virtual bool isNeverRead(ShPtr< Variable > var) const override
Returns true if var is never read in the function, false otherwise.
Definition: pessim_call_info_obtainer.cpp:73
virtual bool mayBeRead(ShPtr< Variable > var) const override
Returns true if var may be read in the function, false otherwise.
Definition: pessim_call_info_obtainer.cpp:78
virtual bool isAlwaysModified(ShPtr< Variable > var) const override
Returns true if the value of var is always changed in the function, false otherwise.
Definition: pessim_call_info_obtainer.cpp:98
virtual bool mayBeModified(ShPtr< Variable > var) const override
Returns true if the value of var may be changed in the function, false otherwise.
Definition: pessim_call_info_obtainer.cpp:93
PessimFuncInfo(ShPtr< Function > func)
Constructs a new pessimistic piece of information about the given function.
Definition: pessim_call_info_obtainer.cpp:71
virtual bool valueIsNeverChanged(ShPtr< Variable > var) const override
Returns true if the value of var is never changed in the call, false otherwise.
Definition: pessim_call_info_obtainer.cpp:103
virtual bool isAlwaysRead(ShPtr< Variable > var) const override
Returns true if var is always read in the function, false otherwise.
Definition: pessim_call_info_obtainer.cpp:83
A library providing API for working with back-end IR.
std::shared_ptr< T > ShPtr
An alias for a shared pointer.
Definition: smart_ptr.h:18
Definition: archive_wrapper.h:19
Declarations, aliases, macros, etc. for the use of smart pointers.