LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
target::mips::SpimAssembly Class Reference

Implements a SPIM compatible assembly language. More...

#include <spim-assembly.hh>

Inheritance diagram for target::mips::SpimAssembly:
Collaboration diagram for target::mips::SpimAssembly:

Public Member Functions

assem::Layoutlayout_get ()
 Return Assembly layout.
Ctor & dtor.
 SpimAssembly ()
 Construct a SpimAssembly.
virtual ~SpimAssembly ()
 Destroy a SpimAssembly.
Arithmetic instructions.
std::string binop_inst (const tree::Binop::Oper &op) const
 Return the instruction for op.
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.
assem::Instrs binop_build (const tree::Binop::Oper &op, int left, const temp::Temp &right, const temp::Temp &res) const
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 instruction for relop.
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 conditional jump in assembly.
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 conditional jump in assembly.
assem::Instrs jump_build (const temp::Label &label) const
 Build an unconditional jump in assembly.
Function operations.
assem::Instrs call_build (const temp::Label &label, const temp::temp_list_type &args, const temp::temp_list_type &res) const
 Build a function call in assembly.
assem::Instrs ret_build (const temp::Temp &ret) 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::Layoutlayout_
 The associated assembly layout.

Detailed Description

Implements a SPIM compatible assembly language.

See SPIM, MIPS emulator.

Constructor & Destructor Documentation

target::mips::SpimAssembly::SpimAssembly ( )

Construct a SpimAssembly.

target::mips::SpimAssembly::~SpimAssembly ( )
virtual

Destroy a SpimAssembly.

Member Function Documentation

assem::Instrs target::mips::SpimAssembly::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.

Referenced by binop_build().

assem::Instrs target::mips::SpimAssembly::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.

assem::Instrs target::mips::SpimAssembly::binop_build ( const tree::Binop::Oper op,
int  left,
const temp::Temp right,
const temp::Temp res 
) const

References binop_build().

std::string target::mips::SpimAssembly::binop_inst ( const tree::Binop::Oper op) const

Return the instruction for op.

assem::Instrs target::mips::SpimAssembly::call_build ( const temp::Label label,
const temp::temp_list_type args,
const temp::temp_list_type res 
) const

Build a function call in assembly.

References temp::Identifier< Traits_ >::string_get().

assem::Instrs target::mips::SpimAssembly::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 conditional jump in assembly.

assem::Instrs target::mips::SpimAssembly::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 conditional jump in assembly.

std::string target::mips::SpimAssembly::cjump_inst ( const tree::Cjump::Relop op) const

Return the instruction for relop.

assem::Instrs target::mips::SpimAssembly::jump_build ( const temp::Label label) const

Build an unconditional jump in assembly.

assem::Instrs target::mips::SpimAssembly::label_build ( const temp::Label label) const

Build a label in assembly.

References temp::Identifier< Traits_ >::string_get().

assem::Layout & target::Assembly::layout_get ( )
inherited

Return Assembly layout.

References target::Assembly::layout_.

Referenced by target::instructions_dump().

assem::Instrs target::mips::SpimAssembly::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::mips::SpimAssembly::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::mips::SpimAssembly::load_build ( int  absolute,
const temp::Temp dst 
) const

Build a load (memory into register) operation in assembly.

assem::Instrs target::mips::SpimAssembly::move_build ( const temp::Temp src,
const temp::Temp dst 
) const

Build a move (register into register) operation in assembly.

assem::Instrs target::mips::SpimAssembly::move_build ( int  immediate,
const temp::Temp dst 
) const

Build a move (immediate into register) operation in assembly.

assem::Instrs target::mips::SpimAssembly::move_build ( const temp::Label label,
const temp::Temp dst 
) const

Build a move (label into register) operation in assembly.

assem::Instrs target::mips::SpimAssembly::ret_build ( const temp::Temp ret) const

Build a function return in assembly.

virtual const char* target::mips::SpimAssembly::runtime ( bool  gc = false) const
overridevirtual

Return the runtime library.

Implements target::Assembly.

assem::Instrs target::mips::SpimAssembly::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::mips::SpimAssembly::store_build ( const temp::Temp src,
int  absolute 
) const

Build a store (register into memory) operation in assembly.

Member Data Documentation

assem::Layout& target::Assembly::layout_
protectedinherited

The associated assembly layout.

Referenced by target::Assembly::layout_get().


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