Skip to content

Commit c40be98

Browse files
committed
WIword_of_int -> WIwint_of_int
1 parent e746cba commit c40be98

File tree

8 files changed

+32
-38
lines changed

8 files changed

+32
-38
lines changed

compiler/safetylib/safetyAbsExpr.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ let remove_Owi2 o =
9696

9797
let rec remove_Owi1 sg o e =
9898
match o with
99-
| E.WIword_of_int sz -> Papp1(E.Oword_of_int sz, e)
100-
| E.WIint_of_word sz -> Papp1(E.Oint_of_word(sg, sz), e)
99+
| E.WIwint_of_int sz -> Papp1(E.Oword_of_int sz, e)
100+
| E.WIint_of_wint sz -> Papp1(E.Oint_of_word(sg, sz), e)
101101
| E.WIword_of_wint _ -> remove_Owi e
102102
| E.WIwint_of_word _ -> remove_Owi e
103-
| E.WIword_ext(szo, szi) ->
103+
| E.WIwint_ext(szo, szi) ->
104104
let o = if sg = Signed then E.Osignext(szo, szi) else E.Ozeroext(szo, szi) in
105105
Papp1(o, e)
106106
| E.WIneg sz -> Papp1(E.Oneg (Op_w sz), e)

compiler/safetylib/safetyInterpreter.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ let safe_op1 o e1 =
279279
match o with
280280
| E.Owi1(sg, o) ->
281281
begin match o with
282-
| E.WIword_of_int sz -> [in_wint_range sg sz e1]
283-
| E.WIint_of_word sz -> []
282+
| E.WIwint_of_int sz -> [in_wint_range sg sz e1]
283+
| E.WIint_of_wint sz -> []
284284
| E.WIword_of_wint _ -> []
285285
| E.WIwint_of_word _ -> []
286-
| E.WIword_ext(szo, szi) -> [] (* Check this ! *)
286+
| E.WIwint_ext(szo, szi) -> [] (* Check this ! *)
287287
| E.WIneg sz ->
288288
if sg = Signed then [NotEqual(None, wint_to_int sg sz e1, Pconst (Z.neg (half_modulus sz)))]
289289
else [InRange(Pconst Z.zero, Pconst Z.zero, wint_to_int sg sz e1)]

compiler/src/pretyping.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1031,12 +1031,12 @@ let wk_s_ws (s: W.signedness option) (ws: W.wsize) =
10311031
let op_word_of_int (wk, s, ws) =
10321032
match wk with
10331033
| Word -> E.Oword_of_int ws
1034-
| WInt -> E.Owi1(s, E.WIword_of_int ws)
1034+
| WInt -> E.Owi1(s, E.WIwint_of_int ws)
10351035

10361036
let op_int_of_word (wk, s, ws) =
10371037
match wk with
10381038
| Word -> E.Oint_of_word (s, ws)
1039-
| WInt -> E.Owi1(s, E.WIint_of_word ws)
1039+
| WInt -> E.Owi1(s, E.WIint_of_wint ws)
10401040

10411041
let cast loc e ety ty =
10421042
match ety, ty with
@@ -1294,7 +1294,7 @@ let rec tt_expr pd ?(mode=`AllVar) (env : 'asm Env.env) pe =
12941294
s, wie, P.etwi s ws
12951295
| `WInt s, P.ETint ->
12961296
let s = tt_sign s in
1297-
s, Papp1(E.Owi1(s, E.WIword_of_int sz), e), P.etwi s sz
1297+
s, Papp1(E.Owi1(s, E.WIwint_of_int sz), e), P.etwi s sz
12981298
| _ -> rs_tyerror ~loc:(L.loc pe) (InvalidCast(ety,rty))
12991299
in
13001300
(* ensures that the size is the expected *)
@@ -1304,9 +1304,9 @@ let rec tt_expr pd ?(mode=`AllVar) (env : 'asm Env.env) pe =
13041304
let op = if s = W.Unsigned then E.Ozeroext(sz, ws) else E.Osignext(sz, ws) in
13051305
P.Papp1(op, e)
13061306
| P.ETword(Some W.Unsigned, ws) when W.wsize_cmp ws sz = Datatypes.Lt ->
1307-
P.Papp1(E.Owi1(s, E.WIword_ext(sz, ws)), e)
1307+
P.Papp1(E.Owi1(s, E.WIwint_ext(sz, ws)), e)
13081308
| P.ETword(Some W.Signed, ws) ->
1309-
P.Papp1(E.Owi1(s, E.WIword_ext(sz, ws)), e)
1309+
P.Papp1(E.Owi1(s, E.WIwint_ext(sz, ws)), e)
13101310
| _ -> e
13111311
in
13121312
e, rty

compiler/src/printCommon.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ let string_of_wi_cast sg sz =
6363
asprintf "%d%s" (int_of_ws sz) (string_of_wi sg)
6464

6565
let string_of_wiop1 sg = function
66-
| E.WIword_of_int sz ->
66+
| E.WIwint_of_int sz ->
6767
asprintf "(%s /* of int */)" (string_of_wi_cast sg sz)
68-
| WIint_of_word sz ->
68+
| WIint_of_wint sz ->
6969
asprintf "(%s /* of %s */)" (string_of_int_cast sg) (string_of_wi_ty sg sz)
7070
| WIword_of_wint sz ->
7171
asprintf "(%s /* of %s */)" (string_of_w_cast sz) (string_of_wi_ty sg sz)
7272
| WIwint_of_word sz ->
7373
asprintf "(%s /* of %s */)" (string_of_wi_cast sg sz) (string_of_w_ty sz)
74-
| WIword_ext(szo, _) ->
74+
| WIwint_ext(szo, _) ->
7575
asprintf "(%s)" (string_of_wi_cast sg szo)
7676
| WIneg sz ->
7777
asprintf "-%s" (string_of_wi_cast sg sz)

proofs/compiler/wint_int.v

+3-9
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,15 @@ Definition esubtype (ty1 ty2 : extended_type positive) :=
7878
| _, _ => false
7979
end.
8080

81-
(*Definition word_of_int sg ws e :=
82-
match e with
83-
| Papp1 (Oint_of_word sg' ws') e1 => if (sg == sg') && (ws == ws') then e1 else Papp1 (Oword_of_int ws) e
84-
| _ => Papp1 (Oword_of_int ws) e
85-
end.*)
86-
8781
Definition wi2i_op1_e (o : sop1) (e : pexpr) :=
8882
match is_wi1 o with
8983
| Some (s, o) =>
9084
match o with
91-
| WIword_of_int ws => e
92-
| WIint_of_word ws => e
85+
| WIwint_of_int ws => e
86+
| WIint_of_wint ws => e
9387
| WIword_of_wint ws => Papp1 (Oword_of_int ws) e
9488
| WIwint_of_word ws => Papp1 (Oint_of_word s ws) e
95-
| WIword_ext szo szi =>
89+
| WIwint_ext szo szi =>
9690
Papp1 (Oint_of_word s szo)
9791
(Papp1 (signed (Ozeroext szo szi) (Osignext szo szi) s)
9892
(Papp1 (Oword_of_int szi) e))

proofs/compiler/wint_word.v

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ Context `{asmop:asmOp}.
1717

1818
Definition wi2w_wiop1 s (o : wiop1) (e : pexpr) : pexpr :=
1919
match o with
20-
| WIword_of_int sz => Papp1 (Oword_of_int sz) e
21-
| WIint_of_word sz => Papp1 (Oint_of_word s sz) e
20+
| WIwint_of_int sz => Papp1 (Oword_of_int sz) e
21+
| WIint_of_wint sz => Papp1 (Oint_of_word s sz) e
2222
| WIword_of_wint _ => e
2323
| WIwint_of_word _ => e
24-
| WIword_ext sz1 sz2 =>
24+
| WIwint_ext sz1 sz2 =>
2525
let o := if s is Unsigned then Ozeroext sz1 sz2 else Osignext sz1 sz2 in
2626
Papp1 o e
2727
| WIneg sz => Papp1 (Oneg (Op_w sz)) e

proofs/lang/expr.v

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ Variant op_kind :=
2929
| Op_w of wsize.
3030

3131
Variant wiop1 :=
32-
| WIword_of_int of wsize (* int → word *)
33-
| WIint_of_word of wsize (* word/uint/sint → int, signed or unsigned interpretation *)
32+
| WIwint_of_int of wsize (* int → word *)
33+
| WIint_of_wint of wsize (* word/uint/sint → int, signed or unsigned interpretation *)
3434
| WIword_of_wint of wsize (* uint/sint -> word *)
3535
| WIwint_of_word of wsize (* word -> uint/sint *)
36-
| WIword_ext of wsize & wsize (* Sign-extension: output-size, input-size *)
36+
| WIwint_ext of wsize & wsize (* Sign-extension: output-size, input-size *)
3737
| WIneg of wsize
3838
.
3939

@@ -176,21 +176,21 @@ HB.instance Definition _ := hasDecEq.Build opN opN_eq_axiom.
176176
(* Type of unany operators: input, output *)
177177
Definition etype_of_wiop1 {len:Type} (s: signedness) (o:wiop1) : extended_type len * extended_type len :=
178178
match o with
179-
| WIword_of_int sz => (tint, twint s sz)
180-
| WIint_of_word sz => (twint s sz, tint)
179+
| WIwint_of_int sz => (tint, twint s sz)
180+
| WIint_of_wint sz => (twint s sz, tint)
181181
| WIword_of_wint sz => (twint s sz, tword sz)
182182
| WIwint_of_word sz => (tword sz, twint s sz)
183-
| WIword_ext szo szi => (twint s szi, twint s szo)
183+
| WIwint_ext szo szi => (twint s szi, twint s szo)
184184
| WIneg sz => (twint s sz, twint s sz)
185185
end.
186186

187187
Definition type_of_wiop1 (o:wiop1) : stype * stype :=
188188
match o with
189-
| WIword_of_int sz => (sint, sword sz)
190-
| WIint_of_word sz => (sword sz, sint)
189+
| WIwint_of_int sz => (sint, sword sz)
190+
| WIint_of_wint sz => (sword sz, sint)
191191
| WIword_of_wint sz => (sword sz, sword sz)
192192
| WIwint_of_word sz => (sword sz, sword sz)
193-
| WIword_ext szo szi => (sword szi, sword szo)
193+
| WIwint_ext szo szi => (sword szi, sword szo)
194194
| WIneg sz => (sword sz, sword sz)
195195
end.
196196

proofs/lang/sem_op_typed.v

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Definition sem_wiop1_typed (sign : signedness) (o: wiop1) :
1212
let t := type_of_wiop1 o in
1313
sem_t t.1 → exec (sem_t t.2) :=
1414
match o return let t := type_of_wiop1 o in sem_t t.1 → exec (sem_t t.2) with
15-
| WIword_of_int sz => wint_of_int sign sz
16-
| WIint_of_word sz => mk_sem_sop1 (@int_of_word sign sz)
15+
| WIwint_of_int sz => wint_of_int sign sz
16+
| WIint_of_wint sz => mk_sem_sop1 (@int_of_word sign sz)
1717

1818
| WIword_of_wint sz => mk_sem_sop1 (fun (w:word sz) => w)
1919
| WIwint_of_word sz => mk_sem_sop1 (fun (w:word sz) => w)
2020

21-
| WIword_ext szo szi => mk_sem_sop1 (@sem_word_extend sign szo szi)
21+
| WIwint_ext szo szi => mk_sem_sop1 (@sem_word_extend sign szo szi)
2222

2323
| WIneg sz => fun (w: word sz) => wint_of_int sign sz (- int_of_word sign w)
2424
end.

0 commit comments

Comments
 (0)