stages.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- Copyright (C) International Computer Science Institute, 1995.  COPYRIGHT  --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
-- the file "Doc/License" of the Sather distribution.  The license is also   --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
--------> Please email comments to sather-bugs@icsi.berkeley.edu. <----------

-- The interfaces in this file are roughly in their temporal order,
-- although they may be implemented `lazily' in practice for more
-- efficiency.


abstract class $GET_OPTIONS

abstract class $GET_OPTIONS is -- This prints the state of all options. str:STR; -- This interprets the command line passed to it interpret(a:ARRAY{STR}); read_env; end;

abstract class $PARSE

abstract class $PARSE is -- The stage in which all files are parsed and tree forms built. -- This stage catches both syntactic errors and multiply defined -- classes. This interface allows parsing to occur lazily, as -- the trees are first requested. -- Return the code tree for the class with name `nm' and the number -- of type parameters `num'. Return void if no such class. tree_for(nm:IDENT, num:INT):AS_CLASS_DEF; -- Tell the parser to parse the file `f'. parse(f:STR); end;

abstract class $FIND_TYPES

abstract class $FIND_TYPES is -- This is the stage which finds all possible types in the program. -- It starts from the non-parameterized types parsed in the first -- stage. It produces an IMPL for each such type and determines all -- types mentioned within it. If any of these types is missing or if -- any of the builtin types is missing an error is signalled -- and compilation ends. It causes errors for overloaded name -- conflicts. -- Walk through all the code trees and find all the types referred -- to. Cause errors for any types referred to but not existing. find_types; end;

abstract class $BUILD_TYPE_GRAPH

abstract class $BUILD_TYPE_GRAPH is -- This stage builds the type graph of the types found above. -- It causes errors if there are loops. -- Build the type graphs for all types in the program. build_graphs; end;

abstract class $CHECK_IFC_CONFORMANCE

abstract class $CHECK_IFC_CONFORMANCE is -- This stage checks the conformance of interfaces for each -- type against its parents and children. check_ifc_conformance; end;

abstract class $GET_MAIN_SIG

abstract class $GET_MAIN_SIG is -- This stage determines the signature of main. -- Get the signature of the main routine in the class named `nm' -- and put it in `main_sig'. get_main_sig(nm:STR); main_sig:SIG; end;

abstract class $GENERATE_AM

abstract class $GENERATE_AM is -- This stage does a code walk from main and generates the AM form -- It causes errors for failures of type checking, name clashes, -- etc. It is inlined in time with the back-end for each emitted -- routine. generate_am; output_sig(sig:SIG); -- output a signature, if it hasn't been done. -- sig_out:FSET{SIG}; -- return table of SIGs which have been output. sig_recursive:FSET{SIG}; -- signatures of routines known to be recursive. end;

abstract class $INLINE

abstract class $INLINE is -- This stage is called on every AM_ROUT_CALL_EXPR after it and -- all its subexpressions have been generated. This way any -- routine call can be replaced by an alternative expression. -- Called for every defined routine, before 'inline' is called. consider(am:AM_ROUT_DEF); -- There two different kinds of inlining. Special purpose -- inlining exploits certain special cases and could be -- done early (just after translation). General inlining -- might interfere with other optimizations and is done later. special_inline(call:AM_ROUT_CALL_EXPR):$AM_EXPR; -- general_inline(call:AM_ROUT_CALL_EXPR):$AM_EXPR; general_inline(rout:AM_ROUT_DEF,call:AM_ROUT_CALL_EXPR):$AM_EXPR; special_inline(call:AM_ITER_CALL_EXPR):$AM_EXPR; -- general_inline(call:AM_ITER_CALL_EXPR):$AM_EXPR; general_inline(rout:AM_ROUT_DEF,lp:AM_LOOP_STMT,call:AM_ITER_CALL_EXPR):$AM_EXPR; -- True if a given signature always be inlined so that -- code for it need not be generated. inlined(s:SIG):BOOL; init; -- used to initialize the inliner end;

abstract class $OPTIMIZE

abstract class $OPTIMIZE is -- This stage is right before the back-end. This is where -- expensive optimizations should be done. It passes the optimized -- $AM expressions to the back-end. -- Initialization occurs after the layouts and sigs have -- been constructed. init; -- This gets called for every routine to be optimized and generated. optimize(func:AM_ROUT_DEF); -- This gets called for every routine to be generated but not optimized. no_optimize(func:AM_ROUT_DEF); -- After all routines have been emitted, this is called. finalize; end;
-- $BACK_END is the abstract type which defines the interface that a -- back-end must provide to the rest of the compiler. At creation, a -- back-end is passed a PROG object, which holds various compiler-wide -- tables.

abstract class $BACK_END

abstract class $BACK_END is -- Initialization occurs after the layouts and sigs have -- been constructed. init; -- This gets called for every routine to be generated. emit(func:AM_ROUT_DEF); -- After all routines have been emitted, this is called. finalize; end;

abstract class $CHECK_AM

abstract class $CHECK_AM is -- Check the code for routines which aren't reached, but don't output -- any am code for them. check_code; end;