How to Obtain MLRISC
Problem Statement
MLRISC Based Compiler
MLRISC Intermediate Representation
MLRisc Generation
Back End Optimizations
Register Allocation
Machine Description
Garbage Collection Safety
System Integration
Graphical Interface
Line Counts
Systems Using MLRISC
Future Work
Architecture of MLRISC
The MLTREE Language
MLTree Extensions
MLTree Utilities
Instruction Selection
Machine Code Emitters
Delay Slot Filling
Span Dependency Resolution
The Graph Library
The Graph Visualization Library
Basic Compiler Graphs
SSA Optimizations
ILP Optimizations
Optimizations for VLIW/EPIC Architectur...
Register Allocator
Back Ends
The Alpha Back End
The PA RISC Back End
The Sparc Back End
The Intel x86 Back End
The PowerPC Back End
The MIPS Back End
The TI C6x Back End
Basic Types
Client Defined Constants
Client Defined Pseudo Ops
Instruction Streams
Label Expressions


MLRISC uses the CELLS interface to define all readable/writable resources in a machine architecture, or cells The types defined herein are:
  • cellkind -- different classes of cells are assigned difference cellkinds. The following cellkinds should be present
    • GP -- general purpose registers.
    • FP -- floating point registers.
    • CC -- condition code registers.
    In addition, the cellkinds MEM and CTRL should also be defined. These are used for representing memory based data dependence and control dependence.
    • MEM -- memory
    • CTRL -- control dependence
  • regmap -- register map
  • cellset -- a cellset represent a set of cells. This type can be used to denote live-in/live-out information. Cellsets are implemented as immutable abstract types.

These core definitions are defined in the following signature

 signature CELLS_BASIS =
    eqtype cellkind 
    type cell = int
    type regmap = cell Intmap.intmap
    exception Cells
    val cellkinds : cellkind list 
    val cellkindToString : cellkind -> string
    val firstPseudo : cell                    
    val Reg   : cellkind -> int -> cell
    val GPReg : int -> cell 
    val FPReg : int -> cell
    val cellRange : cellkind -> {low:int, high:int}
    val newCell   : cellkind -> 'a -> cell 
    val cellKind : cell -> cellkind         
    val updateCellKind : cell * cellkind -> unit        
    val numCell   : cellkind -> unit -> int              
    val maxCell   : unit -> cell
    val newReg    : 'a -> cell              
    val newFreg   : 'a -> cell              
    val newVar    : cell -> cell
    val regmap    : unit -> regmap
    val lookup    : regmap -> cell -> cell
    val reset     : unit -> unit
  • cellkinds -- this is a list of all the cellkinds defined in the architecture
  • cellkindToString -- this function maps a cellkind into its name
  • firstPseudo -- MLRISC numbered physical resources in the architecture from 0 to firstPseudo-1. This is the first usable virtual register number.
  • Reg -- This function maps the ith physical resource of a particular cellkind to its internal encoding used by MLRISC. Note that all resources in MLRISC are named uniquely.
  • GPReg -- abbreviation for Reg GP
  • FPReg -- abbreviation for Reg FP
  • cellRange -- this returns a range \sml{{low, high}} when given a cellkind, with denotes the range of physical resources
  • newCell -- This function returns a new virtual register of a particular cellkind.
  • newReg -- abbreviation as newCell GP
  • newFreg -- abbreviation as newCell FP
  • cellKind -- When given a cell number, this returns its cellkind. Note that this feature is not enabled by default.
  • updateCellKind -- updates the cellkind of a cell.
  • numCell -- returns the number of virtual cells allocated for one cellkind.
  • maxCell -- returns the next virtual cell id.
  • newVar -- given a cell id, return a new cell id of the same cellkind.
  • regmap -- This function returns a new empty regmap
  • lookup -- This converts a regmap into a lookup function.
  • reset -- This function resets all counters associated with all virtual cells.

 signature CELLS = sig
    include CELLS_BASIS
    val GP   : cellkind 
    val FP   : cellkind
    val CC   : cellkind 
    val MEM  : cellkind 
    val CTRL : cellkind 
    val toString : cellkind -> cell -> string
    val stackptrR : cell 
    val asmTmpR : cell  
    val fasmTmp : cell 
    val zeroReg : cellkind -> cell option
    type cellset
    val empty      : cellset
    val addCell    : cellkind -> cell * cellset -> cellset
    val rmvCell    : cellkind -> cell * cellset -> cellset
    val addReg     : cell * cellset -> cellset
    val rmvReg     : cell * cellset -> cellset
    val addFreg    : cell * cellset -> cellset
    val rmvFreg    : cell * cellset -> cellset
    val getCell    : cellkind -> cellset -> cell list
    val updateCell : cellkind -> cellset * cell list -> cellset
    val cellsetToString : cellset -> string
    val cellsetToString' : (cell -> cell) -> cellset -> string
    val cellsetToCells : cellset -> cell list
  • toString -- convert a cell id of a certain cellkind into its assembly name.
  • stackptrR -- the cell id of the stack pointer register.
  • asmTmpR -- the cell id of the assembly temporary
  • fasmTmp -- the cell id of the floating point temporary
  • zeroReg -- given the cellkind, returns the cell id of the source that always hold the value of zero, if there is any.
  • empty -- an empty cellset
  • addCell -- inserts a cell into a cellset
  • rmvCell -- remove a cell from a cellset
  • addReg -- abbreviation for addCell GP
  • rmvReg -- abbreviation for rmvCell GP
  • addFreg -- abbreviation for addCell FP
  • rmvFreg -- abbreviation for rmvCell FP
  • getCell -- lookup all cells of a particular cellkind from the cellset
  • updateCell -- replace all cells of a particular cellkind from the cellset.
  • cellsetToString -- pretty print a cellset
  • cellsetToString' -- pretty print a cellset, but first apply a regmap function.
  • cellsetToCells -- convert a cellset into list form.

Lal George
Allen Leung
SML/NJ Validate this page
Generated by mltex2html
Last modified: Thu Jan 9 19:38:15 EST 2003 by leunga@slinky