File: hipe_sparc_liveness.erl

package info (click to toggle)
erlang 1%3A12.b.3-dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 77,780 kB
  • ctags: 157,528
  • sloc: erlang: 664,178; ansic: 241,119; makefile: 15,725; xml: 8,378; java: 7,780; sh: 6,789; lisp: 5,396; pascal: 3,637; perl: 2,310; asm: 1,438; cpp: 975; tcl: 245; python: 21; sed: 20; awk: 15
file content (69 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download | duplicates (2)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% LIVENESS ANALYSIS
%%
%% Exports:
%% ~~~~~~~
%% analyze(CFG) - returns a liveness analysis of CFG.
%% liveout(Liveness, Label) - returns a set of variables that are live at
%%      exit from basic block named Label.
%% livein(Liveness, Label) - returns a set of variables that are live at
%%      entry to the basic block named Label.
%% list(Instructions, LiveOut) - Given a list of instructions and a liveout-set,
%%      returns a set of variables live at the first instruction.

-module(hipe_sparc_liveness).

%% The following, is addition to all exports of liveness.inc
-export([update_livein/3]).

-define(LIVEOUT_NEEDED,true).   % needed for liveness.inc below.

-include("../flow/liveness.inc").

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Interface to CFG and SPARC.
%%

cfg_bb(CFG, L) ->
  hipe_sparc_cfg:bb(CFG, L).

cfg_postorder(CFG) ->
  hipe_sparc_cfg:postorder(CFG).

cfg_succ_map(CFG) ->
  hipe_sparc_cfg:succ_map(CFG).

cfg_succ(CFG, L) ->
  hipe_sparc_cfg:succ(CFG, L).

uses(Instr) ->
  hipe_sparc:uses(Instr).

defines(Instr) ->
  hipe_sparc:defines(Instr).

%%
%% This is the list of registers that are live at exit from a function
%%

liveout_no_succ() ->
  ordsets:from_list(lists:map(fun(R) -> hipe_sparc:mk_reg(R) end,
		     hipe_sparc_registers:global())).

%%
%% The following are used only if annotation of the code is requested.
%%
-ifdef(DEBUG_LIVENESS).

cfg_labels(CFG) ->
  hipe_sparc_cfg:labels(CFG).

cfg_bb_add(CFG, L, NewBB) ->
  hipe_sparc_cfg:bb_add(CFG, L, NewBB).

mk_comment(Text) ->
  hipe_sparc:comment_create(Text, []).

-endif.