40#ifndef GCC_MODREF_TREE_H
41#define GCC_MODREF_TREE_H
43struct ipa_modref_summary;
97 void dump (FILE *out);
101 bool range_info_useful_p ()
const;
103 tree get_call_arg (
const gcall *stmt)
const;
105 bool get_ao_ref (
const gcall *stmt,
class ao_ref *ref)
const;
113 static int insert (vec <modref_access_node, va_gc> *&accesses,
115 bool record_adjustments);
137 static void try_merge_with (vec <modref_access_node, va_gc> *&,
size_t);
153 every_access (
false),
170 bool record_adjustments)
200 "--param modref-max-accesses limit reached; collapsing\n");
224 modref_ref_node <T> *n;
237 modref_ref_node <T> *ref_node;
244 ref_node = search (ref);
251 if (ref &&
refs &&
refs->length () >= max_refs)
254 fprintf (
dump_file,
"--param modref-max-refs limit reached;"
257 ref_node = search (ref);
274 modref_ref_node <T> *
r;
315 every_base (
false) {}
323 unsigned int max_bases,
326 modref_base_node <T> *base_node;
333 base_node = search (base);
340 if (base && bases && bases->length () >= max_bases)
342 base_node = search (ref);
346 fprintf (
dump_file,
"--param modref-max-bases"
347 " limit reached; using ref\n");
351 fprintf (
dump_file,
"--param modref-max-bases"
352 " limit reached; using 0\n");
354 base_node = search (base);
363 modref_base_node <T> (base);
371 unsigned int max_refs,
372 unsigned int max_accesses,
374 bool record_adjustments)
383 if (
a.range_info_useful_p ()
384 && known_size_p (
a.size) && known_size_p (
a.max_size)
389 " - Paradoxical range. Ignoring\n");
392 if (known_size_p (
a.size)
397 " - Zero size. Ignoring\n");
400 if (known_size_p (
a.max_size)
405 " - Zero max_size. Ignoring\n");
412 if (!base && !ref && !
a.useful_p ())
418 modref_base_node <T> *base_node
419 = insert_base (base, ref, max_bases, &
changed);
420 base = base_node->
base;
422 if (!base && !ref && !
a.useful_p ())
432 if (!ref && !
a.useful_p ())
438 modref_ref_node <T> *ref_node
469 bool record_adjustments)
473 opt_for_fn (fndecl, param_modref_max_accesses),
474 base, ref,
a, record_adjustments);
482 modref_base_node <T> *base_node;
483 modref_ref_node <T> *ref_node;
497 base_node->
refs->unordered_remove (j);
505 && (!base_node->
refs || !base_node->
refs->length ()))
507 bases->unordered_remove (
i);
514 if (bases && !bases->length ())
526 unsigned int max_refs,
527 unsigned int max_accesses,
528 modref_tree <T> *other, vec <modref_parm_map> *parm_map,
530 bool record_accesses,
531 bool promote_unknown_to_global =
false)
533 if (!other || every_base)
543 modref_base_node <T> *base_node, *my_base_node;
544 modref_ref_node <T> *ref_node;
546 bool release =
false;
561 my_base_node = insert_base (base_node->
base, 0,
563 if (my_base_node && !my_base_node->
every_ref)
590 if (
a.parm_index >= (
int)parm_map->length ())
597 : (*parm_map) [
a.parm_index];
606 && promote_unknown_to_global)
609 base_node->
base, ref_node->
ref,
624 modref_tree <T> *other, vec <modref_parm_map> *parm_map,
626 bool record_accesses,
627 bool promote_unknown_to_global =
false)
629 return merge (
opt_for_fn (fndecl, param_modref_max_bases),
631 opt_for_fn (fndecl, param_modref_max_accesses),
632 other, parm_map, static_chain_map, record_accesses,
633 promote_unknown_to_global);
646 modref_base_node <T> *n;
657 modref_base_node <T> *base_node;
658 modref_ref_node <T> *ref_node;
692 modref_base_node <T> *n;
718 modref_base_node <T> *base_node;
722 modref_ref_node <T> *ref_node;
740void gt_ggc_mx (modref_tree <int>*
const&);
741void gt_ggc_mx (modref_tree <tree_node*>*
const&);
742void gt_pch_nx (modref_tree <int>*
const&);
743void gt_pch_nx (modref_tree <tree_node*>*
const&);
749void gt_ggc_mx (modref_base_node <tree_node*>* &);
758void gt_ggc_mx (modref_ref_node <tree_node*>* &);
Definition tree-ssa-alias.h:77
#define GTY(x)
Definition coretypes.h:41
void(* gt_pointer_operator)(void *, void *, void *)
Definition coretypes.h:473
union tree_node * tree
Definition coretypes.h:97
static struct string2counter_map map[debug_counter_number_of_counters]
Definition dbgcnt.cc:39
bool operator==(const nowarn_spec_t &lhs, const nowarn_spec_t &rhs)
Definition diagnostic-spec.h:131
FILE * dump_file
Definition dumpfile.cc:64
static bool contains(const rtx_insn *, hash_table< insn_cache_hasher > *)
Definition function.cc:5776
void ggc_free(void *)
Definition genmatch.cc:42
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
T * ggc_alloc_no_dtor(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:200
void ggc_delete(T *ptr)
Definition ggc.h:255
#define INT_MAX
Definition glimits.h:85
const modref_access_node unspecified_modref_access_node
Definition ipa-modref-tree.h:142
void gt_pch_nx(modref_tree< int > *const &)
Definition ipa-modref-tree.cc:1055
modref_special_parms
Definition ipa-modref-tree.h:47
@ MODREF_UNKNOWN_PARM
Definition ipa-modref-tree.h:48
@ MODREF_RETSLOT_PARM
Definition ipa-modref-tree.h:50
@ MODREF_GLOBAL_MEMORY_PARM
Definition ipa-modref-tree.h:52
@ MODREF_LOCAL_MEMORY_PARM
Definition ipa-modref-tree.h:56
@ MODREF_STATIC_CHAIN_PARM
Definition ipa-modref-tree.h:49
void gt_ggc_mx(modref_tree< int > *const &)
Definition ipa-modref-tree.cc:1036
poly_int< N, C > r
Definition poly-int.h:774
i
Definition poly-int.h:776
Ca & a
Definition poly-int.h:770
Definition ipa-modref-tree.h:65
bool merge(const modref_access_node &, bool)
Definition ipa-modref-tree.cc:168
static void try_merge_with(vec< modref_access_node, va_gc > *&, size_t)
Definition ipa-modref-tree.cc:443
poly_int64 parm_offset
Definition ipa-modref-tree.h:72
bool merge_for_kills(const modref_access_node &, bool)
Definition ipa-modref-tree.cc:774
void update2(poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, bool)
Definition ipa-modref-tree.cc:358
poly_int64 size
Definition ipa-modref-tree.h:68
static bool closer_pair_p(const modref_access_node &, const modref_access_node &, const modref_access_node &, const modref_access_node &)
Definition ipa-modref-tree.cc:246
bool useful_p() const
Definition ipa-modref-tree.h:83
tree get_call_arg(const gcall *stmt) const
Definition ipa-modref-tree.cc:675
poly_int64 max_size
Definition ipa-modref-tree.h:69
void dump(FILE *out)
Definition ipa-modref-tree.cc:641
void forced_merge(const modref_access_node &, bool)
Definition ipa-modref-tree.cc:323
void stream_out(struct output_block *ob) const
Definition ipa-modref-tree.cc:481
bool get_ao_ref(const gcall *stmt, class ao_ref *ref) const
Definition ipa-modref-tree.cc:692
bool contains_for_kills(const modref_access_node &) const
Definition ipa-modref-tree.cc:711
bool combined_offsets(const modref_access_node &, poly_int64 *, poly_int64 *, poly_int64 *) const
Definition ipa-modref-tree.cc:413
static int insert(vec< modref_access_node, va_gc > *&accesses, modref_access_node a, size_t max_accesses, bool record_adjustments)
Definition ipa-modref-tree.cc:530
bool parm_offset_known
Definition ipa-modref-tree.h:77
poly_int64 offset
Definition ipa-modref-tree.h:67
static bool insert_kill(vec< modref_access_node > &kills, modref_access_node &a, bool record_adjustments)
Definition ipa-modref-tree.cc:810
unsigned char adjustments
Definition ipa-modref-tree.h:80
bool useful_for_kill_p() const
Definition ipa-modref-tree.h:88
bool contains(const modref_access_node &) const
Definition ipa-modref-tree.cc:60
bool range_info_useful_p() const
Definition ipa-modref-tree.cc:629
bool operator==(modref_access_node &a) const
Definition ipa-modref-tree.cc:35
static modref_access_node stream_in(struct lto_input_block *ib)
Definition ipa-modref-tree.cc:498
int parm_index
Definition ipa-modref-tree.h:76
bool update_for_kills(poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, bool)
Definition ipa-modref-tree.cc:730
void update(poly_int64, poly_int64, poly_int64, poly_int64, bool)
Definition ipa-modref-tree.cc:113
Definition ipa-modref-tree.h:210
T base
Definition ipa-modref-tree.h:211
modref_base_node(T base)
Definition ipa-modref-tree.h:215
void collapse()
Definition ipa-modref-tree.h:271
vec< modref_ref_node< T > *, va_gc > * refs
Definition ipa-modref-tree.h:212
modref_ref_node< T > * search(T ref)
Definition ipa-modref-tree.h:221
bool every_ref
Definition ipa-modref-tree.h:213
modref_ref_node< T > * insert_ref(T ref, size_t max_refs, bool *changed=NULL)
Definition ipa-modref-tree.h:234
Definition ipa-modref-tree.h:293
modref_parm_map()
Definition ipa-modref-tree.h:295
poly_int64 parm_offset
Definition ipa-modref-tree.h:303
bool parm_offset_known
Definition ipa-modref-tree.h:302
int parm_index
Definition ipa-modref-tree.h:301
Definition ipa-modref-tree.h:146
T ref
Definition ipa-modref-tree.h:147
bool insert_access(modref_access_node a, size_t max_accesses, bool record_adjustments)
Definition ipa-modref-tree.h:169
modref_ref_node(T ref)
Definition ipa-modref-tree.h:151
vec< modref_access_node, va_gc > * accesses
Definition ipa-modref-tree.h:149
void collapse()
Definition ipa-modref-tree.h:158
bool every_access
Definition ipa-modref-tree.h:148
Definition ipa-modref-tree.h:309
bool insert(tree fndecl, T base, T ref, const modref_access_node &a, bool record_adjustments)
Definition ipa-modref-tree.h:467
~modref_tree()
Definition ipa-modref-tree.h:708
void copy_from(modref_tree< T > *other)
Definition ipa-modref-tree.h:637
modref_base_node< T > * insert_base(T base, T ref, unsigned int max_bases, bool *changed=NULL)
Definition ipa-modref-tree.h:322
bool merge(tree fndecl, modref_tree< T > *other, vec< modref_parm_map > *parm_map, modref_parm_map *static_chain_map, bool record_accesses, bool promote_unknown_to_global=false)
Definition ipa-modref-tree.h:623
vec< modref_base_node< T > *, va_gc > * bases
Definition ipa-modref-tree.h:310
modref_base_node< T > * search(T base)
Definition ipa-modref-tree.h:643
bool insert(unsigned int max_bases, unsigned int max_refs, unsigned int max_accesses, T base, T ref, modref_access_node a, bool record_adjustments)
Definition ipa-modref-tree.h:370
bool merge(unsigned int max_bases, unsigned int max_refs, unsigned int max_accesses, modref_tree< T > *other, vec< modref_parm_map > *parm_map, modref_parm_map *static_chain_map, bool record_accesses, bool promote_unknown_to_global=false)
Definition ipa-modref-tree.h:525
bool every_base
Definition ipa-modref-tree.h:311
bool global_access_p()
Definition ipa-modref-tree.h:654
void collapse()
Definition ipa-modref-tree.h:689
void remap_params(vec< int > *map)
Definition ipa-modref-tree.h:715
void cleanup()
Definition ipa-modref-tree.h:479
modref_tree()
Definition ipa-modref-tree.h:313
static modref_tree< T > * create_ggc()
Definition ipa-modref-tree.h:682
Definition lto-streamer.h:707
#define NULL
Definition system.h:50
#define false
Definition system.h:888
#define gcc_checking_assert(EXPR)
Definition system.h:821
hash_table< mem_ref_hasher > * refs
Definition tree-ssa-loop-im.cc:240
static void insert(void)
Definition tree-ssa-pre.cc:3804
static bitmap changed
Definition tree-ssa-structalias.cc:1445
#define opt_for_fn(fndecl, opt)
Definition tree.h:6233
bool vec_safe_iterate(const vec< T, A, vl_embed > *v, unsigned ix, T **ptr)
Definition vec.h:803
#define FOR_EACH_VEC_SAFE_ELT(V, I, P)
Definition vec.h:1887
T * vec_safe_push(vec< T, A, vl_embed > *&v, const T &obj CXX_MEM_STAT_INFO)
Definition vec.h:832
void vec_free(vec< T, A, vl_embed > *&v)
Definition vec.h:746