Parcourir la source

Supplemented docs

Taddeus Kroes il y a 12 ans
Parent
commit
632c12d380
1 fichiers modifiés avec 24 ajouts et 0 suppressions
  1. 24 0
      phases/unroll.mli

+ 24 - 0
phases/unroll.mli

@@ -52,6 +52,30 @@
 
 
     A simple heuristic is applied to decide whether a recognised for-loop will
     A simple heuristic is applied to decide whether a recognised for-loop will
     be unrolled: the resulting number of statements must not be larger than 20.
     be unrolled: the resulting number of statements must not be larger than 20.
+
+    Note that since programmer-defined for-loops are also transformed into
+    while-loops, these are recognized by the compiler as well (as long as the
+    loop has constant boundaries). For example:
+
+{v extern void printInt(int val);
+export int main() \{
+    for (int i = 0, 10, 2)
+        printInt(i);
+
+    return 0;
+\} v}
+
+    which is transformed into:
+
+{v extern void printInt(int val);
+export int main() \{
+    printInt(0);
+    printInt(2);
+    printInt(4);
+    printInt(6);
+    printInt(8);
+    return 0;
+\} v}
     *)
     *)
 
 
 (** Main phase function, called by {!Main}. *)
 (** Main phase function, called by {!Main}. *)