From 84c3580d0514c24a7c29eeec635e16183c3c5c65 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 21 Aug 2015 15:35:13 +0200 Subject: Simplify the handling of extended inline asm, taking advantage of the new, structured builtin arguments and results. --- cparser/ExtendedAsm.ml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'cparser/ExtendedAsm.ml') diff --git a/cparser/ExtendedAsm.ml b/cparser/ExtendedAsm.ml index fbf8d569..05084561 100644 --- a/cparser/ExtendedAsm.ml +++ b/cparser/ExtendedAsm.ml @@ -57,10 +57,9 @@ let set_label_reg lbl pos pos' subst = have this feature and with which syntax. *) let set_label_regpair lbl pos pos' subst = - StringMap.add (name_of_label ~modifier:"R" lbl pos) (sprintf "%%%d" pos') - (StringMap.add (name_of_label ~modifier:"Q" lbl pos) - (sprintf "%%%d" (pos' + 1)) - subst) + StringMap.add (name_of_label ~modifier:"R" lbl pos) (sprintf "%%R%d" pos') + (StringMap.add (name_of_label ~modifier:"Q" lbl pos) (sprintf "%%Q%d" pos') + subst) let set_label_mem lbl pos pos' subst = StringMap.add (name_of_label lbl pos) @@ -91,7 +90,7 @@ let rec transf_inputs loc env accu pos pos' subst = function let valid = Str.string_match re_valid_input cstr 0 in if valid && String.contains cstr 'r' then if is_reg_pair env e.etyp then - transf_inputs loc env (e :: accu) (pos + 1) (pos' + 2) + transf_inputs loc env (e :: accu) (pos + 1) (pos' + 1) (set_label_regpair lbl pos pos' subst) inputs else transf_inputs loc env (e :: accu) (pos + 1) (pos' + 1) @@ -133,7 +132,7 @@ let transf_outputs loc env = function let valid = Str.string_match re_valid_output cstr 0 in if valid && String.contains cstr 'r' then if is_reg_pair env e.etyp then - (Some e, [], set_label_regpair lbl 0 0 StringMap.empty, 1, 2) + (Some e, [], set_label_regpair lbl 0 0 StringMap.empty, 1, 1) else (Some e, [], set_label_reg lbl 0 0 StringMap.empty, 1, 1) else -- cgit