OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ipa-ref-inline.h] - Blame information for rev 733

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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
/* Return callgraph node REF is refering.  */
23
static inline struct cgraph_node *
24
ipa_ref_node (struct ipa_ref *ref)
25
{
26
  gcc_assert (ref->refered_type == IPA_REF_CGRAPH);
27
  return ref->refered.cgraph_node;
28
}
29
 
30
/* Return varpool node REF is refering.  */
31
 
32
static inline struct varpool_node *
33
ipa_ref_varpool_node (struct ipa_ref *ref)
34
{
35
  gcc_assert (ref->refered_type == IPA_REF_VARPOOL);
36
  return ref->refered.varpool_node;
37
}
38
 
39
/* Return cgraph node REF is in.  */
40
 
41
static inline struct cgraph_node *
42
ipa_ref_refering_node (struct ipa_ref *ref)
43
{
44
  gcc_assert (ref->refering_type == IPA_REF_CGRAPH);
45
  return ref->refering.cgraph_node;
46
}
47
 
48
/* Return varpool node REF is in.  */
49
 
50
static inline struct varpool_node *
51
ipa_ref_refering_varpool_node (struct ipa_ref *ref)
52
{
53
  gcc_assert (ref->refering_type == IPA_REF_VARPOOL);
54
  return ref->refering.varpool_node;
55
}
56
 
57
/* Return reference list REF is in.  */
58
 
59
static inline struct ipa_ref_list *
60
ipa_ref_refering_ref_list (struct ipa_ref *ref)
61
{
62
  if (ref->refering_type == IPA_REF_CGRAPH)
63
    return &ipa_ref_refering_node (ref)->ref_list;
64
  else
65
    return &ipa_ref_refering_varpool_node (ref)->ref_list;
66
}
67
 
68
/* Return reference list REF is in.  */
69
 
70
static inline struct ipa_ref_list *
71
ipa_ref_refered_ref_list (struct ipa_ref *ref)
72
{
73
  if (ref->refered_type == IPA_REF_CGRAPH)
74
    return &ipa_ref_node (ref)->ref_list;
75
  else
76
    return &ipa_ref_varpool_node (ref)->ref_list;
77
}
78
 
79
/* Return first reference in LIST or NULL if empty.  */
80
 
81
static inline struct ipa_ref *
82
ipa_ref_list_first_reference (struct ipa_ref_list *list)
83
{
84
  if (!VEC_length (ipa_ref_t, list->references))
85
    return NULL;
86
  return VEC_index (ipa_ref_t, list->references, 0);
87
}
88
 
89
/* Return first refering ref in LIST or NULL if empty.  */
90
 
91
static inline struct ipa_ref *
92
ipa_ref_list_first_refering (struct ipa_ref_list *list)
93
{
94
  if (!VEC_length (ipa_ref_ptr, list->refering))
95
    return NULL;
96
  return VEC_index (ipa_ref_ptr, list->refering, 0);
97
}
98
 
99
/* Clear reference list.  */
100
 
101
static inline void
102
ipa_empty_ref_list (struct ipa_ref_list *list)
103
{
104
  list->refering = NULL;
105
  list->references = NULL;
106
}
107
 
108
/* Clear reference list.  */
109
 
110
static inline unsigned int
111
ipa_ref_list_nreferences (struct ipa_ref_list *list)
112
{
113
  return VEC_length (ipa_ref_t, list->references);
114
}
115
 
116
#define ipa_ref_list_reference_iterate(L,I,P) \
117
   VEC_iterate(ipa_ref_t, (L)->references, (I), (P))
118
#define ipa_ref_list_refering_iterate(L,I,P) \
119
   VEC_iterate(ipa_ref_ptr, (L)->refering, (I), (P))

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.