fcml
1.2.2
|
It's a stateful assembler which can be used to assemble instructions one by one on the fly. More...
#include <fcml_stateful_assembler.hpp>
Classes | |
class | SAFlush |
Used only to indicate the need of the flush operation. More... | |
Public Member Functions | |
StatefulAssembler (Assembler &assembler, AssemblerContext &context, bool enableParser=false) | |
Creates a stateful assembler for the given assembler and assembler context. More... | |
virtual | ~StatefulAssembler () |
Destructor. More... | |
StatefulAssembler & | operator<< (const IB &ib) |
Adds instruction builder to the stateful assembler. More... | |
StatefulAssembler & | add (const IB &ib) |
Adds instruction builder to the stateful assembler. More... | |
StatefulAssembler & | operator<< (const fcml_cstring &mnemonic) |
Creates an instruction builder for the given mnemonic. More... | |
StatefulAssembler & | inst (const fcml_cstring &mnemonic) |
Creates an instruction builder for the given mnemonic. More... | |
StatefulAssembler & | operator<< (const Register ®) |
Adds the new register operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | operator<< (const Integer &imm) |
Adds the new immediate operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | operator<< (const Address &address) |
Adds the new address operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | operator<< (const FarPointer &pointer) |
Adds the new far pointer operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | operator<< (const Operand &operand) |
Adds an operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | op (const Operand &operand) |
Adds an operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | op (const Register ®) |
Adds the new register operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | op (const Integer &imm) |
Adds the new immediate operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | op (const Address &address) |
Adds the new address operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | op (const FarPointer &pointer) |
Adds the new far pointer operand to the instruction builder associated with the buffer. More... | |
StatefulAssembler & | operator<< (const SAFlush &indic) |
Flushes the instruction builder. More... | |
StatefulAssembler & | operator<< (const Instruction &instruction) |
Assembles an instruction in the given instruction builder. More... | |
StatefulAssembler & | operator<< (const InstructionPrefix &prefix) |
Adds a prefix to the instruction being built. More... | |
StatefulAssembler & | operator<< (const InstructionHint &hint) |
Adds an instruction level hint to the instruction being built. More... | |
StatefulAssembler & | operator<< (const OperandHint &hint) |
Adds an operand level hint to the instruction being built. More... | |
StatefulAssembler & | set (const InstructionPrefix &prefix) |
Adds a prefix to the instruction being built. More... | |
StatefulAssembler & | set (const InstructionHint &hint) |
Adds an instruction level hint to the instruction being built. More... | |
StatefulAssembler & | set (const OperandHint &hint) |
Adds an operand level hint to the instruction being built. More... | |
StatefulAssembler & | inst (const Instruction &instruction) |
Assembles an instruction in the given instruction builder. More... | |
CodeIterator | getCodeIterator () |
Gets iterator which allows to iterate through the whole machine code byte by byte. More... | |
std::vector< AssembledInstruction > & | getAssembledInstructions () |
Gets all chosen assembled instructions. More... | |
fcml_usize | getCodeLength () |
Gets the code length of all assembled instructions available. More... | |
void | flush () |
Assembles all pending instructions. More... | |
const ParserConfig & | getParserConfig () const |
Gets configuration used by parser if parsing is supported. More... | |
ParserConfig & | getParserConfig () |
Gets configuration used by parser if parsing is supported. More... | |
const SymbolTable * | getSymbolTable () const |
Gets symbol table used together with the parser. More... | |
SymbolTable * | getSymbolTable () |
Gets symbol table used together with the parser. More... | |
void | setSymbolTable (SymbolTable *symbolTable) |
Sets a new symbol table for the parser. More... | |
Static Public Member Functions | |
static SAFlush | FLUSH () |
Creates flush indicated for "shift" operators. More... | |
It's a stateful assembler which can be used to assemble instructions one by one on the fly.
By default is works with the general instruction models as well as with instruction builders, but it can be also configured to parse whole statements using internally managed parser. It holds it's own state, so it's not necessary to update instruction pointer etc while it's working. Assembled instructions are placed inside a dedicated vector, but generated machine code is accessing directly by the dedicated CodeIterator.
|
inline |
Creates a stateful assembler for the given assembler and assembler context.
Bear in mind that assembler and context are not copied in any way and have to be valid as long as the stateful assembler in in use. Parsing support can be enabled optionally using the third parameter.
assembler | The assembled that will be used to assemble the code. |
context | The assembler context. |
enableParser | Enables parsing support. |
|
inlinevirtual |
Destructor.
|
inline |
Adds instruction builder to the stateful assembler.
Such a instruction builder will be used then to assemble an instruction it represents. Before any operation is performed, pending instruction is flushed if there is any available.
ib | The instruction builder to be flushed. |
AssemblingFailedException |
|
inline |
|
inlinestatic |
Creates flush indicated for "shift" operators.
|
inline |
Gets all chosen assembled instructions.
|
inline |
Gets iterator which allows to iterate through the whole machine code byte by byte.
|
inline |
Gets the code length of all assembled instructions available.
|
inline |
Gets configuration used by parser if parsing is supported.
|
inline |
|
inline |
Gets symbol table used together with the parser.
|
inline |
Gets symbol table used together with the parser.
|
inline |
Creates an instruction builder for the given mnemonic.
mnemonic | The instruction mnemonic. |
AssemblingFailedException,ParsingFailedException |
|
inline |
Assembles an instruction in the given instruction builder.
instruction | Instruction to be assembled. |
AssemblingFailedException |
|
inline |
Adds an operand to the instruction builder associated with the buffer.
operand | The operand to be added.. |
IllegalStateException |
|
inline |
Adds the new register operand to the instruction builder associated with the buffer.
reg | The register. |
IllegalStateException |
|
inline |
Adds the new immediate operand to the instruction builder associated with the buffer.
imm | The immediate value. |
IllegalStateException |
|
inline |
Adds the new address operand to the instruction builder associated with the buffer.
address | The address. |
IllegalStateException |
|
inline |
Adds the new far pointer operand to the instruction builder associated with the buffer.
pointer | The far pointer. |
IllegalStateException |
|
inline |
Adds instruction builder to the stateful assembler.
Such a instruction builder will be used then to assemble an instruction it represents. Before any operation is performed, pending instruction is flushed if there is any available.
ib | The instruction builder to be flushed. |
AssemblingFailedException |
|
inline |
Creates an instruction builder for the given mnemonic.
mnemonic | The instruction mnemonic. |
AssemblingFailedException,ParsingFailedException |
|
inline |
Adds the new register operand to the instruction builder associated with the buffer.
reg | The register. |
IllegalStateException |
|
inline |
Adds the new immediate operand to the instruction builder associated with the buffer.
imm | The immediate value. |
IllegalStateException |
|
inline |
Adds the new address operand to the instruction builder associated with the buffer.
address | The address. |
IllegalStateException |
|
inline |
Adds the new far pointer operand to the instruction builder associated with the buffer.
pointer | The far pointer. |
IllegalStateException |
|
inline |
Adds an operand to the instruction builder associated with the buffer.
operand | The operand to be added. |
IllegalStateException |
|
inline |
Flushes the instruction builder.
indic | Flush indicator. |
AssemblingFailedException |
|
inline |
Assembles an instruction in the given instruction builder.
instruction | Instruction to be assembled. |
AssemblingFailedException |
|
inline |
Adds a prefix to the instruction being built.
prefix | The prefix to be added. |
|
inline |
Adds an instruction level hint to the instruction being built.
hint | The hint to be added. |
|
inline |
Adds an operand level hint to the instruction being built.
hint | The hint to be added. |
|
inline |
Adds a prefix to the instruction being built.
prefix | The prefix to be added. |
|
inline |
Adds an instruction level hint to the instruction being built.
hint | The hint to be added. |
|
inline |
Adds an operand level hint to the instruction being built.
hint | The hint to be added. |
|
inline |
Sets a new symbol table for the parser.
symbolTable | The new symbol table. |