* rw.po: Remove.
[official-gcc.git] / gcc / tree-flow-inline.h
blob89d9a4fdfd09902d81c4f4473522a38a1c10c1b7
1 /* Inline functions for tree-flow.h
2 Copyright (C) 2001, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
3 Contributed by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
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 3, or (at your option)
10 any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef _TREE_FLOW_INLINE_H
22 #define _TREE_FLOW_INLINE_H 1
24 /* Inline functions for manipulating various data structures defined in
25 tree-flow.h. See tree-flow.h for documentation. */
27 /* Initialize the hashtable iterator HTI to point to hashtable TABLE */
29 static inline void *
30 first_htab_element (htab_iterator *hti, htab_t table)
32 hti->htab = table;
33 hti->slot = table->entries;
34 hti->limit = hti->slot + htab_size (table);
37 PTR x = *(hti->slot);
38 if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
39 break;
40 } while (++(hti->slot) < hti->limit);
42 if (hti->slot < hti->limit)
43 return *(hti->slot);
44 return NULL;
47 /* Return current non-empty/deleted slot of the hashtable pointed to by HTI,
48 or NULL if we have reached the end. */
50 static inline bool
51 end_htab_p (htab_iterator *hti)
53 if (hti->slot >= hti->limit)
54 return true;
55 return false;
58 /* Advance the hashtable iterator pointed to by HTI to the next element of the
59 hashtable. */
61 static inline void *
62 next_htab_element (htab_iterator *hti)
64 while (++(hti->slot) < hti->limit)
66 PTR x = *(hti->slot);
67 if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
68 return x;
70 return NULL;
73 /* Initialize ITER to point to the first referenced variable in the
74 referenced_vars hashtable, and return that variable. */
76 static inline tree
77 first_referenced_var (referenced_var_iterator *iter)
79 struct int_tree_map *itm;
80 itm = (struct int_tree_map *) first_htab_element (&iter->hti,
81 referenced_vars);
82 if (!itm)
83 return NULL;
84 return itm->to;
87 /* Return true if we have hit the end of the referenced variables ITER is
88 iterating through. */
90 static inline bool
91 end_referenced_vars_p (referenced_var_iterator *iter)
93 return end_htab_p (&iter->hti);
96 /* Make ITER point to the next referenced_var in the referenced_var hashtable,
97 and return that variable. */
99 static inline tree
100 next_referenced_var (referenced_var_iterator *iter)
102 struct int_tree_map *itm;
103 itm = (struct int_tree_map *) next_htab_element (&iter->hti);
104 if (!itm)
105 return NULL;
106 return itm->to;
109 /* Fill up VEC with the variables in the referenced vars hashtable. */
111 static inline void
112 fill_referenced_var_vec (VEC (tree, heap) **vec)
114 referenced_var_iterator rvi;
115 tree var;
116 *vec = NULL;
117 FOR_EACH_REFERENCED_VAR (var, rvi)
118 VEC_safe_push (tree, heap, *vec, var);
121 /* Return the variable annotation for T, which must be a _DECL node.
122 Return NULL if the variable annotation doesn't already exist. */
123 static inline var_ann_t
124 var_ann (tree t)
126 gcc_assert (t);
127 gcc_assert (DECL_P (t));
128 gcc_assert (TREE_CODE (t) != FUNCTION_DECL);
129 gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
131 return (var_ann_t) t->common.ann;
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)
139 var_ann_t ann = var_ann (var);
140 return (ann) ? ann : create_var_ann (var);
143 /* Return the function annotation for T, which must be a FUNCTION_DECL node.
144 Return NULL if the function annotation doesn't already exist. */
145 static inline function_ann_t
146 function_ann (tree t)
148 gcc_assert (t);
149 gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
150 gcc_assert (!t->common.ann || t->common.ann->common.type == FUNCTION_ANN);
152 return (function_ann_t) t->common.ann;
155 /* Return the function annotation for T, which must be a FUNCTION_DECL node.
156 Create the function annotation if it doesn't exist. */
157 static inline function_ann_t
158 get_function_ann (tree var)
160 function_ann_t ann = function_ann (var);
161 gcc_assert (!var->common.ann || var->common.ann->common.type == FUNCTION_ANN);
162 return (ann) ? ann : create_function_ann (var);
165 /* Return the statement annotation for T, which must be a statement
166 node. Return NULL if the statement annotation doesn't exist. */
167 static inline stmt_ann_t
168 stmt_ann (tree t)
170 #ifdef ENABLE_CHECKING
171 gcc_assert (is_gimple_stmt (t));
172 #endif
173 gcc_assert (!t->common.ann || t->common.ann->common.type == STMT_ANN);
174 return (stmt_ann_t) t->common.ann;
177 /* Return the statement annotation for T, which must be a statement
178 node. Create the statement annotation if it doesn't exist. */
179 static inline stmt_ann_t
180 get_stmt_ann (tree stmt)
182 stmt_ann_t ann = stmt_ann (stmt);
183 return (ann) ? ann : create_stmt_ann (stmt);
186 /* Return the annotation type for annotation ANN. */
187 static inline enum tree_ann_type
188 ann_type (tree_ann_t ann)
190 return ann->common.type;
193 /* Return the basic block for statement T. */
194 static inline basic_block
195 bb_for_stmt (tree t)
197 stmt_ann_t ann;
199 if (TREE_CODE (t) == PHI_NODE)
200 return PHI_BB (t);
202 ann = stmt_ann (t);
203 return ann ? ann->bb : NULL;
206 /* Return the may_aliases varray for variable VAR, or NULL if it has
207 no may aliases. */
208 static inline VEC(tree, gc) *
209 may_aliases (tree var)
211 var_ann_t ann = var_ann (var);
212 return ann ? ann->may_aliases : NULL;
215 /* Return the line number for EXPR, or return -1 if we have no line
216 number information for it. */
217 static inline int
218 get_lineno (tree expr)
220 if (expr == NULL_TREE)
221 return -1;
223 if (TREE_CODE (expr) == COMPOUND_EXPR)
224 expr = TREE_OPERAND (expr, 0);
226 if (! EXPR_HAS_LOCATION (expr))
227 return -1;
229 return EXPR_LINENO (expr);
232 /* Return the file name for EXPR, or return "???" if we have no
233 filename information. */
234 static inline const char *
235 get_filename (tree expr)
237 const char *filename;
238 if (expr == NULL_TREE)
239 return "???";
241 if (TREE_CODE (expr) == COMPOUND_EXPR)
242 expr = TREE_OPERAND (expr, 0);
244 if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
245 return filename;
246 else
247 return "???";
250 /* Return true if T is a noreturn call. */
251 static inline bool
252 noreturn_call_p (tree t)
254 tree call = get_call_expr_in (t);
255 return call != 0 && (call_expr_flags (call) & ECF_NORETURN) != 0;
258 /* Mark statement T as modified. */
259 static inline void
260 mark_stmt_modified (tree t)
262 stmt_ann_t ann;
263 if (TREE_CODE (t) == PHI_NODE)
264 return;
266 ann = stmt_ann (t);
267 if (ann == NULL)
268 ann = create_stmt_ann (t);
269 else if (noreturn_call_p (t))
270 VEC_safe_push (tree, gc, modified_noreturn_calls, t);
271 ann->modified = 1;
274 /* Mark statement T as modified, and update it. */
275 static inline void
276 update_stmt (tree t)
278 if (TREE_CODE (t) == PHI_NODE)
279 return;
280 mark_stmt_modified (t);
281 update_stmt_operands (t);
284 static inline void
285 update_stmt_if_modified (tree t)
287 if (stmt_modified_p (t))
288 update_stmt_operands (t);
291 /* Return true if T is marked as modified, false otherwise. */
292 static inline bool
293 stmt_modified_p (tree t)
295 stmt_ann_t ann = stmt_ann (t);
297 /* Note that if the statement doesn't yet have an annotation, we consider it
298 modified. This will force the next call to update_stmt_operands to scan
299 the statement. */
300 return ann ? ann->modified : true;
303 /* Delink an immediate_uses node from its chain. */
304 static inline void
305 delink_imm_use (ssa_use_operand_t *linknode)
307 /* Return if this node is not in a list. */
308 if (linknode->prev == NULL)
309 return;
311 linknode->prev->next = linknode->next;
312 linknode->next->prev = linknode->prev;
313 linknode->prev = NULL;
314 linknode->next = NULL;
317 /* Link ssa_imm_use node LINKNODE into the chain for LIST. */
318 static inline void
319 link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list)
321 /* Link the new node at the head of the list. If we are in the process of
322 traversing the list, we won't visit any new nodes added to it. */
323 linknode->prev = list;
324 linknode->next = list->next;
325 list->next->prev = linknode;
326 list->next = linknode;
329 /* Link ssa_imm_use node LINKNODE into the chain for DEF. */
330 static inline void
331 link_imm_use (ssa_use_operand_t *linknode, tree def)
333 ssa_use_operand_t *root;
335 if (!def || TREE_CODE (def) != SSA_NAME)
336 linknode->prev = NULL;
337 else
339 root = &(SSA_NAME_IMM_USE_NODE (def));
340 #ifdef ENABLE_CHECKING
341 if (linknode->use)
342 gcc_assert (*(linknode->use) == def);
343 #endif
344 link_imm_use_to_list (linknode, root);
348 /* Set the value of a use pointed to by USE to VAL. */
349 static inline void
350 set_ssa_use_from_ptr (use_operand_p use, tree val)
352 delink_imm_use (use);
353 *(use->use) = val;
354 link_imm_use (use, val);
357 /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
358 in STMT. */
359 static inline void
360 link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, tree stmt)
362 if (stmt)
363 link_imm_use (linknode, def);
364 else
365 link_imm_use (linknode, NULL);
366 linknode->stmt = stmt;
369 /* Relink a new node in place of an old node in the list. */
370 static inline void
371 relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old)
373 /* The node one had better be in the same list. */
374 gcc_assert (*(old->use) == *(node->use));
375 node->prev = old->prev;
376 node->next = old->next;
377 if (old->prev)
379 old->prev->next = node;
380 old->next->prev = node;
381 /* Remove the old node from the list. */
382 old->prev = NULL;
386 /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
387 in STMT. */
388 static inline void
389 relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, tree stmt)
391 if (stmt)
392 relink_imm_use (linknode, old);
393 else
394 link_imm_use (linknode, NULL);
395 linknode->stmt = stmt;
399 /* Return true is IMM has reached the end of the immediate use list. */
400 static inline bool
401 end_readonly_imm_use_p (imm_use_iterator *imm)
403 return (imm->imm_use == imm->end_p);
406 /* Initialize iterator IMM to process the list for VAR. */
407 static inline use_operand_p
408 first_readonly_imm_use (imm_use_iterator *imm, tree var)
410 gcc_assert (TREE_CODE (var) == SSA_NAME);
412 imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
413 imm->imm_use = imm->end_p->next;
414 #ifdef ENABLE_CHECKING
415 imm->iter_node.next = imm->imm_use->next;
416 #endif
417 if (end_readonly_imm_use_p (imm))
418 return NULL_USE_OPERAND_P;
419 return imm->imm_use;
422 /* Bump IMM to the next use in the list. */
423 static inline use_operand_p
424 next_readonly_imm_use (imm_use_iterator *imm)
426 use_operand_p old = imm->imm_use;
428 #ifdef ENABLE_CHECKING
429 /* If this assertion fails, it indicates the 'next' pointer has changed
430 since we the last bump. This indicates that the list is being modified
431 via stmt changes, or SET_USE, or somesuch thing, and you need to be
432 using the SAFE version of the iterator. */
433 gcc_assert (imm->iter_node.next == old->next);
434 imm->iter_node.next = old->next->next;
435 #endif
437 imm->imm_use = old->next;
438 if (end_readonly_imm_use_p (imm))
439 return old;
440 return imm->imm_use;
443 /* Return true if VAR has no uses. */
444 static inline bool
445 has_zero_uses (tree var)
447 ssa_use_operand_t *ptr;
448 ptr = &(SSA_NAME_IMM_USE_NODE (var));
449 /* A single use means there is no items in the list. */
450 return (ptr == ptr->next);
453 /* Return true if VAR has a single use. */
454 static inline bool
455 has_single_use (tree var)
457 ssa_use_operand_t *ptr;
458 ptr = &(SSA_NAME_IMM_USE_NODE (var));
459 /* A single use means there is one item in the list. */
460 return (ptr != ptr->next && ptr == ptr->next->next);
463 /* If VAR has only a single immediate use, return true, and set USE_P and STMT
464 to the use pointer and stmt of occurrence. */
465 static inline bool
466 single_imm_use (tree var, use_operand_p *use_p, tree *stmt)
468 ssa_use_operand_t *ptr;
470 ptr = &(SSA_NAME_IMM_USE_NODE (var));
471 if (ptr != ptr->next && ptr == ptr->next->next)
473 *use_p = ptr->next;
474 *stmt = ptr->next->stmt;
475 return true;
477 *use_p = NULL_USE_OPERAND_P;
478 *stmt = NULL_TREE;
479 return false;
482 /* Return the number of immediate uses of VAR. */
483 static inline unsigned int
484 num_imm_uses (tree var)
486 ssa_use_operand_t *ptr, *start;
487 unsigned int num;
489 start = &(SSA_NAME_IMM_USE_NODE (var));
490 num = 0;
491 for (ptr = start->next; ptr != start; ptr = ptr->next)
492 num++;
494 return num;
498 /* Return the tree pointer to by USE. */
499 static inline tree
500 get_use_from_ptr (use_operand_p use)
502 return *(use->use);
505 /* Return the tree pointer to by DEF. */
506 static inline tree
507 get_def_from_ptr (def_operand_p def)
509 return *def;
512 /* Return a def_operand_p pointer for the result of PHI. */
513 static inline def_operand_p
514 get_phi_result_ptr (tree phi)
516 return &(PHI_RESULT_TREE (phi));
519 /* Return a use_operand_p pointer for argument I of phinode PHI. */
520 static inline use_operand_p
521 get_phi_arg_def_ptr (tree phi, int i)
523 return &(PHI_ARG_IMM_USE_NODE (phi,i));
527 /* Return the bitmap of addresses taken by STMT, or NULL if it takes
528 no addresses. */
529 static inline bitmap
530 addresses_taken (tree stmt)
532 stmt_ann_t ann = stmt_ann (stmt);
533 return ann ? ann->addresses_taken : NULL;
536 /* Return the PHI nodes for basic block BB, or NULL if there are no
537 PHI nodes. */
538 static inline tree
539 phi_nodes (basic_block bb)
541 return bb->phi_nodes;
544 /* Set list of phi nodes of a basic block BB to L. */
546 static inline void
547 set_phi_nodes (basic_block bb, tree l)
549 tree phi;
551 bb->phi_nodes = l;
552 for (phi = l; phi; phi = PHI_CHAIN (phi))
553 set_bb_for_stmt (phi, bb);
556 /* Return the phi argument which contains the specified use. */
558 static inline int
559 phi_arg_index_from_use (use_operand_p use)
561 struct phi_arg_d *element, *root;
562 int index;
563 tree phi;
565 /* Since the use is the first thing in a PHI argument element, we can
566 calculate its index based on casting it to an argument, and performing
567 pointer arithmetic. */
569 phi = USE_STMT (use);
570 gcc_assert (TREE_CODE (phi) == PHI_NODE);
572 element = (struct phi_arg_d *)use;
573 root = &(PHI_ARG_ELT (phi, 0));
574 index = element - root;
576 #ifdef ENABLE_CHECKING
577 /* Make sure the calculation doesn't have any leftover bytes. If it does,
578 then imm_use is likely not the first element in phi_arg_d. */
579 gcc_assert (
580 (((char *)element - (char *)root) % sizeof (struct phi_arg_d)) == 0);
581 gcc_assert (index >= 0 && index < PHI_ARG_CAPACITY (phi));
582 #endif
584 return index;
587 /* Mark VAR as used, so that it'll be preserved during rtl expansion. */
589 static inline void
590 set_is_used (tree var)
592 var_ann_t ann = get_var_ann (var);
593 ann->used = 1;
597 /* ----------------------------------------------------------------------- */
599 /* Return true if T is an executable statement. */
600 static inline bool
601 is_exec_stmt (tree t)
603 return (t && !IS_EMPTY_STMT (t) && t != error_mark_node);
607 /* Return true if this stmt can be the target of a control transfer stmt such
608 as a goto. */
609 static inline bool
610 is_label_stmt (tree t)
612 if (t)
613 switch (TREE_CODE (t))
615 case LABEL_DECL:
616 case LABEL_EXPR:
617 case CASE_LABEL_EXPR:
618 return true;
619 default:
620 return false;
622 return false;
625 /* PHI nodes should contain only ssa_names and invariants. A test
626 for ssa_name is definitely simpler; don't let invalid contents
627 slip in in the meantime. */
629 static inline bool
630 phi_ssa_name_p (tree t)
632 if (TREE_CODE (t) == SSA_NAME)
633 return true;
634 #ifdef ENABLE_CHECKING
635 gcc_assert (is_gimple_min_invariant (t));
636 #endif
637 return false;
640 /* ----------------------------------------------------------------------- */
642 /* Return a block_stmt_iterator that points to beginning of basic
643 block BB. */
644 static inline block_stmt_iterator
645 bsi_start (basic_block bb)
647 block_stmt_iterator bsi;
648 if (bb->stmt_list)
649 bsi.tsi = tsi_start (bb->stmt_list);
650 else
652 gcc_assert (bb->index < NUM_FIXED_BLOCKS);
653 bsi.tsi.ptr = NULL;
654 bsi.tsi.container = NULL;
656 bsi.bb = bb;
657 return bsi;
660 /* Return a block statement iterator that points to the first non-label
661 statement in block BB. */
663 static inline block_stmt_iterator
664 bsi_after_labels (basic_block bb)
666 block_stmt_iterator bsi = bsi_start (bb);
668 while (!bsi_end_p (bsi) && TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
669 bsi_next (&bsi);
671 return bsi;
674 /* Return a block statement iterator that points to the end of basic
675 block BB. */
676 static inline block_stmt_iterator
677 bsi_last (basic_block bb)
679 block_stmt_iterator bsi;
680 if (bb->stmt_list)
681 bsi.tsi = tsi_last (bb->stmt_list);
682 else
684 gcc_assert (bb->index < NUM_FIXED_BLOCKS);
685 bsi.tsi.ptr = NULL;
686 bsi.tsi.container = NULL;
688 bsi.bb = bb;
689 return bsi;
692 /* Return true if block statement iterator I has reached the end of
693 the basic block. */
694 static inline bool
695 bsi_end_p (block_stmt_iterator i)
697 return tsi_end_p (i.tsi);
700 /* Modify block statement iterator I so that it is at the next
701 statement in the basic block. */
702 static inline void
703 bsi_next (block_stmt_iterator *i)
705 tsi_next (&i->tsi);
708 /* Modify block statement iterator I so that it is at the previous
709 statement in the basic block. */
710 static inline void
711 bsi_prev (block_stmt_iterator *i)
713 tsi_prev (&i->tsi);
716 /* Return the statement that block statement iterator I is currently
717 at. */
718 static inline tree
719 bsi_stmt (block_stmt_iterator i)
721 return tsi_stmt (i.tsi);
724 /* Return a pointer to the statement that block statement iterator I
725 is currently at. */
726 static inline tree *
727 bsi_stmt_ptr (block_stmt_iterator i)
729 return tsi_stmt_ptr (i.tsi);
732 /* Returns the loop of the statement STMT. */
734 static inline struct loop *
735 loop_containing_stmt (tree stmt)
737 basic_block bb = bb_for_stmt (stmt);
738 if (!bb)
739 return NULL;
741 return bb->loop_father;
744 /* Return true if VAR is a clobbered by function calls. */
745 static inline bool
746 is_call_clobbered (tree var)
748 if (!MTAG_P (var))
749 return DECL_CALL_CLOBBERED (var);
750 else
751 return bitmap_bit_p (call_clobbered_vars, DECL_UID (var));
754 /* Mark variable VAR as being clobbered by function calls. */
755 static inline void
756 mark_call_clobbered (tree var, unsigned int escape_type)
758 var_ann (var)->escape_mask |= escape_type;
759 if (!MTAG_P (var))
760 DECL_CALL_CLOBBERED (var) = true;
761 bitmap_set_bit (call_clobbered_vars, DECL_UID (var));
764 /* Clear the call-clobbered attribute from variable VAR. */
765 static inline void
766 clear_call_clobbered (tree var)
768 var_ann_t ann = var_ann (var);
769 ann->escape_mask = 0;
770 if (MTAG_P (var) && TREE_CODE (var) != STRUCT_FIELD_TAG)
771 MTAG_GLOBAL (var) = 0;
772 if (!MTAG_P (var))
773 DECL_CALL_CLOBBERED (var) = false;
774 bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
777 /* Mark variable VAR as being non-addressable. */
778 static inline void
779 mark_non_addressable (tree var)
781 if (!MTAG_P (var))
782 DECL_CALL_CLOBBERED (var) = false;
783 bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
784 TREE_ADDRESSABLE (var) = 0;
787 /* Return the common annotation for T. Return NULL if the annotation
788 doesn't already exist. */
789 static inline tree_ann_common_t
790 tree_common_ann (tree t)
792 return &t->common.ann->common;
795 /* Return a common annotation for T. Create the constant annotation if it
796 doesn't exist. */
797 static inline tree_ann_common_t
798 get_tree_common_ann (tree t)
800 tree_ann_common_t ann = tree_common_ann (t);
801 return (ann) ? ann : create_tree_common_ann (t);
804 /* ----------------------------------------------------------------------- */
806 /* The following set of routines are used to iterator over various type of
807 SSA operands. */
809 /* Return true if PTR is finished iterating. */
810 static inline bool
811 op_iter_done (ssa_op_iter *ptr)
813 return ptr->done;
816 /* Get the next iterator use value for PTR. */
817 static inline use_operand_p
818 op_iter_next_use (ssa_op_iter *ptr)
820 use_operand_p use_p;
821 #ifdef ENABLE_CHECKING
822 gcc_assert (ptr->iter_type == ssa_op_iter_use);
823 #endif
824 if (ptr->uses)
826 use_p = USE_OP_PTR (ptr->uses);
827 ptr->uses = ptr->uses->next;
828 return use_p;
830 if (ptr->vuses)
832 use_p = VUSE_OP_PTR (ptr->vuses);
833 ptr->vuses = ptr->vuses->next;
834 return use_p;
836 if (ptr->mayuses)
838 use_p = MAYDEF_OP_PTR (ptr->mayuses);
839 ptr->mayuses = ptr->mayuses->next;
840 return use_p;
842 if (ptr->mustkills)
844 use_p = MUSTDEF_KILL_PTR (ptr->mustkills);
845 ptr->mustkills = ptr->mustkills->next;
846 return use_p;
848 if (ptr->phi_i < ptr->num_phi)
850 return PHI_ARG_DEF_PTR (ptr->phi_stmt, (ptr->phi_i)++);
852 ptr->done = true;
853 return NULL_USE_OPERAND_P;
856 /* Get the next iterator def value for PTR. */
857 static inline def_operand_p
858 op_iter_next_def (ssa_op_iter *ptr)
860 def_operand_p def_p;
861 #ifdef ENABLE_CHECKING
862 gcc_assert (ptr->iter_type == ssa_op_iter_def);
863 #endif
864 if (ptr->defs)
866 def_p = DEF_OP_PTR (ptr->defs);
867 ptr->defs = ptr->defs->next;
868 return def_p;
870 if (ptr->mustdefs)
872 def_p = MUSTDEF_RESULT_PTR (ptr->mustdefs);
873 ptr->mustdefs = ptr->mustdefs->next;
874 return def_p;
876 if (ptr->maydefs)
878 def_p = MAYDEF_RESULT_PTR (ptr->maydefs);
879 ptr->maydefs = ptr->maydefs->next;
880 return def_p;
882 ptr->done = true;
883 return NULL_DEF_OPERAND_P;
886 /* Get the next iterator tree value for PTR. */
887 static inline tree
888 op_iter_next_tree (ssa_op_iter *ptr)
890 tree val;
891 #ifdef ENABLE_CHECKING
892 gcc_assert (ptr->iter_type == ssa_op_iter_tree);
893 #endif
894 if (ptr->uses)
896 val = USE_OP (ptr->uses);
897 ptr->uses = ptr->uses->next;
898 return val;
900 if (ptr->vuses)
902 val = VUSE_OP (ptr->vuses);
903 ptr->vuses = ptr->vuses->next;
904 return val;
906 if (ptr->mayuses)
908 val = MAYDEF_OP (ptr->mayuses);
909 ptr->mayuses = ptr->mayuses->next;
910 return val;
912 if (ptr->mustkills)
914 val = MUSTDEF_KILL (ptr->mustkills);
915 ptr->mustkills = ptr->mustkills->next;
916 return val;
918 if (ptr->defs)
920 val = DEF_OP (ptr->defs);
921 ptr->defs = ptr->defs->next;
922 return val;
924 if (ptr->mustdefs)
926 val = MUSTDEF_RESULT (ptr->mustdefs);
927 ptr->mustdefs = ptr->mustdefs->next;
928 return val;
930 if (ptr->maydefs)
932 val = MAYDEF_RESULT (ptr->maydefs);
933 ptr->maydefs = ptr->maydefs->next;
934 return val;
937 ptr->done = true;
938 return NULL_TREE;
943 /* This functions clears the iterator PTR, and marks it done. This is normally
944 used to prevent warnings in the compile about might be uninitialized
945 components. */
947 static inline void
948 clear_and_done_ssa_iter (ssa_op_iter *ptr)
950 ptr->defs = NULL;
951 ptr->uses = NULL;
952 ptr->vuses = NULL;
953 ptr->maydefs = NULL;
954 ptr->mayuses = NULL;
955 ptr->mustdefs = NULL;
956 ptr->mustkills = NULL;
957 ptr->iter_type = ssa_op_iter_none;
958 ptr->phi_i = 0;
959 ptr->num_phi = 0;
960 ptr->phi_stmt = NULL_TREE;
961 ptr->done = true;
964 /* Initialize the iterator PTR to the virtual defs in STMT. */
965 static inline void
966 op_iter_init (ssa_op_iter *ptr, tree stmt, int flags)
968 #ifdef ENABLE_CHECKING
969 gcc_assert (stmt_ann (stmt));
970 #endif
972 ptr->defs = (flags & SSA_OP_DEF) ? DEF_OPS (stmt) : NULL;
973 ptr->uses = (flags & SSA_OP_USE) ? USE_OPS (stmt) : NULL;
974 ptr->vuses = (flags & SSA_OP_VUSE) ? VUSE_OPS (stmt) : NULL;
975 ptr->maydefs = (flags & SSA_OP_VMAYDEF) ? MAYDEF_OPS (stmt) : NULL;
976 ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? MAYDEF_OPS (stmt) : NULL;
977 ptr->mustdefs = (flags & SSA_OP_VMUSTDEF) ? MUSTDEF_OPS (stmt) : NULL;
978 ptr->mustkills = (flags & SSA_OP_VMUSTKILL) ? MUSTDEF_OPS (stmt) : NULL;
979 ptr->done = false;
981 ptr->phi_i = 0;
982 ptr->num_phi = 0;
983 ptr->phi_stmt = NULL_TREE;
986 /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
987 the first use. */
988 static inline use_operand_p
989 op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags)
991 gcc_assert ((flags & SSA_OP_ALL_DEFS) == 0);
992 op_iter_init (ptr, stmt, flags);
993 ptr->iter_type = ssa_op_iter_use;
994 return op_iter_next_use (ptr);
997 /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
998 the first def. */
999 static inline def_operand_p
1000 op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags)
1002 gcc_assert ((flags & (SSA_OP_ALL_USES | SSA_OP_VIRTUAL_KILLS)) == 0);
1003 op_iter_init (ptr, stmt, flags);
1004 ptr->iter_type = ssa_op_iter_def;
1005 return op_iter_next_def (ptr);
1008 /* Initialize iterator PTR to the operands in STMT based on FLAGS. Return
1009 the first operand as a tree. */
1010 static inline tree
1011 op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags)
1013 op_iter_init (ptr, stmt, flags);
1014 ptr->iter_type = ssa_op_iter_tree;
1015 return op_iter_next_tree (ptr);
1018 /* Get the next iterator mustdef value for PTR, returning the mustdef values in
1019 KILL and DEF. */
1020 static inline void
1021 op_iter_next_maymustdef (use_operand_p *use, def_operand_p *def,
1022 ssa_op_iter *ptr)
1024 #ifdef ENABLE_CHECKING
1025 gcc_assert (ptr->iter_type == ssa_op_iter_maymustdef);
1026 #endif
1027 if (ptr->mayuses)
1029 *def = MAYDEF_RESULT_PTR (ptr->mayuses);
1030 *use = MAYDEF_OP_PTR (ptr->mayuses);
1031 ptr->mayuses = ptr->mayuses->next;
1032 return;
1035 if (ptr->mustkills)
1037 *def = MUSTDEF_RESULT_PTR (ptr->mustkills);
1038 *use = MUSTDEF_KILL_PTR (ptr->mustkills);
1039 ptr->mustkills = ptr->mustkills->next;
1040 return;
1043 *def = NULL_DEF_OPERAND_P;
1044 *use = NULL_USE_OPERAND_P;
1045 ptr->done = true;
1046 return;
1050 /* Initialize iterator PTR to the operands in STMT. Return the first operands
1051 in USE and DEF. */
1052 static inline void
1053 op_iter_init_maydef (ssa_op_iter *ptr, tree stmt, use_operand_p *use,
1054 def_operand_p *def)
1056 gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1058 op_iter_init (ptr, stmt, SSA_OP_VMAYUSE);
1059 ptr->iter_type = ssa_op_iter_maymustdef;
1060 op_iter_next_maymustdef (use, def, ptr);
1064 /* Initialize iterator PTR to the operands in STMT. Return the first operands
1065 in KILL and DEF. */
1066 static inline void
1067 op_iter_init_mustdef (ssa_op_iter *ptr, tree stmt, use_operand_p *kill,
1068 def_operand_p *def)
1070 gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1072 op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL);
1073 ptr->iter_type = ssa_op_iter_maymustdef;
1074 op_iter_next_maymustdef (kill, def, ptr);
1077 /* Initialize iterator PTR to the operands in STMT. Return the first operands
1078 in KILL and DEF. */
1079 static inline void
1080 op_iter_init_must_and_may_def (ssa_op_iter *ptr, tree stmt,
1081 use_operand_p *kill, def_operand_p *def)
1083 gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1085 op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL|SSA_OP_VMAYUSE);
1086 ptr->iter_type = ssa_op_iter_maymustdef;
1087 op_iter_next_maymustdef (kill, def, ptr);
1091 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
1092 return NULL. */
1093 static inline tree
1094 single_ssa_tree_operand (tree stmt, int flags)
1096 tree var;
1097 ssa_op_iter iter;
1099 var = op_iter_init_tree (&iter, stmt, flags);
1100 if (op_iter_done (&iter))
1101 return NULL_TREE;
1102 op_iter_next_tree (&iter);
1103 if (op_iter_done (&iter))
1104 return var;
1105 return NULL_TREE;
1109 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
1110 return NULL. */
1111 static inline use_operand_p
1112 single_ssa_use_operand (tree stmt, int flags)
1114 use_operand_p var;
1115 ssa_op_iter iter;
1117 var = op_iter_init_use (&iter, stmt, flags);
1118 if (op_iter_done (&iter))
1119 return NULL_USE_OPERAND_P;
1120 op_iter_next_use (&iter);
1121 if (op_iter_done (&iter))
1122 return var;
1123 return NULL_USE_OPERAND_P;
1128 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
1129 return NULL. */
1130 static inline def_operand_p
1131 single_ssa_def_operand (tree stmt, int flags)
1133 def_operand_p var;
1134 ssa_op_iter iter;
1136 var = op_iter_init_def (&iter, stmt, flags);
1137 if (op_iter_done (&iter))
1138 return NULL_DEF_OPERAND_P;
1139 op_iter_next_def (&iter);
1140 if (op_iter_done (&iter))
1141 return var;
1142 return NULL_DEF_OPERAND_P;
1146 /* Return true if there are zero operands in STMT matching the type
1147 given in FLAGS. */
1148 static inline bool
1149 zero_ssa_operands (tree stmt, int flags)
1151 ssa_op_iter iter;
1153 op_iter_init_tree (&iter, stmt, flags);
1154 return op_iter_done (&iter);
1158 /* Return the number of operands matching FLAGS in STMT. */
1159 static inline int
1160 num_ssa_operands (tree stmt, int flags)
1162 ssa_op_iter iter;
1163 tree t;
1164 int num = 0;
1166 FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags)
1167 num++;
1168 return num;
1172 /* Delink all immediate_use information for STMT. */
1173 static inline void
1174 delink_stmt_imm_use (tree stmt)
1176 ssa_op_iter iter;
1177 use_operand_p use_p;
1179 if (ssa_operands_active ())
1180 FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter,
1181 (SSA_OP_ALL_USES | SSA_OP_ALL_KILLS))
1182 delink_imm_use (use_p);
1186 /* This routine will compare all the operands matching FLAGS in STMT1 to those
1187 in STMT2. TRUE is returned if they are the same. STMTs can be NULL. */
1188 static inline bool
1189 compare_ssa_operands_equal (tree stmt1, tree stmt2, int flags)
1191 ssa_op_iter iter1, iter2;
1192 tree op1 = NULL_TREE;
1193 tree op2 = NULL_TREE;
1194 bool look1, look2;
1196 if (stmt1 == stmt2)
1197 return true;
1199 look1 = stmt1 && stmt_ann (stmt1);
1200 look2 = stmt2 && stmt_ann (stmt2);
1202 if (look1)
1204 op1 = op_iter_init_tree (&iter1, stmt1, flags);
1205 if (!look2)
1206 return op_iter_done (&iter1);
1208 else
1209 clear_and_done_ssa_iter (&iter1);
1211 if (look2)
1213 op2 = op_iter_init_tree (&iter2, stmt2, flags);
1214 if (!look1)
1215 return op_iter_done (&iter2);
1217 else
1218 clear_and_done_ssa_iter (&iter2);
1220 while (!op_iter_done (&iter1) && !op_iter_done (&iter2))
1222 if (op1 != op2)
1223 return false;
1224 op1 = op_iter_next_tree (&iter1);
1225 op2 = op_iter_next_tree (&iter2);
1228 return (op_iter_done (&iter1) && op_iter_done (&iter2));
1232 /* If there is a single DEF in the PHI node which matches FLAG, return it.
1233 Otherwise return NULL_DEF_OPERAND_P. */
1234 static inline tree
1235 single_phi_def (tree stmt, int flags)
1237 tree def = PHI_RESULT (stmt);
1238 if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
1239 return def;
1240 if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
1241 return def;
1242 return NULL_TREE;
1245 /* Initialize the iterator PTR for uses matching FLAGS in PHI. FLAGS should
1246 be either SSA_OP_USES or SSA_OP_VIRTUAL_USES. */
1247 static inline use_operand_p
1248 op_iter_init_phiuse (ssa_op_iter *ptr, tree phi, int flags)
1250 tree phi_def = PHI_RESULT (phi);
1251 int comp;
1253 clear_and_done_ssa_iter (ptr);
1254 ptr->done = false;
1256 gcc_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
1258 comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
1260 /* If the PHI node doesn't the operand type we care about, we're done. */
1261 if ((flags & comp) == 0)
1263 ptr->done = true;
1264 return NULL_USE_OPERAND_P;
1267 ptr->phi_stmt = phi;
1268 ptr->num_phi = PHI_NUM_ARGS (phi);
1269 ptr->iter_type = ssa_op_iter_use;
1270 return op_iter_next_use (ptr);
1274 /* Start an iterator for a PHI definition. */
1276 static inline def_operand_p
1277 op_iter_init_phidef (ssa_op_iter *ptr, tree phi, int flags)
1279 tree phi_def = PHI_RESULT (phi);
1280 int comp;
1282 clear_and_done_ssa_iter (ptr);
1283 ptr->done = false;
1285 gcc_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
1287 comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS);
1289 /* If the PHI node doesn't the operand type we care about, we're done. */
1290 if ((flags & comp) == 0)
1292 ptr->done = true;
1293 return NULL_USE_OPERAND_P;
1296 ptr->iter_type = ssa_op_iter_def;
1297 /* The first call to op_iter_next_def will terminate the iterator since
1298 all the fields are NULL. Simply return the result here as the first and
1299 therefore only result. */
1300 return PHI_RESULT_PTR (phi);
1303 /* Return true is IMM has reached the end of the immediate use stmt list. */
1305 static inline bool
1306 end_imm_use_stmt_p (imm_use_iterator *imm)
1308 return (imm->imm_use == imm->end_p);
1311 /* Finished the traverse of an immediate use stmt list IMM by removing the
1312 placeholder node from the list. */
1314 static inline void
1315 end_imm_use_stmt_traverse (imm_use_iterator *imm)
1317 delink_imm_use (&(imm->iter_node));
1320 /* Immediate use traversal of uses within a stmt require that all the
1321 uses on a stmt be sequentially listed. This routine is used to build up
1322 this sequential list by adding USE_P to the end of the current list
1323 currently delimited by HEAD and LAST_P. The new LAST_P value is
1324 returned. */
1326 static inline use_operand_p
1327 move_use_after_head (use_operand_p use_p, use_operand_p head,
1328 use_operand_p last_p)
1330 gcc_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
1331 /* Skip head when we find it. */
1332 if (use_p != head)
1334 /* If use_p is already linked in after last_p, continue. */
1335 if (last_p->next == use_p)
1336 last_p = use_p;
1337 else
1339 /* Delink from current location, and link in at last_p. */
1340 delink_imm_use (use_p);
1341 link_imm_use_to_list (use_p, last_p);
1342 last_p = use_p;
1345 return last_p;
1349 /* This routine will relink all uses with the same stmt as HEAD into the list
1350 immediately following HEAD for iterator IMM. */
1352 static inline void
1353 link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
1355 use_operand_p use_p;
1356 use_operand_p last_p = head;
1357 tree head_stmt = USE_STMT (head);
1358 tree use = USE_FROM_PTR (head);
1359 ssa_op_iter op_iter;
1360 int flag;
1362 /* Only look at virtual or real uses, depending on the type of HEAD. */
1363 flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
1365 if (TREE_CODE (head_stmt) == PHI_NODE)
1367 FOR_EACH_PHI_ARG (use_p, head_stmt, op_iter, flag)
1368 if (USE_FROM_PTR (use_p) == use)
1369 last_p = move_use_after_head (use_p, head, last_p);
1371 else
1373 FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag)
1374 if (USE_FROM_PTR (use_p) == use)
1375 last_p = move_use_after_head (use_p, head, last_p);
1377 /* LInk iter node in after last_p. */
1378 if (imm->iter_node.prev != NULL)
1379 delink_imm_use (&imm->iter_node);
1380 link_imm_use_to_list (&(imm->iter_node), last_p);
1383 /* Initialize IMM to traverse over uses of VAR. Return the first statement. */
1384 static inline tree
1385 first_imm_use_stmt (imm_use_iterator *imm, tree var)
1387 gcc_assert (TREE_CODE (var) == SSA_NAME);
1389 imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
1390 imm->imm_use = imm->end_p->next;
1391 imm->next_imm_name = NULL_USE_OPERAND_P;
1393 /* iter_node is used as a marker within the immediate use list to indicate
1394 where the end of the current stmt's uses are. Initialize it to NULL
1395 stmt and use, which indicates a marker node. */
1396 imm->iter_node.prev = NULL_USE_OPERAND_P;
1397 imm->iter_node.next = NULL_USE_OPERAND_P;
1398 imm->iter_node.stmt = NULL_TREE;
1399 imm->iter_node.use = NULL_USE_OPERAND_P;
1401 if (end_imm_use_stmt_p (imm))
1402 return NULL_TREE;
1404 link_use_stmts_after (imm->imm_use, imm);
1406 return USE_STMT (imm->imm_use);
1409 /* Bump IMM to the next stmt which has a use of var. */
1411 static inline tree
1412 next_imm_use_stmt (imm_use_iterator *imm)
1414 imm->imm_use = imm->iter_node.next;
1415 if (end_imm_use_stmt_p (imm))
1417 if (imm->iter_node.prev != NULL)
1418 delink_imm_use (&imm->iter_node);
1419 return NULL_TREE;
1422 link_use_stmts_after (imm->imm_use, imm);
1423 return USE_STMT (imm->imm_use);
1427 /* This routine will return the first use on the stmt IMM currently refers
1428 to. */
1430 static inline use_operand_p
1431 first_imm_use_on_stmt (imm_use_iterator *imm)
1433 imm->next_imm_name = imm->imm_use->next;
1434 return imm->imm_use;
1437 /* Return TRUE if the last use on the stmt IMM refers to has been visited. */
1439 static inline bool
1440 end_imm_use_on_stmt_p (imm_use_iterator *imm)
1442 return (imm->imm_use == &(imm->iter_node));
1445 /* Bump to the next use on the stmt IMM refers to, return NULL if done. */
1447 static inline use_operand_p
1448 next_imm_use_on_stmt (imm_use_iterator *imm)
1450 imm->imm_use = imm->next_imm_name;
1451 if (end_imm_use_on_stmt_p (imm))
1452 return NULL_USE_OPERAND_P;
1453 else
1455 imm->next_imm_name = imm->imm_use->next;
1456 return imm->imm_use;
1460 /* Return true if VAR cannot be modified by the program. */
1462 static inline bool
1463 unmodifiable_var_p (tree var)
1465 if (TREE_CODE (var) == SSA_NAME)
1466 var = SSA_NAME_VAR (var);
1468 if (MTAG_P (var))
1469 return TREE_READONLY (var) && (TREE_STATIC (var) || MTAG_GLOBAL (var));
1471 return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
1474 /* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it. */
1476 static inline bool
1477 array_ref_contains_indirect_ref (tree ref)
1479 gcc_assert (TREE_CODE (ref) == ARRAY_REF);
1481 do {
1482 ref = TREE_OPERAND (ref, 0);
1483 } while (handled_component_p (ref));
1485 return TREE_CODE (ref) == INDIRECT_REF;
1488 /* Return true if REF, a handled component reference, has an ARRAY_REF
1489 somewhere in it. */
1491 static inline bool
1492 ref_contains_array_ref (tree ref)
1494 gcc_assert (handled_component_p (ref));
1496 do {
1497 if (TREE_CODE (ref) == ARRAY_REF)
1498 return true;
1499 ref = TREE_OPERAND (ref, 0);
1500 } while (handled_component_p (ref));
1502 return false;
1505 /* Given a variable VAR, lookup and return a pointer to the list of
1506 subvariables for it. */
1508 static inline subvar_t *
1509 lookup_subvars_for_var (tree var)
1511 var_ann_t ann = var_ann (var);
1512 gcc_assert (ann);
1513 return &ann->subvars;
1516 /* Given a variable VAR, return a linked list of subvariables for VAR, or
1517 NULL, if there are no subvariables. */
1519 static inline subvar_t
1520 get_subvars_for_var (tree var)
1522 subvar_t subvars;
1524 gcc_assert (SSA_VAR_P (var));
1526 if (TREE_CODE (var) == SSA_NAME)
1527 subvars = *(lookup_subvars_for_var (SSA_NAME_VAR (var)));
1528 else
1529 subvars = *(lookup_subvars_for_var (var));
1530 return subvars;
1533 /* Return the subvariable of VAR at offset OFFSET. */
1535 static inline tree
1536 get_subvar_at (tree var, unsigned HOST_WIDE_INT offset)
1538 subvar_t sv;
1540 for (sv = get_subvars_for_var (var); sv; sv = sv->next)
1541 if (SFT_OFFSET (sv->var) == offset)
1542 return sv->var;
1544 return NULL_TREE;
1547 /* Return true if V is a tree that we can have subvars for.
1548 Normally, this is any aggregate type. Also complex
1549 types which are not gimple registers can have subvars. */
1551 static inline bool
1552 var_can_have_subvars (tree v)
1554 /* Volatile variables should never have subvars. */
1555 if (TREE_THIS_VOLATILE (v))
1556 return false;
1558 /* Non decls or memory tags can never have subvars. */
1559 if (!DECL_P (v) || MTAG_P (v))
1560 return false;
1562 /* Aggregates can have subvars. */
1563 if (AGGREGATE_TYPE_P (TREE_TYPE (v)))
1564 return true;
1566 /* Complex types variables which are not also a gimple register can
1567 have subvars. */
1568 if (TREE_CODE (TREE_TYPE (v)) == COMPLEX_TYPE
1569 && !DECL_COMPLEX_GIMPLE_REG_P (v))
1570 return true;
1572 return false;
1576 /* Return true if OFFSET and SIZE define a range that overlaps with some
1577 portion of the range of SV, a subvar. If there was an exact overlap,
1578 *EXACT will be set to true upon return. */
1580 static inline bool
1581 overlap_subvar (unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size,
1582 tree sv, bool *exact)
1584 /* There are three possible cases of overlap.
1585 1. We can have an exact overlap, like so:
1586 |offset, offset + size |
1587 |sv->offset, sv->offset + sv->size |
1589 2. We can have offset starting after sv->offset, like so:
1591 |offset, offset + size |
1592 |sv->offset, sv->offset + sv->size |
1594 3. We can have offset starting before sv->offset, like so:
1596 |offset, offset + size |
1597 |sv->offset, sv->offset + sv->size|
1600 if (exact)
1601 *exact = false;
1602 if (offset == SFT_OFFSET (sv) && size == SFT_SIZE (sv))
1604 if (exact)
1605 *exact = true;
1606 return true;
1608 else if (offset >= SFT_OFFSET (sv)
1609 && offset < (SFT_OFFSET (sv) + SFT_SIZE (sv)))
1611 return true;
1613 else if (offset < SFT_OFFSET (sv)
1614 && (size > SFT_OFFSET (sv) - offset))
1616 return true;
1618 return false;
1622 #endif /* _TREE_FLOW_INLINE_H */