IntCodeOpt.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) January 3, 1990 0:28:01 am PST
Routines that are useful in various optimizations.
DIRECTORY
IntCodeDefs USING [Label, LambdaNode, Node, Var],
IntCodeTwig USING [BaseModel, LambdaModel];
IntCodeOpt: CEDAR DEFINITIONS = BEGIN OPEN IntCodeDefs, IntCodeTwig;
GenAnonLocal: PROC [base: BaseModel, parent: Label, bits: INT] RETURNS [Var];
Generates an anonymous local variable of the given width with the given parent.
CleanupLambda: PROC
[base: BaseModel, model: LambdaModel, lambda: LambdaNode, rtnPtr: Var];
Performs a variety of cleanup and optimization transformations that are strictly optional, although they tend to improve the code. The lambda node is modified in place. If there is a return record accessed through a pointer, then rtnPtr designates the variable for that pointer.
RectifyBlock: PROC [node: Node] RETURNS [Node];
Cleans up a block node.
SimplifyValueBlocks: PROC
[base: BaseModel, model: LambdaModel, lambda: LambdaNode];
Tries to make blocks that result in a value simpler, with the goal of eliminating them (although that is not always possible).
IsReallySimple: PROC [n: Node] RETURNS [BOOL];
This is an estimate of what can be generated as an expression without nasty control flow and funny effects. It tends to be conservative, but is not necessarily totally correct.
END.