aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorletouzey2011-01-31 16:27:54 +0000
committerletouzey2011-01-31 16:27:54 +0000
commitfa9175c646ac804af0f446eeb981b2143d310537 (patch)
tree6114b08fd00e47b0b7627bed0cb6fa5221e4ef77 /lib
parentf19a9d9d3a410fda982b2cf9154da5774f9ec84f (diff)
A fine-grain control of inlining at functor application via priority levels
As said in CHANGES: << The inlining done during application of functors can now be controlled more precisely. In addition to the "!F G" syntax preventing any inlining, we can now use a priority level to select parameters to inline : "<30>F G" means "only inline in F the parameters whose levels are <= 30". The level of a parameter can be fixed by "Parameter Inline(30) foo". When levels aren't given, the default value is 100. One can also use the flag "Set Inline Level ..." to set a level. >> Nota : the syntax "Parameter Inline(30) foo" is equivalent to "Set Inline Level 30. Parameter Inline foo.", and "Include <30>F G" is equivalent to "Set Inline Level 30. Include F G." For instance, in ZBinary, eq is @Logic.eq and should rather be inlined, while in BigZ, eq is (fun x y => [x]=[y]) and should rather not be inlined. We could achieve this behavior by setting a level such as 30 to the parameter eq, and then tweaking the current level when applying functors. This idea of levels might be too restrictive, we'll see, but at least the implementation of this change was quite simple. There might be situation where parameters cannot be linearly ordered according to their "inlinablility". For these cases, we would need to mention names to inline or not at a functor application, and this is a bit more tricky (and might be a pain to use if there are many names). No documentation for the moment, since this feature is experimental and might still evolve. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13807 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r--lib/flags.ml6
-rw-r--r--lib/flags.mli5
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/flags.ml b/lib/flags.ml
index 13f5403790..6d1fb7fae4 100644
--- a/lib/flags.ml
+++ b/lib/flags.ml
@@ -124,3 +124,9 @@ let camlbin = ref Coq_config.camlbin
let camlp4bin_spec = ref false
let camlp4bin = ref Coq_config.camlp4bin
+(* Level of inlining during a functor application *)
+
+let default_inline_level = 100
+let inline_level = ref default_inline_level
+let set_inline_level = (:=) inline_level
+let get_inline_level () = !inline_level
diff --git a/lib/flags.mli b/lib/flags.mli
index ecb4d6dd63..20e3a7819c 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -84,3 +84,8 @@ val camlbin_spec : bool ref
val camlbin : string ref
val camlp4bin_spec : bool ref
val camlp4bin : string ref
+
+(** Level of inlining during a functor application *)
+val set_inline_level : int -> unit
+val get_inline_level : unit -> int
+val default_inline_level : int