From 2057282e475c72a14651c2ec4a66bfe0287a9d43 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 4 Jan 2023 15:31:04 +0100 Subject: Use more functions from Asmgen in Asmexpand. --- arm/Asmexpand.ml | 21 ++++----------------- 1 file 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; -- cgit