summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2022-01-28 15:54:54 +0100
committerSon Ho2022-01-28 15:54:54 +0100
commit5155f13281aedb6af08754cded19c7150b71c843 (patch)
treebb91f5dc44e8e4edee76ab011f64768133dcb13b
parentc0d7d2847000612b75aade018e054b9a204661d5 (diff)
Cleanup a bit
Diffstat (limited to '')
-rw-r--r--src/PrintPure.ml11
-rw-r--r--src/PureMicroPasses.ml16
-rw-r--r--src/PureUtils.ml1
-rw-r--r--src/TranslateCore.ml1
4 files changed, 15 insertions, 14 deletions
diff --git a/src/PrintPure.ml b/src/PrintPure.ml
index 77e01c65..4f7b653a 100644
--- a/src/PrintPure.ml
+++ b/src/PrintPure.ml
@@ -1,7 +1,5 @@
(** This module defines printing functions for the types defined in Pure.ml *)
-open Errors
-open Identifiers
open Pure
module T = Types
module V = Values
@@ -372,13 +370,14 @@ let rec expression_to_string (fmt : ast_formatter) (indent : string)
and call_to_string (fmt : ast_formatter) (indent : string)
(indent_incr : string) (call : call) : string =
- let val_fmt = ast_to_value_formatter fmt in
let ty_fmt = ast_to_type_formatter fmt in
let tys = List.map (ty_to_string ty_fmt) call.type_params in
- (* The arguments are expressions, so this may not be perfect... (though
- * those expressions will in most cases be values) *)
+ (* The arguments are expressions, so indentation might get weird... (though
+ * those expressions will in most cases just be values) *)
let indent1 = indent ^ indent_incr in
- let args = List.map (expression_to_string fmt indent indent_incr) call.args in
+ let args =
+ List.map (expression_to_string fmt indent1 indent_incr) call.args
+ in
let all_args = List.append tys args in
let fun_id = fun_id_to_string fmt call.func in
if all_args = [] then fun_id else fun_id ^ " " ^ String.concat " " all_args
diff --git a/src/PureMicroPasses.ml b/src/PureMicroPasses.ml
index d261188f..74796e22 100644
--- a/src/PureMicroPasses.ml
+++ b/src/PureMicroPasses.ml
@@ -430,7 +430,8 @@ let apply_passes_to_def (ctx : trans_ctx) (def : fun_def) : fun_def =
(* First, find names for the variables which are unnamed *)
let def = compute_pretty_names def in
- log#ldebug (lazy ("compute_pretty_name:\n" ^ fun_def_to_string ctx def));
+ log#ldebug
+ (lazy ("compute_pretty_name:\n\n" ^ fun_def_to_string ctx def ^ "\n"));
(* TODO: we might want to leverage more the assignment meta-data, for
* aggregates for instance. *)
@@ -439,30 +440,33 @@ let apply_passes_to_def (ctx : trans_ctx) (def : fun_def) : fun_def =
(* The meta-information is now useless: remove it *)
let def = remove_meta def in
- log#ldebug (lazy ("remove_meta:\n" ^ fun_def_to_string ctx def));
+ log#ldebug (lazy ("remove_meta:\n\n" ^ fun_def_to_string ctx def ^ "\n"));
(* Add unit arguments for functions with no arguments, and change their return type.
* **Rk.**: from now onwards, the types in the AST are correct (until now,
* functions had return type `t` where they should have return type `result t`).
* Also, from now onwards, the outputs list has length 1. x*)
let def = to_monadic def in
- log#ldebug (lazy ("to_monadic:\n" ^ fun_def_to_string ctx def));
+ log#ldebug (lazy ("to_monadic:\n\n" ^ fun_def_to_string ctx def ^ "\n"));
(* Convert the unit variables to `()` if they are used as right-values or
* `_` if they are used as left values. *)
let def = unit_vars_to_unit def in
- log#ldebug (lazy ("unit_vars_to_unit:\n" ^ fun_def_to_string ctx def));
+ log#ldebug
+ (lazy ("unit_vars_to_unit:\n\n" ^ fun_def_to_string ctx def ^ "\n"));
(* Inline the useless variable reassignments *)
let inline_named_vars = true in
let def = inline_useless_var_reassignments inline_named_vars def in
log#ldebug
- (lazy ("inline_useless_var_assignments:\n" ^ fun_def_to_string ctx def));
+ (lazy
+ ("inline_useless_var_assignments:\n\n" ^ fun_def_to_string ctx def ^ "\n"));
(* Filter the unused assignments (removes the unused variables, filters
* the function calls) *)
let def = filter_unused_assignments def in
- log#ldebug (lazy ("filter_unused_assignments:\n" ^ fun_def_to_string ctx def));
+ log#ldebug
+ (lazy ("filter_unused_assignments:\n\n" ^ fun_def_to_string ctx def ^ "\n"));
(* TODO: deconstruct the monadic bindings into matches *)
diff --git a/src/PureUtils.ml b/src/PureUtils.ml
index e5ce94a0..140f4082 100644
--- a/src/PureUtils.ml
+++ b/src/PureUtils.ml
@@ -1,4 +1,3 @@
-open Identifiers
open Pure
(* TODO : move *)
diff --git a/src/TranslateCore.ml b/src/TranslateCore.ml
index 02528f9a..361cf216 100644
--- a/src/TranslateCore.ml
+++ b/src/TranslateCore.ml
@@ -1,7 +1,6 @@
(** Some utilities for the translation *)
open InterpreterStatements
-open Interpreter
module L = Logging
module T = Types
module A = CfimAst