Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/compiler/FLINT/opt/optutils.sml
ViewVC logotype

View of /sml/trunk/src/compiler/FLINT/opt/optutils.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 190 - (download) (annotate)
Thu Nov 19 21:01:17 1998 UTC (23 years, 7 months ago) by monnier
File size: 1305 byte(s)
* opt/optutils.sml (id): removed.  That was stupid.
* opt/collect.sml: drop support for actuals (was only used for cstargs).
* opt/lcontract.sml (lpfd): reset the inline bit to a safe value.
* opt/fcontract.sml (cstargs): eliminated.  Might reappear in a
  specialization phase some day.
(inline): turned off unrolling because it's buggy.
(APP): use the new ifs, damit!
(* copyright 1998 YALE FLINT PROJECT *)
(* monnier@cs.yale.edu *)

signature OPT_UTILS =

    datatype ('a,'b) either = A of 'a | B of 'b

    (* takes the fk of a function and returns the fk of the wrapper
     * along with the new fk of the actual body *)
    val fk_wrap : FLINT.fkind * FLINT.lty list option ->
	              (FLINT.fkind * FLINT.fkind)

    (* this is a known APL function, but I don't know its real name *)
    val filter : bool list * 'a list -> 'a list

structure OptUtils :> OPT_UTILS =
local structure F = FLINT
      structure LK = LtyKernel
    datatype ('a,'b) either = A of 'a | B of 'b

    fun bug msg = ErrorMsg.impossible ("OptUtils: "^msg)
    fun fk_wrap ({inline,known,isrec,cconv},rtys') =
	let val cconv' =
		case cconv
		 of F.CC_FUN(LK.FF_VAR(f1,f2)) => F.CC_FUN(LK.FF_VAR(true, f2))
		  | (F.CC_FCT | F.CC_FUN(LK.FF_FIXED)) => cconv
	    val isrec' = Option.map (fn ltys => (ltys, F.LK_UNKNOWN)) rtys'
	in ({isrec=isrec, known=known, cconv=cconv, inline=F.IH_ALWAYS},
	    {isrec=isrec', known=true, cconv=cconv', inline=inline})

    fun filter ([],[]) = []
      | filter (true::fs,x::xs)  = x::(filter(fs, xs))
      | filter (false::fs,x::xs) = (filter(fs, xs))
      | filter _ = bug "unmatched list length in filter"


ViewVC Help
Powered by ViewVC 1.0.0