aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/x86/hipe_x86_main.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-03-17 21:37:26 +0100
committerMagnus Lång <[email protected]>2016-08-30 17:17:45 +0200
commitdc4e9384c6f2f733ab0d12727ab53238bda3fbca (patch)
tree55c4d84effc98ae0bffbd9b7bc185d2d0a602ba6 /lib/hipe/x86/hipe_x86_main.erl
parent4b8c17b0901dfa356792c36f01d78de827cb6645 (diff)
downloadotp-dc4e9384c6f2f733ab0d12727ab53238bda3fbca.tar.gz
otp-dc4e9384c6f2f733ab0d12727ab53238bda3fbca.tar.bz2
otp-dc4e9384c6f2f733ab0d12727ab53238bda3fbca.zip
hipe_x86: Minimise CFG<->linear conversions
Most x86 passes were either linearise(pass(to_cfg(Code))) or trivially rewritable to process a CFG. This saves a great deal of time and memory churn when compiling large programs. Now, there will only ever be a single Linear->CFG conversion, just after lowering from RTL, and only ever a single CFG->Linear conversion, just before the finalise pass. Both of these now happen in hipe_x86_main.
Diffstat (limited to 'lib/hipe/x86/hipe_x86_main.erl')
-rw-r--r--lib/hipe/x86/hipe_x86_main.erl22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/hipe/x86/hipe_x86_main.erl b/lib/hipe/x86/hipe_x86_main.erl
index 13b0bb6b28..341269b698 100644
--- a/lib/hipe/x86/hipe_x86_main.erl
+++ b/lib/hipe/x86/hipe_x86_main.erl
@@ -53,19 +53,23 @@
?RTL_TO_X86(MFA, RTL, Options) ->
Translated = ?option_time(?HIPE_RTL_TO_X86:translate(RTL),
"RTL-to-"?X86STR, Options),
- SpillRest =
+ TransCFG = ?option_time(hipe_x86_cfg:init(Translated),
+ ?X86STR" to cfg", Options),
+ SpillRestCFG =
case proplists:get_bool(caller_save_spill_restore, Options) of
true ->
- ?option_time(?HIPE_X86_SPILL_RESTORE:spill_restore(Translated, Options),
+ ?option_time(?HIPE_X86_SPILL_RESTORE:spill_restore(TransCFG, Options),
?X86STR" spill restore", Options);
false ->
- Translated
+ TransCFG
end,
- Allocated = ?option_time(?HIPE_X86_RA:ra(SpillRest, Options),
- ?X86STR" register allocation", Options),
- Framed = ?option_time(?HIPE_X86_FRAME:frame(Allocated, Options),
- ?X86STR" frame", Options),
- Finalised = ?option_time(hipe_x86_postpass:postpass(Framed, Options),
- ?X86STR" finalise", Options),
+ AllocatedCFG = ?option_time(?HIPE_X86_RA:ra(SpillRestCFG, Options),
+ ?X86STR" register allocation", Options),
+ FramedCFG = ?option_time(?HIPE_X86_FRAME:frame(AllocatedCFG, Options),
+ ?X86STR" frame", Options),
+ Framed = ?option_time(hipe_x86_cfg:linearise(FramedCFG),
+ ?X86STR" linearise", Options),
+ Finalised = ?option_time(hipe_x86_postpass:postpass(Framed, Options),
+ ?X86STR" finalise", Options),
?HIPE_X86_PP:optional_pp(Finalised, MFA, Options),
{native, ?X86TAG, {unprofiled, Finalised}}.