ROSE  0.11.145.0
IntervalSemantics.h
1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics_IntervalSemantics_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics_IntervalSemantics_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <stdint.h>
7 
8 #ifndef __STDC_FORMAT_MACROS
9 #define __STDC_FORMAT_MACROS
10 #endif
11 #include <inttypes.h>
12 
13 #include <Rose/BinaryAnalysis/BasicTypes.h>
14 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
15 #include "integerOps.h"
16 
17 namespace Rose {
18 namespace BinaryAnalysis { // documented elsewhere
19 namespace InstructionSemantics { // documented elsewhere
20 
21 
23 namespace IntervalSemantics {
24 
25 /* Single contiguous interval. */
27 
30 
32 // Semantic values
34 
37 
40 public:
43 
45  using Ptr = SValuePtr;
46 
47 protected:
48  Intervals intervals_;
49  bool isBottom_;
50 
51 protected:
52  // Protected constructors. See base class and public members for documentation
53  explicit SValue(size_t nbits):
54  BaseSemantics::SValue(nbits), isBottom_(false){
55  intervals_.insert(Interval::hull(0, IntegerOps::genMask<uint64_t>(nbits)));
56  }
57  SValue(size_t nbits, uint64_t number)
58  : BaseSemantics::SValue(nbits), isBottom_(false) {
59  number &= IntegerOps::genMask<uint64_t>(nbits);
60  intervals_.insert(number);
61  }
62  SValue(size_t nbits, uint64_t v1, uint64_t v2):
63  BaseSemantics::SValue(nbits), isBottom_(false) {
64  v1 &= IntegerOps::genMask<uint64_t>(nbits);
65  v2 &= IntegerOps::genMask<uint64_t>(nbits);
66  ASSERT_require(v1<=v2);
67  intervals_.insert(Interval::hull(v1, v2));
68  }
69  SValue(size_t nbits, const Intervals &intervals):
70  BaseSemantics::SValue(nbits), isBottom_(false) {
71  ASSERT_require(!intervals.isEmpty());
72  ASSERT_require((intervals.greatest() <= IntegerOps::genMask<uint64_t>(nbits)));
73  intervals_ = intervals;
74  }
75 
77  // Static allocating constructors
78 public:
80  static SValuePtr instance() {
81  return SValuePtr(new SValue(1));
82  }
83 
85  static SValuePtr instance_bottom(size_t nbits) {
86  SValue *self = new SValue(nbits);
87  self->isBottom_ = true;
88  return SValuePtr(self);
89  }
90 
93  static SValuePtr instance_undefined(size_t nbits) {
94  return SValuePtr(new SValue(nbits));
95  }
96 
101  static SValuePtr instance_unspecified(size_t nbits) {
102  return SValuePtr(new SValue(nbits));
103  }
104 
106  static SValuePtr instance_integer(size_t nbits, uint64_t number) {
107  return SValuePtr(new SValue(nbits, number));
108  }
109 
111  static SValuePtr instance_intervals(size_t nbits, const Intervals &intervals) {
112  return SValuePtr(new SValue(nbits, intervals));
113  }
114 
116  static SValuePtr instance_hull(size_t nbits, uint64_t v1, uint64_t v2) {
117  return SValuePtr(new SValue(nbits, v1, v2));
118  }
119 
121  static SValuePtr instance_copy(const SValuePtr &other) {
122  return SValuePtr(new SValue(*other));
123  }
124 
126  static SValuePtr instance_from_bits(size_t nbits, uint64_t possible_bits);
127 
129  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
130  SValuePtr retval = v.dynamicCast<SValue>();
131  ASSERT_not_null(retval);
132  return retval;
133  }
134 
136  // Virtual allocating constructors inherited from the super class
137 public:
138  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override {
139  return instance_bottom(nbits);
140  }
141  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override {
142  return instance_undefined(nbits);
143  }
144  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override {
145  return instance_unspecified(nbits);
146  }
147 
148  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t number) const override {
149  return instance_integer(nbits, number);
150  }
151  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const override {
152  SValuePtr retval(new SValue(*this));
153  if (new_width!=0 && new_width!=retval->nBits())
154  retval->set_width(new_width);
155  return retval;
156  }
157 
160  const SmtSolverPtr&) const override;
161 
163  // Virtual allocating constructors first defined at this level of the class hierarchy
164 public:
166  virtual SValuePtr create(size_t nbits, uint64_t v1, uint64_t v2) {
167  return instance_hull(nbits, v1, v2);
168  }
169 
172  virtual SValuePtr create(size_t nbits, const Intervals &intervals) {
173  return instance_intervals(nbits, intervals);
174  }
175 
179  virtual SValuePtr create_from_bits(size_t nbits, uint64_t possible_bits) {
180  return instance_from_bits(nbits, possible_bits);
181  }
182 
183 
185  // Override virtual methods...
186 public:
187  virtual void hash(Combinatorics::Hasher&) const override;
188 
189  virtual bool isBottom() const override {
190  return isBottom_;
191  }
192 
193  virtual void print(std::ostream &output, BaseSemantics::Formatter&) const override;
194 
196  // Override legacy methods. Override these, but always call the camelCase versions from BaseSemantics::SValue. These
197  // snake_case names may eventually go away, so be sure to make good use of "override" in your own code.
198 public:
199  // See mayEqual
200  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
201  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
202 
203  // See mustEqual
204  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
205  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
206 
207  // See isConcrete
208  virtual bool is_number() const override {
209  return 1==intervals_.size();
210  }
211 
212  // See toUnsigned and toSigned
213  virtual uint64_t get_number() const override {
214  ASSERT_require(1==intervals_.size());
215  return intervals_.least();
216  }
217 
219  // Additional methods introduced at this level of the class hierarchy
220 public:
222  const Intervals& get_intervals() const {
223  return intervals_;
224  }
225 
227  void set_intervals(const Intervals &intervals) {
228  intervals_ = intervals;
229  }
230 
232  uint64_t possible_bits() const;
233 
234 };
235 
236 
238 // Register state
240 
241 typedef BaseSemantics::RegisterStateGeneric RegisterState;
242 typedef BaseSemantics::RegisterStateGenericPtr RegisterStateGenericPtr;
243 
244 
246 // Memory state
248 
250 typedef boost::shared_ptr<class MemoryState> MemoryStatePtr;
251 
263 public:
266 
269 
271  // Real constructors
272 protected:
273  MemoryState(const BaseSemantics::MemoryCellPtr &protocell)
274  : BaseSemantics::MemoryCellList(protocell) {}
275 
276  MemoryState(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
277  : BaseSemantics::MemoryCellList(addrProtoval, valProtoval) {}
278 
279  MemoryState(const MemoryState &other)
280  : BaseSemantics::MemoryCellList(other) {}
281 
283  // Static allocating constructors
284 public:
286  static MemoryStatePtr instance(const BaseSemantics::MemoryCellPtr &protocell) {
287  return MemoryStatePtr(new MemoryState(protocell));
288  }
289 
292  static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) {
293  return MemoryStatePtr(new MemoryState(addrProtoval, valProtoval));
294  }
295 
297  // Virtual constructors
298 public:
299  virtual BaseSemantics::MemoryStatePtr create(const BaseSemantics::MemoryCellPtr &protocell) const override {
300  return instance(protocell);
301  }
302 
304  const BaseSemantics::SValuePtr &valProtoval) const override {
305  return instance(addrProtoval, valProtoval);
306  }
307 
308  virtual BaseSemantics::MemoryStatePtr clone() const override {
309  return MemoryStatePtr(new MemoryState(*this));
310  }
311 
313  // Methods we inherited
314 public:
321 
328 
332  virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value,
334 };
335 
336 
338 // Complete state
340 
341 typedef BaseSemantics::State State;
342 typedef BaseSemantics::StatePtr StatePtr;
343 
344 
346 // RISC operators
348 
350 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
351 
354 public:
357 
360 
362  // Real constructors
363 protected:
365 
366  explicit RiscOperators(const BaseSemantics::StatePtr&, const SmtSolverPtr&);
367 
369  // Static allocating constructors
370 public:
373  static RiscOperatorsPtr instanceFromRegisters(const RegisterDictionaryPtr&, const SmtSolverPtr &solver = SmtSolverPtr());
374 
377  static RiscOperatorsPtr instanceFromProtoval(const BaseSemantics::SValuePtr &protoval,
378  const SmtSolverPtr &solver = SmtSolverPtr());
379 
382  static RiscOperatorsPtr instanceFromState(const BaseSemantics::StatePtr&, const SmtSolverPtr &solver = SmtSolverPtr());
383 
385  // Virtual constructors
386 public:
388  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
389 
391  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
392 
394  // Dynamic pointer casts
395 public:
398  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr&);
399 
401  // Methods first introduced at this level of the class hierarchy.
402 public:
403 
406  virtual SValuePtr svalue_from_bits(size_t nbits, uint64_t possible_bits) {
407  return SValue::promote(protoval())->create_from_bits(nbits, possible_bits);
408  }
409 
412  virtual SValuePtr svalue_from_intervals(size_t nbits, const Intervals &intervals) {
413  return SValue::promote(protoval())->create(nbits, intervals);
414  }
415 
417  // Override methods from base class. These are the RISC operators that are invoked by a Dispatcher.
418 public:
420  const BaseSemantics::SValuePtr &b_) override;
422  const BaseSemantics::SValuePtr &b_) override;
424  const BaseSemantics::SValuePtr &b_) override;
425  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override;
427  size_t begin_bit, size_t end_bit) override;
429  const BaseSemantics::SValuePtr &b_) override;
433  const BaseSemantics::SValuePtr &sa_) override;
435  const BaseSemantics::SValuePtr &sa_) override;
437  const BaseSemantics::SValuePtr &sa_) override;
439  const BaseSemantics::SValuePtr &sa_) override;
441  const BaseSemantics::SValuePtr &sa_) override;
444  const BaseSemantics::SValuePtr &a_,
445  const BaseSemantics::SValuePtr &b_,
446  IteStatus&) override;
447  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
448  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
450  const BaseSemantics::SValuePtr &b_) override;
452  const BaseSemantics::SValuePtr &b_,
453  const BaseSemantics::SValuePtr &c_,
454  BaseSemantics::SValuePtr &carry_out/*out*/) override;
455  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override;
457  const BaseSemantics::SValuePtr &b_) override;
459  const BaseSemantics::SValuePtr &b_) override;
461  const BaseSemantics::SValuePtr &b_) override;
463  const BaseSemantics::SValuePtr &b_) override;
465  const BaseSemantics::SValuePtr &b_) override;
467  const BaseSemantics::SValuePtr &b_) override;
469  const BaseSemantics::SValuePtr &addr,
470  const BaseSemantics::SValuePtr &dflt,
471  const BaseSemantics::SValuePtr &cond) override;
473  const BaseSemantics::SValuePtr &addr,
474  const BaseSemantics::SValuePtr &dflt) override;
475  virtual void writeMemory(RegisterDescriptor segreg,
476  const BaseSemantics::SValuePtr &addr,
477  const BaseSemantics::SValuePtr &data,
478  const BaseSemantics::SValuePtr &cond) override;
479 };
480 
481 } // namespace
482 } // namespace
483 } // namespace
484 } // namespace
485 
486 #endif
487 #endif
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) override
Writes a value to memory.
Type of values manipulated by the IntervalSemantics domain.
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.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to an interval memory state.
virtual BaseSemantics::MemoryStatePtr create(const BaseSemantics::MemoryCellPtr &protocell) const override
Virtual allocating constructor.
static RiscOperatorsPtr instanceFromState(const BaseSemantics::StatePtr &, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators with specified state.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two unsigned values.
static SValuePtr instance_undefined(size_t nbits)
Instantiate a new undefined value of particular width.
Sawyer::SharedPointer< class SValue > SValuePtr
Shared-ownership pointer to an interval semantic value.
void set_intervals(const Intervals &intervals)
Changes the rangemap stored in the value.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with unsigned values.
virtual SValuePtr svalue_from_bits(size_t nbits, uint64_t possible_bits)
Create a new SValue from a set of possible bits.
static RiscOperatorsPtr instanceFromProtoval(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified prototypical value.
virtual BaseSemantics::SValuePtr peekMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Read a byte from memory without side effects.
virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) override
Returns position of least significant set bit; zero when no bits are set.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
virtual BaseSemantics::SValuePtr readMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Read a byte from memory.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_, size_t begin_bit, size_t end_bit) override
Extracts bits from a value.
const Intervals & get_intervals() const
Returns the rangemap stored in this value.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with signed values.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the left.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual allocating constructor.
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 signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override
Sign extends a value.
virtual SValuePtr create(size_t nbits, const Intervals &intervals)
Construct a ValueType from a rangemap.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t number) const override
Create a new concrete semantic value.
Holds a value or nothing.
Definition: Optional.h:49
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) override
Returns position of most significant set bit; zero when no bits are set.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
Main namespace for the ROSE library.
virtual SValuePtr create(size_t nbits, uint64_t v1, uint64_t v2)
Construct a ValueType that's constrained to be between two unsigned values, inclusive.
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.
boost::shared_ptr< MemoryCell > MemoryCellPtr
Shared-ownership pointer to a memory cell.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to an IntevalSemantics value.
virtual void writeMemory(const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
Write a byte to memory.
void insert(const Interval2 &interval)
Insert specified values.
Definition: IntervalSet.h:544
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override
One's complement.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
virtual BaseSemantics::MemoryStatePtr clone() const override
Virtual allocating copy constructor.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Concatenates the bits of two values.
static SValuePtr instance_hull(size_t nbits, uint64_t v1, uint64_t v2)
Instantiate a new value that's constrained to be between two unsigned values, inclusive.
static SValuePtr instance_unspecified(size_t nbits)
Instantiate a new unspecified value of specific width.
boost::shared_ptr< class RegisterStateGeneric > RegisterStateGenericPtr
Shared-ownership pointer to generic register states.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
virtual SValuePtr svalue_from_intervals(size_t nbits, const Intervals &intervals)
Create a new SValue from a set of intervals.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise XOR of two values.
static MemoryStatePtr instance(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
Instantiate a new memory state with prototypical value.
static SValuePtr instance_integer(size_t nbits, uint64_t number)
Instantiate a new concrete value of particular width.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Adds two integers of equal size.
virtual SValuePtr create_from_bits(size_t nbits, uint64_t possible_bits)
Generate ranges from bits.
Describes (part of) a physical CPU register.
static Interval hull(T v1, T v2)
Construct an interval from two endpoints.
Definition: Interval.h:151
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiplies two signed values.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the right.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiply two unsigned values.
virtual bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
static SValuePtr instance_copy(const SValuePtr &other)
Instantiate a new copy of an existing value.
SharedPointer< U > dynamicCast() const
Dynamic cast.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted left.
static SValuePtr instance_bottom(size_t nbits)
Instantiate a new data-flow-bottom value of specified width.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) override
Determines whether a value is equal to zero.
Scalar least() const
Returns the minimum scalar contained in this set.
Definition: IntervalSet.h:420
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two signed values.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override
Two's complement.
virtual void hash(Combinatorics::Hasher &) const override
Hash this semantic value.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override
Create a new unspecified semantic value.
virtual bool isBottom() const override
Determines whether a value is a data-flow bottom.
Range of values delimited by endpoints.
Definition: Interval.h:33
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) override
Read memory without side effects.
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise OR of two values.
virtual void print(std::ostream &output, BaseSemantics::Formatter &) const override
Print a value to a stream using default format.
std::shared_ptr< SmtSolver > SmtSolverPtr
Reference counting pointer.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override
Data-flow bottom value.
static MemoryStatePtr instance(const BaseSemantics::MemoryCellPtr &protocell)
Instantiate a new memory state with specified prototypical cells and 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 ...
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right arithmetically (with sign bit).
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right logically (no sign bit).
Sawyer::Container::IntervalSet< Interval > Intervals
Set of intervals.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
Base class for most instruction semantics RISC operators.
Definition: RiscOperators.h:49
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::MemoryStatePtr create(const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const override
Virtual allocating constructor.
static SValuePtr instance_intervals(size_t nbits, const Intervals &intervals)
Instantiate a new value from a set of intervals.
Interval::Value size() const
Number of scalar elements represented.
Definition: IntervalSet.h:308
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise AND of two values.
uint64_t possible_bits() const
Returns all possible bits that could be set.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override
Create a new undefined semantic value.
Base class for semantics machine states.
Definition: State.h:39
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &)
Run-time promotion of a base RiscOperators pointer to interval operators.
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_from_bits(size_t nbits, uint64_t possible_bits)
Create a value from a set of possible bits.
static SValuePtr instance()
Instantiate a new prototypical value.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to interval RISC operations.
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.