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

Instruction Streams


Instruction Streams
-Overview
-The Details
-The protocol

Overview

An instruction stream is an abstraction used by MLRISC to describe linearized instructions. This abstraction turns out to fit the function of many MLRISC modules. For example, a phase such as Instruction Selection can be viewed as taking an stream of MLTREE statements and return a stream of instructions. Similarly, phases such as assembly output and machine code generation can be seen as taking a stream of instructions and returning a stream of characters and a stream of bytes.

The Details

An instruction stream satisfy the following abstract signature:
 signature INSTRUCTION_STREAM =
 sig
    structure P : PSEUDO_OPS
 
    datatype ('a,'b,'c,'d,'e,'f) stream =
       STREAM of
       { beginCluster: int -> 'b,  
         endCluster  : 'c -> unit, 
         emit        : 'a,        
         pseudoOp    : P.pseudo_op -> unit,
         defineLabel : Label.label -> unit,
         entryLabel  : Label.label -> unit,
         comment     : string -> unit,    
         annotation  : Annotations.annotation -> unit,
         exitBlock   : 'd -> unit,
         alias       : 'e -> unit, 
         phi         : 'f -> unit  
       }
 end
 
This type is specialized in other modules as such the assembler, the machine code emitter, and the instruction selection modules.

The protocol

All instruction streams, irrespective of their actual types, follow the following protocol:
  • The method beginCluster should be called at the beginning of the stream to mark the start of a new compilation unit. The integer passed to this method is the number of bytes in the stream. This integer is only used for machine code emitter, which uses it to allocate space for the code string.
  • The method endCluster should be called when the entire compilation unit has been sent.
  • In between these calls, the following methods can be called in any order:
    • emit -- this method emits an instruction. It takes a regmap as argument.
    • pseudoOp -- this method emits a pseudo op.
    • defineLabel -- this method defines a local label, i.e. a label that is only referenced within the same compilation unit.
    • entryLabel -- this method defines an enternal label that marks an procedure entry, and may be referenced from other compilation units.
    • comment -- this emits a comment string
    • annotation -- this function attaches an annotation to the current basic block.
    • exitBlock -- this marks the current block as an procedure exit.

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