ROSE  0.9.10.103
ConcreteSemantics2.h
1 #ifndef Rose_ConcreteSemantics2_H
2 #define Rose_ConcreteSemantics2_H
3 
4 #ifndef __STDC_FORMAT_MACROS
5 #define __STDC_FORMAT_MACROS
6 #endif
7 #include <inttypes.h>
8 
9 #include "integerOps.h"
10 #include "BaseSemantics2.h"
11 #include "RegisterStateGeneric.h"
12 #include <Sawyer/BitVector.h>
13 
14 namespace Rose {
15 namespace BinaryAnalysis { // documented elsewhere
16 namespace InstructionSemantics2 { // documented elsewhere
17 
22 namespace ConcreteSemantics {
23 
25 // Value type
27 
30 
32 typedef BaseSemantics::Formatter Formatter; // we might extend this in the future
33 
42 protected:
44 
46  // Real constructors
47 protected:
48  explicit SValue(size_t nbits): BaseSemantics::SValue(nbits), bits_(nbits) {}
49 
50  SValue(size_t nbits, uint64_t number): BaseSemantics::SValue(nbits) {
51  bits_ = Sawyer::Container::BitVector(nbits);
52  bits_.fromInteger(number);
53  }
54 
56  // Static allocating constructors
57 public:
59  static SValuePtr instance() {
60  return SValuePtr(new SValue(1));
61  }
62 
67  static SValuePtr instance(size_t nbits) {
68  return SValuePtr(new SValue(nbits));
69  }
70 
72  static SValuePtr instance(size_t nbits, uint64_t value) {
73  return SValuePtr(new SValue(nbits, value));
74  }
75 
77  // Virtual allocating constructors
78 public:
79  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE {
80  return instance(nbits);
81  }
82  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE {
83  return instance(nbits);
84  }
85  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE {
86  return instance(nbits);
87  }
88  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const ROSE_OVERRIDE {
89  return instance(nbits, value);
90  }
91  virtual BaseSemantics::SValuePtr boolean_(bool value) const ROSE_OVERRIDE {
92  return instance(1, value ? 1 : 0);
93  }
94  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const ROSE_OVERRIDE {
95  SValuePtr retval(new SValue(*this));
96  if (new_width!=0 && new_width!=retval->get_width())
97  retval->set_width(new_width);
98  return retval;
99  }
102  const SmtSolverPtr&) const ROSE_OVERRIDE;
103 
105  // Dynamic pointer casts
106 public:
108  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
109  SValuePtr retval = v.dynamicCast<SValue>();
110  ASSERT_not_null(retval);
111  return retval;
112  }
113 
115  // Override virtual methods...
116 public:
117  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
118  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
119  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
120  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
121 
122  virtual void set_width(size_t nbits) ROSE_OVERRIDE;
123 
124  virtual bool isBottom() const ROSE_OVERRIDE {
125  return false;
126  }
127 
128  virtual bool is_number() const ROSE_OVERRIDE {
129  return true;
130  }
131 
132  virtual uint64_t get_number() const ROSE_OVERRIDE;
133 
134  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
135 
137  // Additional methods first declared in this class...
138 public:
142  virtual const Sawyer::Container::BitVector& bits() const { return bits_; }
143  virtual void bits(const Sawyer::Container::BitVector&);
145 };
146 
147 
149 // Register State
151 
152 typedef BaseSemantics::RegisterStateGeneric RegisterState;
153 typedef BaseSemantics::RegisterStateGenericPtr RegisterStatePtr;
154 
155 
157 // Memory State
159 
161 typedef boost::shared_ptr<class MemoryState> MemoryStatePtr;
162 
168  MemoryMap::Ptr map_;
169  rose_addr_t pageSize_;
170 
172  // Real constructors
173 protected:
174  explicit MemoryState(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
175  : BaseSemantics::MemoryState(addrProtoval, valProtoval), pageSize_(4096) {
176  (void) SValue::promote(addrProtoval); // for its checking side effects
177  (void) SValue::promote(valProtoval);
178  }
179 
180  MemoryState(const MemoryState &other)
181  : BaseSemantics::MemoryState(other), map_(other.map_), pageSize_(other.pageSize_) {
182  if (map_) {
183  BOOST_FOREACH (MemoryMap::Segment &segment, map_->values())
184  segment.buffer()->copyOnWrite(true);
185  }
186  }
187 
189  // Static allocating constructors
190 public:
194  static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) {
195  return MemoryStatePtr(new MemoryState(addrProtoval, valProtoval));
196  }
197 
202  static MemoryStatePtr instance(const MemoryStatePtr &other) {
203  return MemoryStatePtr(new MemoryState(*other));
204  }
205 
207  // Virtual constructors
208 public:
214  const BaseSemantics::SValuePtr &valProtoval) const ROSE_OVERRIDE {
215  return instance(addrProtoval, valProtoval);
216  }
217 
223  virtual BaseSemantics::MemoryStatePtr clone() const ROSE_OVERRIDE {
224  return MemoryStatePtr(new MemoryState(*this));
225  }
226 
228  // Dynamic pointer casts
229 public:
232  static MemoryStatePtr promote(const BaseSemantics::MemoryStatePtr &x) {
233  MemoryStatePtr retval = boost::dynamic_pointer_cast<MemoryState>(x);
234  ASSERT_not_null(retval);
235  return retval;
236  }
237 
239  // Methods we inherited
240 public:
241  virtual void clear() ROSE_OVERRIDE {
242  map_ = MemoryMap::Ptr();
243  }
244 
245  virtual void print(std::ostream&, Formatter&) const ROSE_OVERRIDE;
246 
247  virtual BaseSemantics::SValuePtr readMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt,
248  BaseSemantics::RiscOperators *addrOps,
249  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
250 
251  virtual BaseSemantics::SValuePtr peekMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt,
252  BaseSemantics::RiscOperators *addrOps,
253  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
254 
255  virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value,
256  BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
257 
258  virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps,
259  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
260 
261 protected:
262  virtual BaseSemantics::SValuePtr readOrPeekMemory(const BaseSemantics::SValuePtr &addr,
263  const BaseSemantics::SValuePtr &dflt,
264  BaseSemantics::RiscOperators *addrOps,
265  BaseSemantics::RiscOperators *valOps,
266  bool allowSideEffects);
267 
269  // Methods first declared in this class
270 public:
272  const MemoryMap::Ptr memoryMap() const { return map_; }
273 
280 
287  rose_addr_t pageSize() const { return pageSize_; }
288  void pageSize(rose_addr_t nBytes);
295  void allocatePage(rose_addr_t va);
296 
297 };
298 
299 
301 // Complete semantic state
303 
304 typedef BaseSemantics::State State;
305 typedef BaseSemantics::StatePtr StatePtr;
306 
307 
309 // RISC operators
311 
313 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
314 
334  // Real constructors
335 protected:
337  : BaseSemantics::RiscOperators(protoval, solver) {
338  name("Concrete");
339  (void) SValue::promote(protoval); // make sure its dynamic type is a ConcreteSemantics::SValue
340  }
341 
342  RiscOperators(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver)
343  : BaseSemantics::RiscOperators(state, solver) {
344  name("Concrete");
345  (void) SValue::promote(state->protoval()); // values must have ConcreteSemantics::SValue dynamic type
346  }
347 
349  // Static allocating constructors
350 public:
353  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver = SmtSolverPtr()) {
355  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
356  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
357  BaseSemantics::StatePtr state = State::instance(registers, memory);
358  return RiscOperatorsPtr(new RiscOperators(state, solver));
359  }
360 
364  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
365  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
366  }
367 
370  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
371  return RiscOperatorsPtr(new RiscOperators(state, solver));
372  }
373 
375  // Virtual constructors
376 public:
378  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
379  return instance(protoval, solver);
380  }
381 
383  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
384  return instance(state, solver);
385  }
386 
388  // Dynamic pointer casts
389 public:
392  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
393  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
394  ASSERT_not_null(retval);
395  return retval;
396  }
397 
399  // New methods for constructing values, so we don't have to write so many SValue::promote calls in the RiscOperators
400  // implementations.
401 protected:
402  SValuePtr svalue_number(size_t nbits, uint64_t value) {
403  return SValue::promote(number_(nbits, value));
404  }
405 
406  SValuePtr svalue_number(const Sawyer::Container::BitVector&);
407 
408  SValuePtr svalue_boolean(bool b) {
409  return SValue::promote(boolean_(b));
410  }
411 
412  SValuePtr svalue_zero(size_t nbits) {
413  return SValue::promote(number_(nbits, 0));
414  }
415 
417  // Override methods from base class. These are the RISC operators that are invoked by a Dispatcher.
418 public:
419  virtual void interrupt(int majr, int minr) ROSE_OVERRIDE;
421  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
423  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
425  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
426  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
428  size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
430  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
434  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
436  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
438  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
440  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
442  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
443  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
445  const BaseSemantics::SValuePtr &a_,
446  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
447  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
448  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
450  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
452  const BaseSemantics::SValuePtr &b_,
453  const BaseSemantics::SValuePtr &c_,
454  BaseSemantics::SValuePtr &carry_out/*out*/) ROSE_OVERRIDE;
455  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
457  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
459  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
461  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
463  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
465  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
467  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
468 
469  virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &intValue, SgAsmFloatType*) ROSE_OVERRIDE;
470  virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &fpValue, SgAsmFloatType *fpType,
471  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
472  virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
473  SgAsmFloatType*) ROSE_OVERRIDE;
474  virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
475  SgAsmFloatType*) ROSE_OVERRIDE;
476  virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
477  SgAsmFloatType*) ROSE_OVERRIDE;
478  virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &a, SgAsmFloatType*) ROSE_OVERRIDE;
479 
480  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg,
481  const BaseSemantics::SValuePtr &addr,
482  const BaseSemantics::SValuePtr &dflt,
483  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
484  virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg,
485  const BaseSemantics::SValuePtr &addr,
486  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
487  virtual void writeMemory(RegisterDescriptor segreg,
488  const BaseSemantics::SValuePtr &addr,
489  const BaseSemantics::SValuePtr &data,
490  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
491 
492 protected:
493  // handles readMemory and peekMemory
494  virtual BaseSemantics::SValuePtr readOrPeekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &address,
495  const BaseSemantics::SValuePtr &dflt, bool allowSideEffects);
496 
497  // Convert expression to double
498  double exprToDouble(const BaseSemantics::SValuePtr &expr, SgAsmFloatType*);
499 
500  // Convert double to expression
501  BaseSemantics::SValuePtr doubleToExpr(double d, SgAsmFloatType*);
502 };
503 
504 } // namespace
505 } // namespace
506 } // namespace
507 } // namespace
508 
509 #endif
virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
Write a value to memory.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Returns arg shifted right arithmetically (with sign bit).
static RegisterStateGenericPtr instance(const SValuePtr &protoval, const RegisterDictionary *regdict)
Instantiate a new register state.
Defines RISC operators for the ConcreteSemantics domain.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Concatenates the bits of two values.
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
Add two values of equal size and a carry bit.
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.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Computes bit-wise OR of two values.
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 BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Computes bit-wise XOR of two values.
virtual BaseSemantics::SValuePtr readMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
Read a value from memory.
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Returns arg shifted right logically (no sign bit).
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.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE
Extracts bits from a value.
MemoryStatePtr Ptr
Shared-ownership pointer for a MemoryState.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to concrete operators.
STL namespace.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Determines whether a value is equal to zero.
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 BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Returns position of least significant set bit; zero when no bits are set.
virtual uint64_t get_number() const ROSE_OVERRIDE
Return the concrete number for this value.
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.
virtual bool is_number() const ROSE_OVERRIDE
Determines if the value is a concrete number.
Main namespace for the ROSE library.
Describes (part of) a physical CPU register.
virtual BaseSemantics::MemoryStatePtr create(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const ROSE_OVERRIDE
Virtual constructor.
virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
Merge memory states for data flow analysis.
virtual void interrupt(int majr, int minr) ROSE_OVERRIDE
Invoked for instructions that cause an interrupt.
virtual SValuePtr boolean_(bool value)
Returns a Boolean value.
BitVector & fromInteger(const BitRange &range, boost::uint64_t value)
Obtain bits from an integer.
Definition: BitVector.h:1199
Name space for the entire library.
Definition: Access.h:13
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Calculates modulo with signed values.
Sawyer::SharedPointer< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Adds two integers of equal size.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Returns position of most significant set bit; zero when no bits are set.
boost::shared_ptr< class RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
boost::shared_ptr< class State > StatePtr
Shared-ownership pointer to a semantic state.
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.
Base classes for instruction semantics.
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 signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE
Sign extends a 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.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
One's complement.
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
Accessor for value width.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
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
Returns true if two values could be equal.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Returns arg shifted left.
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:108
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.
Defines registers available for a particular architecture.
Definition: Registers.h:32
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.
static StatePtr instance(const RegisterStatePtr &registers, const MemoryStatePtr &memory)
Instantiate a new state object with specified register and memory states.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Rotate bits to the right.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory 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
Returns true if two values must be equal.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Read memory without side effects.
virtual BaseSemantics::SValuePtr peekMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
Read a value from memory without side effects.
virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE
Extend (or shrink) operand a so it is nbits wide by adding or removing high-order bits...
static SValuePtr instance(size_t nbits, uint64_t value)
Instantiate a new concrete value.
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.
virtual SValuePtr number_(size_t nbits, uint64_t value)
Returns a number of the specified bit width.
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.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Rotate bits to the left.
Floating point types.
virtual void print(std::ostream &, Formatter &) const ROSE_OVERRIDE
Print a memory state to more than one line of output.
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.
virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &sel_, const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
If-then-else.
virtual bool isBottom() const ROSE_OVERRIDE
Determines whether a value is a data-flow bottom.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Computes bit-wise AND of two values.