ROSE  0.11.31.0
LlvmSemantics2.h
1 #ifndef Rose_LlvmSemantics2_H
2 #define Rose_LlvmSemantics2_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include "SymbolicSemantics2.h"
7 #include "CommandLine.h"
8 #include "DispatcherX86.h"
9 
10 namespace Rose {
11 namespace BinaryAnalysis {
12 namespace InstructionSemantics2 {
13 
15 namespace LlvmSemantics {
16 
17 typedef std::vector<RegisterDescriptor> RegisterDescriptors;
18 
24 typedef SymbolicExpr::Nodes TreeNodes;
25 
28 
29 typedef BaseSemantics::RegisterStateGenericPtr RegisterStatePtr;
31 
32 typedef SymbolicSemantics::MemoryStatePtr MemoryStatePtr;
34 
35 typedef BaseSemantics::StatePtr StatePtr;
36 typedef BaseSemantics::State State;
37 
39 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
40 
42 private:
45 
46  Rewrites rewrites; // maps expressions to LLVM variables
47  Variables variables; // ROSE-to-LLVM variable map; name includes sigil
48  RegisterStatePtr prev_regstate; // most recently emitted register state
49  RegisterDescriptors important_registers; // registers that should be emitted to LLVM
50  TreeNodes mem_writes; // memory write operations (OP_WRITE expressions)
51  int indent_level; // level of indentation (might be negative, but prefix() clips to zero
52  std::string indent_string; // white space per indentation level
53  int llvmVersion_; // 1000000*major + 1000*minor + patch. e.g., 3005000 = llvm-3.5.0
54 
56  // Real constructors
57 protected:
59  : SymbolicSemantics::RiscOperators(protoval, solver), indent_level(0), indent_string(" "), llvmVersion_(0) {
60  name("Llvm");
61  }
62 
63  explicit RiscOperators(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr())
64  : SymbolicSemantics::RiscOperators(state, solver), indent_level(0), indent_string(" "), llvmVersion_(0) {
65  name("Llvm");
66  }
67 
69  // Static allocating constructors
70 public:
73  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, const SmtSolverPtr &solver = SmtSolverPtr()) {
75  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
76  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
77  BaseSemantics::StatePtr state = State::instance(registers, memory);
78  return RiscOperatorsPtr(new RiscOperators(state, solver));
79  }
80 
82  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
83  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
84  }
85 
87  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
88  return RiscOperatorsPtr(new RiscOperators(state, solver));
89  }
90 
92  // Virtual constructors
93 public:
95  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
96  return instance(protoval, solver);
97  }
98 
100  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
101  return instance(state, solver);
102  }
103 
105  // Dynamic pointer cases
106 public:
109  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
110  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
111  assert(retval!=NULL);
112  return retval;
113  }
114 
116  // Properties
117 public:
125  int llvmVersion() const { return llvmVersion_; }
126  void llvmVersion(int v) { llvmVersion_ = v; }
129  // Methods we override from the super class
131 public:
133  const BaseSemantics::SValuePtr &dflt,
134  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
135  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
136  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
137 
139  // Methods to control indentation of LLVM output
140 public:
144  int indent(int nlevels=1) { indent_level += nlevels; return nlevels; }
145 
147  std::string prefix() const;
148 
150  struct Indent {
151  RiscOperators *ops;
152  RiscOperatorsPtr ops_ptr;
153  int nlevels;
154  explicit Indent(const RiscOperatorsPtr &ops_ptr, int nlevels=1): ops_ptr(ops_ptr), nlevels(nlevels) {
155  ops = ops_ptr.get();
156  ops->indent(nlevels);
157  }
158  explicit Indent(RiscOperators *ops, int nlevels=1): ops(ops), nlevels(nlevels) {
159  ops->indent(nlevels);
160  }
161  ~Indent() {
162  ops->indent(-nlevels);
163  }
164  };
165 
167  // New methods to control/query the machine state
168 public:
170  virtual void reset();
171 
174  virtual const RegisterDescriptors& get_important_registers();
175 
178  virtual RegisterDescriptors get_stored_registers();
179 
181  virtual RegisterDescriptors get_modified_registers();
182 
185 
187  virtual SValuePtr get_instruction_pointer();
188 
192  virtual const TreeNodes& get_memory_writes() { return mem_writes; }
193 
195  virtual void make_current();
196 
198  virtual void add_rewrite(const ExpressionPtr &from, const LeafPtr &to);
199 
202  virtual std::string add_variable(const LeafPtr&);
203 
206  virtual std::string get_variable(const LeafPtr&);
207 
209  // New methods to emit the machine state
210 public:
212  virtual void emit_register_declarations(std::ostream&, const RegisterDescriptors&);
213 
215  virtual void emit_register_definitions(std::ostream&, const RegisterDescriptors&);
216 
243  virtual void emit_prerequisites(std::ostream&, const RegisterDescriptors&, const RegisterDictionary*);
244 
247  virtual void emit_next_eip(std::ostream&, SgAsmInstruction *latest_insn);
248 
250  virtual void emit_memory_writes(std::ostream&);
251 
253  virtual void emit_changed_state(std::ostream&);
254 
256  // New methods to return snippets of LLVM as strings or expressions
257 public:
259  virtual std::string llvm_integer_type(size_t nbits);
260 
262  virtual std::string llvm_term(const ExpressionPtr&);
263 
266  virtual std::string llvm_lvalue(const LeafPtr&);
267 
269  virtual LeafPtr next_temporary(size_t nbits);
270 
272  virtual std::string next_label();
273 
275  virtual std::string addr_label(rose_addr_t);
276 
278  virtual std::string function_label(SgAsmFunction*);
279 
281  // New methods to emit LLVM code for an expression.
282 public:
300  virtual LeafPtr emit_expression(std::ostream&, const SValuePtr&);
301  virtual LeafPtr emit_expression(std::ostream&, const ExpressionPtr&);
302  virtual LeafPtr emit_expression(std::ostream&, const LeafPtr&);
305 protected:
309  virtual LeafPtr emit_assignment(std::ostream&, const ExpressionPtr &rhs);
310 
317  virtual ExpressionPtr emit_zero_extend(std::ostream&, const ExpressionPtr &value, size_t nbits);
318  virtual ExpressionPtr emit_sign_extend(std::ostream&, const ExpressionPtr &value, size_t nbits);
319  virtual ExpressionPtr emit_truncate(std::ostream&, const ExpressionPtr &value, size_t nbits);
320  virtual ExpressionPtr emit_unsigned_resize(std::ostream&, const ExpressionPtr &value, size_t nbits);
321  virtual ExpressionPtr emit_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
322  virtual ExpressionPtr emit_signed_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
323  virtual ExpressionPtr emit_unsigned_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
324  virtual ExpressionPtr emit_logical_right_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
325  virtual ExpressionPtr emit_logical_right_shift_ones(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
326  virtual ExpressionPtr emit_arithmetic_right_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
327  virtual ExpressionPtr emit_left_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
328  virtual ExpressionPtr emit_left_shift_ones(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
329  virtual ExpressionPtr emit_lssb(std::ostream&, const ExpressionPtr&);
330  virtual ExpressionPtr emit_mssb(std::ostream&, const ExpressionPtr&);
331  virtual ExpressionPtr emit_extract(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &from, size_t result_nbits);
332  virtual ExpressionPtr emit_invert(std::ostream&, const ExpressionPtr &value);
333  virtual ExpressionPtr emit_left_associative(std::ostream&, const std::string &llvm_op, const TreeNodes &operands);
334  virtual ExpressionPtr emit_concat(std::ostream&, TreeNodes operands);
335  virtual ExpressionPtr emit_signed_divide(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
336  virtual ExpressionPtr emit_unsigned_divide(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
337  virtual ExpressionPtr emit_signed_modulo(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
338  virtual ExpressionPtr emit_unsigned_modulo(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
339  virtual ExpressionPtr emit_signed_multiply(std::ostream&, const TreeNodes &operands);
340  virtual ExpressionPtr emit_unsigned_multiply(std::ostream&, const TreeNodes &operands);
341  virtual ExpressionPtr emit_rotate_left(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
342  virtual ExpressionPtr emit_rotate_right(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
343  virtual ExpressionPtr emit_compare(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
344  virtual ExpressionPtr emit_ite(std::ostream&, const ExpressionPtr &cond, const ExpressionPtr&, const ExpressionPtr&);
345  virtual ExpressionPtr emit_memory_read(std::ostream&, const ExpressionPtr &address, size_t nbits);
346  virtual ExpressionPtr emit_global_read(std::ostream&, const std::string &varname, size_t nbits);
347  virtual void emit_memory_write(std::ostream&, const ExpressionPtr &address, const ExpressionPtr &value);
349 };
350 
352 typedef boost::shared_ptr<class Transcoder> TranscoderPtr;
353 
355 class Transcoder {
356 private:
357  RiscOperatorsPtr operators;
358  BaseSemantics::DispatcherPtr dispatcher;
359  bool emit_funcfrags; // emit BBs that aren't part of the CFG?
360  bool quiet_errors; // catch exceptions and emit an LLVM comment instead?
361 
362 protected:
363  explicit Transcoder(const BaseSemantics::DispatcherPtr &dispatcher)
364  : dispatcher(dispatcher), emit_funcfrags(false), quiet_errors(false) {
365  operators = RiscOperators::promote(dispatcher->operators());
366  }
367 
368 public:
371  static TranscoderPtr instance(const BaseSemantics::DispatcherPtr &dispatcher) {
372  return TranscoderPtr(new Transcoder(dispatcher));
373  }
374 
376  static TranscoderPtr instanceX86() {
379  RiscOperatorsPtr ops = RiscOperators::instance(regdict, solver);
381  return instance(dispatcher);
382  }
383 
392  int llvmVersion() const;
393  void llvmVersion(int version);
401  bool emitFunctionFragements() const { return emit_funcfrags; }
402  void emitFunctionFragements(bool b) { emit_funcfrags = b; }
409  bool quietErrors() const { return quiet_errors; }
410  void quietErrors(bool b) { quiet_errors = b; }
415  void emitFilePrologue(std::ostream&);
416  std::string emitFilePrologue();
421  void emitFunctionDeclarations(SgNode *ast, std::ostream&);
422  std::string emitFunctionDeclarations(SgNode *ast);
428  void transcodeInstruction(SgAsmInstruction*, std::ostream&);
435  size_t transcodeBasicBlock(SgAsmBlock*, std::ostream&);
436  std::string transcodeBasicBlock(SgAsmBlock*);
442  size_t transcodeFunction(SgAsmFunction*, std::ostream&);
443  std::string transcodeFunction(SgAsmFunction*);
449  void transcodeInterpretation(SgAsmInterpretation*, std::ostream&);
452 };
453 
454 } // namespace
455 } // namespace
456 } // namespace
457 } // namespace
458 
459 #endif
460 #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.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
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.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
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.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
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.
static const RegisterDictionary * dictionary_pentium4()
Intel Pentium 4 registers.
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.
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 intrusive smart pointer.
Definition: SharedPointer.h:68
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.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
virtual std::string add_variable(const LeafPtr &)
Register an LLVM variable.
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.
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.
Describes (part of) a physical CPU register.
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.
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:9451
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.
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.
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.
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.
Defines registers available for a particular architecture.
Definition: Registers.h:38
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.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
std::shared_ptr< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
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.