* config/sh/lib1funcs-Os-4-200.asm: Guard entire file with
[official-gcc.git] / gcc / tree-flow-inline.h
blob5f7efa7de31ea7f31df5ab4c55008da23d5c7587
1 /* Inline functions for tree-flow.h
2 Copyright (C) 2001, 2003, 2005, 2006 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 2, 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 COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
22 #ifndef _TREE_FLOW_INLINE_H
23 #define _TREE_FLOW_INLINE_H 1
25 /* Inline functions for manipulating various data structures defined in
26 tree-flow.h. See tree-flow.h for documentation. */
28 /* Initialize the hashtable iterator HTI to point to hashtable TABLE */
30 static inline void *
31 first_htab_element (htab_iterator *hti, htab_t table)
33 hti->htab = table;
34 hti->slot = table->entries;
35 hti->limit = hti->slot + htab_size (table);
38 PTR x = *(hti->slot);
39 if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
40 break;
41 } while (++(hti->slot) < hti->limit);
43 if (hti->slot < hti->limit)
44 return *(hti->slot);
45 return NULL;
48 /* Return current non-empty/deleted slot of the hashtable pointed to by HTI,
49 or NULL if we have reached the end. */
51 static inline bool
52 end_htab_p (htab_iterator *hti)
54 if (hti->slot >= hti->limit)
55 return true;
56 return false;
59 /* Advance the hashtable iterator pointed to by HTI to the next element of the
60 hashtable. */
62 static inline void *
63 next_htab_element (htab_iterator *hti)
65 while (++(hti->slot) < hti->limit)
67 PTR x = *(hti->slot);
68 if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
69 return x;
71 return NULL;
74 /* Initialize ITER to point to the first referenced variable in the
75 referenced_vars hashtable, and return that variable. */
77 static inline tree
78 first_referenced_var (referenced_var_iterator *iter)
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;
88 /* Return true if we have hit the end of the referenced variables ITER is
89 iterating through. */
91 static inline bool
92 end_referenced_vars_p (referenced_var_iterator *iter)
94 return end_htab_p (&iter->hti);
97 /* Make ITER point to the next referenced_var in the referenced_var hashtable,
98 and return that variable. */
100 static inline tree
101 next_referenced_var (referenced_var_iterator *iter)
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;
110 /* Fill up VEC with the variables in the referenced vars hashtable. */
112 static inline void
113 fill_referenced_var_vec (VEC (tree, heap) **vec)
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);
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)
127 gcc_assert (t);
128 gcc_assert (DECL_P (t));
129 gcc_assert (TREE_CODE (t) != FUNCTION_DECL);
130 gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
132 return (var_ann_t) t->common.ann;
135 /* Return the variable annotation for T, which must be a _DECL node.
136 Create the variable annotation if it doesn't exist. */
137 static inline var_ann_t
138 get_var_ann (tree var)
140 var_ann_t ann = var_ann (var);
141 return (ann) ? ann : create_var_ann (var);
144 /* Return the function annotation for T, which must be a FUNCTION_DECL node.
145 Return NULL if the function annotation doesn't already exist. */
146 static inline function_ann_t
147 function_ann (tree t)
149 gcc_assert (t);
150 gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
151 gcc_assert (!t->common.ann || t->common.ann->common.type == FUNCTION_ANN);
153 return (function_ann_t) t->common.ann;
156 /* Return the function annotation for T, which must be a FUNCTION_DECL node.
157 Create the function annotation if it doesn't exist. */
158 static inline function_ann_t
159 get_function_ann (tree var)
161 function_ann_t ann = function_ann (var);
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 return (stmt_ann_t) t->common.ann;
176 /* Return the statement annotation for T, which must be a statement
177 node. Create the statement annotation if it doesn't exist. */
178 static inline stmt_ann_t
179 get_stmt_ann (tree stmt)
181 stmt_ann_t ann = stmt_ann (stmt);
182 return (ann) ? ann : create_stmt_ann (stmt);
185 /* Return the annotation type for annotation ANN. */
186 static inline enum tree_ann_type
187 ann_type (tree_ann_t ann)
189 return ann->common.type;
192 /* Return the basic block for statement T. */
193 static inline basic_block
194 bb_for_stmt (tree t)
196 stmt_ann_t ann;
198 if (TREE_CODE (t) == PHI_NODE)
199 return PHI_BB (t);
201 ann = stmt_ann (t);
202 return ann ? ann->bb : NULL;
205 /* Return the may_aliases varray for variable VAR, or NULL if it has
206 no may aliases. */
207 static inline VEC(tree, gc) *
208 may_aliases (tree var)
210 var_ann_t ann = var_ann (var);
211 return ann ? ann->may_aliases : NULL;
214 /* Return the line number for EXPR, or return -1 if we have no line
215 number information for it. */
216 static inline int
217 get_lineno (tree expr)
219 if (expr == NULL_TREE)
220 return -1;
222 if (TREE_CODE (expr) == COMPOUND_EXPR)
223 expr = TREE_OPERAND (expr, 0);
225 if (! EXPR_HAS_LOCATION (expr))
226 return -1;
228 return EXPR_LINENO (expr);
231 /* Return the file name for EXPR, or return "???" if we have no
232 filename information. */
233 static inline const char *
234 get_filename (tree expr)
236 const char *filename;
237 if (expr == NULL_TREE)
238 return "???";
240 if (TREE_CODE (expr) == COMPOUND_EXPR)
241 expr = TREE_OPERAND (expr, 0);
243 if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
244 return filename;
245 else
246 return "???";
249 /* Return true if T is a noreturn call. */
250 static inline bool
251 noreturn_call_p (tree t)
253 tree call = get_call_expr_in (t);
254 return call != 0 && (call_expr_flags (call) & ECF_NORETURN) != 0;
257 /* Mark statement T as modified. */
258 static inline void
259 mark_stmt_modified (tree t)
261 stmt_ann_t ann;
262 if (TREE_CODE (t) == PHI_NODE)
263 return;
265 ann = stmt_ann (t);
266 if (ann == NULL)
267 ann = create_stmt_ann (t);
268 else if (noreturn_call_p (t))
269 VEC_safe_push (tree, gc, modified_noreturn_calls, t);
270 ann->modified = 1;
273 /* Mark statement T as modified, and update it. */
274 static inline void
275 update_stmt (tree t)
277 if (TREE_CODE (t) == PHI_NODE)
278 return;
279 mark_stmt_modified (t);
280 update_stmt_operands (t);
283 static inline void
284 update_stmt_if_modified (tree t)
286 if (stmt_modified_p (t))
287 update_stmt_operands (t);
290 /* Return true if T is marked as modified, false otherwise. */
291 static inline bool
292 stmt_modified_p (tree t)
294 stmt_ann_t ann = stmt_ann (t);
296 /* Note that if the statement doesn't yet have an annotation, we consider it
297 modified. This will force the next call to update_stmt_operands to scan
298 the statement. */
299 return ann ? ann->modified : true;
302 /* Delink an immediate_uses node from its chain. */
303 static inline void
304 delink_imm_use (ssa_use_operand_t *linknode)
306 /* Return if this node is not in a list. */
307 if (linknode->prev == NULL)
308 return;
310 linknode->prev->next = linknode->next;
311 linknode->next->prev = linknode->prev;
312 linknode->prev = NULL;
313 linknode->next = NULL;
316 /* Link ssa_imm_use node LINKNODE into the chain for LIST. */
317 static inline void
318 link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list)
320 /* Link the new node at the head of the list. If we are in the process of
321 traversing the list, we won't visit any new nodes added to it. */
322 linknode->prev = list;
323 linknode->next = list->next;
324 list->next->prev = linknode;
325 list->next = linknode;
328 /* Link ssa_imm_use node LINKNODE into the chain for DEF. */
329 static inline void
330 link_imm_use (ssa_use_operand_t *linknode, tree def)
332 ssa_use_operand_t *root;
334 if (!def || TREE_CODE (def) != SSA_NAME)
335 linknode->prev = NULL;
336 else
338 root = &(SSA_NAME_IMM_USE_NODE (def));
339 #ifdef ENABLE_CHECKING
340 if (linknode->use)
341 gcc_assert (*(linknode->use) == def);
342 #endif
343 link_imm_use_to_list (linknode, root);
347 /* Set the value of a use pointed to by USE to VAL. */
348 static inline void
349 set_ssa_use_from_ptr (use_operand_p use, tree val)
351 delink_imm_use (use);
352 *(use->use) = val;
353 link_imm_use (use, val);
356 /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
357 in STMT. */
358 static inline void
359 link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, tree stmt)
361 if (stmt)
362 link_imm_use (linknode, def);
363 else
364 link_imm_use (linknode, NULL);
365 linknode->stmt = stmt;
368 /* Relink a new node in place of an old node in the list. */
369 static inline void
370 relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old)
372 /* The node one had better be in the same list. */
373 gcc_assert (*(old->use) == *(node->use));
374 node->prev = old->prev;
375 node->next = old->next;
376 if (old->prev)
378 old->prev->next = node;
379 old->next->prev = node;
380 /* Remove the old node from the list. */
381 old->prev = NULL;
385 /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
386 in STMT. */
387 static inline void
388 relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, tree stmt)
390 if (stmt)
391 relink_imm_use (linknode, old);
392 else
393 link_imm_use (linknode, NULL);
394 linknode->stmt = stmt;
398 /* Return true is IMM has reached the end of the immediate use list. */
399 static inline bool
400 end_readonly_imm_use_p (imm_use_iterator *imm)
402 return (imm->imm_use == imm->end_p);
405 /* Initialize iterator IMM to process the list for VAR. */
406 static inline use_operand_p
407 first_readonly_imm_use (imm_use_iterator *imm, tree var)
409 gcc_assert (TREE_CODE (var) == SSA_NAME);
411 imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
412 imm->imm_use = imm->end_p->next;
413 #ifdef ENABLE_CHECKING
414 imm->iter_node.next = imm->imm_use->next;
415 #endif
416 if (end_readonly_imm_use_p (imm))
417 return NULL_USE_OPERAND_P;
418 return imm->imm_use;
421 /* Bump IMM to the next use in the list. */
422 static inline use_operand_p
423 next_readonly_imm_use (imm_use_iterator *imm)
425 use_operand_p old = imm->imm_use;
427 #ifdef ENABLE_CHECKING
428 /* If this assertion fails, it indicates the 'next' pointer has changed
429 since we the last bump. This indicates that the list is being modified
430 via stmt changes, or SET_USE, or somesuch thing, and you need to be
431 using the SAFE version of the iterator. */
432 gcc_assert (imm->iter_node.next == old->next);
433 imm->iter_node.next = old->next->next;
434 #endif
436 imm->imm_use = old->next;
437 if (end_readonly_imm_use_p (imm))
438 return old;
439 return imm->imm_use;
442 /* Return true if VAR has no uses. */
443 static inline bool
444 has_zero_uses (tree var)
446 ssa_use_operand_t *ptr;
447 ptr = &(SSA_NAME_IMM_USE_NODE (var));
448 /* A single use means there is no items in the list. */
449 return (ptr == ptr->next);
452 /* Return true if VAR has a single use. */
453 static inline bool
454 has_single_use (tree var)
456 ssa_use_operand_t *ptr;
457 ptr = &(SSA_NAME_IMM_USE_NODE (var));
458 /* A single use means there is one item in the list. */
459 return (ptr != ptr->next && ptr == ptr->next->next);
462 /* If VAR has only a single immediate use, return true, and set USE_P and STMT
463 to the use pointer and stmt of occurrence. */
464 static inline bool
465 single_imm_use (tree var, use_operand_p *use_p, tree *stmt)
467 ssa_use_operand_t *ptr;
469 ptr = &(SSA_NAME_IMM_USE_NODE (var));
470 if (ptr != ptr->next && ptr == ptr->next->next)
472 *use_p = ptr->next;
473 *stmt = ptr->next->stmt;
474 return true;
476 *use_p = NULL_USE_OPERAND_P;
477 *stmt = NULL_TREE;
478 return false;
481 /* Return the number of immediate uses of VAR. */
482 static inline unsigned int
483 num_imm_uses (tree var)
485 ssa_use_operand_t *ptr, *start;
486 unsigned int num;
488 start = &(SSA_NAME_IMM_USE_NODE (var));
489 num = 0;
490 for (ptr = start->next; ptr != start; ptr = ptr->next)
491 num++;
493 return num;
497 /* Return the tree pointer to by USE. */
498 static inline tree
499 get_use_from_ptr (use_operand_p use)
501 return *(use->use);
504 /* Return the tree pointer to by DEF. */
505 static inline tree
506 get_def_from_ptr (def_operand_p def)
508 return *def;
511 /* Return a def_operand_p pointer for the result of PHI. */
512 static inline def_operand_p
513 get_phi_result_ptr (tree phi)
515 return &(PHI_RESULT_TREE (phi));
518 /* Return a use_operand_p pointer for argument I of phinode PHI. */
519 static inline use_operand_p
520 get_phi_arg_def_ptr (tree phi, int i)
522 return &(PHI_ARG_IMM_USE_NODE (phi,i));
526 /* Return the bitmap of addresses taken by STMT, or NULL if it takes
527 no addresses. */
528 static inline bitmap
529 addresses_taken (tree stmt)
531 stmt_ann_t ann = stmt_ann (stmt);
532 return ann ? ann->addresses_taken : NULL;
535 /* Return the PHI nodes for basic block BB, or NULL if there are no
536 PHI nodes. */
537 static inline tree
538 phi_nodes (basic_block bb)
540 return bb->phi_nodes;
543 /* Set list of phi nodes of a basic block BB to L. */
545 static inline void
546 set_phi_nodes (basic_block bb, tree l)
548 tree phi;
550 bb->phi_nodes = l;
551 for (phi = l; phi; phi = PHI_CHAIN (phi))
552 set_bb_for_stmt (phi, bb);
555 /* Return the phi argument which contains the specified use. */
557 static inline int
558 phi_arg_index_from_use (use_operand_p use)
560 struct phi_arg_d *element, *root;
561 int index;
562 tree phi;
564 /* Since the use is the first thing in a PHI argument element, we can
565 calculate its index based on casting it to an argument, and performing
566 pointer arithmetic. */
568 phi = USE_STMT (use);
569 gcc_assert (TREE_CODE (phi) == PHI_NODE);
571 element = (struct phi_arg_d *)use;
572 root = &(PHI_ARG_ELT (phi, 0));
573 index = element - root;
575 #ifdef ENABLE_CHECKING
576 /* Make sure the calculation doesn't have any leftover bytes. If it does,
577 then imm_use is likely not the first element in phi_arg_d. */
578 gcc_assert (
579 (((char *)element - (char *)root) % sizeof (struct phi_arg_d)) == 0);
580 gcc_assert (index >= 0 && index < PHI_ARG_CAPACITY (phi));
581 #endif
583 return index;
586 /* Mark VAR as used, so that it'll be preserved during rtl expansion. */
588 static inline void
589 set_is_used (tree var)
591 var_ann_t ann = get_var_ann (var);
592 ann->used = 1;
596 /* ----------------------------------------------------------------------- */
598 /* Return true if T is an executable statement. */
599 static inline bool
600 is_exec_stmt (tree t)
602 return (t && !IS_EMPTY_STMT (t) && t != error_mark_node);
606 /* Return true if this stmt can be the target of a control transfer stmt such
607 as a goto. */
608 static inline bool
609 is_label_stmt (tree t)
611 if (t)
612 switch (TREE_CODE (t))
614 case LABEL_DECL:
615 case LABEL_EXPR:
616 case CASE_LABEL_EXPR:
617 return true;
618 default:
619 return false;
621 return false;
624 /* PHI nodes should contain only ssa_names and invariants. A test
625 for ssa_name is definitely simpler; don't let invalid contents
626 slip in in the meantime. */
628 static inline bool
629 phi_ssa_name_p (tree t)
631 if (TREE_CODE (t) == SSA_NAME)
632 return true;
633 #ifdef ENABLE_CHECKING
634 gcc_assert (is_gimple_min_invariant (t));
635 #endif
636 return false;
639 /* ----------------------------------------------------------------------- */
641 /* Return a block_stmt_iterator that points to beginning of basic
642 block BB. */
643 static inline block_stmt_iterator
644 bsi_start (basic_block bb)
646 block_stmt_iterator bsi;
647 if (bb->stmt_list)
648 bsi.tsi = tsi_start (bb->stmt_list);
649 else
651 gcc_assert (bb->index < NUM_FIXED_BLOCKS);
652 bsi.tsi.ptr = NULL;
653 bsi.tsi.container = NULL;
655 bsi.bb = bb;
656 return bsi;
659 /* Return a block statement iterator that points to the first non-label
660 statement in block BB. */
662 static inline block_stmt_iterator
663 bsi_after_labels (basic_block bb)
665 block_stmt_iterator bsi = bsi_start (bb);
667 while (!bsi_end_p (bsi) && TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
668 bsi_next (&bsi);
670 return bsi;
673 /* Return a block statement iterator that points to the end of basic
674 block BB. */
675 static inline block_stmt_iterator
676 bsi_last (basic_block bb)
678 block_stmt_iterator bsi;
679 if (bb->stmt_list)
680 bsi.tsi = tsi_last (bb->stmt_list);
681 else
683 gcc_assert (bb->index < NUM_FIXED_BLOCKS);
684 bsi.tsi.ptr = NULL;
685 bsi.tsi.container = NULL;
687 bsi.bb = bb;
688 return bsi;
691 /* Return true if block statement iterator I has reached the end of
692 the basic block. */
693 static inline bool
694 bsi_end_p (block_stmt_iterator i)
696 return tsi_end_p (i.tsi);
699 /* Modify block statement iterator I so that it is at the next
700 statement in the basic block. */
701 static inline void
702 bsi_next (block_stmt_iterator *i)
704 tsi_next (&i->tsi);
707 /* Modify block statement iterator I so that it is at the previous
708 statement in the basic block. */
709 static inline void
710 bsi_prev (block_stmt_iterator *i)
712 tsi_prev (&i->tsi);
715 /* Return the statement that block statement iterator I is currently
716 at. */
717 static inline tree
718 bsi_stmt (block_stmt_iterator i)
720 return tsi_stmt (i.tsi);
723 /* Return a pointer to the statement that block statement iterator I
724 is currently at. */
725 static inline tree *
726 bsi_stmt_ptr (block_stmt_iterator i)
728 return tsi_stmt_ptr (i.tsi);
731 /* Returns the loop of the statement STMT. */
733 static inline struct loop *
734 loop_containing_stmt (tree stmt)
736 basic_block bb = bb_for_stmt (stmt);
737 if (!bb)
738 return NULL;
740 return bb->loop_father;
743 /* Return true if VAR is a clobbered by function calls. */
744 static inline bool
745 is_call_clobbered (tree var)
747 if (!MTAG_P (var))
748 return DECL_CALL_CLOBBERED (var);
749 else
750 return bitmap_bit_p (call_clobbered_vars, DECL_UID (var));
753 /* Mark variable VAR as being clobbered by function calls. */
754 static inline void
755 mark_call_clobbered (tree var, unsigned int escape_type)
757 var_ann (var)->escape_mask |= escape_type;
758 if (!MTAG_P (var))
759 DECL_CALL_CLOBBERED (var) = true;
760 bitmap_set_bit (call_clobbered_vars, DECL_UID (var));
763 /* Clear the call-clobbered attribute from variable VAR. */
764 static inline void
765 clear_call_clobbered (tree var)
767 var_ann_t ann = var_ann (var);
768 ann->escape_mask = 0;
769 if (MTAG_P (var) && TREE_CODE (var) != STRUCT_FIELD_TAG)
770 MTAG_GLOBAL (var) = 0;
771 if (!MTAG_P (var))
772 DECL_CALL_CLOBBERED (var) = false;
773 bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
776 /* Mark variable VAR as being non-addressable. */
777 static inline void
778 mark_non_addressable (tree var)
780 if (!MTAG_P (var))
781 DECL_CALL_CLOBBERED (var) = false;
782 bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
783 TREE_ADDRESSABLE (var) = 0;
786 /* Return the common annotation for T. Return NULL if the annotation
787 doesn't already exist. */
788 static inline tree_ann_t
789 tree_ann (tree t)
791 return t->common.ann;
794 /* Return a common annotation for T. Create the constant annotation if it
795 doesn't exist. */
796 static inline tree_ann_t
797 get_tree_ann (tree t)
799 tree_ann_t ann = tree_ann (t);
800 return (ann) ? ann : create_tree_ann (t);
803 /* ----------------------------------------------------------------------- */
805 /* The following set of routines are used to iterator over various type of
806 SSA operands. */
808 /* Return true if PTR is finished iterating. */
809 static inline bool
810 op_iter_done (ssa_op_iter *ptr)
812 return ptr->done;
815 /* Get the next iterator use value for PTR. */
816 static inline use_operand_p
817 op_iter_next_use (ssa_op_iter *ptr)
819 use_operand_p use_p;
820 #ifdef ENABLE_CHECKING
821 gcc_assert (ptr->iter_type == ssa_op_iter_use);
822 #endif
823 if (ptr->uses)
825 use_p = USE_OP_PTR (ptr->uses);
826 ptr->uses = ptr->uses->next;
827 return use_p;
829 if (ptr->vuses)
831 use_p = VUSE_OP_PTR (ptr->vuses);
832 ptr->vuses = ptr->vuses->next;
833 return use_p;
835 if (ptr->mayuses)
837 use_p = MAYDEF_OP_PTR (ptr->mayuses);
838 ptr->mayuses = ptr->mayuses->next;
839 return use_p;
841 if (ptr->mustkills)
843 use_p = MUSTDEF_KILL_PTR (ptr->mustkills);
844 ptr->mustkills = ptr->mustkills->next;
845 return use_p;
847 if (ptr->phi_i < ptr->num_phi)
849 return PHI_ARG_DEF_PTR (ptr->phi_stmt, (ptr->phi_i)++);
851 ptr->done = true;
852 return NULL_USE_OPERAND_P;
855 /* Get the next iterator def value for PTR. */
856 static inline def_operand_p
857 op_iter_next_def (ssa_op_iter *ptr)
859 def_operand_p def_p;
860 #ifdef ENABLE_CHECKING
861 gcc_assert (ptr->iter_type == ssa_op_iter_def);
862 #endif
863 if (ptr->defs)
865 def_p = DEF_OP_PTR (ptr->defs);
866 ptr->defs = ptr->defs->next;
867 return def_p;
869 if (ptr->mustdefs)
871 def_p = MUSTDEF_RESULT_PTR (ptr->mustdefs);
872 ptr->mustdefs = ptr->mustdefs->next;
873 return def_p;
875 if (ptr->maydefs)
877 def_p = MAYDEF_RESULT_PTR (ptr->maydefs);
878 ptr->maydefs = ptr->maydefs->next;
879 return def_p;
881 ptr->done = true;
882 return NULL_DEF_OPERAND_P;
885 /* Get the next iterator tree value for PTR. */
886 static inline tree
887 op_iter_next_tree (ssa_op_iter *ptr)
889 tree val;
890 #ifdef ENABLE_CHECKING
891 gcc_assert (ptr->iter_type == ssa_op_iter_tree);
892 #endif
893 if (ptr->uses)
895 val = USE_OP (ptr->uses);
896 ptr->uses = ptr->uses->next;
897 return val;
899 if (ptr->vuses)
901 val = VUSE_OP (ptr->vuses);
902 ptr->vuses = ptr->vuses->next;
903 return val;
905 if (ptr->mayuses)
907 val = MAYDEF_OP (ptr->mayuses);
908 ptr->mayuses = ptr->mayuses->next;
909 return val;
911 if (ptr->mustkills)
913 val = MUSTDEF_KILL (ptr->mustkills);
914 ptr->mustkills = ptr->mustkills->next;
915 return val;
917 if (ptr->defs)
919 val = DEF_OP (ptr->defs);
920 ptr->defs = ptr->defs->next;
921 return val;
923 if (ptr->mustdefs)
925 val = MUSTDEF_RESULT (ptr->mustdefs);
926 ptr->mustdefs = ptr->mustdefs->next;
927 return val;
929 if (ptr->maydefs)
931 val = MAYDEF_RESULT (ptr->maydefs);
932 ptr->maydefs = ptr->maydefs->next;
933 return val;
936 ptr->done = true;
937 return NULL_TREE;
942 /* This functions clears the iterator PTR, and marks it done. This is normally
943 used to prevent warnings in the compile about might be uninitialized
944 components. */
946 static inline void
947 clear_and_done_ssa_iter (ssa_op_iter *ptr)
949 ptr->defs = NULL;
950 ptr->uses = NULL;
951 ptr->vuses = NULL;
952 ptr->maydefs = NULL;
953 ptr->mayuses = NULL;
954 ptr->mustdefs = NULL;
955 ptr->mustkills = NULL;
956 ptr->iter_type = ssa_op_iter_none;
957 ptr->phi_i = 0;
958 ptr->num_phi = 0;
959 ptr->phi_stmt = NULL_TREE;
960 ptr->done = true;
963 /* Initialize the iterator PTR to the virtual defs in STMT. */
964 static inline void
965 op_iter_init (ssa_op_iter *ptr, tree stmt, int flags)
967 #ifdef ENABLE_CHECKING
968 gcc_assert (stmt_ann (stmt));
969 #endif
971 ptr->defs = (flags & SSA_OP_DEF) ? DEF_OPS (stmt) : NULL;
972 ptr->uses = (flags & SSA_OP_USE) ? USE_OPS (stmt) : NULL;
973 ptr->vuses = (flags & SSA_OP_VUSE) ? VUSE_OPS (stmt) : NULL;
974 ptr->maydefs = (flags & SSA_OP_VMAYDEF) ? MAYDEF_OPS (stmt) : NULL;
975 ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? MAYDEF_OPS (stmt) : NULL;
976 ptr->mustdefs = (flags & SSA_OP_VMUSTDEF) ? MUSTDEF_OPS (stmt) : NULL;
977 ptr->mustkills = (flags & SSA_OP_VMUSTKILL) ? MUSTDEF_OPS (stmt) : NULL;
978 ptr->done = false;
980 ptr->phi_i = 0;
981 ptr->num_phi = 0;
982 ptr->phi_stmt = NULL_TREE;
985 /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
986 the first use. */
987 static inline use_operand_p
988 op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags)
990 gcc_assert ((flags & SSA_OP_ALL_DEFS) == 0);
991 op_iter_init (ptr, stmt, flags);
992 ptr->iter_type = ssa_op_iter_use;
993 return op_iter_next_use (ptr);
996 /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
997 the first def. */
998 static inline def_operand_p
999 op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags)
1001 gcc_assert ((flags & (SSA_OP_ALL_USES | SSA_OP_VIRTUAL_KILLS)) == 0);
1002 op_iter_init (ptr, stmt, flags);
1003 ptr->iter_type = ssa_op_iter_def;
1004 return op_iter_next_def (ptr);
1007 /* Initialize iterator PTR to the operands in STMT based on FLAGS. Return
1008 the first operand as a tree. */
1009 static inline tree
1010 op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags)
1012 op_iter_init (ptr, stmt, flags);
1013 ptr->iter_type = ssa_op_iter_tree;
1014 return op_iter_next_tree (ptr);
1017 /* Get the next iterator mustdef value for PTR, returning the mustdef values in
1018 KILL and DEF. */
1019 static inline void
1020 op_iter_next_maymustdef (use_operand_p *use, def_operand_p *def,
1021 ssa_op_iter *ptr)
1023 #ifdef ENABLE_CHECKING
1024 gcc_assert (ptr->iter_type == ssa_op_iter_maymustdef);
1025 #endif
1026 if (ptr->mayuses)
1028 *def = MAYDEF_RESULT_PTR (ptr->mayuses);
1029 *use = MAYDEF_OP_PTR (ptr->mayuses);
1030 ptr->mayuses = ptr->mayuses->next;
1031 return;
1034 if (ptr->mustkills)
1036 *def = MUSTDEF_RESULT_PTR (ptr->mustkills);
1037 *use = MUSTDEF_KILL_PTR (ptr->mustkills);
1038 ptr->mustkills = ptr->mustkills->next;
1039 return;
1042 *def = NULL_DEF_OPERAND_P;
1043 *use = NULL_USE_OPERAND_P;
1044 ptr->done = true;
1045 return;
1049 /* Initialize iterator PTR to the operands in STMT. Return the first operands
1050 in USE and DEF. */
1051 static inline void
1052 op_iter_init_maydef (ssa_op_iter *ptr, tree stmt, use_operand_p *use,
1053 def_operand_p *def)
1055 gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1057 op_iter_init (ptr, stmt, SSA_OP_VMAYUSE);
1058 ptr->iter_type = ssa_op_iter_maymustdef;
1059 op_iter_next_maymustdef (use, def, ptr);
1063 /* Initialize iterator PTR to the operands in STMT. Return the first operands
1064 in KILL and DEF. */
1065 static inline void
1066 op_iter_init_mustdef (ssa_op_iter *ptr, tree stmt, use_operand_p *kill,
1067 def_operand_p *def)
1069 gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1071 op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL);
1072 ptr->iter_type = ssa_op_iter_maymustdef;
1073 op_iter_next_maymustdef (kill, def, ptr);
1076 /* Initialize iterator PTR to the operands in STMT. Return the first operands
1077 in KILL and DEF. */
1078 static inline void
1079 op_iter_init_must_and_may_def (ssa_op_iter *ptr, tree stmt,
1080 use_operand_p *kill, def_operand_p *def)
1082 gcc_assert (TREE_CODE (stmt) != PHI_NODE);
1084 op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL|SSA_OP_VMAYUSE);
1085 ptr->iter_type = ssa_op_iter_maymustdef;
1086 op_iter_next_maymustdef (kill, def, ptr);
1090 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
1091 return NULL. */
1092 static inline tree
1093 single_ssa_tree_operand (tree stmt, int flags)
1095 tree var;
1096 ssa_op_iter iter;
1098 var = op_iter_init_tree (&iter, stmt, flags);
1099 if (op_iter_done (&iter))
1100 return NULL_TREE;
1101 op_iter_next_tree (&iter);
1102 if (op_iter_done (&iter))
1103 return var;
1104 return NULL_TREE;
1108 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
1109 return NULL. */
1110 static inline use_operand_p
1111 single_ssa_use_operand (tree stmt, int flags)
1113 use_operand_p var;
1114 ssa_op_iter iter;
1116 var = op_iter_init_use (&iter, stmt, flags);
1117 if (op_iter_done (&iter))
1118 return NULL_USE_OPERAND_P;
1119 op_iter_next_use (&iter);
1120 if (op_iter_done (&iter))
1121 return var;
1122 return NULL_USE_OPERAND_P;
1127 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
1128 return NULL. */
1129 static inline def_operand_p
1130 single_ssa_def_operand (tree stmt, int flags)
1132 def_operand_p var;
1133 ssa_op_iter iter;
1135 var = op_iter_init_def (&iter, stmt, flags);
1136 if (op_iter_done (&iter))
1137 return NULL_DEF_OPERAND_P;
1138 op_iter_next_def (&iter);
1139 if (op_iter_done (&iter))
1140 return var;
1141 return NULL_DEF_OPERAND_P;
1145 /* If there is a single operand in STMT matching FLAGS, return it. Otherwise
1146 return NULL. */
1147 static inline bool
1148 zero_ssa_operands (tree stmt, int flags)
1150 ssa_op_iter iter;
1152 op_iter_init_tree (&iter, stmt, flags);
1153 return op_iter_done (&iter);
1157 /* Return the number of operands matching FLAGS in STMT. */
1158 static inline int
1159 num_ssa_operands (tree stmt, int flags)
1161 ssa_op_iter iter;
1162 tree t;
1163 int num = 0;
1165 FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags)
1166 num++;
1167 return num;
1171 /* Delink all immediate_use information for STMT. */
1172 static inline void
1173 delink_stmt_imm_use (tree stmt)
1175 ssa_op_iter iter;
1176 use_operand_p use_p;
1178 if (ssa_operands_active ())
1179 FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter,
1180 (SSA_OP_ALL_USES | SSA_OP_ALL_KILLS))
1181 delink_imm_use (use_p);
1185 /* This routine will compare all the operands matching FLAGS in STMT1 to those
1186 in STMT2. TRUE is returned if they are the same. STMTs can be NULL. */
1187 static inline bool
1188 compare_ssa_operands_equal (tree stmt1, tree stmt2, int flags)
1190 ssa_op_iter iter1, iter2;
1191 tree op1 = NULL_TREE;
1192 tree op2 = NULL_TREE;
1193 bool look1, look2;
1195 if (stmt1 == stmt2)
1196 return true;
1198 look1 = stmt1 && stmt_ann (stmt1);
1199 look2 = stmt2 && stmt_ann (stmt2);
1201 if (look1)
1203 op1 = op_iter_init_tree (&iter1, stmt1, flags);
1204 if (!look2)
1205 return op_iter_done (&iter1);
1207 else
1208 clear_and_done_ssa_iter (&iter1);
1210 if (look2)
1212 op2 = op_iter_init_tree (&iter2, stmt2, flags);
1213 if (!look1)
1214 return op_iter_done (&iter2);
1216 else
1217 clear_and_done_ssa_iter (&iter2);
1219 while (!op_iter_done (&iter1) && !op_iter_done (&iter2))
1221 if (op1 != op2)
1222 return false;
1223 op1 = op_iter_next_tree (&iter1);
1224 op2 = op_iter_next_tree (&iter2);
1227 return (op_iter_done (&iter1) && op_iter_done (&iter2));
1231 /* If there is a single DEF in the PHI node which matches FLAG, return it.
1232 Otherwise return NULL_DEF_OPERAND_P. */
1233 static inline tree
1234 single_phi_def (tree stmt, int flags)
1236 tree def = PHI_RESULT (stmt);
1237 if ((flags & SSA_OP_DEF) && is_gimple_reg (def))
1238 return def;
1239 if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def))
1240 return def;
1241 return NULL_TREE;
1244 /* Initialize the iterator PTR for uses matching FLAGS in PHI. FLAGS should
1245 be either SSA_OP_USES or SSA_OP_VIRTUAL_USES. */
1246 static inline use_operand_p
1247 op_iter_init_phiuse (ssa_op_iter *ptr, tree phi, int flags)
1249 tree phi_def = PHI_RESULT (phi);
1250 int comp;
1252 clear_and_done_ssa_iter (ptr);
1253 ptr->done = false;
1255 gcc_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0);
1257 comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
1259 /* If the PHI node doesn't the operand type we care about, we're done. */
1260 if ((flags & comp) == 0)
1262 ptr->done = true;
1263 return NULL_USE_OPERAND_P;
1266 ptr->phi_stmt = phi;
1267 ptr->num_phi = PHI_NUM_ARGS (phi);
1268 ptr->iter_type = ssa_op_iter_use;
1269 return op_iter_next_use (ptr);
1273 /* Start an iterator for a PHI definition. */
1275 static inline def_operand_p
1276 op_iter_init_phidef (ssa_op_iter *ptr, tree phi, int flags)
1278 tree phi_def = PHI_RESULT (phi);
1279 int comp;
1281 clear_and_done_ssa_iter (ptr);
1282 ptr->done = false;
1284 gcc_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0);
1286 comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS);
1288 /* If the PHI node doesn't the operand type we care about, we're done. */
1289 if ((flags & comp) == 0)
1291 ptr->done = true;
1292 return NULL_USE_OPERAND_P;
1295 ptr->iter_type = ssa_op_iter_def;
1296 /* The first call to op_iter_next_def will terminate the iterator since
1297 all the fields are NULL. Simply return the result here as the first and
1298 therefore only result. */
1299 return PHI_RESULT_PTR (phi);
1302 /* Return true is IMM has reached the end of the immediate use stmt list. */
1304 static inline bool
1305 end_imm_use_stmt_p (imm_use_iterator *imm)
1307 return (imm->imm_use == imm->end_p);
1310 /* Finished the traverse of an immediate use stmt list IMM by removing the
1311 placeholder node from the list. */
1313 static inline void
1314 end_imm_use_stmt_traverse (imm_use_iterator *imm)
1316 delink_imm_use (&(imm->iter_node));
1319 /* Immediate use traversal of uses within a stmt require that all the
1320 uses on a stmt be sequentially listed. This routine is used to build up
1321 this sequential list by adding USE_P to the end of the current list
1322 currently delimited by HEAD and LAST_P. The new LAST_P value is
1323 returned. */
1325 static inline use_operand_p
1326 move_use_after_head (use_operand_p use_p, use_operand_p head,
1327 use_operand_p last_p)
1329 gcc_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
1330 /* Skip head when we find it. */
1331 if (use_p != head)
1333 /* If use_p is already linked in after last_p, continue. */
1334 if (last_p->next == use_p)
1335 last_p = use_p;
1336 else
1338 /* Delink from current location, and link in at last_p. */
1339 delink_imm_use (use_p);
1340 link_imm_use_to_list (use_p, last_p);
1341 last_p = use_p;
1344 return last_p;
1348 /* This routine will relink all uses with the same stmt as HEAD into the list
1349 immediately following HEAD for iterator IMM. */
1351 static inline void
1352 link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
1354 use_operand_p use_p;
1355 use_operand_p last_p = head;
1356 tree head_stmt = USE_STMT (head);
1357 tree use = USE_FROM_PTR (head);
1358 ssa_op_iter op_iter;
1359 int flag;
1361 /* Only look at virtual or real uses, depending on the type of HEAD. */
1362 flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES);
1364 if (TREE_CODE (head_stmt) == PHI_NODE)
1366 FOR_EACH_PHI_ARG (use_p, head_stmt, op_iter, flag)
1367 if (USE_FROM_PTR (use_p) == use)
1368 last_p = move_use_after_head (use_p, head, last_p);
1370 else
1372 FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag)
1373 if (USE_FROM_PTR (use_p) == use)
1374 last_p = move_use_after_head (use_p, head, last_p);
1376 /* LInk iter node in after last_p. */
1377 if (imm->iter_node.prev != NULL)
1378 delink_imm_use (&imm->iter_node);
1379 link_imm_use_to_list (&(imm->iter_node), last_p);
1382 /* Initialize IMM to traverse over uses of VAR. Return the first statement. */
1383 static inline tree
1384 first_imm_use_stmt (imm_use_iterator *imm, tree var)
1386 gcc_assert (TREE_CODE (var) == SSA_NAME);
1388 imm->end_p = &(SSA_NAME_IMM_USE_NODE (var));
1389 imm->imm_use = imm->end_p->next;
1390 imm->next_imm_name = NULL_USE_OPERAND_P;
1392 /* iter_node is used as a marker within the immediate use list to indicate
1393 where the end of the current stmt's uses are. Initialize it to NULL
1394 stmt and use, which indicates a marker node. */
1395 imm->iter_node.prev = NULL_USE_OPERAND_P;
1396 imm->iter_node.next = NULL_USE_OPERAND_P;
1397 imm->iter_node.stmt = NULL_TREE;
1398 imm->iter_node.use = NULL_USE_OPERAND_P;
1400 if (end_imm_use_stmt_p (imm))
1401 return NULL_TREE;
1403 link_use_stmts_after (imm->imm_use, imm);
1405 return USE_STMT (imm->imm_use);
1408 /* Bump IMM to the next stmt which has a use of var. */
1410 static inline tree
1411 next_imm_use_stmt (imm_use_iterator *imm)
1413 imm->imm_use = imm->iter_node.next;
1414 if (end_imm_use_stmt_p (imm))
1416 if (imm->iter_node.prev != NULL)
1417 delink_imm_use (&imm->iter_node);
1418 return NULL_TREE;
1421 link_use_stmts_after (imm->imm_use, imm);
1422 return USE_STMT (imm->imm_use);
1426 /* This routine will return the first use on the stmt IMM currently refers
1427 to. */
1429 static inline use_operand_p
1430 first_imm_use_on_stmt (imm_use_iterator *imm)
1432 imm->next_imm_name = imm->imm_use->next;
1433 return imm->imm_use;
1436 /* Return TRUE if the last use on the stmt IMM refers to has been visited. */
1438 static inline bool
1439 end_imm_use_on_stmt_p (imm_use_iterator *imm)
1441 return (imm->imm_use == &(imm->iter_node));
1444 /* Bump to the next use on the stmt IMM refers to, return NULL if done. */
1446 static inline use_operand_p
1447 next_imm_use_on_stmt (imm_use_iterator *imm)
1449 imm->imm_use = imm->next_imm_name;
1450 if (end_imm_use_on_stmt_p (imm))
1451 return NULL_USE_OPERAND_P;
1452 else
1454 imm->next_imm_name = imm->imm_use->next;
1455 return imm->imm_use;
1459 /* Return true if VAR cannot be modified by the program. */
1461 static inline bool
1462 unmodifiable_var_p (tree var)
1464 if (TREE_CODE (var) == SSA_NAME)
1465 var = SSA_NAME_VAR (var);
1467 if (MTAG_P (var))
1468 return TREE_READONLY (var) && (TREE_STATIC (var) || MTAG_GLOBAL (var));
1470 return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
1473 /* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it. */
1475 static inline bool
1476 array_ref_contains_indirect_ref (tree ref)
1478 gcc_assert (TREE_CODE (ref) == ARRAY_REF);
1480 do {
1481 ref = TREE_OPERAND (ref, 0);
1482 } while (handled_component_p (ref));
1484 return TREE_CODE (ref) == INDIRECT_REF;
1487 /* Return true if REF, a handled component reference, has an ARRAY_REF
1488 somewhere in it. */
1490 static inline bool
1491 ref_contains_array_ref (tree ref)
1493 gcc_assert (handled_component_p (ref));
1495 do {
1496 if (TREE_CODE (ref) == ARRAY_REF)
1497 return true;
1498 ref = TREE_OPERAND (ref, 0);
1499 } while (handled_component_p (ref));
1501 return false;
1504 /* Given a variable VAR, lookup and return a pointer to the list of
1505 subvariables for it. */
1507 static inline subvar_t *
1508 lookup_subvars_for_var (tree var)
1510 var_ann_t ann = var_ann (var);
1511 gcc_assert (ann);
1512 return &ann->subvars;
1515 /* Given a variable VAR, return a linked list of subvariables for VAR, or
1516 NULL, if there are no subvariables. */
1518 static inline subvar_t
1519 get_subvars_for_var (tree var)
1521 subvar_t subvars;
1523 gcc_assert (SSA_VAR_P (var));
1525 if (TREE_CODE (var) == SSA_NAME)
1526 subvars = *(lookup_subvars_for_var (SSA_NAME_VAR (var)));
1527 else
1528 subvars = *(lookup_subvars_for_var (var));
1529 return subvars;
1532 /* Return the subvariable of VAR at offset OFFSET. */
1534 static inline tree
1535 get_subvar_at (tree var, unsigned HOST_WIDE_INT offset)
1537 subvar_t sv;
1539 for (sv = get_subvars_for_var (var); sv; sv = sv->next)
1540 if (SFT_OFFSET (sv->var) == offset)
1541 return sv->var;
1543 return NULL_TREE;
1546 /* Return true if V is a tree that we can have subvars for.
1547 Normally, this is any aggregate type. Also complex
1548 types which are not gimple registers can have subvars. */
1550 static inline bool
1551 var_can_have_subvars (tree v)
1553 /* Volatile variables should never have subvars. */
1554 if (TREE_THIS_VOLATILE (v))
1555 return false;
1557 /* Non decls or memory tags can never have subvars. */
1558 if (!DECL_P (v) || MTAG_P (v))
1559 return false;
1561 /* Aggregates can have subvars. */
1562 if (AGGREGATE_TYPE_P (TREE_TYPE (v)))
1563 return true;
1565 /* Complex types variables which are not also a gimple register can
1566 have subvars. */
1567 if (TREE_CODE (TREE_TYPE (v)) == COMPLEX_TYPE
1568 && !DECL_COMPLEX_GIMPLE_REG_P (v))
1569 return true;
1571 return false;
1575 /* Return true if OFFSET and SIZE define a range that overlaps with some
1576 portion of the range of SV, a subvar. If there was an exact overlap,
1577 *EXACT will be set to true upon return. */
1579 static inline bool
1580 overlap_subvar (unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size,
1581 tree sv, bool *exact)
1583 /* There are three possible cases of overlap.
1584 1. We can have an exact overlap, like so:
1585 |offset, offset + size |
1586 |sv->offset, sv->offset + sv->size |
1588 2. We can have offset starting after sv->offset, like so:
1590 |offset, offset + size |
1591 |sv->offset, sv->offset + sv->size |
1593 3. We can have offset starting before sv->offset, like so:
1595 |offset, offset + size |
1596 |sv->offset, sv->offset + sv->size|
1599 if (exact)
1600 *exact = false;
1601 if (offset == SFT_OFFSET (sv) && size == SFT_SIZE (sv))
1603 if (exact)
1604 *exact = true;
1605 return true;
1607 else if (offset >= SFT_OFFSET (sv)
1608 && offset < (SFT_OFFSET (sv) + SFT_SIZE (sv)))
1610 return true;
1612 else if (offset < SFT_OFFSET (sv)
1613 && (size > SFT_OFFSET (sv) - offset))
1615 return true;
1617 return false;
1621 #endif /* _TREE_FLOW_INLINE_H */