ROSE  0.11.50.0
ConcreteSemantics.h
1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics2_ConcreteSemantics_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics2_ConcreteSemantics_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 <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics.h>
13 #include <Sawyer/BitVector.h>
14 
15 namespace Rose {
16 namespace BinaryAnalysis { // documented elsewhere
17 namespace InstructionSemantics2 { // documented elsewhere
18 
23 namespace ConcreteSemantics {
24 
26 // Value type
28 
31 
33 typedef BaseSemantics::Formatter Formatter; // we might extend this in the future
34 
43 public:
46 
48  using Ptr = SValuePtr;
49 
50 protected:
52 
54  // Real constructors
55 protected:
56  explicit SValue(size_t nbits): BaseSemantics::SValue(nbits), bits_(nbits) {}
57 
58  SValue(size_t nbits, uint64_t number): BaseSemantics::SValue(nbits) {
59  bits_ = Sawyer::Container::BitVector(nbits);
60  bits_.fromInteger(number);
61  }
62 
64  // Static allocating constructors
65 public:
67  static SValuePtr instance() {
68  return SValuePtr(new SValue(1));
69  }
70 
75  static SValuePtr instance(size_t nbits) {
76  return SValuePtr(new SValue(nbits));
77  }
78 
80  static SValuePtr instance(size_t nbits, uint64_t value) {
81  return SValuePtr(new SValue(nbits, value));
82  }
83 
85  // Virtual allocating constructors
86 public:
87  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE {
88  return instance(nbits);
89  }
90  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE {
91  return instance(nbits);
92  }
93  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE {
94  return instance(nbits);
95  }
96  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const ROSE_OVERRIDE {
97  return instance(nbits, value);
98  }
99  virtual BaseSemantics::SValuePtr boolean_(bool value) const ROSE_OVERRIDE {
100  return instance(1, value ? 1 : 0);
101  }
102  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const ROSE_OVERRIDE {
103  SValuePtr retval(new SValue(*this));
104  if (new_width!=0 && new_width!=retval->nBits())
105  retval->set_width(new_width);
106  return retval;
107  }
110  const SmtSolverPtr&) const ROSE_OVERRIDE;
111 
113  // Dynamic pointer casts
114 public:
116  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
117  SValuePtr retval = v.dynamicCast<SValue>();
118  ASSERT_not_null(retval);
119  return retval;
120  }
121 
123  // Override virtual methods...
124 public:
125  virtual void hash(Combinatorics::Hasher&) const override;
126 
127  virtual bool isBottom() const ROSE_OVERRIDE {
128  return false;
129  }
130 
131  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
132 
134  // Override legacy virtual methods. These snake_case names may eventually go away, but for now they're the ones you should
135  // override. Be sure to use "override" in your own code in order to be notified when we finally remove these.
136 public:
137  // See mayEqual
138  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
139  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
140 
141  // See mustEqual
142  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
143  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
144 
145  // See nBits
146  virtual void set_width(size_t nbits) ROSE_OVERRIDE;
147 
148  // See isConcrete
149  virtual bool is_number() const ROSE_OVERRIDE {
150  return true;
151  }
152 
153  // See toUnsigned and toSigned
154  virtual uint64_t get_number() const ROSE_OVERRIDE;
155 
157  // Additional methods first declared in this class...
158 public:
162  virtual const Sawyer::Container::BitVector& bits() const { return bits_; }
163  virtual void bits(const Sawyer::Container::BitVector&);
165 };
166 
167 
169 // Register State
171 
172 typedef BaseSemantics::RegisterStateGeneric RegisterState;
173 typedef BaseSemantics::RegisterStateGenericPtr RegisterStatePtr;
174 
175 
177 // Memory State
179 
181 typedef boost::shared_ptr<class MemoryState> MemoryStatePtr;
182 
187 class MemoryState: public BaseSemantics::MemoryState {
188 public:
190  using Super = BaseSemantics::MemoryState;
191 
194 
195 private:
196  MemoryMap::Ptr map_;
197  rose_addr_t pageSize_;
198 
200  // Real constructors
201 protected:
202  explicit MemoryState(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
203  : BaseSemantics::MemoryState(addrProtoval, valProtoval), pageSize_(4096) {
204  (void) SValue::promote(addrProtoval); // for its checking side effects
205  (void) SValue::promote(valProtoval);
206  }
207 
208  MemoryState(const MemoryState &other)
209  : BaseSemantics::MemoryState(other), map_(other.map_), pageSize_(other.pageSize_) {
210  if (map_) {
211  BOOST_FOREACH (MemoryMap::Segment &segment, map_->values())
212  segment.buffer()->copyOnWrite(true);
213  }
214  }
215 
217  // Static allocating constructors
218 public:
222  static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) {
223  return MemoryStatePtr(new MemoryState(addrProtoval, valProtoval));
224  }
225 
230  static MemoryStatePtr instance(const MemoryStatePtr &other) {
231  return MemoryStatePtr(new MemoryState(*other));
232  }
233 
235  // Virtual constructors
236 public:
242  const BaseSemantics::SValuePtr &valProtoval) const ROSE_OVERRIDE {
243  return instance(addrProtoval, valProtoval);
244  }
245 
251  virtual BaseSemantics::MemoryStatePtr clone() const ROSE_OVERRIDE {
252  return MemoryStatePtr(new MemoryState(*this));
253  }
254 
256  // Dynamic pointer casts
257 public:
260  static MemoryStatePtr promote(const BaseSemantics::MemoryStatePtr &x) {
261  MemoryStatePtr retval = boost::dynamic_pointer_cast<MemoryState>(x);
262  ASSERT_not_null(retval);
263  return retval;
264  }
265 
267  // Methods we inherited
268 public:
269  virtual void clear() ROSE_OVERRIDE {
270  map_ = MemoryMap::Ptr();
271  }
272 
273  virtual void hash(Combinatorics::Hasher&, BaseSemantics::RiscOperators *addrOps,
274  BaseSemantics::RiscOperators *valOps) const override;
275 
276  virtual void print(std::ostream&, Formatter&) const ROSE_OVERRIDE;
277 
278  virtual BaseSemantics::SValuePtr readMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt,
279  BaseSemantics::RiscOperators *addrOps,
280  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
281 
282  virtual BaseSemantics::SValuePtr peekMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt,
283  BaseSemantics::RiscOperators *addrOps,
284  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
285 
286  virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value,
287  BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
288 
289  virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps,
290  BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE;
291 
292 protected:
293  BaseSemantics::SValuePtr readOrPeekMemory(const BaseSemantics::SValuePtr &addr,
294  const BaseSemantics::SValuePtr &dflt,
295  BaseSemantics::RiscOperators *addrOps,
296  BaseSemantics::RiscOperators *valOps,
297  bool allowSideEffects);
298 
300  // Methods first declared in this class
301 public:
303  const MemoryMap::Ptr memoryMap() const { return map_; }
304 
311 
318  rose_addr_t pageSize() const { return pageSize_; }
319  void pageSize(rose_addr_t nBytes);
326  void allocatePage(rose_addr_t va);
327 
328 };
329 
330 
332 // Complete semantic state
334 
335 typedef BaseSemantics::State State;
336 typedef BaseSemantics::StatePtr StatePtr;
337 
338 
340 // RISC operators
342 
344 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
345 
364 public:
367 
370 
372  // Real constructors
373 protected:
375  : BaseSemantics::RiscOperators(protoval, solver) {
376  name("Concrete");
377  (void) SValue::promote(protoval); // make sure its dynamic type is a ConcreteSemantics::SValue
378  }
379 
381  : BaseSemantics::RiscOperators(state, solver) {
382  name("Concrete");
383  (void) SValue::promote(state->protoval()); // values must have ConcreteSemantics::SValue dynamic type
384  }
385 
387  // Static allocating constructors
388 public:
391  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver = SmtSolverPtr()) {
393  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
394  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
395  BaseSemantics::StatePtr state = State::instance(registers, memory);
396  return RiscOperatorsPtr(new RiscOperators(state, solver));
397  }
398 
402  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
403  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
404  }
405 
408  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
409  return RiscOperatorsPtr(new RiscOperators(state, solver));
410  }
411 
413  // Virtual constructors
414 public:
416  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
417  return instance(protoval, solver);
418  }
419 
421  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
422  return instance(state, solver);
423  }
424 
426  // Dynamic pointer casts
427 public:
430  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
431  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
432  ASSERT_not_null(retval);
433  return retval;
434  }
435 
437  // New methods for constructing values, so we don't have to write so many SValue::promote calls in the RiscOperators
438  // implementations.
439 protected:
440  SValuePtr svalueNumber(size_t nbits, uint64_t value) {
441  return SValue::promote(number_(nbits, value));
442  }
443 
444  SValuePtr svalueNumber(const Sawyer::Container::BitVector&);
445 
446  SValuePtr svalueBoolean(bool b) {
447  return SValue::promote(boolean_(b));
448  }
449 
450  SValuePtr svalueZero(size_t nbits) {
451  return SValue::promote(number_(nbits, 0));
452  }
453 
455  // Override methods from base class. These are the RISC operators that are invoked by a Dispatcher.
456 public:
457  virtual void interrupt(int majr, int minr) ROSE_OVERRIDE;
458  virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_,
459  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
461  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
462  virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_,
463  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
464  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
465  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_,
466  size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
467  virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_,
468  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
469  virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
470  virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
471  virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_,
472  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
473  virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_,
474  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
475  virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_,
476  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
477  virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_,
478  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
479  virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_,
480  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
481  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
482  virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &sel_,
483  const BaseSemantics::SValuePtr &a_,
484  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
485  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
486  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
488  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
490  const BaseSemantics::SValuePtr &b_,
491  const BaseSemantics::SValuePtr &c_,
492  BaseSemantics::SValuePtr &carry_out/*out*/) ROSE_OVERRIDE;
493  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
495  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
497  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
499  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
501  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
503  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
505  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
506 
507  virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &intValue, SgAsmFloatType*) ROSE_OVERRIDE;
508  virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &fpValue, SgAsmFloatType *fpType,
509  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
510  virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
511  SgAsmFloatType*) ROSE_OVERRIDE;
512  virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
513  SgAsmFloatType*) ROSE_OVERRIDE;
514  virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
515  SgAsmFloatType*) ROSE_OVERRIDE;
516  virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &a, SgAsmFloatType*) ROSE_OVERRIDE;
517 
518  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg,
519  const BaseSemantics::SValuePtr &addr,
520  const BaseSemantics::SValuePtr &dflt,
521  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
522  virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg,
523  const BaseSemantics::SValuePtr &addr,
524  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
525  virtual void writeMemory(RegisterDescriptor segreg,
526  const BaseSemantics::SValuePtr &addr,
527  const BaseSemantics::SValuePtr &data,
528  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
529 
530 protected:
531  // handles readMemory and peekMemory
532  BaseSemantics::SValuePtr readOrPeekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &address,
533  const BaseSemantics::SValuePtr &dflt, bool allowSideEffects);
534 
535  // Convert expression to double
536  double exprToDouble(const BaseSemantics::SValuePtr &expr, SgAsmFloatType*);
537 
538  // Convert double to expression
539  BaseSemantics::SValuePtr doubleToExpr(double d, SgAsmFloatType*);
540 };
541 
542 } // namespace
543 } // namespace
544 } // namespace
545 } // namespace
546 
547 #endif
548 #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.
Definition: FeasiblePath.h:787
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:111
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.
Definition: RiscOperators.h:48
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.
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
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:37
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.
Definition: SmtSolver.h:25
virtual bool isBottom() const ROSE_OVERRIDE
Determines whether a value is a data-flow bottom.