| 1 |
684 |
jeremybenn |
/* IPA reference lists.
|
| 2 |
|
|
Copyright (C) 2010
|
| 3 |
|
|
Free Software Foundation, Inc.
|
| 4 |
|
|
Contributed by Jan Hubicka
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of GCC.
|
| 7 |
|
|
|
| 8 |
|
|
GCC is free software; you can redistribute it and/or modify it under
|
| 9 |
|
|
the terms of the GNU General Public License as published by the Free
|
| 10 |
|
|
Software Foundation; either version 3, or (at your option) any later
|
| 11 |
|
|
version.
|
| 12 |
|
|
|
| 13 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
| 14 |
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 15 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 16 |
|
|
for more details.
|
| 17 |
|
|
|
| 18 |
|
|
You should have received a copy of the GNU General Public License
|
| 19 |
|
|
along with GCC; see the file COPYING3. If not see
|
| 20 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 21 |
|
|
|
| 22 |
|
|
struct cgraph_node;
|
| 23 |
|
|
struct varpool_node;
|
| 24 |
|
|
|
| 25 |
|
|
/* How the reference is done. */
|
| 26 |
|
|
enum GTY(()) ipa_ref_use
|
| 27 |
|
|
{
|
| 28 |
|
|
IPA_REF_LOAD,
|
| 29 |
|
|
IPA_REF_STORE,
|
| 30 |
|
|
IPA_REF_ADDR,
|
| 31 |
|
|
IPA_REF_ALIAS
|
| 32 |
|
|
};
|
| 33 |
|
|
|
| 34 |
|
|
/* Type of refering or refered type. */
|
| 35 |
|
|
enum GTY(()) ipa_ref_type
|
| 36 |
|
|
{
|
| 37 |
|
|
IPA_REF_CGRAPH,
|
| 38 |
|
|
IPA_REF_VARPOOL
|
| 39 |
|
|
};
|
| 40 |
|
|
|
| 41 |
|
|
/* We can have references spanning both callgraph and varpool,
|
| 42 |
|
|
so all pointers needs to be of both types. */
|
| 43 |
|
|
union GTY(()) ipa_ref_ptr_u
|
| 44 |
|
|
{
|
| 45 |
|
|
struct cgraph_node * GTY((tag ("IPA_REF_CGRAPH"))) cgraph_node;
|
| 46 |
|
|
struct varpool_node * GTY((tag ("IPA_REF_VARPOOL"))) varpool_node;
|
| 47 |
|
|
};
|
| 48 |
|
|
|
| 49 |
|
|
/* Record of reference in callgraph or varpool. */
|
| 50 |
|
|
struct GTY(()) ipa_ref
|
| 51 |
|
|
{
|
| 52 |
|
|
union ipa_ref_ptr_u GTY ((desc ("%1.refering_type"))) refering;
|
| 53 |
|
|
union ipa_ref_ptr_u GTY ((desc ("%1.refered_type"))) refered;
|
| 54 |
|
|
gimple stmt;
|
| 55 |
|
|
unsigned int refered_index;
|
| 56 |
|
|
ENUM_BITFIELD (ipa_ref_type) refering_type:1;
|
| 57 |
|
|
ENUM_BITFIELD (ipa_ref_type) refered_type:1;
|
| 58 |
|
|
ENUM_BITFIELD (ipa_ref_use) use:2;
|
| 59 |
|
|
};
|
| 60 |
|
|
|
| 61 |
|
|
typedef struct ipa_ref ipa_ref_t;
|
| 62 |
|
|
typedef struct ipa_ref *ipa_ref_ptr;
|
| 63 |
|
|
|
| 64 |
|
|
DEF_VEC_O(ipa_ref_t);
|
| 65 |
|
|
DEF_VEC_ALLOC_O(ipa_ref_t,gc);
|
| 66 |
|
|
DEF_VEC_P(ipa_ref_ptr);
|
| 67 |
|
|
DEF_VEC_ALLOC_P(ipa_ref_ptr,heap);
|
| 68 |
|
|
|
| 69 |
|
|
/* List of references. This is stored in both callgraph and varpool nodes. */
|
| 70 |
|
|
struct GTY(()) ipa_ref_list
|
| 71 |
|
|
{
|
| 72 |
|
|
/* Store actual references in references vector. */
|
| 73 |
|
|
VEC(ipa_ref_t,gc) *references;
|
| 74 |
|
|
/* Refering is vector of pointers to references. It must not live in GGC space
|
| 75 |
|
|
or GGC will try to mark middle of references vectors. */
|
| 76 |
|
|
VEC(ipa_ref_ptr,heap) * GTY((skip)) refering;
|
| 77 |
|
|
};
|
| 78 |
|
|
|
| 79 |
|
|
struct ipa_ref * ipa_record_reference (struct cgraph_node *,
|
| 80 |
|
|
struct varpool_node *,
|
| 81 |
|
|
struct cgraph_node *,
|
| 82 |
|
|
struct varpool_node *,
|
| 83 |
|
|
enum ipa_ref_use, gimple);
|
| 84 |
|
|
|
| 85 |
|
|
void ipa_remove_reference (struct ipa_ref *);
|
| 86 |
|
|
void ipa_remove_all_references (struct ipa_ref_list *);
|
| 87 |
|
|
void ipa_remove_all_refering (struct ipa_ref_list *);
|
| 88 |
|
|
void ipa_dump_references (FILE *, struct ipa_ref_list *);
|
| 89 |
|
|
void ipa_dump_refering (FILE *, struct ipa_ref_list *);
|
| 90 |
|
|
void ipa_clone_references (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
|
| 91 |
|
|
void ipa_clone_refering (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
|
| 92 |
|
|
bool ipa_ref_cannot_lead_to_return (struct ipa_ref *);
|
| 93 |
|
|
bool ipa_ref_has_aliases_p (struct ipa_ref_list *);
|