From 91a46bd44fb13b716df6440be5ab083c24f7621e Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 18 Mar 2013 12:59:28 +0000 Subject: For Pfreeframe, generate an "addi" over GPR1 when possible, to work around a limitation in the a3 analyzers. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2154 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- checklink/Check.ml | 8 +++++++- powerpc/PrintAsm.ml | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/checklink/Check.ml b/checklink/Check.ml index bda2a03..5821953 100644 --- a/checklink/Check.ml +++ b/checklink/Check.ml @@ -1742,11 +1742,17 @@ let rec compare_code ccode ecode pc: checker = fun fw -> end | Pfreeframe(sz, ofs) -> begin match ecode with + | ADDI(rD, rA, simm) :: es -> + OK(fw) + >>= match_iregs GPR1 rD + >>= match_iregs GPR1 rA + >>= match_z_int32 sz (exts simm) + >>= recur_simpl | LWZ(rD, rA, d) :: es -> OK(fw) >>= match_iregs GPR1 rD >>= match_iregs GPR1 rA - >>= match_z_int32 ofs (Int32.neg (exts d)) + >>= match_z_int32 ofs (exts d) >>= recur_simpl | _ -> error end diff --git a/powerpc/PrintAsm.ml b/powerpc/PrintAsm.ml index 152a4f7..fd71b14 100644 --- a/powerpc/PrintAsm.ml +++ b/powerpc/PrintAsm.ml @@ -564,8 +564,12 @@ let print_instruction oc tbl pc fallthrough = function | Pextsh(r1, r2) -> fprintf oc " extsh %a, %a\n" ireg r1 ireg r2 | Pfreeframe(sz, ofs) -> - (* Note: could also do an add on GPR1 using sz *) - fprintf oc " lwz %a, %ld(%a)\n" ireg GPR1 (camlint_of_coqint ofs) ireg GPR1 + let sz = camlint_of_coqint sz + and ofs = camlint_of_coqint ofs in + if sz < 0x8000l then + fprintf oc " addi %a, %a, %ld\n" ireg GPR1 ireg GPR1 sz + else + fprintf oc " lwz %a, %ld(%a)\n" ireg GPR1 ofs ireg GPR1 | Pfabs(r1, r2) -> fprintf oc " fabs %a, %a\n" freg r1 freg r2 | Pfadd(r1, r2, r3) -> -- cgit v1.2.3