2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GCC is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 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/>. */
23 #include "coretypes.h"
25 #include "diagnostic-core.h"
26 #include "gimple-pretty-print.h"
28 #include "basic-block.h"
30 #include "gimple-iterator.h"
31 #include "diagnostic-core.h"
36 #include "stringpool.h"
39 #include "fold-const.h"
40 #include "tree-pretty-print.h"
41 #include "diagnostic-color.h"
42 #include "diagnostic-metadata.h"
47 #include "analyzer/analyzer.h"
48 #include "analyzer/analyzer-logging.h"
49 #include "ordered-hash-map.h"
54 #include "analyzer/supergraph.h"
56 #include "analyzer/call-string.h"
57 #include "analyzer/program-point.h"
58 #include "analyzer/store.h"
59 #include "analyzer/region-model.h"
65 /* class region and its various subclasses. */
71 delete m_cached_offset
;
74 /* Compare REG1 and REG2 by id. */
77 region::cmp_ids (const region
*reg1
, const region
*reg2
)
79 return (long)reg1
->get_id () - (long)reg2
->get_id ();
82 /* Determine the base region for this region: when considering bindings
83 for this region, the base region is the ancestor which identifies
84 which cluster they should be partitioned into.
85 Regions within the same struct/union/array are in the same cluster.
86 Different decls are in different clusters. */
89 region::get_base_region () const
91 const region
*iter
= this;
94 switch (iter
->get_kind ())
99 iter
= iter
->get_parent_region ();
102 iter
= iter
->dyn_cast_cast_region ()->get_original_region ();
111 /* Return true if get_base_region() == this for this region. */
114 region::base_region_p () const
118 /* Region kinds representing a descendent of a base region. */
130 /* Return true if this region is ELDER or one of its descendents. */
133 region::descendent_of_p (const region
*elder
) const
135 const region
*iter
= this;
140 if (iter
->get_kind () == RK_CAST
)
141 iter
= iter
->dyn_cast_cast_region ()->get_original_region ();
143 iter
= iter
->get_parent_region ();
148 /* If this region is a frame_region, or a descendent of one, return it.
149 Otherwise return NULL. */
152 region::maybe_get_frame_region () const
154 const region
*iter
= this;
157 if (const frame_region
*frame_reg
= iter
->dyn_cast_frame_region ())
159 if (iter
->get_kind () == RK_CAST
)
160 iter
= iter
->dyn_cast_cast_region ()->get_original_region ();
162 iter
= iter
->get_parent_region ();
167 /* If this region is a decl_region, return the decl.
168 Otherwise return NULL. */
171 region::maybe_get_decl () const
173 if (const decl_region
*decl_reg
= dyn_cast_decl_region ())
174 return decl_reg
->get_decl ();
178 /* Get the region_offset for this region (calculating it on the
179 first call and caching it internally). */
182 region::get_offset () const
185 m_cached_offset
= new region_offset (calc_offset ());
186 return *m_cached_offset
;
189 /* If the size of this region (in bytes) is known statically, write it to *OUT
191 Otherwise return false. */
194 region::get_byte_size (byte_size_t
*out
) const
196 tree type
= get_type ();
198 /* Bail out e.g. for heap-allocated regions. */
202 HOST_WIDE_INT bytes
= int_size_in_bytes (type
);
209 /* If the size of this region (in bits) is known statically, write it to *OUT
211 Otherwise return false. */
214 region::get_bit_size (bit_size_t
*out
) const
216 byte_size_t byte_size
;
217 if (!get_byte_size (&byte_size
))
219 *out
= byte_size
* BITS_PER_UNIT
;
223 /* Get the field within RECORD_TYPE at BIT_OFFSET. */
226 get_field_at_bit_offset (tree record_type
, bit_offset_t bit_offset
)
228 gcc_assert (TREE_CODE (record_type
) == RECORD_TYPE
);
232 /* Find the first field that has an offset > BIT_OFFSET,
233 then return the one preceding it.
234 Skip other trees within the chain, such as FUNCTION_DECLs. */
235 tree last_field
= NULL_TREE
;
236 for (tree iter
= TYPE_FIELDS (record_type
); iter
!= NULL_TREE
;
237 iter
= DECL_CHAIN (iter
))
239 if (TREE_CODE (iter
) == FIELD_DECL
)
241 int iter_field_offset
= int_bit_position (iter
);
242 if (bit_offset
< iter_field_offset
)
250 /* Populate *OUT with descendent regions of type TYPE that match
251 RELATIVE_BIT_OFFSET and SIZE_IN_BITS within this region. */
254 region::get_subregions_for_binding (region_model_manager
*mgr
,
255 bit_offset_t relative_bit_offset
,
256 bit_size_t size_in_bits
,
258 auto_vec
<const region
*> *out
) const
260 if (get_type () == NULL_TREE
|| type
== NULL_TREE
)
262 if (relative_bit_offset
== 0
263 && types_compatible_p (get_type (), type
))
265 out
->safe_push (this);
268 switch (TREE_CODE (get_type ()))
272 tree element_type
= TREE_TYPE (get_type ());
273 HOST_WIDE_INT hwi_byte_size
= int_size_in_bytes (element_type
);
274 if (hwi_byte_size
> 0)
276 HOST_WIDE_INT bits_per_element
277 = hwi_byte_size
<< LOG2_BITS_PER_UNIT
;
278 HOST_WIDE_INT element_index
279 = (relative_bit_offset
.to_shwi () / bits_per_element
);
280 tree element_index_cst
281 = build_int_cst (integer_type_node
, element_index
);
282 HOST_WIDE_INT inner_bit_offset
283 = relative_bit_offset
.to_shwi () % bits_per_element
;
284 const region
*subregion
= mgr
->get_element_region
286 mgr
->get_or_create_constant_svalue (element_index_cst
));
287 subregion
->get_subregions_for_binding (mgr
, inner_bit_offset
,
288 size_in_bits
, type
, out
);
294 /* The bit offset might be *within* one of the fields (such as
295 with nested structs).
296 So we want to find the enclosing field, adjust the offset,
298 if (tree field
= get_field_at_bit_offset (get_type (),
299 relative_bit_offset
))
301 int field_bit_offset
= int_bit_position (field
);
302 const region
*subregion
= mgr
->get_field_region (this, field
);
303 subregion
->get_subregions_for_binding
304 (mgr
, relative_bit_offset
- field_bit_offset
,
305 size_in_bits
, type
, out
);
311 for (tree field
= TYPE_FIELDS (get_type ()); field
!= NULL_TREE
;
312 field
= DECL_CHAIN (field
))
314 if (TREE_CODE (field
) != FIELD_DECL
)
316 const region
*subregion
= mgr
->get_field_region (this, field
);
317 subregion
->get_subregions_for_binding (mgr
,
331 /* Walk from this region up to the base region within its cluster, calculating
332 the offset relative to the base region, either as an offset in bits,
333 or a symbolic offset. */
336 region::calc_offset () const
338 const region
*iter_region
= this;
339 bit_offset_t accum_bit_offset
= 0;
343 switch (iter_region
->get_kind ())
347 const field_region
*field_reg
348 = (const field_region
*)iter_region
;
349 iter_region
= iter_region
->get_parent_region ();
351 /* Compare with e.g. gimple-fold.c's
352 fold_nonarray_ctor_reference. */
353 tree field
= field_reg
->get_field ();
354 tree byte_offset
= DECL_FIELD_OFFSET (field
);
355 if (TREE_CODE (byte_offset
) != INTEGER_CST
)
356 return region_offset::make_symbolic (iter_region
);
357 tree field_offset
= DECL_FIELD_BIT_OFFSET (field
);
358 /* Compute bit offset of the field. */
360 = (wi::to_offset (field_offset
)
361 + (wi::to_offset (byte_offset
) << LOG2_BITS_PER_UNIT
));
362 accum_bit_offset
+= bitoffset
;
368 const element_region
*element_reg
369 = (const element_region
*)iter_region
;
370 iter_region
= iter_region
->get_parent_region ();
373 = element_reg
->get_index ()->maybe_get_constant ())
375 gcc_assert (TREE_CODE (idx_cst
) == INTEGER_CST
);
377 tree elem_type
= element_reg
->get_type ();
378 offset_int element_idx
= wi::to_offset (idx_cst
);
380 /* First, use int_size_in_bytes, to reject the case where we
381 have an incomplete type, or a non-constant value. */
382 HOST_WIDE_INT hwi_byte_size
= int_size_in_bytes (elem_type
);
383 if (hwi_byte_size
> 0)
385 offset_int element_bit_size
386 = hwi_byte_size
<< LOG2_BITS_PER_UNIT
;
387 offset_int element_bit_offset
388 = element_idx
* element_bit_size
;
389 accum_bit_offset
+= element_bit_offset
;
393 return region_offset::make_symbolic (iter_region
);
399 const offset_region
*offset_reg
400 = (const offset_region
*)iter_region
;
401 iter_region
= iter_region
->get_parent_region ();
403 if (tree byte_offset_cst
404 = offset_reg
->get_byte_offset ()->maybe_get_constant ())
406 gcc_assert (TREE_CODE (byte_offset_cst
) == INTEGER_CST
);
407 /* Use a signed value for the byte offset, to handle
409 HOST_WIDE_INT byte_offset
410 = wi::to_offset (byte_offset_cst
).to_shwi ();
411 HOST_WIDE_INT bit_offset
= byte_offset
* BITS_PER_UNIT
;
412 accum_bit_offset
+= bit_offset
;
415 return region_offset::make_symbolic (iter_region
);
421 const cast_region
*cast_reg
422 = as_a
<const cast_region
*> (iter_region
);
423 iter_region
= cast_reg
->get_original_region ();
428 return region_offset::make_concrete (iter_region
, accum_bit_offset
);
431 return region_offset::make_concrete (iter_region
, accum_bit_offset
);
434 /* Copy from SRC_REG to DST_REG, using CTXT for any issues that occur. */
437 region_model::copy_region (const region
*dst_reg
, const region
*src_reg
,
438 region_model_context
*ctxt
)
440 gcc_assert (dst_reg
);
441 gcc_assert (src_reg
);
442 if (dst_reg
== src_reg
)
445 const svalue
*sval
= get_store_value (src_reg
);
446 set_value (dst_reg
, sval
, ctxt
);
449 /* Dump a description of this region to stderr. */
452 region::dump (bool simple
) const
455 pp_format_decoder (&pp
) = default_tree_printer
;
456 pp_show_color (&pp
) = pp_show_color (global_dc
->printer
);
457 pp
.buffer
->stream
= stderr
;
458 dump_to_pp (&pp
, simple
);
463 /* Generate a description of this region. */
465 DEBUG_FUNCTION label_text
466 region::get_desc (bool simple
) const
469 pp_format_decoder (&pp
) = default_tree_printer
;
470 dump_to_pp (&pp
, simple
);
471 return label_text::take (xstrdup (pp_formatted_text (&pp
)));
474 /* Base implementation of region::accept vfunc.
475 Subclass implementations should chain up to this. */
478 region::accept (visitor
*v
) const
480 v
->visit_region (this);
482 m_parent
->accept (v
);
485 /* Return true if this is a symbolic region for deferencing an
487 We shouldn't attempt to bind values for this region (but
488 can unbind values for other regions). */
491 region::symbolic_for_unknown_ptr_p () const
493 if (const symbolic_region
*sym_reg
= dyn_cast_symbolic_region ())
494 if (sym_reg
->get_pointer ()->get_kind () == SK_UNKNOWN
)
501 region::region (complexity c
, unsigned id
, const region
*parent
, tree type
)
502 : m_complexity (c
), m_id (id
), m_parent (parent
), m_type (type
),
503 m_cached_offset (NULL
)
505 gcc_assert (type
== NULL_TREE
|| TYPE_P (type
));
508 /* Comparator for regions, using their IDs to order them. */
511 region::cmp_ptrs (const void *p1
, const void *p2
)
513 const region
* const *reg1
= (const region
* const *)p1
;
514 const region
* const *reg2
= (const region
* const *)p2
;
516 return cmp_ids (*reg1
, *reg2
);
519 /* Determine if a pointer to this region must be non-NULL.
521 Generally, pointers to regions must be non-NULL, but pointers
522 to symbolic_regions might, in fact, be NULL.
524 This allows us to simulate functions like malloc and calloc with:
525 - only one "outcome" from each statement,
526 - the idea that the pointer is on the heap if non-NULL
527 - the possibility that the pointer could be NULL
528 - the idea that successive values returned from malloc are non-equal
529 - to be able to zero-fill for calloc. */
532 region::non_null_p () const
539 /* Are we within a symbolic_region? If so, it could be NULL, and we
540 have to fall back on the constraints. */
542 case RK_HEAP_ALLOCATED
:
547 /* Comparator for trees to impose a deterministic ordering on
551 tree_cmp (const_tree t1
, const_tree t2
)
556 /* Test tree codes first. */
557 if (TREE_CODE (t1
) != TREE_CODE (t2
))
558 return TREE_CODE (t1
) - TREE_CODE (t2
);
560 /* From this point on, we know T1 and T2 have the same tree code. */
564 if (DECL_NAME (t1
) && DECL_NAME (t2
))
565 return strcmp (IDENTIFIER_POINTER (DECL_NAME (t1
)),
566 IDENTIFIER_POINTER (DECL_NAME (t2
)));
571 else if (DECL_NAME (t2
))
574 return DECL_UID (t1
) - DECL_UID (t2
);
578 switch (TREE_CODE (t1
))
582 if (SSA_NAME_VAR (t1
) && SSA_NAME_VAR (t2
))
584 int var_cmp
= tree_cmp (SSA_NAME_VAR (t1
), SSA_NAME_VAR (t2
));
587 return SSA_NAME_VERSION (t1
) - SSA_NAME_VERSION (t2
);
591 if (SSA_NAME_VAR (t1
))
593 else if (SSA_NAME_VAR (t2
))
596 return SSA_NAME_VERSION (t1
) - SSA_NAME_VERSION (t2
);
602 return tree_int_cst_compare (t1
, t2
);
606 const real_value
*rv1
= TREE_REAL_CST_PTR (t1
);
607 const real_value
*rv2
= TREE_REAL_CST_PTR (t2
);
608 if (real_compare (UNORDERED_EXPR
, rv1
, rv2
))
610 /* Impose an arbitrary order on NaNs relative to other NaNs
612 if (int cmp_isnan
= real_isnan (rv1
) - real_isnan (rv2
))
614 if (int cmp_issignaling_nan
615 = real_issignaling_nan (rv1
) - real_issignaling_nan (rv2
))
616 return cmp_issignaling_nan
;
617 return real_isneg (rv1
) - real_isneg (rv2
);
619 if (real_compare (LT_EXPR
, rv1
, rv2
))
621 if (real_compare (GT_EXPR
, rv1
, rv2
))
627 return strcmp (TREE_STRING_POINTER (t1
),
628 TREE_STRING_POINTER (t2
));
640 /* qsort comparator for trees to impose a deterministic ordering on
644 tree_cmp (const void *p1
, const void *p2
)
646 const_tree t1
= *(const_tree
const *)p1
;
647 const_tree t2
= *(const_tree
const *)p2
;
649 return tree_cmp (t1
, t2
);
652 /* class frame_region : public space_region. */
654 frame_region::~frame_region ()
656 for (map_t::iterator iter
= m_locals
.begin ();
657 iter
!= m_locals
.end ();
659 delete (*iter
).second
;
663 frame_region::accept (visitor
*v
) const
667 m_calling_frame
->accept (v
);
670 /* Implementation of region::dump_to_pp vfunc for frame_region. */
673 frame_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
676 pp_printf (pp
, "frame: %qs@%i", function_name (m_fun
), get_stack_depth ());
678 pp_printf (pp
, "frame_region(%qs, index: %i, depth: %i)",
679 function_name (m_fun
), m_index
, get_stack_depth ());
683 frame_region::get_region_for_local (region_model_manager
*mgr
,
686 // TODO: could also check that VAR_DECLs are locals
687 gcc_assert (TREE_CODE (expr
) == PARM_DECL
688 || TREE_CODE (expr
) == VAR_DECL
689 || TREE_CODE (expr
) == SSA_NAME
690 || TREE_CODE (expr
) == RESULT_DECL
);
692 /* Ideally we'd use mutable here. */
693 map_t
&mutable_locals
= const_cast <map_t
&> (m_locals
);
695 if (decl_region
**slot
= mutable_locals
.get (expr
))
698 = new decl_region (mgr
->alloc_region_id (), this, expr
);
699 mutable_locals
.put (expr
, reg
);
703 /* class globals_region : public space_region. */
705 /* Implementation of region::dump_to_pp vfunc for globals_region. */
708 globals_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
711 pp_string (pp
, "::");
713 pp_string (pp
, "globals");
716 /* class code_region : public map_region. */
718 /* Implementation of region::dump_to_pp vfunc for code_region. */
721 code_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
724 pp_string (pp
, "code region");
726 pp_string (pp
, "code_region()");
729 /* class function_region : public region. */
731 /* Implementation of region::dump_to_pp vfunc for function_region. */
734 function_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
738 dump_quoted_tree (pp
, m_fndecl
);
742 pp_string (pp
, "function_region(");
743 dump_quoted_tree (pp
, m_fndecl
);
748 /* class label_region : public region. */
750 /* Implementation of region::dump_to_pp vfunc for label_region. */
753 label_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
757 dump_quoted_tree (pp
, m_label
);
761 pp_string (pp
, "label_region(");
762 dump_quoted_tree (pp
, m_label
);
767 /* class stack_region : public region. */
769 /* Implementation of region::dump_to_pp vfunc for stack_region. */
772 stack_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
775 pp_string (pp
, "stack region");
777 pp_string (pp
, "stack_region()");
780 /* class heap_region : public region. */
782 /* Implementation of region::dump_to_pp vfunc for heap_region. */
785 heap_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
788 pp_string (pp
, "heap region");
790 pp_string (pp
, "heap_region()");
793 /* class root_region : public region. */
795 /* root_region's ctor. */
797 root_region::root_region (unsigned id
)
798 : region (complexity (1, 1), id
, NULL
, NULL_TREE
)
802 /* Implementation of region::dump_to_pp vfunc for root_region. */
805 root_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
808 pp_string (pp
, "root region");
810 pp_string (pp
, "root_region()");
813 /* class symbolic_region : public map_region. */
815 /* Implementation of region::accept vfunc for symbolic_region. */
818 symbolic_region::accept (visitor
*v
) const
821 m_sval_ptr
->accept (v
);
824 /* Implementation of region::dump_to_pp vfunc for symbolic_region. */
827 symbolic_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
831 pp_string (pp
, "(*");
832 m_sval_ptr
->dump_to_pp (pp
, simple
);
837 pp_string (pp
, "symbolic_region(");
838 get_parent_region ()->dump_to_pp (pp
, simple
);
839 pp_string (pp
, ", ");
840 print_quoted_type (pp
, get_type ());
841 pp_string (pp
, ", ");
842 m_sval_ptr
->dump_to_pp (pp
, simple
);
847 /* class decl_region : public region. */
849 /* Implementation of region::dump_to_pp vfunc for decl_region. */
852 decl_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
855 pp_printf (pp
, "%E", m_decl
);
858 pp_string (pp
, "decl_region(");
859 get_parent_region ()->dump_to_pp (pp
, simple
);
860 pp_string (pp
, ", ");
861 print_quoted_type (pp
, get_type ());
862 pp_printf (pp
, ", %qE)", m_decl
);
866 /* Get the stack depth for the frame containing this decl, or 0
870 decl_region::get_stack_depth () const
872 if (get_parent_region () == NULL
)
874 if (const frame_region
*frame_reg
875 = get_parent_region ()->dyn_cast_frame_region ())
876 return frame_reg
->get_stack_depth ();
880 /* If the underlying decl is in the global constant pool,
881 return an svalue representing the constant value.
882 Otherwise return NULL. */
885 decl_region::maybe_get_constant_value (region_model_manager
*mgr
) const
887 if (TREE_CODE (m_decl
) == VAR_DECL
888 && DECL_IN_CONSTANT_POOL (m_decl
)
889 && DECL_INITIAL (m_decl
)
890 && TREE_CODE (DECL_INITIAL (m_decl
)) == CONSTRUCTOR
)
891 return get_svalue_for_constructor (DECL_INITIAL (m_decl
), mgr
);
895 /* Get an svalue for CTOR, a CONSTRUCTOR for this region's decl. */
898 decl_region::get_svalue_for_constructor (tree ctor
,
899 region_model_manager
*mgr
) const
901 gcc_assert (!TREE_CLOBBER_P (ctor
));
903 /* Create a binding map, applying ctor to it, using this
904 decl_region as the base region when building child regions
905 for offset calculations. */
907 map
.apply_ctor_to_region (this, ctor
, mgr
);
909 /* Return a compound svalue for the map we built. */
910 return mgr
->get_or_create_compound_svalue (get_type (), map
);
913 /* For use on decl_regions for global variables.
915 Get an svalue for the initial value of this region at entry to
916 "main" (either based on DECL_INITIAL, or implicit initialization to
920 decl_region::get_svalue_for_initializer (region_model_manager
*mgr
) const
922 tree init
= DECL_INITIAL (m_decl
);
925 /* Implicit initialization to zero; use a compound_svalue for it. */
926 binding_cluster
c (this);
927 c
.zero_fill_region (mgr
->get_store_manager (), this);
928 return mgr
->get_or_create_compound_svalue (TREE_TYPE (m_decl
),
932 if (TREE_CODE (init
) == CONSTRUCTOR
)
933 return get_svalue_for_constructor (init
, mgr
);
935 /* Reuse the get_rvalue logic from region_model. */
936 region_model
m (mgr
);
937 return m
.get_rvalue (path_var (init
, 0), NULL
);
940 /* class field_region : public region. */
942 /* Implementation of region::dump_to_pp vfunc for field_region. */
945 field_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
949 get_parent_region ()->dump_to_pp (pp
, simple
);
951 pp_printf (pp
, "%E", m_field
);
955 pp_string (pp
, "field_region(");
956 get_parent_region ()->dump_to_pp (pp
, simple
);
957 pp_string (pp
, ", ");
958 print_quoted_type (pp
, get_type ());
959 pp_printf (pp
, ", %qE)", m_field
);
963 /* class element_region : public region. */
965 /* Implementation of region::accept vfunc for element_region. */
968 element_region::accept (visitor
*v
) const
974 /* Implementation of region::dump_to_pp vfunc for element_region. */
977 element_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
981 //pp_string (pp, "(");
982 get_parent_region ()->dump_to_pp (pp
, simple
);
984 m_index
->dump_to_pp (pp
, simple
);
986 //pp_string (pp, ")");
990 pp_string (pp
, "element_region(");
991 get_parent_region ()->dump_to_pp (pp
, simple
);
992 pp_string (pp
, ", ");
993 print_quoted_type (pp
, get_type ());
994 pp_string (pp
, ", ");
995 m_index
->dump_to_pp (pp
, simple
);
1000 /* class offset_region : public region. */
1002 /* Implementation of region::accept vfunc for offset_region. */
1005 offset_region::accept (visitor
*v
) const
1008 m_byte_offset
->accept (v
);
1011 /* Implementation of region::dump_to_pp vfunc for offset_region. */
1014 offset_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
1018 //pp_string (pp, "(");
1019 get_parent_region ()->dump_to_pp (pp
, simple
);
1020 pp_string (pp
, "+");
1021 m_byte_offset
->dump_to_pp (pp
, simple
);
1022 //pp_string (pp, ")");
1026 pp_string (pp
, "offset_region(");
1027 get_parent_region ()->dump_to_pp (pp
, simple
);
1028 pp_string (pp
, ", ");
1029 print_quoted_type (pp
, get_type ());
1030 pp_string (pp
, ", ");
1031 m_byte_offset
->dump_to_pp (pp
, simple
);
1032 pp_printf (pp
, ")");
1036 /* class cast_region : public region. */
1038 /* Implementation of region::accept vfunc for cast_region. */
1041 cast_region::accept (visitor
*v
) const
1044 m_original_region
->accept (v
);
1047 /* Implementation of region::dump_to_pp vfunc for cast_region. */
1050 cast_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
1054 pp_string (pp
, "CAST_REG(");
1055 print_quoted_type (pp
, get_type ());
1056 pp_string (pp
, ", ");
1057 m_original_region
->dump_to_pp (pp
, simple
);
1058 pp_string (pp
, ")");
1062 pp_string (pp
, "cast_region(");
1063 m_original_region
->dump_to_pp (pp
, simple
);
1064 pp_string (pp
, ", ");
1065 print_quoted_type (pp
, get_type ());
1066 pp_printf (pp
, ")");
1070 /* class heap_allocated_region : public region. */
1072 /* Implementation of region::dump_to_pp vfunc for heap_allocated_region. */
1075 heap_allocated_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
1078 pp_printf (pp
, "HEAP_ALLOCATED_REGION(%i)", get_id ());
1080 pp_printf (pp
, "heap_allocated_region(%i)", get_id ());
1083 /* class alloca_region : public region. */
1085 /* Implementation of region::dump_to_pp vfunc for alloca_region. */
1088 alloca_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
1091 pp_string (pp
, "ALLOCA_REGION");
1093 pp_string (pp
, "alloca_region()");
1096 /* class string_region : public region. */
1098 /* Implementation of region::dump_to_pp vfunc for string_region. */
1101 string_region::dump_to_pp (pretty_printer
*pp
, bool simple
) const
1104 dump_tree (pp
, m_string_cst
);
1107 pp_string (pp
, "string_region(");
1108 dump_tree (pp
, m_string_cst
);
1109 pp_string (pp
, " (");
1110 pp_pointer (pp
, m_string_cst
);
1111 pp_string (pp
, "))");
1115 /* class unknown_region : public region. */
1117 /* Implementation of region::dump_to_pp vfunc for unknown_region. */
1120 unknown_region::dump_to_pp (pretty_printer
*pp
, bool /*simple*/) const
1122 pp_string (pp
, "UNKNOWN_REGION");
1127 #endif /* #if ENABLE_ANALYZER */