MLRISC

MLRISC Contributors Requirements How to Obtain MLRISC

Overview

Problem Statement Contributions MLRISC Based Compiler MLRISC Intermediate Representation MLRisc Generation Back End Optimizations Register Allocation Machine Description Garbage Collection Safety System Integration Optimizations Graphical Interface Line Counts Systems Using MLRISC Future Work

System

Architecture of MLRISC The MLTREE Language MLTree Extensions MLTree Utilities Instruction Selection Assemblers Machine Code Emitters Delay Slot Filling Span Dependency Resolution The Graph Library The Graph Visualization Library Basic Compiler Graphs The MLRISC IR 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

Annotations Cells Cluster Client Defined Constants Client Defined Pseudo Ops Instructions Instruction Streams Label Expressions Labels Regions Regmap

# Cells

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 =
     sig
        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
     end

- `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
     end

- `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

Generated by mltex2html
Last modified: Mon Oct 3 20:52:35 UTC 2022 by buildd@x86-grnet-02