aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2023-01-04 15:31:04 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2023-02-20 13:29:04 +0100
commit2057282e475c72a14651c2ec4a66bfe0287a9d43 (patch)
tree165a3d863e227e1324e59a8a507053883754cb4a
parent0286b9572d6f79a2821647052c0d78dc23fa3f30 (diff)
downloadcompcert-2057282e475c72a14651c2ec4a66bfe0287a9d43.tar.gz
compcert-2057282e475c72a14651c2ec4a66bfe0287a9d43.zip
Use more functions from Asmgen in Asmexpand.
-rw-r--r--arm/Asmexpand.ml21
1 files changed, 4 insertions, 17 deletions
diff --git a/arm/Asmexpand.ml b/arm/Asmexpand.ml
index 79491861..a3f6187c 100644
--- a/arm/Asmexpand.ml
+++ b/arm/Asmexpand.ml
@@ -37,29 +37,16 @@ let _64 = coqint_of_camlint 64l
(* No S suffix because they are applied to SP most of the time. *)
let expand_movimm dst n =
- match Asmgen.decompose_int n with
- | [] -> assert false
- | hd::tl->
- emit (Pmov (dst,SOimm hd));
- List.iter
- (fun n -> emit (Porr (dst,dst, SOimm n))) tl
+ List.iter emit (Asmgen.loadimm dst n [])
let expand_subimm dst src n =
if dst <> src || n <> _0 then begin
- match Asmgen.decompose_int n with
- | [] -> assert false
- | hd::tl ->
- emit (Psub(dst,src,SOimm hd));
- List.iter (fun n -> emit (Psub (dst,dst,SOimm n))) tl
+ List.iter emit (Asmgen.addimm dst src (Int.neg n) [])
end
let expand_addimm dst src n =
if dst <> src || n <> _0 then begin
- match Asmgen.decompose_int n with
- | [] -> assert false
- | hd::tl ->
- emit (Padd (dst,src,SOimm hd));
- List.iter (fun n -> emit (Padd (dst,dst,SOimm n))) tl
+ List.iter emit (Asmgen.addimm dst src n [])
end
let expand_int64_arith conflict rl fn =
@@ -616,7 +603,7 @@ let expand_instruction instr =
then coqint_of_camlint (Int32.add 16l (camlint_of_coqint sz))
else sz in
if Asmgen.is_immed_arith sz
- then emit (Padd (IR13,IR13,SOimm sz))
+ then expand_addimm IR13 IR13 sz
else begin
if camlint_of_coqint ofs >= 4096l then begin
expand_addimm IR13 IR13 ofs;