https://svn.lrde.epita.fr/svn/xrm/trunk
Index: ChangeLog
from SIGOURE Benoit <sigoure.benoit(a)lrde.epita.fr>
Add messages for the --verbose notice level.
Because someone has been reporting poor performances when using
xrm-front on large files, this will help to track the execution of
the pipeline by using --verbose notice. Hopefully we'll quickly see
where is the bottleneck (in term of execution time).
desugar-array-access has been renamed to flatten-array-access because
the name wasn't really appropriate and also because this name will be
used for a new strategy in future extensions.
* src/str/desugar-array-accesses.str: Rename as...
* src/str/flatten-array-access.str: ...this.
* src/str/xrm-to-prism.str: Update accordingly.
* src/str/xrm-front.str: Add calls to notice-msg.
flatten-array-access.str | 6 +++---
xrm-front.str | 8 +++++---
xrm-to-prism.str | 15 ++++++++++++---
3 files changed, 20 insertions(+), 9 deletions(-)
Index: src/str/flatten-array-access.str
--- src/str/flatten-array-access.str (revision 44)
+++ src/str/flatten-array-access.str (working copy)
@@ -1,15 +1,15 @@
-module desugar-array-accesses
+module flatten-array-access
rules
/**
** Transform an array access into an identifier (eg: x[i] -> x_i)
*/
- remove-array-accesses:
+ flatten-array-access:
ArrayAccess(Identifier(idf), access-list) -> Identifier(idf')
where flatten-access-list(|idf, access-list) => idf'
- remove-array-accesses:
+ flatten-array-access:
ArrayAccessPrime(Identifier(idf), access-list) -> IdentifierPrime(idf')
where flatten-access-list(|idf, access-list) => idf'
Index: src/str/xrm-to-prism.str
--- src/str/xrm-to-prism.str (revision 44)
+++ src/str/xrm-to-prism.str (working copy)
@@ -25,7 +25,7 @@
imports
XRM
prism-desugar
- desugar-array-accesses
+ flatten-array-access
check-meta-vars
eval-meta-code
array-decl-desugar
@@ -40,10 +40,12 @@
<+ DesugarImplicitForStep <+ DesugarImplicitElse
<+ DesugarRand <+ EvalRand
)
+ ; notice-msg(|"xrm-to-prism: XRM sugar removed")
/* Collect static const variables
* Two goals: expand them if needed, look for variable name conflicts. */
; topdown(try(collect-static-const-decl); try(collect-formulas))
+ ; notice-msg(|"xrm-to-prism: static const and formulas collected")
/* Desugar array declarations
* eg: x[4][5] is transformed into two nested meta for loops
@@ -53,18 +55,22 @@
* This must come AFTER collect-static-const-decl since we might need
* to expand an arrays which rely on static const variables.
*/
- ; array-decl-desugar
+ ; topdown(try(array-decl-desugar))
+ ; notice-msg(|"xrm-to-prism: array declarations desugared")
/* Check that meta vars are always defined in the current scope when used
* and that they are not redefined twice in the same scope */
; check-meta-vars
+ ; notice-msg(|"xrm-to-prism: meta-vars checked")
/* unroll meta loops, eval meta if */
; eval-meta-code
+ ; notice-msg(|"xrm-to-prism: eval-meta-code done")
/* flatten nested lists */
; ModulesFile(id, flatten-list)
; ModulesFile(id, map(try(Module(id, flatten-list))))
+ ; notice-msg(|"xrm-to-prism: flatten-list done")
/* get the modules that generates random numbers (XRM rand builtin) */
; where(bagof-RandGenModules; reverse => rand-gen-modules)
@@ -73,10 +79,13 @@
; ModulesFile(id, <conc>(<id>, rand-gen-modules))
/* remove array accesses: x[i] -> x_i */
- ; bottomup(try(remove-array-accesses))
+ // FIXME: can we make this more efficient than a complete bottomup?
+ ; bottomup(try(flatten-array-access))
+ ; notice-msg(|"xrm-to-prism: flatten-array-access done")
/* re-order modules so that all declarations appear before commands */
; ModulesFile(id, map(try(reorder-module-contents)))
+ ; notice-msg(|"xrm-to-prism: reorder-module-contents done")
rules
Index: src/str/xrm-front.str
--- src/str/xrm-front.str (revision 44)
+++ src/str/xrm-front.str (working copy)
@@ -29,15 +29,17 @@
write-to // output binary ATerms
else
if must-pp-aterm then // output pp-ATerms
- write-to; xtc-transform(!"pp-aterm", pass-verbose)
+ notice-msg(|"pretty printing ATerms")
+ ; write-to; xtc-transform(!"pp-aterm", pass-verbose)
else // output PRISM source
- write-to; xtc-transform(!"pp-prism", pass-verbose)
+ notice-msg(|"pretty printing PRISM code")
+ ; write-to; xtc-transform(!"pp-prism", pass-verbose)
end
end
/** pipeline of transformations performed by xrm-front */
xrm-front-pipeline =
- dbg(|"xrm-front-pipeline starting")
+ notice-msg(|"transformation pipeline starting")
; xrm-to-prism
; dbg(|"xrm-to-prism finished")
; if must-desugar then