ROSE  0.9.9.139
TraceSemantics2.h
1 #ifndef Rose_TraceSemantics2_H
2 #define Rose_TraceSemantics2_H
3 
4 #include "BaseSemantics2.h"
5 #include "Diagnostics.h"
6 
7 namespace Rose {
8 namespace BinaryAnalysis { // documented elsewhere
9 namespace InstructionSemantics2 { // documented elsewhere
10 
50 namespace TraceSemantics {
51 
52 
54 // Semantic values
56 
57 typedef void SValue;
58 
60 typedef boost::shared_ptr<void> SValuePtr;
61 
62 
64 // Register state
66 
67 typedef void RegisterState;
68 
70 typedef boost::shared_ptr<void> RegisterStatePtr;
71 
72 
74 // Memory state
76 
77 typedef void MemoryState;
78 
80 typedef boost::shared_ptr<void> MemoryStatePtr;
81 
82 
84 // RISC operators
86 
88 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
89 
92  BaseSemantics::RiscOperatorsPtr subdomain_; // Domain to which all our RISC operators chain
93  Sawyer::Message::Stream stream_; // stream to which output is emitted
94 
95 
97  // Real constructors.
98 protected:
99  // use the version that takes a subdomain instead of this c'tor
101  : BaseSemantics::RiscOperators(protoval, solver), stream_(mlog[Diagnostics::INFO]) {
102  name("Trace");
103  }
104 
105  // use the version that takes a subdomain instead of this c'tor.
106  explicit RiscOperators(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL)
107  : BaseSemantics::RiscOperators(state, solver), stream_(mlog[Diagnostics::INFO]) {
108  name("Trace");
109  }
110 
112  : BaseSemantics::RiscOperators(subdomain->currentState(), subdomain->solver()),
113  subdomain_(subdomain), stream_(mlog[Diagnostics::INFO]) {
114  name("Trace");
115  }
116 
117 public:
118  virtual ~RiscOperators() {
119  linePrefix();
120  stream_ <<"operators destroyed\n";
121  }
122 
124  // Static allocating constructors.
125 public:
129  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL) {
130  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
131  }
132 
136  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL) {
137  return RiscOperatorsPtr(new RiscOperators(state, solver));
138  }
139 
142  static RiscOperatorsPtr instance(const BaseSemantics::RiscOperatorsPtr &subdomain) {
143  ASSERT_not_null(subdomain);
144  RiscOperatorsPtr self = subdomain->currentState()!=NULL ?
145  RiscOperatorsPtr(new RiscOperators(subdomain->currentState(), subdomain->solver())) :
146  RiscOperatorsPtr(new RiscOperators(subdomain->protoval(), subdomain->solver()));
147  self->subdomain_ = subdomain;
148  return self;
149  }
150 
152  // Virtual constructors
153 public:
155  SmtSolver *solver=NULL) const ROSE_OVERRIDE {
156  return instance(protoval, solver);
157  }
158 
160  SmtSolver *solver=NULL) const ROSE_OVERRIDE {
161  return instance(state, solver);
162  }
163 
166  return instance(subdomain);
167  }
168 
170  // Dynamic pointer casts
171 public:
174  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
175  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
176  ASSERT_not_null(retval);
177  return retval;
178  }
179 
181  // Methods first defined at this level of the class hierarchy
182 public:
184  virtual BaseSemantics::RiscOperatorsPtr get_subdomain() const ROSE_DEPRECATED("use subdomain instead") {
185  return subdomain();
186  }
187 
188 
190  void set_subdomain(const BaseSemantics::RiscOperatorsPtr &sd) ROSE_DEPRECATED("use subdomain instead") {
191  subdomain(sd);
192  }
193 
197  const BaseSemantics::RiscOperatorsPtr& subdomain() const { return subdomain_; }
198  void subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain) { subdomain_ = subdomain; }
204  void check_subdomain() const ROSE_DEPRECATED("use checkSubodmain instead") {
205  checkSubdomain();
206  }
207  void checkSubdomain() const {
208  if (subdomain_==NULL)
209  throw BaseSemantics::Exception("subdomain is not set; nothing to trace", NULL);
210  }
217  Sawyer::Message::Stream& stream() { return stream_; }
218  void stream(Sawyer::Message::Stream &s) { stream_ = s; }
221 protected:
222  void linePrefix();
223  std::string toString(const BaseSemantics::SValuePtr&);
224  std::string toString(SgAsmFloatType*);
225  void check_equal_widths(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
226  const BaseSemantics::SValuePtr &check_width(const BaseSemantics::SValuePtr &a, size_t nbits,
227  const std::string &what="result");
228  std::string register_name(RegisterDescriptor);
229 
230  void before(const std::string&);
231  void before(const std::string&, RegisterDescriptor);
232  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&);
233  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
234  size_t);
235  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
236  const BaseSemantics::SValuePtr&);
237  void before(const std::string&, SgAsmInstruction*, bool showAddress);
238  void before(const std::string&, size_t);
239  void before(const std::string&, size_t, uint64_t);
240  void before(const std::string&, const BaseSemantics::SValuePtr&);
241  void before(const std::string&, const BaseSemantics::SValuePtr&, size_t);
242  void before(const std::string&, const BaseSemantics::SValuePtr&, size_t, size_t);
243  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
244  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
245  const BaseSemantics::SValuePtr&);
246  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*);
247  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*, const BaseSemantics::SValuePtr&);
248  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*, SgAsmFloatType*);
249  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&, SgAsmFloatType*);
250 
251  void after();
254  void after(const BaseSemantics::Exception&);
255  void after_exception();
256 
258  // Methods we override from our super class
259 public:
260  virtual BaseSemantics::SValuePtr protoval() const ROSE_OVERRIDE;
261  virtual void solver(SmtSolver*) ROSE_OVERRIDE;
262  virtual SmtSolver *solver() const ROSE_OVERRIDE;
263  virtual BaseSemantics::StatePtr currentState() const ROSE_OVERRIDE;
264  virtual void currentState(const BaseSemantics::StatePtr&) ROSE_OVERRIDE;
265  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
266  virtual size_t nInsns() const ROSE_OVERRIDE;
267  virtual void nInsns(size_t n) ROSE_OVERRIDE;
268  virtual SgAsmInstruction* currentInstruction() const ROSE_OVERRIDE;
269  virtual void startInstruction(SgAsmInstruction*) ROSE_OVERRIDE;
270  virtual void finishInstruction(SgAsmInstruction*) ROSE_OVERRIDE;
271 
272  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) ROSE_OVERRIDE;
273  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) ROSE_OVERRIDE;
274  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) ROSE_OVERRIDE;
275  virtual BaseSemantics::SValuePtr boolean_(bool value) ROSE_OVERRIDE;
276  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) ROSE_OVERRIDE;
277 
278  virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
279  virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
280  virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
281  virtual void hlt() ROSE_OVERRIDE;
282  virtual void cpuid() ROSE_OVERRIDE;
283  virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE;
284 
285  // The actual RISC operators. These are pure virtual in the base class
286  virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
287  virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
288  virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
289  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
290  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr&, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
291  virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
292  virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
293  virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
294  virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
295  virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
296  virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
297  virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
298  virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr&,
299  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
300  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
301  virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
302  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
303  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr&, size_t nbits) ROSE_OVERRIDE;
304  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr&, size_t nbits) ROSE_OVERRIDE;
305  virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
306  virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
307  const BaseSemantics::SValuePtr&,
308  BaseSemantics::SValuePtr&/*out*/) ROSE_OVERRIDE;
309  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
310  virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
311  virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
312  virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr&,
313  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
314  virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr&,
315  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
316  virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr&,
317  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
318  virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr&,
319  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
320 
321  virtual void interrupt(int majr, int minr) ROSE_OVERRIDE;
322 
323  virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
324  virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*,
325  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
326  virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr&, SgAsmFloatType*, SgAsmFloatType*) ROSE_OVERRIDE;
327  virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
328  virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
329  virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
330  virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
331  virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
332  virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
333  virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
334  SgAsmFloatType*) ROSE_OVERRIDE;
335  virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
336  SgAsmFloatType*) ROSE_OVERRIDE;
337  virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
338  SgAsmFloatType*) ROSE_OVERRIDE;
339  virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
340  SgAsmFloatType*) ROSE_OVERRIDE;
341  virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
342  virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
343 
344  virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor,
345  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
346  virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor,
347  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
348  virtual void writeRegister(RegisterDescriptor, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
349  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
350  const BaseSemantics::SValuePtr &dflt,
351  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
352  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
353  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
354 };
355 
356 } // namespace
357 } // namespace
358 } // namespace
359 } // namespace
360 
361 #endif
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Multiply two floating-point values.
virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Subtract one floating-point value from another.
boost::shared_ptr< void > RegisterStatePtr
Shared-ownership pointer to trace-semantics register state.
virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Obtain a register value without side effects.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Rotate bits to the right.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::RiscOperatorsPtr &subdomain)
Wraps a subdomain's RISC operators to add tracing.
virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Divide one floating-point value by another.
virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE
Invoked for the x86 RDTSC instruction.
virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Sign of floating-point value.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Divides two signed values.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Rotate bits to the left.
virtual SgAsmInstruction * currentInstruction() const ROSE_OVERRIDE
Returns current instruction.
virtual void startInstruction(SgAsmInstruction *) ROSE_OVERRIDE
Called at the beginning of every instruction.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise XOR of two values.
void subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain)
Property: Subdomain to which operations are forwarded.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &, size_t nbits) ROSE_OVERRIDE
Sign extends a value.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE
Extracts bits from a value.
Base class for machine instructions.
virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
If-then-else.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
One's complement.
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 SmtSolver * solver() const ROSE_OVERRIDE
Property: Satisfiability module theory (SMT) solver.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns position of most significant set bit; zero when no bits are set.
virtual BaseSemantics::RiscOperatorsPtr get_subdomain() const ROSE_DEPRECATED("use subdomain instead")
Obtain a pointer to the subdomain's RISC operators.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Add two floating-point values.
STL namespace.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Calculates modulo with signed values.
virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Exponent of floating-point value.
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 concat(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Concatenates the bits of two values.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to trace-semantics RISC operations.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Divides two unsigned values.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Two's complement.
void set_subdomain(const BaseSemantics::RiscOperatorsPtr &sd) ROSE_DEPRECATED("use subdomain instead")
Set the subdomain that is to be traced.
virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is infinity.
Main namespace for the ROSE library.
virtual BaseSemantics::SValuePtr boolean_(bool value) ROSE_OVERRIDE
Returns a Boolean value.
virtual void interrupt(int majr, int minr) ROSE_OVERRIDE
Invoked for instructions that cause an interrupt.
Describes (part of) a physical CPU register.
virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Construct an integer value from a floating-point value.
virtual void cpuid() ROSE_OVERRIDE
Invoked for the x86 CPUID instruction.
boost::shared_ptr< void > MemoryStatePtr
Shared-ownership pointer to trace-semantics memory state.
void stream(Sawyer::Message::Stream &s)
Property: output stream to which tracing is emitted.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise AND of two values.
virtual BaseSemantics::SValuePtr protoval() const ROSE_OVERRIDE
Property: Prototypical semantic value.
Sawyer::Message::Stream & stream()
Property: output stream to which tracing is emitted.
boost::shared_ptr< class State > StatePtr
Shared-ownership pointer to a semantic state.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) ROSE_OVERRIDE
Returns a number of the specified bit width.
Base classes for instruction semantics.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Multiplies two signed values.
virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Square root.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to trace operators.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) ROSE_OVERRIDE
Returns a new undefined value.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted right arithmetically (with sign bit).
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted right logically (no sign bit).
Sawyer::Message::Facility mlog
Diagnostics logging facility for instruction semantics.
virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter call targets.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print multi-line output for this object.
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Add two values of equal size and a carry bit.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual void writeRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Writes a value to a register.
Base class for most instruction semantics RISC operators.
void check_subdomain() const ROSE_DEPRECATED("use checkSubodmain instead")
Check that we have a valid subdomain.
virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr &, SgAsmFloatType *, SgAsmFloatType *) ROSE_OVERRIDE
Convert from one floating-point type to another.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted left.
virtual void finishInstruction(SgAsmInstruction *) ROSE_OVERRIDE
Called at the end of every instruction.
virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter indirect jumps.
virtual BaseSemantics::StatePtr currentState() const ROSE_OVERRIDE
Property: Current semantic state.
virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter return targets.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) ROSE_OVERRIDE
Returns a data-flow bottom value.
virtual size_t nInsns() const ROSE_OVERRIDE
Property: Number of instructions processed.
virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is equal to zero.
const BaseSemantics::RiscOperatorsPtr & subdomain() const
Property: Subdomain to which operations are forwarded.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Calculates modulo with unsigned values.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Adds two integers of equal size.
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.
Converts text to messages.
Definition: Message.h:1394
Interface to Satisfiability Modulo Theory (SMT) solvers.
virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &, size_t nbits) ROSE_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.
virtual void hlt() ROSE_OVERRIDE
Invoked for the x86 HLT instruction.
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Round toward zero.
Base class for exceptions thrown by instruction semantics.
void checkSubdomain() const
Check that we have a valid subdomain.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Virtual allocating constructor.
boost::shared_ptr< void > SValuePtr
Shared-ownership pointer to trace-semantics values.
static RiscOperatorsPtr instance(const BaseSemantics::RiscOperatorsPtr &subdomain)
Instantiate a new RiscOperators object.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise OR of two values.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Determines whether a value is equal to zero.
Floating point types.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Construct a floating-point value from an integer value.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Multiply two unsigned values.
virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is denormalized.
virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Reads a value from a register.
virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns position of least significant set bit; zero when no bits are set.