ROSE  0.9.10.69
LlvmSemantics2.h
1 #ifndef Rose_LlvmSemantics2_H
2 #define Rose_LlvmSemantics2_H
3 
4 #include "SymbolicSemantics2.h"
5 #include "CommandLine.h"
6 #include "DispatcherX86.h"
7 
8 namespace Rose {
9 namespace BinaryAnalysis {
10 namespace InstructionSemantics2 {
11 
13 namespace LlvmSemantics {
14 
15 typedef std::vector<RegisterDescriptor> RegisterDescriptors;
16 
22 typedef SymbolicExpr::Nodes TreeNodes;
23 
26 
27 typedef BaseSemantics::RegisterStateGenericPtr RegisterStatePtr;
29 
30 typedef SymbolicSemantics::MemoryStatePtr MemoryStatePtr;
32 
33 typedef BaseSemantics::StatePtr StatePtr;
35 
37 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
38 
40 private:
43 
44  Rewrites rewrites; // maps expressions to LLVM variables
45  Variables variables; // ROSE-to-LLVM variable map; name includes sigil
46  RegisterStatePtr prev_regstate; // most recently emitted register state
47  RegisterDescriptors important_registers; // registers that should be emitted to LLVM
48  TreeNodes mem_writes; // memory write operations (OP_WRITE expressions)
49  int indent_level; // level of indentation (might be negative, but prefix() clips to zero
50  std::string indent_string; // white space per indentation level
51  int llvmVersion_; // 1000000*major + 1000*minor + patch. e.g., 3005000 = llvm-3.5.0
52 
54  // Real constructors
55 protected:
57  : SymbolicSemantics::RiscOperators(protoval, solver), indent_level(0), indent_string(" "), llvmVersion_(0) {
58  name("Llvm");
59  }
60 
61  explicit RiscOperators(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr())
62  : SymbolicSemantics::RiscOperators(state, solver), indent_level(0), indent_string(" "), llvmVersion_(0) {
63  name("Llvm");
64  }
65 
67  // Static allocating constructors
68 public:
71  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver = SmtSolverPtr()) {
73  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
74  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
75  BaseSemantics::StatePtr state = State::instance(registers, memory);
76  return RiscOperatorsPtr(new RiscOperators(state, solver));
77  }
78 
80  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
81  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
82  }
83 
85  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
86  return RiscOperatorsPtr(new RiscOperators(state, solver));
87  }
88 
90  // Virtual constructors
91 public:
93  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
94  return instance(protoval, solver);
95  }
96 
98  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
99  return instance(state, solver);
100  }
101 
103  // Dynamic pointer cases
104 public:
107  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
108  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
109  assert(retval!=NULL);
110  return retval;
111  }
112 
114  // Properties
115 public:
123  int llvmVersion() const { return llvmVersion_; }
124  void llvmVersion(int v) { llvmVersion_ = v; }
127  // Methods we override from the super class
129 public:
131  const BaseSemantics::SValuePtr &dflt,
132  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
133  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
134  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
135 
137  // Methods to control indentation of LLVM output
138 public:
142  int indent(int nlevels=1) { indent_level += nlevels; return nlevels; }
143 
145  std::string prefix() const;
146 
148  struct Indent {
149  RiscOperators *ops;
150  RiscOperatorsPtr ops_ptr;
151  int nlevels;
152  explicit Indent(const RiscOperatorsPtr &ops_ptr, int nlevels=1): ops_ptr(ops_ptr), nlevels(nlevels) {
153  ops = ops_ptr.get();
154  ops->indent(nlevels);
155  }
156  explicit Indent(RiscOperators *ops, int nlevels=1): ops(ops), nlevels(nlevels) {
157  ops->indent(nlevels);
158  }
159  ~Indent() {
160  ops->indent(-nlevels);
161  }
162  };
163 
165  // New methods to control/query the machine state
166 public:
168  virtual void reset();
169 
172  virtual const RegisterDescriptors& get_important_registers();
173 
176  virtual RegisterDescriptors get_stored_registers();
177 
179  virtual RegisterDescriptors get_modified_registers();
180 
183 
185  virtual SValuePtr get_instruction_pointer();
186 
190  virtual const TreeNodes& get_memory_writes() { return mem_writes; }
191 
193  virtual void make_current();
194 
196  virtual void add_rewrite(const ExpressionPtr &from, const LeafPtr &to);
197 
200  virtual std::string add_variable(const LeafPtr&);
201 
204  virtual std::string get_variable(const LeafPtr&);
205 
207  // New methods to emit the machine state
208 public:
210  virtual void emit_register_declarations(std::ostream&, const RegisterDescriptors&);
211 
213  virtual void emit_register_definitions(std::ostream&, const RegisterDescriptors&);
214 
241  virtual void emit_prerequisites(std::ostream&, const RegisterDescriptors&, const RegisterDictionary*);
242 
245  virtual void emit_next_eip(std::ostream&, SgAsmInstruction *latest_insn);
246 
248  virtual void emit_memory_writes(std::ostream&);
249 
251  virtual void emit_changed_state(std::ostream&);
252 
254  // New methods to return snippets of LLVM as strings or expressions
255 public:
257  virtual std::string llvm_integer_type(size_t nbits);
258 
260  virtual std::string llvm_term(const ExpressionPtr&);
261 
264  virtual std::string llvm_lvalue(const LeafPtr&);
265 
267  virtual LeafPtr next_temporary(size_t nbits);
268 
270  virtual std::string next_label();
271 
273  virtual std::string addr_label(rose_addr_t);
274 
276  virtual std::string function_label(SgAsmFunction*);
277 
279  // New methods to emit LLVM code for an expression.
280 public:
298  virtual LeafPtr emit_expression(std::ostream&, const SValuePtr&);
299  virtual LeafPtr emit_expression(std::ostream&, const ExpressionPtr&);
300  virtual LeafPtr emit_expression(std::ostream&, const LeafPtr&);
303 protected:
307  virtual LeafPtr emit_assignment(std::ostream&, const ExpressionPtr &rhs);
308 
315  virtual ExpressionPtr emit_zero_extend(std::ostream&, const ExpressionPtr &value, size_t nbits);
316  virtual ExpressionPtr emit_sign_extend(std::ostream&, const ExpressionPtr &value, size_t nbits);
317  virtual ExpressionPtr emit_truncate(std::ostream&, const ExpressionPtr &value, size_t nbits);
318  virtual ExpressionPtr emit_unsigned_resize(std::ostream&, const ExpressionPtr &value, size_t nbits);
319  virtual ExpressionPtr emit_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
320  virtual ExpressionPtr emit_signed_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
321  virtual ExpressionPtr emit_unsigned_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
322  virtual ExpressionPtr emit_logical_right_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
323  virtual ExpressionPtr emit_logical_right_shift_ones(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
324  virtual ExpressionPtr emit_arithmetic_right_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
325  virtual ExpressionPtr emit_left_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
326  virtual ExpressionPtr emit_left_shift_ones(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
327  virtual ExpressionPtr emit_lssb(std::ostream&, const ExpressionPtr&);
328  virtual ExpressionPtr emit_mssb(std::ostream&, const ExpressionPtr&);
329  virtual ExpressionPtr emit_extract(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &from, size_t result_nbits);
330  virtual ExpressionPtr emit_invert(std::ostream&, const ExpressionPtr &value);
331  virtual ExpressionPtr emit_left_associative(std::ostream&, const std::string &llvm_op, const TreeNodes &operands);
332  virtual ExpressionPtr emit_concat(std::ostream&, TreeNodes operands);
333  virtual ExpressionPtr emit_signed_divide(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
334  virtual ExpressionPtr emit_unsigned_divide(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
335  virtual ExpressionPtr emit_signed_modulo(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
336  virtual ExpressionPtr emit_unsigned_modulo(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
337  virtual ExpressionPtr emit_signed_multiply(std::ostream&, const TreeNodes &operands);
338  virtual ExpressionPtr emit_unsigned_multiply(std::ostream&, const TreeNodes &operands);
339  virtual ExpressionPtr emit_rotate_left(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
340  virtual ExpressionPtr emit_rotate_right(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
341  virtual ExpressionPtr emit_compare(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
342  virtual ExpressionPtr emit_ite(std::ostream&, const ExpressionPtr &cond, const ExpressionPtr&, const ExpressionPtr&);
343  virtual ExpressionPtr emit_memory_read(std::ostream&, const ExpressionPtr &address, size_t nbits);
344  virtual ExpressionPtr emit_global_read(std::ostream&, const std::string &varname, size_t nbits);
345  virtual void emit_memory_write(std::ostream&, const ExpressionPtr &address, const ExpressionPtr &value);
347 };
348 
350 typedef boost::shared_ptr<class Transcoder> TranscoderPtr;
351 
353 class Transcoder {
354 private:
355  RiscOperatorsPtr operators;
356  BaseSemantics::DispatcherPtr dispatcher;
357  bool emit_funcfrags; // emit BBs that aren't part of the CFG?
358  bool quiet_errors; // catch exceptions and emit an LLVM comment instead?
359 
360 protected:
361  explicit Transcoder(const BaseSemantics::DispatcherPtr &dispatcher)
362  : dispatcher(dispatcher), emit_funcfrags(false), quiet_errors(false) {
363  operators = RiscOperators::promote(dispatcher->get_operators());
364  }
365 
366 public:
369  static TranscoderPtr instance(const BaseSemantics::DispatcherPtr &dispatcher) {
370  return TranscoderPtr(new Transcoder(dispatcher));
371  }
372 
374  static TranscoderPtr instanceX86() {
377  RiscOperatorsPtr ops = RiscOperators::instance(regdict, solver);
379  return instance(dispatcher);
380  }
381 
390  int llvmVersion() const;
391  void llvmVersion(int version);
399  bool emitFunctionFragements() const { return emit_funcfrags; }
400  void emitFunctionFragements(bool b) { emit_funcfrags = b; }
407  bool quietErrors() const { return quiet_errors; }
408  void quietErrors(bool b) { quiet_errors = b; }
413  void emitFilePrologue(std::ostream&);
414  std::string emitFilePrologue();
419  void emitFunctionDeclarations(SgNode *ast, std::ostream&);
420  std::string emitFunctionDeclarations(SgNode *ast);
426  void transcodeInstruction(SgAsmInstruction*, std::ostream&);
433  size_t transcodeBasicBlock(SgAsmBlock*, std::ostream&);
434  std::string transcodeBasicBlock(SgAsmBlock*);
440  size_t transcodeFunction(SgAsmFunction*, std::ostream&);
441  std::string transcodeFunction(SgAsmFunction*);
447  void transcodeInterpretation(SgAsmInterpretation*, std::ostream&);
450 };
451 
452 } // namespace
453 } // namespace
454 } // namespace
455 } // namespace
456 
457 #endif
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual RegisterDescriptor get_insn_pointer_register()
Return the descriptor for the instruction pointer register.
size_t transcodeBasicBlock(SgAsmBlock *, std::ostream &)
Transcode a basic block of machine instructions to LLVM instructions.
static RegisterStateGenericPtr instance(const SValuePtr &protoval, const RegisterDictionary *regdict)
Instantiate a new register state.
static TranscoderPtr instance(const BaseSemantics::DispatcherPtr &dispatcher)
Factory method to create a new transcoder for an arbitrary machine architecture.
virtual void make_current()
Mark the current state as having been emitted.
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 ExpressionPtr emit_unsigned_modulo(std::ostream &, const ExpressionPtr &numerator, const ExpressionPtr &denominator)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_invert(std::ostream &, const ExpressionPtr &value)
Emit an operation as LLVM instructions.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to Llvm operators.
Leaf node of an expression tree for instruction semantics.
Defines RISC operators for the SymbolicSemantics domain.
virtual const TreeNodes & get_memory_writes()
Return the list of memory writes that have occured since the last call to make_current().
boost::shared_ptr< class RegisterStateGeneric > RegisterStateGenericPtr
Shared-ownership pointer to generic register states.
virtual const RegisterDescriptors & get_important_registers()
Return the list of registers that needs to be emitted to LLVM.
virtual std::string llvm_integer_type(size_t nbits)
Obtain the LLVM type name for an integer.
Instruction basic block.
Interior node of an expression tree for instruction semantics.
Base class for machine instructions.
std::string prefix() const
Return indentation string.
boost::shared_ptr< class Transcoder > TranscoderPtr
Shared-ownership pointer to an LLVM transcoder.
virtual ExpressionPtr emit_sign_extend(std::ostream &, const ExpressionPtr &value, size_t nbits)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_global_read(std::ostream &, const std::string &varname, size_t nbits)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_unsigned_binary(std::ostream &, const std::string &llvm_op, const ExpressionPtr &, const ExpressionPtr &)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_unsigned_resize(std::ostream &, const ExpressionPtr &value, size_t nbits)
Emit an operation as LLVM instructions.
virtual void emit_register_definitions(std::ostream &, const RegisterDescriptors &)
Output LLVM global register definitions for the specified registers.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Writes a value to memory.
bool emitFunctionFragements() const
Property to determine whether function fragments should be emitted.
virtual ExpressionPtr emit_signed_multiply(std::ostream &, const TreeNodes &operands)
Emit an operation as LLVM instructions.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified prototypical values.
Represents a synthesized function.
void transcodeInstruction(SgAsmInstruction *, std::ostream &)
Translate a single machine instruction to LLVM instructions.
virtual RegisterDescriptors get_modified_registers()
Return the list of important registers that have been modified since the last call to make_current()...
size_t transcodeFunction(SgAsmFunction *, std::ostream &)
Transcode an entire function to LLVM instructions.
virtual void add_rewrite(const ExpressionPtr &from, const LeafPtr &to)
Register a rewrite.
virtual void emit_register_declarations(std::ostream &, const RegisterDescriptors &)
Output LLVM global register declarations for the specified registers.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
Main namespace for the ROSE library.
virtual std::string next_label()
Obtain the name for an LLVM label, excluding the "%" sigil.
Describes (part of) a physical CPU register.
virtual ExpressionPtr emit_logical_right_shift(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &amount)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_rotate_left(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &amount)
Emit an operation as LLVM instructions.
static MemoryListStatePtr instance(const BaseSemantics::MemoryCellPtr &protocell)
Instantiates a new memory state having specified prototypical cells and value.
virtual ExpressionPtr emit_truncate(std::ostream &, const ExpressionPtr &value, size_t nbits)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_binary(std::ostream &, const std::string &llvm_op, const ExpressionPtr &, const ExpressionPtr &)
Emit an operation as LLVM instructions.
Reference-counting smart pointer.
Definition: SharedPointer.h:34
virtual ExpressionPtr emit_unsigned_divide(std::ostream &, const ExpressionPtr &numerator, const ExpressionPtr &denominator)
Emit an operation as LLVM instructions.
virtual std::string llvm_term(const ExpressionPtr &)
Convert a ROSE variable or integer to an LLVM term.
virtual LeafPtr emit_assignment(std::ostream &, const ExpressionPtr &rhs)
Emit an assignment and add a rewrite rule.
Sawyer::SharedPointer< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
boost::shared_ptr< class RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
virtual std::string add_variable(const LeafPtr &)
Register an LLVM variable.
boost::shared_ptr< class State > StatePtr
Shared-ownership pointer to a semantic state.
void quietErrors(bool b)
Property to control what happens when a translation exception occurs.
virtual ExpressionPtr emit_signed_divide(std::ostream &, const ExpressionPtr &numerator, const ExpressionPtr &denominator)
Emit an operation as LLVM instructions.
virtual LeafPtr next_temporary(size_t nbits)
Create a temporary variable.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to LLVM RISC operations.
boost::shared_ptr< class Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
virtual std::string function_label(SgAsmFunction *)
Obtain a label for a function.
virtual void emit_memory_writes(std::ostream &)
Output changed memory state.
static Ptr instance(const std::string &name)
Allocate a new solver by name.
void emitFunctionFragements(bool b)
Property to determine whether function fragments should be emitted.
virtual ExpressionPtr emit_rotate_right(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &amount)
Emit an operation as LLVM instructions.
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:8672
virtual ExpressionPtr emit_extract(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &from, size_t result_nbits)
Emit an operation as LLVM instructions.
static SValuePtr instance()
Instantiate a new prototypical value.
virtual RegisterDescriptors get_stored_registers()
Return the list of important registers that are stored.
virtual ExpressionPtr emit_left_shift_ones(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &amount)
Emit an operation as LLVM instructions.
virtual LeafPtr emit_expression(std::ostream &, const SValuePtr &)
Emit LLVM statements for an expression.
virtual void emit_changed_state(std::ostream &)
Output LLVM to bring the LLVM state up to date with respect to the ROSE state.
virtual void emit_next_eip(std::ostream &, SgAsmInstruction *latest_insn)
Output an LLVM branch instruction.
Defines registers available for a particular architecture.
Definition: Registers.h:32
virtual ExpressionPtr emit_logical_right_shift_ones(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &amount)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_signed_binary(std::ostream &, const std::string &llvm_op, const ExpressionPtr &, const ExpressionPtr &)
Emit an operation as LLVM instructions.
bool quietErrors() const
Property to control what happens when a translation exception occurs.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual ExpressionPtr emit_left_associative(std::ostream &, const std::string &llvm_op, const TreeNodes &operands)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_arithmetic_right_shift(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &amount)
Emit an operation as LLVM instructions.
virtual void emit_memory_write(std::ostream &, const ExpressionPtr &address, const ExpressionPtr &value)
Emit an operation as LLVM instructions.
static const RegisterDictionary * dictionary_pentium4()
Intel Pentium 4 registers.
static StatePtr instance(const RegisterStatePtr &registers, const MemoryStatePtr &memory)
Instantiate a new state object with specified register and memory states.
Type of values manipulated by the SymbolicSemantics domain.
virtual std::string llvm_lvalue(const LeafPtr &)
Convert a ROSE variable to an LLVM lvalue.
void emitFunctionDeclarations(SgNode *ast, std::ostream &)
Emit function declarations.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
virtual SValuePtr get_instruction_pointer()
Return the value of the instruction pointer.
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 ...
virtual ExpressionPtr emit_memory_read(std::ostream &, const ExpressionPtr &address, size_t nbits)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_ite(std::ostream &, const ExpressionPtr &cond, const ExpressionPtr &, const ExpressionPtr &)
Emit an operation as LLVM instructions.
static DispatcherX86Ptr instance()
Construct a prototypical dispatcher.
void transcodeInterpretation(SgAsmInterpretation *, std::ostream &)
Transcode an entire binary interpretation.
virtual ExpressionPtr emit_mssb(std::ostream &, const ExpressionPtr &)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_compare(std::ostream &, const std::string &llvm_op, const ExpressionPtr &, const ExpressionPtr &)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_left_shift(std::ostream &, const ExpressionPtr &value, const ExpressionPtr &amount)
Emit an operation as LLVM instructions.
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual ExpressionPtr emit_unsigned_multiply(std::ostream &, const TreeNodes &operands)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_concat(std::ostream &, TreeNodes operands)
Emit an operation as LLVM instructions.
virtual ExpressionPtr emit_signed_modulo(std::ostream &, const ExpressionPtr &numerator, const ExpressionPtr &denominator)
Emit an operation as LLVM instructions.
virtual const std::string & name() const
Property: Name used for debugging.
virtual void emit_prerequisites(std::ostream &, const RegisterDescriptors &, const RegisterDictionary *)
Output LLVM global variable reads that are needed to define the specified registers and pending memor...
int indent(int nlevels=1)
Increase indentation by nlevels levels.
Represents an interpretation of a binary container.
ROSE_DLL_API GenericSwitchArgs genericSwitchArgs
Global location for parsed generic command-line switches.
virtual ExpressionPtr emit_lssb(std::ostream &, const ExpressionPtr &)
Emit an operation as LLVM instructions.
virtual std::string get_variable(const LeafPtr &)
Returns the LLVM name for a variable, including the sigil.
virtual std::string addr_label(rose_addr_t)
Obtain a label for a virtual address.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object with specified state.
static TranscoderPtr instanceX86()
Factory method to create a new transcoder for 32-bit X86 instructions.
virtual ExpressionPtr emit_zero_extend(std::ostream &, const ExpressionPtr &value, size_t nbits)
Emit an operation as LLVM instructions.