comparison src/mono_reduce.sml @ 1393:802c179dac1f

alwaysInline .urp setting
author Adam Chlipala <adam@chlipala.net>
date Thu, 13 Jan 2011 18:15:04 -0500
parents 02fc16faecf3
children d328983dc5a6
comparison
equal deleted inserted replaced
1392:e305ffee2b5b 1393:802c179dac1f
372 fun functionInside t = 372 fun functionInside t =
373 case #1 t of 373 case #1 t of
374 TFun (t1, t2) => functionInside' t1 orelse functionInside t2 374 TFun (t1, t2) => functionInside' t1 orelse functionInside t2
375 | _ => functionInside' t 375 | _ => functionInside' t
376 376
377 fun mayInline (n, e, t) = 377 fun mayInline (n, e, t, s) =
378 case IM.find (uses, n) of 378 case IM.find (uses, n) of
379 NONE => false 379 NONE => false
380 | SOME count => count <= 1 380 | SOME count => count <= 1
381 orelse size e <= Settings.getMonoInline () 381 orelse size e <= Settings.getMonoInline ()
382 orelse functionInside t 382 orelse functionInside t
383 orelse Settings.checkAlwaysInline s
383 384
384 fun summarize d (e, _) = 385 fun summarize d (e, _) =
385 let 386 let
386 val s = 387 val s =
387 case e of 388 case e of
709 | U.Decl.RelE (x, t) => E.pushERel env x t NONE 710 | U.Decl.RelE (x, t) => E.pushERel env x t NONE
710 | U.Decl.NamedE (x, n, t, eo, s) => 711 | U.Decl.NamedE (x, n, t, eo, s) =>
711 let 712 let
712 val eo = case eo of 713 val eo = case eo of
713 NONE => NONE 714 NONE => NONE
714 | SOME e => if mayInline (n, e, t) then 715 | SOME e => if mayInline (n, e, t, s) then
715 SOME e 716 SOME e
716 else 717 else
717 NONE 718 NONE
718 in 719 in
719 E.pushENamed env x n t (Option.map (reduceExp env) eo) s 720 E.pushENamed env x n t (Option.map (reduceExp env) eo) s