GCC Middle and Back End API Reference
region.h
Go to the documentation of this file.
1/* Regions of memory.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_ANALYZER_REGION_H
22#define GCC_ANALYZER_REGION_H
23
24#include "analyzer/symbol.h"
25
26namespace ana {
27
28/* An enum for identifying different spaces within memory. */
29
41
42/* An enum for discriminating between the different concrete subclasses
43 of region. */
44
72
73/* Region and its subclasses.
74
75 The class hierarchy looks like this (using indentation to show
76 inheritance, and with region_kinds shown for the concrete subclasses):
77
78 region
79 space_region
80 frame_region (RK_FRAME): a function frame on the stack
81 globals_region (RK_GLOBALS): holds globals variables (data and bss)
82 code_region (RK_CODE): represents the code segment, containing functions
83 stack_region (RK_STACK): a stack, containing all stack frames
84 heap_region (RK_HEAP): the heap, containing heap_allocated_regions
85 thread_local_region (RK_THREAD_LOCAL): thread-local data for the thread
86 being analyzed
87 root_region (RK_ROOT): the top-level region
88 function_region (RK_FUNCTION): the code for a particular function
89 label_region (RK_LABEL): a particular label within a function
90 symbolic_region (RK_SYMBOLIC): dereferencing a symbolic pointer
91 decl_region (RK_DECL): the memory occupied by a particular global, local,
92 or SSA name
93 field_region (RK_FIELD): the memory occupied by a field within a struct
94 or union
95 element_region (RK_ELEMENT): an element within an array
96 offset_region (RK_OFFSET): a byte-offset within another region, for
97 handling pointer arithmetic as a region
98 sized_region (RK_SIZED): a subregion of symbolic size (in bytes)
99 within its parent
100 cast_region (RK_CAST): a region that views another region using a
101 different type
102 heap_allocated_region (RK_HEAP_ALLOCATED): an untyped region dynamically
103 allocated on the heap via
104 "malloc" or similar
105 alloca_region (RK_ALLOCA): an untyped region dynamically allocated on the
106 stack via "alloca"
107 string_region (RK_STRING): a region for a STRING_CST
108 bit_range_region (RK_BIT_RANGE): a region for a specific range of bits
109 within another region
110 var_arg_region (RK_VAR_ARG): a region for the N-th vararg within a
111 frame_region for a variadic call
112 errno_region (RK_ERRNO): a region for holding "errno"
113 private_region (RK_PRIVATE): a region for internal state of an API
114 unknown_region (RK_UNKNOWN): for handling unimplemented tree codes. */
115
116/* Abstract base class for representing ways of accessing chunks of memory.
117
118 Regions form a tree-like hierarchy, with a root region at the base,
119 with memory space regions within it, representing the stack and
120 globals, with frames within the stack, and regions for variables
121 within the frames and the "globals" region. Regions for structs
122 can have subregions for fields. */
123
124class region : public symbol
125{
126public:
127 virtual ~region ();
128
129 virtual enum region_kind get_kind () const = 0;
130 virtual const frame_region *
131 dyn_cast_frame_region () const { return NULL; }
132 virtual const function_region *
133 dyn_cast_function_region () const { return NULL; }
134 virtual const symbolic_region *
135 dyn_cast_symbolic_region () const { return NULL; }
136 virtual const decl_region *
137 dyn_cast_decl_region () const { return NULL; }
138 virtual const field_region *
139 dyn_cast_field_region () const { return NULL; }
140 virtual const element_region *
141 dyn_cast_element_region () const { return NULL; }
142 virtual const offset_region *
143 dyn_cast_offset_region () const { return NULL; }
144 virtual const sized_region *
145 dyn_cast_sized_region () const { return NULL; }
146 virtual const cast_region *
147 dyn_cast_cast_region () const { return NULL; }
148 virtual const string_region *
149 dyn_cast_string_region () const { return NULL; }
150 virtual const bit_range_region *
151 dyn_cast_bit_range_region () const { return NULL; }
152 virtual const var_arg_region *
153 dyn_cast_var_arg_region () const { return NULL; }
154
155 virtual void accept (visitor *v) const;
156
157 const region *get_parent_region () const { return m_parent; }
158 const region *get_base_region () const;
159 bool base_region_p () const;
160 bool descendent_of_p (const region *elder) const;
165
167
168 tree get_type () const { return m_type; }
169
171 pretty_printer *pp) const;
172 label_text get_desc (bool simple=true) const;
173
174 virtual void dump_to_pp (pretty_printer *pp, bool simple) const = 0;
175 void dump (bool simple) const;
176
178
180 const region_model &model) const;
181
182 bool non_null_p () const;
183
184 static int cmp_ptr_ptr (const void *, const void *);
185
186 bool involves_p (const svalue *sval) const;
187
190
191 /* Attempt to get the size of this region as a concrete number of bytes.
192 If successful, return true and write the size to *OUT.
193 Otherwise return false.
194 This is the accessed size, not necessarily the size that's valid to
195 access. */
196 virtual bool get_byte_size (byte_size_t *out) const;
197
198 /* Attempt to get the size of this region as a concrete number of bits.
199 If successful, return true and write the size to *OUT.
200 Otherwise return false.
201 This is the accessed size, not necessarily the size that's valid to
202 access. */
203 virtual bool get_bit_size (bit_size_t *out) const;
204
205 /* Get a symbolic value describing the size of this region in bytes
206 (which could be "unknown").
207 This is the accessed size, not necessarily the size that's valid to
208 access. */
210
211 /* Get a symbolic value describing the size of this region in bits
212 (which could be "unknown").
213 This is the accessed size, not necessarily the size that's valid to
214 access. */
216
217 /* Attempt to get the offset in bits of this region relative to its parent.
218 If successful, return true and write to *OUT.
219 Otherwise return false. */
221
222 /* Get the offset in bytes of this region relative to its parent as a svalue.
223 Might return an unknown_svalue. */
224 virtual const svalue *
226
227 /* Attempt to get the position and size of this region expressed as a
228 concrete range of bytes relative to its parent.
229 If successful, return true and write to *OUT.
230 Otherwise return false. */
232
233 void
237 tree type,
238 auto_vec <const region *> *out) const;
239
241
242 bool symbolic_p () const;
243
244 /* For most base regions it makes sense to track the bindings of the region
245 within the store. As an optimization, some are not tracked (to avoid
246 bloating the store object with redundant binding clusters). */
247 virtual bool tracked_p () const { return true; }
248
249 bool is_named_decl_p (const char *decl_name) const;
250
251 bool empty_p () const;
252
253 protected:
254 region (complexity c, symbol::id_t id, const region *parent, tree type);
255
256 private:
259
262
264
265 /* For regions within a global decl, a cache of the svalue for the initial
266 value of this region when the program starts. */
268};
269
270} // namespace ana
271
272template <>
273template <>
274inline bool
276{
277 return true;
278}
279
280namespace ana {
281
282/* Abstract subclass of region, for regions that represent an untyped
283 space within memory, such as the stack or the heap. */
284
285class space_region : public region
286{
287protected:
288 space_region (symbol::id_t id, const region *parent)
289 : region (complexity (parent), id, parent, NULL_TREE)
290 {}
291};
292
293/* Concrete space_region subclass, representing a function frame on the stack,
294 to contain the locals.
295 The parent is the stack region; there's also a hierarchy of call-stack
296 prefixes expressed via m_calling_frame.
297 For example, given "oldest" calling "middle" called "newest" we would have
298 - a stack depth of 3
299 - frame (A) for "oldest" with index 0 for depth 1, calling_frame == NULL
300 - frame (B) for "middle" with index 1 for depth 2, calling_frame == (A)
301 - frame (C) for "newest" with index 2 for depth 3, calling_frame == (B)
302 where the parent region for each of the frames is the "stack" region.
303 The index is the count of frames earlier than this in the stack. */
304
306{
307public:
308 /* A support class for uniquifying instances of frame_region. */
309 struct key_t
310 {
313 {
314 /* calling_frame can be NULL. */
315 }
316
318 {
320 hstate.add_ptr (m_calling_frame);
321 hstate.add_ptr (m_fun);
322 return hstate.end ();
323 }
324
325 bool operator== (const key_t &other) const
326 {
327 return (m_calling_frame == other.m_calling_frame
328 && m_fun == other.m_fun);
329 }
330
331 void mark_deleted () { m_fun = reinterpret_cast<function *> (1); }
332 void mark_empty () { m_fun = NULL; }
333 bool is_deleted () const
334 {
335 return m_fun == reinterpret_cast<function *> (1);
336 }
337 bool is_empty () const { return m_fun == NULL; }
338
341 };
342
343 frame_region (symbol::id_t id, const region *parent,
345 const function &fun, int index)
347 m_fun (fun), m_index (index)
348 {}
350
351 /* region vfuncs. */
352 enum region_kind get_kind () const final override { return RK_FRAME; }
354 {
355 return this;
356 }
357 void accept (visitor *v) const final override;
358 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
359
360 /* Accessors. */
362 const function &get_function () const { return m_fun; }
363 tree get_fndecl () const { return get_function ().decl; }
364 int get_index () const { return m_index; }
365 int get_stack_depth () const { return m_index + 1; }
366
367 const decl_region *
369 tree expr,
370 const region_model_context *ctxt) const;
371
372 unsigned get_num_locals () const { return m_locals.elements (); }
373
374 /* Implemented in region-model-manager.cc. */
376
377 private:
381
382 /* The regions for the decls within this frame are managed by this
383 object, rather than the region_model_manager, to make it a simple
384 lookup by tree. */
387};
388
389} // namespace ana
390
391template <>
392template <>
393inline bool
395{
396 return reg->get_kind () == RK_FRAME;
397}
398
399template <> struct default_hash_traits<frame_region::key_t>
400: public member_function_hash_traits<frame_region::key_t>
401{
402 static const bool empty_zero_p = true;
403};
404
405namespace ana {
406
407/* Concrete space_region subclass, to hold global variables (data and bss). */
408
410{
411 public:
413 : space_region (id, parent)
414 {}
415
416 /* region vfuncs. */
417 enum region_kind get_kind () const final override { return RK_GLOBALS; }
418 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
419};
420
421} // namespace ana
422
423template <>
424template <>
425inline bool
427{
428 return reg->get_kind () == RK_GLOBALS;
429}
430
431namespace ana {
432
433/* Concrete space_region subclass, representing the code segment
434 containing functions. */
435
437{
438public:
439 code_region (symbol::id_t id, const region *parent)
440 : space_region (id, parent)
441 {}
442
443 /* region vfuncs. */
444 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
445 enum region_kind get_kind () const final override { return RK_CODE; }
446};
447
448} // namespace ana
449
450template <>
451template <>
452inline bool
454{
455 return reg->get_kind () == RK_CODE;
456}
457
458namespace ana {
459
460/* Concrete region subclass. A region representing the code for
461 a particular function. */
462
464{
465public:
466 function_region (symbol::id_t id, const code_region *parent, tree fndecl)
467 : region (complexity (parent), id, parent, TREE_TYPE (fndecl)),
468 m_fndecl (fndecl)
469 {
471 }
472
473 /* region vfuncs. */
474 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
475 enum region_kind get_kind () const final override { return RK_FUNCTION; }
476 const function_region *
477 dyn_cast_function_region () const final override{ return this; }
478
479 tree get_fndecl () const { return m_fndecl; }
480
481private:
483};
484
485} // namespace ana
486
487template <>
488template <>
489inline bool
491{
492 return reg->get_kind () == RK_FUNCTION;
493}
494
495namespace ana {
496
497/* Concrete region subclass. A region representing a particular label
498 within a function. */
499
500class label_region : public region
501{
502public:
504 : region (complexity (parent), id, parent, NULL_TREE), m_label (label)
505 {
506 gcc_assert (TREE_CODE (label) == LABEL_DECL);
507 }
508
509 /* region vfuncs. */
510 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
511 enum region_kind get_kind () const final override { return RK_LABEL; }
512
513 tree get_label () const { return m_label; }
514
515private:
517};
518
519} // namespace ana
520
521template <>
522template <>
523inline bool
525{
526 return reg->get_kind () == RK_LABEL;
527}
528
529namespace ana {
530
531/* Concrete space_region subclass representing a stack, containing all stack
532 frames. */
533
535{
536public:
538 : space_region (id, parent)
539 {}
540
541 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
542
543 enum region_kind get_kind () const final override { return RK_STACK; }
544};
545
546} // namespace ana
547
548template <>
549template <>
550inline bool
552{
553 return reg->get_kind () == RK_STACK;
554}
555
556namespace ana {
557
558/* Concrete space_region subclass: a region within which regions can be
559 dynamically allocated. */
560
562{
563public:
565 : space_region (id, parent)
566 {}
567
568 enum region_kind get_kind () const final override { return RK_HEAP; }
569 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
570};
571
572} // namespace ana
573
574template <>
575template <>
576inline bool
578{
579 return reg->get_kind () == RK_HEAP;
580}
581
582namespace ana {
583
584/* Concrete space_region subclass: thread-local data for the thread
585 being analyzed. */
586
588{
589public:
591 : space_region (id, parent)
592 {}
593
594 enum region_kind get_kind () const final override { return RK_THREAD_LOCAL; }
595 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
596};
597
598} // namespace ana
599
600template <>
601template <>
602inline bool
604{
605 return reg->get_kind () == RK_THREAD_LOCAL;
606}
607
608namespace ana {
609
610/* Concrete region subclass. The root region, containing all regions
611 (either directly, or as descendents).
612 Unique within a region_model_manager. */
613
614class root_region : public region
615{
616public:
618
619 enum region_kind get_kind () const final override { return RK_ROOT; }
620 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
621};
622
623} // namespace ana
624
625template <>
626template <>
627inline bool
629{
630 return reg->get_kind () == RK_ROOT;
631}
632
633namespace ana {
634
635/* Concrete region subclass: a region to use when dereferencing an unknown
636 pointer. */
637
639{
640public:
641 /* A support class for uniquifying instances of symbolic_region. */
642 struct key_t
643 {
644 key_t (const region *parent, const svalue *sval_ptr)
645 : m_parent (parent), m_sval_ptr (sval_ptr)
646 {
648 }
649
651 {
653 hstate.add_ptr (m_parent);
654 hstate.add_ptr (m_sval_ptr);
655 return hstate.end ();
656 }
657
658 bool operator== (const key_t &other) const
659 {
660 return (m_parent == other.m_parent && m_sval_ptr == other.m_sval_ptr);
661 }
662
663 void mark_deleted () { m_sval_ptr = reinterpret_cast<const svalue *> (1); }
665 bool is_deleted () const
666 {
667 return m_sval_ptr == reinterpret_cast<const svalue *> (1);
668 }
669 bool is_empty () const { return m_sval_ptr == NULL; }
670
673 };
674
676
677 const symbolic_region *
678 dyn_cast_symbolic_region () const final override { return this; }
679
680 enum region_kind get_kind () const final override { return RK_SYMBOLIC; }
681 void accept (visitor *v) const final override;
682 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
683
684 const svalue *get_pointer () const { return m_sval_ptr; }
685
686private:
688};
689
690} // namespace ana
691
692template <>
693template <>
694inline bool
696{
697 return reg->get_kind () == RK_SYMBOLIC;
698}
699
700template <> struct default_hash_traits<symbolic_region::key_t>
701: public member_function_hash_traits<symbolic_region::key_t>
702{
703 static const bool empty_zero_p = true;
704};
705
706namespace ana {
707
708/* Concrete region subclass representing the memory occupied by a
709 variable (whether for a global or a local).
710 Also used for representing SSA names, as if they were locals. */
711
712class decl_region : public region
713{
714public:
716 : region (complexity (parent), id, parent, TREE_TYPE (decl)), m_decl (decl),
719 {}
720
721 enum region_kind get_kind () const final override { return RK_DECL; }
722 const decl_region *
723 dyn_cast_decl_region () const final override { return this; }
724
725 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
726
727 bool tracked_p () const final override { return m_tracked; }
728
729 tree get_decl () const { return m_decl; }
730 int get_stack_depth () const;
731
736
737private:
740 static bool calc_tracked_p (tree decl);
741
743
744 /* Cached result of calc_tracked_p, so that we can quickly determine when
745 we don't to track a binding_cluster for this decl (to avoid bloating
746 store objects).
747 This can be debugged using -fdump-analyzer-untracked. */
749
750 /* Cached result of get_svalue_for_constructor. */
751 mutable const svalue *m_ctor_svalue;
752};
753
754} // namespace ana
755
756template <>
757template <>
758inline bool
760{
761 return reg->get_kind () == RK_DECL;
762}
763
764namespace ana {
765
766/* Concrete region subclass representing the memory occupied by a
767 field within a struct or union. */
768
769class field_region : public region
770{
771public:
772 /* A support class for uniquifying instances of field_region. */
773 struct key_t
774 {
775 key_t (const region *parent, tree field)
776 : m_parent (parent), m_field (field)
777 {
778 gcc_assert (field);
779 }
780
782 {
784 hstate.add_ptr (m_parent);
785 hstate.add_ptr (m_field);
786 return hstate.end ();
787 }
788
789 bool operator== (const key_t &other) const
790 {
791 return (m_parent == other.m_parent && m_field == other.m_field);
792 }
793
794 void mark_deleted () { m_field = reinterpret_cast<tree> (1); }
796 bool is_deleted () const { return m_field == reinterpret_cast<tree> (1); }
797 bool is_empty () const { return m_field == NULL_TREE; }
798
801 };
802
803 field_region (symbol::id_t id, const region *parent, tree field)
804 : region (complexity (parent), id, parent, TREE_TYPE (field)),
805 m_field (field)
806 {}
807
808 enum region_kind get_kind () const final override { return RK_FIELD; }
809
810 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
811 const field_region *
812 dyn_cast_field_region () const final override { return this; }
813
814 tree get_field () const { return m_field; }
815
816 bool get_relative_concrete_offset (bit_offset_t *out) const final override;
818 const final override;
819
820private:
822};
823
824} // namespace ana
825
826template <>
827template <>
828inline bool
830{
831 return reg->get_kind () == RK_FIELD;
832}
833
834template <> struct default_hash_traits<field_region::key_t>
835: public member_function_hash_traits<field_region::key_t>
836{
837 static const bool empty_zero_p = true;
838};
839
840namespace ana {
841
842/* An element within an array. */
843
844class element_region : public region
845{
846public:
847 /* A support class for uniquifying instances of element_region. */
848 struct key_t
849 {
850 key_t (const region *parent, tree element_type, const svalue *index)
851 : m_parent (parent), m_element_type (element_type), m_index (index)
852 {
853 gcc_assert (index);
854 }
855
857 {
859 hstate.add_ptr (m_parent);
860 hstate.add_ptr (m_element_type);
861 hstate.add_ptr (m_index);
862 return hstate.end ();
863 }
864
865 bool operator== (const key_t &other) const
866 {
867 return (m_parent == other.m_parent
869 && m_index == other.m_index);
870 }
871
872 void mark_deleted () { m_index = reinterpret_cast<const svalue *> (1); }
873 void mark_empty () { m_index = NULL; }
874 bool is_deleted () const
875 {
876 return m_index == reinterpret_cast<const svalue *> (1);
877 }
878 bool is_empty () const { return m_index == NULL; }
879
883 };
884
885 element_region (symbol::id_t id, const region *parent, tree element_type,
886 const svalue *index)
887 : region (complexity::from_pair (parent, index), id, parent, element_type),
888 m_index (index)
889 {}
890
891 enum region_kind get_kind () const final override { return RK_ELEMENT; }
892 const element_region *
893 dyn_cast_element_region () const final override { return this; }
894
895 void accept (visitor *v) const final override;
896
897 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
898
899 const svalue *get_index () const { return m_index; }
900
901 virtual bool
902 get_relative_concrete_offset (bit_offset_t *out) const final override;
904 const final override;
905
906private:
908};
909
910} // namespace ana
911
912template <>
913template <>
914inline bool
916{
917 return reg->get_kind () == RK_ELEMENT;
918}
919
920template <> struct default_hash_traits<element_region::key_t>
921: public member_function_hash_traits<element_region::key_t>
922{
923 static const bool empty_zero_p = true;
924};
925
926namespace ana {
927
928/* A byte-offset within another region, for handling pointer arithmetic
929 as a region. */
930
931class offset_region : public region
932{
933public:
934 /* A support class for uniquifying instances of offset_region. */
935 struct key_t
936 {
937 key_t (const region *parent, tree element_type, const svalue *byte_offset)
938 : m_parent (parent), m_element_type (element_type), m_byte_offset (byte_offset)
939 {
941 }
942
944 {
946 hstate.add_ptr (m_parent);
947 hstate.add_ptr (m_element_type);
948 hstate.add_ptr (m_byte_offset);
949 return hstate.end ();
950 }
951
952 bool operator== (const key_t &other) const
953 {
954 return (m_parent == other.m_parent
956 && m_byte_offset == other.m_byte_offset);
957 }
958
959 void mark_deleted () { m_byte_offset = reinterpret_cast<const svalue *> (1); }
961 bool is_deleted () const
962 {
963 return m_byte_offset == reinterpret_cast<const svalue *> (1);
964 }
965 bool is_empty () const { return m_byte_offset == NULL; }
966
970 };
971
973 const svalue *byte_offset)
974 : region (complexity::from_pair (parent, byte_offset), id, parent, type),
976 {}
977
978 enum region_kind get_kind () const final override { return RK_OFFSET; }
979 const offset_region *
980 dyn_cast_offset_region () const final override { return this; }
981
982 void accept (visitor *v) const final override;
983
984 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
985
986 const svalue *get_byte_offset () const { return m_byte_offset; }
988
989 bool get_relative_concrete_offset (bit_offset_t *out) const final override;
991 const final override;
992
993private:
995};
996
997} // namespace ana
998
999template <>
1000template <>
1001inline bool
1003{
1004 return reg->get_kind () == RK_OFFSET;
1005}
1006
1007template <> struct default_hash_traits<offset_region::key_t>
1008: public member_function_hash_traits<offset_region::key_t>
1009{
1010 static const bool empty_zero_p = true;
1011};
1012
1013namespace ana {
1014
1015/* A region that is size BYTES_SIZE_SVAL in size within its parent
1016 region (or possibly larger, which would lead to an overflow. */
1017
1018class sized_region : public region
1019{
1020public:
1021 /* A support class for uniquifying instances of sized_region. */
1022 struct key_t
1023 {
1024 key_t (const region *parent, tree element_type,
1025 const svalue *byte_size_sval)
1026 : m_parent (parent), m_element_type (element_type),
1028 {
1030 }
1031
1033 {
1035 hstate.add_ptr (m_parent);
1036 hstate.add_ptr (m_element_type);
1037 hstate.add_ptr (m_byte_size_sval);
1038 return hstate.end ();
1039 }
1040
1041 bool operator== (const key_t &other) const
1042 {
1043 return (m_parent == other.m_parent
1044 && m_element_type == other.m_element_type
1046 }
1047
1048 void mark_deleted () { m_byte_size_sval = reinterpret_cast<const svalue *> (1); }
1050 bool is_deleted () const
1051 {
1052 return m_byte_size_sval == reinterpret_cast<const svalue *> (1);
1053 }
1054 bool is_empty () const { return m_byte_size_sval == NULL; }
1055
1060 };
1061
1063 const svalue *byte_size_sval)
1064 : region (complexity::from_pair (parent, byte_size_sval),
1065 id, parent, type),
1067 {}
1068
1069 enum region_kind get_kind () const final override { return RK_SIZED; }
1070 const sized_region *
1071 dyn_cast_sized_region () const final override { return this; }
1072
1073 void accept (visitor *v) const final override;
1074
1075 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1076
1077 bool get_byte_size (byte_size_t *out) const final override;
1078 bool get_bit_size (bit_size_t *out) const final override;
1079
1080 const svalue *
1082 {
1083 return m_byte_size_sval;
1084 }
1085
1086 const svalue *
1087 get_bit_size_sval (region_model_manager *) const final override;
1088
1089private:
1091};
1092
1093} // namespace ana
1094
1095template <>
1096template <>
1097inline bool
1099{
1100 return reg->get_kind () == RK_SIZED;
1101}
1102
1103template <> struct default_hash_traits<sized_region::key_t>
1104: public member_function_hash_traits<sized_region::key_t>
1105{
1106 static const bool empty_zero_p = true;
1107};
1108
1109namespace ana {
1110
1111/* A region that views another region using a different type. */
1112
1113class cast_region : public region
1114{
1115public:
1116 /* A support class for uniquifying instances of cast_region. */
1117 struct key_t
1118 {
1124
1126 {
1128 hstate.add_ptr (m_original_region);
1129 hstate.add_ptr (m_type);
1130 return hstate.end ();
1131 }
1132
1133 bool operator== (const key_t &other) const
1134 {
1135 return (m_original_region == other.m_original_region
1136 && m_type == other.m_type);
1137 }
1138
1140 {
1141 m_original_region = reinterpret_cast<const region *> (1);
1142 }
1143 void mark_empty () { m_original_region = nullptr; }
1144 bool is_deleted () const
1145 {
1146 return m_original_region == reinterpret_cast<const region *> (1);
1147 }
1148 bool is_empty () const { return m_original_region == nullptr; }
1149
1152 };
1153
1159
1160 enum region_kind get_kind () const final override { return RK_CAST; }
1161 const cast_region *
1162 dyn_cast_cast_region () const final override { return this; }
1163 void accept (visitor *v) const final override;
1164 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1165
1166 bool get_relative_concrete_offset (bit_offset_t *out) const final override;
1167
1169
1170private:
1172};
1173
1174} // namespace ana
1175
1176template <>
1177template <>
1178inline bool
1180{
1181 return reg->get_kind () == RK_CAST;
1182}
1183
1184template <> struct default_hash_traits<cast_region::key_t>
1185: public member_function_hash_traits<cast_region::key_t>
1186{
1187 static const bool empty_zero_p = true;
1188};
1189
1190namespace ana {
1191
1192/* An untyped region dynamically allocated on the heap via "malloc"
1193 or similar. */
1194
1196{
1197public:
1199 : region (complexity (parent), id, parent, NULL_TREE)
1200 {}
1201
1202 enum region_kind
1203 get_kind () const final override { return RK_HEAP_ALLOCATED; }
1204
1205 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1206};
1207
1208/* An untyped region dynamically allocated on the stack via "alloca". */
1209
1210class alloca_region : public region
1211{
1212public:
1214 : region (complexity (parent), id, parent, NULL_TREE)
1215 {}
1216
1217 enum region_kind get_kind () const final override { return RK_ALLOCA; }
1218
1219 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1220};
1221
1222/* A region for a STRING_CST. */
1223
1224class string_region : public region
1225{
1226public:
1228 : region (complexity (parent), id, parent, TREE_TYPE (string_cst)),
1230 {}
1231
1232 const string_region *
1233 dyn_cast_string_region () const final override { return this; }
1234
1235 enum region_kind get_kind () const final override { return RK_STRING; }
1236
1237 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1238
1239 /* We assume string literals are immutable, so we don't track them in
1240 the store. */
1241 bool tracked_p () const final override { return false; }
1242
1243 tree get_string_cst () const { return m_string_cst; }
1244
1245private:
1247};
1248
1249} // namespace ana
1250
1251template <>
1252template <>
1253inline bool
1255{
1256 return reg->get_kind () == RK_STRING;
1257}
1258
1259namespace ana {
1260
1261/* A region for a specific range of bits within another region. */
1262
1264{
1265public:
1266 /* A support class for uniquifying instances of bit_range_region. */
1267 struct key_t
1268 {
1269 key_t (const region *parent, tree type, const bit_range &bits)
1270 : m_parent (parent), m_type (type), m_bits (bits)
1271 {
1272 gcc_assert (parent);
1273 }
1274
1276 {
1278 hstate.add_ptr (m_parent);
1279 hstate.add_ptr (m_type);
1280 hstate.add_wide_int (m_bits.m_start_bit_offset);
1281 hstate.add_wide_int (m_bits.m_size_in_bits);
1282 return hstate.end ();
1283 }
1284
1285 bool operator== (const key_t &other) const
1286 {
1287 return (m_parent == other.m_parent
1288 && m_type == other.m_type
1289 && m_bits == other.m_bits);
1290 }
1291
1292 void mark_deleted () { m_parent = reinterpret_cast<const region *> (1); }
1293 void mark_empty () { m_parent = NULL; }
1294 bool is_deleted () const
1295 {
1296 return m_parent == reinterpret_cast<const region *> (1);
1297 }
1298 bool is_empty () const { return m_parent == NULL; }
1299
1303 };
1304
1306 const bit_range &bits)
1307 : region (complexity (parent), id, parent, type),
1308 m_bits (bits)
1309 {}
1310
1311 const bit_range_region *
1312 dyn_cast_bit_range_region () const final override { return this; }
1313
1314 enum region_kind get_kind () const final override { return RK_BIT_RANGE; }
1315
1316 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1317
1318 const bit_range &get_bits () const { return m_bits; }
1319
1320 bool get_byte_size (byte_size_t *out) const final override;
1321 bool get_bit_size (bit_size_t *out) const final override;
1322 const svalue *get_byte_size_sval (region_model_manager *mgr) const final override;
1323 const svalue *get_bit_size_sval (region_model_manager *mgr) const final override;
1324 bool get_relative_concrete_offset (bit_offset_t *out) const final override;
1326 const final override;
1327
1328private:
1330};
1331
1332} // namespace ana
1333
1334template <>
1335template <>
1336inline bool
1338{
1339 return reg->get_kind () == RK_BIT_RANGE;
1340}
1341
1342template <> struct default_hash_traits<bit_range_region::key_t>
1343: public member_function_hash_traits<bit_range_region::key_t>
1344{
1345 static const bool empty_zero_p = true;
1346};
1347
1348namespace ana {
1349
1350/* A region for the N-th vararg within a frame_region for a variadic call. */
1351
1353{
1354public:
1355 /* A support class for uniquifying instances of var_arg_region. */
1356 struct key_t
1357 {
1358 key_t (const frame_region *parent, unsigned idx)
1359 : m_parent (parent), m_idx (idx)
1360 {
1361 gcc_assert (parent);
1362 }
1363
1365 {
1367 hstate.add_ptr (m_parent);
1368 hstate.add_int (m_idx);
1369 return hstate.end ();
1370 }
1371
1372 bool operator== (const key_t &other) const
1373 {
1374 return (m_parent == other.m_parent
1375 && m_idx == other.m_idx);
1376 }
1377
1379 {
1380 m_parent = reinterpret_cast<const frame_region *> (1);
1381 }
1382 void mark_empty () { m_parent = NULL; }
1383 bool is_deleted () const
1384 {
1385 return m_parent == reinterpret_cast<const frame_region *> (1);
1386 }
1387 bool is_empty () const { return m_parent == NULL; }
1388
1390 unsigned m_idx;
1391 };
1392
1394 unsigned idx)
1395 : region (complexity (parent), id, parent, NULL_TREE),
1396 m_idx (idx)
1397 {}
1398
1399 const var_arg_region *
1400 dyn_cast_var_arg_region () const final override { return this; }
1401
1402 enum region_kind get_kind () const final override { return RK_VAR_ARG; }
1403
1404 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1405
1407 unsigned get_index () const { return m_idx; }
1408
1409private:
1410 unsigned m_idx;
1411};
1412
1413} // namespace ana
1414
1415template <>
1416template <>
1417inline bool
1419{
1420 return reg->get_kind () == RK_VAR_ARG;
1421}
1422
1423template <> struct default_hash_traits<var_arg_region::key_t>
1424: public member_function_hash_traits<var_arg_region::key_t>
1425{
1426 static const bool empty_zero_p = true;
1427};
1428
1429namespace ana {
1430
1431/* A region for errno for the current thread. */
1432
1433class errno_region : public region
1434{
1435public:
1437 : region (complexity (parent), id, parent, integer_type_node)
1438 {}
1439
1440 enum region_kind get_kind () const final override { return RK_ERRNO; }
1441
1442 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1443};
1444
1445} // namespace ana
1446
1447template <>
1448template <>
1449inline bool
1451{
1452 return reg->get_kind () == RK_ERRNO;
1453}
1454
1455namespace ana {
1456
1457/* Similar to a decl region, but we don't have the decl.
1458 For implementing e.g. static buffers of known_functions,
1459 or other internal state of an API.
1460
1461 These are owned by known_function instances, rather than the
1462 region_model_manager. */
1463
1465{
1466public:
1467 private_region (unsigned id, const region *parent, tree type,
1468 const char *desc)
1469 : region (complexity (parent), id, parent, type),
1470 m_desc (desc)
1471 {}
1472
1473 enum region_kind get_kind () const final override { return RK_PRIVATE; }
1474
1475 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1476
1477private:
1478 const char *m_desc;
1479};
1480
1481} // namespace ana
1482
1483template <>
1484template <>
1485inline bool
1487{
1488 return reg->get_kind () == RK_PRIVATE;
1489}
1490
1491namespace ana {
1492
1493/* An unknown region, for handling unimplemented tree codes. */
1494
1496{
1497public:
1499 : region (complexity (parent), id, parent, type)
1500 {}
1501
1502 enum region_kind get_kind () const final override { return RK_UNKNOWN; }
1503
1504 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1505};
1506
1507} // namespace ana
1508
1509#endif /* GCC_ANALYZER_REGION_H */
Definition region.h:1211
alloca_region(symbol::id_t id, const frame_region *parent)
Definition region.h:1213
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum region_kind get_kind() const final override
Definition region.h:1217
Definition region.h:1264
bool get_relative_concrete_offset(bit_offset_t *out) const final override
bit_range_region(symbol::id_t id, const region *parent, tree type, const bit_range &bits)
Definition region.h:1305
enum region_kind get_kind() const final override
Definition region.h:1314
bool get_byte_size(byte_size_t *out) const final override
const svalue * get_bit_size_sval(region_model_manager *mgr) const final override
const bit_range_region * dyn_cast_bit_range_region() const final override
Definition region.h:1312
bool get_bit_size(bit_size_t *out) const final override
bit_range m_bits
Definition region.h:1329
const svalue * get_byte_size_sval(region_model_manager *mgr) const final override
const svalue * get_relative_symbolic_offset(region_model_manager *mgr) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const bit_range & get_bits() const
Definition region.h:1318
Definition region.h:1114
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const region * m_original_region
Definition region.h:1171
const cast_region * dyn_cast_cast_region() const final override
Definition region.h:1162
enum region_kind get_kind() const final override
Definition region.h:1160
cast_region(symbol::id_t id, const region *original_region, tree type)
Definition region.h:1154
const region * get_original_region() const
Definition region.h:1168
bool get_relative_concrete_offset(bit_offset_t *out) const final override
void accept(visitor *v) const final override
Definition region.h:437
code_region(symbol::id_t id, const region *parent)
Definition region.h:439
enum region_kind get_kind() const final override
Definition region.h:445
void dump_to_pp(pretty_printer *pp, bool simple) const final override
Definition region.h:713
const decl_region * dyn_cast_decl_region() const final override
Definition region.h:723
const svalue * get_svalue_for_initializer(region_model_manager *mgr) const
const svalue * get_svalue_for_constructor(tree ctor, region_model_manager *mgr) const
decl_region(symbol::id_t id, const region *parent, tree decl)
Definition region.h:715
tree m_decl
Definition region.h:742
static bool calc_tracked_p(tree decl)
const svalue * maybe_get_constant_value(region_model_manager *mgr) const
const svalue * calc_svalue_for_constructor(tree ctor, region_model_manager *mgr) const
bool m_tracked
Definition region.h:748
enum region_kind get_kind() const final override
Definition region.h:721
int get_stack_depth() const
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const svalue * m_ctor_svalue
Definition region.h:751
bool tracked_p() const final override
Definition region.h:727
tree get_decl() const
Definition region.h:729
Definition region.h:845
const svalue * m_index
Definition region.h:907
const element_region * dyn_cast_element_region() const final override
Definition region.h:893
element_region(symbol::id_t id, const region *parent, tree element_type, const svalue *index)
Definition region.h:885
void accept(visitor *v) const final override
const svalue * get_index() const
Definition region.h:899
void dump_to_pp(pretty_printer *pp, bool simple) const final override
virtual bool get_relative_concrete_offset(bit_offset_t *out) const final override
const svalue * get_relative_symbolic_offset(region_model_manager *mgr) const final override
enum region_kind get_kind() const final override
Definition region.h:891
Definition region.h:1434
enum region_kind get_kind() const final override
Definition region.h:1440
errno_region(symbol::id_t id, const thread_local_region *parent)
Definition region.h:1436
void dump_to_pp(pretty_printer *pp, bool simple) const final override
Definition region.h:770
tree get_field() const
Definition region.h:814
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum region_kind get_kind() const final override
Definition region.h:808
tree m_field
Definition region.h:821
const svalue * get_relative_symbolic_offset(region_model_manager *mgr) const final override
bool get_relative_concrete_offset(bit_offset_t *out) const final override
const field_region * dyn_cast_field_region() const final override
Definition region.h:812
field_region(symbol::id_t id, const region *parent, tree field)
Definition region.h:803
Definition region.h:306
int get_index() const
Definition region.h:364
void accept(visitor *v) const final override
const function & m_fun
Definition region.h:379
unsigned get_num_locals() const
Definition region.h:372
enum region_kind get_kind() const final override
Definition region.h:352
const frame_region * m_calling_frame
Definition region.h:378
const decl_region * get_region_for_local(region_model_manager *mgr, tree expr, const region_model_context *ctxt) const
const frame_region * dyn_cast_frame_region() const final override
Definition region.h:353
const frame_region * get_calling_frame() const
Definition region.h:361
map_t m_locals
Definition region.h:386
void dump_untracked_regions() const
tree get_fndecl() const
Definition region.h:363
const function & get_function() const
Definition region.h:362
void dump_to_pp(pretty_printer *pp, bool simple) const final override
frame_region(symbol::id_t id, const region *parent, const frame_region *calling_frame, const function &fun, int index)
Definition region.h:343
hash_map< tree, decl_region * > map_t
Definition region.h:385
int m_index
Definition region.h:380
int get_stack_depth() const
Definition region.h:365
Definition region.h:464
function_region(symbol::id_t id, const code_region *parent, tree fndecl)
Definition region.h:466
tree m_fndecl
Definition region.h:482
const function_region * dyn_cast_function_region() const final override
Definition region.h:477
enum region_kind get_kind() const final override
Definition region.h:475
tree get_fndecl() const
Definition region.h:479
void dump_to_pp(pretty_printer *pp, bool simple) const final override
Definition region.h:410
enum region_kind get_kind() const final override
Definition region.h:417
void dump_to_pp(pretty_printer *pp, bool simple) const final override
globals_region(symbol::id_t id, const region *parent)
Definition region.h:412
Definition region.h:1196
enum region_kind get_kind() const final override
Definition region.h:1203
heap_allocated_region(symbol::id_t id, const region *parent)
Definition region.h:1198
void dump_to_pp(pretty_printer *pp, bool simple) const final override
Definition region.h:562
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum region_kind get_kind() const final override
Definition region.h:568
heap_region(symbol::id_t id, region *parent)
Definition region.h:564
Definition region.h:501
label_region(symbol::id_t id, const function_region *parent, tree label)
Definition region.h:503
tree get_label() const
Definition region.h:513
void dump_to_pp(pretty_printer *pp, bool simple) const final override
tree m_label
Definition region.h:516
enum region_kind get_kind() const final override
Definition region.h:511
Definition region.h:932
bool get_relative_concrete_offset(bit_offset_t *out) const final override
enum region_kind get_kind() const final override
Definition region.h:978
const svalue * get_relative_symbolic_offset(region_model_manager *mgr) const final override
const svalue * get_byte_offset() const
Definition region.h:986
void dump_to_pp(pretty_printer *pp, bool simple) const final override
void accept(visitor *v) const final override
const svalue * get_bit_offset(region_model_manager *mgr) const
const svalue * m_byte_offset
Definition region.h:994
const offset_region * dyn_cast_offset_region() const final override
Definition region.h:980
offset_region(symbol::id_t id, const region *parent, tree type, const svalue *byte_offset)
Definition region.h:972
Definition region.h:1465
enum region_kind get_kind() const final override
Definition region.h:1473
void dump_to_pp(pretty_printer *pp, bool simple) const final override
private_region(unsigned id, const region *parent, tree type, const char *desc)
Definition region.h:1467
const char * m_desc
Definition region.h:1478
Definition region-model.h:702
Definition region-model-manager.h:32
Definition region-model.h:258
Definition analyzer.h:192
Definition region.h:125
virtual const var_arg_region * dyn_cast_var_arg_region() const
Definition region.h:153
bool maybe_print_for_user(pretty_printer *pp, const region_model &model) const
bool is_named_decl_p(const char *decl_name) const
bool symbolic_for_unknown_ptr_p() const
region_offset calc_offset(region_model_manager *mgr) const
void get_subregions_for_binding(region_model_manager *mgr, bit_offset_t start_bit_offset, bit_size_t size_in_bits, tree type, auto_vec< const region * > *out) const
bool involves_p(const svalue *sval) const
json::value * to_json() const
virtual const offset_region * dyn_cast_offset_region() const
Definition region.h:143
virtual const frame_region * dyn_cast_frame_region() const
Definition region.h:131
virtual const string_region * dyn_cast_string_region() const
Definition region.h:149
bool non_null_p() const
virtual const symbolic_region * dyn_cast_symbolic_region() const
Definition region.h:135
const frame_region * maybe_get_frame_region() const
bool can_have_initial_svalue_p() const
virtual const sized_region * dyn_cast_sized_region() const
Definition region.h:145
const region * get_base_region() const
static int cmp_ptr_ptr(const void *, const void *)
bool descendent_of_p(const region *elder) const
tree get_type() const
Definition region.h:168
virtual bool tracked_p() const
Definition region.h:247
virtual ~region()
const region * m_parent
Definition region.h:260
const svalue * calc_initial_value_at_main(region_model_manager *mgr) const
virtual bool get_relative_concrete_offset(bit_offset_t *out) const
const region * get_parent_region() const
Definition region.h:157
virtual const svalue * get_byte_size_sval(region_model_manager *mgr) const
region_offset get_offset(region_model_manager *mgr) const
bool base_region_p() const
virtual const element_region * dyn_cast_element_region() const
Definition region.h:141
virtual const field_region * dyn_cast_field_region() const
Definition region.h:139
virtual bool get_byte_size(byte_size_t *out) const
enum memory_space get_memory_space() const
void print(const region_model &model, pretty_printer *pp) const
virtual const svalue * get_relative_symbolic_offset(region_model_manager *mgr) const
region(complexity c, symbol::id_t id, const region *parent, tree type)
virtual enum region_kind get_kind() const =0
const svalue * get_initial_value_at_main(region_model_manager *mgr) const
label_text get_desc(bool simple=true) const
tree maybe_get_decl() const
bool empty_p() const
virtual const decl_region * dyn_cast_decl_region() const
Definition region.h:137
virtual void accept(visitor *v) const
const svalue * m_cached_init_sval_at_main
Definition region.h:267
virtual const function_region * dyn_cast_function_region() const
Definition region.h:133
virtual const svalue * get_bit_size_sval(region_model_manager *mgr) const
bool symbolic_p() const
region_offset * m_cached_offset
Definition region.h:263
tree m_type
Definition region.h:261
virtual void dump_to_pp(pretty_printer *pp, bool simple) const =0
virtual bool get_bit_size(bit_size_t *out) const
virtual const bit_range_region * dyn_cast_bit_range_region() const
Definition region.h:151
virtual const cast_region * dyn_cast_cast_region() const
Definition region.h:147
void dump(bool simple) const
region_offset get_next_offset(region_model_manager *mgr) const
bool get_relative_concrete_byte_range(byte_range *out) const
Definition region.h:615
enum region_kind get_kind() const final override
Definition region.h:619
void dump_to_pp(pretty_printer *pp, bool simple) const final override
root_region(symbol::id_t id)
Definition region.h:1019
const svalue * m_byte_size_sval
Definition region.h:1090
bool get_bit_size(bit_size_t *out) const final override
bool get_byte_size(byte_size_t *out) const final override
const sized_region * dyn_cast_sized_region() const final override
Definition region.h:1071
const svalue * get_byte_size_sval(region_model_manager *) const final override
Definition region.h:1081
enum region_kind get_kind() const final override
Definition region.h:1069
sized_region(symbol::id_t id, const region *parent, tree type, const svalue *byte_size_sval)
Definition region.h:1062
const svalue * get_bit_size_sval(region_model_manager *) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
void accept(visitor *v) const final override
Definition region.h:286
space_region(symbol::id_t id, const region *parent)
Definition region.h:288
Definition region.h:535
void dump_to_pp(pretty_printer *pp, bool simple) const final override
stack_region(symbol::id_t id, region *parent)
Definition region.h:537
enum region_kind get_kind() const final override
Definition region.h:543
Definition region.h:1225
const string_region * dyn_cast_string_region() const final override
Definition region.h:1233
bool tracked_p() const final override
Definition region.h:1241
tree get_string_cst() const
Definition region.h:1243
enum region_kind get_kind() const final override
Definition region.h:1235
void dump_to_pp(pretty_printer *pp, bool simple) const final override
tree m_string_cst
Definition region.h:1246
string_region(symbol::id_t id, const region *parent, tree string_cst)
Definition region.h:1227
Definition svalue.h:90
virtual enum svalue_kind get_kind() const =0
Definition symbol.h:31
unsigned id_t
Definition symbol.h:33
Definition region.h:639
void dump_to_pp(pretty_printer *pp, bool simple) const final override
symbolic_region(symbol::id_t id, region *parent, const svalue *sval_ptr)
const svalue * get_pointer() const
Definition region.h:684
const symbolic_region * dyn_cast_symbolic_region() const final override
Definition region.h:678
enum region_kind get_kind() const final override
Definition region.h:680
const svalue * m_sval_ptr
Definition region.h:687
void accept(visitor *v) const final override
Definition region.h:588
void dump_to_pp(pretty_printer *pp, bool simple) const final override
thread_local_region(symbol::id_t id, region *parent)
Definition region.h:590
enum region_kind get_kind() const final override
Definition region.h:594
Definition region.h:1496
enum region_kind get_kind() const final override
Definition region.h:1502
void dump_to_pp(pretty_printer *pp, bool simple) const final override
unknown_region(symbol::id_t id, const region *parent, tree type)
Definition region.h:1498
Definition region.h:1353
unsigned m_idx
Definition region.h:1410
var_arg_region(symbol::id_t id, const frame_region *parent, unsigned idx)
Definition region.h:1393
const var_arg_region * dyn_cast_var_arg_region() const final override
Definition region.h:1400
const frame_region * get_frame_region() const
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum region_kind get_kind() const final override
Definition region.h:1402
unsigned get_index() const
Definition region.h:1407
Definition region-model.h:217
Definition genmatch.cc:845
Definition hash-map.h:40
size_t elements() const
Definition hash-map.h:247
Definition inchash.h:38
Definition json.h:79
Definition pretty-print.h:244
union tree_node * tree
Definition coretypes.h:97
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2002
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
Definition access-diagram.h:30
offset_int byte_size_t
Definition analyzer.h:182
offset_int bit_offset_t
Definition analyzer.h:179
offset_int bit_size_t
Definition analyzer.h:180
region_kind
Definition region.h:46
@ RK_UNKNOWN
Definition region.h:70
@ RK_STACK
Definition region.h:52
@ RK_PRIVATE
Definition region.h:69
@ RK_LABEL
Definition region.h:51
@ RK_CAST
Definition region.h:62
@ RK_FIELD
Definition region.h:58
@ RK_FRAME
Definition region.h:47
@ RK_DECL
Definition region.h:57
@ RK_ERRNO
Definition region.h:68
@ RK_ELEMENT
Definition region.h:59
@ RK_SYMBOLIC
Definition region.h:56
@ RK_BIT_RANGE
Definition region.h:66
@ RK_ALLOCA
Definition region.h:64
@ RK_SIZED
Definition region.h:61
@ RK_HEAP_ALLOCATED
Definition region.h:63
@ RK_THREAD_LOCAL
Definition region.h:54
@ RK_CODE
Definition region.h:49
@ RK_GLOBALS
Definition region.h:48
@ RK_OFFSET
Definition region.h:60
@ RK_ROOT
Definition region.h:55
@ RK_FUNCTION
Definition region.h:50
@ RK_HEAP
Definition region.h:53
@ RK_VAR_ARG
Definition region.h:67
@ RK_STRING
Definition region.h:65
memory_space
Definition region.h:31
@ MEMSPACE_GLOBALS
Definition region.h:34
@ MEMSPACE_READONLY_DATA
Definition region.h:37
@ MEMSPACE_HEAP
Definition region.h:36
@ MEMSPACE_PRIVATE
Definition region.h:39
@ MEMSPACE_THREAD_LOCAL
Definition region.h:38
@ MEMSPACE_STACK
Definition region.h:35
@ MEMSPACE_CODE
Definition region.h:33
@ MEMSPACE_UNKNOWN
Definition region.h:32
Definition region.h:1268
void mark_deleted()
Definition region.h:1292
bit_range m_bits
Definition region.h:1302
const region * m_parent
Definition region.h:1300
bool is_empty() const
Definition region.h:1298
hashval_t hash() const
Definition region.h:1275
bool is_deleted() const
Definition region.h:1294
key_t(const region *parent, tree type, const bit_range &bits)
Definition region.h:1269
void mark_empty()
Definition region.h:1293
tree m_type
Definition region.h:1301
bool operator==(const key_t &other) const
Definition region.h:1285
Definition store.h:231
bit_size_t m_size_in_bits
Definition store.h:301
bit_offset_t m_start_bit_offset
Definition store.h:300
Definition store.h:307
Definition region.h:1118
key_t(const region *original_region, tree type)
Definition region.h:1119
const region * m_original_region
Definition region.h:1150
void mark_empty()
Definition region.h:1143
bool is_deleted() const
Definition region.h:1144
tree m_type
Definition region.h:1151
bool operator==(const key_t &other) const
Definition region.h:1133
bool is_empty() const
Definition region.h:1148
hashval_t hash() const
Definition region.h:1125
void mark_deleted()
Definition region.h:1139
Definition complexity.h:31
Definition region.h:849
bool operator==(const key_t &other) const
Definition region.h:865
const svalue * m_index
Definition region.h:882
void mark_empty()
Definition region.h:873
bool is_deleted() const
Definition region.h:874
const region * m_parent
Definition region.h:880
key_t(const region *parent, tree element_type, const svalue *index)
Definition region.h:850
tree m_element_type
Definition region.h:881
bool is_empty() const
Definition region.h:878
void mark_deleted()
Definition region.h:872
hashval_t hash() const
Definition region.h:856
Definition region.h:774
void mark_deleted()
Definition region.h:794
hashval_t hash() const
Definition region.h:781
bool is_deleted() const
Definition region.h:796
const region * m_parent
Definition region.h:799
bool is_empty() const
Definition region.h:797
bool operator==(const key_t &other) const
Definition region.h:789
tree m_field
Definition region.h:800
key_t(const region *parent, tree field)
Definition region.h:775
void mark_empty()
Definition region.h:795
Definition region.h:310
key_t(const frame_region *calling_frame, const function &fun)
Definition region.h:311
bool is_empty() const
Definition region.h:337
bool is_deleted() const
Definition region.h:333
void mark_empty()
Definition region.h:332
bool operator==(const key_t &other) const
Definition region.h:325
void mark_deleted()
Definition region.h:331
hashval_t hash() const
Definition region.h:317
const frame_region * m_calling_frame
Definition region.h:339
const function * m_fun
Definition region.h:340
Definition region.h:936
key_t(const region *parent, tree element_type, const svalue *byte_offset)
Definition region.h:937
const region * m_parent
Definition region.h:967
bool is_empty() const
Definition region.h:965
bool operator==(const key_t &other) const
Definition region.h:952
hashval_t hash() const
Definition region.h:943
tree m_element_type
Definition region.h:968
bool is_deleted() const
Definition region.h:961
void mark_empty()
Definition region.h:960
const svalue * m_byte_offset
Definition region.h:969
void mark_deleted()
Definition region.h:959
Definition region.h:1023
const svalue * m_end_offset
Definition region.h:1059
key_t(const region *parent, tree element_type, const svalue *byte_size_sval)
Definition region.h:1024
const region * m_parent
Definition region.h:1056
void mark_deleted()
Definition region.h:1048
bool is_empty() const
Definition region.h:1054
bool operator==(const key_t &other) const
Definition region.h:1041
const svalue * m_byte_size_sval
Definition region.h:1058
tree m_element_type
Definition region.h:1057
hashval_t hash() const
Definition region.h:1032
void mark_empty()
Definition region.h:1049
bool is_deleted() const
Definition region.h:1050
Definition region.h:643
const svalue * m_sval_ptr
Definition region.h:672
bool is_empty() const
Definition region.h:669
const region * m_parent
Definition region.h:671
void mark_deleted()
Definition region.h:663
void mark_empty()
Definition region.h:664
hashval_t hash() const
Definition region.h:650
key_t(const region *parent, const svalue *sval_ptr)
Definition region.h:644
bool operator==(const key_t &other) const
Definition region.h:658
bool is_deleted() const
Definition region.h:665
Definition region.h:1357
bool is_deleted() const
Definition region.h:1383
const frame_region * m_parent
Definition region.h:1389
unsigned m_idx
Definition region.h:1390
bool operator==(const key_t &other) const
Definition region.h:1372
bool is_empty() const
Definition region.h:1387
void mark_empty()
Definition region.h:1382
void mark_deleted()
Definition region.h:1378
hashval_t hash() const
Definition region.h:1364
key_t(const frame_region *parent, unsigned idx)
Definition region.h:1358
Definition genautomata.cc:499
Definition hash-traits.h:466
Definition function.h:249
tree decl
Definition function.h:280
Definition collect2.cc:168
static bool test(U *p)
Definition analyzer.h:508
Definition gengtype.h:252
#define NULL
Definition system.h:50
#define gcc_assert(EXPR)
Definition system.h:821
#define TREE_CODE(NODE)
Definition tree.h:324
#define FUNC_OR_METHOD_TYPE_P(NODE)
Definition tree.h:721
#define TREE_TYPE(NODE)
Definition tree.h:512
#define NULL_TREE
Definition tree.h:317
#define integer_type_node
Definition tree.h:4636