diff options
author | Magnus Lång <[email protected]> | 2016-03-30 18:42:52 +0200 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-08-30 17:17:59 +0200 |
commit | 7dd26f1dbbb85af96c80a9a2f272150ba52b0a56 (patch) | |
tree | a8a2011b287c2e40a7fe87e8689342764511d8c7 | |
parent | 522c00d0fb8157cfe19861f158c6e67e6b67c968 (diff) | |
download | otp-7dd26f1dbbb85af96c80a9a2f272150ba52b0a56.tar.gz otp-7dd26f1dbbb85af96c80a9a2f272150ba52b0a56.tar.bz2 otp-7dd26f1dbbb85af96c80a9a2f272150ba52b0a56.zip |
hipe_ppc: Be resilient to crappy RTL
The PowerPC backend crashes if certain RTL optimisations were omitted,
preventing it from being usable at lower optimisation levels.
-rw-r--r-- | lib/hipe/ppc/hipe_rtl_to_ppc.erl | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/hipe/ppc/hipe_rtl_to_ppc.erl b/lib/hipe/ppc/hipe_rtl_to_ppc.erl index a994659616..a01e67a789 100644 --- a/lib/hipe/ppc/hipe_rtl_to_ppc.erl +++ b/lib/hipe/ppc/hipe_rtl_to_ppc.erl @@ -1031,7 +1031,7 @@ conv_return(I, Map, Data) -> {I2, Map0, Data}. conv_store(I, Map, Data) -> - {Base1, Map0} = conv_dst(hipe_rtl:store_base(I), Map), + {Base1, Map0} = conv_src(hipe_rtl:store_base(I), Map), {Src, Map1} = conv_src(hipe_rtl:store_src(I), Map0), {Base2, Map2} = conv_src(hipe_rtl:store_offset(I), Map1), StoreSize = hipe_rtl:store_size(I), @@ -1056,13 +1056,28 @@ mk_store(Src, Base1, Base2, StoreSize) -> end. mk_store2(Src, Base1, Base2, StOp) -> - case hipe_ppc:is_temp(Base2) of + case hipe_ppc:is_temp(Base1) of true -> - mk_store_rr(Src, Base1, Base2, StOp); + case hipe_ppc:is_temp(Base2) of + true -> + mk_store_rr(Src, Base1, Base2, StOp); + _ -> + mk_store_ri(Src, Base1, Base2, StOp) + end; _ -> - mk_store_ri(Src, Base1, Base2, StOp) + case hipe_ppc:is_temp(Base2) of + true -> + mk_store_ri(Src, Base2, Base1, StOp); + _ -> + mk_store_ii(Src, Base1, Base2, StOp) + end end. - + +mk_store_ii(Src, Base, Disp, StOp) -> + Tmp = new_untagged_temp(), + mk_li(Tmp, Base, + mk_store_ri(Src, Tmp, Disp, StOp)). + mk_store_ri(Src, Base, Disp, StOp) -> hipe_ppc:mk_store(StOp, Src, Disp, Base, 'new', []). |