ROSE  0.11.31.0
ConcreteSemantics2.h
1 #ifndef Rose_ConcreteSemantics2_H
2 #define Rose_ConcreteSemantics2_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #ifndef __STDC_FORMAT_MACROS
7 #define __STDC_FORMAT_MACROS
8 #endif
9 #include <inttypes.h>
10 
11 #include "integerOps.h"
12 #include "BaseSemantics2.h"
13 #include "RegisterStateGeneric.h"
14 #include <Sawyer/BitVector.h>
15 
16 namespace Rose {
17 namespace BinaryAnalysis { // documented elsewhere
18 namespace InstructionSemantics2 { // documented elsewhere
19 
24 namespace ConcreteSemantics {
25 
27 // Value type
29 
32 
34 typedef BaseSemantics::Formatter Formatter; // we might extend this in the future
35 
44 protected:
46 
48  // Real constructors
49 protected:
50  explicit SValue(size_t nbits): BaseSemantics::SValue(nbits), bits_(nbits) {}
51 
52  SValue(size_t nbits, uint64_t number): BaseSemantics::SValue(nbits) {
53  bits_ = Sawyer::Container::BitVector(nbits);
54  bits_.fromInteger(number);
55  }
56 
58  // Static allocating constructors
59 public:
61  static SValuePtr instance() {
62  return SValuePtr(new SValue(1));
63  }
64 
69  static SValuePtr instance(size_t nbits) {
70  return SValuePtr(new SValue(nbits));
71  }
72 
74  static SValuePtr instance(size_t nbits, uint64_t value) {
75  return SValuePtr(new SValue(nbits, value));
76  }
77 
79  // Virtual allocating constructors
80 public:
81  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE {
82  return instance(nbits);
83  }
84  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE {
85  return instance(nbits);
86  }
87  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE {
88  return instance(nbits);
89  }
90  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const ROSE_OVERRIDE {
91  return instance(nbits, value);
92  }
93  virtual BaseSemantics::SValuePtr boolean_(bool value) const ROSE_OVERRIDE {
94  return instance(1, value ? 1 : 0);
95  }
96  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const ROSE_OVERRIDE {
97  SValuePtr retval(new SValue(*this));
98  if (new_width!=0 && new_width!=retval->nBits())
99  retval->set_width(new_width);
100  return retval;
101  }
104  const SmtSolverPtr&) const ROSE_OVERRIDE;
105 
107  // Dynamic pointer casts
108 public:
110  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
111  SValuePtr retval = v.dynamicCast<SValue>();
112  ASSERT_not_null(retval);
113  return retval;
114  }
115 
117  // Override virtual methods...
118 public:
119  virtual void hash(Combinatorics::Hasher&) const override;
120 
121  virtual bool isBottom() const ROSE_OVERRIDE {
122  return false;
123  }
124 
125  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
126 
128  // Override legacy virtual methods. These snake_case names may eventually go away, but for now they're the ones you should
129  // override. Be sure to use "override" in your own code in order to be notified when we finally remove these.
130 public:
131  // See mayEqual
132  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
133  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
134 
135  // See mustEqual
136  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
137  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
138 
139  // See nBits
140  virtual void set_width(size_t nbits) ROSE_OVERRIDE;
141 
142  // See isConcrete
143  virtual bool is_number() const ROSE_OVERRIDE {
144  return true;
145  }
146 
147  // See toUnsigned and toSigned
148  virtual uint64_t get_number() const ROSE_OVERRIDE;
149 
151  // Additional methods first declared in this class...
152 public:
156  virtual const Sawyer::Container::BitVector& bits() const { return bits_; }
157  virtual void bits(const Sawyer::Container::BitVector&);
159 };
160 
161 
163 // Register State
165 
166 typedef BaseSemantics::RegisterStateGeneric RegisterState;
167 typedef BaseSemantics::RegisterStateGenericPtr RegisterStatePtr;
168 
169 
171 // Memory State
173 
175 typedef boost::shared_ptr<class MemoryState> MemoryStatePtr;
176 
181 class MemoryState: public BaseSemantics::MemoryState {
182  MemoryMap::Ptr map_;
183  rose_addr_t pageSize_;
184 
186  // Real constructors
187 protected:
188  explicit MemoryState(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
189  : BaseSemantics::MemoryState(addrProtoval, valProtoval), pageSize_(4096) {
190  (void) SValue::promote(addrProtoval); // for its checking side effects
191  (void) SValue::promote(valProtoval);
192  }
193 
194  MemoryState(const MemoryState &other)
195  : BaseSemantics::MemoryState(other), map_(other.map_), pageSize_(other.pageSize_) {
196  if (map_) {
197  BOOST_FOREACH (MemoryMap::Segment &segment, map_->values())
198  segment.buffer()->copyOnWrite(true);
199  }
200  }
201 
203  // Static allocating constructors
204 public:
208  static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) {
209  return MemoryStatePtr(new MemoryState(addrProtoval, valProtoval));
210  }
211 
216  static MemoryStatePtr instance(const MemoryStatePtr &other) {
217  return MemoryStatePtr(new MemoryState(*other));
218  }
219 
221  // Virtual constructors
222 public:
228  const BaseSemantics::SValuePtr &valProtoval) const ROSE_OVERRIDE {
229  return instance(addrProtoval, valProtoval);
230  }
231 
237  virtual BaseSemantics::MemoryStatePtr clone() const ROSE_OVERRIDE {
238  return MemoryStatePtr(new MemoryState(*this));
239  }
240 
242  // Dynamic pointer casts
243 public:
246  static MemoryStatePtr promote(const BaseSemantics::MemoryStatePtr &x) {
247  MemoryStatePtr retval = boost::dynamic_pointer_cast<MemoryState>(x);
248  ASSERT_not_null(retval);
249  return retval;
250  }
251 
253  // Methods we inherited
254 public:
255  virtual void clear() ROSE_OVERRIDE {
256  map_ = MemoryMap::Ptr();
257  }
258 
259  virtual void hash(Combinatorics::Hasher&, BaseSemantics::RiscOperators *addrOps,
260  BaseSemantics::RiscOperators *valOps) const override;
261 
262  virtual void print(std::ostream&, Formatter&) const ROSE_OVERRIDE;
263 
264  virtual BaseSemantics::SValuePtr readMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt,
265  BaseSemantics::RiscOperators *addrOps,
266  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
267 
268  virtual BaseSemantics::SValuePtr peekMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt,
269  BaseSemantics::RiscOperators *addrOps,
270  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
271 
272  virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value,
273  BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
274 
275  virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps,
276  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
277 
278 protected:
279  BaseSemantics::SValuePtr readOrPeekMemory(const BaseSemantics::SValuePtr &addr,
280  const BaseSemantics::SValuePtr &dflt,
281  BaseSemantics::RiscOperators *addrOps,
282  BaseSemantics::RiscOperators *valOps,
283  bool allowSideEffects);
284 
286  // Methods first declared in this class
287 public:
289  const MemoryMap::Ptr memoryMap() const { return map_; }
290 
297 
304  rose_addr_t pageSize() const { return pageSize_; }
305  void pageSize(rose_addr_t nBytes);
312  void allocatePage(rose_addr_t va);
313 
314 };
315 
316 
318 // Complete semantic state
320 
321 typedef BaseSemantics::State State;
322 typedef BaseSemantics::StatePtr StatePtr;
323 
324 
326 // RISC operators
328 
330 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
331 
351  // Real constructors
352 protected:
354  : BaseSemantics::RiscOperators(protoval, solver) {
355  name("Concrete");
356  (void) SValue::promote(protoval); // make sure its dynamic type is a ConcreteSemantics::SValue
357  }
358 
359  RiscOperators(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver)
360  : BaseSemantics::RiscOperators(state, solver) {
361  name("Concrete");
362  (void) SValue::promote(state->protoval()); // values must have ConcreteSemantics::SValue dynamic type
363  }
364 
366  // Static allocating constructors
367 public:
370  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver = SmtSolverPtr()) {
372  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
373  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
374  BaseSemantics::StatePtr state = State::instance(registers, memory);
375  return RiscOperatorsPtr(new RiscOperators(state, solver));
376  }
377 
381  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
382  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
383  }
384 
387  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
388  return RiscOperatorsPtr(new RiscOperators(state, solver));
389  }
390 
392  // Virtual constructors
393 public:
395  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
396  return instance(protoval, solver);
397  }
398 
400  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
401  return instance(state, solver);
402  }
403 
405  // Dynamic pointer casts
406 public:
409  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
410  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
411  ASSERT_not_null(retval);
412  return retval;
413  }
414 
416  // New methods for constructing values, so we don't have to write so many SValue::promote calls in the RiscOperators
417  // implementations.
418 protected:
419  SValuePtr svalueNumber(size_t nbits, uint64_t value) {
420  return SValue::promote(number_(nbits, value));
421  }
422 
423  SValuePtr svalueNumber(const Sawyer::Container::BitVector&);
424 
425  SValuePtr svalueBoolean(bool b) {
426  return SValue::promote(boolean_(b));
427  }
428 
429  SValuePtr svalueZero(size_t nbits) {
430  return SValue::promote(number_(nbits, 0));
431  }
432 
434  // Override methods from base class. These are the RISC operators that are invoked by a Dispatcher.
435 public:
436  virtual void interrupt(int majr, int minr) ROSE_OVERRIDE;
437  virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_,
438  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
440  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
441  virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_,
442  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
443  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
444  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_,
445  size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
446  virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_,
447  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
448  virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
449  virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
450  virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_,
451  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
452  virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_,
453  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
454  virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_,
455  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
456  virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_,
457  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
458  virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_,
459  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
460  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
461  virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &sel_,
462  const BaseSemantics::SValuePtr &a_,
463  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
464  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
465  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
467  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
469  const BaseSemantics::SValuePtr &b_,
470  const BaseSemantics::SValuePtr &c_,
471  BaseSemantics::SValuePtr &carry_out/*out*/) ROSE_OVERRIDE;
472  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
474  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
476  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
478  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
480  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
482  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
484  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
485 
486  virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &intValue, SgAsmFloatType*) ROSE_OVERRIDE;
487  virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &fpValue, SgAsmFloatType *fpType,
488  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
489  virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
490  SgAsmFloatType*) ROSE_OVERRIDE;
491  virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
492  SgAsmFloatType*) ROSE_OVERRIDE;
493  virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
494  SgAsmFloatType*) ROSE_OVERRIDE;
495  virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &a, SgAsmFloatType*) ROSE_OVERRIDE;
496 
497  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg,
498  const BaseSemantics::SValuePtr &addr,
499  const BaseSemantics::SValuePtr &dflt,
500  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
501  virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg,
502  const BaseSemantics::SValuePtr &addr,
503  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
504  virtual void writeMemory(RegisterDescriptor segreg,
505  const BaseSemantics::SValuePtr &addr,
506  const BaseSemantics::SValuePtr &data,
507  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
508 
509 protected:
510  // handles readMemory and peekMemory
511  BaseSemantics::SValuePtr readOrPeekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &address,
512  const BaseSemantics::SValuePtr &dflt, bool allowSideEffects);
513 
514  // Convert expression to double
515  double exprToDouble(const BaseSemantics::SValuePtr &expr, SgAsmFloatType*);
516 
517  // Convert double to expression
518  BaseSemantics::SValuePtr doubleToExpr(double d, SgAsmFloatType*);
519 };
520 
521 } // namespace
522 } // namespace
523 } // namespace
524 } // namespace
525 
526 #endif
527 #endif
static RegisterStateGenericPtr instance(const SValuePtr &protoval, const RegisterDictionary *regdict)
Instantiate a new register state.
Defines RISC operators for the ConcreteSemantics domain.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
static MemoryStatePtr instance(const MemoryStatePtr &other)
Instantiates a new deep copy of an existing state.
virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const ROSE_OVERRIDE
Create a new value from an existing value, changing the width if new_width is non-zero.
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_, const BaseSemantics::SValuePtr &c_, BaseSemantics::SValuePtr &carry_out) ROSE_OVERRIDE
Used for printing RISC operators with formatting.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print a value to a stream using default format.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to concrete RISC operations.
boost::shared_ptr< class RegisterStateGeneric > RegisterStateGenericPtr
Shared-ownership pointer to generic register states.
static SValuePtr instance()
Instantiate a new prototypical value.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Two's complement.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Divides two signed values.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Writes a value to memory.
static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object and configures it to use semantic values and states that are ...
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &a, SgAsmFloatType *) ROSE_OVERRIDE
Round toward zero.
Type of values manipulated by the concrete domain.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to concrete operators.
Holds a value or nothing.
Definition: Optional.h:49
Buffer< A, T >::Ptr buffer() const
Property: buffer.
virtual const Sawyer::Container::BitVector & bits() const
Returns the bit vector storing the concrete value.
virtual uint64_t get_number() const ROSE_OVERRIDE
Virtual API.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Calculates modulo with unsigned values.
bool copyOnWrite() const
Property: Copy on write.
Definition: Buffer.h:127
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) ROSE_OVERRIDE
Multiply two floating-point values.
Main namespace for the ROSE library.
virtual BaseSemantics::MemoryStatePtr create(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const ROSE_OVERRIDE
Virtual constructor.
virtual void interrupt(int majr, int minr) ROSE_OVERRIDE
Invoked for instructions that cause an interrupt.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
BitVector & fromInteger(const BitRange &range, boost::uint64_t value)
Obtain bits from an integer.
Definition: BitVector.h:1306
Name space for the entire library.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Calculates modulo with signed values.
virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &fpValue, SgAsmFloatType *fpType, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Construct an integer value from a floating-point value.
virtual BaseSemantics::SValuePtr boolean_(bool value) const ROSE_OVERRIDE
Create a new, Boolean value.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Divides two unsigned values.
Sawyer::SharedPointer< class SValue > SValuePtr
Smart-ownership pointer to a concrete semantic value.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const ROSE_OVERRIDE
Create a new concrete semantic value.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE
Create a new undefined semantic value.
static SValuePtr instance(size_t nbits)
Instantiate a new undefined value of specified width.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to a concrete memory state.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified prototypical values.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &intValue, SgAsmFloatType *) ROSE_OVERRIDE
Construct a floating-point value from an integer value.
virtual void set_width(size_t nbits) ROSE_OVERRIDE
Virtual API.
virtual void hash(Combinatorics::Hasher &) const override
Hash this semantic value.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) ROSE_OVERRIDE
Add two floating-point values.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual API.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
An efficient mapping from an address space to stored data.
Definition: MemoryMap.h:112
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Multiply two unsigned values.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE
Create a new unspecified semantic value.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to a SymbolicSemantics value.
virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Reads a value from memory.
static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
Instantiates a new memory state having specified prototypical value.
SharedPointer< U > dynamicCast() const
Dynamic cast.
Base class for most instruction semantics RISC operators.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified state.
virtual Sawyer::Optional< BaseSemantics::SValuePtr > createOptionalMerge(const BaseSemantics::SValuePtr &other, const BaseSemantics::MergerPtr &, const SmtSolverPtr &) const ROSE_OVERRIDE
Possibly create a new value by merging two existing values.
const MemoryMap::Ptr memoryMap() const
Returns the memory map.
virtual bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual API.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Read memory without side effects.
static SValuePtr instance(size_t nbits, uint64_t value)
Instantiate a new concrete value.
Defines registers available for a particular architecture.
Definition: Registers.h:38
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE
Data-flow bottom value.
Represents no value.
Definition: Optional.h:32
void allocatePage(rose_addr_t va)
Allocate a page of memory.
virtual const std::string & name() const
Property: Name used for debugging.
BaseSemantics::Formatter Formatter
Formatter for symbolic values.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Multiplies two signed values.
Floating point types.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) ROSE_OVERRIDE
Subtract one floating-point value from another.
virtual BaseSemantics::MemoryStatePtr clone() const ROSE_OVERRIDE
Virtual copy constructor.
static MemoryStatePtr promote(const BaseSemantics::MemoryStatePtr &x)
Recasts a base pointer to a concrete memory state.
std::shared_ptr< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
virtual bool isBottom() const ROSE_OVERRIDE
Determines whether a value is a data-flow bottom.