ROSE  0.11.83.2
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 override {
88  return instance(nbits);
89  }
90  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override {
91  return instance(nbits);
92  }
93  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override {
94  return instance(nbits);
95  }
96  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const override {
97  return instance(nbits, value);
98  }
99  virtual BaseSemantics::SValuePtr boolean_(bool value) const override {
100  return instance(1, value ? 1 : 0);
101  }
102  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const 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 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 override {
128  return false;
129  }
130 
131  virtual void print(std::ostream&, BaseSemantics::Formatter&) const 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 override;
140 
141  // See mustEqual
142  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
143  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
144 
145  // See nBits
146  virtual void set_width(size_t nbits) override;
147 
148  // See isConcrete
149  virtual bool is_number() const override {
150  return true;
151  }
152 
153  // See toUnsigned and toSigned
154  virtual uint64_t get_number() const 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 
188 public:
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  for (MemoryMap::Segment &segment: map_->values())
212  segment.buffer()->copyOnWrite(true);
213  map_ = map_->shallowCopy();
214  }
215  }
216 
218  // Static allocating constructors
219 public:
223  static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) {
224  return MemoryStatePtr(new MemoryState(addrProtoval, valProtoval));
225  }
226 
231  static MemoryStatePtr instance(const MemoryStatePtr &other) {
232  return MemoryStatePtr(new MemoryState(*other));
233  }
234 
236  // Virtual constructors
237 public:
243  const BaseSemantics::SValuePtr &valProtoval) const override {
244  return instance(addrProtoval, valProtoval);
245  }
246 
252  virtual BaseSemantics::MemoryStatePtr clone() const override {
253  return MemoryStatePtr(new MemoryState(*this));
254  }
255 
257  // Dynamic pointer casts
258 public:
261  static MemoryStatePtr promote(const BaseSemantics::MemoryStatePtr &x) {
262  MemoryStatePtr retval = boost::dynamic_pointer_cast<MemoryState>(x);
263  ASSERT_not_null(retval);
264  return retval;
265  }
266 
268  // Methods we inherited
269 public:
270  virtual void clear() override {
271  map_ = MemoryMap::Ptr();
272  }
273 
275  BaseSemantics::RiscOperators *valOps) const override;
276 
277  virtual void print(std::ostream&, Formatter&) const override;
278 
281  BaseSemantics::RiscOperators *valOps) override;
282 
285  BaseSemantics::RiscOperators *valOps) override;
286 
287  virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value,
289 
290  virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps,
291  BaseSemantics::RiscOperators *valOps) override;
292 
293 protected:
294  BaseSemantics::SValuePtr readOrPeekMemory(const BaseSemantics::SValuePtr &addr,
295  const BaseSemantics::SValuePtr &dflt,
298  bool allowSideEffects);
299 
301  // Methods first declared in this class
302 public:
304  const MemoryMap::Ptr memoryMap() const { return map_; }
305 
312 
319  rose_addr_t pageSize() const { return pageSize_; }
320  void pageSize(rose_addr_t nBytes);
327  void allocatePage(rose_addr_t va);
328 
329 };
330 
331 
333 // Complete semantic state
335 
336 typedef BaseSemantics::State State;
337 typedef BaseSemantics::StatePtr StatePtr;
338 
339 
341 // RISC operators
343 
345 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
346 
365 public:
368 
371 
373  // Real constructors
374 protected:
376  : BaseSemantics::RiscOperators(protoval, solver) {
377  name("Concrete");
378  (void) SValue::promote(protoval); // make sure its dynamic type is a ConcreteSemantics::SValue
379  }
380 
382  : BaseSemantics::RiscOperators(state, solver) {
383  name("Concrete");
384  (void) SValue::promote(state->protoval()); // values must have ConcreteSemantics::SValue dynamic type
385  }
386 
388  // Static allocating constructors
389 public:
392  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver = SmtSolverPtr()) {
394  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
395  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
396  BaseSemantics::StatePtr state = State::instance(registers, memory);
397  return RiscOperatorsPtr(new RiscOperators(state, solver));
398  }
399 
403  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
404  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
405  }
406 
409  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
410  return RiscOperatorsPtr(new RiscOperators(state, solver));
411  }
412 
414  // Virtual constructors
415 public:
417  const SmtSolverPtr &solver = SmtSolverPtr()) const override {
418  return instance(protoval, solver);
419  }
420 
422  const SmtSolverPtr &solver = SmtSolverPtr()) const override {
423  return instance(state, solver);
424  }
425 
427  // Dynamic pointer casts
428 public:
431  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
432  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
433  ASSERT_not_null(retval);
434  return retval;
435  }
436 
438  // New methods for constructing values, so we don't have to write so many SValue::promote calls in the RiscOperators
439  // implementations.
440 protected:
441  SValuePtr svalueNumber(size_t nbits, uint64_t value) {
442  return SValue::promote(number_(nbits, value));
443  }
444 
445  SValuePtr svalueNumber(const Sawyer::Container::BitVector&);
446 
447  SValuePtr svalueBoolean(bool b) {
448  return SValue::promote(boolean_(b));
449  }
450 
451  SValuePtr svalueZero(size_t nbits) {
452  return SValue::promote(number_(nbits, 0));
453  }
454 
456  // Override methods from base class. These are the RISC operators that are invoked by a Dispatcher.
457 public:
458  virtual void interrupt(int majr, int minr) override;
460  const BaseSemantics::SValuePtr &b_) override;
462  const BaseSemantics::SValuePtr &b_) override;
464  const BaseSemantics::SValuePtr &b_) override;
465  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override;
467  size_t begin_bit, size_t end_bit) override;
469  const BaseSemantics::SValuePtr &b_) override;
473  const BaseSemantics::SValuePtr &sa_) override;
475  const BaseSemantics::SValuePtr &sa_) override;
477  const BaseSemantics::SValuePtr &sa_) override;
479  const BaseSemantics::SValuePtr &sa_) override;
481  const BaseSemantics::SValuePtr &sa_) override;
484  const BaseSemantics::SValuePtr &a_,
485  const BaseSemantics::SValuePtr &b_) override;
486  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
487  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
489  const BaseSemantics::SValuePtr &b_) override;
491  const BaseSemantics::SValuePtr &b_,
492  const BaseSemantics::SValuePtr &c_,
493  BaseSemantics::SValuePtr &carry_out/*out*/) override;
494  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override;
496  const BaseSemantics::SValuePtr &b_) override;
498  const BaseSemantics::SValuePtr &b_) override;
500  const BaseSemantics::SValuePtr &b_) override;
502  const BaseSemantics::SValuePtr &b_) override;
504  const BaseSemantics::SValuePtr &b_) override;
506  const BaseSemantics::SValuePtr &b_) override;
507 
510  const BaseSemantics::SValuePtr &dflt) override;
512  SgAsmFloatType*) override;
514  SgAsmFloatType*) override;
516  SgAsmFloatType*) override;
518 
519  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg,
520  const BaseSemantics::SValuePtr &addr,
521  const BaseSemantics::SValuePtr &dflt,
522  const BaseSemantics::SValuePtr &cond) override;
523  virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg,
524  const BaseSemantics::SValuePtr &addr,
525  const BaseSemantics::SValuePtr &dflt) override;
526  virtual void writeMemory(RegisterDescriptor segreg,
527  const BaseSemantics::SValuePtr &addr,
528  const BaseSemantics::SValuePtr &data,
529  const BaseSemantics::SValuePtr &cond) override;
530 
531 protected:
532  // handles readMemory and peekMemory
533  BaseSemantics::SValuePtr readOrPeekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &address,
534  const BaseSemantics::SValuePtr &dflt, bool allowSideEffects);
535 
536  // Convert expression to double
537  double exprToDouble(const BaseSemantics::SValuePtr &expr, SgAsmFloatType*);
538 
539  // Convert double to expression
540  BaseSemantics::SValuePtr doubleToExpr(double d, SgAsmFloatType*);
541 };
542 
543 } // namespace
544 } // namespace
545 } // namespace
546 } // namespace
547 
548 #endif
549 #endif
virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const override
Create a new value from an existing value, changing the width if new_width is non-zero.
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 peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) override
Read memory without side effects.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) override
Determines whether a value is equal to zero.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_, size_t begin_bit, size_t end_bit) override
Extracts bits from a value.
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 bool isBottom() const override
Determines whether a value is a data-flow bottom.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Concatenates the bits of two values.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise OR of two values.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiplies two signed values.
virtual void hash(Combinatorics::Hasher &, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) const override
Calculate a hash for this memory state.
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 ...
Type of values manipulated by the concrete domain.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) override
Add two floating-point values.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) override
Writes a value to memory.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise XOR of two values.
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
virtual const Sawyer::Container::BitVector & bits() const
Returns the bit vector storing the concrete value.
virtual void print(std::ostream &, Formatter &) const override
Print a memory state to more than one line of output.
virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, const BaseSemantics::SValuePtr &cond) override
Reads a value from memory.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override
Data-flow bottom value.
virtual Sawyer::Optional< BaseSemantics::SValuePtr > createOptionalMerge(const BaseSemantics::SValuePtr &other, const BaseSemantics::MergerPtr &, const SmtSolverPtr &) const override
Possibly create a new value by merging two existing values.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override
Create a new unspecified semantic value.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two unsigned values.
virtual BaseSemantics::MemoryStatePtr clone() const override
Virtual copy constructor.
Main namespace for the ROSE library.
virtual void set_width(size_t nbits) override
Virtual API.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const override
Create a new concrete semantic value.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &intValue, SgAsmFloatType *) override
Construct a floating-point value from an integer value.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two signed values.
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:1306
virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) override
Returns position of least significant set bit; zero when no bits are set.
virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) override
Subtract one floating-point value from another.
virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &fpValue, SgAsmFloatType *fpType, const BaseSemantics::SValuePtr &dflt) override
Construct an integer value from a floating-point value.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with signed values.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with unsigned values.
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &a, SgAsmFloatType *) override
Round toward zero.
Base classes for instruction semantics.
Definition: Dispatcher.h:18
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) override
Multiply two floating-point values.
Sawyer::SharedPointer< class SValue > SValuePtr
Smart-ownership pointer to a concrete 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 void hash(Combinatorics::Hasher &) const override
Hash this semantic value.
virtual BaseSemantics::SValuePtr readMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Read a value from memory.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right arithmetically (with sign bit).
Base class for semantics machine states.
Definition: State.h:39
virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override
Extend (or shrink) operand a so it is nbits wide by adding or removing high-order bits...
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Adds two integers of equal size.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) override
Returns position of most significant set bit; zero when no bits are set.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to a SymbolicSemantics value.
static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
Instantiates a new memory state having specified prototypical value.
virtual void interrupt(int majr, int minr) override
Invoked for instructions that cause an interrupt.
virtual BaseSemantics::MemoryStatePtr create(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const override
Virtual constructor.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override
One's complement.
SharedPointer< U > dynamicCast() const
Dynamic cast.
Base class for most instruction semantics RISC operators.
Definition: RiscOperators.h:48
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the right.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified state.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual allocating constructor.
virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Write a value to memory.
static StatePtr instance(const RegisterStatePtr &registers, const MemoryStatePtr &memory)
Instantiate a new state object with specified register and memory states.
Definition: State.h:81
virtual BaseSemantics::SValuePtr boolean_(bool value) const override
Create a new, Boolean value.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override
Sign extends a value.
virtual uint64_t get_number() const override
Virtual API.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise AND of two values.
const MemoryMap::Ptr memoryMap() const
Returns the memory map.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override
Two's complement.
virtual BaseSemantics::SValuePtr peekMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Read a value from memory without side effects.
static SValuePtr instance(size_t nbits, uint64_t value)
Instantiate a new concrete value.
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_, const BaseSemantics::SValuePtr &c_, BaseSemantics::SValuePtr &carry_out) override
Add two values of equal size and a carry bit.
Defines registers available for a particular architecture.
Definition: Registers.h:37
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
Represents no value.
Definition: Optional.h:32
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override
Create a new undefined semantic value.
void allocatePage(rose_addr_t va)
Allocate a page of memory.
virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &sel_, const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
If-then-else.
virtual const std::string & name() const
Property: Name used for debugging.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const override
Print a value to a stream using default format.
virtual SValuePtr number_(size_t nbits, uint64_t value)
Returns a number of the specified bit width.
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right logically (no sign bit).
BaseSemantics::Formatter Formatter
Formatter for symbolic values.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the left.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted left.
virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Merge memory states for data flow analysis.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual allocating constructor.
Floating point types.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
virtual bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
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:26
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiply two unsigned values.