OSDN Git Service

* tree-inline.c (copy_body_r): Use explicit cast when
[pf3gnuchains/gcc-fork.git] / gcc / tree-flow-inline.h
1 /* Inline functions for tree-flow.h
2    Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
3    Contributed by Diego Novillo <dnovillo@redhat.com>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.  */
21
22 #ifndef _TREE_FLOW_INLINE_H
23 #define _TREE_FLOW_INLINE_H 1
24
25 /* Inline functions for manipulating various data structures defined in
26    tree-flow.h.  See tree-flow.h for documentation.  */
27
28 /* Initialize the hashtable iterator HTI to point to hashtable TABLE */
29
30 static inline void *
31 first_htab_element (htab_iterator *hti, htab_t table)
32 {
33   hti->htab = table;
34   hti->slot = table->entries;
35   hti->limit = hti->slot + htab_size (table);
36   do
37     {
38       PTR x = *(hti->slot);
39       if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
40         break;
41     } while (++(hti->slot) < hti->limit);
42   
43   if (hti->slot < hti->limit)
44     return *(hti->slot);
45   return NULL;
46 }
47
48 /* Return current non-empty/deleted slot of the hashtable pointed to by HTI,
49    or NULL if we have  reached the end.  */
50
51 static inline bool
52 end_htab_p (htab_iterator *hti)
53 {
54   if (hti->slot >= hti->limit)
55     return true;
56   return false;
57 }
58
59 /* Advance the hashtable iterator pointed to by HTI to the next element of the
60    hashtable.  */
61
62 static inline void *
63 next_htab_element (htab_iterator *hti)
64 {
65   while (++(hti->slot) < hti->limit)
66     {
67       PTR x = *(hti->slot);
68       if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
69         return x;
70     };
71   return NULL;
72 }
73
74 /* Initialize ITER to point to the first referenced variable in the
75    referenced_vars hashtable, and return that variable.  */
76
77 static inline tree
78 first_referenced_var (referenced_var_iterator *iter)
79 {
80   struct int_tree_map *itm;
81   itm = (struct int_tree_map *) first_htab_element (&iter->hti,
82                                                     referenced_vars);
83   if (!itm) 
84     return NULL;
85   return itm->to;
86 }
87
88 /* Return true if we have hit the end of the referenced variables ITER is
89    iterating through.  */
90
91 static inline bool
92 end_referenced_vars_p (referenced_var_iterator *iter)
93 {
94   return end_htab_p (&iter->hti);
95 }
96
97 /* Make ITER point to the next referenced_var in the referenced_var hashtable,
98    and return that variable.  */
99
100 static inline tree
101 next_referenced_var (referenced_var_iterator *iter)
102 {
103   struct int_tree_map *itm;
104   itm = (struct int_tree_map *) next_htab_element (&iter->hti);
105   if (!itm) 
106     return NULL;
107   return itm->to;
108
109
110 /* Fill up VEC with the variables in the referenced vars hashtable.  */
111
112 static inline void
113 fill_referenced_var_vec (VEC (tree, heap) **vec)
114 {
115   referenced_var_iterator rvi;
116   tree var;
117   *vec = NULL;
118   FOR_EACH_REFERENCED_VAR (var, rvi)
119     VEC_safe_push (tree, heap, *vec, var);
120 }
121
122 /* Return the variable annotation for T, which must be a _DECL node.
123    Return NULL if the variable annotation doesn't already exist.  */
124 static inline var_ann_t
125 var_ann (tree t)
126 {
127   gcc_assert (t);
128   gcc_assert (DECL_P (t));
129   gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
130
131   return (var_ann_t) t->common.ann;
132 }
133
134 /* Return the variable annotation for T, which must be a _DECL node.
135    Create the variable annotation if it doesn't exist.  */
136 static inline var_ann_t
137 get_var_ann (tree var)
138 {
139   var_ann_t ann = var_ann (var);
140   return (ann) ? ann : create_var_ann (var);
141 }
142
143 /* Return the statement annotation for T, which must be a statement
144    node.  Return NULL if the statement annotation doesn't exist.  */
145 static inline stmt_ann_t
146 stmt_ann (tree t)
147 {
148 #ifdef ENABLE_CHECKING
149   gcc_assert (is_gimple_stmt (t));
150 #endif
151   return (stmt_ann_t) t->common.ann;
152 }
153
154 /* Return the statement annotation for T, which must be a statement
155    node.  Create the statement annotation if it doesn't exist.  */
156 static inline stmt_ann_t
157 get_stmt_ann (tree stmt)
158 {
159   stmt_ann_t ann = stmt_ann (stmt);
160   return (ann) ? ann : create_stmt_ann (stmt);
161 }
162
163 /* Return the annotation type for annotation ANN.  */
164 static inline enum tree_ann_type
165 ann_type (tree_ann_t ann)
166 {
167   return ann->common.type;
168 }
169
170 /* Return the basic block for statement T.  */
171 static inline basic_block
172 bb_for_stmt (tree t)
173 {
174   stmt_ann_t ann;
175
176   if (TREE_CODE (t) == PHI_NODE)
177     return PHI_BB (t);
178
179   ann = stmt_ann (t);
180   return ann ? ann->bb : NULL;
181 }
182
183 /* Return the may_aliases varray for variable VAR, or NULL if it has
184    no may aliases.  */
185 static inline varray_type
186 may_aliases (tree var)
187 {
188   var_ann_t ann = var_ann (var);
189   return ann ? ann->may_aliases : NULL;
190 }
191
192 /* Return the line number for EXPR, or return -1 if we have no line
193    number information for it.  */
194 static inline int
195 get_lineno (tree expr)
196 {
197   if (expr == NULL_TREE)
198     return -1;
199
200   if (TREE_CODE (expr) == COMPOUND_EXPR)
201     expr = TREE_OPERAND (expr, 0);
202
203   if (! EXPR_HAS_LOCATION (expr))
204     return -1;
205
206   return EXPR_LINENO (expr);
207 }
208
209 /* Return the file name for EXPR, or return "???" if we have no
210    filename information.  */
211 static inline const char *
212 get_filename (tree expr)
213 {
214   const char *filename;
215   if (expr == NULL_TREE)
216     return "???";
217
218   if (TREE_CODE (expr) == COMPOUND_EXPR)
219     expr = TREE_OPERAND (expr, 0);
220
221   if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
222     return filename;
223   else
224     return "???";
225 }
226
227 /* Return true if T is a noreturn call.  */
228 static inline bool
229 noreturn_call_p (tree t)
230 {
231   tree call = get_call_expr_in (t);
232   return call != 0 && (call_expr_flags (call) & ECF_NORETURN) != 0;
233 }
234
235 /* Mark statement T as modified.  */
236 static inline void
237 mark_stmt_modified (tree t)
238 {
239   stmt_ann_t ann;
240   if (TREE_CODE (t) == PHI_NODE)
241     return;
242
243   ann = stmt_ann (t);
244   if (ann == NULL)
245     ann = create_stmt_ann (t);
246   else if (noreturn_call_p (t))
247     VEC_safe_push (tree, gc, modified_noreturn_calls, t);
248   ann->modified = 1;
249 }
250
251 /* Mark statement T as modified, and update it.  */
252 static inline void
253 update_stmt (tree t)
254 {
255   if (TREE_CODE (t) == PHI_NODE)
256     return;
257   mark_stmt_modified (t);
258   update_stmt_operands (t);
259 }
260
261 static inline void
262 update_stmt_if_modified (tree t)
263 {
264   if (stmt_modified_p (t))
265     update_stmt_operands (t);
266 }
267
268 /* Return true if T is marked as modified, false otherwise.  */
269 static inline bool
270 stmt_modified_p (tree t)
271 {
272   stmt_ann_t ann = stmt_ann (t);
273
274   /* Note that if the statement doesn't yet have an annotation, we consider it
275      modified.  This will force the next call to update_stmt_operands to scan 
276      the statement.  */
277   return ann ? ann->modified : true;
278 }
279
280 /* Delink an immediate_uses node from its chain.  */
281 static inline void
282 delink_imm_use (ssa_use_operand_t *linknode)
283 {
284   /* Return if this node is not in a list.  */
285   if (linknode->prev == NULL)
286     return;
287
288   linknode->prev->next = linknode->next;
289   linknode->next->prev = linknode->prev;
290   linknode->prev = NULL;
291   linknode->next = NULL;
292 }
293
294 /* Link ssa_imm_use node LINKNODE into the chain for LIST.  */
295 static inline void
296 link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list)
297 {
298   /* Link the new node at the head of the list.  If we are in the process of 
299      traversing the list, we won't visit any new nodes added to it.  */
300   linknode->prev = list;
301   linknode->next = list->next;
302   list->next->prev = linknode;
303   list->next = linknode;
304 }
305
306 /* Link ssa_imm_use node LINKNODE into the chain for DEF.  */
307 static inline void
308 link_imm_use (ssa_use_operand_t *linknode, tree def)
309 {
310   ssa_use_operand_t *root;
311
312   if (!def || TREE_CODE (def) != SSA_NAME)
313     linknode->prev = NULL;
314   else
315     {
316       root = &(SSA_NAME_IMM_USE_NODE (def));
317 #ifdef ENABLE_CHECKING
318       if (linknode->use)
319         gcc_assert (*(linknode->use) == def);
320 #endif
321       link_imm_use_to_list (linknode, root);
322     }
323 }
324
325 /* Set the value of a use pointed to by USE to VAL.  */
326 static inline void
327 set_ssa_use_from_ptr (use_operand_p use, tree val)
328 {
329   delink_imm_use (use);
330   *(use->use) = val;
331   link_imm_use (use, val);
332 }
333
334 /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring 
335    in STMT.  */
336 static inline void
337 link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, tree stmt)
338 {
339   if (stmt)
340     link_imm_use (linknode, def);
341   else
342     link_imm_use (linknode, NULL);
343   linknode->stmt = stmt;
344 }
345
346 /* Relink a new node in place of an old node in the list.  */
347 static inline void
348 relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old)
349 {
350   /* The node one had better be in the same list.  */
351   gcc_assert (*(old->use) == *(node->use));
352   node->prev = old->prev;
353   node->next = old->next;
354   if (old->prev)
355     {
356       old->prev->next = node;
357       old->next->prev = node;
358       /* Remove the old node from the list.  */
359       old->prev = NULL;
360     }
361 }
362
363 /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring 
364    in STMT.  */
365 static inline void
366 relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, tree stmt)
367 {
368   if (stmt)
369     relink_imm_use (linknode, old);
370   else
371     link_imm_use (linknode, NULL);
372   linknode->stmt = stmt;
373 }
374
375 /* Finished the traverse of an immediate use list IMM by removing it from 
376    the list.  */
377 static inline void
378 end_safe_imm_use_traverse (imm_use_iterator *imm)
379 {
380  delink_imm_use (&(imm->iter_node));
381 }
382
383 /* Return true if IMM is at the end of the list.  */
384 static inline bool
385 end_safe_imm_use_p (imm_use_iterator *imm)
386 {
387   return (imm->imm_use == imm->end_p);
388 }
389
390 /* Initialize iterator IMM to process the list for VAR.  */
391 static inline use_operand_p
392 first_safe_imm_use (imm_use_iterator *imm, tree var)
393 {
394   /* Set up and link the iterator node into the linked list for VAR.  */
395   imm->iter_node.use = NULL;
396   imm->iter_node.stmt = NULL_TREE;
397   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
398   /* Check if there are 0 elements.  */
399   if (imm->end_p->next == imm->end_p)
400     {
401       imm->imm_use = imm->end_p;
402       return NULL_USE_OPERAND_P;
403     }
404
405   link_imm_use (&(imm->iter_node), var);
406   imm->imm_use = imm->iter_node.next;
407   return imm->imm_use;
408 }
409
410 /* Bump IMM to the next use in the list.  */
411 static inline use_operand_p
412 next_safe_imm_use (imm_use_iterator *imm)
413 {
414   ssa_use_operand_t *ptr;
415   use_operand_p old;
416
417   old = imm->imm_use;
418   /* If the next node following the iter_node is still the one referred to by
419      imm_use, then the list hasn't changed, go to the next node.  */
420   if (imm->iter_node.next == imm->imm_use)
421     {
422       ptr = &(imm->iter_node);
423       /* Remove iternode from the list.  */
424       delink_imm_use (ptr);
425       imm->imm_use = imm->imm_use->next;
426       if (! end_safe_imm_use_p (imm))
427         {
428           /* This isn't the end, link iternode before the next use.  */
429           ptr->prev = imm->imm_use->prev;
430           ptr->next = imm->imm_use;
431           imm->imm_use->prev->next = ptr;
432           imm->imm_use->prev = ptr;
433         }
434       else
435         return old;
436     }
437   else
438     {
439       /* If the 'next' value after the iterator isn't the same as it was, then
440          a node has been deleted, so we simply proceed to the node following 
441          where the iterator is in the list.  */
442       imm->imm_use = imm->iter_node.next;
443       if (end_safe_imm_use_p (imm))
444         {
445           end_safe_imm_use_traverse (imm);
446           return old;
447         }
448     }
449
450   return imm->imm_use;
451 }
452
453 /* Return true is IMM has reached the end of the immediate use list.  */
454 static inline bool
455 end_readonly_imm_use_p (imm_use_iterator *imm)
456 {
457   return (imm->imm_use == imm->end_p);
458 }
459
460 /* Initialize iterator IMM to process the list for VAR.  */
461 static inline use_operand_p
462 first_readonly_imm_use (imm_use_iterator *imm, tree var)
463 {
464   gcc_assert (TREE_CODE (var) == SSA_NAME);
465
466   imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
467   imm->imm_use = imm->end_p->next;
468 #ifdef ENABLE_CHECKING
469   imm->iter_node.next = imm->imm_use->next;
470 #endif
471   if (end_readonly_imm_use_p (imm))
472     return NULL_USE_OPERAND_P;
473   return imm->imm_use;
474 }
475
476 /* Bump IMM to the next use in the list.  */
477 static inline use_operand_p
478 next_readonly_imm_use (imm_use_iterator *imm)
479 {
480   use_operand_p old = imm->imm_use;
481
482 #ifdef ENABLE_CHECKING
483   /* If this assertion fails, it indicates the 'next' pointer has changed 
484      since we the last bump.  This indicates that the list is being modified
485      via stmt changes, or SET_USE, or somesuch thing, and you need to be
486      using the SAFE version of the iterator.  */
487   gcc_assert (imm->iter_node.next == old->next);
488   imm->iter_node.next = old->next->next;
489 #endif
490
491   imm->imm_use = old->next;
492   if (end_readonly_imm_use_p (imm))
493     return old;
494   return imm->imm_use;
495 }
496
497 /* Return true if VAR has no uses.  */
498 static inline bool
499 has_zero_uses (tree var)
500 {
501   ssa_use_operand_t *ptr;
502   ptr = &(SSA_NAME_IMM_USE_NODE (var));
503   /* A single use means there is no items in the list.  */
504   return (ptr == ptr->next);
505 }
506
507 /* Return true if VAR has a single use.  */
508 static inline bool
509 has_single_use (tree var)
510 {
511   ssa_use_operand_t *ptr;
512   ptr = &(SSA_NAME_IMM_USE_NODE (var));
513   /* A single use means there is one item in the list.  */
514   return (ptr != ptr->next && ptr == ptr->next->next);
515 }
516
517 /* If VAR has only a single immediate use, return true, and set USE_P and STMT
518    to the use pointer and stmt of occurrence.  */
519 static inline bool
520 single_imm_use (tree var, use_operand_p *use_p, tree *stmt)
521 {
522   ssa_use_operand_t *ptr;
523
524   ptr = &(SSA_NAME_IMM_USE_NODE (var));
525   if (ptr != ptr->next && ptr == ptr->next->next)
526     {
527       *use_p = ptr->next;
528       *stmt = ptr->next->stmt;
529       return true;
530     }
531   *use_p = NULL_USE_OPERAND_P;
532   *stmt = NULL_TREE;
533   return false;
534 }
535
536 /* Return the number of immediate uses of VAR.  */
537 static inline unsigned int
538 num_imm_uses (tree var)
539 {
540   ssa_use_operand_t *ptr, *start;
541   unsigned int num;
542
543   start = &(SSA_NAME_IMM_USE_NODE (var));
544   num = 0;
545   for (ptr = start->next; ptr != start; ptr = ptr->next)
546      num++;
547
548   return num;
549 }
550
551
552 /* Return the tree pointer to by USE.  */ 
553 static inline tree
554 get_use_from_ptr (use_operand_p use)
555
556   return *(use->use);
557
558
559 /* Return the tree pointer to by DEF.  */
560 static inline tree
561 get_def_from_ptr (def_operand_p def)
562 {
563   return *def;
564 }
565
566 /* Return a def_operand_p pointer for the result of PHI.  */
567 static inline def_operand_p
568 get_phi_result_ptr (tree phi)
569 {
570   return &(PHI_RESULT_TREE (phi));
571 }
572
573 /* Return a use_operand_p pointer for argument I of phinode PHI.  */
574 static inline use_operand_p
575 get_phi_arg_def_ptr (tree phi, int i)
576 {
577   return &(PHI_ARG_IMM_USE_NODE (phi,i));
578 }
579
580
581 /* Return the bitmap of addresses taken by STMT, or NULL if it takes
582    no addresses.  */
583 static inline bitmap
584 addresses_taken (tree stmt)
585 {
586   stmt_ann_t ann = stmt_ann (stmt);
587   return ann ? ann->addresses_taken : NULL;
588 }
589
590 /* Return the PHI nodes for basic block BB, or NULL if there are no
591    PHI nodes.  */
592 static inline tree
593 phi_nodes (basic_block bb)
594 {
595   return bb->phi_nodes;
596 }
597
598 /* Set list of phi nodes of a basic block BB to L.  */
599
600 static inline void
601 set_phi_nodes (basic_block bb, tree l)
602 {
603   tree phi;
604
605   bb->phi_nodes = l;
606   for (phi = l; phi; phi = PHI_CHAIN (phi))
607     set_bb_for_stmt (phi, bb);
608 }
609
610 /* Return the phi argument which contains the specified use.  */
611
612 static inline int
613 phi_arg_index_from_use (use_operand_p use)
614 {
615   struct phi_arg_d *element, *root;
616   int index;
617   tree phi;
618
619   /* Since the use is the first thing in a PHI argument element, we can
620      calculate its index based on casting it to an argument, and performing
621      pointer arithmetic.  */
622
623   phi = USE_STMT (use);
624   gcc_assert (TREE_CODE (phi) == PHI_NODE);
625
626   element = (struct phi_arg_d *)use;
627   root = &(PHI_ARG_ELT (phi, 0));
628   index = element - root;
629
630 #ifdef ENABLE_CHECKING
631   /* Make sure the calculation doesn't have any leftover bytes.  If it does, 
632      then imm_use is likely not the first element in phi_arg_d.  */
633   gcc_assert (
634           (((char *)element - (char *)root) % sizeof (struct phi_arg_d)) == 0);
635   gcc_assert (index >= 0 && index < PHI_ARG_CAPACITY (phi));
636 #endif
637  
638  return index;
639 }
640
641 /* Mark VAR as used, so that it'll be preserved during rtl expansion.  */
642
643 static inline void
644 set_is_used (tree var)
645 {
646   var_ann_t ann = get_var_ann (var);
647   ann->used = 1;
648 }
649
650
651 /*  -----------------------------------------------------------------------  */
652
653 /* Return true if T is an executable statement.  */
654 static inline bool
655 is_exec_stmt (tree t)
656 {
657   return (t && !IS_EMPTY_STMT (t) && t != error_mark_node);
658 }
659
660
661 /* Return true if this stmt can be the target of a control transfer stmt such
662    as a goto.  */
663 static inline bool
664 is_label_stmt (tree t)
665 {
666   if (t)
667     switch (TREE_CODE (t))
668       {
669         case LABEL_DECL:
670         case LABEL_EXPR:
671         case CASE_LABEL_EXPR:
672           return true;
673         default:
674           return false;
675       }
676   return false;
677 }
678
679 /* PHI nodes should contain only ssa_names and invariants.  A test
680    for ssa_name is definitely simpler; don't let invalid contents
681    slip in in the meantime.  */
682
683 static inline bool
684 phi_ssa_name_p (tree t)
685 {
686   if (TREE_CODE (t) == SSA_NAME)
687     return true;
688 #ifdef ENABLE_CHECKING
689   gcc_assert (is_gimple_min_invariant (t));
690 #endif
691   return false;
692 }
693
694 /*  -----------------------------------------------------------------------  */
695
696 /* Return a block_stmt_iterator that points to beginning of basic
697    block BB.  */
698 static inline block_stmt_iterator
699 bsi_start (basic_block bb)
700 {
701   block_stmt_iterator bsi;
702   if (bb->stmt_list)
703     bsi.tsi = tsi_start (bb->stmt_list);
704   else
705     {
706       gcc_assert (bb->index < NUM_FIXED_BLOCKS);
707       bsi.tsi.ptr = NULL;
708       bsi.tsi.container = NULL;
709     }
710   bsi.bb = bb;
711   return bsi;
712 }
713
714 /* Return a block statement iterator that points to the first non-label
715    block BB.  */
716
717 static inline block_stmt_iterator
718 bsi_after_labels (basic_block bb)
719 {
720   block_stmt_iterator bsi;
721   tree_stmt_iterator next;
722
723   bsi.bb = bb;
724
725   if (!bb->stmt_list)
726     {
727       gcc_assert (bb->index < NUM_FIXED_BLOCKS);
728       bsi.tsi.ptr = NULL;
729       bsi.tsi.container = NULL;
730       return bsi;
731     }
732
733   bsi.tsi = tsi_start (bb->stmt_list);
734   if (tsi_end_p (bsi.tsi))
735     return bsi;
736
737   next = bsi.tsi;
738   tsi_next (&next);
739
740   while (!tsi_end_p (next)
741          && TREE_CODE (tsi_stmt (next)) == LABEL_EXPR)
742     {
743       bsi.tsi = next;
744       tsi_next (&next);
745     }
746
747   return bsi;
748 }
749
750 /* Return a block statement iterator that points to the end of basic
751    block BB.  */
752 static inline block_stmt_iterator
753 bsi_last (basic_block bb)
754 {
755   block_stmt_iterator bsi;
756   if (bb->stmt_list)
757     bsi.tsi = tsi_last (bb->stmt_list);
758   else
759     {
760       gcc_assert (bb->index < NUM_FIXED_BLOCKS);
761       bsi.tsi.ptr = NULL;
762       bsi.tsi.container = NULL;
763     }
764   bsi.bb = bb;
765   return bsi;
766 }
767
768 /* Return true if block statement iterator I has reached the end of
769    the basic block.  */
770 static inline bool
771 bsi_end_p (block_stmt_iterator i)
772 {
773   return tsi_end_p (i.tsi);
774 }
775
776 /* Modify block statement iterator I so that it is at the next
777    statement in the basic block.  */
778 static inline void
779 bsi_next (block_stmt_iterator *i)
780 {
781   tsi_next (&i->tsi);
782 }
783
784 /* Modify block statement iterator I so that it is at the previous
785    statement in the basic block.  */
786 static inline void
787 bsi_prev (block_stmt_iterator *i)
788 {
789   tsi_prev (&i->tsi);
790 }
791
792 /* Return the statement that block statement iterator I is currently
793    at.  */
794 static inline tree
795 bsi_stmt (block_stmt_iterator i)
796 {
797   return tsi_stmt (i.tsi);
798 }
799
800 /* Return a pointer to the statement that block statement iterator I
801    is currently at.  */
802 static inline tree *
803 bsi_stmt_ptr (block_stmt_iterator i)
804 {
805   return tsi_stmt_ptr (i.tsi);
806 }
807
808 /* Returns the loop of the statement STMT.  */
809
810 static inline struct loop *
811 loop_containing_stmt (tree stmt)
812 {
813   basic_block bb = bb_for_stmt (stmt);
814   if (!bb)
815     return NULL;
816
817   return bb->loop_father;
818 }
819
820 /* Return true if VAR is a clobbered by function calls.  */
821 static inline bool
822 is_call_clobbered (tree var)
823 {
824   return is_global_var (var)
825     || bitmap_bit_p (call_clobbered_vars, DECL_UID (var));
826 }
827
828 /* Mark variable VAR as being clobbered by function calls.  */
829 static inline void
830 mark_call_clobbered (tree var)
831 {
832   /* If VAR is a memory tag, then we need to consider it a global
833      variable.  This is because the pointer that VAR represents has
834      been found to point to either an arbitrary location or to a known
835      location in global memory.  */
836   if (MTAG_P (var) && TREE_CODE (var) != STRUCT_FIELD_TAG)
837     MTAG_GLOBAL (var) = 1;
838   bitmap_set_bit (call_clobbered_vars, DECL_UID (var));
839   ssa_call_clobbered_cache_valid = false;
840   ssa_ro_call_cache_valid = false;
841 }
842
843 /* Clear the call-clobbered attribute from variable VAR.  */
844 static inline void
845 clear_call_clobbered (tree var)
846 {
847   if (MTAG_P (var) && TREE_CODE (var) != STRUCT_FIELD_TAG)
848     MTAG_GLOBAL (var) = 0;
849   bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
850   ssa_call_clobbered_cache_valid = false;
851   ssa_ro_call_cache_valid = false;
852 }
853
854 /* Mark variable VAR as being non-addressable.  */
855 static inline void
856 mark_non_addressable (tree var)
857 {
858   bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
859   TREE_ADDRESSABLE (var) = 0;
860   ssa_call_clobbered_cache_valid = false;
861   ssa_ro_call_cache_valid = false;
862 }
863
864 /* Return the common annotation for T.  Return NULL if the annotation
865    doesn't already exist.  */
866 static inline tree_ann_t
867 tree_ann (tree t)
868 {
869   return t->common.ann;
870 }
871
872 /* Return a common annotation for T.  Create the constant annotation if it
873    doesn't exist.  */
874 static inline tree_ann_t
875 get_tree_ann (tree t)
876 {
877   tree_ann_t ann = tree_ann (t);
878   return (ann) ? ann : create_tree_ann (t);
879 }
880
881 /*  -----------------------------------------------------------------------  */
882
883 /* The following set of routines are used to iterator over various type of
884    SSA operands.  */
885
886 /* Return true if PTR is finished iterating.  */
887 static inline bool
888 op_iter_done (ssa_op_iter *ptr)
889 {
890   return ptr->done;
891 }
892
893 /* Get the next iterator use value for PTR.  */
894 static inline use_operand_p
895 op_iter_next_use (ssa_op_iter *ptr)
896 {
897   use_operand_p use_p;
898 #ifdef ENABLE_CHECKING
899   gcc_assert (ptr->iter_type == ssa_op_iter_use);
900 #endif
901   if (ptr->uses)
902     {
903       use_p = USE_OP_PTR (ptr->uses);
904       ptr->uses = ptr->uses->next;
905       return use_p;
906     }
907   if (ptr->vuses)
908     {
909       use_p = VUSE_OP_PTR (ptr->vuses);
910       ptr->vuses = ptr->vuses->next;
911       return use_p;
912     }
913   if (ptr->mayuses)
914     {
915       use_p = MAYDEF_OP_PTR (ptr->mayuses);
916       ptr->mayuses = ptr->mayuses->next;
917       return use_p;
918     }
919   if (ptr->mustkills)
920     {
921       use_p = MUSTDEF_KILL_PTR (ptr->mustkills);
922       ptr->mustkills = ptr->mustkills->next;
923       return use_p;
924     }
925   if (ptr->phi_i < ptr->num_phi)
926     {
927       return PHI_ARG_DEF_PTR (ptr->phi_stmt, (ptr->phi_i)++);
928     }
929   ptr->done = true;
930   return NULL_USE_OPERAND_P;
931 }
932
933 /* Get the next iterator def value for PTR.  */
934 static inline def_operand_p
935 op_iter_next_def (ssa_op_iter *ptr)
936 {
937   def_operand_p def_p;
938 #ifdef ENABLE_CHECKING
939   gcc_assert (ptr->iter_type == ssa_op_iter_def);
940 #endif
941   if (ptr->defs)
942     {
943       def_p = DEF_OP_PTR (ptr->defs);
944       ptr->defs = ptr->defs->next;
945       return def_p;
946     }
947   if (ptr->mustdefs)
948     {
949       def_p = MUSTDEF_RESULT_PTR (ptr->mustdefs);
950       ptr->mustdefs = ptr->mustdefs->next;
951       return def_p;
952     }
953   if (ptr->maydefs)
954     {
955       def_p = MAYDEF_RESULT_PTR (ptr->maydefs);
956       ptr->maydefs = ptr->maydefs->next;
957       return def_p;
958     }
959   ptr->done = true;
960   return NULL_DEF_OPERAND_P;
961 }
962
963 /* Get the next iterator tree value for PTR.  */
964 static inline tree
965 op_iter_next_tree (ssa_op_iter *ptr)
966 {
967   tree val;
968 #ifdef ENABLE_CHECKING
969   gcc_assert (ptr->iter_type == ssa_op_iter_tree);
970 #endif
971   if (ptr->uses)
972     {
973       val = USE_OP (ptr->uses);
974       ptr->uses = ptr->uses->next;
975       return val;
976     }
977   if (ptr->vuses)
978     {
979       val = VUSE_OP (ptr->vuses);
980       ptr->vuses = ptr->vuses->next;
981       return val;
982     }
983   if (ptr->mayuses)
984     {
985       val = MAYDEF_OP (ptr->mayuses);
986       ptr->mayuses = ptr->mayuses->next;
987       return val;
988     }
989   if (ptr->mustkills)
990     {
991       val = MUSTDEF_KILL (ptr->mustkills);
992       ptr->mustkills = ptr->mustkills->next;
993       return val;
994     }
995   if (ptr->defs)
996     {
997       val = DEF_OP (ptr->defs);
998       ptr->defs = ptr->defs->next;
999       return val;
1000     }
1001   if (ptr->mustdefs)
1002     {
1003       val = MUSTDEF_RESULT (ptr->mustdefs);
1004       ptr->mustdefs = ptr->mustdefs->next;
1005       return val;
1006     }
1007   if (ptr->maydefs)
1008     {
1009       val = MAYDEF_RESULT (ptr->maydefs);
1010       ptr->maydefs = ptr->maydefs->next;
1011       return val;
1012     }
1013
1014   ptr->done = true;
1015   return NULL_TREE;
1016
1017 }
1018
1019
1020 /* This functions clears the iterator PTR, and marks it done.  This is normally
1021    used to prevent warnings in the compile about might be uninitialized
1022    components.  */
1023
1024 static inline void
1025 clear_and_done_ssa_iter (ssa_op_iter *ptr)
1026 {
1027   ptr->defs = NULL;
1028   ptr->uses = NULL;
1029   ptr->vuses = NULL;
1030   ptr->maydefs = NULL;
1031   ptr->mayuses = NULL;
1032   ptr->mustdefs = NULL;
1033   ptr->mustkills = NULL;
1034   ptr->iter_type = ssa_op_iter_none;
1035   ptr->phi_i = 0;
1036   ptr->num_phi = 0;
1037   ptr->phi_stmt = NULL_TREE;
1038   ptr->done = true;
1039 }
1040
1041 /* Initialize the iterator PTR to the virtual defs in STMT.  */
1042 static inline void
1043 op_iter_init (ssa_op_iter *ptr, tree stmt, int flags)
1044 {
1045 #ifdef ENABLE_CHECKING
1046   gcc_assert (stmt_ann (stmt));
1047 #endif
1048
1049   ptr->defs = (flags & SSA_OP_DEF) ? DEF_OPS (stmt) : NULL;
1050   ptr->uses = (flags & SSA_OP_USE) ? USE_OPS (stmt) : NULL;
1051   ptr->vuses = (flags & SSA_OP_VUSE) ? VUSE_OPS (stmt) : NULL;
1052   ptr->maydefs = (flags & SSA_OP_VMAYDEF) ? MAYDEF_OPS (stmt) : NULL;
1053   ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? MAYDEF_OPS (stmt) : NULL;
1054   ptr->mustdefs = (flags & SSA_OP_VMUSTDEF) ? MUSTDEF_OPS (stmt) : NULL;
1055   ptr->mustkills = (flags & SSA_OP_VMUSTKILL) ? MUSTDEF_OPS (stmt) : NULL;
1056   ptr->done = false;
1057
1058   ptr->phi_i = 0;
1059   ptr->num_phi = 0;
1060   ptr->phi_stmt = NULL_TREE;
1061 }
1062
1063 /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
1064    the first use.  */
1065 static inline use_operand_p
1066 op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags)
1067 {
1068   gcc_assert ((flags & SSA_OP_ALL_DEFS) == 0);
1069   op_iter_init (ptr, stmt, flags);
1070   ptr->iter_type = ssa_op_iter_use;
1071   return op_iter_next_use (ptr);
1072 }
1073
1074 /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
1075    the first def.  */
1076 static inline def_operand_p
1077 op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags)
1078 {
1079   gcc_assert ((flags & (SSA_OP_ALL_USES | SSA_OP_VIRTUAL_KILLS)) == 0);
1080   op_iter_init (ptr, stmt, flags);
1081   ptr->iter_type = ssa_op_iter_def;
1082   return op_iter_next_def (ptr);
1083 }
1084
1085 /* Initialize iterator PTR to the operands in STMT based on FLAGS. Return
1086    the first operand as a tree.  */
1087 static inline tree
1088 op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags)
1089 {
1090   op_iter_init (ptr, stmt, flags);
1091   ptr->iter_type = ssa_op_iter_tree;
1092   return op_iter_next_tree (ptr);
1093 }
1094
1095 /* Get the next iterator mustdef value for PTR, returning the mustdef values in
1096    KILL and DEF.  */
1097 static inline void
1098 op_iter_next_maymustdef (use_operand_p *use, def_operand_p *def, 
1099                          ssa_op_iter *ptr)
1100 {
1101 #ifdef ENABLE_CHECKING
1102   gcc_assert (ptr->iter_type == ssa_op_iter_maymustdef);
1103 #endif
1104   if (ptr->mayuses)
1105     {
1106       *def = MAYDEF_RESULT_PTR (ptr->mayuses);
1107       *use = MAYDEF_OP_PTR (ptr->mayuses);
1108       ptr->mayuses = ptr->mayuses->next;
1109       return;
1110     }
1111
1112   if (ptr->mustkills)
1113     {
1114       *def = MUSTDEF_RESULT_PTR (ptr->mustkills);
1115       *use = MUSTDEF_KILL_PTR (ptr->mustkills);
1116       ptr->mustkills = ptr->mustkills->next;
1117       return;
1118     }
1119
1120   *def = NULL_DEF_OPERAND_P;
1121   *use = NULL_USE_OPERAND_P;
1122   ptr->done = true;
1123   return;
1124 }
1125
1126
1127 /* Initialize iterator PTR to the operands in STMT.  Return the first operands
1128    in USE and DEF.  */
1129 static inline void
1130 op_iter_init_maydef (ssa_op_iter *ptr, tree stmt, use_operand_p *use, 
1131                      def_operand_p *def)
1132 {
1133   gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1134
1135   op_iter_init (ptr, stmt, SSA_OP_VMAYUSE);
1136   ptr->iter_type = ssa_op_iter_maymustdef;
1137   op_iter_next_maymustdef (use, def, ptr);
1138 }
1139
1140
1141 /* Initialize iterator PTR to the operands in STMT.  Return the first operands
1142    in KILL and DEF.  */
1143 static inline void
1144 op_iter_init_mustdef (ssa_op_iter *ptr, tree stmt, use_operand_p *kill, 
1145                      def_operand_p *def)
1146 {
1147   gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1148
1149   op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL);
1150   ptr->iter_type = ssa_op_iter_maymustdef;
1151   op_iter_next_maymustdef (kill, def, ptr);
1152 }
1153
1154 /* Initialize iterator PTR to the operands in STMT.  Return the first operands
1155    in KILL and DEF.  */
1156 static inline void
1157 op_iter_init_must_and_may_def (ssa_op_iter *ptr, tree stmt,
1158                                use_operand_p *kill, def_operand_p *def)
1159 {
1160   gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1161
1162   op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL|SSA_OP_VMAYUSE);
1163   ptr->iter_type = ssa_op_iter_maymustdef;
1164   op_iter_next_maymustdef (kill, def, ptr);
1165 }
1166
1167
1168 /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
1169    return NULL.  */
1170 static inline tree
1171 single_ssa_tree_operand (tree stmt, int flags)
1172 {
1173   tree var;
1174   ssa_op_iter iter;
1175
1176   var = op_iter_init_tree (&iter, stmt, flags);
1177   if (op_iter_done (&iter))
1178     return NULL_TREE;
1179   op_iter_next_tree (&iter);
1180   if (op_iter_done (&iter))
1181     return var;
1182   return NULL_TREE;
1183 }
1184
1185
1186 /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
1187    return NULL.  */
1188 static inline use_operand_p
1189 single_ssa_use_operand (tree stmt, int flags)
1190 {
1191   use_operand_p var;
1192   ssa_op_iter iter;
1193
1194   var = op_iter_init_use (&iter, stmt, flags);
1195   if (op_iter_done (&iter))
1196     return NULL_USE_OPERAND_P;
1197   op_iter_next_use (&iter);
1198   if (op_iter_done (&iter))
1199     return var;
1200   return NULL_USE_OPERAND_P;
1201 }
1202
1203
1204
1205 /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
1206    return NULL.  */
1207 static inline def_operand_p
1208 single_ssa_def_operand (tree stmt, int flags)
1209 {
1210   def_operand_p var;
1211   ssa_op_iter iter;
1212
1213   var = op_iter_init_def (&iter, stmt, flags);
1214   if (op_iter_done (&iter))
1215     return NULL_DEF_OPERAND_P;
1216   op_iter_next_def (&iter);
1217   if (op_iter_done (&iter))
1218     return var;
1219   return NULL_DEF_OPERAND_P;
1220 }
1221
1222
1223 /* If there is a single operand in STMT matching FLAGS, return it.  Otherwise
1224    return NULL.  */
1225 static inline bool
1226 zero_ssa_operands (tree stmt, int flags)
1227 {
1228   ssa_op_iter iter;
1229
1230   op_iter_init_tree (&iter, stmt, flags);
1231   return op_iter_done (&iter);
1232 }
1233
1234
1235 /* Return the number of operands matching FLAGS in STMT.  */
1236 static inline int
1237 num_ssa_operands (tree stmt, int flags)
1238 {
1239   ssa_op_iter iter;
1240   tree t;
1241   int num = 0;
1242
1243   FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags)
1244     num++;
1245   return num;
1246 }
1247
1248
1249 /* Delink all immediate_use information for STMT.  */
1250 static inline void
1251 delink_stmt_imm_use (tree stmt)
1252 {
1253    ssa_op_iter iter;
1254    use_operand_p use_p;
1255
1256    if (ssa_operands_active ())
1257      FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter,
1258                                (SSA_OP_ALL_USES | SSA_OP_ALL_KILLS))
1259        delink_imm_use (use_p);
1260 }
1261
1262
1263 /* This routine will compare all the operands matching FLAGS in STMT1 to those
1264    in STMT2.  TRUE is returned if they are the same.  STMTs can be NULL.  */
1265 static inline bool
1266 compare_ssa_operands_equal (tree stmt1, tree stmt2, int flags)
1267 {
1268   ssa_op_iter iter1, iter2;
1269   tree op1 = NULL_TREE;
1270   tree op2 = NULL_TREE;
1271   bool look1, look2;
1272
1273   if (stmt1 == stmt2)
1274     return true;
1275
1276   look1 = stmt1 && stmt_ann (stmt1);
1277   look2 = stmt2 && stmt_ann (stmt2);
1278
1279   if (look1)
1280     {
1281       op1 = op_iter_init_tree (&iter1, stmt1, flags);
1282       if (!look2)
1283         return op_iter_done (&iter1);
1284     }
1285   else
1286     clear_and_done_ssa_iter (&iter1);
1287
1288   if (look2)
1289     {
1290       op2 = op_iter_init_tree (&iter2, stmt2, flags);
1291       if (!look1)
1292         return op_iter_done (&iter2);
1293     }
1294   else
1295     clear_and_done_ssa_iter (&iter2);
1296
1297   while (!op_iter_done (&iter1) && !op_iter_done (&iter2))
1298     {
1299       if (op1 != op2)
1300         return false;
1301       op1 = op_iter_next_tree (&iter1);
1302       op2 = op_iter_next_tree (&iter2);
1303     }
1304
1305   return (op_iter_done (&iter1) && op_iter_done (&iter2));
1306 }
1307
1308
1309 /* If there is a single DEF in the PHI node which matches FLAG, return it.
1310    Otherwise return NULL_DEF_OPERAND_P.  */
1311 static inline tree
1312 single_phi_def (tree stmt, int flags)
1313 {
1314   tree def = PHI_RESULT (stmt);
1315   if ((flags & SSA_OP_DEF) && is_gimple_reg (def)) 
1316     return def;
1317   if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
1318     return def;
1319   return NULL_TREE;
1320 }
1321
1322 /* Initialize the iterator PTR for uses matching FLAGS in PHI.  FLAGS should
1323    be either SSA_OP_USES or SAS_OP_VIRTUAL_USES.  */
1324 static inline use_operand_p
1325 op_iter_init_phiuse (ssa_op_iter *ptr, tree phi, int flags)
1326 {
1327   tree phi_def = PHI_RESULT (phi);
1328   int comp;
1329
1330   clear_and_done_ssa_iter (ptr);
1331   ptr->done = false;
1332
1333   gcc_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
1334
1335   comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
1336     
1337   /* If the PHI node doesn't the operand type we care about, we're done.  */
1338   if ((flags & comp) == 0)
1339     {
1340       ptr->done = true;
1341       return NULL_USE_OPERAND_P;
1342     }
1343
1344   ptr->phi_stmt = phi;
1345   ptr->num_phi = PHI_NUM_ARGS (phi);
1346   ptr->iter_type = ssa_op_iter_use;
1347   return op_iter_next_use (ptr);
1348 }
1349
1350
1351 /* Start an iterator for a PHI definition.  */
1352
1353 static inline def_operand_p
1354 op_iter_init_phidef (ssa_op_iter *ptr, tree phi, int flags)
1355 {
1356   tree phi_def = PHI_RESULT (phi);
1357   int comp;
1358
1359   clear_and_done_ssa_iter (ptr);
1360   ptr->done = false;
1361
1362   gcc_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
1363
1364   comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS);
1365     
1366   /* If the PHI node doesn't the operand type we care about, we're done.  */
1367   if ((flags & comp) == 0)
1368     {
1369       ptr->done = true;
1370       return NULL_USE_OPERAND_P;
1371     }
1372
1373   ptr->iter_type = ssa_op_iter_def;
1374   /* The first call to op_iter_next_def will terminate the iterator since
1375      all the fields are NULL.  Simply return the result here as the first and
1376      therefore only result.  */
1377   return PHI_RESULT_PTR (phi);
1378 }
1379
1380
1381
1382 /* Return true if VAR cannot be modified by the program.  */
1383
1384 static inline bool
1385 unmodifiable_var_p (tree var)
1386 {
1387   if (TREE_CODE (var) == SSA_NAME)
1388     var = SSA_NAME_VAR (var);
1389
1390   if (MTAG_P (var))
1391     return TREE_READONLY (var) && (TREE_STATIC (var) || MTAG_GLOBAL (var));
1392
1393   return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
1394 }
1395
1396 /* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it.  */
1397
1398 static inline bool
1399 array_ref_contains_indirect_ref (tree ref)
1400 {
1401   gcc_assert (TREE_CODE (ref) == ARRAY_REF);
1402
1403   do {
1404     ref = TREE_OPERAND (ref, 0);
1405   } while (handled_component_p (ref));
1406
1407   return TREE_CODE (ref) == INDIRECT_REF;
1408 }
1409
1410 /* Return true if REF, a handled component reference, has an ARRAY_REF
1411    somewhere in it.  */
1412
1413 static inline bool
1414 ref_contains_array_ref (tree ref)
1415 {
1416   gcc_assert (handled_component_p (ref));
1417
1418   do {
1419     if (TREE_CODE (ref) == ARRAY_REF)
1420       return true;
1421     ref = TREE_OPERAND (ref, 0);
1422   } while (handled_component_p (ref));
1423
1424   return false;
1425 }
1426
1427 /* Given a variable VAR, lookup and return a pointer to the list of
1428    subvariables for it.  */
1429
1430 static inline subvar_t *
1431 lookup_subvars_for_var (tree var)
1432 {
1433   var_ann_t ann = var_ann (var);
1434   gcc_assert (ann);
1435   return &ann->subvars;
1436 }
1437
1438 /* Given a variable VAR, return a linked list of subvariables for VAR, or
1439    NULL, if there are no subvariables.  */
1440
1441 static inline subvar_t
1442 get_subvars_for_var (tree var)
1443 {
1444   subvar_t subvars;
1445
1446   gcc_assert (SSA_VAR_P (var));  
1447   
1448   if (TREE_CODE (var) == SSA_NAME)
1449     subvars = *(lookup_subvars_for_var (SSA_NAME_VAR (var)));
1450   else
1451     subvars = *(lookup_subvars_for_var (var));
1452   return subvars;
1453 }
1454
1455 /* Return the subvariable of VAR at offset OFFSET.  */
1456
1457 static inline tree
1458 get_subvar_at (tree var, unsigned HOST_WIDE_INT offset)
1459 {
1460   subvar_t sv;
1461
1462   for (sv = get_subvars_for_var (var); sv; sv = sv->next)
1463     if (sv->offset == offset)
1464       return sv->var;
1465
1466   return NULL_TREE;
1467 }
1468
1469 /* Return true if V is a tree that we can have subvars for.
1470    Normally, this is any aggregate type, however, due to implementation
1471    limitations ATM, we exclude array types as well.  */
1472
1473 static inline bool
1474 var_can_have_subvars (tree v)
1475 {
1476   return (AGGREGATE_TYPE_P (TREE_TYPE (v)) &&
1477           TREE_CODE (TREE_TYPE (v)) != ARRAY_TYPE);
1478 }
1479
1480   
1481 /* Return true if OFFSET and SIZE define a range that overlaps with some
1482    portion of the range of SV, a subvar.  If there was an exact overlap,
1483    *EXACT will be set to true upon return. */
1484
1485 static inline bool
1486 overlap_subvar (unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size,
1487                 subvar_t sv,  bool *exact)
1488 {
1489   /* There are three possible cases of overlap.
1490      1. We can have an exact overlap, like so:   
1491      |offset, offset + size             |
1492      |sv->offset, sv->offset + sv->size |
1493      
1494      2. We can have offset starting after sv->offset, like so:
1495      
1496            |offset, offset + size              |
1497      |sv->offset, sv->offset + sv->size  |
1498
1499      3. We can have offset starting before sv->offset, like so:
1500      
1501      |offset, offset + size    |
1502        |sv->offset, sv->offset + sv->size|
1503   */
1504
1505   if (exact)
1506     *exact = false;
1507   if (offset == sv->offset && size == sv->size)
1508     {
1509       if (exact)
1510         *exact = true;
1511       return true;
1512     }
1513   else if (offset >= sv->offset && offset < (sv->offset + sv->size))
1514     {
1515       return true;
1516     }
1517   else if (offset < sv->offset && (size > sv->offset - offset))
1518     {
1519       return true;
1520     }
1521   return false;
1522
1523 }
1524
1525 #endif /* _TREE_FLOW_INLINE_H  */