summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-01-13 18:15:04 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-01-13 18:15:04 -0500
commit434556a40833c8b3df8d4e857b4b9fa10521c758 (patch)
tree8b084eda74b40c5837e84f4fdd6cc82b57112fb6
parentc7447c954b5c45ccfa72c2877863d6ac99d5674a (diff)
alwaysInline .urp setting
-rw-r--r--src/compiler.sml1
-rw-r--r--src/mono_reduce.sml5
-rw-r--r--src/settings.sig3
-rw-r--r--src/settings.sml9
4 files changed, 16 insertions, 2 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index df7cdb4c..c8bb036a 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -754,6 +754,7 @@ fun parseUrp' accLibs fname =
(case Int.fromString arg of
NONE => ErrorMsg.error ("invalid min heap '" ^ arg ^ "'")
| SOME n => minHeap := n)
+ | "alwaysInline" => Settings.addAlwaysInline arg
| _ => ErrorMsg.error ("Unrecognized command '" ^ cmd ^ "'");
read ()
diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml
index f8b209d5..e61ed237 100644
--- a/src/mono_reduce.sml
+++ b/src/mono_reduce.sml
@@ -374,12 +374,13 @@ fun reduce file =
TFun (t1, t2) => functionInside' t1 orelse functionInside t2
| _ => functionInside' t
- fun mayInline (n, e, t) =
+ fun mayInline (n, e, t, s) =
case IM.find (uses, n) of
NONE => false
| SOME count => count <= 1
orelse size e <= Settings.getMonoInline ()
orelse functionInside t
+ orelse Settings.checkAlwaysInline s
fun summarize d (e, _) =
let
@@ -711,7 +712,7 @@ fun reduce file =
let
val eo = case eo of
NONE => NONE
- | SOME e => if mayInline (n, e, t) then
+ | SOME e => if mayInline (n, e, t, s) then
SOME e
else
NONE
diff --git a/src/settings.sig b/src/settings.sig
index c49ecacc..fbf9b3c5 100644
--- a/src/settings.sig
+++ b/src/settings.sig
@@ -215,4 +215,7 @@ signature SETTINGS = sig
val setMinHeap : int -> unit
val getMinHeap : unit -> int
+
+ val addAlwaysInline : string -> unit
+ val checkAlwaysInline : string -> bool
end
diff --git a/src/settings.sml b/src/settings.sml
index ec0f582d..5edb1fde 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -539,4 +539,13 @@ val minHeap = ref 0
fun setMinHeap n = if n >= 0 then minHeap := n else raise Fail "Trying to set negative minHeap"
fun getMinHeap () = !minHeap
+structure SS = BinarySetFn(struct
+ type ord_key = string
+ val compare = String.compare
+ end)
+
+val alwaysInline = ref SS.empty
+fun addAlwaysInline s = alwaysInline := SS.add (!alwaysInline, s)
+fun checkAlwaysInline s = SS.member (!alwaysInline, s)
+
end