ROSE  0.11.83.2
StaticSemantics.h
1 // Turn instruction semantics into part of the AST
2 #ifndef ROSE_BinaryAnalysis_InstructionSemantics2_StaticSemantics_H
3 #define ROSE_BinaryAnalysis_InstructionSemantics2_StaticSemantics_H
4 #include <featureTests.h>
5 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 
7 #include <Rose/BinaryAnalysis/Disassembler.h>
8 #include <Rose/BinaryAnalysis/InstructionSemantics2/NullSemantics.h>
9 #include "SageBuilderAsm.h"
10 
11 namespace Rose {
12 namespace BinaryAnalysis { // documented elsewhere
13 namespace InstructionSemantics2 { // documented elsewhere
14 
39 namespace StaticSemantics {
40 
42 // Free functions
44 
60 // Value type
63 
66 
75 public:
78 
80  using Ptr = SValuePtr;
81 
82 protected:
83  SgAsmExpression *ast_;
84 
85 protected:
86  SValue(size_t nbits, SgAsmRiscOperation::RiscOperator op): BaseSemantics::SValue(nbits) {
87  static uint64_t nVars = 0;
88  ast_ = SageBuilderAsm::buildRiscOperation(op, SageBuilderAsm::buildValueU64(nVars++));
89  }
90 
91  SValue(size_t nbits, uint64_t number): BaseSemantics::SValue(nbits) {
92  SgAsmType *type = SgAsmType::registerOrDelete(new SgAsmIntegerType(ByteOrder::ORDER_LSB, nbits,
93  false /*unsigned*/));
94  ast_ = SageBuilderAsm::buildValueInteger(number, type);
95  }
96 
97  SValue(const SValue &other): BaseSemantics::SValue(other) {
98  SgTreeCopy deep;
99  SgNode *copied = other.ast_->copy(deep);
100  ASSERT_require(isSgAsmExpression(copied));
101  ast_ = isSgAsmExpression(copied);
102  }
103 
104 public:
108  static SValuePtr instance() {
109  return SValuePtr(new SValue(1, SgAsmRiscOperation::OP_undefined));
110  }
111 
113  static SValuePtr instance_bottom(size_t nbits) {
114  return SValuePtr(new SValue(nbits, SgAsmRiscOperation::OP_bottom));
115  }
116 
122  static SValuePtr instance_undefined(size_t nbits) {
123  return SValuePtr(new SValue(nbits, SgAsmRiscOperation::OP_undefined));
124  }
125 
131  static SValuePtr instance_unspecified(size_t nbits) {
132  return SValuePtr(new SValue(nbits, SgAsmRiscOperation::OP_unspecified));
133  }
134 
136  static SValuePtr instance_integer(size_t nbits, uint64_t value) {
137  return SValuePtr(new SValue(nbits, value));
138  }
139 
140 public:
141  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) const override {
142  return instance_bottom(nbits);
143  }
144  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override {
145  return instance_undefined(nbits);
146  }
147  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) const override {
148  return instance_unspecified(nbits);
149  }
150  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const override {
151  return instance_integer(nbits, value);
152  }
153  virtual BaseSemantics::SValuePtr boolean_(bool value) const override {
154  return instance_integer(1, value ? 1 : 0);
155  }
156  virtual BaseSemantics::SValuePtr copy(size_t new_width=0) const override {
157  SValuePtr retval(new SValue(*this));
158  if (new_width!=0 && new_width!=retval->nBits())
159  retval->set_width(new_width);
160  return retval;
161  }
164  const SmtSolverPtr&) const override {
165  throw BaseSemantics::NotImplemented("StaticSemantics is not suitable for dataflow analysis", NULL);
166  }
167 
168 public:
170  static SValuePtr promote(const BaseSemantics::SValuePtr &v) { // hot
171  SValuePtr retval = v.dynamicCast<SValue>();
172  ASSERT_not_null(retval);
173  return retval;
174  }
175 
176 public:
177  // These are not needed since this domain never tries to compare semantic values.
178  virtual bool may_equal(const BaseSemantics::SValuePtr &other,
179  const SmtSolverPtr &solver = SmtSolverPtr()) const override {
180  ASSERT_not_reachable("no implementation necessary");
181  }
182 
183  virtual bool must_equal(const BaseSemantics::SValuePtr &other,
184  const SmtSolverPtr &solver = SmtSolverPtr()) const override {
185  ASSERT_not_reachable("no implementation necessary");
186  }
187 
188  virtual void set_width(size_t nbits) override {
189  ASSERT_not_reachable("no implementation necessary");
190  }
191 
192  virtual bool isBottom() const override {
193  return false;
194  }
195 
196  virtual bool is_number() const override {
197  return false;
198  }
199 
200  virtual uint64_t get_number() const override {
201  ASSERT_not_reachable("no implementation necessary");
202  }
203 
204  virtual void hash(Combinatorics::Hasher&) const override {
205  ASSERT_not_reachable("no implementation necessary");
206  }
207 
208  virtual void print(std::ostream&, BaseSemantics::Formatter&) const override;
209 
210 public:
214  virtual SgAsmExpression* ast() {
215  return ast_;
216  }
217  virtual void ast(SgAsmExpression *x) {
218  ASSERT_not_null(x);
219  ASSERT_require(x->get_parent() == NULL);
220  ast_ = x;
221  }
223 };
224 
226 // State
228 
229 // No state necessary for this domain. All instruction side effects are immediately attached to the SgAsmInstruction node
230 // rather than being stored in some state.
231 
232 typedef NullSemantics::RegisterState RegisterState;
233 typedef NullSemantics::RegisterStatePtr RegisterStatePtr;
234 
235 typedef NullSemantics::MemoryState MemoryState;
236 typedef NullSemantics::MemoryStatePtr MemoryStatePtr;
237 
238 typedef NullSemantics::State State;
239 typedef NullSemantics::StatePtr StatePtr;
240 
241 
243 // RiscOperators
245 
247 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
248 
259 public:
262 
265 
266 protected:
268  : BaseSemantics::RiscOperators(protoval, solver) {
269  name("StaticSemantics");
270  (void) SValue::promote(protoval); // make sure its dynamic type is a StaticSemantics::SValue
271  }
272 
274  : BaseSemantics::RiscOperators(state, solver) {
275  name("StaticSemantics");
276  (void) SValue::promote(state->protoval()); // values must have StaticSemantics::SValue dynamic type
277  }
278 
279 public:
282  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver = SmtSolverPtr()) {
284  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
285  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
286  BaseSemantics::StatePtr state = State::instance(registers, memory);
287  return RiscOperatorsPtr(new RiscOperators(state, solver));
288  }
289 
293  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
294  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
295  }
296 
299  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
300  return RiscOperatorsPtr(new RiscOperators(state, solver));
301  }
302 
304  // Virtual constructors
305 public:
307  const SmtSolverPtr &solver = SmtSolverPtr()) const override {
308  return instance(protoval, solver);
309  }
310 
312  const SmtSolverPtr &solver = SmtSolverPtr()) const override {
313  return instance(state, solver);
314  }
315 
317  // Dynamic pointer casts
318 public:
321  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
322  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
323  ASSERT_not_null(retval);
324  return retval;
325  }
326 
328  // Supporting functions
329 protected:
340  const BaseSemantics::SValuePtr &a);
342  const BaseSemantics::SValuePtr &a,
343  const BaseSemantics::SValuePtr &b);
345  const BaseSemantics::SValuePtr &a,
346  const BaseSemantics::SValuePtr &b,
347  const BaseSemantics::SValuePtr &c);
349  const BaseSemantics::SValuePtr &a,
350  const BaseSemantics::SValuePtr &b,
351  const BaseSemantics::SValuePtr &c,
352  const BaseSemantics::SValuePtr &d);
362 
364  // Override all operator methods from base class. These are the RISC operators that are invoked by a Dispatcher.
365 public:
366  virtual void startInstruction(SgAsmInstruction*) override;
370  virtual void hlt() override;
371  virtual void cpuid() override;
372  virtual BaseSemantics::SValuePtr rdtsc() override;
374  const BaseSemantics::SValuePtr &b_) override;
376  const BaseSemantics::SValuePtr &b_) override;
378  const BaseSemantics::SValuePtr &b_) override;
379  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override;
381  size_t begin_bit, size_t end_bit) override;
383  const BaseSemantics::SValuePtr &b_) override;
387  const BaseSemantics::SValuePtr &sa_) override;
389  const BaseSemantics::SValuePtr &sa_) override;
391  const BaseSemantics::SValuePtr &sa_) override;
393  const BaseSemantics::SValuePtr &sa_) override;
395  const BaseSemantics::SValuePtr &sa_) override;
398  const BaseSemantics::SValuePtr &a_,
399  const BaseSemantics::SValuePtr &b_) override;
403  const BaseSemantics::SValuePtr&) override;
405  const BaseSemantics::SValuePtr&) override;
407  const BaseSemantics::SValuePtr&) override;
409  const BaseSemantics::SValuePtr&) override;
411  const BaseSemantics::SValuePtr&) override;
413  const BaseSemantics::SValuePtr&) override;
415  const BaseSemantics::SValuePtr&) override;
417  const BaseSemantics::SValuePtr&) override;
418  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
419  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override;
421  const BaseSemantics::SValuePtr &b_) override;
423  const BaseSemantics::SValuePtr &b_) override;
425  const BaseSemantics::SValuePtr &b_,
426  const BaseSemantics::SValuePtr &c_,
427  BaseSemantics::SValuePtr &carry_out/*out*/) override;
428  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override;
430  const BaseSemantics::SValuePtr &b_) override;
432  const BaseSemantics::SValuePtr &b_) override;
434  const BaseSemantics::SValuePtr &b_) override;
436  const BaseSemantics::SValuePtr &b_) override;
438  const BaseSemantics::SValuePtr &b_) override;
440  const BaseSemantics::SValuePtr &b_) override;
441  virtual void interrupt(int majr, int minr) override;
443  const BaseSemantics::SValuePtr &dflt) override;
445  const BaseSemantics::SValuePtr &dflt) override;
446  virtual void writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) override;
448  const BaseSemantics::SValuePtr &addr,
449  const BaseSemantics::SValuePtr &dflt,
450  const BaseSemantics::SValuePtr &cond) override;
452  const BaseSemantics::SValuePtr &addr,
453  const BaseSemantics::SValuePtr &dflt) override;
454  virtual void writeMemory(RegisterDescriptor segreg,
455  const BaseSemantics::SValuePtr &addr,
456  const BaseSemantics::SValuePtr &data,
457  const BaseSemantics::SValuePtr &cond) override;
458 };
459 
460 
461 } // namespace
462 } // namespace
463 } // namespace
464 } // namespace
465 
466 #endif
467 #endif
virtual void cpuid() override
Invoked for the x86 CPUID instruction.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise AND of two values.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
virtual void set_width(size_t nbits) override
Virtual API.
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 isUnsignedLessThanOrEqual(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for unsigned values.
virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &sel_, const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
If-then-else.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &a_) override
Returns position of most significant set bit; zero when no bits are set.
Base class for machine instructions.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two unsigned values.
virtual BaseSemantics::SValuePtr rdtsc() override
Invoked for the x86 RDTSC instruction.
static SValuePtr instance_undefined(size_t nbits)
Instantiate an undefined value.
static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object and configures it to use semantic values and states that are ...
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
RiscOperator
One enum per RISC operator.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr &a) override
Invoked to filter return targets.
virtual SgAsmExpression * ast()
Property: Abstract syntax tree.
void attachInstructionSemantics(SgNode *ast, Disassembler *)
Build and attach static semantics to all instructions.
Holds a value or nothing.
Definition: Optional.h:49
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &a_, size_t begin_bit, size_t end_bit) override
Extracts bits from a value.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to null register state.
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right logically (no sign bit).
virtual BaseSemantics::SValuePtr isSignedGreaterThan(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for signed values.
Main namespace for the ROSE library.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with signed values.
virtual void writeRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &a) override
Writes a value to a register.
virtual void interrupt(int majr, int minr) override
Invoked for instructions that cause an interrupt.
virtual void ast(SgAsmExpression *x)
Property: Abstract syntax tree.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted left.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified prototypical values.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) const override
Create a new undefined semantic value.
virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) override
Reads a value from a register.
virtual Sawyer::Optional< BaseSemantics::SValuePtr > createOptionalMerge(const BaseSemantics::SValuePtr &, const BaseSemantics::MergerPtr &, const SmtSolverPtr &) const override
Possibly create a new value by merging two existing values.
Semantic values for generating static semantic ASTs.
virtual BaseSemantics::SValuePtr isSignedLessThanOrEqual(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for signed values.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
virtual BaseSemantics::SValuePtr isEqual(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Equality comparison.
static SValuePtr promote(const BaseSemantics::SValuePtr &v)
Promote a base value to a static semantics value.
boost::shared_ptr< class RegisterState > RegisterStatePtr
Shared-ownership pointer to null register state.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
virtual BaseSemantics::SValuePtr boolean_(bool value) const override
Create a new, Boolean value.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) override
Read memory without side effects.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Concatenates the bits of two values.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &a_) override
One's complement.
virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr &a) override
Invoked to filter call targets.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiplies two signed values.
static Type * registerOrDelete(Type *toInsert)
Registers a type with the type system.
static SValuePtr instance_bottom(size_t nbits)
Instantiate a data-flow bottom value.
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.
Base classes for instruction semantics.
Definition: Dispatcher.h:18
virtual bool isBottom() const override
Determines whether a value is a data-flow bottom.
Describes (part of) a physical CPU register.
virtual BaseSemantics::SValuePtr isUnsignedGreaterThan(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for unsigned values.
This class represents the base class for all IR nodes within Sage III.
Base class for semantics machine states.
Definition: State.h:39
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Divides two signed values.
virtual BaseSemantics::SValuePtr isSignedLessThan(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for signed values.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr isUnsignedLessThan(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for unsigned values.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Calculates modulo with unsigned values.
virtual uint64_t get_number() const override
Virtual API.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer for basic semantic operations.
SharedPointer< U > dynamicCast() const
Dynamic cast.
Base class for most instruction semantics RISC operators.
Definition: RiscOperators.h:48
Base class for expressions.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise XOR of two values.
static SValuePtr instance_unspecified(size_t nbits)
Instantiate an unspecified value.
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.
virtual BaseSemantics::SValuePtr isUnsignedGreaterThanOrEqual(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for unsigned values.
virtual bool must_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified state.
virtual SgNode * copy(SgCopyHelp &help) const
This function clones the current IR node object recursively or not, depending on the argument...
Supporting class for "Deep" copies of the AST.
Definition: Cxx_Grammar.h:9944
static StatePtr instance(const RegisterStatePtr &registers, const MemoryStatePtr &memory)
Instantiate a new state object with specified register and memory states.
Definition: State.h:81
Base class for binary types.
Sawyer::SharedPointer< class SValue > SValuePtr
Shared-ownership pointer for a static-semantics value.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to static operators.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the left.
virtual BaseSemantics::SValuePtr subtract(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Subtract one value from another.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Computes bit-wise OR of two values.
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 BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Rotate bits to the right.
SgNode * get_parent() const
Access function for parent node.
virtual BaseSemantics::SValuePtr isSignedGreaterThanOrEqual(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Comparison for signed values.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Multiply two unsigned values.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &b_) override
Adds two integers of equal size.
virtual void startInstruction(SgAsmInstruction *) override
Called at the beginning of every instruction.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) const override
Create a new concrete semantic value.
virtual void hlt() override
Invoked for the x86 HLT instruction.
static SValuePtr instance_integer(size_t nbits, uint64_t value)
Instantiate an integer constant.
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 bottom_(size_t nbits) const override
Data-flow bottom value.
virtual BaseSemantics::SValuePtr isNotEqual(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) override
Equality comparison.
Defines registers available for a particular architecture.
Definition: Registers.h:37
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &a_) override
Determines whether a value is equal to zero.
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 const std::string & name() const
Property: Name used for debugging.
Integer types.
static SValuePtr instance()
Instantiate a prototypical SValue.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &a_, size_t new_width) override
Sign extends a value.
Virtual base class for instruction disassemblers.
Definition: Disassembler.h:50
virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr &a) override
Invoked to filter indirect jumps.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const override
Print a value to a stream using default format.
BaseSemantics::SValuePtr makeSValue(size_t nbits, SgAsmExpression *)
Create a new SValue.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &a_) override
Two's complement.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &a_, const BaseSemantics::SValuePtr &sa_) override
Returns arg shifted right arithmetically (with sign bit).
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
std::shared_ptr< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
Definition: SmtSolver.h:26
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) override
Writes a value to memory.
virtual bool may_equal(const BaseSemantics::SValuePtr &other, const SmtSolverPtr &solver=SmtSolverPtr()) const override
Virtual API.
void saveSemanticEffect(const BaseSemantics::SValuePtr &)
Save instruction side effect.
virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) override
Obtain a register value without side effects.