1/* IPA handling of references.
2   Copyright (C) 2004-2005 Free Software Foundation, Inc.
3   Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING.  If not, write to the Free
19Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2002110-1301, USA.  */
21
22#ifndef GCC_IPA_REFERENCE_H
23#define GCC_IPA_REFERENCE_H
24#include "bitmap.h"
25#include "tree.h"
26
27/* The static variables defined within the compilation unit that are
28   loaded or stored directly by function that owns this structure.  */
29
30struct ipa_reference_local_vars_info_d
31{
32  bitmap statics_read;
33  bitmap statics_written;
34
35  /* Set when this function calls another function external to the
36     compilation unit or if the function has a asm clobber of memory.
37     In general, such calls are modeled as reading and writing all
38     variables (both bits on) but sometime there are attributes on the
39     called function so we can do better.  */
40  bool calls_read_all;
41  bool calls_write_all;
42};
43
44struct ipa_reference_global_vars_info_d
45{
46  bitmap statics_read;
47  bitmap statics_written;
48  bitmap statics_not_read;
49  bitmap statics_not_written;
50};
51
52/* Statics that are read and written by some set of functions. The
53   local ones are based on the loads and stores local to the function.
54   The global ones are based on the local info as well as the
55   transitive closure of the functions that are called.  The
56   structures are separated to allow the global structures to be
57   shared between several functions since every function within a
58   strongly connected component will have the same information.  This
59   sharing saves both time and space in the computation of the vectors
60   as well as their translation from decl_uid form to ann_uid
61   form.  */
62
63typedef struct ipa_reference_local_vars_info_d *ipa_reference_local_vars_info_t;
64typedef struct ipa_reference_global_vars_info_d *ipa_reference_global_vars_info_t;
65
66struct ipa_reference_vars_info_d
67{
68  ipa_reference_local_vars_info_t local;
69  ipa_reference_global_vars_info_t global;
70};
71
72typedef struct ipa_reference_vars_info_d *ipa_reference_vars_info_t;
73
74/* In ipa-reference.c  */
75bitmap ipa_reference_get_read_local (tree fn);
76bitmap ipa_reference_get_written_local (tree fn);
77bitmap ipa_reference_get_read_global (tree fn);
78bitmap ipa_reference_get_written_global (tree fn);
79bitmap ipa_reference_get_not_read_global (tree fn);
80bitmap ipa_reference_get_not_written_global (tree fn);
81
82#endif  /* GCC_IPA_REFERENCE_H  */
83
84