ROSE  0.11.145.0
MultiSemantics.h
1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics_MultiSemantics_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics_MultiSemantics_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/BasicTypes.h>
7 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
8 
9 namespace Rose { // documented elsewhere
10 namespace BinaryAnalysis { // documented elsewhere
11 namespace InstructionSemantics { // documented elsewhere
12 
60 namespace MultiSemantics {
61 
64 public:
65  std::vector<std::string> subdomain_names;
66 };
67 
69 // Semantic values
71 
74 
85 public:
88 
90  using Ptr = SValuePtr;
91 
92 protected:
93  typedef std::vector<BaseSemantics::SValuePtr> Subvalues;
94  Subvalues subvalues;
95 
96 protected:
97  // Protected constructors
98  explicit SValue(size_t nbits)
99  : BaseSemantics::SValue(nbits) {}
100 
101  SValue(const SValue &other)
102  : BaseSemantics::SValue(other.nBits()) {
103  init(other);
104  }
105 
106  void init(const SValue &other);
107 
109  // Static allocating constructors
110 public:
112  static SValuePtr instance() {
113  return SValuePtr(new SValue(1));
114  }
115 
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  // Virtual allocating constructors
125 public:
126 
127  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override;
128 
132  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override;
133 
137  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override;
138 
141  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t number) const override;
142 
145  virtual SValuePtr create_empty(size_t nbits) const {
146  return SValuePtr(new SValue(nbits));
147  }
148 
149  virtual BaseSemantics::SValuePtr copy(size_t /*new_width*/=0) const override {
150  return BaseSemantics::SValuePtr(new SValue(*this));
151  }
152 
155  const SmtSolverPtr&) const override;
156 
158  // Override virtual methods
159 public:
160  virtual bool isBottom() const override;
161  virtual void print(std::ostream&, BaseSemantics::Formatter&) const override;
162  virtual void hash(Combinatorics::Hasher&) const override;
163 
165  // Override legacy methods. Override these for now, but always call the camelCase names from the base class. Eventually
166  // these snake_case names will go away and the camelCase will become the virtual functions, so be sure to specify
167  // "override" in your own code so you get notified when that change occurs.
168 public:
171  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
172  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
173 
177  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
178  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
179 
180  virtual void set_width(size_t nbits) override;
181 
185  virtual bool is_number() const override;
186 
187  virtual uint64_t get_number() const override;
188 
189 
191  // Additional methods first declared at this level of the class hierarchy
192 public:
195  virtual bool is_valid(size_t idx) const { // hot
196  return idx<subvalues.size() && subvalues[idx]!=NULL;
197  }
198 
201  virtual void invalidate(size_t idx);
202 
204  virtual BaseSemantics::SValuePtr get_subvalue(size_t idx) const { // hot
205  ASSERT_require(idx<subvalues.size() && subvalues[idx]!=NULL); // you should have called is_valid() first
206  return subvalues[idx];
207  }
208 
212  virtual void set_subvalue(size_t idx, const BaseSemantics::SValuePtr &value) { // hot
213  ASSERT_require(value==NULL || value->nBits()==nBits());
214  if (idx>=subvalues.size())
215  subvalues.resize(idx+1);
216  subvalues[idx] = value;
217  }
218 };
219 
220 
222 // Register states
224 
225 typedef void RegisterState;
226 
228 typedef boost::shared_ptr<void> RegisterStatePtr;
229 
231 // Memory states
233 
234 typedef void MemoryState;
235 
237 typedef boost::shared_ptr<void> MemoryStatePtr;
238 
240 // Complete state
242 
243 typedef void State;
244 
246 typedef boost::shared_ptr<void> StatePtr;
247 
249 // RISC operators
251 
253 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
254 
260 public:
263 
266 
267 protected:
268  typedef std::vector<BaseSemantics::RiscOperatorsPtr> Subdomains;
269  Subdomains subdomains;
270  std::vector<bool> active;
271  Formatter formatter; // contains names for the subdomains
272 
274  // Real constructors
275 protected:
277 
278  explicit RiscOperators(const BaseSemantics::StatePtr&, const SmtSolverPtr&);
279 
281  // Static allocating constructors
282 public:
283  ~RiscOperators();
284 
288  static RiscOperatorsPtr instanceFromRegisters(const RegisterDictionaryPtr&);
289 
290  static RiscOperatorsPtr instanceFromProtoval(const BaseSemantics::SValuePtr &protoval,
291  const SmtSolverPtr &solver = SmtSolverPtr());
292 
293  static RiscOperatorsPtr instanceFromState(const BaseSemantics::StatePtr&, const SmtSolverPtr &solver = SmtSolverPtr());
294 
296  // Virtual constructors
297 public:
299  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
300 
302  const SmtSolverPtr &solver = SmtSolverPtr()) const override;
303 
305  // Dynamic pointer casts
306 public:
307  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &ops);
308 
310  // Methods first defined at this level of the class hiearchy
311 public:
317  virtual size_t add_subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain, const std::string &name, bool activate=true);
318 
321  return formatter;
322  }
323 
325  virtual size_t nsubdomains() const {
326  return subdomains.size();
327  }
328 
330  virtual BaseSemantics::RiscOperatorsPtr get_subdomain(size_t idx) const;
331 
335  virtual bool is_active(size_t idx) const {
336  return idx<subdomains.size() && subdomains[idx]!=NULL && active[idx];
337  }
338 
341  virtual void clear_active(size_t idx) {
342  set_active(idx, false);
343  }
344 
348  virtual void set_active(size_t idx, bool status);
349 
352  virtual void before(size_t /*idx*/) {}
353 
356  virtual void after(size_t /*idx*/) {}
357 
359  virtual SValuePtr svalue_empty(size_t nbits) {
360  return SValue::promote(protoval())->create_empty(nbits);
361  }
362 
378  class Cursor {
379  public:
380  typedef std::vector<SValuePtr> Inputs;
381  protected:
382  RiscOperators *ops_;
383  Inputs inputs_;
384  size_t idx_;
385  public:
386  Cursor(RiscOperators *ops, const SValuePtr &arg1=SValuePtr(), const SValuePtr &arg2=SValuePtr(),
387  const SValuePtr &arg3=SValuePtr())
388  : ops_(ops), idx_(0) {
389  init(arg1, arg2, arg3);
390  }
391  Cursor(RiscOperators *ops, const Inputs &inputs)
392  : ops_(ops), inputs_(inputs), idx_(0) {
393  init();
394  }
395 
399  static Inputs inputs(const BaseSemantics::SValuePtr &arg1=BaseSemantics::SValuePtr(),
402 
403  bool at_end() const;
404  void next();
405  size_t idx() const;
411 
412  protected:
413  void init(const SValuePtr &arg1, const SValuePtr &arg2, const SValuePtr &arg3);
414  void init();
415  void skip_invalid();
416  bool inputs_are_valid() const;
417  };
418 
420  // RISC operations and other overrides
421 public:
422  virtual void print(std::ostream &o, BaseSemantics::Formatter&) const override;
423  virtual void startInstruction(SgAsmInstruction *insn) override;
424  virtual void finishInstruction(SgAsmInstruction *insn) override;
425  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) override;
426  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) override;
427  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) override;
428  virtual BaseSemantics::SValuePtr boolean_(bool) override;
429  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) override;
436  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a) override;
437  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a, size_t begin_bit, size_t end_bit) override;
442  const BaseSemantics::SValuePtr &nbits) override;
444  const BaseSemantics::SValuePtr &nbits) override;
446  const BaseSemantics::SValuePtr &nbits) override;
448  const BaseSemantics::SValuePtr &nbits) override;
450  const BaseSemantics::SValuePtr &nbits) override;
453  const BaseSemantics::SValuePtr &b, IteStatus&) override;
454  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a, size_t new_width) override;
455  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a, size_t new_width) override;
458  const BaseSemantics::SValuePtr &c,
459  BaseSemantics::SValuePtr &carry_out/*output*/) override;
460  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a) override;
462  const BaseSemantics::SValuePtr &b) override;
464  const BaseSemantics::SValuePtr &b) override;
466  const BaseSemantics::SValuePtr &b) override;
468  const BaseSemantics::SValuePtr &b) override;
470  const BaseSemantics::SValuePtr &b) override;
472  const BaseSemantics::SValuePtr &b) override;
475  const BaseSemantics::SValuePtr&) override;
484  SgAsmFloatType*) override;
486  SgAsmFloatType*) override;
488  SgAsmFloatType*) override;
490  SgAsmFloatType*) override;
495  const BaseSemantics::SValuePtr &dflt) override;
497  const BaseSemantics::SValuePtr &dflt) override;
498  virtual void writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) override;
500  const BaseSemantics::SValuePtr &dflt,
501  const BaseSemantics::SValuePtr &cond) override;
503  const BaseSemantics::SValuePtr &dflt) override;
504  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
505  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) override;
506 };
507 
508 } // namespace
509 } // namespace
510 } // namespace
511 } // namespace
512 
513 #endif
514 #endif
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) override
Returns a new undefined value.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Computes bit-wise OR of two values.
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 BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Whether a floating-point value is equal to zero.
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 bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Determines if two multidomain values must be equal.
virtual BaseSemantics::RiscOperatorsPtr get_subdomain(size_t idx) const
Returns the RiscOperators for a subdomain.
virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr &) override
Invoked to filter return targets.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Multiply two unsigned values.
BaseSemantics::RiscOperatorsPtr operator*() const
Return the subdomain for the current cursor position.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Divides two unsigned values.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Computes bit-wise XOR of two values.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Adds two integers of equal size.
virtual const std::string & name() const
Property: Name used for debugging.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override
Create a new unspecified MultiSemantics value.
Defines RISC operators for the MultiSemantics domain.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
Rotate bits to the right.
virtual void after(size_t)
Called after each subdomain RISC operation.
static SValuePtr instance()
Construct a prototypical value.
Base class for machine instructions.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Construct a floating-point value from an integer value.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Determines if two multidomain values might be equal.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Multiplies two signed values.
virtual void clear_active(size_t idx)
Makes a subdomain inactive.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Concatenates the bits of two values.
virtual void before(size_t)
Called before each subdomain RISC operation.
virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr &) override
Invoked to filter indirect jumps.
virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr &) override
Invoked to filter call targets.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a) override
Returns position of most significant set bit; zero when no bits are set.
virtual void set_active(size_t idx, bool status)
Makes a subdomain active or inactive.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) override
Returns a data-flow bottom value.
virtual bool is_active(size_t idx) const
Returns true if a subdomain is active.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a) override
Determines whether a value is equal to zero.
virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, const BaseSemantics::SValuePtr &cond) override
Reads a value from memory.
Holds a value or nothing.
Definition: Optional.h:49
virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) override
Reads a value from a register.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a) override
Two's complement.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a) override
One's complement.
Main namespace for the ROSE library.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Computes bit-wise AND of two values.
virtual void hash(Combinatorics::Hasher &) const override
Hash this semantic value.
virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Sign of floating-point value.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Calculates modulo with signed values.
virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr &, SgAsmFloatType *, SgAsmFloatType *) override
Convert from one floating-point type to another.
boost::shared_ptr< void > RegisterStatePtr
Shared-ownership pointer to a multi-semantics register state.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Divides two signed values.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override
Data-flow bottom value.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
Returns arg shifted right arithmetically (with sign bit).
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
virtual bool isBottom() const override
Determines whether a value is a data-flow bottom.
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.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
virtual SValuePtr create_empty(size_t nbits) const
Create a new MultiSemantics value with no valid subvalues.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a, size_t begin_bit, size_t end_bit) override
Extracts bits from a value.
virtual Formatter & get_formatter()
Returns a formatter containing the names of the subdomains.
virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Whether a floating-point value is infinity.
virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Square root.
virtual void set_width(size_t nbits) override
Virtual API.
bool at_end() const
Returns true when the cursor has gone past the last valid subdomain.
BaseSemantics::RiscOperatorsPtr operator->() const
Return the subdomain for the current cursor position.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Add two floating-point values.
virtual uint64_t get_number() const override
Virtual API.
static RiscOperatorsPtr instanceFromRegisters(const RegisterDictionaryPtr &)
Static allocating constructor.
Describes (part of) a physical CPU register.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a, size_t new_width) override
Sign extends a value.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t number) const override
Create a MultiSemantics value holding a concrete value.
virtual BaseSemantics::SValuePtr iteWithStatus(const BaseSemantics::SValuePtr &cond, const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, IteStatus &) override
If-then-else with status.
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 peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) override
Read memory without side effects.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Divide one floating-point value by another.
Sawyer::SharedPointer< class SValue > SValuePtr
Shared-ownership pointer to a multi-semantic value.
virtual BaseSemantics::SValuePtr reinterpret(const BaseSemantics::SValuePtr &, SgAsmType *) override
Reinterpret an expression as a different type.
SharedPointer< U > dynamicCast() const
Dynamic cast.
virtual BaseSemantics::SValuePtr boolean_(bool) override
Returns a Boolean value.
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Multiply two floating-point values.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) override
Returns a number of the specified bit width.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to multi-semantics RISC operators.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to a MultiSemantics value.
BaseSemantics::SValuePtr operator()(const BaseSemantics::SValuePtr &) const
Returns subdomain value of its multidomain argument.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) override
Returns a new undefined value.
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const override
Print a value to a stream using default format.
Base class for binary types.
virtual void startInstruction(SgAsmInstruction *insn) override
Called at the beginning of every instruction.
virtual size_t nsubdomains() const
Returns the number of subdomains added to this MultiDomain.
boost::shared_ptr< void > MemoryStatePtr
Shared-ownership pointer to a multi-semantics memory state.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
Calculates modulo with unsigned values.
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual size_t add_subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain, const std::string &name, bool activate=true)
Add a subdomain to this MultiSemantics domain.
virtual BaseSemantics::SValuePtr copy(size_t=0) const override
Create a new value from an existing value, changing the width if new_width is non-zero.
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
Returns arg shifted right logically (no sign bit).
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override
Create a new undefined MultiSemantics value.
std::shared_ptr< SmtSolver > SmtSolverPtr
Reference counting pointer.
virtual void set_subvalue(size_t idx, const BaseSemantics::SValuePtr &value)
Insert a subdomain value.
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 get_subvalue(size_t idx) const
Return a subdomain value.
virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *, const BaseSemantics::SValuePtr &) override
Construct an integer value from a floating-point value.
virtual void invalidate(size_t idx)
Removes a subdomain value and marks it as invalid.
virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) override
Obtain a register value without side effects.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
virtual bool is_number() const override
Determines if the value is a concrete number.
virtual void finishInstruction(SgAsmInstruction *insn) override
Called at the end of every instruction.
Base class for most instruction semantics RISC operators.
Definition: RiscOperators.h:49
virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Whether a floating-point value is denormalized.
virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Exponent of floating-point value.
Type of values manipulated by the MultiSemantics domain.
Helps printing multidomain values by allowing the user to specify a name for each subdomain...
virtual void print(std::ostream &o, BaseSemantics::Formatter &) const override
Print multi-line output for this object.
boost::shared_ptr< void > StatePtr
Shared-ownership pointer to a multi-semantics state.
virtual bool is_valid(size_t idx) const
Returns true if a subdomain value is valid.
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 fpSubtract(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Subtract one floating-point value from another.
Floating point types.
virtual SValuePtr svalue_empty(size_t nbits)
Convenience function for SValue::create_empty().
virtual void writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) override
Writes a value to a register.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
Returns arg shifted left.
size_t idx() const
Return the subdomain index for the current cursor position.
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Round toward zero.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
Rotate bits to the left.
virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
Whether a floating-point value is a special not-a-number bit pattern.