comparison gcc/tree-flow-inline.h @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
33 gimple_in_ssa_p (const struct function *fun) 33 gimple_in_ssa_p (const struct function *fun)
34 { 34 {
35 return fun && fun->gimple_df && fun->gimple_df->in_ssa_p; 35 return fun && fun->gimple_df && fun->gimple_df->in_ssa_p;
36 } 36 }
37 37
38 /* 'true' after aliases have been computed (see compute_may_aliases). */
39 static inline bool
40 gimple_aliases_computed_p (const struct function *fun)
41 {
42 gcc_assert (fun && fun->gimple_df);
43 return fun->gimple_df->aliases_computed_p;
44 }
45
46 /* Addressable variables in the function. If bit I is set, then
47 REFERENCED_VARS (I) has had its address taken. Note that
48 CALL_CLOBBERED_VARS and ADDRESSABLE_VARS are not related. An
49 addressable variable is not necessarily call-clobbered (e.g., a
50 local addressable whose address does not escape) and not all
51 call-clobbered variables are addressable (e.g., a local static
52 variable). */
53 static inline bitmap
54 gimple_addressable_vars (const struct function *fun)
55 {
56 gcc_assert (fun && fun->gimple_df);
57 return fun->gimple_df->addressable_vars;
58 }
59
60 /* Call clobbered variables in the function. If bit I is set, then
61 REFERENCED_VARS (I) is call-clobbered. */
62 static inline bitmap
63 gimple_call_clobbered_vars (const struct function *fun)
64 {
65 gcc_assert (fun && fun->gimple_df);
66 return fun->gimple_df->call_clobbered_vars;
67 }
68
69 /* Call-used variables in the function. If bit I is set, then
70 REFERENCED_VARS (I) is call-used at pure function call-sites. */
71 static inline bitmap
72 gimple_call_used_vars (const struct function *fun)
73 {
74 gcc_assert (fun && fun->gimple_df);
75 return fun->gimple_df->call_used_vars;
76 }
77
78 /* Array of all variables referenced in the function. */ 38 /* Array of all variables referenced in the function. */
79 static inline htab_t 39 static inline htab_t
80 gimple_referenced_vars (const struct function *fun) 40 gimple_referenced_vars (const struct function *fun)
81 { 41 {
82 if (!fun->gimple_df) 42 if (!fun->gimple_df)
83 return NULL; 43 return NULL;
84 return fun->gimple_df->referenced_vars; 44 return fun->gimple_df->referenced_vars;
85 } 45 }
86 46
87 /* Artificial variable used to model the effects of function calls. */
88 static inline tree
89 gimple_global_var (const struct function *fun)
90 {
91 gcc_assert (fun && fun->gimple_df);
92 return fun->gimple_df->global_var;
93 }
94
95 /* Artificial variable used to model the effects of nonlocal 47 /* Artificial variable used to model the effects of nonlocal
96 variables. */ 48 variables. */
97 static inline tree 49 static inline tree
98 gimple_nonlocal_all (const struct function *fun) 50 gimple_nonlocal_all (const struct function *fun)
99 { 51 {
100 gcc_assert (fun && fun->gimple_df); 52 gcc_assert (fun && fun->gimple_df);
101 return fun->gimple_df->nonlocal_all; 53 return fun->gimple_df->nonlocal_all;
54 }
55
56 /* Artificial variable used for the virtual operand FUD chain. */
57 static inline tree
58 gimple_vop (const struct function *fun)
59 {
60 gcc_assert (fun && fun->gimple_df);
61 return fun->gimple_df->vop;
102 } 62 }
103 63
104 /* Initialize the hashtable iterator HTI to point to hashtable TABLE */ 64 /* Initialize the hashtable iterator HTI to point to hashtable TABLE */
105 65
106 static inline void * 66 static inline void *
113 { 73 {
114 PTR x = *(hti->slot); 74 PTR x = *(hti->slot);
115 if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY) 75 if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
116 break; 76 break;
117 } while (++(hti->slot) < hti->limit); 77 } while (++(hti->slot) < hti->limit);
118 78
119 if (hti->slot < hti->limit) 79 if (hti->slot < hti->limit)
120 return *(hti->slot); 80 return *(hti->slot);
121 return NULL; 81 return NULL;
122 } 82 }
123 83
171 131
172 static inline tree 132 static inline tree
173 next_referenced_var (referenced_var_iterator *iter) 133 next_referenced_var (referenced_var_iterator *iter)
174 { 134 {
175 return (tree) next_htab_element (&iter->hti); 135 return (tree) next_htab_element (&iter->hti);
176 } 136 }
177 137
178 /* Fill up VEC with the variables in the referenced vars hashtable. */ 138 /* Fill up VEC with the variables in the referenced vars hashtable. */
179 139
180 static inline void 140 static inline void
181 fill_referenced_var_vec (VEC (tree, heap) **vec) 141 fill_referenced_var_vec (VEC (tree, heap) **vec)
190 /* Return the variable annotation for T, which must be a _DECL node. 150 /* Return the variable annotation for T, which must be a _DECL node.
191 Return NULL if the variable annotation doesn't already exist. */ 151 Return NULL if the variable annotation doesn't already exist. */
192 static inline var_ann_t 152 static inline var_ann_t
193 var_ann (const_tree t) 153 var_ann (const_tree t)
194 { 154 {
195 var_ann_t ann; 155 const var_ann_t *p = DECL_VAR_ANN_PTR (t);
196 156 return p ? *p : NULL;
197 if (!t->base.ann)
198 return NULL;
199 ann = (var_ann_t) t->base.ann;
200
201 gcc_assert (ann->common.type == VAR_ANN);
202
203 return ann;
204 } 157 }
205 158
206 /* Return the variable annotation for T, which must be a _DECL node. 159 /* Return the variable annotation for T, which must be a _DECL node.
207 Create the variable annotation if it doesn't exist. */ 160 Create the variable annotation if it doesn't exist. */
208 static inline var_ann_t 161 static inline var_ann_t
209 get_var_ann (tree var) 162 get_var_ann (tree var)
210 { 163 {
211 var_ann_t ann = var_ann (var); 164 var_ann_t *p = DECL_VAR_ANN_PTR (var);
212 return (ann) ? ann : create_var_ann (var); 165 gcc_assert (p);
213 } 166 return *p ? *p : create_var_ann (var);
214
215 /* Return the function annotation for T, which must be a FUNCTION_DECL node.
216 Return NULL if the function annotation doesn't already exist. */
217 static inline function_ann_t
218 function_ann (const_tree t)
219 {
220 gcc_assert (t);
221 gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
222 gcc_assert (!t->base.ann
223 || t->base.ann->common.type == FUNCTION_ANN);
224
225 return (function_ann_t) t->base.ann;
226 }
227
228 /* Return the function annotation for T, which must be a FUNCTION_DECL node.
229 Create the function annotation if it doesn't exist. */
230 static inline function_ann_t
231 get_function_ann (tree var)
232 {
233 function_ann_t ann = function_ann (var);
234 gcc_assert (!var->base.ann || var->base.ann->common.type == FUNCTION_ANN);
235 return (ann) ? ann : create_function_ann (var);
236 } 167 }
237 168
238 /* Get the number of the next statement uid to be allocated. */ 169 /* Get the number of the next statement uid to be allocated. */
239 static inline unsigned int 170 static inline unsigned int
240 gimple_stmt_max_uid (struct function *fn) 171 gimple_stmt_max_uid (struct function *fn)
252 /* Set the number of the next statement uid to be allocated. */ 183 /* Set the number of the next statement uid to be allocated. */
253 static inline unsigned int 184 static inline unsigned int
254 inc_gimple_stmt_max_uid (struct function *fn) 185 inc_gimple_stmt_max_uid (struct function *fn)
255 { 186 {
256 return fn->last_stmt_uid++; 187 return fn->last_stmt_uid++;
257 }
258
259 /* Return the annotation type for annotation ANN. */
260 static inline enum tree_ann_type
261 ann_type (tree_ann_t ann)
262 {
263 return ann->common.type;
264 }
265
266 /* Return the may_aliases bitmap for variable VAR, or NULL if it has
267 no may aliases. */
268 static inline bitmap
269 may_aliases (const_tree var)
270 {
271 return MTAG_ALIASES (var);
272 } 188 }
273 189
274 /* Return the line number for EXPR, or return -1 if we have no line 190 /* Return the line number for EXPR, or return -1 if we have no line
275 number information for it. */ 191 number information for it. */
276 static inline int 192 static inline int
280 196
281 if (!stmt) 197 if (!stmt)
282 return -1; 198 return -1;
283 199
284 loc = gimple_location (stmt); 200 loc = gimple_location (stmt);
285 if (loc != UNKNOWN_LOCATION) 201 if (loc == UNKNOWN_LOCATION)
286 return -1; 202 return -1;
287 203
288 return LOCATION_LINE (loc); 204 return LOCATION_LINE (loc);
289 } 205 }
290 206
304 220
305 /* Link ssa_imm_use node LINKNODE into the chain for LIST. */ 221 /* Link ssa_imm_use node LINKNODE into the chain for LIST. */
306 static inline void 222 static inline void
307 link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list) 223 link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list)
308 { 224 {
309 /* Link the new node at the head of the list. If we are in the process of 225 /* Link the new node at the head of the list. If we are in the process of
310 traversing the list, we won't visit any new nodes added to it. */ 226 traversing the list, we won't visit any new nodes added to it. */
311 linknode->prev = list; 227 linknode->prev = list;
312 linknode->next = list->next; 228 linknode->next = list->next;
313 list->next->prev = linknode; 229 list->next->prev = linknode;
314 list->next = linknode; 230 list->next = linknode;
340 delink_imm_use (use); 256 delink_imm_use (use);
341 *(use->use) = val; 257 *(use->use) = val;
342 link_imm_use (use, val); 258 link_imm_use (use, val);
343 } 259 }
344 260
345 /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring 261 /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
346 in STMT. */ 262 in STMT. */
347 static inline void 263 static inline void
348 link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple stmt) 264 link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple stmt)
349 { 265 {
350 if (stmt) 266 if (stmt)
369 /* Remove the old node from the list. */ 285 /* Remove the old node from the list. */
370 old->prev = NULL; 286 old->prev = NULL;
371 } 287 }
372 } 288 }
373 289
374 /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring 290 /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
375 in STMT. */ 291 in STMT. */
376 static inline void 292 static inline void
377 relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, 293 relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old,
378 gimple stmt) 294 gimple stmt)
379 { 295 {
427 if (end_readonly_imm_use_p (imm)) 343 if (end_readonly_imm_use_p (imm))
428 return NULL_USE_OPERAND_P; 344 return NULL_USE_OPERAND_P;
429 return imm->imm_use; 345 return imm->imm_use;
430 } 346 }
431 347
432 /* Return true if VAR has no uses. */ 348 /* tree-cfg.c */
349 extern bool has_zero_uses_1 (const ssa_use_operand_t *head);
350 extern bool single_imm_use_1 (const ssa_use_operand_t *head,
351 use_operand_p *use_p, gimple *stmt);
352
353 /* Return true if VAR has no nondebug uses. */
433 static inline bool 354 static inline bool
434 has_zero_uses (const_tree var) 355 has_zero_uses (const_tree var)
435 { 356 {
436 const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var)); 357 const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
437 /* A single use means there is no items in the list. */ 358
438 return (ptr == ptr->next); 359 /* A single use_operand means there is no items in the list. */
439 } 360 if (ptr == ptr->next)
440 361 return true;
441 /* Return true if VAR has a single use. */ 362
363 /* If there are debug stmts, we have to look at each use and see
364 whether there are any nondebug uses. */
365 if (!MAY_HAVE_DEBUG_STMTS)
366 return false;
367
368 return has_zero_uses_1 (ptr);
369 }
370
371 /* Return true if VAR has a single nondebug use. */
442 static inline bool 372 static inline bool
443 has_single_use (const_tree var) 373 has_single_use (const_tree var)
444 { 374 {
445 const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var)); 375 const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
446 /* A single use means there is one item in the list. */ 376
447 return (ptr != ptr->next && ptr == ptr->next->next); 377 /* If there aren't any uses whatsoever, we're done. */
448 } 378 if (ptr == ptr->next)
449 379 return false;
450 380
451 /* If VAR has only a single immediate use, return true, and set USE_P and STMT 381 /* If there's a single use, check that it's not a debug stmt. */
452 to the use pointer and stmt of occurrence. */ 382 if (ptr == ptr->next->next)
383 return !is_gimple_debug (USE_STMT (ptr->next));
384
385 /* If there are debug stmts, we have to look at each of them. */
386 if (!MAY_HAVE_DEBUG_STMTS)
387 return false;
388
389 return single_imm_use_1 (ptr, NULL, NULL);
390 }
391
392
393 /* If VAR has only a single immediate nondebug use, return true, and
394 set USE_P and STMT to the use pointer and stmt of occurrence. */
453 static inline bool 395 static inline bool
454 single_imm_use (const_tree var, use_operand_p *use_p, gimple *stmt) 396 single_imm_use (const_tree var, use_operand_p *use_p, gimple *stmt)
455 { 397 {
456 const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var)); 398 const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
457 if (ptr != ptr->next && ptr == ptr->next->next) 399
458 { 400 /* If there aren't any uses whatsoever, we're done. */
459 *use_p = ptr->next; 401 if (ptr == ptr->next)
460 *stmt = ptr->next->loc.stmt; 402 {
461 return true; 403 return_false:
462 } 404 *use_p = NULL_USE_OPERAND_P;
463 *use_p = NULL_USE_OPERAND_P; 405 *stmt = NULL;
464 *stmt = NULL; 406 return false;
465 return false; 407 }
466 } 408
467 409 /* If there's a single use, check that it's not a debug stmt. */
468 /* Return the number of immediate uses of VAR. */ 410 if (ptr == ptr->next->next)
411 {
412 if (!is_gimple_debug (USE_STMT (ptr->next)))
413 {
414 *use_p = ptr->next;
415 *stmt = ptr->next->loc.stmt;
416 return true;
417 }
418 else
419 goto return_false;
420 }
421
422 /* If there are debug stmts, we have to look at each of them. */
423 if (!MAY_HAVE_DEBUG_STMTS)
424 goto return_false;
425
426 return single_imm_use_1 (ptr, use_p, stmt);
427 }
428
429 /* Return the number of nondebug immediate uses of VAR. */
469 static inline unsigned int 430 static inline unsigned int
470 num_imm_uses (const_tree var) 431 num_imm_uses (const_tree var)
471 { 432 {
472 const ssa_use_operand_t *const start = &(SSA_NAME_IMM_USE_NODE (var)); 433 const ssa_use_operand_t *const start = &(SSA_NAME_IMM_USE_NODE (var));
473 const ssa_use_operand_t *ptr; 434 const ssa_use_operand_t *ptr;
474 unsigned int num = 0; 435 unsigned int num = 0;
475 436
476 for (ptr = start->next; ptr != start; ptr = ptr->next) 437 if (!MAY_HAVE_DEBUG_STMTS)
477 num++; 438 for (ptr = start->next; ptr != start; ptr = ptr->next)
439 num++;
440 else
441 for (ptr = start->next; ptr != start; ptr = ptr->next)
442 if (!is_gimple_debug (USE_STMT (ptr)))
443 num++;
478 444
479 return num; 445 return num;
480 } 446 }
481 447
482 /* Return the tree pointed-to by USE. */ 448 /* Return the tree pointed-to by USE. */
483 static inline tree 449 static inline tree
484 get_use_from_ptr (use_operand_p use) 450 get_use_from_ptr (use_operand_p use)
485 { 451 {
486 return *(use->use); 452 return *(use->use);
487 } 453 }
488 454
489 /* Return the tree pointed-to by DEF. */ 455 /* Return the tree pointed-to by DEF. */
490 static inline tree 456 static inline tree
491 get_def_from_ptr (def_operand_p def) 457 get_def_from_ptr (def_operand_p def)
492 { 458 {
523 static inline edge 489 static inline edge
524 gimple_phi_arg_edge (gimple gs, size_t i) 490 gimple_phi_arg_edge (gimple gs, size_t i)
525 { 491 {
526 return EDGE_PRED (gimple_bb (gs), i); 492 return EDGE_PRED (gimple_bb (gs), i);
527 } 493 }
494
495 /* Return the source location of gimple argument I of phi node GS. */
496
497 static inline source_location
498 gimple_phi_arg_location (gimple gs, size_t i)
499 {
500 return gimple_phi_arg (gs, i)->locus;
501 }
502
503 /* Return the source location of the argument on edge E of phi node GS. */
504
505 static inline source_location
506 gimple_phi_arg_location_from_edge (gimple gs, edge e)
507 {
508 return gimple_phi_arg (gs, e->dest_idx)->locus;
509 }
510
511 /* Set the source location of gimple argument I of phi node GS to LOC. */
512
513 static inline void
514 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
515 {
516 gimple_phi_arg (gs, i)->locus = loc;
517 }
518
519 /* Return TRUE if argument I of phi node GS has a location record. */
520
521 static inline bool
522 gimple_phi_arg_has_location (gimple gs, size_t i)
523 {
524 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
525 }
526
528 527
529 /* Return the PHI nodes for basic block BB, or NULL if there are no 528 /* Return the PHI nodes for basic block BB, or NULL if there are no
530 PHI nodes. */ 529 PHI nodes. */
531 static inline gimple_seq 530 static inline gimple_seq
532 phi_nodes (const_basic_block bb) 531 phi_nodes (const_basic_block bb)
570 element = (struct phi_arg_d *)use; 569 element = (struct phi_arg_d *)use;
571 root = gimple_phi_arg (phi, 0); 570 root = gimple_phi_arg (phi, 0);
572 index = element - root; 571 index = element - root;
573 572
574 #ifdef ENABLE_CHECKING 573 #ifdef ENABLE_CHECKING
575 /* Make sure the calculation doesn't have any leftover bytes. If it does, 574 /* Make sure the calculation doesn't have any leftover bytes. If it does,
576 then imm_use is likely not the first element in phi_arg_d. */ 575 then imm_use is likely not the first element in phi_arg_d. */
577 gcc_assert ( 576 gcc_assert (
578 (((char *)element - (char *)root) % sizeof (struct phi_arg_d)) == 0); 577 (((char *)element - (char *)root) % sizeof (struct phi_arg_d)) == 0);
579 gcc_assert (index < gimple_phi_capacity (phi)); 578 gcc_assert (index < gimple_phi_capacity (phi));
580 #endif 579 #endif
581 580
582 return index; 581 return index;
583 } 582 }
584 583
585 /* Mark VAR as used, so that it'll be preserved during rtl expansion. */ 584 /* Mark VAR as used, so that it'll be preserved during rtl expansion. */
586 585
590 var_ann_t ann = get_var_ann (var); 589 var_ann_t ann = get_var_ann (var);
591 ann->used = 1; 590 ann->used = 1;
592 } 591 }
593 592
594 593
595 /* Return true if T (assumed to be a DECL) is a global variable. */ 594 /* Return true if T (assumed to be a DECL) is a global variable.
595 A variable is considered global if its storage is not automatic. */
596 596
597 static inline bool 597 static inline bool
598 is_global_var (const_tree t) 598 is_global_var (const_tree t)
599 { 599 {
600 if (MTAG_P (t)) 600 return (TREE_STATIC (t) || DECL_EXTERNAL (t));
601 return MTAG_GLOBAL (t); 601 }
602 else 602
603 return (TREE_STATIC (t) || DECL_EXTERNAL (t)); 603
604 } 604 /* Return true if VAR may be aliased. A variable is considered as
605 maybe aliased if it has its address taken by the local TU
606 or possibly by another TU and might be modified through a pointer. */
607
608 static inline bool
609 may_be_aliased (const_tree var)
610 {
611 return (TREE_CODE (var) != CONST_DECL
612 && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
613 && TREE_READONLY (var)
614 && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
615 && (TREE_PUBLIC (var)
616 || DECL_EXTERNAL (var)
617 || TREE_ADDRESSABLE (var)));
618 }
619
605 620
606 /* PHI nodes should contain only ssa_names and invariants. A test 621 /* PHI nodes should contain only ssa_names and invariants. A test
607 for ssa_name is definitely simpler; don't let invalid contents 622 for ssa_name is definitely simpler; don't let invalid contents
608 slip in in the meantime. */ 623 slip in in the meantime. */
609 624
630 645
631 return bb->loop_father; 646 return bb->loop_father;
632 } 647 }
633 648
634 649
635 /* Return the memory partition tag associated with symbol SYM. */ 650 /* Return true if VAR is clobbered by function calls. */
636 651 static inline bool
637 static inline tree 652 is_call_clobbered (const_tree var)
638 memory_partition (tree sym) 653 {
639 { 654 return (is_global_var (var)
640 tree tag; 655 || (may_be_aliased (var)
641 656 && pt_solution_includes (&cfun->gimple_df->escaped, var)));
642 /* MPTs belong to their own partition. */
643 if (TREE_CODE (sym) == MEMORY_PARTITION_TAG)
644 return sym;
645
646 gcc_assert (!is_gimple_reg (sym));
647 /* Autoparallelization moves statements from the original function (which has
648 aliases computed) to the new one (which does not). When rebuilding
649 operands for the statement in the new function, we do not want to
650 record the memory partition tags of the original function. */
651 if (!gimple_aliases_computed_p (cfun))
652 return NULL_TREE;
653 tag = get_var_ann (sym)->mpt;
654
655 #if defined ENABLE_CHECKING
656 if (tag)
657 gcc_assert (TREE_CODE (tag) == MEMORY_PARTITION_TAG);
658 #endif
659
660 return tag;
661 }
662
663 /* Return true if NAME is a memory factoring SSA name (i.e., an SSA
664 name for a memory partition. */
665
666 static inline bool
667 factoring_name_p (const_tree name)
668 {
669 return TREE_CODE (SSA_NAME_VAR (name)) == MEMORY_PARTITION_TAG;
670 } 657 }
671 658
672 /* Return true if VAR is used by function calls. */ 659 /* Return true if VAR is used by function calls. */
673 static inline bool 660 static inline bool
674 is_call_used (const_tree var) 661 is_call_used (const_tree var)
675 { 662 {
676 return (var_ann (var)->call_clobbered 663 return (is_call_clobbered (var)
677 || bitmap_bit_p (gimple_call_used_vars (cfun), DECL_UID (var))); 664 || (may_be_aliased (var)
678 } 665 && pt_solution_includes (&cfun->gimple_df->callused, var)));
679
680 /* Return true if VAR is clobbered by function calls. */
681 static inline bool
682 is_call_clobbered (const_tree var)
683 {
684 return var_ann (var)->call_clobbered;
685 }
686
687 /* Mark variable VAR as being clobbered by function calls. */
688 static inline void
689 mark_call_clobbered (tree var, unsigned int escape_type)
690 {
691 var_ann (var)->escape_mask |= escape_type;
692 var_ann (var)->call_clobbered = true;
693 bitmap_set_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
694 }
695
696 /* Clear the call-clobbered attribute from variable VAR. */
697 static inline void
698 clear_call_clobbered (tree var)
699 {
700 var_ann_t ann = var_ann (var);
701 ann->escape_mask = 0;
702 if (MTAG_P (var))
703 MTAG_GLOBAL (var) = 0;
704 var_ann (var)->call_clobbered = false;
705 bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
706 }
707
708 /* Return the common annotation for T. Return NULL if the annotation
709 doesn't already exist. */
710 static inline tree_ann_common_t
711 tree_common_ann (const_tree t)
712 {
713 /* Watch out static variables with unshared annotations. */
714 if (DECL_P (t) && TREE_CODE (t) == VAR_DECL)
715 return &var_ann (t)->common;
716 return &t->base.ann->common;
717 }
718
719 /* Return a common annotation for T. Create the constant annotation if it
720 doesn't exist. */
721 static inline tree_ann_common_t
722 get_tree_common_ann (tree t)
723 {
724 tree_ann_common_t ann = tree_common_ann (t);
725 return (ann) ? ann : create_tree_common_ann (t);
726 } 666 }
727 667
728 /* ----------------------------------------------------------------------- */ 668 /* ----------------------------------------------------------------------- */
729 669
730 /* The following set of routines are used to iterator over various type of 670 /* The following set of routines are used to iterator over various type of
749 { 689 {
750 use_p = USE_OP_PTR (ptr->uses); 690 use_p = USE_OP_PTR (ptr->uses);
751 ptr->uses = ptr->uses->next; 691 ptr->uses = ptr->uses->next;
752 return use_p; 692 return use_p;
753 } 693 }
754 if (ptr->vuses)
755 {
756 use_p = VUSE_OP_PTR (ptr->vuses, ptr->vuse_index);
757 if (++(ptr->vuse_index) >= VUSE_NUM (ptr->vuses))
758 {
759 ptr->vuse_index = 0;
760 ptr->vuses = ptr->vuses->next;
761 }
762 return use_p;
763 }
764 if (ptr->mayuses)
765 {
766 use_p = VDEF_OP_PTR (ptr->mayuses, ptr->mayuse_index);
767 if (++(ptr->mayuse_index) >= VDEF_NUM (ptr->mayuses))
768 {
769 ptr->mayuse_index = 0;
770 ptr->mayuses = ptr->mayuses->next;
771 }
772 return use_p;
773 }
774 if (ptr->phi_i < ptr->num_phi) 694 if (ptr->phi_i < ptr->num_phi)
775 { 695 {
776 return PHI_ARG_DEF_PTR (ptr->phi_stmt, (ptr->phi_i)++); 696 return PHI_ARG_DEF_PTR (ptr->phi_stmt, (ptr->phi_i)++);
777 } 697 }
778 ptr->done = true; 698 ptr->done = true;
791 { 711 {
792 def_p = DEF_OP_PTR (ptr->defs); 712 def_p = DEF_OP_PTR (ptr->defs);
793 ptr->defs = ptr->defs->next; 713 ptr->defs = ptr->defs->next;
794 return def_p; 714 return def_p;
795 } 715 }
796 if (ptr->vdefs)
797 {
798 def_p = VDEF_RESULT_PTR (ptr->vdefs);
799 ptr->vdefs = ptr->vdefs->next;
800 return def_p;
801 }
802 ptr->done = true; 716 ptr->done = true;
803 return NULL_DEF_OPERAND_P; 717 return NULL_DEF_OPERAND_P;
804 } 718 }
805 719
806 /* Get the next iterator tree value for PTR. */ 720 /* Get the next iterator tree value for PTR. */
815 { 729 {
816 val = USE_OP (ptr->uses); 730 val = USE_OP (ptr->uses);
817 ptr->uses = ptr->uses->next; 731 ptr->uses = ptr->uses->next;
818 return val; 732 return val;
819 } 733 }
820 if (ptr->vuses)
821 {
822 val = VUSE_OP (ptr->vuses, ptr->vuse_index);
823 if (++(ptr->vuse_index) >= VUSE_NUM (ptr->vuses))
824 {
825 ptr->vuse_index = 0;
826 ptr->vuses = ptr->vuses->next;
827 }
828 return val;
829 }
830 if (ptr->mayuses)
831 {
832 val = VDEF_OP (ptr->mayuses, ptr->mayuse_index);
833 if (++(ptr->mayuse_index) >= VDEF_NUM (ptr->mayuses))
834 {
835 ptr->mayuse_index = 0;
836 ptr->mayuses = ptr->mayuses->next;
837 }
838 return val;
839 }
840 if (ptr->defs) 734 if (ptr->defs)
841 { 735 {
842 val = DEF_OP (ptr->defs); 736 val = DEF_OP (ptr->defs);
843 ptr->defs = ptr->defs->next; 737 ptr->defs = ptr->defs->next;
844 return val; 738 return val;
845 } 739 }
846 if (ptr->vdefs)
847 {
848 val = VDEF_RESULT (ptr->vdefs);
849 ptr->vdefs = ptr->vdefs->next;
850 return val;
851 }
852 740
853 ptr->done = true; 741 ptr->done = true;
854 return NULL_TREE; 742 return NULL_TREE;
855 743
856 } 744 }
863 static inline void 751 static inline void
864 clear_and_done_ssa_iter (ssa_op_iter *ptr) 752 clear_and_done_ssa_iter (ssa_op_iter *ptr)
865 { 753 {
866 ptr->defs = NULL; 754 ptr->defs = NULL;
867 ptr->uses = NULL; 755 ptr->uses = NULL;
868 ptr->vuses = NULL;
869 ptr->vdefs = NULL;
870 ptr->mayuses = NULL;
871 ptr->iter_type = ssa_op_iter_none; 756 ptr->iter_type = ssa_op_iter_none;
872 ptr->phi_i = 0; 757 ptr->phi_i = 0;
873 ptr->num_phi = 0; 758 ptr->num_phi = 0;
874 ptr->phi_stmt = NULL; 759 ptr->phi_stmt = NULL;
875 ptr->done = true; 760 ptr->done = true;
876 ptr->vuse_index = 0;
877 ptr->mayuse_index = 0;
878 } 761 }
879 762
880 /* Initialize the iterator PTR to the virtual defs in STMT. */ 763 /* Initialize the iterator PTR to the virtual defs in STMT. */
881 static inline void 764 static inline void
882 op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags) 765 op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags)
883 { 766 {
884 ptr->defs = (flags & SSA_OP_DEF) ? gimple_def_ops (stmt) : NULL; 767 /* We do not support iterating over virtual defs or uses without
885 ptr->uses = (flags & SSA_OP_USE) ? gimple_use_ops (stmt) : NULL; 768 iterating over defs or uses at the same time. */
886 ptr->vuses = (flags & SSA_OP_VUSE) ? gimple_vuse_ops (stmt) : NULL; 769 gcc_assert ((!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF))
887 ptr->vdefs = (flags & SSA_OP_VDEF) ? gimple_vdef_ops (stmt) : NULL; 770 && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE)));
888 ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? gimple_vdef_ops (stmt) : NULL; 771 ptr->defs = (flags & (SSA_OP_DEF|SSA_OP_VDEF)) ? gimple_def_ops (stmt) : NULL;
772 if (!(flags & SSA_OP_VDEF)
773 && ptr->defs
774 && gimple_vdef (stmt) != NULL_TREE)
775 ptr->defs = ptr->defs->next;
776 ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL;
777 if (!(flags & SSA_OP_VUSE)
778 && ptr->uses
779 && gimple_vuse (stmt) != NULL_TREE)
780 ptr->uses = ptr->uses->next;
889 ptr->done = false; 781 ptr->done = false;
890 782
891 ptr->phi_i = 0; 783 ptr->phi_i = 0;
892 ptr->num_phi = 0; 784 ptr->num_phi = 0;
893 ptr->phi_stmt = NULL; 785 ptr->phi_stmt = NULL;
894 ptr->vuse_index = 0;
895 ptr->mayuse_index = 0;
896 } 786 }
897 787
898 /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return 788 /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
899 the first use. */ 789 the first use. */
900 static inline use_operand_p 790 static inline use_operand_p
901 op_iter_init_use (ssa_op_iter *ptr, gimple stmt, int flags) 791 op_iter_init_use (ssa_op_iter *ptr, gimple stmt, int flags)
902 { 792 {
903 gcc_assert ((flags & SSA_OP_ALL_DEFS) == 0); 793 gcc_assert ((flags & SSA_OP_ALL_DEFS) == 0
794 && (flags & SSA_OP_USE));
904 op_iter_init (ptr, stmt, flags); 795 op_iter_init (ptr, stmt, flags);
905 ptr->iter_type = ssa_op_iter_use; 796 ptr->iter_type = ssa_op_iter_use;
906 return op_iter_next_use (ptr); 797 return op_iter_next_use (ptr);
907 } 798 }
908 799
909 /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return 800 /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
910 the first def. */ 801 the first def. */
911 static inline def_operand_p 802 static inline def_operand_p
912 op_iter_init_def (ssa_op_iter *ptr, gimple stmt, int flags) 803 op_iter_init_def (ssa_op_iter *ptr, gimple stmt, int flags)
913 { 804 {
914 gcc_assert ((flags & SSA_OP_ALL_USES) == 0); 805 gcc_assert ((flags & SSA_OP_ALL_USES) == 0
806 && (flags & SSA_OP_DEF));
915 op_iter_init (ptr, stmt, flags); 807 op_iter_init (ptr, stmt, flags);
916 ptr->iter_type = ssa_op_iter_def; 808 ptr->iter_type = ssa_op_iter_def;
917 return op_iter_next_def (ptr); 809 return op_iter_next_def (ptr);
918 } 810 }
919 811
923 op_iter_init_tree (ssa_op_iter *ptr, gimple stmt, int flags) 815 op_iter_init_tree (ssa_op_iter *ptr, gimple stmt, int flags)
924 { 816 {
925 op_iter_init (ptr, stmt, flags); 817 op_iter_init (ptr, stmt, flags);
926 ptr->iter_type = ssa_op_iter_tree; 818 ptr->iter_type = ssa_op_iter_tree;
927 return op_iter_next_tree (ptr); 819 return op_iter_next_tree (ptr);
928 }
929
930 /* Get the next iterator mustdef value for PTR, returning the mustdef values in
931 KILL and DEF. */
932 static inline void
933 op_iter_next_vdef (vuse_vec_p *use, def_operand_p *def,
934 ssa_op_iter *ptr)
935 {
936 #ifdef ENABLE_CHECKING
937 gcc_assert (ptr->iter_type == ssa_op_iter_vdef);
938 #endif
939 if (ptr->mayuses)
940 {
941 *def = VDEF_RESULT_PTR (ptr->mayuses);
942 *use = VDEF_VECT (ptr->mayuses);
943 ptr->mayuses = ptr->mayuses->next;
944 return;
945 }
946
947 *def = NULL_DEF_OPERAND_P;
948 *use = NULL;
949 ptr->done = true;
950 return;
951 }
952
953
954 static inline void
955 op_iter_next_mustdef (use_operand_p *use, def_operand_p *def,
956 ssa_op_iter *ptr)
957 {
958 vuse_vec_p vp;
959 op_iter_next_vdef (&vp, def, ptr);
960 if (vp != NULL)
961 {
962 gcc_assert (VUSE_VECT_NUM_ELEM (*vp) == 1);
963 *use = VUSE_ELEMENT_PTR (*vp, 0);
964 }
965 else
966 *use = NULL_USE_OPERAND_P;
967 }
968
969 /* Initialize iterator PTR to the operands in STMT. Return the first operands
970 in USE and DEF. */
971 static inline void
972 op_iter_init_vdef (ssa_op_iter *ptr, gimple stmt, vuse_vec_p *use,
973 def_operand_p *def)
974 {
975 gcc_assert (gimple_code (stmt) != GIMPLE_PHI);
976
977 op_iter_init (ptr, stmt, SSA_OP_VMAYUSE);
978 ptr->iter_type = ssa_op_iter_vdef;
979 op_iter_next_vdef (use, def, ptr);
980 } 820 }
981 821
982 822
983 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise 823 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
984 return NULL. */ 824 return NULL. */
1033 return var; 873 return var;
1034 return NULL_DEF_OPERAND_P; 874 return NULL_DEF_OPERAND_P;
1035 } 875 }
1036 876
1037 877
1038 /* Return true if there are zero operands in STMT matching the type 878 /* Return true if there are zero operands in STMT matching the type
1039 given in FLAGS. */ 879 given in FLAGS. */
1040 static inline bool 880 static inline bool
1041 zero_ssa_operands (gimple stmt, int flags) 881 zero_ssa_operands (gimple stmt, int flags)
1042 { 882 {
1043 ssa_op_iter iter; 883 ssa_op_iter iter;
1072 FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) 912 FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
1073 delink_imm_use (use_p); 913 delink_imm_use (use_p);
1074 } 914 }
1075 915
1076 916
1077 /* This routine will compare all the operands matching FLAGS in STMT1 to those
1078 in STMT2. TRUE is returned if they are the same. STMTs can be NULL. */
1079 static inline bool
1080 compare_ssa_operands_equal (gimple stmt1, gimple stmt2, int flags)
1081 {
1082 ssa_op_iter iter1, iter2;
1083 tree op1 = NULL_TREE;
1084 tree op2 = NULL_TREE;
1085 bool look1, look2;
1086
1087 if (stmt1 == stmt2)
1088 return true;
1089
1090 look1 = stmt1 != NULL;
1091 look2 = stmt2 != NULL;
1092
1093 if (look1)
1094 {
1095 op1 = op_iter_init_tree (&iter1, stmt1, flags);
1096 if (!look2)
1097 return op_iter_done (&iter1);
1098 }
1099 else
1100 clear_and_done_ssa_iter (&iter1);
1101
1102 if (look2)
1103 {
1104 op2 = op_iter_init_tree (&iter2, stmt2, flags);
1105 if (!look1)
1106 return op_iter_done (&iter2);
1107 }
1108 else
1109 clear_and_done_ssa_iter (&iter2);
1110
1111 while (!op_iter_done (&iter1) && !op_iter_done (&iter2))
1112 {
1113 if (op1 != op2)
1114 return false;
1115 op1 = op_iter_next_tree (&iter1);
1116 op2 = op_iter_next_tree (&iter2);
1117 }
1118
1119 return (op_iter_done (&iter1) && op_iter_done (&iter2));
1120 }
1121
1122
1123 /* If there is a single DEF in the PHI node which matches FLAG, return it. 917 /* If there is a single DEF in the PHI node which matches FLAG, return it.
1124 Otherwise return NULL_DEF_OPERAND_P. */ 918 Otherwise return NULL_DEF_OPERAND_P. */
1125 static inline tree 919 static inline tree
1126 single_phi_def (gimple stmt, int flags) 920 single_phi_def (gimple stmt, int flags)
1127 { 921 {
1128 tree def = PHI_RESULT (stmt); 922 tree def = PHI_RESULT (stmt);
1129 if ((flags & SSA_OP_DEF) && is_gimple_reg (def)) 923 if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
1130 return def; 924 return def;
1131 if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def)) 925 if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
1132 return def; 926 return def;
1133 return NULL_TREE; 927 return NULL_TREE;
1134 } 928 }
1145 ptr->done = false; 939 ptr->done = false;
1146 940
1147 gcc_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0); 941 gcc_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
1148 942
1149 comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES); 943 comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
1150 944
1151 /* If the PHI node doesn't the operand type we care about, we're done. */ 945 /* If the PHI node doesn't the operand type we care about, we're done. */
1152 if ((flags & comp) == 0) 946 if ((flags & comp) == 0)
1153 { 947 {
1154 ptr->done = true; 948 ptr->done = true;
1155 return NULL_USE_OPERAND_P; 949 return NULL_USE_OPERAND_P;
1174 ptr->done = false; 968 ptr->done = false;
1175 969
1176 gcc_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0); 970 gcc_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
1177 971
1178 comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS); 972 comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS);
1179 973
1180 /* If the PHI node doesn't the operand type we care about, we're done. */ 974 /* If the PHI node doesn't have the operand type we care about,
975 we're done. */
1181 if ((flags & comp) == 0) 976 if ((flags & comp) == 0)
1182 { 977 {
1183 ptr->done = true; 978 ptr->done = true;
1184 return NULL_USE_OPERAND_P; 979 return NULL_DEF_OPERAND_P;
1185 } 980 }
1186 981
1187 ptr->iter_type = ssa_op_iter_def; 982 ptr->iter_type = ssa_op_iter_def;
1188 /* The first call to op_iter_next_def will terminate the iterator since 983 /* The first call to op_iter_next_def will terminate the iterator since
1189 all the fields are NULL. Simply return the result here as the first and 984 all the fields are NULL. Simply return the result here as the first and
1208 delink_imm_use (&(imm->iter_node)); 1003 delink_imm_use (&(imm->iter_node));
1209 } 1004 }
1210 1005
1211 /* Immediate use traversal of uses within a stmt require that all the 1006 /* Immediate use traversal of uses within a stmt require that all the
1212 uses on a stmt be sequentially listed. This routine is used to build up 1007 uses on a stmt be sequentially listed. This routine is used to build up
1213 this sequential list by adding USE_P to the end of the current list 1008 this sequential list by adding USE_P to the end of the current list
1214 currently delimited by HEAD and LAST_P. The new LAST_P value is 1009 currently delimited by HEAD and LAST_P. The new LAST_P value is
1215 returned. */ 1010 returned. */
1216 1011
1217 static inline use_operand_p 1012 static inline use_operand_p
1218 move_use_after_head (use_operand_p use_p, use_operand_p head, 1013 move_use_after_head (use_operand_p use_p, use_operand_p head,
1219 use_operand_p last_p) 1014 use_operand_p last_p)
1220 { 1015 {
1221 gcc_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head)); 1016 gcc_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
1222 /* Skip head when we find it. */ 1017 /* Skip head when we find it. */
1223 if (use_p != head) 1018 if (use_p != head)
1259 if (USE_FROM_PTR (use_p) == use) 1054 if (USE_FROM_PTR (use_p) == use)
1260 last_p = move_use_after_head (use_p, head, last_p); 1055 last_p = move_use_after_head (use_p, head, last_p);
1261 } 1056 }
1262 else 1057 else
1263 { 1058 {
1264 FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag) 1059 if (flag == SSA_OP_USE)
1265 if (USE_FROM_PTR (use_p) == use) 1060 {
1266 last_p = move_use_after_head (use_p, head, last_p); 1061 FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag)
1062 if (USE_FROM_PTR (use_p) == use)
1063 last_p = move_use_after_head (use_p, head, last_p);
1064 }
1065 else if ((use_p = gimple_vuse_op (head_stmt)) != NULL_USE_OPERAND_P)
1066 {
1067 if (USE_FROM_PTR (use_p) == use)
1068 last_p = move_use_after_head (use_p, head, last_p);
1069 }
1267 } 1070 }
1268 /* Link iter node in after last_p. */ 1071 /* Link iter node in after last_p. */
1269 if (imm->iter_node.prev != NULL) 1072 if (imm->iter_node.prev != NULL)
1270 delink_imm_use (&imm->iter_node); 1073 delink_imm_use (&imm->iter_node);
1271 link_imm_use_to_list (&(imm->iter_node), last_p); 1074 link_imm_use_to_list (&(imm->iter_node), last_p);
1274 /* Initialize IMM to traverse over uses of VAR. Return the first statement. */ 1077 /* Initialize IMM to traverse over uses of VAR. Return the first statement. */
1275 static inline gimple 1078 static inline gimple
1276 first_imm_use_stmt (imm_use_iterator *imm, tree var) 1079 first_imm_use_stmt (imm_use_iterator *imm, tree var)
1277 { 1080 {
1278 gcc_assert (TREE_CODE (var) == SSA_NAME); 1081 gcc_assert (TREE_CODE (var) == SSA_NAME);
1279 1082
1280 imm->end_p = &(SSA_NAME_IMM_USE_NODE (var)); 1083 imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
1281 imm->imm_use = imm->end_p->next; 1084 imm->imm_use = imm->end_p->next;
1282 imm->next_imm_name = NULL_USE_OPERAND_P; 1085 imm->next_imm_name = NULL_USE_OPERAND_P;
1283 1086
1284 /* iter_node is used as a marker within the immediate use list to indicate 1087 /* iter_node is used as a marker within the immediate use list to indicate
1285 where the end of the current stmt's uses are. Initialize it to NULL 1088 where the end of the current stmt's uses are. Initialize it to NULL
1286 stmt and use, which indicates a marker node. */ 1089 stmt and use, which indicates a marker node. */
1287 imm->iter_node.prev = NULL_USE_OPERAND_P; 1090 imm->iter_node.prev = NULL_USE_OPERAND_P;
1288 imm->iter_node.next = NULL_USE_OPERAND_P; 1091 imm->iter_node.next = NULL_USE_OPERAND_P;
1289 imm->iter_node.loc.stmt = NULL; 1092 imm->iter_node.loc.stmt = NULL;
1290 imm->iter_node.use = NULL_USE_OPERAND_P; 1093 imm->iter_node.use = NULL;
1291 1094
1292 if (end_imm_use_stmt_p (imm)) 1095 if (end_imm_use_stmt_p (imm))
1293 return NULL; 1096 return NULL;
1294 1097
1295 link_use_stmts_after (imm->imm_use, imm); 1098 link_use_stmts_after (imm->imm_use, imm);
1352 static inline bool 1155 static inline bool
1353 unmodifiable_var_p (const_tree var) 1156 unmodifiable_var_p (const_tree var)
1354 { 1157 {
1355 if (TREE_CODE (var) == SSA_NAME) 1158 if (TREE_CODE (var) == SSA_NAME)
1356 var = SSA_NAME_VAR (var); 1159 var = SSA_NAME_VAR (var);
1357
1358 if (MTAG_P (var))
1359 return false;
1360 1160
1361 return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var)); 1161 return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
1362 } 1162 }
1363 1163
1364 /* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it. */ 1164 /* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it. */
1386 do { 1186 do {
1387 if (TREE_CODE (ref) == ARRAY_REF) 1187 if (TREE_CODE (ref) == ARRAY_REF)
1388 return true; 1188 return true;
1389 ref = TREE_OPERAND (ref, 0); 1189 ref = TREE_OPERAND (ref, 0);
1390 } while (handled_component_p (ref)); 1190 } while (handled_component_p (ref));
1191
1192 return false;
1193 }
1194
1195 /* Return true if REF has an VIEW_CONVERT_EXPR somewhere in it. */
1196
1197 static inline bool
1198 contains_view_convert_expr_p (const_tree ref)
1199 {
1200 while (handled_component_p (ref))
1201 {
1202 if (TREE_CODE (ref) == VIEW_CONVERT_EXPR)
1203 return true;
1204 ref = TREE_OPERAND (ref, 0);
1205 }
1391 1206
1392 return false; 1207 return false;
1393 } 1208 }
1394 1209
1395 /* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2] 1210 /* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2]
1412 return true; 1227 return true;
1413 1228
1414 return false; 1229 return false;
1415 } 1230 }
1416 1231
1417 /* Return the memory tag associated with symbol SYM. */
1418
1419 static inline tree
1420 symbol_mem_tag (tree sym)
1421 {
1422 tree tag = get_var_ann (sym)->symbol_mem_tag;
1423
1424 #if defined ENABLE_CHECKING
1425 if (tag)
1426 gcc_assert (TREE_CODE (tag) == SYMBOL_MEMORY_TAG);
1427 #endif
1428
1429 return tag;
1430 }
1431
1432
1433 /* Set the memory tag associated with symbol SYM. */
1434
1435 static inline void
1436 set_symbol_mem_tag (tree sym, tree tag)
1437 {
1438 #if defined ENABLE_CHECKING
1439 if (tag)
1440 gcc_assert (TREE_CODE (tag) == SYMBOL_MEMORY_TAG);
1441 #endif
1442
1443 get_var_ann (sym)->symbol_mem_tag = tag;
1444 }
1445
1446 /* Accessor to tree-ssa-operands.c caches. */ 1232 /* Accessor to tree-ssa-operands.c caches. */
1447 static inline struct ssa_operands * 1233 static inline struct ssa_operands *
1448 gimple_ssa_operands (const struct function *fun) 1234 gimple_ssa_operands (const struct function *fun)
1449 { 1235 {
1450 return &fun->gimple_df->ssa_operands; 1236 return &fun->gimple_df->ssa_operands;
1451 } 1237 }
1452 1238
1453 /* Map describing reference statistics for function FN. */
1454 static inline struct mem_ref_stats_d *
1455 gimple_mem_ref_stats (const struct function *fn)
1456 {
1457 return &fn->gimple_df->mem_ref_stats;
1458 }
1459
1460 /* Given an edge_var_map V, return the PHI arg definition. */ 1239 /* Given an edge_var_map V, return the PHI arg definition. */
1461 1240
1462 static inline tree 1241 static inline tree
1463 redirect_edge_var_map_def (edge_var_map *v) 1242 redirect_edge_var_map_def (edge_var_map *v)
1464 { 1243 {
1469 1248
1470 static inline tree 1249 static inline tree
1471 redirect_edge_var_map_result (edge_var_map *v) 1250 redirect_edge_var_map_result (edge_var_map *v)
1472 { 1251 {
1473 return v->result; 1252 return v->result;
1253 }
1254
1255 /* Given an edge_var_map V, return the PHI arg location. */
1256
1257 static inline source_location
1258 redirect_edge_var_map_location (edge_var_map *v)
1259 {
1260 return v->locus;
1474 } 1261 }
1475 1262
1476 1263
1477 /* Return an SSA_NAME node for variable VAR defined in statement STMT 1264 /* Return an SSA_NAME node for variable VAR defined in statement STMT
1478 in function cfun. */ 1265 in function cfun. */