summaryrefslogtreecommitdiff
path: root/powerpc/Unusedglob1.ml
blob: 2d3efe39984a17b5b42b151edc5d42692931b062 (plain)
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
(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)

(* Identifiers referenced from a PowerPC Asm instruction *)

open Datatypes
open AST
open Asm

let referenced_constant = function
  | Cint n -> []
  | Csymbol_low(s, ofs) -> [s]
  | Csymbol_high(s, ofs) -> [s]
  | Csymbol_sda(s, ofs) -> [s]
  | Csymbol_rel_low(s, ofs) -> [s]
  | Csymbol_rel_high(s, ofs) -> [s]

let referenced_builtin ef =
  match ef with
  | EF_vload_global(chunk, id, ofs) -> [id]
  | EF_vstore_global(chunk, id, ofs) -> [id]
  | _ -> []

let referenced_instr = function
  | Pbl(s, _) -> [s]
  | Pbs(s, _) -> [s]
  | Paddi(_, _, c)
  | Paddic(_, _, c)
  | Paddis(_, _, c)
  | Pandi_(_, _, c)
  | Pandis_(_, _, c)
  | Pcmplwi(_, c)
  | Pcmpwi(_, c)
  | Plbz(_, c, _)
  | Plfd(_, c, _)
  | Plfd_a(_, c, _)
  | Plfs(_, c, _)
  | Plha(_, c, _)
  | Plhz(_, c, _)
  | Plwz(_, c, _)
  | Plwz_a(_, c, _)
  | Pmulli(_, _, c)
  | Pori(_, _, c)
  | Poris(_, _, c)
  | Pstb(_, c, _)
  | Pstfd(_, c, _)
  | Pstfd_a(_, c, _)
  | Pstfs(_, c, _)
  | Psth(_, c, _) 
  | Pstw(_, c, _) 
  | Pstw_a(_, c, _) 
  | Psubfic(_, _, c)
  | Pxori(_, _, c)
  | Pxoris(_, _, c) -> referenced_constant c
  | Pbuiltin(ef, _, _) -> referenced_builtin ef
  | _ -> []

let code_of_function f = f.fn_code