diff options
author | Magnus Lång <[email protected]> | 2016-03-30 18:28:30 +0200 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-08-30 17:17:59 +0200 |
commit | 522c00d0fb8157cfe19861f158c6e67e6b67c968 (patch) | |
tree | f935ee3c08eeff96eaecf4b8fe71ef5cac4f46dd /lib/hipe/sparc | |
parent | c7a0cd1b5710178878d9b240f634e9eda7e68d96 (diff) | |
download | otp-522c00d0fb8157cfe19861f158c6e67e6b67c968.tar.gz otp-522c00d0fb8157cfe19861f158c6e67e6b67c968.tar.bz2 otp-522c00d0fb8157cfe19861f158c6e67e6b67c968.zip |
hipe_sparc: Be resilient to crappy RTL
The SPARC backend crashes if certain RTL optimisations were omitted,
preventing it from being usable at lower optimisation levels.
Diffstat (limited to 'lib/hipe/sparc')
-rw-r--r-- | lib/hipe/sparc/hipe_rtl_to_sparc.erl | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/hipe/sparc/hipe_rtl_to_sparc.erl b/lib/hipe/sparc/hipe_rtl_to_sparc.erl index eef5ba8d96..b1d56e6ab5 100644 --- a/lib/hipe/sparc/hipe_rtl_to_sparc.erl +++ b/lib/hipe/sparc/hipe_rtl_to_sparc.erl @@ -625,7 +625,7 @@ conv_return(I, Map, Data) -> {I2, Map0, Data}. conv_store(I, Map, Data) -> - {Base1, Map0} = conv_dst(hipe_rtl:store_base(I), Map), % no immediates allowed + {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), StOp = conv_stop(hipe_rtl:store_size(I)), @@ -649,13 +649,27 @@ mk_store(StOp, Src, Base1, Base2) -> end. mk_store2(StOp, Src, Base1, Base2) -> - case hipe_sparc:is_temp(Base2) of + case hipe_sparc:is_temp(Base1) of true -> - mk_store_rr(StOp, Src, Base1, Base2); + case hipe_sparc:is_temp(Base2) of + true -> + mk_store_rr(StOp, Src, Base1, Base2); + _ -> + mk_store_ri(StOp, Src, Base1, Base2) + end; _ -> - mk_store_ri(StOp, Src, Base1, Base2) + case hipe_sparc:is_temp(Base2) of + true -> + mk_store_ri(StOp, Src, Base2, Base1); + _ -> + mk_store_ii(StOp, Src, Base1, Base2) + end end. +mk_store_ii(StOp, Src, Base, Disp) -> + Tmp = new_untagged_temp(), + mk_set(Base, Tmp, mk_store_ri(StOp, Src, Tmp, Disp)). + mk_store_ri(StOp, Src, Base, Disp) -> hipe_sparc:mk_store(StOp, Src, Base, Disp, 'new', []). |