ROSE  0.9.9.139
LlvmSemantics2.h
1 #ifndef Rose_LlvmSemantics2_H
2 #define Rose_LlvmSemantics2_H
3 
4 #include "SymbolicSemantics2.h"
5 #include "DispatcherX86.h"
6 
7 namespace Rose {
8 namespace BinaryAnalysis {
9 namespace InstructionSemantics2 {
10 
12 namespace LlvmSemantics {
13 
14 typedef std::vector<RegisterDescriptor> RegisterDescriptors;
15 
21 typedef SymbolicExpr::Nodes TreeNodes;
22 
25 
26 typedef BaseSemantics::RegisterStateGenericPtr RegisterStatePtr;
28 
29 typedef SymbolicSemantics::MemoryStatePtr MemoryStatePtr;
31 
32 typedef BaseSemantics::StatePtr StatePtr;
34 
36 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
37 
39 private:
42 
43  Rewrites rewrites; // maps expressions to LLVM variables
44  Variables variables; // ROSE-to-LLVM variable map; name includes sigil
45  RegisterStatePtr prev_regstate; // most recently emitted register state
46  RegisterDescriptors important_registers; // registers that should be emitted to LLVM
47  TreeNodes mem_writes; // memory write operations (OP_WRITE expressions)
48  int indent_level; // level of indentation (might be negative, but prefix() clips to zero
49  std::string indent_string; // white space per indentation level
50  int llvmVersion_; // 1000000*major + 1000*minor + patch. e.g., 3005000 = llvm-3.5.0
51 
53  // Real constructors
54 protected:
56  : SymbolicSemantics::RiscOperators(protoval, solver), indent_level(0), indent_string(" "), llvmVersion_(0) {
57  name("Llvm");
58  }
59 
60  explicit RiscOperators(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL)
61  : SymbolicSemantics::RiscOperators(state, solver), indent_level(0), indent_string(" "), llvmVersion_(0) {
62  name("Llvm");
63  }
64 
66  // Static allocating constructors
67 public:
70  static RiscOperatorsPtr instance(const RegisterDictionary *regdict, SmtSolver *solver=NULL) {
72  BaseSemantics::RegisterStatePtr registers = RegisterState::instance(protoval, regdict);
73  BaseSemantics::MemoryStatePtr memory = MemoryState::instance(protoval, protoval);
74  BaseSemantics::StatePtr state = State::instance(registers, memory);
75  return RiscOperatorsPtr(new RiscOperators(state, solver));
76  }
77 
79  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL) {
80  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
81  }
82 
84  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL) {
85  return RiscOperatorsPtr(new RiscOperators(state, solver));
86  }
87 
89  // Virtual constructors
90 public:
92  SmtSolver *solver=NULL) const ROSE_OVERRIDE {
93  return instance(protoval, solver);
94  }
95 
97  SmtSolver *solver=NULL) const ROSE_OVERRIDE {
98  return instance(state, solver);
99  }
100 
102  // Dynamic pointer cases
103 public:
106  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
107  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
108  assert(retval!=NULL);
109  return retval;
110  }
111 
113  // Properties
114 public:
122  int llvmVersion() const { return llvmVersion_; }
123  void llvmVersion(int v) { llvmVersion_ = v; }
126  // Methods we override from the super class
128 public:
130  const BaseSemantics::SValuePtr &dflt,
131  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
132  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
133  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
134 
136  // Methods to control indentation of LLVM output
137 public:
141  int indent(int nlevels=1) { indent_level += nlevels; return nlevels; }
142 
144  std::string prefix() const;
145 
147  struct Indent {
148  RiscOperators *ops;
149  RiscOperatorsPtr ops_ptr;
150  int nlevels;
151  explicit Indent(const RiscOperatorsPtr &ops_ptr, int nlevels=1): ops_ptr(ops_ptr), nlevels(nlevels) {
152  ops = ops_ptr.get();
153  ops->indent(nlevels);
154  }
155  explicit Indent(RiscOperators *ops, int nlevels=1): ops(ops), nlevels(nlevels) {
156  ops->indent(nlevels);
157  }
158  ~Indent() {
159  ops->indent(-nlevels);
160  }
161  };
162 
164  // New methods to control/query the machine state
165 public:
167  virtual void reset();
168 
171  virtual const RegisterDescriptors& get_important_registers();
172 
175  virtual RegisterDescriptors get_stored_registers();
176 
178  virtual RegisterDescriptors get_modified_registers();
179 
182 
184  virtual SValuePtr get_instruction_pointer();
185 
189  virtual const TreeNodes& get_memory_writes() { return mem_writes; }
190 
192  virtual void make_current();
193 
195  virtual void add_rewrite(const ExpressionPtr &from, const LeafPtr &to);
196 
199  virtual std::string add_variable(const LeafPtr&);
200 
203  virtual std::string get_variable(const LeafPtr&);
204 
206  // New methods to emit the machine state
207 public:
209  virtual void emit_register_declarations(std::ostream&, const RegisterDescriptors&);
210 
212  virtual void emit_register_definitions(std::ostream&, const RegisterDescriptors&);
213 
240  virtual void emit_prerequisites(std::ostream&, const RegisterDescriptors&, const RegisterDictionary*);
241 
244  virtual void emit_next_eip(std::ostream&, SgAsmInstruction *latest_insn);
245 
247  virtual void emit_memory_writes(std::ostream&);
248 
250  virtual void emit_changed_state(std::ostream&);
251 
253  // New methods to return snippets of LLVM as strings or expressions
254 public:
256  virtual std::string llvm_integer_type(size_t nbits);
257 
259  virtual std::string llvm_term(const ExpressionPtr&);
260 
263  virtual std::string llvm_lvalue(const LeafPtr&);
264 
266  virtual LeafPtr next_temporary(size_t nbits);
267 
269  virtual std::string next_label();
270 
272  virtual std::string addr_label(rose_addr_t);
273 
275  virtual std::string function_label(SgAsmFunction*);
276 
278  // New methods to emit LLVM code for an expression.
279 public:
297  virtual LeafPtr emit_expression(std::ostream&, const SValuePtr&);
298  virtual LeafPtr emit_expression(std::ostream&, const ExpressionPtr&);
299  virtual LeafPtr emit_expression(std::ostream&, const LeafPtr&);
302 protected:
306  virtual LeafPtr emit_assignment(std::ostream&, const ExpressionPtr &rhs);
307 
314  virtual ExpressionPtr emit_zero_extend(std::ostream&, const ExpressionPtr &value, size_t nbits);
315  virtual ExpressionPtr emit_sign_extend(std::ostream&, const ExpressionPtr &value, size_t nbits);
316  virtual ExpressionPtr emit_truncate(std::ostream&, const ExpressionPtr &value, size_t nbits);
317  virtual ExpressionPtr emit_unsigned_resize(std::ostream&, const ExpressionPtr &value, size_t nbits);
318  virtual ExpressionPtr emit_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
319  virtual ExpressionPtr emit_signed_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
320  virtual ExpressionPtr emit_unsigned_binary(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
321  virtual ExpressionPtr emit_logical_right_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
322  virtual ExpressionPtr emit_logical_right_shift_ones(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
323  virtual ExpressionPtr emit_arithmetic_right_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
324  virtual ExpressionPtr emit_left_shift(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
325  virtual ExpressionPtr emit_left_shift_ones(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
326  virtual ExpressionPtr emit_lssb(std::ostream&, const ExpressionPtr&);
327  virtual ExpressionPtr emit_mssb(std::ostream&, const ExpressionPtr&);
328  virtual ExpressionPtr emit_extract(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &from, size_t result_nbits);
329  virtual ExpressionPtr emit_invert(std::ostream&, const ExpressionPtr &value);
330  virtual ExpressionPtr emit_left_associative(std::ostream&, const std::string &llvm_op, const TreeNodes &operands);
331  virtual ExpressionPtr emit_concat(std::ostream&, TreeNodes operands);
332  virtual ExpressionPtr emit_signed_divide(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
333  virtual ExpressionPtr emit_unsigned_divide(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
334  virtual ExpressionPtr emit_signed_modulo(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
335  virtual ExpressionPtr emit_unsigned_modulo(std::ostream&, const ExpressionPtr &numerator, const ExpressionPtr &denominator);
336  virtual ExpressionPtr emit_signed_multiply(std::ostream&, const TreeNodes &operands);
337  virtual ExpressionPtr emit_unsigned_multiply(std::ostream&, const TreeNodes &operands);
338  virtual ExpressionPtr emit_rotate_left(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
339  virtual ExpressionPtr emit_rotate_right(std::ostream&, const ExpressionPtr &value, const ExpressionPtr &amount);
340  virtual ExpressionPtr emit_compare(std::ostream&, const std::string &llvm_op, const ExpressionPtr&, const ExpressionPtr&);
341  virtual ExpressionPtr emit_ite(std::ostream&, const ExpressionPtr &cond, const ExpressionPtr&, const ExpressionPtr&);
342  virtual ExpressionPtr emit_memory_read(std::ostream&, const ExpressionPtr &address, size_t nbits);
343  virtual ExpressionPtr emit_global_read(std::ostream&, const std::string &varname, size_t nbits);
344  virtual void emit_memory_write(std::ostream&, const ExpressionPtr &address, const ExpressionPtr &value);
346 };
347 
349 typedef boost::shared_ptr<class Transcoder> TranscoderPtr;
350 
352 class Transcoder {
353 private:
354  RiscOperatorsPtr operators;
355  BaseSemantics::DispatcherPtr dispatcher;
356  bool emit_funcfrags; // emit BBs that aren't part of the CFG?
357  bool quiet_errors; // catch exceptions and emit an LLVM comment instead?
358 
359 protected:
360  explicit Transcoder(const BaseSemantics::DispatcherPtr &dispatcher)
361  : dispatcher(dispatcher), emit_funcfrags(false), quiet_errors(false) {
362  operators = RiscOperators::promote(dispatcher->get_operators());
363  }
364 
365 public:
368  static TranscoderPtr instance(const BaseSemantics::DispatcherPtr &dispatcher) {
369  return TranscoderPtr(new Transcoder(dispatcher));
370  }
371 
373  static TranscoderPtr instanceX86() {
375  SmtSolver *solver = NULL;
376  RiscOperatorsPtr ops = RiscOperators::instance(regdict, solver);
378  return instance(dispatcher);
379  }
380 
389  int llvmVersion() const;
390  void llvmVersion(int version);
398  bool emitFunctionFragements() const { return emit_funcfrags; }
399  void emitFunctionFragements(bool b) { emit_funcfrags = b; }
406  bool quietErrors() const { return quiet_errors; }
407  void quietErrors(bool b) { quiet_errors = b; }
412  void emitFilePrologue(std::ostream&);
413  std::string emitFilePrologue();
418  void emitFunctionDeclarations(SgNode *ast, std::ostream&);
419  std::string emitFunctionDeclarations(SgNode *ast);
425  void transcodeInstruction(SgAsmInstruction*, std::ostream&);
432  size_t transcodeBasicBlock(SgAsmBlock*, std::ostream&);
433  std::string transcodeBasicBlock(SgAsmBlock*);
439  size_t transcodeFunction(SgAsmFunction*, std::ostream&);
440  std::string transcodeFunction(SgAsmFunction*);
446  void transcodeInterpretation(SgAsmInterpretation*, std::ostream&);
449 };
450 
451 } // namespace
452 } // namespace
453 } // namespace
454 } // namespace
455 
456 #endif
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 SmtSolver * solver() const
Property: Satisfiability module theory (SMT) solver.
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.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL) const ROSE_OVERRIDE
Virtual allocating constructor.
static RiscOperatorsPtr instance(const RegisterDictionary *regdict, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object and configures it to use semantic values and states that are ...
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.
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.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object with specified state.
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
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, SmtSolver *solver=NULL)
Instantiates a new RiscOperators object with specified prototypical values.
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< 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.
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:8322
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 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.
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.
Interface to Satisfiability Modulo Theory (SMT) solvers.
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.
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 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.