ROSE  0.11.2.0
MultiSemantics2.h
1 #ifndef Rose_MultiSemantics2_H
2 #define Rose_MultiSemantics2_H
3 #include <rosePublicConfig.h>
4 #ifdef ROSE_BUILD_BINARY_ANALYSIS_SUPPORT
5 
6 #include "BaseSemantics2.h"
7 
8 namespace Rose { // documented elsewhere
9 namespace BinaryAnalysis { // documented elsewhere
10 namespace InstructionSemantics2 { // documented elsewhere
11 
59 namespace MultiSemantics {
60 
63 public:
64  std::vector<std::string> subdomain_names;
65 };
66 
68 // Semantic values
70 
73 
84 protected:
85  typedef std::vector<BaseSemantics::SValuePtr> Subvalues;
86  Subvalues subvalues;
87 
88 protected:
89  // Protected constructors
90  explicit SValue(size_t nbits)
91  : BaseSemantics::SValue(nbits) {}
92 
93  SValue(const SValue &other)
94  : BaseSemantics::SValue(other.get_width()) {
95  init(other);
96  }
97 
98  void init(const SValue &other);
99 
101  // Static allocating constructors
102 public:
104  static SValuePtr instance() {
105  return SValuePtr(new SValue(1));
106  }
107 
109  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
110  SValuePtr retval = v.dynamicCast<SValue>();
111  ASSERT_not_null(retval);
112  return retval;
113  }
114 
116  // Virtual allocating constructors
117 public:
118 
119  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE;
120 
124  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE;
125 
129  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE;
130 
133  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t number) const ROSE_OVERRIDE;
134 
137  virtual SValuePtr create_empty(size_t nbits) const {
138  return SValuePtr(new SValue(nbits));
139  }
140 
141  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const ROSE_OVERRIDE {
142  return BaseSemantics::SValuePtr(new SValue(*this));
143  }
144 
147  const SmtSolverPtr&) const ROSE_OVERRIDE;
148 
150  // Override virtual methods
151 public:
154  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
155  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
156 
160  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
161  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE;
162 
163  virtual void set_width(size_t nbits) ROSE_OVERRIDE;
164 
165  virtual bool isBottom() const ROSE_OVERRIDE;
166 
170  virtual bool is_number() const ROSE_OVERRIDE;
171 
172  virtual uint64_t get_number() const ROSE_OVERRIDE;
173 
174  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
175 
177  // Additional methods first declared at this level of the class hierarchy
178 public:
181  virtual bool is_valid(size_t idx) const { // hot
182  return idx<subvalues.size() && subvalues[idx]!=NULL;
183  }
184 
187  virtual void invalidate(size_t idx);
188 
190  virtual BaseSemantics::SValuePtr get_subvalue(size_t idx) const { // hot
191  ASSERT_require(idx<subvalues.size() && subvalues[idx]!=NULL); // you should have called is_valid() first
192  return subvalues[idx];
193  }
194 
198  virtual void set_subvalue(size_t idx, const BaseSemantics::SValuePtr &value) { // hot
199  ASSERT_require(value==NULL || value->get_width()==get_width());
200  if (idx>=subvalues.size())
201  subvalues.resize(idx+1);
202  subvalues[idx] = value;
203  }
204 };
205 
206 
208 // Register states
210 
211 typedef void RegisterState;
212 
214 typedef boost::shared_ptr<void> RegisterStatePtr;
215 
217 // Memory states
219 
220 typedef void MemoryState;
221 
223 typedef boost::shared_ptr<void> MemoryStatePtr;
224 
226 // Complete state
228 
229 typedef void State;
230 
232 typedef boost::shared_ptr<void> StatePtr;
233 
235 // RISC operators
237 
239 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
240 
246 protected:
247  typedef std::vector<BaseSemantics::RiscOperatorsPtr> Subdomains;
248  Subdomains subdomains;
249  std::vector<bool> active;
250  Formatter formatter; // contains names for the subdomains
251 
253  // Real constructors
254 protected:
256  : BaseSemantics::RiscOperators(protoval, solver) {
257  name("Multi");
258  (void) SValue::promote(protoval); // check that its dynamic type is a MultiSemantics::SValue
259  }
260 
261  explicit RiscOperators(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr())
263  name("Multi");
264  (void) SValue::promote(state->protoval()); // dynamic type must be a MultiSemantics::SValue
265  }
266 
268  // Static allocating constructors
269 public:
273  static RiscOperatorsPtr instance(const RegisterDictionary *regdict) {
275  return RiscOperatorsPtr(new RiscOperators(protoval));
276  }
277 
278  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
279  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
280  }
281 
282  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
283  return RiscOperatorsPtr(new RiscOperators(state, solver));
284  }
285 
287  // Virtual constructors
288 public:
290  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
291  return instance(protoval, solver);
292  }
293 
295  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
296  return instance(state, solver);
297  }
298 
300  // Dynamic pointer casts
301 public:
302  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &ops);
303 
305  // Methods first defined at this level of the class hiearchy
306 public:
312  virtual size_t add_subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain, const std::string &name, bool activate=true);
313 
316  return formatter;
317  }
318 
320  virtual size_t nsubdomains() const {
321  return subdomains.size();
322  }
323 
325  virtual BaseSemantics::RiscOperatorsPtr get_subdomain(size_t idx) const;
326 
330  virtual bool is_active(size_t idx) const {
331  return idx<subdomains.size() && subdomains[idx]!=NULL && active[idx];
332  }
333 
336  virtual void clear_active(size_t idx) {
337  set_active(idx, false);
338  }
339 
343  virtual void set_active(size_t idx, bool status);
344 
347  virtual void before(size_t idx) {}
348 
351  virtual void after(size_t idx) {}
352 
354  virtual SValuePtr svalue_empty(size_t nbits) {
355  return SValue::promote(protoval())->create_empty(nbits);
356  }
357 
373  class Cursor {
374  public:
375  typedef std::vector<SValuePtr> Inputs;
376  protected:
377  RiscOperators *ops_;
378  Inputs inputs_;
379  size_t idx_;
380  public:
381  Cursor(RiscOperators *ops, const SValuePtr &arg1=SValuePtr(), const SValuePtr &arg2=SValuePtr(),
382  const SValuePtr &arg3=SValuePtr())
383  : ops_(ops), idx_(0) {
384  init(arg1, arg2, arg3);
385  }
386  Cursor(RiscOperators *ops, const Inputs &inputs)
387  : ops_(ops), inputs_(inputs), idx_(0) {
388  init();
389  }
390 
394  static Inputs inputs(const BaseSemantics::SValuePtr &arg1=BaseSemantics::SValuePtr(),
397 
398  bool at_end() const;
399  void next();
400  size_t idx() const;
406 
407  protected:
408  void init(const SValuePtr &arg1, const SValuePtr &arg2, const SValuePtr &arg3);
409  void init();
410  void skip_invalid();
411  bool inputs_are_valid() const;
412  };
413 
415  // RISC operations and other overrides
416 public:
417  virtual void print(std::ostream &o, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
418  virtual void startInstruction(SgAsmInstruction *insn) ROSE_OVERRIDE;
419  virtual void finishInstruction(SgAsmInstruction *insn) ROSE_OVERRIDE;
420  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) ROSE_OVERRIDE;
421  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) ROSE_OVERRIDE;
422  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) ROSE_OVERRIDE;
423  virtual BaseSemantics::SValuePtr boolean_(bool) ROSE_OVERRIDE;
424  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) ROSE_OVERRIDE;
425  virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
426  virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
427  virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
428  virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
429  virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
430  virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
431  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE;
432  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
433  virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
434  virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE;
435  virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE;
436  virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a,
437  const BaseSemantics::SValuePtr &nbits) ROSE_OVERRIDE;
438  virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a,
439  const BaseSemantics::SValuePtr &nbits) ROSE_OVERRIDE;
440  virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a,
441  const BaseSemantics::SValuePtr &nbits) ROSE_OVERRIDE;
442  virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a,
443  const BaseSemantics::SValuePtr &nbits) ROSE_OVERRIDE;
444  virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a,
445  const BaseSemantics::SValuePtr &nbits) ROSE_OVERRIDE;
446  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE;
447  virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &cond, const BaseSemantics::SValuePtr &a,
448  const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
449  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a, size_t new_width) ROSE_OVERRIDE;
450  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a, size_t new_width) ROSE_OVERRIDE;
451  virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
452  virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b,
453  const BaseSemantics::SValuePtr &c,
454  BaseSemantics::SValuePtr &carry_out/*output*/) ROSE_OVERRIDE;
455  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE;
456  virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a,
457  const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
458  virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a,
459  const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
460  virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a,
461  const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
462  virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a,
463  const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
464  virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a,
465  const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
466  virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a,
467  const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE;
468  virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
469  virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*,
470  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
471  virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr&, SgAsmFloatType*, SgAsmFloatType*) ROSE_OVERRIDE;
472  virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
473  virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
474  virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
475  virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
476  virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
477  virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
478  virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
479  SgAsmFloatType*) ROSE_OVERRIDE;
480  virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
481  SgAsmFloatType*) ROSE_OVERRIDE;
482  virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
483  SgAsmFloatType*) ROSE_OVERRIDE;
484  virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
485  SgAsmFloatType*) ROSE_OVERRIDE;
486  virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
487  virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
488  virtual BaseSemantics::SValuePtr reinterpret(const BaseSemantics::SValuePtr&, SgAsmType*) ROSE_OVERRIDE;
489  virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor reg,
490  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
491  virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor reg,
492  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
493  virtual void writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE;
494  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
495  const BaseSemantics::SValuePtr &dflt,
496  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
497  virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
498  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
499  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
500  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
501 };
502 
503 } // namespace
504 } // namespace
505 } // namespace
506 } // namespace
507 
508 #endif
509 #endif
virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Sign of floating-point value.
BaseSemantics::RiscOperatorsPtr operator->() const
Return the subdomain for the current cursor position.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
boost::shared_ptr< void > MemoryStatePtr
Shared-ownership pointer to a multi-semantics memory state.
boost::shared_ptr< void > StatePtr
Shared-ownership pointer to a multi-semantics state.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
static SValuePtr instance()
Construct a prototypical value.
virtual SValuePtr svalue_empty(size_t nbits)
Convenience function for SValue::create_empty().
virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is equal to zero.
virtual BaseSemantics::SValuePtr reinterpret(const BaseSemantics::SValuePtr &, SgAsmType *) ROSE_OVERRIDE
Reinterpret an expression as a different type.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE
Two's complement.
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 bool isBottom() const ROSE_OVERRIDE
Determines whether a value is a data-flow bottom.
virtual Formatter & get_formatter()
Returns a formatter containing the names of the subdomains.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Determines if two multidomain values might be equal.
Base class for machine instructions.
virtual bool is_active(size_t idx) const
Returns true if a subdomain is active.
virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is infinity.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Add two floating-point values.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
static RiscOperatorsPtr instance(const RegisterDictionary *regdict)
Static allocating constructor.
virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr &, SgAsmFloatType *, SgAsmFloatType *) ROSE_OVERRIDE
Convert from one floating-point type to another.
virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is denormalized.
STL namespace.
Holds a value or nothing.
Definition: Optional.h:49
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
Helps printing multidomain values by allowing the user to specify a name for each subdomain...
virtual bool is_number() const ROSE_OVERRIDE
Determines if the value is a concrete number.
Main namespace for the ROSE library.
virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Construct an integer value from a floating-point value.
virtual bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Determines if two multidomain values must be equal.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to multi-semantics RISC operators.
virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Subtract one floating-point value from another.
virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Reads a value from a register.
Defines RISC operators for the MultiSemantics domain.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE
Divides two signed values.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Read memory without side effects.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
Sawyer::SharedPointer< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
virtual void clear_active(size_t idx)
Makes a subdomain inactive.
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.
BaseSemantics::RiscOperatorsPtr operator*() const
Return the subdomain for the current cursor position.
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Multiply two floating-point values.
virtual void before(size_t idx)
Called before each subdomain RISC operation.
virtual uint64_t get_number() const ROSE_OVERRIDE
Return the concrete number for this value.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to a MultiSemantics value.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Writes a value to memory.
virtual void set_active(size_t idx, bool status)
Makes a subdomain active or inactive.
Describes (part of) a physical CPU register.
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 void set_subvalue(size_t idx, const BaseSemantics::SValuePtr &value)
Insert a subdomain value.
BaseSemantics::SValuePtr operator()(const BaseSemantics::SValuePtr &) const
Returns subdomain value of its multidomain argument.
virtual bool is_valid(size_t idx) const
Returns true if a subdomain value is valid.
Sawyer::SharedPointer< class SValue > SValuePtr
Shared-ownership pointer to a multi-semantic value.
virtual void after(size_t idx)
Called after each subdomain RISC operation.
virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Obtain a register value without side effects.
virtual size_t add_subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain, const std::string &name, bool activate=true)
Add a subdomain to this MultiSemantics domain.
boost::shared_ptr< void > RegisterStatePtr
Shared-ownership pointer to a multi-semantics register state.
virtual void invalidate(size_t idx)
Removes a subdomain value and marks it as invalid.
virtual BaseSemantics::RiscOperatorsPtr get_subdomain(size_t idx) const
Returns the RiscOperators for a subdomain.
virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is a special not-a-number bit pattern.
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Round toward zero.
virtual void writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE
Writes a value to a register.
SharedPointer< U > dynamicCast() const
Dynamic cast.
Base class for most instruction semantics RISC operators.
virtual size_t nsubdomains() const
Returns the number of subdomains added to this MultiDomain.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE
Data-flow bottom value.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE
Create a new unspecified MultiSemantics value.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE
Divides two unsigned values.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Construct a floating-point value from an integer value.
static Inputs inputs(const BaseSemantics::SValuePtr &arg1=BaseSemantics::SValuePtr(), const BaseSemantics::SValuePtr &arg2=BaseSemantics::SValuePtr(), const BaseSemantics::SValuePtr &arg3=BaseSemantics::SValuePtr())
Class method to construct the array of inputs from a variable number of arguments.
virtual void set_width(size_t nbits) ROSE_OVERRIDE
Accessor for value width.
Base class for binary types.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE
Create a new undefined MultiSemantics 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.
virtual size_t get_width() const
Accessor for value width.
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
Type of values manipulated by the MultiSemantics domain.
virtual BaseSemantics::SValuePtr get_subvalue(size_t idx) const
Return a subdomain value.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE
Calculates modulo with signed values.
virtual void print(std::ostream &o, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print multi-line output for this object.
Defines registers available for a particular architecture.
Definition: Registers.h:38
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE
Multiply two unsigned values.
virtual const std::string & name() const
Property: Name used for debugging.
virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Square root.
virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Exponent of floating-point value.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t number) const ROSE_OVERRIDE
Create a MultiSemantics value holding a concrete value.
virtual SValuePtr create_empty(size_t nbits) const
Create a new MultiSemantics value with no valid subvalues.
Floating point types.
virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Divide one floating-point value by another.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE
Multiplies two signed values.
size_t idx() const
Return the subdomain index for the current cursor position.
bool at_end() const
Returns true when the cursor has gone past the last valid subdomain.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) ROSE_OVERRIDE
Calculates modulo with unsigned values.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print a value to a stream using default format.