File: hipe_x86_liveness.erl

package info (click to toggle)
erlang 1%3A11.b.2-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 54,332 kB
  • ctags: 138,013
  • sloc: erlang: 566,932; ansic: 185,450; makefile: 14,148; java: 7,835; sh: 7,307; lisp: 5,249; pascal: 3,225; perl: 2,290; asm: 1,325; cpp: 306; tcl: 245; csh: 29; python: 21; sed: 9
file content (37 lines) | stat: -rw-r--r-- 1,202 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
%%% -*- erlang-indent-level: 2 -*-
%%% $Id$
%%% x86_liveness -- compute register liveness for x86 CFGs

-ifdef(HIPE_AMD64).
-define(HIPE_X86_LIVENESS,	hipe_amd64_liveness).
-define(HIPE_X86_DEFUSE,	hipe_amd64_defuse).
-define(HIPE_X86_REGISTERS,	hipe_amd64_registers).
-else.
-define(HIPE_X86_LIVENESS,	hipe_x86_liveness).
-define(HIPE_X86_DEFUSE,	hipe_x86_defuse).
-define(HIPE_X86_REGISTERS,	hipe_x86_registers).
-endif.

-module(?HIPE_X86_LIVENESS).
-export([analyse/1]).
-export([liveout/2]).
-include("../flow/liveness.inc").

analyse(CFG) -> analyze(CFG).
cfg_bb(CFG, L) -> hipe_x86_cfg:bb(CFG, L).
cfg_postorder(CFG) -> hipe_x86_cfg:postorder(CFG).
cfg_succ_map(CFG) -> hipe_x86_cfg:succ_map(CFG).
cfg_succ(CFG, L) -> hipe_x86_cfg:succ(CFG, L).
uses(Insn) -> ?HIPE_X86_DEFUSE:insn_use(Insn).
defines(Insn) -> ?HIPE_X86_DEFUSE:insn_def(Insn).
liveout_no_succ() ->
  ordsets:from_list(lists:map(fun({Reg,Type}) ->
				  hipe_x86:mk_temp(Reg, Type)
			      end,
			      ?HIPE_X86_REGISTERS:live_at_return())).

-ifdef(DEBUG_LIVENESS).
cfg_labels(CFG) -> hipe_x86_cfg:labels(CFG).
cfg_bb_add(CFG,L,NewBB) -> hipe_x86_cfg:bb_add(CFG,L,NewBB).
mk_comment(Text) -> hipe_x86:mk_comment(Text).
-endif.