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