ROSE  0.11.50.0
ExternalFunctionUnit.h
1 #ifndef ROSE_BinaryAnalysis_ModelChecker_ExternalFunctionUnit_H
2 #define ROSE_BinaryAnalysis_ModelChecker_ExternalFunctionUnit_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/ModelChecker/ExecutionUnit.h>
7 #include <Rose/BinaryAnalysis/CallingConvention.h>
8 #include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
9 
10 namespace Rose {
11 namespace BinaryAnalysis {
12 namespace ModelChecker {
13 
21 public:
22  using Ptr = ExternalFunctionUnitPtr;
23 
24 private:
25  Partitioner2::FunctionPtr function_;
26 
27 protected:
28  ExternalFunctionUnit() = delete;
29  ExternalFunctionUnit(const Partitioner2::FunctionPtr&, const SourceLocation&);
30 public:
32 
33 public:
39  static Ptr instance(const Partitioner2::FunctionPtr&, const SourceLocation&);
40 
41 public:
48  Partitioner2::FunctionPtr function() const;
49 
50 public:
51  virtual std::string printableName() const override;
52  virtual void printSteps(const SettingsPtr&, std::ostream&, const std::string &prefix,
53  size_t stepOrigin, size_t maxSteps) const override;
54  virtual void toYamlHeader(const SettingsPtr&, std::ostream&, const std::string &prefix) const override;
55  virtual void toYamlSteps(const SettingsPtr&, std::ostream&, const std::string &prefix,
56  size_t stepOrigin, size_t maxSteps) const override;
57  virtual size_t nSteps() const override;
58  virtual Sawyer::Optional<rose_addr_t> address() const override;
59  virtual std::vector<TagPtr> execute(const SettingsPtr&, const SemanticCallbacksPtr&,
61 
62 private:
63  // Read a calling convention parameter location
68 
69  // Write to a calling convention parameter location
70  void
74 
75  // Set function return values to free variables
76  void clearReturnValues(const InstructionSemantics2::BaseSemantics::DispatcherPtr&);
77 
78  // Simulate a function return
79  void simulateReturn(const InstructionSemantics2::BaseSemantics::DispatcherPtr&);
80 };
81 
82 
83 } // namespace
84 } // namespace
85 } // namespace
86 
87 #endif
88 #endif
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
Information about a source location.
virtual size_t nSteps() const override
Property: Number of steps required to execute this unit.
An execution unit for an externally linked function.
virtual Sawyer::Optional< rose_addr_t > address() const override
Property: Address if it has one.
static Ptr instance(const Partitioner2::FunctionPtr &, const SourceLocation &)
Allocating constructor.
virtual void toYamlHeader(const SettingsPtr &, std::ostream &, const std::string &prefix) const override
Print the header information in YAML format.
Main namespace for the ROSE library.
virtual void printSteps(const SettingsPtr &, std::ostream &, const std::string &prefix, size_t stepOrigin, size_t maxSteps) const override
Print the steps for this execution unit.
virtual std::string printableName() const override
Property: Printable name.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
ExecutionUnitPtr Ptr
Shared ownership pointer for an execution unit.
Definition: ExecutionUnit.h:22
virtual std::vector< TagPtr > execute(const SettingsPtr &, const SemanticCallbacksPtr &, const InstructionSemantics2::BaseSemantics::RiscOperatorsPtr &) override
Execute the unit to create a new state.
virtual void toYamlSteps(const SettingsPtr &, std::ostream &, const std::string &prefix, size_t stepOrigin, size_t maxSteps) const override
Print the steps for this execution unit in YAML format.