aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/x86
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-05-28 20:22:34 +0200
committerMagnus Lång <[email protected]>2016-09-02 15:04:45 +0200
commit85bd166647e7f260fd665eb44da9151c0d88f208 (patch)
tree84878ab624fcc22246bae89b75a6857415508539 /lib/hipe/x86
parentc2f8b61ca3682281752fa0984699214dfcbf7ccd (diff)
downloadotp-85bd166647e7f260fd665eb44da9151c0d88f208.tar.gz
otp-85bd166647e7f260fd665eb44da9151c0d88f208.tar.bz2
otp-85bd166647e7f260fd665eb44da9151c0d88f208.zip
hipe: Add hipe_regalloc_prepass
hipe_regalloc_prepass speeds up register allocation by spilling any temp that is live over a call (which clobbers all register). In order to detect these, a new function was added to the target interface; defines_all_alloc/1, that takes an instruction and returns a boolean.
Diffstat (limited to 'lib/hipe/x86')
-rw-r--r--lib/hipe/x86/hipe_x86_defuse.erl12
-rw-r--r--lib/hipe/x86/hipe_x86_registers.erl2
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/hipe/x86/hipe_x86_defuse.erl b/lib/hipe/x86/hipe_x86_defuse.erl
index 9cba6cbe4b..4455def74e 100644
--- a/lib/hipe/x86/hipe_x86_defuse.erl
+++ b/lib/hipe/x86/hipe_x86_defuse.erl
@@ -35,7 +35,7 @@
-endif.
-module(?HIPE_X86_DEFUSE).
--export([insn_def/1, insn_use/1]). %% src_use/1]).
+-export([insn_def/1, insn_defs_all/1, insn_use/1]). %% src_use/1]).
-include("../x86/hipe_x86.hrl").
%%%
@@ -64,6 +64,16 @@ insn_def(I) ->
_ -> []
end.
+
+%% @doc Answers whether instruction I defines all allocatable registers. Used by
+%% hipe_regalloc_prepass.
+-spec insn_defs_all(_) -> boolean().
+insn_defs_all(I) ->
+ case I of
+ #pseudo_call{} -> true;
+ _ -> false
+ end.
+
dst_def(Dst) ->
case Dst of
#x86_temp{} -> [Dst];
diff --git a/lib/hipe/x86/hipe_x86_registers.erl b/lib/hipe/x86/hipe_x86_registers.erl
index 179d734501..f00bbfb280 100644
--- a/lib/hipe/x86/hipe_x86_registers.erl
+++ b/lib/hipe/x86/hipe_x86_registers.erl
@@ -224,6 +224,8 @@ ret(N) ->
exit({?MODULE, ret, N})
end.
+%% Note: the fact that (allocatable() UNION allocatable_x87()) is a subset of
+%% call_clobbered() is hard-coded in hipe_x86_defuse:insn_defs_all/1
call_clobbered() ->
[{?EAX,tagged},{?EAX,untagged}, % does the RA strip the type or not?
{?EDX,tagged},{?EDX,untagged},