GCC Middle and Back End API Reference
svalue.h
Go to the documentation of this file.
1/* Symbolic values.
2 Copyright (C) 2019-2026 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_SVALUE_H
22#define GCC_ANALYZER_SVALUE_H
23
24#include "analyzer/symbol.h"
25#include "analyzer/store.h"
27#include "text-art/widget.h"
28
29using namespace ana;
31
32namespace ana {
33
34/* An enum for discriminating between the different concrete subclasses
35 of svalue. */
36
58
59/* svalue and its subclasses.
60
61 The class hierarchy looks like this (using indentation to show
62 inheritance, and with svalue_kinds shown for the concrete subclasses):
63
64 svalue
65 region_svalue (SK_REGION): a pointer to a region
66 constant_svalue (SK_CONSTANT): a constant
67 unknown_svalue (SK_UNKNOWN): an unknowable value
68 poisoned_svalue (SK_POISONED): a unusable value (undefined)
69 setjmp_svalue (SK_SETJMP): a setjmp/longjmp buffer
70 initial_svalue (SK_INITIAL): the initial value of a region
71 unaryop_svalue (SK_UNARYOP): unary operation on another svalue
72 binop_svalue (SK_BINOP): binary operation on two svalues
73 sub_svalue (SK_SUB): the result of accessing a subregion
74 repeated_svalue (SK_REPEATED): repeating an svalue to fill a larger region
75 bits_within_svalue (SK_BITS_WITHIN): a range of bits/bytes within a larger
76 svalue
77 unmergeable_svalue (SK_UNMERGEABLE): a value that is so interesting
78 from a control-flow perspective that it can inhibit state-merging
79 placeholder_svalue (SK_PLACEHOLDER): for use in selftests.
80 widening_svalue (SK_WIDENING): a merger of two svalues (possibly
81 in an iteration).
82 compound_svalue (SK_COMPOUND): a mapping of bit-ranges to svalues
83 conjured_svalue (SK_CONJURED): a value arising from a stmt
84 asm_output_svalue (SK_ASM_OUTPUT): an output from a deterministic
85 asm stmt.
86 const_fn_result_svalue (SK_CONST_FN_RESULT): the return value from
87 a function with __attribute((const)) for given inputs. */
88
89/* An abstract base class representing a value held by a region of memory. */
90
91class svalue : public symbol
92{
93public:
94 virtual ~svalue () {}
95
96 tree get_type () const { return m_type; }
97
98 virtual enum svalue_kind get_kind () const = 0;
99
100 void print (const region_model &model,
101 pretty_printer *pp) const;
102
103 virtual void dump_to_pp (pretty_printer *pp, bool simple) const = 0;
104 void dump () const;
105 void dump (bool simple) const;
106 label_text get_desc (bool simple=true) const;
107
108 std::unique_ptr<json::value> to_json () const;
109
110 std::unique_ptr<text_art::tree_widget>
112 const char *prefix = nullptr) const;
113
114 virtual const region_svalue *
115 dyn_cast_region_svalue () const { return nullptr; }
116 virtual const constant_svalue *
117 dyn_cast_constant_svalue () const { return nullptr; }
118 virtual const poisoned_svalue *
119 dyn_cast_poisoned_svalue () const { return nullptr; }
120 virtual const setjmp_svalue *
121 dyn_cast_setjmp_svalue () const { return nullptr; }
122 virtual const initial_svalue *
123 dyn_cast_initial_svalue () const { return nullptr; }
124 virtual const unaryop_svalue *
125 dyn_cast_unaryop_svalue () const { return nullptr; }
126 virtual const binop_svalue *
127 dyn_cast_binop_svalue () const { return nullptr; }
128 virtual const sub_svalue *
129 dyn_cast_sub_svalue () const { return nullptr; }
130 virtual const repeated_svalue *
131 dyn_cast_repeated_svalue () const { return nullptr; }
132 virtual const bits_within_svalue *
133 dyn_cast_bits_within_svalue () const { return nullptr; }
134 virtual const unmergeable_svalue *
135 dyn_cast_unmergeable_svalue () const { return nullptr; }
136 virtual const widening_svalue *
137 dyn_cast_widening_svalue () const { return nullptr; }
138 virtual const compound_svalue *
139 dyn_cast_compound_svalue () const { return nullptr; }
140 virtual const conjured_svalue *
141 dyn_cast_conjured_svalue () const { return nullptr; }
142 virtual const asm_output_svalue *
143 dyn_cast_asm_output_svalue () const { return nullptr; }
144 virtual const const_fn_result_svalue *
145 dyn_cast_const_fn_result_svalue () const { return nullptr; }
146
148 const region *maybe_get_region () const;
149 const svalue *maybe_undo_cast () const;
151
152 const svalue *can_merge_p (const svalue *other,
154 model_merger *merger) const;
155
156 virtual void accept (visitor *v) const = 0;
157
158 bool live_p (const svalue_set *live_svalues,
159 const region_model *model) const;
160 virtual bool implicitly_live_p (const svalue_set *live_svalues,
161 const region_model *model) const;
162
163 static int cmp_ptr (const svalue *, const svalue *);
164 static int cmp_ptr_ptr (const void *, const void *);
165
166 bool involves_p (const svalue *other) const;
167
168 const svalue *
170 const bit_range &subrange,
171 region_model_manager *mgr) const;
172
173 virtual const svalue *
175 const bit_range &subrange,
176 region_model_manager *mgr) const;
177
178 virtual bool all_zeroes_p () const;
179
180 /* Can this svalue be involved in constraints and sm-state?
181 Most can, but UNKNOWN and POISONED svalues are singletons
182 per-type and thus it's meaningless for them to "have state". */
183 virtual bool can_have_associated_state_p () const { return true; }
184
186
188 const region_model &model,
189 const svalue *outer_sval = nullptr) const;
190
192
193 /* If we can get a value_range for this svalue, write it to OUT
194 and return true. Otherwise return false. */
195 bool
197 {
198 if (maybe_get_value_range_1 (out))
199 {
200 gcc_assert (!out.undefined_p ());
201 return true;
202 }
203 return false;
204 }
205
206 protected:
208 : symbol (c, id), m_type (type)
209 {}
210
212
213 private:
214 virtual void
216 virtual void
218 const dump_widget_info &dwi) const = 0;
219 virtual bool
221
223};
224
225/* Concrete subclass of svalue representing a pointer value that points to
226 a known region */
227
228class region_svalue : public svalue
229{
230public:
231 /* A support class for uniquifying instances of region_svalue. */
232 struct key_t
233 {
234 key_t (tree type, const region *reg)
235 : m_type (type), m_reg (reg)
236 {}
237
238 hashval_t hash () const
239 {
240 inchash::hash hstate;
241 hstate.add_ptr (m_type);
242 hstate.add_ptr (m_reg);
243 return hstate.end ();
244 }
245
246 bool operator== (const key_t &other) const
247 {
248 return (m_type == other.m_type && m_reg == other.m_reg);
249 }
250
251 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
252 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
253 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
254 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
255
257 const region *m_reg;
258 };
259
261 : svalue (complexity (reg), id, type),
262 m_reg (reg)
263 {
264 gcc_assert (m_reg != nullptr);
265 }
266
267 enum svalue_kind get_kind () const final override { return SK_REGION; }
268 const region_svalue *
269 dyn_cast_region_svalue () const final override { return this; }
270
271 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
272
273 void
274 print_dump_widget_label (pretty_printer *pp) const final override;
275 void
277 const dump_widget_info &dwi) const final override;
278
279 void accept (visitor *v) const final override;
281 const region_model *) const final override;
282
283 const region * get_pointee () const { return m_reg; }
284
285 static tristate eval_condition (const region_svalue *lhs_ptr,
286 enum tree_code op,
287 const region_svalue *rhs_ptr);
288
289 private:
290 const region *m_reg;
291};
292
293} // namespace ana
294
295template <>
296template <>
297inline bool
299{
300 return sval->get_kind () == SK_REGION;
301}
302
304: public member_function_hash_traits<region_svalue::key_t>
305{
306 static const bool empty_zero_p = false;
307};
308
309namespace ana {
310
311/* Concrete subclass of svalue representing a specific constant value.
312 The type will either be the same as that of the underlying tree constant,
313 or NULL_TREE indicating the constant is intended to be "typeless". */
314
316{
317public:
318 /* A support class for uniquifying instances of region_svalue. */
319 struct key_t
320 {
322 : m_type (type), m_cst (cst)
323 {}
324
325 hashval_t hash () const
326 {
327 inchash::hash hstate;
328 hstate.add_ptr (m_type);
329 hstate.add_ptr (m_cst);
330 return hstate.end ();
331 }
332
333 bool operator== (const key_t &other) const
334 {
335 return (m_type == other.m_type && m_cst == other.m_cst);
336 }
337
338 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
339 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
340 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
341 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
342
345 };
346
348 : svalue (complexity (1, 1), id, type),
349 m_cst_expr (cst_expr)
350 {
351 gcc_assert (cst_expr);
352 gcc_assert (CONSTANT_CLASS_P (cst_expr));
353 gcc_assert (type == TREE_TYPE (cst_expr) || type == NULL_TREE);
354 }
355
356 enum svalue_kind get_kind () const final override { return SK_CONSTANT; }
357 const constant_svalue *
358 dyn_cast_constant_svalue () const final override { return this; }
359
360 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
361
362 void
363 print_dump_widget_label (pretty_printer *pp) const final override;
364 void
366 const dump_widget_info &dwi) const final override;
367
368 void accept (visitor *v) const final override;
370 const region_model *) const final override;
371
372 tree get_constant () const { return m_cst_expr; }
374 enum tree_code op,
375 const constant_svalue *rhs);
376
377 const svalue *
379 const bit_range &subrange,
380 region_model_manager *mgr) const final override;
381
382 bool all_zeroes_p () const final override;
383
384 bool maybe_get_value_range_1 (value_range &out) const final override;
385
386 private:
388};
389
390} // namespace ana
391
392template <>
393template <>
394inline bool
395is_a_helper <const constant_svalue *>::test (const svalue *sval)
396{
397 return sval->get_kind () == SK_CONSTANT;
398}
399
401: public member_function_hash_traits<constant_svalue::key_t>
402{
403 static const bool empty_zero_p = false;
404};
405
406namespace ana {
407
408/* Concrete subclass of svalue representing an unknowable value, the bottom
409 value when thinking of svalues as a lattice.
410 This is a singleton (w.r.t. its manager): there is a single unknown_svalue
411 per type. Self-comparisons of such instances yield "unknown". */
412
413class unknown_svalue : public svalue
414{
415public:
419
420 enum svalue_kind get_kind () const final override { return SK_UNKNOWN; }
421
422 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
423
424 void
425 print_dump_widget_label (pretty_printer *pp) const final override;
426 void
428 const dump_widget_info &dwi) const final override;
429
430 void accept (visitor *v) const final override;
431
432 const svalue *
434 const bit_range &subrange,
435 region_model_manager *mgr) const final override;
436
437 bool maybe_get_value_range_1 (value_range &out) const final override;
438
439 /* Unknown values are singletons per-type, so can't have state. */
440 bool can_have_associated_state_p () const final override { return false; }
441};
442
443/* An enum describing a particular kind of "poisoned" value. */
444
445enum class poison_kind
446{
447 /* For use to describe uninitialized memory. */
449
450 /* For use to describe freed memory. */
452
453 /* For use to describe deleted memory. */
455
456 /* For use on pointers to regions within popped stack frames. */
458};
459
460extern const char *poison_kind_to_str (enum poison_kind);
461
462/* Concrete subclass of svalue representing a value that should not
463 be used (e.g. uninitialized memory, freed memory). */
464
466{
467public:
468 /* A support class for uniquifying instances of poisoned_svalue. */
469 struct key_t
470 {
472 : m_kind (kind), m_type (type)
473 {}
474
475 hashval_t hash () const
476 {
477 inchash::hash hstate;
478 hstate.add_int (static_cast<int> (m_kind));
479 hstate.add_ptr (m_type);
480 return hstate.end ();
481 }
482
483 bool operator== (const key_t &other) const
484 {
485 return (m_kind == other.m_kind && m_type == other.m_type);
486 }
487
488 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
489 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
490 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
491 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
492
495 };
496
498 : svalue (complexity (1, 1), id, type), m_kind (kind) {}
499
500 enum svalue_kind get_kind () const final override { return SK_POISONED; }
501 const poisoned_svalue *
502 dyn_cast_poisoned_svalue () const final override { return this; }
503
504 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
505
506 void
507 print_dump_widget_label (pretty_printer *pp) const final override;
508 void
510 const dump_widget_info &dwi) const final override;
511
512 void accept (visitor *v) const final override;
513
514 const svalue *
516 const bit_range &subrange,
517 region_model_manager *mgr) const final override;
518
519 enum poison_kind get_poison_kind () const { return m_kind; }
520
521 /* Poisoned svalues are singletons per-type, so can't have state. */
522 bool can_have_associated_state_p () const final override { return false; }
523
524 private:
526};
527
528} // namespace ana
529
530template <>
531template <>
532inline bool
534{
535 return sval->get_kind () == SK_POISONED;
536}
537
539: public member_function_hash_traits<poisoned_svalue::key_t>
540{
541 static const bool empty_zero_p = false;
542};
543
544namespace ana {
545
546/* A bundle of information recording a setjmp/sigsetjmp call, corresponding
547 roughly to a jmp_buf. */
548
550{
552 const superedge *sedge,
553 const gcall &setjmp_call)
554 : m_enode (enode), m_sedge (sedge), m_setjmp_call (&setjmp_call)
555 {
556 }
557
558 bool operator== (const setjmp_record &other) const
559 {
560 return (m_enode == other.m_enode
561 && m_sedge == other.m_sedge
562 && m_setjmp_call == other.m_setjmp_call);
563 }
564
565 void add_to_hash (inchash::hash *hstate) const
566 {
567 hstate->add_ptr (m_enode);
568 hstate->add_ptr (m_sedge);
569 hstate->add_ptr (m_setjmp_call);
570 }
571
572 static int cmp (const setjmp_record &rec1, const setjmp_record &rec2);
573
577 // non-null, but we can't use a reference since we're putting these in a hash_map
578};
579
580/* Concrete subclass of svalue representing buffers for setjmp/sigsetjmp,
581 so that longjmp/siglongjmp can potentially "return" to an entirely
582 different function. */
583
584class setjmp_svalue : public svalue
585{
586public:
587 /* A support class for uniquifying instances of poisoned_svalue. */
588 struct key_t
589 {
590 key_t (const setjmp_record &record, tree type)
591 : m_record (record), m_type (type)
592 {}
593
594 hashval_t hash () const
595 {
596 inchash::hash hstate;
597 m_record.add_to_hash (&hstate);
598 hstate.add_ptr (m_type);
599 return hstate.end ();
600 }
601
602 bool operator== (const key_t &other) const
603 {
604 return (m_record == other.m_record && m_type == other.m_type);
605 }
606
607 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
608 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
609 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
610 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
611
614 };
615
621
622 enum svalue_kind get_kind () const final override { return SK_SETJMP; }
623 const setjmp_svalue *
624 dyn_cast_setjmp_svalue () const final override { return this; }
625
626 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
627
628 void
629 print_dump_widget_label (pretty_printer *pp) const final override;
630 void
632 const dump_widget_info &dwi) const final override;
633
634 void accept (visitor *v) const final override;
635
636 int get_enode_index () const;
637
639
640 private:
642};
643
644} // namespace ana
645
646template <>
647template <>
648inline bool
650{
651 return sval->get_kind () == SK_SETJMP;
652}
653
655: public member_function_hash_traits<setjmp_svalue::key_t>
656{
657 static const bool empty_zero_p = false;
658};
659
660namespace ana {
661
662/* Concrete subclass of svalue representing the initial value of a
663 specific region.
664
665 This represents the initial value at the start of the analysis path,
666 as opposed to the first time the region is accessed during the path.
667 Hence as soon as we have a call to an unknown function, all previously
668 unmodelled globals become implicitly "unknown" rathen than "initial". */
669
670class initial_svalue : public svalue
671{
672public:
674 : svalue (complexity (reg), id, type), m_reg (reg)
675 {
676 gcc_assert (m_reg != nullptr);
677 }
678
679 enum svalue_kind get_kind () const final override { return SK_INITIAL; }
680 const initial_svalue *
681 dyn_cast_initial_svalue () const final override { return this; }
682
683 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
684
685 void
686 print_dump_widget_label (pretty_printer *pp) const final override;
687 void
689 const dump_widget_info &dwi) const final override;
690
691 void accept (visitor *v) const final override;
693 const region_model *) const final override;
694
696
697 const region *get_region () const { return m_reg; }
698
699 private:
700 const region *m_reg;
701};
702
703} // namespace ana
704
705template <>
706template <>
707inline bool
709{
710 return sval->get_kind () == SK_INITIAL;
711}
712
713namespace ana {
714
715/* Concrete subclass of svalue representing a unary operation on
716 another svalues (e.g. a cast). */
717
718class unaryop_svalue : public svalue
719{
720public:
721 /* A support class for uniquifying instances of unaryop_svalue. */
722 struct key_t
723 {
724 key_t (tree type, enum tree_code op, const svalue *arg)
725 : m_type (type), m_op (op), m_arg (arg)
726 {}
727
728 hashval_t hash () const
729 {
730 inchash::hash hstate;
731 hstate.add_ptr (m_type);
732 hstate.add_int (m_op);
733 hstate.add_ptr (m_arg);
734 return hstate.end ();
735 }
736
737 bool operator== (const key_t &other) const
738 {
739 return (m_type == other.m_type
740 && m_op == other.m_op
741 && m_arg == other.m_arg);
742 }
743
744 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
745 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
746 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
747 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
748
751 const svalue *m_arg;
752 };
753
755 const svalue *arg)
756 : svalue (complexity (arg), id, type), m_op (op), m_arg (arg)
757 {
759 }
760
761 enum svalue_kind get_kind () const final override { return SK_UNARYOP; }
762 const unaryop_svalue *
763 dyn_cast_unaryop_svalue () const final override { return this; }
764
765 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
766
767 void
768 print_dump_widget_label (pretty_printer *pp) const final override;
769 void
771 const dump_widget_info &dwi) const final override;
772
773 void accept (visitor *v) const final override;
775 const region_model *) const final override;
776
777 enum tree_code get_op () const { return m_op; }
778 const svalue *get_arg () const { return m_arg; }
779
780 const svalue *
782 const bit_range &subrange,
783 region_model_manager *mgr) const final override;
784
785 bool maybe_get_value_range_1 (value_range &out) const final override;
786
787 private:
789 const svalue *m_arg;
790};
791
792} // namespace ana
793
794template <>
795template <>
796inline bool
798{
799 return sval->get_kind () == SK_UNARYOP;
800}
801
803: public member_function_hash_traits<unaryop_svalue::key_t>
804{
805 static const bool empty_zero_p = false;
806};
807
808namespace ana {
809
810/* Concrete subclass of svalue representing a binary operation of
811 two svalues. */
812
813class binop_svalue : public svalue
814{
815public:
816 /* A support class for uniquifying instances of binop_svalue. */
817 struct key_t
818 {
820 const svalue *arg0, const svalue *arg1)
821 : m_type (type), m_op (op), m_arg0 (arg0), m_arg1 (arg1)
822 {}
823
824 hashval_t hash () const
825 {
826 inchash::hash hstate;
827 hstate.add_ptr (m_type);
828 hstate.add_int (m_op);
829 hstate.add_ptr (m_arg0);
830 hstate.add_ptr (m_arg1);
831 return hstate.end ();
832 }
833
834 bool operator== (const key_t &other) const
835 {
836 return (m_type == other.m_type
837 && m_op == other.m_op
838 && m_arg0 == other.m_arg0
839 && m_arg1 == other.m_arg1);
840 }
841
842 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
843 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
844 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
845 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
846
851 };
852
854 const svalue *arg0, const svalue *arg1)
855 : svalue (complexity::from_pair (arg0->get_complexity (),
856 arg1->get_complexity ()),
857 id,
858 type),
859 m_op (op), m_arg0 (arg0), m_arg1 (arg1)
860 {
863 }
864
865 enum svalue_kind get_kind () const final override { return SK_BINOP; }
866 const binop_svalue *dyn_cast_binop_svalue () const final override
867 {
868 return this;
869 }
870
871 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
872
873 void
874 print_dump_widget_label (pretty_printer *pp) const final override;
875 void
877 const dump_widget_info &dwi) const final override;
878
879 void accept (visitor *v) const final override;
881 const region_model *) const final override;
882
883 bool maybe_get_value_range_1 (value_range &out) const final override;
884
885 enum tree_code get_op () const { return m_op; }
886 const svalue *get_arg0 () const { return m_arg0; }
887 const svalue *get_arg1 () const { return m_arg1; }
888
889 private:
893};
894
895} // namespace ana
896
897template <>
898template <>
899inline bool
901{
902 return sval->get_kind () == SK_BINOP;
903}
904
906: public member_function_hash_traits<binop_svalue::key_t>
907{
908 static const bool empty_zero_p = false;
909};
910
911namespace ana {
912
913/* Concrete subclass of svalue representing the result of accessing a subregion
914 of another svalue (the value of a component/field of a struct, or an element
915 from an array). */
916
917class sub_svalue : public svalue
918{
919public:
920 /* A support class for uniquifying instances of sub_svalue. */
921 struct key_t
922 {
923 key_t (tree type, const svalue *parent_svalue, const region *subregion)
924 : m_type (type), m_parent_svalue (parent_svalue), m_subregion (subregion)
925 {}
926
927 hashval_t hash () const
928 {
929 inchash::hash hstate;
930 hstate.add_ptr (m_type);
931 hstate.add_ptr (m_parent_svalue);
932 hstate.add_ptr (m_subregion);
933 return hstate.end ();
934 }
935
936 bool operator== (const key_t &other) const
937 {
938 return (m_type == other.m_type
939 && m_parent_svalue == other.m_parent_svalue
940 && m_subregion == other.m_subregion);
941 }
942
943 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
944 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
945 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
946 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
947
951 };
952 sub_svalue (symbol::id_t id, tree type, const svalue *parent_svalue,
953 const region *subregion);
954
955 enum svalue_kind get_kind () const final override { return SK_SUB; }
956 const sub_svalue *dyn_cast_sub_svalue () const final override
957 {
958 return this;
959 }
960
961 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
962
963 void
964 print_dump_widget_label (pretty_printer *pp) const final override;
965 void
967 const dump_widget_info &dwi) const final override;
968
969 void accept (visitor *v) const final override;
971 const region_model *) const final override;
972
973 const svalue *get_parent () const { return m_parent_svalue; }
974 const region *get_subregion () const { return m_subregion; }
975
976 private:
979};
980
981} // namespace ana
982
983template <>
984template <>
985inline bool
987{
988 return sval->get_kind () == SK_SUB;
989}
990
992: public member_function_hash_traits<sub_svalue::key_t>
993{
994 static const bool empty_zero_p = false;
995};
996
997namespace ana {
998
999/* Concrete subclass of svalue representing repeating an inner svalue
1000 (possibly not a whole number of times) to fill a larger region of
1001 type TYPE of size OUTER_SIZE bytes. */
1002
1004{
1005public:
1006 /* A support class for uniquifying instances of repeated_svalue. */
1007 struct key_t
1008 {
1010 const svalue *outer_size,
1011 const svalue *inner_svalue)
1012 : m_type (type), m_outer_size (outer_size), m_inner_svalue (inner_svalue)
1013 {}
1014
1015 hashval_t hash () const
1016 {
1017 inchash::hash hstate;
1018 hstate.add_ptr (m_type);
1019 hstate.add_ptr (m_outer_size);
1020 hstate.add_ptr (m_inner_svalue);
1021 return hstate.end ();
1022 }
1023
1024 bool operator== (const key_t &other) const
1025 {
1026 return (m_type == other.m_type
1027 && m_outer_size == other.m_outer_size
1028 && m_inner_svalue == other.m_inner_svalue);
1029 }
1030
1031 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1032 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1033 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1034 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1035
1039 };
1041 tree type,
1042 const svalue *outer_size,
1043 const svalue *inner_svalue);
1044
1045 enum svalue_kind get_kind () const final override { return SK_REPEATED; }
1047 {
1048 return this;
1049 }
1050
1051 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1052
1053 void
1054 print_dump_widget_label (pretty_printer *pp) const final override;
1055 void
1057 const dump_widget_info &dwi) const final override;
1058
1059 void accept (visitor *v) const final override;
1060
1061 const svalue *get_outer_size () const { return m_outer_size; }
1062 const svalue *get_inner_svalue () const { return m_inner_svalue; }
1063
1064 bool all_zeroes_p () const final override;
1065
1066 const svalue *
1068 const bit_range &subrange,
1069 region_model_manager *mgr) const final override;
1070
1071 private:
1074};
1075
1076} // namespace ana
1077
1078template <>
1079template <>
1080inline bool
1081is_a_helper <const repeated_svalue *>::test (const svalue *sval)
1082{
1083 return sval->get_kind () == SK_REPEATED;
1084}
1085
1087: public member_function_hash_traits<repeated_svalue::key_t>
1088{
1089 static const bool empty_zero_p = false;
1090};
1091
1092namespace ana {
1093
1094/* A range of bits/bytes within another svalue
1095 e.g. bytes 5-39 of INITIAL_SVALUE(R).
1096 These can be generated for prefixes and suffixes when part of a binding
1097 is clobbered, so that we don't lose too much information. */
1098
1100{
1101public:
1102 /* A support class for uniquifying instances of bits_within_svalue. */
1103 struct key_t
1104 {
1106 const bit_range &bits,
1107 const svalue *inner_svalue)
1108 : m_type (type), m_bits (bits), m_inner_svalue (inner_svalue)
1109 {}
1110
1111 hashval_t hash () const
1112 {
1113 inchash::hash hstate;
1114 hstate.add_ptr (m_type);
1115 hstate.add_ptr (m_inner_svalue);
1116 return hstate.end ();
1117 }
1118
1119 bool operator== (const key_t &other) const
1120 {
1121 return (m_type == other.m_type
1122 && m_bits == other.m_bits
1123 && m_inner_svalue == other.m_inner_svalue);
1124 }
1125
1126 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1127 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1128 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1129 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1130
1134 };
1136 tree type,
1137 const bit_range &bits,
1138 const svalue *inner_svalue);
1139
1140 enum svalue_kind get_kind () const final override { return SK_BITS_WITHIN; }
1141 const bits_within_svalue *
1143 {
1144 return this;
1145 }
1146
1147 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1148
1149 void
1150 print_dump_widget_label (pretty_printer *pp) const final override;
1151 void
1153 const dump_widget_info &dwi) const final override;
1154
1155 void accept (visitor *v) const final override;
1157 const region_model *) const final override;
1158
1159 const bit_range &get_bits () const { return m_bits; }
1160 const svalue *get_inner_svalue () const { return m_inner_svalue; }
1161
1162 const svalue *
1164 const bit_range &subrange,
1165 region_model_manager *mgr) const final override;
1166
1167 private:
1170};
1171
1172} // namespace ana
1173
1174template <>
1175template <>
1176inline bool
1178{
1179 return sval->get_kind () == SK_BITS_WITHIN;
1180}
1181
1183: public member_function_hash_traits<bits_within_svalue::key_t>
1184{
1185 static const bool empty_zero_p = false;
1186};
1187
1188namespace ana {
1189
1190/* Concrete subclass of svalue: decorate another svalue,
1191 so that the resulting svalue can be identified as being
1192 "interesting to control flow".
1193 For example, consider the return value from setjmp. We
1194 don't want to merge states in which the result is 0 with
1195 those in which the result is non-zero. By using an
1196 unmergeable_svalue for the result, we can inhibit such merges
1197 and have separate exploded nodes for those states, keeping
1198 the first and second returns from setjmp distinct in the exploded
1199 graph. */
1200
1202{
1203public:
1205 : svalue (complexity (arg), id, arg->get_type ()), m_arg (arg)
1206 {
1207 }
1208
1209 enum svalue_kind get_kind () const final override { return SK_UNMERGEABLE; }
1210 const unmergeable_svalue *
1211 dyn_cast_unmergeable_svalue () const final override { return this; }
1212
1213 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1214
1215 void
1216 print_dump_widget_label (pretty_printer *pp) const final override;
1217 void
1219 const dump_widget_info &dwi) const final override;
1220
1221 void accept (visitor *v) const final override;
1223 const region_model *) const final override;
1224
1225 const svalue *get_arg () const { return m_arg; }
1226
1227 private:
1229};
1230
1231} // namespace ana
1232
1233template <>
1234template <>
1235inline bool
1237{
1238 return sval->get_kind () == SK_UNMERGEABLE;
1239}
1240
1241namespace ana {
1242
1243/* Concrete subclass of svalue for use in selftests, where
1244 we want a specific but unknown svalue.
1245 Unlike other svalue subclasses these aren't managed by
1246 region_model_manager. */
1247
1249{
1250public:
1252 : svalue (complexity (1, 1), id, type), m_name (name)
1253 {
1254 }
1255
1256 enum svalue_kind get_kind () const final override { return SK_PLACEHOLDER; }
1257
1258 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1259
1260 void
1261 print_dump_widget_label (pretty_printer *pp) const final override;
1262 void
1264 const dump_widget_info &dwi) const final override;
1265
1266 void accept (visitor *v) const final override;
1267
1268 const char *get_name () const { return m_name; }
1269
1270 private:
1271 const char *m_name;
1272};
1273
1274} // namespace ana
1275
1276template <>
1277template <>
1278inline bool
1280{
1281 return sval->get_kind () == SK_PLACEHOLDER;
1282}
1283
1284namespace ana {
1285
1286/* Concrete subclass of svalue representing a "widening" seen when merging
1287 states, widening from a base value to {base value, iter value} and thus
1288 representing a possible fixed point in an iteration from the base to
1289 +ve infinity, or -ve infinity, and thus useful for representing a value
1290 within a loop.
1291 We also need to capture the program_point at which the merger happens,
1292 so that distinguish between different iterators, and thus handle
1293 nested loops. (currently we capture the function_point instead, for
1294 simplicity of hashing). */
1295
1297{
1298public:
1299 /* A support class for uniquifying instances of widening_svalue. */
1300 struct key_t
1301 {
1302 key_t (tree type, const supernode *snode,
1303 const svalue *base_sval, const svalue *iter_sval)
1304 : m_type (type), m_snode (snode),
1305 m_base_sval (base_sval), m_iter_sval (iter_sval)
1306 {}
1307
1308 hashval_t hash () const
1309 {
1310 inchash::hash hstate;
1311 hstate.add_ptr (m_base_sval);
1312 hstate.add_ptr (m_iter_sval);
1313 return hstate.end ();
1314 }
1315
1316 bool operator== (const key_t &other) const
1317 {
1318 return (m_type == other.m_type
1319 && m_snode == other.m_snode
1320 && m_base_sval == other.m_base_sval
1321 && m_iter_sval == other.m_iter_sval);
1322 }
1323
1324 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1325 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1326 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1327 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1328
1333 };
1334
1341
1343 const svalue *base_sval, const svalue *iter_sval)
1344 : svalue (complexity::from_pair (base_sval->get_complexity (),
1345 iter_sval->get_complexity ()),
1346 id,
1347 type),
1348 m_snode (snode),
1349 m_base_sval (base_sval), m_iter_sval (iter_sval)
1350 {
1353 }
1354
1355 enum svalue_kind get_kind () const final override { return SK_WIDENING; }
1357 {
1358 return this;
1359 }
1360
1361 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1362
1363 void
1364 print_dump_widget_label (pretty_printer *pp) const final override;
1365 void
1367 const dump_widget_info &dwi) const final override;
1368
1369 void accept (visitor *v) const final override;
1370
1371 const supernode *get_snode () const { return m_snode; }
1372 const svalue *get_base_svalue () const { return m_base_sval; }
1373 const svalue *get_iter_svalue () const { return m_iter_sval; }
1374
1376
1378 tree rhs_cst) const;
1379
1380 private:
1384};
1385
1386} // namespace ana
1387
1388template <>
1389template <>
1390inline bool
1392{
1393 return sval->get_kind () == SK_WIDENING;
1394}
1395
1397: public member_function_hash_traits<widening_svalue::key_t>
1398{
1399 static const bool empty_zero_p = false;
1400};
1401
1402namespace ana {
1403
1404/* Concrete subclass of svalue representing a mapping of bit-ranges
1405 to svalues, analogous to a cluster within the store.
1406
1407 This is for use in places where we want to represent a store-like
1408 mapping, but are required to use an svalue, such as when handling
1409 compound assignments and compound return values.
1410
1411 All keys within the underlying binding_map are required to be concrete,
1412 not symbolic.
1413
1414 Instances of this class shouldn't be bound as-is into the store;
1415 instead they should be unpacked. Similarly, they should not be
1416 nested. */
1417
1419{
1420public:
1423
1424 /* A support class for uniquifying instances of compound_svalue.
1425 Note that to avoid copies, keys store pointers to binding_maps,
1426 rather than the maps themselves. */
1427 struct key_t
1428 {
1429 key_t (tree type, const binding_map *map_ptr)
1430 : m_type (type), m_map_ptr (map_ptr)
1431 {}
1432
1433 hashval_t hash () const
1434 {
1435 inchash::hash hstate;
1436 hstate.add_ptr (m_type);
1437 //hstate.add_ptr (m_map_ptr); // TODO
1438 return hstate.end ();
1439 }
1440
1441 bool operator== (const key_t &other) const
1442 {
1443 return (m_type == other.m_type
1444 && *m_map_ptr == *other.m_map_ptr);
1445 }
1446
1447 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1448 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1449 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1450 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1451
1454 };
1455
1457
1458 enum svalue_kind get_kind () const final override { return SK_COMPOUND; }
1460 {
1461 return this;
1462 }
1463
1464 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1465
1466 void
1467 print_dump_widget_label (pretty_printer *pp) const final override;
1468 void
1470 const dump_widget_info &dwi) const final override;
1471
1472 void accept (visitor *v) const final override;
1473
1474 const binding_map &get_map () const { return m_map; }
1475
1476 const_iterator_t begin () const { return m_map.begin (); }
1477 const_iterator_t end () const { return m_map.end (); }
1478 iterator_t begin () { return m_map.begin (); }
1479 iterator_t end () { return m_map.end (); }
1480
1481 struct key_t make_key () const
1482 {
1483 return key_t (get_type (), &m_map);
1484 }
1485
1486 const svalue *
1488 const bit_range &subrange,
1489 region_model_manager *mgr) const final override;
1490
1491 private:
1493
1495};
1496
1497} // namespace ana
1498
1499template <>
1500template <>
1501inline bool
1503{
1504 return sval->get_kind () == SK_COMPOUND;
1505}
1506
1508: public member_function_hash_traits<compound_svalue::key_t>
1509{
1510 static const bool empty_zero_p = false;
1511};
1512
1513namespace ana {
1514
1515/* A bundle of state for purging information from a program_state about
1516 a conjured_svalue. We pass this whenever calling
1517 get_or_create_conjured_svalue, so that if the program_state already
1518 has information about this conjured_svalue on an execution path, we
1519 can purge that information, to avoid the analyzer confusing the two
1520 values as being the same. */
1521
1523{
1524public:
1526 : m_model (model), m_ctxt (ctxt)
1527 {
1528 }
1529 void purge (const conjured_svalue *sval) const;
1530
1531private:
1534};
1535
1536/* A defined value arising from a statement, where we want to identify a
1537 particular unknown value, rather than resorting to the unknown_value
1538 singleton, so that the value can have sm-state.
1539
1540 Comparisons of variables that share the same conjured_svalue are known
1541 to be equal, even if we don't know what the value is.
1542
1543 For example, this is used for the values of regions that may have been
1544 touched when calling an unknown function.
1545
1546 The value captures a region as well as a stmt in order to avoid falsely
1547 aliasing the various values that could arise in one statement. For
1548 example, after:
1549 unknown_fn (&a, &b);
1550 we want values to clobber a and b with, but we don't want to use the
1551 same value, or it would falsely implicitly assume that a == b. */
1552
1554{
1555public:
1556 /* A support class for uniquifying instances of conjured_svalue. */
1557 struct key_t
1558 {
1559 key_t (tree type, const gimple *stmt, const region *id_reg, unsigned idx)
1560 : m_type (type), m_stmt (stmt), m_id_reg (id_reg), m_idx (idx)
1561 {}
1562
1563 hashval_t hash () const
1564 {
1565 inchash::hash hstate;
1566 hstate.add_ptr (m_type);
1567 hstate.add_ptr (m_stmt);
1568 hstate.add_ptr (m_id_reg);
1569 return hstate.end ();
1570 }
1571
1572 bool operator== (const key_t &other) const
1573 {
1574 return (m_type == other.m_type
1575 && m_stmt == other.m_stmt
1576 && m_id_reg == other.m_id_reg
1577 && m_idx == other.m_idx);
1578 }
1579
1580 /* Use m_stmt to mark empty/deleted, as m_type can be NULL_TREE for
1581 legitimate instances. */
1582 void mark_deleted () { m_stmt = reinterpret_cast<const gimple *> (1); }
1583 void mark_empty () { m_stmt = nullptr; }
1584 bool is_deleted () const
1585 {
1586 return m_stmt == reinterpret_cast<const gimple *> (1);
1587 }
1588 bool is_empty () const { return m_stmt == nullptr; }
1589
1593 unsigned m_idx;
1594 };
1595
1597 const region *id_reg, unsigned idx)
1598 : svalue (complexity (id_reg), id, type),
1599 m_stmt (stmt), m_id_reg (id_reg), m_idx (idx)
1600 {
1601 gcc_assert (m_stmt != nullptr);
1602 }
1603
1604 enum svalue_kind get_kind () const final override { return SK_CONJURED; }
1606 {
1607 return this;
1608 }
1609
1610 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1611
1612 void
1613 print_dump_widget_label (pretty_printer *pp) const final override;
1614 void
1616 const dump_widget_info &dwi) const final override;
1617
1618 void accept (visitor *v) const final override;
1619
1620 const gimple *get_stmt () const { return m_stmt; }
1621 const region *get_id_region () const { return m_id_reg; }
1622 bool lhs_value_p () const;
1623
1624 private:
1627 unsigned m_idx;
1628};
1629
1630} // namespace ana
1631
1632template <>
1633template <>
1634inline bool
1636{
1637 return sval->get_kind () == SK_CONJURED;
1638}
1639
1641: public member_function_hash_traits<conjured_svalue::key_t>
1642{
1643 static const bool empty_zero_p = true;
1644};
1645
1646namespace ana {
1647
1648/* An output from a deterministic asm stmt, where we want to identify a
1649 particular unknown value, rather than resorting to the unknown_value
1650 singleton.
1651
1652 Comparisons of variables that share the same asm_output_svalue are known
1653 to be equal, even if we don't know what the value is. */
1654
1656{
1657public:
1658 /* Imposing an upper limit and using a (small) array allows key_t
1659 to avoid memory management. */
1660 static const unsigned MAX_INPUTS = 2;
1661
1662 /* A support class for uniquifying instances of asm_output_svalue. */
1663 struct key_t
1664 {
1666 const char *asm_string,
1667 unsigned output_idx,
1668 const vec<const svalue *> &inputs)
1669 : m_type (type), m_asm_string (asm_string), m_output_idx (output_idx),
1670 m_num_inputs (inputs.length ())
1671 {
1672 gcc_assert (inputs.length () <= MAX_INPUTS);
1673 for (unsigned i = 0; i < m_num_inputs; i++)
1674 m_input_arr[i] = inputs[i];
1675 }
1676
1677 hashval_t hash () const
1678 {
1679 inchash::hash hstate;
1680 hstate.add_ptr (m_type);
1681 /* We don't bother hashing m_asm_str. */
1682 hstate.add_int (m_output_idx);
1683 for (unsigned i = 0; i < m_num_inputs; i++)
1684 hstate.add_ptr (m_input_arr[i]);
1685 return hstate.end ();
1686 }
1687
1688 bool operator== (const key_t &other) const
1689 {
1690 if (!(m_type == other.m_type
1691 && 0 == (strcmp (m_asm_string, other.m_asm_string))
1692 && m_output_idx == other.m_output_idx
1693 && m_num_inputs == other.m_num_inputs))
1694 return false;
1695 for (unsigned i = 0; i < m_num_inputs; i++)
1696 if (m_input_arr[i] != other.m_input_arr[i])
1697 return false;
1698 return true;
1699 }
1700
1701 /* Use m_asm_string to mark empty/deleted, as m_type can be NULL_TREE for
1702 legitimate instances. */
1703 void mark_deleted () { m_asm_string = reinterpret_cast<const char *> (1); }
1704 void mark_empty () { m_asm_string = nullptr; }
1705 bool is_deleted () const
1706 {
1707 return m_asm_string == reinterpret_cast<const char *> (1);
1708 }
1709 bool is_empty () const { return m_asm_string == nullptr; }
1710
1712 const char *m_asm_string;
1716 };
1717
1719 tree type,
1720 const char *asm_string,
1721 unsigned output_idx,
1722 unsigned num_outputs,
1723 const vec<const svalue *> &inputs)
1724 : svalue (complexity::from_vec_svalue (inputs), id, type),
1725 m_asm_string (asm_string),
1726 m_output_idx (output_idx),
1727 m_num_outputs (num_outputs),
1728 m_num_inputs (inputs.length ())
1729 {
1730 gcc_assert (inputs.length () <= MAX_INPUTS);
1731 for (unsigned i = 0; i < m_num_inputs; i++)
1732 m_input_arr[i] = inputs[i];
1733 }
1734
1735 enum svalue_kind get_kind () const final override { return SK_ASM_OUTPUT; }
1736 const asm_output_svalue *
1738 {
1739 return this;
1740 }
1741
1742 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1743
1744 void
1745 print_dump_widget_label (pretty_printer *pp) const final override;
1746 void
1748 const dump_widget_info &dwi) const final override;
1749
1750 void accept (visitor *v) const final override;
1751
1752 const char *get_asm_string () const { return m_asm_string; }
1753 unsigned get_output_idx () const { return m_output_idx; }
1754 unsigned get_num_outputs () const { return m_num_outputs; }
1755 unsigned get_num_inputs () const { return m_num_inputs; }
1756 const svalue *get_input (unsigned idx) const { return m_input_arr[idx]; }
1757
1758 private:
1760 unsigned input_idx,
1761 const svalue *sval,
1762 bool simple) const;
1763 unsigned input_idx_to_asm_idx (unsigned input_idx) const;
1764
1765 const char *m_asm_string;
1767
1768 /* We capture this so that we can offset the input indices
1769 to match the %0, %1, %2 in the asm_string when dumping. */
1771
1774};
1775
1776} // namespace ana
1777
1778template <>
1779template <>
1780inline bool
1782{
1783 return sval->get_kind () == SK_ASM_OUTPUT;
1784}
1785
1787: public member_function_hash_traits<asm_output_svalue::key_t>
1788{
1789 static const bool empty_zero_p = true;
1790};
1791
1792namespace ana {
1793
1794/* The return value from a function with __attribute((const)) for given
1795 inputs, provided that we don't have too many inputs, and all of them
1796 are deterministic.
1797
1798 Comparisons of variables that share the same const_fn_result_svalue are known
1799 to be equal, even if we don't know what the value is. */
1800
1802{
1803public:
1804 /* Imposing an upper limit and using a (small) array allows key_t
1805 to avoid memory management. */
1806 static const unsigned MAX_INPUTS = 2;
1807
1808 /* A support class for uniquifying instances of const_fn_result_svalue. */
1809 struct key_t
1810 {
1812 tree fndecl,
1813 const vec<const svalue *> &inputs)
1814 : m_type (type), m_fndecl (fndecl),
1815 m_num_inputs (inputs.length ())
1816 {
1817 gcc_assert (inputs.length () <= MAX_INPUTS);
1818 for (unsigned i = 0; i < m_num_inputs; i++)
1819 m_input_arr[i] = inputs[i];
1820 }
1821
1822 hashval_t hash () const
1823 {
1824 inchash::hash hstate;
1825 hstate.add_ptr (m_type);
1826 hstate.add_ptr (m_fndecl);
1827 for (unsigned i = 0; i < m_num_inputs; i++)
1828 hstate.add_ptr (m_input_arr[i]);
1829 return hstate.end ();
1830 }
1831
1832 bool operator== (const key_t &other) const
1833 {
1834 if (!(m_type == other.m_type
1835 && m_fndecl == other.m_fndecl
1836 && m_num_inputs == other.m_num_inputs))
1837 return false;
1838 for (unsigned i = 0; i < m_num_inputs; i++)
1839 if (m_input_arr[i] != other.m_input_arr[i])
1840 return false;
1841 return true;
1842 }
1843
1844 /* Use m_fndecl to mark empty/deleted. */
1845 void mark_deleted () { m_fndecl = reinterpret_cast<tree> (1); }
1847 bool is_deleted () const
1848 {
1849 return m_fndecl == reinterpret_cast<tree> (1);
1850 }
1851 bool is_empty () const { return m_fndecl == NULL_TREE; }
1852
1857 };
1858
1860 tree type,
1861 tree fndecl,
1862 const vec<const svalue *> &inputs)
1863 : svalue (complexity::from_vec_svalue (inputs), id, type),
1864 m_fndecl (fndecl),
1865 m_num_inputs (inputs.length ())
1866 {
1867 gcc_assert (inputs.length () <= MAX_INPUTS);
1868 for (unsigned i = 0; i < m_num_inputs; i++)
1869 m_input_arr[i] = inputs[i];
1870 }
1871
1872 enum svalue_kind get_kind () const final override
1873 {
1874 return SK_CONST_FN_RESULT;
1875 }
1878 {
1879 return this;
1880 }
1881
1882 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1883
1884 void
1885 print_dump_widget_label (pretty_printer *pp) const final override;
1886 void
1888 const dump_widget_info &dwi) const final override;
1889
1890 void accept (visitor *v) const final override;
1891
1892 tree get_fndecl () const { return m_fndecl; }
1893 unsigned get_num_inputs () const { return m_num_inputs; }
1894 const svalue *get_input (unsigned idx) const { return m_input_arr[idx]; }
1895
1896 private:
1898 unsigned input_idx,
1899 const svalue *sval,
1900 bool simple) const;
1901
1905};
1906
1907} // namespace ana
1908
1909template <>
1910template <>
1911inline bool
1913{
1914 return sval->get_kind () == SK_CONST_FN_RESULT;
1915}
1916
1918: public member_function_hash_traits<const_fn_result_svalue::key_t>
1919{
1920 static const bool empty_zero_p = true;
1921};
1922
1923#endif /* GCC_ANALYZER_SVALUE_H */
Definition svalue.h:1656
const asm_output_svalue * dyn_cast_asm_output_svalue() const final override
Definition svalue.h:1737
void dump_input(pretty_printer *pp, unsigned input_idx, const svalue *sval, bool simple) const
const char * get_asm_string() const
Definition svalue.h:1752
asm_output_svalue(symbol::id_t id, tree type, const char *asm_string, unsigned output_idx, unsigned num_outputs, const vec< const svalue * > &inputs)
Definition svalue.h:1718
const char * m_asm_string
Definition svalue.h:1765
unsigned m_num_inputs
Definition svalue.h:1772
unsigned m_output_idx
Definition svalue.h:1766
unsigned get_num_outputs() const
Definition svalue.h:1754
unsigned input_idx_to_asm_idx(unsigned input_idx) const
unsigned get_num_inputs() const
Definition svalue.h:1755
enum svalue_kind get_kind() const final override
Definition svalue.h:1735
const svalue * get_input(unsigned idx) const
Definition svalue.h:1756
unsigned m_num_outputs
Definition svalue.h:1770
void print_dump_widget_label(pretty_printer *pp) const final override
void accept(visitor *v) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
unsigned get_output_idx() const
Definition svalue.h:1753
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1773
static const unsigned MAX_INPUTS
Definition svalue.h:1660
Definition store.h:524
class ana::binding_map::iterator iterator_t
class ana::binding_map::const_iterator const_iterator_t
Definition svalue.h:814
enum tree_code get_op() const
Definition svalue.h:885
const svalue * get_arg1() const
Definition svalue.h:887
bool maybe_get_value_range_1(value_range &out) const final override
void accept(visitor *v) const final override
enum tree_code m_op
Definition svalue.h:890
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
const svalue * get_arg0() const
Definition svalue.h:886
const svalue * m_arg1
Definition svalue.h:892
enum svalue_kind get_kind() const final override
Definition svalue.h:865
void print_dump_widget_label(pretty_printer *pp) const final override
binop_svalue(symbol::id_t id, tree type, enum tree_code op, const svalue *arg0, const svalue *arg1)
Definition svalue.h:853
const svalue * m_arg0
Definition svalue.h:891
void dump_to_pp(pretty_printer *pp, bool simple) const final override
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
const binop_svalue * dyn_cast_binop_svalue() const final override
Definition svalue.h:866
Definition svalue.h:1100
enum svalue_kind get_kind() const final override
Definition svalue.h:1140
const bit_range m_bits
Definition svalue.h:1168
const svalue * m_inner_svalue
Definition svalue.h:1169
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
void accept(visitor *v) const final override
bits_within_svalue(symbol::id_t id, tree type, const bit_range &bits, const svalue *inner_svalue)
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const svalue * get_inner_svalue() const
Definition svalue.h:1160
const bits_within_svalue * dyn_cast_bits_within_svalue() const final override
Definition svalue.h:1142
const bit_range & get_bits() const
Definition svalue.h:1159
void print_dump_widget_label(pretty_printer *pp) const final override
const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const final override
Definition svalue.h:1419
const_iterator_t end() const
Definition svalue.h:1477
static complexity calc_complexity(const binding_map &map)
iterator_t end()
Definition svalue.h:1479
compound_svalue(symbol::id_t id, tree type, const binding_map &map)
void print_dump_widget_label(pretty_printer *pp) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const binding_map & get_map() const
Definition svalue.h:1474
binding_map::iterator_t iterator_t
Definition svalue.h:1422
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
iterator_t begin()
Definition svalue.h:1478
enum svalue_kind get_kind() const final override
Definition svalue.h:1458
binding_map::const_iterator_t const_iterator_t
Definition svalue.h:1421
const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const final override
const_iterator_t begin() const
Definition svalue.h:1476
void accept(visitor *v) const final override
binding_map m_map
Definition svalue.h:1494
struct key_t make_key() const
Definition svalue.h:1481
const compound_svalue * dyn_cast_compound_svalue() const final override
Definition svalue.h:1459
void purge(const conjured_svalue *sval) const
conjured_purge(region_model *model, region_model_context *ctxt)
Definition svalue.h:1525
region_model_context * m_ctxt
Definition svalue.h:1533
region_model * m_model
Definition svalue.h:1532
Definition svalue.h:1554
void accept(visitor *v) const final override
bool lhs_value_p() const
const gimple * get_stmt() const
Definition svalue.h:1620
const conjured_svalue * dyn_cast_conjured_svalue() const final override
Definition svalue.h:1605
enum svalue_kind get_kind() const final override
Definition svalue.h:1604
const region * m_id_reg
Definition svalue.h:1626
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
const gimple * m_stmt
Definition svalue.h:1625
void print_dump_widget_label(pretty_printer *pp) const final override
unsigned m_idx
Definition svalue.h:1627
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const region * get_id_region() const
Definition svalue.h:1621
conjured_svalue(symbol::id_t id, tree type, const gimple *stmt, const region *id_reg, unsigned idx)
Definition svalue.h:1596
Definition svalue.h:1802
tree m_fndecl
Definition svalue.h:1902
unsigned get_num_inputs() const
Definition svalue.h:1893
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
void accept(visitor *v) const final override
tree get_fndecl() const
Definition svalue.h:1892
static const unsigned MAX_INPUTS
Definition svalue.h:1806
const svalue * get_input(unsigned idx) const
Definition svalue.h:1894
enum svalue_kind get_kind() const final override
Definition svalue.h:1872
void dump_input(pretty_printer *pp, unsigned input_idx, const svalue *sval, bool simple) const
const_fn_result_svalue(symbol::id_t id, tree type, tree fndecl, const vec< const svalue * > &inputs)
Definition svalue.h:1859
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1904
unsigned m_num_inputs
Definition svalue.h:1903
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const const_fn_result_svalue * dyn_cast_const_fn_result_svalue() const final override
Definition svalue.h:1877
void print_dump_widget_label(pretty_printer *pp) const final override
Definition svalue.h:316
bool all_zeroes_p() const final override
static tristate eval_condition(const constant_svalue *lhs, enum tree_code op, const constant_svalue *rhs)
enum svalue_kind get_kind() const final override
Definition svalue.h:356
const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const final override
const constant_svalue * dyn_cast_constant_svalue() const final override
Definition svalue.h:358
constant_svalue(symbol::id_t id, tree type, tree cst_expr)
Definition svalue.h:347
tree get_constant() const
Definition svalue.h:372
void print_dump_widget_label(pretty_printer *pp) const final override
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
bool maybe_get_value_range_1(value_range &out) const final override
tree m_cst_expr
Definition svalue.h:387
void dump_to_pp(pretty_printer *pp, bool simple) const final override
void accept(visitor *v) const final override
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
Definition exploded-graph.h:206
Definition svalue.h:671
const initial_svalue * dyn_cast_initial_svalue() const final override
Definition svalue.h:681
const region * get_region() const
Definition svalue.h:697
void accept(visitor *v) const final override
bool initial_value_of_param_p() const
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
const region * m_reg
Definition svalue.h:700
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:679
void print_dump_widget_label(pretty_printer *pp) const final override
initial_svalue(symbol::id_t id, tree type, const region *reg)
Definition svalue.h:673
void dump_to_pp(pretty_printer *pp, bool simple) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:1256
placeholder_svalue(symbol::id_t id, tree type, const char *name)
Definition svalue.h:1251
const char * m_name
Definition svalue.h:1271
const char * get_name() const
Definition svalue.h:1268
void accept(visitor *v) const final override
void print_dump_widget_label(pretty_printer *pp) const final override
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
Definition svalue.h:466
enum poison_kind get_poison_kind() const
Definition svalue.h:519
void accept(visitor *v) const final override
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const final override
const poisoned_svalue * dyn_cast_poisoned_svalue() const final override
Definition svalue.h:502
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:500
bool can_have_associated_state_p() const final override
Definition svalue.h:522
enum poison_kind m_kind
Definition svalue.h:525
poisoned_svalue(enum poison_kind kind, symbol::id_t id, tree type)
Definition svalue.h:497
void print_dump_widget_label(pretty_printer *pp) const final override
Definition region-model.h:746
Definition region-model-manager.h:32
Definition region-model.h:294
Definition svalue.h:229
enum svalue_kind get_kind() const final override
Definition svalue.h:267
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
const region_svalue * dyn_cast_region_svalue() const final override
Definition svalue.h:269
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const region * get_pointee() const
Definition svalue.h:283
static tristate eval_condition(const region_svalue *lhs_ptr, enum tree_code op, const region_svalue *rhs_ptr)
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
void print_dump_widget_label(pretty_printer *pp) const final override
void accept(visitor *v) const final override
region_svalue(symbol::id_t id, tree type, const region *reg)
Definition svalue.h:260
const region * m_reg
Definition svalue.h:290
Definition region.h:126
Definition svalue.h:1004
const repeated_svalue * dyn_cast_repeated_svalue() const final override
Definition svalue.h:1046
const svalue * m_inner_svalue
Definition svalue.h:1073
const svalue * get_inner_svalue() const
Definition svalue.h:1062
bool all_zeroes_p() const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
void print_dump_widget_label(pretty_printer *pp) const final override
void accept(visitor *v) const final override
const svalue * get_outer_size() const
Definition svalue.h:1061
enum svalue_kind get_kind() const final override
Definition svalue.h:1045
const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const final override
repeated_svalue(symbol::id_t id, tree type, const svalue *outer_size, const svalue *inner_svalue)
const svalue * m_outer_size
Definition svalue.h:1072
Definition svalue.h:585
const setjmp_svalue * dyn_cast_setjmp_svalue() const final override
Definition svalue.h:624
void accept(visitor *v) const final override
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:622
setjmp_svalue(const setjmp_record &setjmp_record, symbol::id_t id, tree type)
Definition svalue.h:616
const setjmp_record & get_setjmp_record() const
Definition svalue.h:638
void print_dump_widget_label(pretty_printer *pp) const final override
setjmp_record m_setjmp_record
Definition svalue.h:641
int get_enode_index() const
Definition svalue.h:918
const svalue * get_parent() const
Definition svalue.h:973
const region * m_subregion
Definition svalue.h:978
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
void print_dump_widget_label(pretty_printer *pp) const final override
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
void accept(visitor *v) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:955
const region * get_subregion() const
Definition svalue.h:974
const svalue * m_parent_svalue
Definition svalue.h:977
sub_svalue(symbol::id_t id, tree type, const svalue *parent_svalue, const region *subregion)
const sub_svalue * dyn_cast_sub_svalue() const final override
Definition svalue.h:956
void dump_to_pp(pretty_printer *pp, bool simple) const final override
Definition supergraph.h:281
Definition supergraph.h:224
Definition svalue.h:92
virtual const unaryop_svalue * dyn_cast_unaryop_svalue() const
Definition svalue.h:125
virtual const compound_svalue * dyn_cast_compound_svalue() const
Definition svalue.h:139
virtual void accept(visitor *v) const =0
virtual const asm_output_svalue * dyn_cast_asm_output_svalue() const
Definition svalue.h:143
virtual void dump_to_pp(pretty_printer *pp, bool simple) const =0
virtual const repeated_svalue * dyn_cast_repeated_svalue() const
Definition svalue.h:131
const svalue * extract_bit_range(tree type, const bit_range &subrange, region_model_manager *mgr) const
virtual const widening_svalue * dyn_cast_widening_svalue() const
Definition svalue.h:137
bool live_p(const svalue_set *live_svalues, const region_model *model) const
virtual bool maybe_get_value_range_1(value_range &out) const
const region * maybe_get_deref_base_region() const
virtual const poisoned_svalue * dyn_cast_poisoned_svalue() const
Definition svalue.h:119
tree m_type
Definition svalue.h:222
void dump() const
void dump(bool simple) const
bool involves_p(const svalue *other) const
bool maybe_get_value_range(value_range &out) const
Definition svalue.h:196
label_text get_desc(bool simple=true) const
virtual const unmergeable_svalue * dyn_cast_unmergeable_svalue() const
Definition svalue.h:135
virtual const const_fn_result_svalue * dyn_cast_const_fn_result_svalue() const
Definition svalue.h:145
virtual const region_svalue * dyn_cast_region_svalue() const
Definition svalue.h:115
virtual enum svalue_kind get_kind() const =0
virtual ~svalue()
Definition svalue.h:94
virtual const initial_svalue * dyn_cast_initial_svalue() const
Definition svalue.h:123
virtual const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const
virtual bool can_have_associated_state_p() const
Definition svalue.h:183
tree maybe_get_constant() const
virtual const sub_svalue * dyn_cast_sub_svalue() const
Definition svalue.h:129
const svalue * can_merge_p(const svalue *other, region_model_manager *mgr, model_merger *merger) const
void print_svalue_node_label(pretty_printer *pp) const
virtual const constant_svalue * dyn_cast_constant_svalue() const
Definition svalue.h:117
virtual const conjured_svalue * dyn_cast_conjured_svalue() const
Definition svalue.h:141
static int cmp_ptr_ptr(const void *, const void *)
tree maybe_get_type_from_typeinfo() const
svalue(complexity c, symbol::id_t id, tree type)
Definition svalue.h:207
virtual void print_dump_widget_label(pretty_printer *pp) const =0
virtual const binop_svalue * dyn_cast_binop_svalue() const
Definition svalue.h:127
const svalue * unwrap_any_unmergeable() const
virtual const setjmp_svalue * dyn_cast_setjmp_svalue() const
Definition svalue.h:121
std::unique_ptr< text_art::tree_widget > make_dump_widget(const dump_widget_info &dwi, const char *prefix=nullptr) const
virtual void add_dump_widget_children(text_art::tree_widget &, const dump_widget_info &dwi) const =0
tree get_type() const
Definition svalue.h:96
static int cmp_ptr(const svalue *, const svalue *)
void print(const region_model &model, pretty_printer *pp) const
const svalue * maybe_undo_cast() const
const region * maybe_get_region() const
virtual const bits_within_svalue * dyn_cast_bits_within_svalue() const
Definition svalue.h:133
bool maybe_print_for_user(pretty_printer *pp, const region_model &model, const svalue *outer_sval=nullptr) const
std::unique_ptr< json::value > to_json() const
virtual bool implicitly_live_p(const svalue_set *live_svalues, const region_model *model) const
virtual bool all_zeroes_p() const
unsigned id_t
Definition symbol.h:33
const complexity & get_complexity() const
Definition symbol.h:35
symbol(complexity c, unsigned id)
Definition symbol.h:41
Definition svalue.h:719
void accept(visitor *v) const final override
const svalue * m_arg
Definition svalue.h:789
unaryop_svalue(symbol::id_t id, tree type, enum tree_code op, const svalue *arg)
Definition svalue.h:754
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const svalue * get_arg() const
Definition svalue.h:778
enum tree_code get_op() const
Definition svalue.h:777
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
bool maybe_get_value_range_1(value_range &out) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:761
const unaryop_svalue * dyn_cast_unaryop_svalue() const final override
Definition svalue.h:763
enum tree_code m_op
Definition svalue.h:788
void print_dump_widget_label(pretty_printer *pp) const final override
const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const final override
bool can_have_associated_state_p() const final override
Definition svalue.h:440
unknown_svalue(symbol::id_t id, tree type)
Definition svalue.h:416
void print_dump_widget_label(pretty_printer *pp) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:420
void accept(visitor *v) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
const svalue * maybe_fold_bits_within(tree type, const bit_range &subrange, region_model_manager *mgr) const final override
bool maybe_get_value_range_1(value_range &out) const final override
Definition svalue.h:1202
const unmergeable_svalue * dyn_cast_unmergeable_svalue() const final override
Definition svalue.h:1211
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:1209
void accept(visitor *v) const final override
unmergeable_svalue(symbol::id_t id, const svalue *arg)
Definition svalue.h:1204
const svalue * get_arg() const
Definition svalue.h:1225
void print_dump_widget_label(pretty_printer *pp) const final override
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const svalue * m_arg
Definition svalue.h:1228
Definition region-model.h:223
Definition svalue.h:1297
const supernode * get_snode() const
Definition svalue.h:1371
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const svalue * m_base_sval
Definition svalue.h:1382
const svalue * get_base_svalue() const
Definition svalue.h:1372
widening_svalue(symbol::id_t id, tree type, const supernode *snode, const svalue *base_sval, const svalue *iter_sval)
Definition svalue.h:1342
direction_t
Definition svalue.h:1336
@ DIR_UNKNOWN
Definition svalue.h:1339
@ DIR_DESCENDING
Definition svalue.h:1338
@ DIR_ASCENDING
Definition svalue.h:1337
const widening_svalue * dyn_cast_widening_svalue() const final override
Definition svalue.h:1356
void print_dump_widget_label(pretty_printer *pp) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:1355
const svalue * get_iter_svalue() const
Definition svalue.h:1373
tristate eval_condition_without_cm(enum tree_code op, tree rhs_cst) const
const supernode * m_snode
Definition svalue.h:1381
void add_dump_widget_children(text_art::tree_widget &w, const dump_widget_info &dwi) const final override
void accept(visitor *v) const final override
const svalue * m_iter_sval
Definition svalue.h:1383
enum direction_t get_direction() const
Definition inchash.h:38
void add_int(unsigned v)
Definition inchash.h:55
hashval_t end() const
Definition inchash.h:49
void add_ptr(const void *ptr)
Definition inchash.h:94
Definition pretty-print.h:241
Definition tree-widget.h:32
Definition tristate.h:26
Definition value-range.h:779
bool undefined_p() const
Definition value-range.h:799
union tree_node * tree
Definition coretypes.h:97
static struct string2counter_map map[debug_counter_number_of_counters]
Definition dbgcnt.cc:39
static bool operator==(cfa_reg &cfa, rtx reg)
Definition dwarf2cfi.cc:1164
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2009
tree_code
Definition genmatch.cc:1002
Definition access-diagram.h:30
@ stmt
Definition checker-event.h:38
poison_kind
Definition svalue.h:446
@ uninit
Definition svalue.h:448
@ freed
Definition svalue.h:451
@ popped_stack
Definition svalue.h:457
@ deleted
Definition svalue.h:454
const char * poison_kind_to_str(enum poison_kind)
hash_set< const svalue * > svalue_set
Definition common.h:75
svalue_kind
Definition svalue.h:38
@ SK_BINOP
Definition svalue.h:46
@ SK_REPEATED
Definition svalue.h:48
@ SK_BITS_WITHIN
Definition svalue.h:49
@ SK_INITIAL
Definition svalue.h:44
@ SK_COMPOUND
Definition svalue.h:53
@ SK_ASM_OUTPUT
Definition svalue.h:55
@ SK_UNKNOWN
Definition svalue.h:41
@ SK_SUB
Definition svalue.h:47
@ SK_UNARYOP
Definition svalue.h:45
@ SK_POISONED
Definition svalue.h:42
@ SK_CONSTANT
Definition svalue.h:40
@ SK_PLACEHOLDER
Definition svalue.h:51
@ SK_UNMERGEABLE
Definition svalue.h:50
@ SK_CONJURED
Definition svalue.h:54
@ SK_SETJMP
Definition svalue.h:43
@ SK_CONST_FN_RESULT
Definition svalue.h:56
@ SK_WIDENING
Definition svalue.h:52
@ SK_REGION
Definition svalue.h:39
i
Definition poly-int.h:776
key_t(tree type, const char *asm_string, unsigned output_idx, const vec< const svalue * > &inputs)
Definition svalue.h:1665
unsigned m_num_inputs
Definition svalue.h:1714
bool is_deleted() const
Definition svalue.h:1705
void mark_empty()
Definition svalue.h:1704
hashval_t hash() const
Definition svalue.h:1677
bool is_empty() const
Definition svalue.h:1709
unsigned m_output_idx
Definition svalue.h:1713
void mark_deleted()
Definition svalue.h:1703
const char * m_asm_string
Definition svalue.h:1712
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1715
tree m_type
Definition svalue.h:1711
bool is_empty() const
Definition svalue.h:845
enum tree_code m_op
Definition svalue.h:848
hashval_t hash() const
Definition svalue.h:824
const svalue * m_arg1
Definition svalue.h:850
tree m_type
Definition svalue.h:847
void mark_deleted()
Definition svalue.h:842
key_t(tree type, enum tree_code op, const svalue *arg0, const svalue *arg1)
Definition svalue.h:819
void mark_empty()
Definition svalue.h:843
bool is_deleted() const
Definition svalue.h:844
const svalue * m_arg0
Definition svalue.h:849
Definition store.h:233
bool is_deleted() const
Definition svalue.h:1128
key_t(tree type, const bit_range &bits, const svalue *inner_svalue)
Definition svalue.h:1105
hashval_t hash() const
Definition svalue.h:1111
bool is_empty() const
Definition svalue.h:1129
void mark_empty()
Definition svalue.h:1127
bit_range m_bits
Definition svalue.h:1132
void mark_deleted()
Definition svalue.h:1126
const svalue * m_inner_svalue
Definition svalue.h:1133
tree m_type
Definition svalue.h:1131
Definition complexity.h:31
Definition svalue.h:1428
bool is_deleted() const
Definition svalue.h:1449
tree m_type
Definition svalue.h:1452
void mark_empty()
Definition svalue.h:1448
hashval_t hash() const
Definition svalue.h:1433
bool is_empty() const
Definition svalue.h:1450
key_t(tree type, const binding_map *map_ptr)
Definition svalue.h:1429
const binding_map * m_map_ptr
Definition svalue.h:1453
void mark_deleted()
Definition svalue.h:1447
unsigned m_idx
Definition svalue.h:1593
bool is_deleted() const
Definition svalue.h:1584
void mark_empty()
Definition svalue.h:1583
bool is_empty() const
Definition svalue.h:1588
const gimple * m_stmt
Definition svalue.h:1591
void mark_deleted()
Definition svalue.h:1582
key_t(tree type, const gimple *stmt, const region *id_reg, unsigned idx)
Definition svalue.h:1559
tree m_type
Definition svalue.h:1590
hashval_t hash() const
Definition svalue.h:1563
const region * m_id_reg
Definition svalue.h:1592
void mark_empty()
Definition svalue.h:1846
tree m_fndecl
Definition svalue.h:1854
hashval_t hash() const
Definition svalue.h:1822
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1856
bool is_empty() const
Definition svalue.h:1851
tree m_type
Definition svalue.h:1853
void mark_deleted()
Definition svalue.h:1845
unsigned m_num_inputs
Definition svalue.h:1855
bool is_deleted() const
Definition svalue.h:1847
key_t(tree type, tree fndecl, const vec< const svalue * > &inputs)
Definition svalue.h:1811
bool is_empty() const
Definition svalue.h:341
void mark_deleted()
Definition svalue.h:338
bool is_deleted() const
Definition svalue.h:340
key_t(tree type, tree cst)
Definition svalue.h:321
tree m_cst
Definition svalue.h:344
hashval_t hash() const
Definition svalue.h:325
void mark_empty()
Definition svalue.h:339
tree m_type
Definition svalue.h:343
bool operator==(const key_t &other) const
Definition svalue.h:333
Definition region-model.h:1202
void mark_deleted()
Definition svalue.h:488
bool is_deleted() const
Definition svalue.h:490
hashval_t hash() const
Definition svalue.h:475
enum poison_kind m_kind
Definition svalue.h:493
bool is_empty() const
Definition svalue.h:491
key_t(enum poison_kind kind, tree type)
Definition svalue.h:471
bool operator==(const key_t &other) const
Definition svalue.h:483
tree m_type
Definition svalue.h:494
void mark_empty()
Definition svalue.h:489
bool operator==(const key_t &other) const
Definition svalue.h:246
bool is_deleted() const
Definition svalue.h:253
bool is_empty() const
Definition svalue.h:254
key_t(tree type, const region *reg)
Definition svalue.h:234
void mark_deleted()
Definition svalue.h:251
tree m_type
Definition svalue.h:256
const region * m_reg
Definition svalue.h:257
void mark_empty()
Definition svalue.h:252
hashval_t hash() const
Definition svalue.h:238
tree m_type
Definition svalue.h:1036
void mark_deleted()
Definition svalue.h:1031
const svalue * m_outer_size
Definition svalue.h:1037
hashval_t hash() const
Definition svalue.h:1015
void mark_empty()
Definition svalue.h:1032
bool is_empty() const
Definition svalue.h:1034
key_t(tree type, const svalue *outer_size, const svalue *inner_svalue)
Definition svalue.h:1009
const svalue * m_inner_svalue
Definition svalue.h:1038
bool is_deleted() const
Definition svalue.h:1033
Definition svalue.h:550
setjmp_record(const exploded_node *enode, const superedge *sedge, const gcall &setjmp_call)
Definition svalue.h:551
static int cmp(const setjmp_record &rec1, const setjmp_record &rec2)
const exploded_node * m_enode
Definition svalue.h:574
const gcall * m_setjmp_call
Definition svalue.h:576
void add_to_hash(inchash::hash *hstate) const
Definition svalue.h:565
const superedge * m_sedge
Definition svalue.h:575
key_t(const setjmp_record &record, tree type)
Definition svalue.h:590
hashval_t hash() const
Definition svalue.h:594
tree m_type
Definition svalue.h:613
setjmp_record m_record
Definition svalue.h:612
void mark_deleted()
Definition svalue.h:607
void mark_empty()
Definition svalue.h:608
bool is_deleted() const
Definition svalue.h:609
bool is_empty() const
Definition svalue.h:610
void mark_empty()
Definition svalue.h:944
void mark_deleted()
Definition svalue.h:943
bool is_deleted() const
Definition svalue.h:945
hashval_t hash() const
Definition svalue.h:927
tree m_type
Definition svalue.h:948
const svalue * m_parent_svalue
Definition svalue.h:949
key_t(tree type, const svalue *parent_svalue, const region *subregion)
Definition svalue.h:923
const region * m_subregion
Definition svalue.h:950
bool is_empty() const
Definition svalue.h:946
tree m_type
Definition svalue.h:749
bool is_deleted() const
Definition svalue.h:746
void mark_empty()
Definition svalue.h:745
bool is_empty() const
Definition svalue.h:747
hashval_t hash() const
Definition svalue.h:728
enum tree_code m_op
Definition svalue.h:750
const svalue * m_arg
Definition svalue.h:751
void mark_deleted()
Definition svalue.h:744
key_t(tree type, enum tree_code op, const svalue *arg)
Definition svalue.h:724
bool is_empty() const
Definition svalue.h:1327
const supernode * m_snode
Definition svalue.h:1330
const svalue * m_base_sval
Definition svalue.h:1331
void mark_deleted()
Definition svalue.h:1324
tree m_type
Definition svalue.h:1329
hashval_t hash() const
Definition svalue.h:1308
bool is_deleted() const
Definition svalue.h:1326
key_t(tree type, const supernode *snode, const svalue *base_sval, const svalue *iter_sval)
Definition svalue.h:1302
const svalue * m_iter_sval
Definition svalue.h:1332
void mark_empty()
Definition svalue.h:1325
static const bool empty_zero_p
Definition svalue.h:1789
static const bool empty_zero_p
Definition svalue.h:908
static const bool empty_zero_p
Definition svalue.h:1185
static const bool empty_zero_p
Definition svalue.h:1510
static const bool empty_zero_p
Definition svalue.h:1643
static const bool empty_zero_p
Definition svalue.h:1920
static const bool empty_zero_p
Definition svalue.h:403
static const bool empty_zero_p
Definition svalue.h:541
static const bool empty_zero_p
Definition svalue.h:306
static const bool empty_zero_p
Definition svalue.h:1089
static const bool empty_zero_p
Definition svalue.h:657
static const bool empty_zero_p
Definition svalue.h:994
static const bool empty_zero_p
Definition svalue.h:805
static const bool empty_zero_p
Definition svalue.h:1399
Definition hash-traits.h:466
Definition gimple.h:352
Definition gimple.h:221
Definition collect2.cc:168
static bool test(const U *p)
Definition is-a.h:211
Definition is-a.h:194
static bool test(U *p)
Definition common.h:540
Definition dump-widget-info.h:31
Definition gengtype.h:252
Definition vec.h:450
#define gcc_assert(EXPR)
Definition system.h:817
#define TREE_TYPE(NODE)
Definition tree.h:513
#define CONSTANT_CLASS_P(NODE)
Definition tree.h:216
#define NULL_TREE
Definition tree.h:318