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

A Cpu mainly describes target machine's registers. More...

#include <cpu.hh>

Inheritance diagram for target::Cpu:
Collaboration diagram for target::Cpu:

Public Member Functions

std::ostream & dump (std::ostream &ostr) const
 Describing a CPU.
Ctor & dtor.
 Cpu ()
 Construct a Cpu (default).
virtual ~Cpu ()
 Destroy a Cpu.
Descriptors of this architecture.
virtual size_t word_size_get () const =0
 The byte size of a memory's word.
virtual size_t nb_regs () const
 The number of registers.
virtual const temp::Tempfp_reg () const =0
 The frame pointer register.
virtual const temp::Tempresult_reg () const =0
 The result register.
virtual const temp::TempMaptempmap_get () const
 Mapping from tc pseudos to hard registers.
virtual const
temp::temp_list_type
argument_regs () const
 Arguments-dedicated registers.
virtual const temp::temp_set_typecaller_save_regs () const
 Caller save registers.
virtual const temp::temp_set_typecallee_save_regs () const
 Callee save registers.
virtual const temp::temp_set_typespecial_regs () const
 Special registers (e.g., $fp, $sp, $zero etc.).
virtual temp::temp_set_type registers_get () const
 The whole register set.

Protected Member Functions

Register registers.
virtual void argument_reg (const std::string &name)
 Argument dedicated register.
virtual void caller_save_reg (const std::string &name)
 Caller save register.
virtual void callee_save_reg (const std::string &name)
 Callee save register.
virtual void special_reg (const temp::Temp &t)
 Special registers, unavailable for register allocaction.

Protected Attributes

Register classes.
temp::temp_set_type callee_save_registers_
 Callee save registers.
temp::temp_set_type caller_save_registers_
 Caller save registers.
temp::temp_list_type argument_registers_
 Argument registers.
temp::temp_set_type special_registers_
 Remaining registers.
std::unique_ptr< temp::TempMaptempmap_
 Mapping from pseudos to hard registers.

Detailed Description

A Cpu mainly describes target machine's registers.

Constructor & Destructor Documentation

target::Cpu::Cpu ( )

Construct a Cpu (default).

Reimplemented in target::ia32::Cpu.

target::Cpu::~Cpu ( )
virtual

Destroy a Cpu.

Member Function Documentation

void target::Cpu::argument_reg ( const std::string &  name)
protectedvirtual

Argument dedicated register.

References argument_registers_.

Referenced by target::mips::Cpu::Cpu().

const temp::temp_list_type & target::Cpu::argument_regs ( ) const
virtual

Arguments-dedicated registers.

References argument_registers_.

void target::Cpu::callee_save_reg ( const std::string &  name)
protectedvirtual

Callee save register.

References callee_save_registers_.

Referenced by target::mips::Cpu::Cpu().

const temp::temp_set_type & target::Cpu::callee_save_regs ( ) const
virtual

Callee save registers.

References callee_save_registers_.

void target::Cpu::caller_save_reg ( const std::string &  name)
protectedvirtual

Caller save register.

References caller_save_registers_.

Referenced by target::ia32::Cpu::Cpu(), and target::mips::Cpu::Cpu().

const temp::temp_set_type & target::Cpu::caller_save_regs ( ) const
virtual

Caller save registers.

References caller_save_registers_.

std::ostream & target::Cpu::dump ( std::ostream &  ostr) const
virtual const temp::Temp& target::Cpu::fp_reg ( ) const
pure virtual

The frame pointer register.

Implemented in target::ia32::Cpu, and target::mips::Cpu.

size_t target::Cpu::nb_regs ( ) const
virtual

The number of registers.

References argument_registers_, callee_save_registers_, caller_save_registers_, and special_registers_.

Referenced by dump().

temp::temp_set_type target::Cpu::registers_get ( ) const
virtual
virtual const temp::Temp& target::Cpu::result_reg ( ) const
pure virtual

The result register.

Implemented in target::ia32::Cpu, and target::mips::Cpu.

void target::Cpu::special_reg ( const temp::Temp t)
protectedvirtual

Special registers, unavailable for register allocaction.

References special_registers_.

Referenced by target::ia32::Cpu::Cpu(), and target::mips::Cpu::Cpu().

const temp::temp_set_type & target::Cpu::special_regs ( ) const
virtual

Special registers (e.g., $fp, $sp, $zero etc.).

References special_registers_.

const temp::TempMap & target::Cpu::tempmap_get ( ) const
virtual

Mapping from tc pseudos to hard registers.

References tempmap_.

virtual size_t target::Cpu::word_size_get ( ) const
pure virtual

The byte size of a memory's word.

Implemented in target::ia32::Cpu, and target::mips::Cpu.

Member Data Documentation

temp::temp_list_type target::Cpu::argument_registers_
protected

Argument registers.

Referenced by argument_reg(), argument_regs(), dump(), nb_regs(), and registers_get().

temp::temp_set_type target::Cpu::callee_save_registers_
protected

Callee save registers.

Referenced by callee_save_reg(), callee_save_regs(), dump(), nb_regs(), and registers_get().

temp::temp_set_type target::Cpu::caller_save_registers_
protected

Caller save registers.

Referenced by caller_save_reg(), caller_save_regs(), dump(), nb_regs(), and registers_get().

temp::temp_set_type target::Cpu::special_registers_
protected

Remaining registers.

Referenced by dump(), nb_regs(), registers_get(), special_reg(), and special_regs().

std::unique_ptr<temp::TempMap> target::Cpu::tempmap_
protected

Mapping from pseudos to hard registers.

Referenced by target::mips::Cpu::Cpu(), dump(), and tempmap_get().


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