~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/hipe/x86/hipe_x86_liveness.erl

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%% -*- erlang-indent-level: 2 -*-
1
2
%%% $Id$
2
3
%%% x86_liveness -- compute register liveness for x86 CFGs
3
4
 
4
 
-module(hipe_x86_liveness).
 
5
-ifdef(HIPE_AMD64).
 
6
-define(HIPE_X86_LIVENESS,      hipe_amd64_liveness).
 
7
-define(HIPE_X86_DEFUSE,        hipe_amd64_defuse).
 
8
-define(HIPE_X86_REGISTERS,     hipe_amd64_registers).
 
9
-else.
 
10
-define(HIPE_X86_LIVENESS,      hipe_x86_liveness).
 
11
-define(HIPE_X86_DEFUSE,        hipe_x86_defuse).
 
12
-define(HIPE_X86_REGISTERS,     hipe_x86_registers).
 
13
-endif.
 
14
 
 
15
-module(?HIPE_X86_LIVENESS).
5
16
-export([analyse/1]).
6
 
-include("../util/hipe_vector.hrl").
 
17
-export([liveout/2]).
7
18
-include("../flow/liveness.inc").
8
19
 
9
20
analyse(CFG) -> analyze(CFG).
10
 
cfg_bb(CFG,L) -> hipe_x86_cfg:bb(CFG,L).
 
21
cfg_bb(CFG, L) -> hipe_x86_cfg:bb(CFG, L).
11
22
cfg_postorder(CFG) -> hipe_x86_cfg:postorder(CFG).
 
23
cfg_succ_map(CFG) -> hipe_x86_cfg:succ_map(CFG).
 
24
cfg_succ(CFG, L) -> hipe_x86_cfg:succ(CFG, L).
 
25
uses(Insn) -> ?HIPE_X86_DEFUSE:insn_use(Insn).
 
26
defines(Insn) -> ?HIPE_X86_DEFUSE:insn_def(Insn).
 
27
liveout_no_succ() ->
 
28
  ordsets:from_list(lists:map(fun({Reg,Type}) ->
 
29
                                  hipe_x86:mk_temp(Reg, Type)
 
30
                              end,
 
31
                              ?HIPE_X86_REGISTERS:live_at_return())).
 
32
 
 
33
-ifdef(DEBUG_LIVENESS).
12
34
cfg_labels(CFG) -> hipe_x86_cfg:labels(CFG).
13
 
cfg_succ_map(CFG) -> hipe_x86_cfg:succ_map(CFG).
14
 
cfg_succ(CFG,L) -> hipe_x86_cfg:succ(CFG,L).
15
 
cfg_bb_update(CFG,L,NewBB) -> hipe_x86_cfg:bb_update(CFG,L,NewBB).
16
 
uses(Insn) -> hipe_x86_defuse:insn_use(Insn).
17
 
defines(Insn) -> hipe_x86_defuse:insn_def(Insn).
 
35
cfg_bb_add(CFG,L,NewBB) -> hipe_x86_cfg:bb_add(CFG,L,NewBB).
18
36
mk_comment(Text) -> hipe_x86:mk_comment(Text).
19
 
liveout_no_succ() ->
20
 
    ordsets:from_list(lists:map(fun({Reg,Type}) -> hipe_x86:mk_temp(Reg,Type) end,
21
 
                                hipe_x86_registers:live_at_return())).
 
37
-endif.