LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Implements a GAS compatible assembly language. More...
#include <gas-assembly.hh>
Public Member Functions | |
assem::Layout & | layout_get () |
Return Assembly layout. | |
Ctor & dtor. | |
GasAssembly () | |
Construct a GasAssembly. | |
virtual | ~GasAssembly () |
Destroy a GasAssembly. | |
Arithmetic instructions. | |
std::string | binop_inst (const tree::Binop::Oper &op) const |
assem::Instrs | binop_build (const tree::Binop::Oper &op, const temp::Temp &left, const temp::Temp &right, const temp::Temp &res) const |
Build a binary (reg with reg in reg) operation in assembly. | |
assem::Instrs | binop_build (const tree::Binop::Oper &op, const temp::Temp &left, int right, const temp::Temp &res) const |
Build a binary (imm with reg in reg) operation in assembly. | |
Copy instructions. | |
assem::Instrs | move_build (const temp::Temp &src, const temp::Temp &dst) const |
Build a move (register into register) operation in assembly. | |
assem::Instrs | move_build (int immediate, const temp::Temp &dst) const |
Build a move (immediate into register) operation in assembly. | |
assem::Instrs | move_build (const temp::Label &label, const temp::Temp &dst) const |
Build a move (label into register) operation in assembly. | |
assem::Instrs | load_build (const temp::Temp &base, int offset, const temp::Temp &dst) const |
Build a load (memory into register) operation in assembly. | |
assem::Instrs | load_build (const temp::Temp &base, const temp::Temp &dst) const |
Build a load (memory into register) operation in assembly. | |
assem::Instrs | load_build (int absolute, const temp::Temp &dst) const |
Build a load (memory into register) operation in assembly. | |
assem::Instrs | store_build (const temp::Temp &src, const temp::Temp &base, int offset=0) const |
Build a store (register into memory) operation in assembly. | |
assem::Instrs | store_build (const temp::Temp &src, int absolute) const |
Build a store (register into memory) operation in assembly. | |
Jump instructions. | |
assem::Instrs | label_build (const temp::Label &label) const |
Build a label in assembly. | |
std::string | cjump_inst (const tree::Cjump::Relop &op) const |
Return the assembly opcode of the conditional jump instruction corresponding to op. | |
assem::Instrs | cjump_build (const tree::Cjump::Relop &relop, const temp::Temp &left, const temp::Temp &right, const temp::Label &label_true, const temp::Label &label_false) const |
Build a reg/reg conditional jump. | |
assem::Instrs | cjump_build (const tree::Cjump::Relop &relop, const temp::Temp &left, int right, const temp::Label &label_true, const temp::Label &label_false) const |
Build a reg/imm conditional jump. | |
assem::Instrs | cjump_build (const tree::Cjump::Relop &relop, int left, const temp::Temp &right, const temp::Label &label_true, const temp::Label &label_false) const |
Build an imm/reg conditional jump. | |
assem::Instrs | jump_build (const temp::Label &label) const |
Build an unconditional jump. | |
Function operations. | |
assem::Instrs | push_build (const temp::Temp &src) |
Build the lovely, so famous, so CISC, push instruction. | |
assem::Instrs | call_build (const temp::Label &label, const temp::temp_list_type &res) const |
Build a function call in assembly. | |
assem::Instrs | leave_build () const |
Revert caller's stack frame. | |
assem::Instrs | ret_build (size_t i) const |
Build a function return in assembly. | |
Runtime library. | |
virtual const char * | runtime (bool gc=false) const override |
Return the runtime library. |
Protected Attributes | |
assem::Layout & | layout_ |
The associated assembly layout. |
Implements a GAS compatible assembly language.
See GAS, IA-32 emulator.
target::ia32::GasAssembly::GasAssembly | ( | ) |
Construct a GasAssembly.
|
virtual |
Destroy a GasAssembly.
assem::Instrs target::ia32::GasAssembly::binop_build | ( | const tree::Binop::Oper & | op, |
const temp::Temp & | left, | ||
const temp::Temp & | right, | ||
const temp::Temp & | res | ||
) | const |
Build a binary (reg with reg in reg) operation in assembly.
References binop_inst(), and tree::Binop::div.
assem::Instrs target::ia32::GasAssembly::binop_build | ( | const tree::Binop::Oper & | op, |
const temp::Temp & | left, | ||
int | right, | ||
const temp::Temp & | res | ||
) | const |
Build a binary (imm with reg in reg) operation in assembly.
References binop_inst(), tree::Binop::div, and move_build().
std::string target::ia32::GasAssembly::binop_inst | ( | const tree::Binop::Oper & | op | ) | const |
References tree::Binop::add, die, tree::Binop::mul, and tree::Binop::sub.
Referenced by binop_build().
assem::Instrs target::ia32::GasAssembly::call_build | ( | const temp::Label & | label, |
const temp::temp_list_type & | res | ||
) | const |
Build a function call in assembly.
References temp::Identifier< Traits_ >::string_get().
assem::Instrs target::ia32::GasAssembly::cjump_build | ( | const tree::Cjump::Relop & | relop, |
const temp::Temp & | left, | ||
const temp::Temp & | right, | ||
const temp::Label & | label_true, | ||
const temp::Label & | label_false | ||
) | const |
Build a reg/reg conditional jump.
Referenced by cjump_build().
assem::Instrs target::ia32::GasAssembly::cjump_build | ( | const tree::Cjump::Relop & | relop, |
const temp::Temp & | left, | ||
int | right, | ||
const temp::Label & | label_true, | ||
const temp::Label & | label_false | ||
) | const |
Build a reg/imm conditional jump.
assem::Instrs target::ia32::GasAssembly::cjump_build | ( | const tree::Cjump::Relop & | relop, |
int | left, | ||
const temp::Temp & | right, | ||
const temp::Label & | label_true, | ||
const temp::Label & | label_false | ||
) | const |
Build an imm/reg conditional jump.
References cjump_build(), and tree::symmetrize().
std::string target::ia32::GasAssembly::cjump_inst | ( | const tree::Cjump::Relop & | op | ) | const |
Return the assembly opcode of the conditional jump instruction corresponding to op.
References die, tree::Cjump::eq, tree::Cjump::ge, tree::Cjump::gt, tree::Cjump::le, tree::Cjump::lt, tree::Cjump::ne, tree::Cjump::uge, tree::Cjump::ugt, tree::Cjump::ule, and tree::Cjump::ult.
assem::Instrs target::ia32::GasAssembly::jump_build | ( | const temp::Label & | label | ) | const |
Build an unconditional jump.
assem::Instrs target::ia32::GasAssembly::label_build | ( | const temp::Label & | label | ) | const |
Build a label in assembly.
References temp::Identifier< Traits_ >::string_get().
|
inherited |
Return Assembly layout.
References target::Assembly::layout_.
Referenced by target::instructions_dump().
assem::Instrs target::ia32::GasAssembly::leave_build | ( | ) | const |
Revert caller's stack frame.
assem::Instrs target::ia32::GasAssembly::load_build | ( | const temp::Temp & | base, |
int | offset, | ||
const temp::Temp & | dst | ||
) | const |
Build a load (memory into register) operation in assembly.
Referenced by load_build().
assem::Instrs target::ia32::GasAssembly::load_build | ( | const temp::Temp & | base, |
const temp::Temp & | dst | ||
) | const |
Build a load (memory into register) operation in assembly.
References load_build().
assem::Instrs target::ia32::GasAssembly::load_build | ( | int | absolute, |
const temp::Temp & | dst | ||
) | const |
Build a load (memory into register) operation in assembly.
References die.
assem::Instrs target::ia32::GasAssembly::move_build | ( | const temp::Temp & | src, |
const temp::Temp & | dst | ||
) | const |
Build a move (register into register) operation in assembly.
Referenced by binop_build().
assem::Instrs target::ia32::GasAssembly::move_build | ( | int | immediate, |
const temp::Temp & | dst | ||
) | const |
Build a move (immediate into register) operation in assembly.
assem::Instrs target::ia32::GasAssembly::move_build | ( | const temp::Label & | label, |
const temp::Temp & | dst | ||
) | const |
Build a move (label into register) operation in assembly.
assem::Instrs target::ia32::GasAssembly::push_build | ( | const temp::Temp & | src | ) |
Build the lovely, so famous, so CISC, push instruction.
assem::Instrs target::ia32::GasAssembly::ret_build | ( | size_t | i | ) | const |
Build a function return in assembly.
|
overridevirtual |
Return the runtime library.
Implements target::Assembly.
assem::Instrs target::ia32::GasAssembly::store_build | ( | const temp::Temp & | src, |
const temp::Temp & | base, | ||
int | offset = 0 |
||
) | const |
Build a store (register into memory) operation in assembly.
assem::Instrs target::ia32::GasAssembly::store_build | ( | const temp::Temp & | src, |
int | absolute | ||
) | const |
Build a store (register into memory) operation in assembly.
References die.
|
protectedinherited |
The associated assembly layout.
Referenced by target::Assembly::layout_get().