ROSE  0.9.9.139
SourceAstSemantics2.h
1 // Turn instruction semantics into a C source AST
2 #ifndef Rose_SourceAstSemantics2_H
3 #define Rose_SourceAstSemantics2_H
4 
5 #include "Disassembler.h"
6 #include "RegisterStateGeneric.h"
7 #include "NullSemantics2.h"
8 
9 namespace Rose {
10 namespace BinaryAnalysis { // documented elsewhere
11 namespace InstructionSemantics2 { // documented elsewhere
12 
48 namespace SourceAstSemantics {
49 
51 // Value type
53 
56 
67 protected:
68  static size_t nVariables_;
69  std::string ctext_;
70 
71 protected:
72  // An undefined or unspecified value is a C variable that's not initialized.
73  explicit SValue(size_t nbits);
74 
75  // An integer value, various types depending on width
76  SValue(size_t nbits, uint64_t number);
77 
78  // Copy constructor deep-copies the AST.
79  SValue(const SValue &other);
80 
81 public:
85  static SValuePtr instance() {
86  return SValuePtr(new SValue(1));
87  }
88 
92  static SValuePtr instance_undefined(size_t nbits) {
93  return SValuePtr(new SValue(nbits));
94  }
95 
97  static SValuePtr instance_integer(size_t nbits, uint64_t value) {
98  return SValuePtr(new SValue(nbits, value));
99  }
100 
101 public:
102  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE {
103  return instance_undefined(nbits);
104  }
105  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE {
106  return instance_undefined(nbits);
107  }
108  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE {
109  return instance_undefined(nbits);
110  }
111  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const ROSE_OVERRIDE {
112  return instance_integer(nbits, value);
113  }
114  virtual BaseSemantics::SValuePtr boolean_(bool value) const ROSE_OVERRIDE {
115  return instance_integer(1, value ? 1 : 0);
116  }
117  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const ROSE_OVERRIDE {
118  SValuePtr retval(new SValue(*this));
119  if (new_width!=0 && new_width!=retval->get_width())
120  retval->set_width(new_width);
121  return retval;
122  }
125  throw BaseSemantics::NotImplemented("SourceAstSemantics is not suitable for dataflow analysis", NULL);
126  }
127 
128 public:
130  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
131  SValuePtr retval = v.dynamicCast<SValue>();
132  ASSERT_not_null(retval);
133  return retval;
134  }
135 
136 public:
137  // These are not needed since this domain never tries to compare semantic values.
138  virtual bool may_equal(const BaseSemantics::SValuePtr &other, SmtSolver *solver=NULL) const ROSE_OVERRIDE {
139  ASSERT_not_reachable("no implementation necessary");
140  }
141 
142  virtual bool must_equal(const BaseSemantics::SValuePtr &other, SmtSolver *solver=NULL) const ROSE_OVERRIDE {
143  ASSERT_not_reachable("no implementation necessary");
144  }
145 
146  virtual void set_width(size_t nbits) ROSE_OVERRIDE {
147  ASSERT_not_reachable("no implementation necessary");
148  }
149 
150  virtual bool isBottom() const ROSE_OVERRIDE {
151  return false;
152  }
153 
154  virtual bool is_number() const ROSE_OVERRIDE {
155  return false;
156  }
157 
158  virtual uint64_t get_number() const ROSE_OVERRIDE {
159  ASSERT_not_reachable("no implementation necessary");
160  }
161 
162  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
163 
164 public:
168  static std::string unsignedTypeNameForSize(size_t nbits);
169  static std::string signedTypeNameForSize(size_t nbits);
172 public:
176  virtual const std::string& ctext() const {
177  return ctext_;
178  }
179  virtual void ctext(const std::string &s) {
180  ctext_ = s;
181  }
183 };
184 
186 // State
188 
189 // No state is necessary for this domain because all instruction side effects are immediately attached to the AST that's
190 // being generated rather than being stored in some state.
191 
202 // RiscOperators
205 
207 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
208 
218 
219 public:
221  struct SideEffect {
226  // Default constructor. Not normally used, but needed by <code>std::vector</code>. (DON'T DOCUMENT)
227  SideEffect() {}
228 
229  // Used internally, not neede by users since data members are public.
230  SideEffect(const BaseSemantics::SValuePtr &location, const BaseSemantics::SValuePtr &temporary,
231  const BaseSemantics::SValuePtr &expression)
232  : location(location), temporary(temporary), expression(expression) {}
233 
235  bool isValid() const { return expression != NULL; }
236 
240  bool isSubstitution() const {
241  return isValid() && location==NULL && temporary!=NULL;
242  }
243  };
244 
246  typedef std::vector<SideEffect> SideEffects;
247 
248 private:
249  SideEffects sideEffects_; // Side effects, including substitutions
250  bool executionHalted_; // Stop adding inputs and outputs?
251 
252 protected:
254  : BaseSemantics::RiscOperators(protoval, solver), executionHalted_(false) {
255  name("SourceAstSemantics");
256  (void) SValue::promote(protoval); // make sure its dynamic type is a SourceAstSemantics::SValue
257  }
258 
260  : BaseSemantics::RiscOperators(state, solver), executionHalted_(false) {
261  name("SourceAstSemantics");
262  (void) SValue::promote(state->protoval()); // values must have SourceAstSemantics::SValue dynamic type
263  }
264 
265 public:
268  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, SmtSolver *solver=NULL) {
270  RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
271  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
272  BaseSemantics::StatePtr state = State::instance(registers, memory);
273  RiscOperatorsPtr ops = RiscOperatorsPtr(new RiscOperators(state, solver));
274  ops->resetState();
275  return ops;
276  }
277 
281  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL) {
282  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
283  }
284 
287  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL) {
288  return RiscOperatorsPtr(new RiscOperators(state, solver));
289  }
290 
292  // Virtual constructors
293 public:
295  SmtSolver *solver=NULL) const ROSE_OVERRIDE {
296  return instance(protoval, solver);
297  }
298 
300  SmtSolver *solver=NULL) const ROSE_OVERRIDE {
301  return instance(state, solver);
302  }
303 
305  // Dynamic pointer casts
306 public:
309  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
310  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
311  ASSERT_not_null(retval);
312  return retval;
313  }
314 
316  // Supporting functions
317 public:
319  BaseSemantics::SValuePtr makeSValue(size_t nbits, SgNode*, const std::string &ctext = "");
320 
328 
335 
339  const SideEffects& sideEffects() const {
340  return sideEffects_;
341  }
342 
344  void resetState();
345 
351 
353  void reset() {
354  sideEffects_.clear();
355  executionHalted_ = false;
356  resetState();
357  }
358 
365  void haltExecution() { executionHalted_ = true; }
366 
372  BaseSemantics::SValuePtr makeMask(size_t nBits, size_t nSet, size_t sa=0);
373 
375  // Override all operator methods from base class. These are the RISC operators that are invoked by a Dispatcher.
376 public:
377  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) ROSE_OVERRIDE;
378  virtual void hlt() ROSE_OVERRIDE;
379  virtual void cpuid() ROSE_OVERRIDE;
380  virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE;
381  virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_,
382  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
383  virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a_,
384  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
385  virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_,
386  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
387  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
388  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_,
389  size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
390  virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_,
391  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
392  virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
393  virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
394  virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_,
395  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
396  virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_,
397  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
398  virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_,
399  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
400  virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_,
401  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
402  virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_,
403  const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE;
404  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
405  virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &sel_,
406  const BaseSemantics::SValuePtr &a_,
407  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
408  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
409  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE;
410  virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_,
411  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
412  virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &a_,
413  const BaseSemantics::SValuePtr &b_,
414  const BaseSemantics::SValuePtr &c_,
415  BaseSemantics::SValuePtr &carry_out/*out*/) ROSE_OVERRIDE;
416  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE;
417  virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_,
418  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
419  virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_,
420  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
421  virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_,
422  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
423  virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_,
424  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
425  virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_,
426  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
427  virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_,
428  const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE;
429  virtual void interrupt(int majr, int minr) ROSE_OVERRIDE;
430  virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor reg,
431  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
432  virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor reg,
433  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
434  virtual void writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE;
435  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg,
436  const BaseSemantics::SValuePtr &addr,
437  const BaseSemantics::SValuePtr &dflt,
438  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
439  virtual void writeMemory(RegisterDescriptor segreg,
440  const BaseSemantics::SValuePtr &addr,
441  const BaseSemantics::SValuePtr &data,
442  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
443 };
444 
445 
446 } // namespace
447 } // namespace
448 } // namespace
449 } // namespace
450 
451 #endif
static std::string unsignedTypeNameForSize(size_t nbits)
Name of integer type used for value.
static RegisterStateGenericPtr instance(const SValuePtr &protoval, const RegisterDictionary *regdict)
Instantiate a new register state.
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 SmtSolver * solver() const
Property: Satisfiability module theory (SMT) solver.
static std::string signedTypeNameForSize(size_t nbits)
Name of integer type used for value.
virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE
Invoked for the x86 RDTSC instruction.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Returns true if two values could be equal.
boost::shared_ptr< class RegisterStateGeneric > RegisterStateGenericPtr
Shared-ownership pointer to generic register states.
virtual bool is_number() const ROSE_OVERRIDE
Determines if the value is a concrete number.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Computes bit-wise AND of two values.
static SValuePtr instance_undefined(size_t nbits)
Instantiate an undefined value.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Rotate bits to the left.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const ROSE_OVERRIDE
Create a new concrete semantic value.
BaseSemantics::RegisterStateGenericPtr RegisterStatePtr
Pointer to register states used by this domain.
Sawyer::SharedPointer< class SValue > SValuePtr
Shared-ownership pointer for a binary-to-source semantic value.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object with specified state.
NullSemantics::MemoryState MemoryState
Memory state used by this domain.
virtual void ctext(const std::string &s)
C source text associated with this semantic value.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Multiplies two signed values.
STL namespace.
Holds a value or nothing.
Definition: Optional.h:49
std::string registerVariableName(RegisterDescriptor)
Global variable name for a register.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE
Extracts bits from a value.
BaseSemantics::SValuePtr makeMask(size_t nBits, size_t nSet, size_t sa=0)
Return a bit mask.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to null register state.
virtual void interrupt(int majr, int minr) ROSE_OVERRIDE
Invoked for instructions that cause an interrupt.
Main namespace for the ROSE library.
BaseSemantics::SValuePtr makeSValue(size_t nbits, SgNode *, const std::string &ctext="")
Create a new SValue.
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.
Describes (part of) a physical CPU register.
NullSemantics::MemoryStatePtr MemoryStatePtr
Pointer to memory states used by this domain.
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Returns arg shifted right logically (no sign bit).
BaseSemantics::StatePtr StatePtr
Pointer to states used by this domain.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Determines whether a value is equal to zero.
virtual void hlt() ROSE_OVERRIDE
Invoked for the x86 HLT instruction.
static SValuePtr instance()
Instantiate a prototypical SValue.
static RiscOperatorsPtr instance(const RegisterDictionary *regdict, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object and configures it to use semantic values and states that are ...
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Calculates modulo with unsigned values.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Divides two signed values.
virtual void cpuid() ROSE_OVERRIDE
Invoked for the x86 CPUID instruction.
boost::shared_ptr< class State > StatePtr
Shared-ownership pointer to a semantic state.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base instance to an instance of this class.
std::vector< SideEffect > SideEffects
Side effects in the order they occur.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Computes bit-wise OR of two values.
Base classes for instruction semantics.
virtual bool must_equal(const BaseSemantics::SValuePtr &other, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Returns true if two values must be equal.
virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Returns position of least significant set bit; zero when no bits are set.
virtual void set_width(size_t nbits) ROSE_OVERRIDE
Accessor for value width.
virtual bool isBottom() const ROSE_OVERRIDE
Determines whether a value is a data-flow bottom.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:8322
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_, const BaseSemantics::SValuePtr &c_, BaseSemantics::SValuePtr &carry_out) ROSE_OVERRIDE
Add two values of equal size and a carry bit.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators instance to an instance of this semantic domain's operator...
virtual Sawyer::Optional< BaseSemantics::SValuePtr > createOptionalMerge(const BaseSemantics::SValuePtr &, const BaseSemantics::MergerPtr &, SmtSolver *) const ROSE_OVERRIDE
Possibly create a new value by merging two existing values.
virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Reads a value from a register.
virtual const std::string & ctext() const
C source text associated with this semantic value.
virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE
Extend (or shrink) operand a so it is nbits wide by adding or removing high-order bits...
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Returns arg shifted left.
Defines registers available for a particular architecture.
Definition: Registers.h:32
static SValuePtr instance_integer(size_t nbits, uint64_t value)
Instantiate an integer constant.
BaseSemantics::SValuePtr saveSideEffect(const BaseSemantics::SValuePtr &expression, const BaseSemantics::SValuePtr &location=BaseSemantics::SValuePtr())
Save a side effect.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Concatenates the bits of two values.
SharedPointer< U > dynamicCast() const
Dynamic cast.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Adds two integers of equal size.
Base class for most instruction semantics RISC operators.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) ROSE_OVERRIDE
Sign extends a value.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
One's complement.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const ROSE_OVERRIDE
Create a new undefined semantic value.
BaseSemantics::State State
State used by this domain.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print a value to a stream using default format.
virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const ROSE_OVERRIDE
Create a new unspecified semantic value.
static StatePtr instance(const RegisterStatePtr &registers, const MemoryStatePtr &memory)
Instantiate a new state object with specified register and memory states.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer for basic semantic operations.
virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Obtain a register value without side effects.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Returns arg shifted right arithmetically (with sign bit).
virtual BaseSemantics::SValuePtr boolean_(bool value) const ROSE_OVERRIDE
Create a new, Boolean value.
virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &sel_, const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
If-then-else.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Multiply two unsigned values.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Computes bit-wise XOR of two values.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Returns position of most significant set bit; zero when no bits are set.
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 writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) ROSE_OVERRIDE
Writes a value to a register.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) ROSE_OVERRIDE
Two's complement.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) ROSE_OVERRIDE
Rotate bits to the right.
bool isSubstitution() const
Predicate to determine whether side effect is rather a substitution.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Divides two unsigned values.
BaseSemantics::SValuePtr substitute(const BaseSemantics::SValuePtr &expression)
Save input value.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object with specified prototypical values.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) ROSE_OVERRIDE
Calculates modulo with signed values.
Interface to Satisfiability Modulo Theory (SMT) solvers.
virtual const std::string & name() const
Property: Name used for debugging.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const ROSE_OVERRIDE
Data-flow bottom value.
bool isValid() const
Predicate to determine whether side effect is valid.
const SideEffects & sideEffects() const
Accumulated side effects and substitutions.
BaseSemantics::RegisterStateGeneric RegisterState
Register state used by this domain.
virtual uint64_t get_number() const ROSE_OVERRIDE
Return the concrete number for this value.