summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/desugar/tasks.hh
blob: 44a68e66baeedeef7f81b4ee9d8fb53745c90911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
 ** \file desugar/tasks.hh
 ** \brief Desugar module tasks.
 */

#pragma once

#include <config.h>
#include <misc/fwd.hh>
#include <task/libtask.hh>

/// Tasks of the desugar module.
namespace desugar::tasks
{
  TASK_GROUP("Desugaring and bounds-checking");

  /*-------------.
    | Desugaring.  |
    `-------------*/

  /// Enable translation of `for' loops into `while' loops.
  BOOLEAN_TASK_DECLARE("desugar-for", "desugar `for' loops", desugar_for_p, "");

  /// Enable string comparison desugaring.
  BOOLEAN_TASK_DECLARE("desugar-string-cmp",
                       "desugar string comparisons",
                       desugar_string_cmp_p,
                       "");

  /// Default the removal of syntactic sugar from the AST to Tiger
  /// (without overloading).
  DISJUNCTIVE_TASK_DECLARE("desugared",
                           "Default the removal of syntactic sugar "
                           "from the AST to Tiger (without overloading)",
                           " assert-desugar"
                           " desugar");

  /// Remove syntactic sugar from the Ast.
  TASK_DECLARE("desugar", "desugar the AST", desugar, "types-compute rename");

  /* FIXME: Careful with this options (and with
     --raw-bounds-checks-add), as they leave the AST in a bad state
     (without bindings nor types).  For instance,

     tc --raw-desugar -H  will probably result in a SEGV.

     since hir-compute wants a type-checked AST. */

  /// Remove syntactic sugar from the AST without recomputing
  /// bindings nor types.
  TASK_DECLARE("raw-desugar",
               "desugar the AST without recomputing "
               "bindings nor types",
               raw_desugar,
               "typed rename");

  /*-----------------------.
    | Array bounds checking.  |
    `-----------------------*/

  /// Enable emission of dynamic array bounds checking code.
  TASK_DECLARE("bounds-checks-add",
               "add dynamic bounds checks",
               bounds_checks_add,
               "types-compute rename");

  /// Enable emission of dynamic array bounds checking code without
  /// recomputing bindings nor types.
  TASK_DECLARE("raw-bounds-checks-add",
               "add bounds-checking to the AST without recomputing "
               "bindings nor types",
               raw_bounds_checks_add,
               "typed rename");

} // namespace desugar::tasks