ROSE  0.11.101.0
ConcreteSemantics.h
1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics_ConcreteSemantics_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics_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 <Rose/BinaryAnalysis/BasicTypes.h>
12 #include "integerOps.h"
13 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
14 #include <Sawyer/BitVector.h>
15 
16 namespace Rose {
17 namespace BinaryAnalysis { // documented elsewhere
18 namespace InstructionSemantics { // 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 public:
47 
49  using Ptr = SValuePtr;
50 
51 protected:
53 
55  // Real constructors
56 protected:
57  explicit SValue(size_t nbits): BaseSemantics::SValue(nbits), bits_(nbits) {}
58 
59  SValue(size_t nbits, uint64_t number): BaseSemantics::SValue(nbits) {
60  bits_ = Sawyer::Container::BitVector(nbits);
61  bits_.fromInteger(number);
62  }
63 
65  // Static allocating constructors
66 public:
68  static SValuePtr instance() {
69  return SValuePtr(new SValue(1));
70  }
71 
76  static SValuePtr instance(size_t nbits) {
77  return SValuePtr(new SValue(nbits));
78  }
79 
81  static SValuePtr instance(size_t nbits, uint64_t value) {
82  return SValuePtr(new SValue(nbits, value));
83  }
84 
86  // Virtual allocating constructors
87 public:
88  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override {
89  return instance(nbits);
90  }
91  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override {
92  return instance(nbits);
93  }
94  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override {
95  return instance(nbits);
96  }
97  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const override {
98  return instance(nbits, value);
99  }
100  virtual BaseSemantics::SValuePtr boolean_(bool value) const override {
101  return instance(1, value ? 1 : 0);
102  }
103  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const override {
104  SValuePtr retval(new SValue(*this));
105  if (new_width!=0 && new_width!=retval->nBits())
106  retval->set_width(new_width);
107  return retval;
108  }
111  const SmtSolverPtr&) const override;
112 
114  // Dynamic pointer casts
115 public:
117  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
118  SValuePtr retval = v.dynamicCast<SValue>();
119  ASSERT_not_null(retval);
120  return retval;
121  }
122 
124  // Override virtual methods...
125 public:
126  virtual void hash(Combinatorics::Hasher&) const override;
127 
128  virtual bool isBottom() const override {
129  return false;
130  }
131 
132  virtual void print(std::ostream&, BaseSemantics::Formatter&) const override;
133 
135  // Override legacy virtual methods. These snake_case names may eventually go away, but for now they're the ones you should
136  // override. Be sure to use "override" in your own code in order to be notified when we finally remove these.
137 public:
138  // See mayEqual
139  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
140  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
141 
142  // See mustEqual
143  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
144  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
145 
146  // See nBits
147  virtual void set_width(size_t nbits) override;
148 
149  // See isConcrete
150  virtual bool is_number() const override {
151  return true;
152  }
153 
154  // See toUnsigned and toSigned
155  virtual uint64_t get_number() const override;
156 
158  // Additional methods first declared in this class...
159 public:
163  virtual const Sawyer::Container::BitVector& bits() const { return bits_; }
164  virtual void bits(const Sawyer::Container::BitVector&);
166 };
167 
168 
170 // Register State
172 
173 typedef BaseSemantics::RegisterStateGeneric RegisterState;
174 typedef BaseSemantics::RegisterStateGenericPtr RegisterStatePtr;
175 
176 
178 // Memory State
180 
182 typedef boost::shared_ptr<class MemoryState> MemoryStatePtr;
183 
189 public:
192 
195 
196 private:
197  MemoryMap::Ptr map_;
198  rose_addr_t pageSize_;
199 
201  // Real constructors
202 protected:
203  explicit MemoryState(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
204  : BaseSemantics::MemoryState(addrProtoval, valProtoval), pageSize_(4096) {
205  (void) SValue::promote(addrProtoval); // for its checking side effects
206  (void) SValue::promote(valProtoval);
207  }
208 
209  MemoryState(const MemoryState &other)
210  : BaseSemantics::MemoryState(other), map_(other.map_), pageSize_(other.pageSize_) {
211  if (map_) {
212  for (MemoryMap::Segment &segment: map_->values())
213  segment.buffer()->copyOnWrite(true);
214  map_ = map_->shallowCopy();
215  }
216  }
217 
219  // Static allocating constructors
220 public:
224  static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) {
225  return MemoryStatePtr(new MemoryState(addrProtoval, valProtoval));
226  }
227 
232  static MemoryStatePtr instance(const MemoryStatePtr &other) {
233  return MemoryStatePtr(new MemoryState(*other));
234  }
235 
237  // Virtual constructors
238 public:
244  const BaseSemantics::SValuePtr &valProtoval) const override {
245  return instance(addrProtoval, valProtoval);
246  }
247 
253  virtual BaseSemantics::MemoryStatePtr clone() const override {
254  return MemoryStatePtr(new MemoryState(*this));
255  }
256 
258  // Dynamic pointer casts
259 public:
262  static MemoryStatePtr promote(const BaseSemantics::MemoryStatePtr &x) {
263  MemoryStatePtr retval = boost::dynamic_pointer_cast<MemoryState>(x);
264  ASSERT_not_null(retval);
265  return retval;
266  }
267 
269  // Methods we inherited
270 public:
271  virtual void clear() override {
272  map_ = MemoryMap::Ptr();
273  }
274 
276  BaseSemantics::RiscOperators *valOps) const override;
277 
278  virtual void print(std::ostream&, Formatter&) const override;
279 
282  BaseSemantics::RiscOperators *valOps) override;
283 
286  BaseSemantics::RiscOperators *valOps) override;
287 
288  virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value,
290 
291  virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps,
292  BaseSemantics::RiscOperators *valOps) override;
293 
294 protected:
295  BaseSemantics::SValuePtr readOrPeekMemory(const BaseSemantics::SValuePtr &addr,
296  const BaseSemantics::SValuePtr &dflt,
299  bool allowSideEffects);
300 
302  // Methods first declared in this class
303 public:
305  const MemoryMap::Ptr memoryMap() const { return map_; }
306 
313 
320  rose_addr_t pageSize() const { return pageSize_; }
321  void pageSize(rose_addr_t nBytes);
328  void allocatePage(rose_addr_t va);
329 
330 };
331 
332 
334 // Complete semantic state
336 
337 typedef BaseSemantics::State State;
338 typedef BaseSemantics::StatePtr StatePtr;
339 
340 
342 // RISC operators
344 
346 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
347 
366 public:
369 
372 
374  // Real constructors
375 protected:
376  RiscOperators(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr&);
377 
378  RiscOperators(const BaseSemantics::StatePtr&, const SmtSolverPtr&);
379 
381  // Static allocating constructors
382 public:
383  ~RiscOperators();
384 
387  static RiscOperatorsPtr instanceFromRegisters(const RegisterDictionaryPtr&, const SmtSolverPtr &solver = SmtSolverPtr());
388 
392  static RiscOperatorsPtr instanceFromProtoval(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr());
393 
396  static RiscOperatorsPtr instanceFromState(const BaseSemantics::StatePtr&, const SmtSolverPtr &solver = SmtSolverPtr());
397 
399  // Virtual constructors
400 public:
402  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
403 
405  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
406 
408  // Dynamic pointer casts
409 public:
412  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr&);
413 
415  // New methods for constructing values, so we don't have to write so many SValue::promote calls in the RiscOperators
416  // implementations.
417 protected:
418  SValuePtr svalueNumber(size_t nbits, uint64_t value) {
419  return SValue::promote(number_(nbits, value));
420  }
421 
422  SValuePtr svalueNumber(const Sawyer::Container::BitVector&);
423 
424  SValuePtr svalueBoolean(bool b) {
425  return SValue::promote(boolean_(b));
426  }
427 
428  SValuePtr svalueZero(size_t nbits) {
429  return SValue::promote(number_(nbits, 0));
430  }
431 
433  // Override methods from base class. These are the RISC operators that are invoked by a Dispatcher.
434 public:
435  virtual void interrupt(int majr, int minr) override;
437  const BaseSemantics::SValuePtr &b_) override;
439  const BaseSemantics::SValuePtr &b_) override;
441  const BaseSemantics::SValuePtr &b_) override;
442  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override;
444  size_t begin_bit, size_t end_bit) override;
446  const BaseSemantics::SValuePtr &b_) override;
450  const BaseSemantics::SValuePtr &sa_) override;
452  const BaseSemantics::SValuePtr &sa_) override;
454  const BaseSemantics::SValuePtr &sa_) override;
456  const BaseSemantics::SValuePtr &sa_) override;
458  const BaseSemantics::SValuePtr &sa_) override;
461  const BaseSemantics::SValuePtr &a_,
462  const BaseSemantics::SValuePtr &b_,
463  IteStatus&) override;
464  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
465  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
467  const BaseSemantics::SValuePtr &b_) override;
469  const BaseSemantics::SValuePtr &b_,
470  const BaseSemantics::SValuePtr &c_,
471  BaseSemantics::SValuePtr &carry_out/*out*/) override;
472  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override;
474  const BaseSemantics::SValuePtr &b_) override;
476  const BaseSemantics::SValuePtr &b_) override;
478  const BaseSemantics::SValuePtr &b_) override;
480  const BaseSemantics::SValuePtr &b_) override;
482  const BaseSemantics::SValuePtr &b_) override;
484  const BaseSemantics::SValuePtr &b_) override;
485 
488  const BaseSemantics::SValuePtr &dflt) override;
490  SgAsmFloatType*) override;
492  SgAsmFloatType*) override;
494  SgAsmFloatType*) override;
496 
498  const BaseSemantics::SValuePtr &addr,
499  const BaseSemantics::SValuePtr &dflt,
500  const BaseSemantics::SValuePtr &cond) override;
502  const BaseSemantics::SValuePtr &addr,
503  const BaseSemantics::SValuePtr &dflt) override;
504  virtual void writeMemory(RegisterDescriptor segreg,
505  const BaseSemantics::SValuePtr &addr,
506  const BaseSemantics::SValuePtr &data,
507  const BaseSemantics::SValuePtr &cond) 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
Base classes for instruction semantics.
Definition: Dispatcher.h:18
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 void hash(Combinatorics::Hasher &, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) const override
Calculate a hash for this memory state.
virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) override
Subtract one floating-point value from another.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override
One's complement.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override
Data-flow bottom value.
Sawyer::SharedPointer< class SValue > SValuePtr
Smart-ownership pointer to a concrete semantic value.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to a SymbolicSemantics value.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &intValue, SgAsmFloatType *) override
Construct a floating-point value from an integer value.
virtual bool isBottom() const override
Determines whether a value is a data-flow bottom.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) override
Returns position of most significant set bit; zero when no bits are set.
virtual BaseSemantics::SValuePtr iteWithStatus(const BaseSemantics::SValuePtr &sel_, const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_, IteStatus &) override
If-then-else with status.
static SValuePtr instance()
Instantiate a new prototypical value.
static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
Instantiates a new memory state having specified prototypical value.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to a concrete memory state.
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.
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 bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
static RiscOperatorsPtr instanceFromState(const BaseSemantics::StatePtr &, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified state.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Concatenates the bits of two values.
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right logically (no sign bit).
Main namespace for the ROSE library.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with unsigned values.
virtual uint64_t get_number() const override
Virtual API.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override
Create a new unspecified semantic value.
virtual void print(std::ostream &, Formatter &) const override
Print a memory state to more than one line of output.
static MemoryStatePtr instance(const MemoryStatePtr &other)
Instantiates a new deep copy of an existing state.
virtual SValuePtr number_(size_t nbits, uint64_t value)
Returns a number of the specified bit width.
virtual BaseSemantics::SValuePtr boolean_(bool value) const override
Create a new, Boolean value.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) override
Writes a value to memory.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
BitVector & fromInteger(const BitRange &range, boost::uint64_t value)
Obtain bits from an integer.
Definition: BitVector.h:1306
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiplies two signed values.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two unsigned values.
virtual bool merge(const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Merge memory states for data flow analysis.
MemoryMapPtr Ptr
Reference counting pointer.
Definition: MemoryMap.h:115
boost::shared_ptr< class RegisterStateGeneric > RegisterStateGenericPtr
Shared-ownership pointer to generic register states.
static SValuePtr instance(size_t nbits, uint64_t value)
Instantiate a new concrete value.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the right.
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 unsignedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiply two unsigned values.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the left.
virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Write a value to memory.
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 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...
Describes (part of) a physical CPU register.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &)
Run-time promotion of a base RiscOperators pointer to concrete operators.
const MemoryMap::Ptr memoryMap() const
Returns the memory map.
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &a, SgAsmFloatType *) override
Round toward zero.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
void allocatePage(rose_addr_t va)
Allocate a page of memory.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to concrete RISC operations.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right arithmetically (with sign bit).
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise XOR of two values.
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) override
Multiply two floating-point values.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two signed values.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted left.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) override
Read memory without side effects.
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.
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.
Type of values manipulated by the concrete domain.
SharedPointer< U > dynamicCast() const
Dynamic cast.
Binary analysis.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override
Create a new undefined semantic 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.
Defines RISC operators for the ConcreteSemantics domain.
virtual void hash(Combinatorics::Hasher &) const override
Hash this semantic value.
virtual BaseSemantics::MemoryStatePtr create(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const override
Virtual constructor.
static MemoryStatePtr promote(const BaseSemantics::MemoryStatePtr &x)
Recasts a base pointer to a concrete memory state.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with signed values.
virtual SValuePtr boolean_(bool value)
Returns a Boolean value.
virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) override
Returns position of least significant set bit; zero when no bits are set.
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise AND of two values.
static SValuePtr instance(size_t nbits)
Instantiate a new undefined value of specified width.
BaseSemantics::Formatter Formatter
Formatter for symbolic values.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Adds two integers of equal size.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const override
Create a new concrete semantic value.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const override
Print a value to a stream using default format.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
virtual void interrupt(int majr, int minr) override
Invoked for instructions that cause an interrupt.
Base class for most instruction semantics RISC operators.
Definition: RiscOperators.h:48
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.
Represents no value.
Definition: Optional.h:32
Base class for semantics machine states.
Definition: State.h:39
static RiscOperatorsPtr instanceFromProtoval(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified prototypical values.
virtual void set_width(size_t nbits) override
Virtual API.
virtual BaseSemantics::MemoryStatePtr clone() const override
Virtual copy constructor.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual allocating constructor.
Floating point types.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, SgAsmFloatType *) override
Add two floating-point values.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override
Two's complement.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override
Sign extends a value.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise OR of two values.
static RiscOperatorsPtr instanceFromRegisters(const RegisterDictionaryPtr &, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object and configures it to use semantic values and states that are ...