aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/ExtendedAsm.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-08-21 15:35:13 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2015-08-21 15:35:13 +0200
commit84c3580d0514c24a7c29eeec635e16183c3c5c65 (patch)
treef4202f012faf10d41b9c0285b5fd1d2cebe21c1c /cparser/ExtendedAsm.ml
parent78808873d889608ee39fb6a9d9c0dac0335ccf47 (diff)
downloadcompcert-kvx-84c3580d0514c24a7c29eeec635e16183c3c5c65.tar.gz
compcert-kvx-84c3580d0514c24a7c29eeec635e16183c3c5c65.zip
Simplify the handling of extended inline asm, taking advantage of the new, structured builtin arguments and results.
Diffstat (limited to 'cparser/ExtendedAsm.ml')
-rw-r--r--cparser/ExtendedAsm.ml11
1 files changed, 5 insertions, 6 deletions
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