ROSE  0.9.9.139
Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder Class Reference

Description

Translates machine instructions to LLVM.

Definition at line 352 of file LlvmSemantics2.h.

#include <LlvmSemantics2.h>

Public Member Functions

int llvmVersion () const
 Property: LLVM version number. More...
 
void llvmVersion (int version)
 Property: LLVM version number. More...
 
bool emitFunctionFragements () const
 Property to determine whether function fragments should be emitted. More...
 
void emitFunctionFragements (bool b)
 Property to determine whether function fragments should be emitted. More...
 
bool quietErrors () const
 Property to control what happens when a translation exception occurs. More...
 
void quietErrors (bool b)
 Property to control what happens when a translation exception occurs. More...
 
void emitFilePrologue (std::ostream &)
 Emit LLVM file prologue.
 
std::string emitFilePrologue ()
 Emit LLVM file prologue.
 
void emitFunctionDeclarations (SgNode *ast, std::ostream &)
 Emit function declarations. More...
 
std::string emitFunctionDeclarations (SgNode *ast)
 Emit function declarations. More...
 
void transcodeInstruction (SgAsmInstruction *, std::ostream &)
 Translate a single machine instruction to LLVM instructions. More...
 
std::string transcodeInstruction (SgAsmInstruction *)
 Translate a single machine instruction to LLVM instructions. More...
 
size_t transcodeBasicBlock (SgAsmBlock *, std::ostream &)
 Transcode a basic block of machine instructions to LLVM instructions. More...
 
std::string transcodeBasicBlock (SgAsmBlock *)
 Transcode a basic block of machine instructions to LLVM instructions. More...
 
size_t transcodeFunction (SgAsmFunction *, std::ostream &)
 Transcode an entire function to LLVM instructions. More...
 
std::string transcodeFunction (SgAsmFunction *)
 Transcode an entire function to LLVM instructions. More...
 
void transcodeInterpretation (SgAsmInterpretation *, std::ostream &)
 Transcode an entire binary interpretation. More...
 
std::string transcodeInterpretation (SgAsmInterpretation *)
 Transcode an entire binary interpretation. More...
 

Static Public Member Functions

static TranscoderPtr instance (const BaseSemantics::DispatcherPtr &dispatcher)
 Factory method to create a new transcoder for an arbitrary machine architecture. More...
 
static TranscoderPtr instanceX86 ()
 Factory method to create a new transcoder for 32-bit X86 instructions. More...
 

Protected Member Functions

 Transcoder (const BaseSemantics::DispatcherPtr &dispatcher)
 

Member Function Documentation

static TranscoderPtr Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::instance ( const BaseSemantics::DispatcherPtr dispatcher)
inlinestatic

Factory method to create a new transcoder for an arbitrary machine architecture.

The supplied dispatcher must use an LlvmSemantics::RiscOperators or subclass thereof.

Definition at line 368 of file LlvmSemantics2.h.

Referenced by instanceX86().

static TranscoderPtr Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::instanceX86 ( )
inlinestatic
int Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::llvmVersion ( ) const

Property: LLVM version number.

The version number controls the dialect of assembly to be emitted. Since LLVM assembly is used mostly as an internal representation within LLVM, its syntax changes from version to version in ways that are not backward compatible. The version number set here is a*x^2 + b*x + c where a b and c are the LLVM version triplet "a.b.c" and x is 1000. The value zero is reserved to mean that the version number is unknown.

void Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::llvmVersion ( int  version)

Property: LLVM version number.

The version number controls the dialect of assembly to be emitted. Since LLVM assembly is used mostly as an internal representation within LLVM, its syntax changes from version to version in ways that are not backward compatible. The version number set here is a*x^2 + b*x + c where a b and c are the LLVM version triplet "a.b.c" and x is 1000. The value zero is reserved to mean that the version number is unknown.

bool Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::emitFunctionFragements ( ) const
inline

Property to determine whether function fragments should be emitted.

A function fragment is a basic block that belongs to a function but doesn't participate in its control flow graph. These fragments are usually added to ROSE functions when ROSE finds valid instructions but can't figure out how that code is reached. The default is to not emit fragements since their control flow successors might be invalid, resulting in invalid LLVM branches.

Definition at line 398 of file LlvmSemantics2.h.

void Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::emitFunctionFragements ( bool  b)
inline

Property to determine whether function fragments should be emitted.

A function fragment is a basic block that belongs to a function but doesn't participate in its control flow graph. These fragments are usually added to ROSE functions when ROSE finds valid instructions but can't figure out how that code is reached. The default is to not emit fragements since their control flow successors might be invalid, resulting in invalid LLVM branches.

Definition at line 399 of file LlvmSemantics2.h.

bool Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::quietErrors ( ) const
inline

Property to control what happens when a translation exception occurs.

If true, then exceptions from ROSE's instruction semantics are caught and emitted as an LLVM comment starting with ";;ERROR: ". This happens when ROSE has no semantics defined for a particular instruction (such as floating point instructions as of Jan 2014).

Definition at line 406 of file LlvmSemantics2.h.

void Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::quietErrors ( bool  b)
inline

Property to control what happens when a translation exception occurs.

If true, then exceptions from ROSE's instruction semantics are caught and emitted as an LLVM comment starting with ";;ERROR: ". This happens when ROSE has no semantics defined for a particular instruction (such as floating point instructions as of Jan 2014).

Definition at line 407 of file LlvmSemantics2.h.

void Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::emitFunctionDeclarations ( SgNode ast,
std::ostream &   
)

Emit function declarations.

Emits declarations for all functions that appear in the specified AST.

std::string Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::emitFunctionDeclarations ( SgNode ast)

Emit function declarations.

Emits declarations for all functions that appear in the specified AST.

void Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeInstruction ( SgAsmInstruction ,
std::ostream &   
)

Translate a single machine instruction to LLVM instructions.

LLVM instructions are emitted to the specified stream or returned as a string.

std::string Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeInstruction ( SgAsmInstruction )

Translate a single machine instruction to LLVM instructions.

LLVM instructions are emitted to the specified stream or returned as a string.

size_t Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeBasicBlock ( SgAsmBlock ,
std::ostream &   
)

Transcode a basic block of machine instructions to LLVM instructions.

LLVM instructions are emitted to the specified stream or returned as a string. When a string isn't returned, the return value is the number of instructions emitted.

std::string Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeBasicBlock ( SgAsmBlock )

Transcode a basic block of machine instructions to LLVM instructions.

LLVM instructions are emitted to the specified stream or returned as a string. When a string isn't returned, the return value is the number of instructions emitted.

size_t Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeFunction ( SgAsmFunction ,
std::ostream &   
)

Transcode an entire function to LLVM instructions.

LLVM instructions are emitted to the specified stream or returned as a string. When a string isn't returned, the return value is the number of basic blocks emitted.

std::string Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeFunction ( SgAsmFunction )

Transcode an entire function to LLVM instructions.

LLVM instructions are emitted to the specified stream or returned as a string. When a string isn't returned, the return value is the number of basic blocks emitted.

void Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeInterpretation ( SgAsmInterpretation ,
std::ostream &   
)

Transcode an entire binary interpretation.

Unlike the lower-level transcoder methods, this one also emits register and function declarations.

std::string Rose::BinaryAnalysis::InstructionSemantics2::LlvmSemantics::Transcoder::transcodeInterpretation ( SgAsmInterpretation )

Transcode an entire binary interpretation.

Unlike the lower-level transcoder methods, this one also emits register and function declarations.


The documentation for this class was generated from the following file: