retdec
compound_semantics.h
Go to the documentation of this file.
1 
8 #ifndef RETDEC_LLVMIR2HLL_SEMANTICS_SEMANTICS_COMPOUND_SEMANTICS_H
9 #define RETDEC_LLVMIR2HLL_SEMANTICS_SEMANTICS_COMPOUND_SEMANTICS_H
10 
11 #include <deque>
12 #include <optional>
13 #include <string>
14 
17 
18 namespace retdec {
19 namespace llvmir2hll {
20 
48 public:
50 
51  void prependSemantics(ShPtr<Semantics> semantics);
52  void appendSemantics(ShPtr<Semantics> semantics);
53 
56  virtual std::string getId() const override { return "compound"; }
57  virtual std::optional<std::string> getMainFuncName() const override;
58  virtual std::optional<std::string> getCHeaderFileForFunc(
59  const std::string &funcName) const override;
60  virtual std::optional<bool> funcNeverReturns(
61  const std::string &funcName) const override;
62  virtual std::optional<std::string> getNameOfVarStoringResult(
63  const std::string &funcName) const override;
64  virtual std::optional<std::string> getNameOfParam(const std::string &funcName,
65  unsigned paramPos) const override;
66  virtual std::optional<IntStringMap> getSymbolicNamesForParam(
67  const std::string &funcName, unsigned paramPos) const override;
69 
70 protected:
72  using SemanticsList = std::deque<ShPtr<Semantics>>;
73 
74 protected:
76 
77 protected:
80 };
81 
82 } // namespace llvmir2hll
83 } // namespace retdec
84 
85 #endif
A class providing compound semantics from several different semantics.
Definition: compound_semantics.h:47
static ShPtr< CompoundSemantics > create()
Creates a new semantics.
Definition: compound_semantics.cpp:90
void appendSemantics(ShPtr< Semantics > semantics)
Inserts the given semantics to the end of the list of compound semantics that this instance provides.
Definition: compound_semantics.cpp:112
virtual std::optional< std::string > getNameOfParam(const std::string &funcName, unsigned paramPos) const override
Returns an appropriate name of the given function's parameter.
Definition: compound_semantics.cpp:139
virtual std::optional< std::string > getMainFuncName() const override
Returns the name of the main function.
Definition: compound_semantics.cpp:116
virtual std::optional< bool > funcNeverReturns(const std::string &funcName) const override
Gets the information whether the given function never returns.
Definition: compound_semantics.cpp:127
virtual std::string getId() const override
Returns the ID of the semantics.
Definition: compound_semantics.h:56
virtual std::optional< IntStringMap > getSymbolicNamesForParam(const std::string &funcName, unsigned paramPos) const override
Returns a mapping of integers into their symbolic names for the given parameter of the given function...
Definition: compound_semantics.cpp:145
SemanticsList providedSemantics
A list of provided semantics.
Definition: compound_semantics.h:79
virtual std::optional< std::string > getNameOfVarStoringResult(const std::string &funcName) const override
Returns an appropriate name of the variable that stores the result of calls to the given function.
Definition: compound_semantics.cpp:133
void prependSemantics(ShPtr< Semantics > semantics)
Inserts the given semantics to the beginning of the list of compound semantics that this instance pro...
Definition: compound_semantics.cpp:101
std::deque< ShPtr< Semantics > > SemanticsList
A list of semantics.
Definition: compound_semantics.h:72
virtual std::optional< std::string > getCHeaderFileForFunc(const std::string &funcName) const override
Returns the C header file for the given function.
Definition: compound_semantics.cpp:121
CompoundSemantics()
Constructs the semantics.
Definition: compound_semantics.cpp:85
A base class for all descriptions of function semantics.
Definition: semantics.h:33
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
A base class for all descriptions of function semantics.
Declarations, aliases, macros, etc. for the use of smart pointers.