Skip to content

Commit 8c2e9c2

Browse files
committed
Update clightgen to the new annotations and the new inline asm.
1 parent 0bf9921 commit 8c2e9c2

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

exportclight/Clightgen.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ let parse_c_file sourcename ifile =
112112
in
113113
(* Parsing and production of a simplified C AST *)
114114
let ast =
115-
match Parse.preprocessed_file simplifs sourcename ifile with
115+
match fst (Parse.preprocessed_file simplifs sourcename ifile) with
116116
| None -> exit 2
117117
| Some p -> p in
118118
(* Save C AST if requested *)

exportclight/ExportClight.ml

+9-24
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,7 @@ let signatur p sg =
233233
(print_option asttype) sg.sig_res
234234
callconv sg.sig_cc
235235

236-
let assertions = ref ([]: (ident * annot_arg list) list)
237-
238-
let annot_arg p = function
239-
| AA_arg ty ->
240-
fprintf p "AA_arg %a" asttype ty
241-
| AA_int n ->
242-
fprintf p "AA_int %a" coqint n
243-
| AA_float n ->
244-
fprintf p "AA_float %a" coqfloat n
236+
let assertions = ref ([]: (ident * typ list) list)
245237

246238
let external_function p = function
247239
| EF_external(name, sg) ->
@@ -262,12 +254,15 @@ let external_function p = function
262254
fprintf p "(EF_memcpy %ld %ld)" (Z.to_int32 sz) (Z.to_int32 al)
263255
| EF_annot(text, targs) ->
264256
assertions := (text, targs) :: !assertions;
265-
fprintf p "(EF_annot %ld%%positive %a)" (P.to_int32 text) (print_list annot_arg) targs
257+
fprintf p "(EF_annot %ld%%positive %a)" (P.to_int32 text) (print_list asttype) targs
266258
| EF_annot_val(text, targ) ->
267-
assertions := (text, [AA_arg targ]) :: !assertions;
259+
assertions := (text, [targ]) :: !assertions;
268260
fprintf p "(EF_annot_val %ld%%positive %a)" (P.to_int32 text) asttype targ
269-
| EF_inline_asm(text) ->
270-
fprintf p "(EF_inline_asm %ld%%positive)" (P.to_int32 text)
261+
| EF_inline_asm(text, sg, clob) ->
262+
fprintf p "@[<hov 2>(EF_inline_asm %ld%%positive@ %a@ %a)@]"
263+
(P.to_int32 text)
264+
signatur sg
265+
(print_list ident) clob
271266

272267
(* Expressions *)
273268

@@ -461,19 +456,9 @@ let print_assertion p (txt, targs) =
461456
frags;
462457
fprintf p " | %ld%%positive, " (P.to_int32 txt);
463458
list_iteri
464-
(fun i targ ->
465-
match targ with
466-
| AA_arg _ -> fprintf p "_x%d :: " (i + 1)
467-
| _ -> ())
459+
(fun i targ -> fprintf p "_x%d :: " (i + 1))
468460
targs;
469461
fprintf p "nil =>@ ";
470-
list_iteri
471-
(fun i targ ->
472-
match targ with
473-
| AA_arg _ -> ()
474-
| AA_int n -> fprintf p " let _x%d := %a in@ " (i + 1) coqint n
475-
| AA_float n -> fprintf p " let _x%d := %a in@ " (i + 1) coqfloat n)
476-
targs;
477462
fprintf p " ";
478463
List.iter
479464
(function

0 commit comments

Comments
 (0)