diff options
| author | Robert Norton | 2017-04-06 12:34:49 +0100 |
|---|---|---|
| committer | Robert Norton | 2017-04-06 12:35:11 +0100 |
| commit | d716893e137a41638b449162dc8b5c682eb7f4d4 (patch) | |
| tree | 485bc65b832df155ce7c5cb259f60127d2932240 /src | |
| parent | 22a5dd79b302a7da4170f58d0c54115c1d4a69ac (diff) | |
use set_register when writing element of vector of registers to avoid accidentally replacing Vregister with Vvalue or Vregister... Seems to work for MIPS but not sure if might encounter vector of something other than bit or register. A more specific value type would have made this a compile-time error rather than run-time.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pretty_print_ocaml.ml | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pretty_print_ocaml.ml b/src/pretty_print_ocaml.ml index 47aacf0c..5df8691e 100644 --- a/src/pretty_print_ocaml.ml +++ b/src/pretty_print_ocaml.ml @@ -479,10 +479,13 @@ let doc_exp_ocaml, doc_let_ocaml = | _ -> (false,false) in match lexp with | LEXP_vector(v,e) -> - doc_op (string "<-") - (group (parens ((string (if is_bit then "get_barray" else "get_varray")) ^^ space ^^ doc_lexp_ocaml false v)) ^^ - dot ^^ parens ((string "int_of_big_int") ^^ space ^^ (exp e))) - (exp e_new_v) + if is_bit then + doc_op (string "<-") (group (parens (string "get_barray" ^^ space ^^ doc_lexp_ocaml false v)) ^^ + dot ^^ parens ((string "int_of_big_int") ^^ space ^^ (exp e))) (exp e_new_v) + else (* XXX Check whether vector of reg? *) + parens ((string "set_register") ^^ space ^^ + ((group (parens ((string "get_varray") ^^ space ^^ doc_lexp_ocaml false v)) ^^ + dot ^^ parens ((string "int_of_big_int") ^^ space ^^ (exp e))) ^^ space ^^ (exp e_new_v))) | LEXP_vector_range(v,e1,e2) -> parens ((string (if is_bitv then "set_vector_subrange_bit" else "set_vector_subrange_vec")) ^^ space ^^ doc_lexp_ocaml false v ^^ space ^^ exp e1 ^^ space ^^ exp e2 ^^ space ^^ exp e_new_v) |
