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 const region_model &model);
289
290 private:
291 const region *m_reg;
292};
293
294} // namespace ana
295
296template <>
297template <>
298inline bool
300{
301 return sval->get_kind () == SK_REGION;
302}
303
305: public member_function_hash_traits<region_svalue::key_t>
306{
307 static const bool empty_zero_p = false;
308};
309
310namespace ana {
311
312/* Concrete subclass of svalue representing a specific constant value.
313 The type will either be the same as that of the underlying tree constant,
314 or NULL_TREE indicating the constant is intended to be "typeless". */
315
317{
318public:
319 /* A support class for uniquifying instances of region_svalue. */
320 struct key_t
321 {
323 : m_type (type), m_cst (cst)
324 {}
325
326 hashval_t hash () const
327 {
328 inchash::hash hstate;
329 hstate.add_ptr (m_type);
330 hstate.add_ptr (m_cst);
331 return hstate.end ();
332 }
333
334 bool operator== (const key_t &other) const
335 {
336 return (m_type == other.m_type && m_cst == other.m_cst);
337 }
338
339 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
340 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
341 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
342 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
343
346 };
347
349 : svalue (complexity (1, 1), id, type),
350 m_cst_expr (cst_expr)
351 {
352 gcc_assert (cst_expr);
353 gcc_assert (CONSTANT_CLASS_P (cst_expr));
354 gcc_assert (type == TREE_TYPE (cst_expr) || type == NULL_TREE);
355 }
356
357 enum svalue_kind get_kind () const final override { return SK_CONSTANT; }
358 const constant_svalue *
359 dyn_cast_constant_svalue () const final override { return this; }
360
361 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
362
363 void
364 print_dump_widget_label (pretty_printer *pp) const final override;
365 void
367 const dump_widget_info &dwi) const final override;
368
369 void accept (visitor *v) const final override;
371 const region_model *) const final override;
372
373 tree get_constant () const { return m_cst_expr; }
375 enum tree_code op,
376 const constant_svalue *rhs);
377
378 const svalue *
380 const bit_range &subrange,
381 region_model_manager *mgr) const final override;
382
383 bool all_zeroes_p () const final override;
384
385 bool maybe_get_value_range_1 (value_range &out) const final override;
386
387 private:
389};
390
391} // namespace ana
392
393template <>
394template <>
395inline bool
396is_a_helper <const constant_svalue *>::test (const svalue *sval)
397{
398 return sval->get_kind () == SK_CONSTANT;
399}
400
402: public member_function_hash_traits<constant_svalue::key_t>
403{
404 static const bool empty_zero_p = false;
405};
406
407namespace ana {
408
409/* Concrete subclass of svalue representing an unknowable value, the bottom
410 value when thinking of svalues as a lattice.
411 This is a singleton (w.r.t. its manager): there is a single unknown_svalue
412 per type. Self-comparisons of such instances yield "unknown". */
413
414class unknown_svalue : public svalue
415{
416public:
420
421 enum svalue_kind get_kind () const final override { return SK_UNKNOWN; }
422
423 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
424
425 void
426 print_dump_widget_label (pretty_printer *pp) const final override;
427 void
429 const dump_widget_info &dwi) const final override;
430
431 void accept (visitor *v) const final override;
432
433 const svalue *
435 const bit_range &subrange,
436 region_model_manager *mgr) const final override;
437
438 bool maybe_get_value_range_1 (value_range &out) const final override;
439
440 /* Unknown values are singletons per-type, so can't have state. */
441 bool can_have_associated_state_p () const final override { return false; }
442};
443
444/* An enum describing a particular kind of "poisoned" value. */
445
446enum class poison_kind
447{
448 /* For use to describe uninitialized memory. */
450
451 /* For use to describe freed memory. */
453
454 /* For use to describe deleted memory. */
456
457 /* For use on pointers to regions within popped stack frames. */
459};
460
461extern const char *poison_kind_to_str (enum poison_kind);
462
463/* Concrete subclass of svalue representing a value that should not
464 be used (e.g. uninitialized memory, freed memory). */
465
467{
468public:
469 /* A support class for uniquifying instances of poisoned_svalue. */
470 struct key_t
471 {
473 : m_kind (kind), m_type (type)
474 {}
475
476 hashval_t hash () const
477 {
478 inchash::hash hstate;
479 hstate.add_int (static_cast<int> (m_kind));
480 hstate.add_ptr (m_type);
481 return hstate.end ();
482 }
483
484 bool operator== (const key_t &other) const
485 {
486 return (m_kind == other.m_kind && m_type == other.m_type);
487 }
488
489 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
490 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
491 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
492 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
493
496 };
497
499 : svalue (complexity (1, 1), id, type), m_kind (kind) {}
500
501 enum svalue_kind get_kind () const final override { return SK_POISONED; }
502 const poisoned_svalue *
503 dyn_cast_poisoned_svalue () const final override { return this; }
504
505 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
506
507 void
508 print_dump_widget_label (pretty_printer *pp) const final override;
509 void
511 const dump_widget_info &dwi) const final override;
512
513 void accept (visitor *v) const final override;
514
515 const svalue *
517 const bit_range &subrange,
518 region_model_manager *mgr) const final override;
519
520 enum poison_kind get_poison_kind () const { return m_kind; }
521
522 /* Poisoned svalues are singletons per-type, so can't have state. */
523 bool can_have_associated_state_p () const final override { return false; }
524
525 private:
527};
528
529} // namespace ana
530
531template <>
532template <>
533inline bool
535{
536 return sval->get_kind () == SK_POISONED;
537}
538
540: public member_function_hash_traits<poisoned_svalue::key_t>
541{
542 static const bool empty_zero_p = false;
543};
544
545namespace ana {
546
547/* A bundle of information recording a setjmp/sigsetjmp call, corresponding
548 roughly to a jmp_buf. */
549
551{
553 const superedge *sedge,
554 const gcall &setjmp_call)
555 : m_enode (enode), m_sedge (sedge), m_setjmp_call (&setjmp_call)
556 {
557 }
558
559 bool operator== (const setjmp_record &other) const
560 {
561 return (m_enode == other.m_enode
562 && m_sedge == other.m_sedge
563 && m_setjmp_call == other.m_setjmp_call);
564 }
565
566 void add_to_hash (inchash::hash *hstate) const
567 {
568 hstate->add_ptr (m_enode);
569 hstate->add_ptr (m_sedge);
570 hstate->add_ptr (m_setjmp_call);
571 }
572
573 static int cmp (const setjmp_record &rec1, const setjmp_record &rec2);
574
578 // non-null, but we can't use a reference since we're putting these in a hash_map
579};
580
581/* Concrete subclass of svalue representing buffers for setjmp/sigsetjmp,
582 so that longjmp/siglongjmp can potentially "return" to an entirely
583 different function. */
584
585class setjmp_svalue : public svalue
586{
587public:
588 /* A support class for uniquifying instances of poisoned_svalue. */
589 struct key_t
590 {
591 key_t (const setjmp_record &record, tree type)
592 : m_record (record), m_type (type)
593 {}
594
595 hashval_t hash () const
596 {
597 inchash::hash hstate;
598 m_record.add_to_hash (&hstate);
599 hstate.add_ptr (m_type);
600 return hstate.end ();
601 }
602
603 bool operator== (const key_t &other) const
604 {
605 return (m_record == other.m_record && m_type == other.m_type);
606 }
607
608 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
609 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
610 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
611 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
612
615 };
616
622
623 enum svalue_kind get_kind () const final override { return SK_SETJMP; }
624 const setjmp_svalue *
625 dyn_cast_setjmp_svalue () const final override { return this; }
626
627 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
628
629 void
630 print_dump_widget_label (pretty_printer *pp) const final override;
631 void
633 const dump_widget_info &dwi) const final override;
634
635 void accept (visitor *v) const final override;
636
637 int get_enode_index () const;
638
640
641 private:
643};
644
645} // namespace ana
646
647template <>
648template <>
649inline bool
651{
652 return sval->get_kind () == SK_SETJMP;
653}
654
656: public member_function_hash_traits<setjmp_svalue::key_t>
657{
658 static const bool empty_zero_p = false;
659};
660
661namespace ana {
662
663/* Concrete subclass of svalue representing the initial value of a
664 specific region.
665
666 This represents the initial value at the start of the analysis path,
667 as opposed to the first time the region is accessed during the path.
668 Hence as soon as we have a call to an unknown function, all previously
669 unmodelled globals become implicitly "unknown" rathen than "initial". */
670
671class initial_svalue : public svalue
672{
673public:
675 : svalue (complexity (reg), id, type), m_reg (reg)
676 {
677 gcc_assert (m_reg != nullptr);
678 }
679
680 enum svalue_kind get_kind () const final override { return SK_INITIAL; }
681 const initial_svalue *
682 dyn_cast_initial_svalue () const final override { return this; }
683
684 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
685
686 void
687 print_dump_widget_label (pretty_printer *pp) const final override;
688 void
690 const dump_widget_info &dwi) const final override;
691
692 void accept (visitor *v) const final override;
694 const region_model *) const final override;
695
697
698 const region *get_region () const { return m_reg; }
699
700 private:
701 const region *m_reg;
702};
703
704} // namespace ana
705
706template <>
707template <>
708inline bool
710{
711 return sval->get_kind () == SK_INITIAL;
712}
713
714namespace ana {
715
716/* Concrete subclass of svalue representing a unary operation on
717 another svalues (e.g. a cast). */
718
719class unaryop_svalue : public svalue
720{
721public:
722 /* A support class for uniquifying instances of unaryop_svalue. */
723 struct key_t
724 {
725 key_t (tree type, enum tree_code op, const svalue *arg)
726 : m_type (type), m_op (op), m_arg (arg)
727 {}
728
729 hashval_t hash () const
730 {
731 inchash::hash hstate;
732 hstate.add_ptr (m_type);
733 hstate.add_int (m_op);
734 hstate.add_ptr (m_arg);
735 return hstate.end ();
736 }
737
738 bool operator== (const key_t &other) const
739 {
740 return (m_type == other.m_type
741 && m_op == other.m_op
742 && m_arg == other.m_arg);
743 }
744
745 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
746 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
747 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
748 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
749
752 const svalue *m_arg;
753 };
754
756 const svalue *arg)
757 : svalue (complexity (arg), id, type), m_op (op), m_arg (arg)
758 {
760 }
761
762 enum svalue_kind get_kind () const final override { return SK_UNARYOP; }
763 const unaryop_svalue *
764 dyn_cast_unaryop_svalue () const final override { return this; }
765
766 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
767
768 void
769 print_dump_widget_label (pretty_printer *pp) const final override;
770 void
772 const dump_widget_info &dwi) const final override;
773
774 void accept (visitor *v) const final override;
776 const region_model *) const final override;
777
778 enum tree_code get_op () const { return m_op; }
779 const svalue *get_arg () const { return m_arg; }
780
781 const svalue *
783 const bit_range &subrange,
784 region_model_manager *mgr) const final override;
785
786 bool maybe_get_value_range_1 (value_range &out) const final override;
787
788 private:
790 const svalue *m_arg;
791};
792
793} // namespace ana
794
795template <>
796template <>
797inline bool
799{
800 return sval->get_kind () == SK_UNARYOP;
801}
802
804: public member_function_hash_traits<unaryop_svalue::key_t>
805{
806 static const bool empty_zero_p = false;
807};
808
809namespace ana {
810
811/* Concrete subclass of svalue representing a binary operation of
812 two svalues. */
813
814class binop_svalue : public svalue
815{
816public:
817 /* A support class for uniquifying instances of binop_svalue. */
818 struct key_t
819 {
821 const svalue *arg0, const svalue *arg1)
822 : m_type (type), m_op (op), m_arg0 (arg0), m_arg1 (arg1)
823 {}
824
825 hashval_t hash () const
826 {
827 inchash::hash hstate;
828 hstate.add_ptr (m_type);
829 hstate.add_int (m_op);
830 hstate.add_ptr (m_arg0);
831 hstate.add_ptr (m_arg1);
832 return hstate.end ();
833 }
834
835 bool operator== (const key_t &other) const
836 {
837 return (m_type == other.m_type
838 && m_op == other.m_op
839 && m_arg0 == other.m_arg0
840 && m_arg1 == other.m_arg1);
841 }
842
843 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
844 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
845 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
846 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
847
852 };
853
855 const svalue *arg0, const svalue *arg1)
856 : svalue (complexity::from_pair (arg0->get_complexity (),
857 arg1->get_complexity ()),
858 id,
859 type),
860 m_op (op), m_arg0 (arg0), m_arg1 (arg1)
861 {
864 }
865
866 enum svalue_kind get_kind () const final override { return SK_BINOP; }
867 const binop_svalue *dyn_cast_binop_svalue () const final override
868 {
869 return this;
870 }
871
872 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
873
874 void
875 print_dump_widget_label (pretty_printer *pp) const final override;
876 void
878 const dump_widget_info &dwi) const final override;
879
880 void accept (visitor *v) const final override;
882 const region_model *) const final override;
883
884 bool maybe_get_value_range_1 (value_range &out) const final override;
885
886 enum tree_code get_op () const { return m_op; }
887 const svalue *get_arg0 () const { return m_arg0; }
888 const svalue *get_arg1 () const { return m_arg1; }
889
890 private:
894};
895
896} // namespace ana
897
898template <>
899template <>
900inline bool
902{
903 return sval->get_kind () == SK_BINOP;
904}
905
907: public member_function_hash_traits<binop_svalue::key_t>
908{
909 static const bool empty_zero_p = false;
910};
911
912namespace ana {
913
914/* Concrete subclass of svalue representing the result of accessing a subregion
915 of another svalue (the value of a component/field of a struct, or an element
916 from an array). */
917
918class sub_svalue : public svalue
919{
920public:
921 /* A support class for uniquifying instances of sub_svalue. */
922 struct key_t
923 {
924 key_t (tree type, const svalue *parent_svalue, const region *subregion)
925 : m_type (type), m_parent_svalue (parent_svalue), m_subregion (subregion)
926 {}
927
928 hashval_t hash () const
929 {
930 inchash::hash hstate;
931 hstate.add_ptr (m_type);
932 hstate.add_ptr (m_parent_svalue);
933 hstate.add_ptr (m_subregion);
934 return hstate.end ();
935 }
936
937 bool operator== (const key_t &other) const
938 {
939 return (m_type == other.m_type
940 && m_parent_svalue == other.m_parent_svalue
941 && m_subregion == other.m_subregion);
942 }
943
944 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
945 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
946 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
947 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
948
952 };
953 sub_svalue (symbol::id_t id, tree type, const svalue *parent_svalue,
954 const region *subregion);
955
956 enum svalue_kind get_kind () const final override { return SK_SUB; }
957 const sub_svalue *dyn_cast_sub_svalue () const final override
958 {
959 return this;
960 }
961
962 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
963
964 void
965 print_dump_widget_label (pretty_printer *pp) const final override;
966 void
968 const dump_widget_info &dwi) const final override;
969
970 void accept (visitor *v) const final override;
972 const region_model *) const final override;
973
974 const svalue *get_parent () const { return m_parent_svalue; }
975 const region *get_subregion () const { return m_subregion; }
976
977 private:
980};
981
982} // namespace ana
983
984template <>
985template <>
986inline bool
988{
989 return sval->get_kind () == SK_SUB;
990}
991
993: public member_function_hash_traits<sub_svalue::key_t>
994{
995 static const bool empty_zero_p = false;
996};
997
998namespace ana {
999
1000/* Concrete subclass of svalue representing repeating an inner svalue
1001 (possibly not a whole number of times) to fill a larger region of
1002 type TYPE of size OUTER_SIZE bytes. */
1003
1005{
1006public:
1007 /* A support class for uniquifying instances of repeated_svalue. */
1008 struct key_t
1009 {
1011 const svalue *outer_size,
1012 const svalue *inner_svalue)
1013 : m_type (type), m_outer_size (outer_size), m_inner_svalue (inner_svalue)
1014 {}
1015
1016 hashval_t hash () const
1017 {
1018 inchash::hash hstate;
1019 hstate.add_ptr (m_type);
1020 hstate.add_ptr (m_outer_size);
1021 hstate.add_ptr (m_inner_svalue);
1022 return hstate.end ();
1023 }
1024
1025 bool operator== (const key_t &other) const
1026 {
1027 return (m_type == other.m_type
1028 && m_outer_size == other.m_outer_size
1029 && m_inner_svalue == other.m_inner_svalue);
1030 }
1031
1032 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1033 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1034 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1035 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1036
1040 };
1042 tree type,
1043 const svalue *outer_size,
1044 const svalue *inner_svalue);
1045
1046 enum svalue_kind get_kind () const final override { return SK_REPEATED; }
1048 {
1049 return this;
1050 }
1051
1052 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1053
1054 void
1055 print_dump_widget_label (pretty_printer *pp) const final override;
1056 void
1058 const dump_widget_info &dwi) const final override;
1059
1060 void accept (visitor *v) const final override;
1061
1062 const svalue *get_outer_size () const { return m_outer_size; }
1063 const svalue *get_inner_svalue () const { return m_inner_svalue; }
1064
1065 bool all_zeroes_p () const final override;
1066
1067 const svalue *
1069 const bit_range &subrange,
1070 region_model_manager *mgr) const final override;
1071
1072 private:
1075};
1076
1077} // namespace ana
1078
1079template <>
1080template <>
1081inline bool
1082is_a_helper <const repeated_svalue *>::test (const svalue *sval)
1083{
1084 return sval->get_kind () == SK_REPEATED;
1085}
1086
1088: public member_function_hash_traits<repeated_svalue::key_t>
1089{
1090 static const bool empty_zero_p = false;
1091};
1092
1093namespace ana {
1094
1095/* A range of bits/bytes within another svalue
1096 e.g. bytes 5-39 of INITIAL_SVALUE(R).
1097 These can be generated for prefixes and suffixes when part of a binding
1098 is clobbered, so that we don't lose too much information. */
1099
1101{
1102public:
1103 /* A support class for uniquifying instances of bits_within_svalue. */
1104 struct key_t
1105 {
1107 const bit_range &bits,
1108 const svalue *inner_svalue)
1109 : m_type (type), m_bits (bits), m_inner_svalue (inner_svalue)
1110 {}
1111
1112 hashval_t hash () const
1113 {
1114 inchash::hash hstate;
1115 hstate.add_ptr (m_type);
1116 hstate.add_ptr (m_inner_svalue);
1117 return hstate.end ();
1118 }
1119
1120 bool operator== (const key_t &other) const
1121 {
1122 return (m_type == other.m_type
1123 && m_bits == other.m_bits
1124 && m_inner_svalue == other.m_inner_svalue);
1125 }
1126
1127 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1128 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1129 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1130 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1131
1135 };
1137 tree type,
1138 const bit_range &bits,
1139 const svalue *inner_svalue);
1140
1141 enum svalue_kind get_kind () const final override { return SK_BITS_WITHIN; }
1142 const bits_within_svalue *
1144 {
1145 return this;
1146 }
1147
1148 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1149
1150 void
1151 print_dump_widget_label (pretty_printer *pp) const final override;
1152 void
1154 const dump_widget_info &dwi) const final override;
1155
1156 void accept (visitor *v) const final override;
1158 const region_model *) const final override;
1159
1160 const bit_range &get_bits () const { return m_bits; }
1161 const svalue *get_inner_svalue () const { return m_inner_svalue; }
1162
1163 const svalue *
1165 const bit_range &subrange,
1166 region_model_manager *mgr) const final override;
1167
1168 private:
1171};
1172
1173} // namespace ana
1174
1175template <>
1176template <>
1177inline bool
1179{
1180 return sval->get_kind () == SK_BITS_WITHIN;
1181}
1182
1184: public member_function_hash_traits<bits_within_svalue::key_t>
1185{
1186 static const bool empty_zero_p = false;
1187};
1188
1189namespace ana {
1190
1191/* Concrete subclass of svalue: decorate another svalue,
1192 so that the resulting svalue can be identified as being
1193 "interesting to control flow".
1194 For example, consider the return value from setjmp. We
1195 don't want to merge states in which the result is 0 with
1196 those in which the result is non-zero. By using an
1197 unmergeable_svalue for the result, we can inhibit such merges
1198 and have separate exploded nodes for those states, keeping
1199 the first and second returns from setjmp distinct in the exploded
1200 graph. */
1201
1203{
1204public:
1206 : svalue (complexity (arg), id, arg->get_type ()), m_arg (arg)
1207 {
1208 }
1209
1210 enum svalue_kind get_kind () const final override { return SK_UNMERGEABLE; }
1211 const unmergeable_svalue *
1212 dyn_cast_unmergeable_svalue () const final override { return this; }
1213
1214 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1215
1216 void
1217 print_dump_widget_label (pretty_printer *pp) const final override;
1218 void
1220 const dump_widget_info &dwi) const final override;
1221
1222 void accept (visitor *v) const final override;
1224 const region_model *) const final override;
1225
1226 const svalue *get_arg () const { return m_arg; }
1227
1228 private:
1230};
1231
1232} // namespace ana
1233
1234template <>
1235template <>
1236inline bool
1238{
1239 return sval->get_kind () == SK_UNMERGEABLE;
1240}
1241
1242namespace ana {
1243
1244/* Concrete subclass of svalue for use in selftests, where
1245 we want a specific but unknown svalue.
1246 Unlike other svalue subclasses these aren't managed by
1247 region_model_manager. */
1248
1250{
1251public:
1253 : svalue (complexity (1, 1), id, type), m_name (name)
1254 {
1255 }
1256
1257 enum svalue_kind get_kind () const final override { return SK_PLACEHOLDER; }
1258
1259 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1260
1261 void
1262 print_dump_widget_label (pretty_printer *pp) const final override;
1263 void
1265 const dump_widget_info &dwi) const final override;
1266
1267 void accept (visitor *v) const final override;
1268
1269 const char *get_name () const { return m_name; }
1270
1271 private:
1272 const char *m_name;
1273};
1274
1275} // namespace ana
1276
1277template <>
1278template <>
1279inline bool
1281{
1282 return sval->get_kind () == SK_PLACEHOLDER;
1283}
1284
1285namespace ana {
1286
1287/* Concrete subclass of svalue representing a "widening" seen when merging
1288 states, widening from a base value to {base value, iter value} and thus
1289 representing a possible fixed point in an iteration from the base to
1290 +ve infinity, or -ve infinity, and thus useful for representing a value
1291 within a loop.
1292 We also need to capture the program_point at which the merger happens,
1293 so that distinguish between different iterators, and thus handle
1294 nested loops. (currently we capture the function_point instead, for
1295 simplicity of hashing). */
1296
1298{
1299public:
1300 /* A support class for uniquifying instances of widening_svalue. */
1301 struct key_t
1302 {
1303 key_t (tree type, const supernode *snode,
1304 const svalue *base_sval, const svalue *iter_sval)
1305 : m_type (type), m_snode (snode),
1306 m_base_sval (base_sval), m_iter_sval (iter_sval)
1307 {}
1308
1309 hashval_t hash () const
1310 {
1311 inchash::hash hstate;
1312 hstate.add_ptr (m_base_sval);
1313 hstate.add_ptr (m_iter_sval);
1314 return hstate.end ();
1315 }
1316
1317 bool operator== (const key_t &other) const
1318 {
1319 return (m_type == other.m_type
1320 && m_snode == other.m_snode
1321 && m_base_sval == other.m_base_sval
1322 && m_iter_sval == other.m_iter_sval);
1323 }
1324
1325 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1326 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1327 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1328 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1329
1334 };
1335
1342
1344 const svalue *base_sval, const svalue *iter_sval)
1345 : svalue (complexity::from_pair (base_sval->get_complexity (),
1346 iter_sval->get_complexity ()),
1347 id,
1348 type),
1349 m_snode (snode),
1350 m_base_sval (base_sval), m_iter_sval (iter_sval)
1351 {
1354 }
1355
1356 enum svalue_kind get_kind () const final override { return SK_WIDENING; }
1358 {
1359 return this;
1360 }
1361
1362 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1363
1364 void
1365 print_dump_widget_label (pretty_printer *pp) const final override;
1366 void
1368 const dump_widget_info &dwi) const final override;
1369
1370 void accept (visitor *v) const final override;
1371
1372 const supernode *get_snode () const { return m_snode; }
1373 const svalue *get_base_svalue () const { return m_base_sval; }
1374 const svalue *get_iter_svalue () const { return m_iter_sval; }
1375
1377
1379 tree rhs_cst) const;
1380
1381 private:
1385};
1386
1387} // namespace ana
1388
1389template <>
1390template <>
1391inline bool
1393{
1394 return sval->get_kind () == SK_WIDENING;
1395}
1396
1398: public member_function_hash_traits<widening_svalue::key_t>
1399{
1400 static const bool empty_zero_p = false;
1401};
1402
1403namespace ana {
1404
1405/* Concrete subclass of svalue representing a mapping of bit-ranges
1406 to svalues, analogous to a cluster within the store, but without
1407 symbolic keys.
1408
1409 This is for use in places where we want to represent a store-like
1410 mapping, but are required to use an svalue, such as when handling
1411 compound assignments and compound return values.
1412
1413 Instances of this class shouldn't be bound as-is into the store;
1414 instead they should be unpacked. Similarly, they should not be
1415 nested. */
1416
1418{
1419public:
1422
1423 /* A support class for uniquifying instances of compound_svalue.
1424 Note that to avoid copies, keys store pointers to
1425 concrete_binding_map, rather than the maps themselves. */
1426 struct key_t
1427 {
1429 : m_type (type), m_map_ptr (map_ptr)
1430 {}
1431
1432 hashval_t hash () const
1433 {
1434 inchash::hash hstate;
1435 hstate.add_ptr (m_type);
1436 //hstate.add_ptr (m_map_ptr); // TODO
1437 return hstate.end ();
1438 }
1439
1440 bool operator== (const key_t &other) const
1441 {
1442 return (m_type == other.m_type
1443 && *m_map_ptr == *other.m_map_ptr);
1444 }
1445
1446 void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
1447 void mark_empty () { m_type = reinterpret_cast<tree> (2); }
1448 bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
1449 bool is_empty () const { return m_type == reinterpret_cast<tree> (2); }
1450
1453 };
1454
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 concrete_binding_map &
1475 get_concrete_bindings () const { return m_map; }
1476
1477 const_iterator_t begin () const { return m_map.begin (); }
1478 const_iterator_t end () const { return m_map.end (); }
1479 iterator_t begin () { return m_map.begin (); }
1480 iterator_t end () { return m_map.end (); }
1481
1482 struct key_t make_key () const
1483 {
1484 return key_t (get_type (), &m_map);
1485 }
1486
1487 const svalue *
1489 const bit_range &subrange,
1490 region_model_manager *mgr) const final override;
1491
1492 private:
1494};
1495
1496} // namespace ana
1497
1498template <>
1499template <>
1500inline bool
1502{
1503 return sval->get_kind () == SK_COMPOUND;
1504}
1505
1507: public member_function_hash_traits<compound_svalue::key_t>
1508{
1509 static const bool empty_zero_p = false;
1510};
1511
1512namespace ana {
1513
1514/* A bundle of state for purging information from a program_state about
1515 a conjured_svalue. We pass this whenever calling
1516 get_or_create_conjured_svalue, so that if the program_state already
1517 has information about this conjured_svalue on an execution path, we
1518 can purge that information, to avoid the analyzer confusing the two
1519 values as being the same. */
1520
1522{
1523public:
1525 : m_model (model), m_ctxt (ctxt)
1526 {
1527 }
1528 void purge (const conjured_svalue *sval) const;
1529
1530private:
1533};
1534
1535/* A defined value arising from a statement, where we want to identify a
1536 particular unknown value, rather than resorting to the unknown_value
1537 singleton, so that the value can have sm-state.
1538
1539 Comparisons of variables that share the same conjured_svalue are known
1540 to be equal, even if we don't know what the value is.
1541
1542 For example, this is used for the values of regions that may have been
1543 touched when calling an unknown function.
1544
1545 The value captures a region as well as a stmt in order to avoid falsely
1546 aliasing the various values that could arise in one statement. For
1547 example, after:
1548 unknown_fn (&a, &b);
1549 we want values to clobber a and b with, but we don't want to use the
1550 same value, or it would falsely implicitly assume that a == b. */
1551
1553{
1554public:
1555 /* A support class for uniquifying instances of conjured_svalue. */
1556 struct key_t
1557 {
1558 key_t (tree type, const gimple *stmt, const region *id_reg, unsigned idx)
1559 : m_type (type), m_stmt (stmt), m_id_reg (id_reg), m_idx (idx)
1560 {}
1561
1562 hashval_t hash () const
1563 {
1564 inchash::hash hstate;
1565 hstate.add_ptr (m_type);
1566 hstate.add_ptr (m_stmt);
1567 hstate.add_ptr (m_id_reg);
1568 return hstate.end ();
1569 }
1570
1571 bool operator== (const key_t &other) const
1572 {
1573 return (m_type == other.m_type
1574 && m_stmt == other.m_stmt
1575 && m_id_reg == other.m_id_reg
1576 && m_idx == other.m_idx);
1577 }
1578
1579 /* Use m_stmt to mark empty/deleted, as m_type can be NULL_TREE for
1580 legitimate instances. */
1581 void mark_deleted () { m_stmt = reinterpret_cast<const gimple *> (1); }
1582 void mark_empty () { m_stmt = nullptr; }
1583 bool is_deleted () const
1584 {
1585 return m_stmt == reinterpret_cast<const gimple *> (1);
1586 }
1587 bool is_empty () const { return m_stmt == nullptr; }
1588
1592 unsigned m_idx;
1593 };
1594
1596 const region *id_reg, unsigned idx)
1597 : svalue (complexity (id_reg), id, type),
1598 m_stmt (stmt), m_id_reg (id_reg), m_idx (idx)
1599 {
1600 gcc_assert (m_stmt != nullptr);
1601 }
1602
1603 enum svalue_kind get_kind () const final override { return SK_CONJURED; }
1605 {
1606 return this;
1607 }
1608
1609 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1610
1611 void
1612 print_dump_widget_label (pretty_printer *pp) const final override;
1613 void
1615 const dump_widget_info &dwi) const final override;
1616
1617 void accept (visitor *v) const final override;
1618
1619 const gimple *get_stmt () const { return m_stmt; }
1620 const region *get_id_region () const { return m_id_reg; }
1621 bool lhs_value_p () const;
1622
1623 private:
1626 unsigned m_idx;
1627};
1628
1629} // namespace ana
1630
1631template <>
1632template <>
1633inline bool
1635{
1636 return sval->get_kind () == SK_CONJURED;
1637}
1638
1640: public member_function_hash_traits<conjured_svalue::key_t>
1641{
1642 static const bool empty_zero_p = true;
1643};
1644
1645namespace ana {
1646
1647/* An output from a deterministic asm stmt, where we want to identify a
1648 particular unknown value, rather than resorting to the unknown_value
1649 singleton.
1650
1651 Comparisons of variables that share the same asm_output_svalue are known
1652 to be equal, even if we don't know what the value is. */
1653
1655{
1656public:
1657 /* Imposing an upper limit and using a (small) array allows key_t
1658 to avoid memory management. */
1659 static const unsigned MAX_INPUTS = 2;
1660
1661 /* A support class for uniquifying instances of asm_output_svalue. */
1662 struct key_t
1663 {
1665 const char *asm_string,
1666 unsigned output_idx,
1667 const vec<const svalue *> &inputs)
1668 : m_type (type), m_asm_string (asm_string), m_output_idx (output_idx),
1669 m_num_inputs (inputs.length ())
1670 {
1671 gcc_assert (inputs.length () <= MAX_INPUTS);
1672 for (unsigned i = 0; i < m_num_inputs; i++)
1673 m_input_arr[i] = inputs[i];
1674 }
1675
1676 hashval_t hash () const
1677 {
1678 inchash::hash hstate;
1679 hstate.add_ptr (m_type);
1680 /* We don't bother hashing m_asm_str. */
1681 hstate.add_int (m_output_idx);
1682 for (unsigned i = 0; i < m_num_inputs; i++)
1683 hstate.add_ptr (m_input_arr[i]);
1684 return hstate.end ();
1685 }
1686
1687 bool operator== (const key_t &other) const
1688 {
1689 if (!(m_type == other.m_type
1690 && 0 == (strcmp (m_asm_string, other.m_asm_string))
1691 && m_output_idx == other.m_output_idx
1692 && m_num_inputs == other.m_num_inputs))
1693 return false;
1694 for (unsigned i = 0; i < m_num_inputs; i++)
1695 if (m_input_arr[i] != other.m_input_arr[i])
1696 return false;
1697 return true;
1698 }
1699
1700 /* Use m_asm_string to mark empty/deleted, as m_type can be NULL_TREE for
1701 legitimate instances. */
1702 void mark_deleted () { m_asm_string = reinterpret_cast<const char *> (1); }
1703 void mark_empty () { m_asm_string = nullptr; }
1704 bool is_deleted () const
1705 {
1706 return m_asm_string == reinterpret_cast<const char *> (1);
1707 }
1708 bool is_empty () const { return m_asm_string == nullptr; }
1709
1711 const char *m_asm_string;
1715 };
1716
1718 tree type,
1719 const char *asm_string,
1720 unsigned output_idx,
1721 unsigned num_outputs,
1722 const vec<const svalue *> &inputs)
1723 : svalue (complexity::from_vec_svalue (inputs), id, type),
1724 m_asm_string (asm_string),
1725 m_output_idx (output_idx),
1726 m_num_outputs (num_outputs),
1727 m_num_inputs (inputs.length ())
1728 {
1729 gcc_assert (inputs.length () <= MAX_INPUTS);
1730 for (unsigned i = 0; i < m_num_inputs; i++)
1731 m_input_arr[i] = inputs[i];
1732 }
1733
1734 enum svalue_kind get_kind () const final override { return SK_ASM_OUTPUT; }
1735 const asm_output_svalue *
1737 {
1738 return this;
1739 }
1740
1741 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1742
1743 void
1744 print_dump_widget_label (pretty_printer *pp) const final override;
1745 void
1747 const dump_widget_info &dwi) const final override;
1748
1749 void accept (visitor *v) const final override;
1750
1751 const char *get_asm_string () const { return m_asm_string; }
1752 unsigned get_output_idx () const { return m_output_idx; }
1753 unsigned get_num_outputs () const { return m_num_outputs; }
1754 unsigned get_num_inputs () const { return m_num_inputs; }
1755 const svalue *get_input (unsigned idx) const { return m_input_arr[idx]; }
1756
1757 private:
1759 unsigned input_idx,
1760 const svalue *sval,
1761 bool simple) const;
1762 unsigned input_idx_to_asm_idx (unsigned input_idx) const;
1763
1764 const char *m_asm_string;
1766
1767 /* We capture this so that we can offset the input indices
1768 to match the %0, %1, %2 in the asm_string when dumping. */
1770
1773};
1774
1775} // namespace ana
1776
1777template <>
1778template <>
1779inline bool
1781{
1782 return sval->get_kind () == SK_ASM_OUTPUT;
1783}
1784
1786: public member_function_hash_traits<asm_output_svalue::key_t>
1787{
1788 static const bool empty_zero_p = true;
1789};
1790
1791namespace ana {
1792
1793/* The return value from a function with __attribute((const)) for given
1794 inputs, provided that we don't have too many inputs, and all of them
1795 are deterministic.
1796
1797 Comparisons of variables that share the same const_fn_result_svalue are known
1798 to be equal, even if we don't know what the value is. */
1799
1801{
1802public:
1803 /* Imposing an upper limit and using a (small) array allows key_t
1804 to avoid memory management. */
1805 static const unsigned MAX_INPUTS = 2;
1806
1807 /* A support class for uniquifying instances of const_fn_result_svalue. */
1808 struct key_t
1809 {
1811 tree fndecl,
1812 const vec<const svalue *> &inputs)
1813 : m_type (type), m_fndecl (fndecl),
1814 m_num_inputs (inputs.length ())
1815 {
1816 gcc_assert (inputs.length () <= MAX_INPUTS);
1817 for (unsigned i = 0; i < m_num_inputs; i++)
1818 m_input_arr[i] = inputs[i];
1819 }
1820
1821 hashval_t hash () const
1822 {
1823 inchash::hash hstate;
1824 hstate.add_ptr (m_type);
1825 hstate.add_ptr (m_fndecl);
1826 for (unsigned i = 0; i < m_num_inputs; i++)
1827 hstate.add_ptr (m_input_arr[i]);
1828 return hstate.end ();
1829 }
1830
1831 bool operator== (const key_t &other) const
1832 {
1833 if (!(m_type == other.m_type
1834 && m_fndecl == other.m_fndecl
1835 && m_num_inputs == other.m_num_inputs))
1836 return false;
1837 for (unsigned i = 0; i < m_num_inputs; i++)
1838 if (m_input_arr[i] != other.m_input_arr[i])
1839 return false;
1840 return true;
1841 }
1842
1843 /* Use m_fndecl to mark empty/deleted. */
1844 void mark_deleted () { m_fndecl = reinterpret_cast<tree> (1); }
1846 bool is_deleted () const
1847 {
1848 return m_fndecl == reinterpret_cast<tree> (1);
1849 }
1850 bool is_empty () const { return m_fndecl == NULL_TREE; }
1851
1856 };
1857
1859 tree type,
1860 tree fndecl,
1861 const vec<const svalue *> &inputs)
1862 : svalue (complexity::from_vec_svalue (inputs), id, type),
1863 m_fndecl (fndecl),
1864 m_num_inputs (inputs.length ())
1865 {
1866 gcc_assert (inputs.length () <= MAX_INPUTS);
1867 for (unsigned i = 0; i < m_num_inputs; i++)
1868 m_input_arr[i] = inputs[i];
1869 }
1870
1871 enum svalue_kind get_kind () const final override
1872 {
1873 return SK_CONST_FN_RESULT;
1874 }
1877 {
1878 return this;
1879 }
1880
1881 void dump_to_pp (pretty_printer *pp, bool simple) const final override;
1882
1883 void
1884 print_dump_widget_label (pretty_printer *pp) const final override;
1885 void
1887 const dump_widget_info &dwi) const final override;
1888
1889 void accept (visitor *v) const final override;
1890
1891 tree get_fndecl () const { return m_fndecl; }
1892 unsigned get_num_inputs () const { return m_num_inputs; }
1893 const svalue *get_input (unsigned idx) const { return m_input_arr[idx]; }
1894
1895 private:
1897 unsigned input_idx,
1898 const svalue *sval,
1899 bool simple) const;
1900
1904};
1905
1906} // namespace ana
1907
1908template <>
1909template <>
1910inline bool
1912{
1913 return sval->get_kind () == SK_CONST_FN_RESULT;
1914}
1915
1917: public member_function_hash_traits<const_fn_result_svalue::key_t>
1918{
1919 static const bool empty_zero_p = true;
1920};
1921
1922#endif /* GCC_ANALYZER_SVALUE_H */
Definition svalue.h:1655
const asm_output_svalue * dyn_cast_asm_output_svalue() const final override
Definition svalue.h:1736
void dump_input(pretty_printer *pp, unsigned input_idx, const svalue *sval, bool simple) const
const char * get_asm_string() const
Definition svalue.h:1751
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:1717
const char * m_asm_string
Definition svalue.h:1764
unsigned m_num_inputs
Definition svalue.h:1771
unsigned m_output_idx
Definition svalue.h:1765
unsigned get_num_outputs() const
Definition svalue.h:1753
unsigned input_idx_to_asm_idx(unsigned input_idx) const
unsigned get_num_inputs() const
Definition svalue.h:1754
enum svalue_kind get_kind() const final override
Definition svalue.h:1734
const svalue * get_input(unsigned idx) const
Definition svalue.h:1755
unsigned m_num_outputs
Definition svalue.h:1769
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:1752
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1772
static const unsigned MAX_INPUTS
Definition svalue.h:1659
Definition svalue.h:815
enum tree_code get_op() const
Definition svalue.h:886
const svalue * get_arg1() const
Definition svalue.h:888
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:891
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:887
const svalue * m_arg1
Definition svalue.h:893
enum svalue_kind get_kind() const final override
Definition svalue.h:866
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:854
const svalue * m_arg0
Definition svalue.h:892
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:867
Definition svalue.h:1101
enum svalue_kind get_kind() const final override
Definition svalue.h:1141
const bit_range m_bits
Definition svalue.h:1169
const svalue * m_inner_svalue
Definition svalue.h:1170
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:1161
const bits_within_svalue * dyn_cast_bits_within_svalue() const final override
Definition svalue.h:1143
const bit_range & get_bits() const
Definition svalue.h:1160
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:1418
const_iterator_t end() const
Definition svalue.h:1478
concrete_binding_map::const_iterator const_iterator_t
Definition svalue.h:1420
compound_svalue(symbol::id_t id, tree type, const concrete_binding_map &map)
iterator_t end()
Definition svalue.h:1480
void print_dump_widget_label(pretty_printer *pp) 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
concrete_binding_map::iterator iterator_t
Definition svalue.h:1421
iterator_t begin()
Definition svalue.h:1479
const concrete_binding_map & get_concrete_bindings() const
Definition svalue.h:1475
enum svalue_kind get_kind() const final override
Definition svalue.h:1458
concrete_binding_map m_map
Definition svalue.h:1493
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:1477
void accept(visitor *v) const final override
compound_svalue(symbol::id_t id, tree type, concrete_binding_map &&map)
struct key_t make_key() const
Definition svalue.h:1482
const compound_svalue * dyn_cast_compound_svalue() const final override
Definition svalue.h:1459
Definition store.h:524
map_t::const_iterator const_iterator
Definition store.h:527
map_t::iterator iterator
Definition store.h:528
void purge(const conjured_svalue *sval) const
conjured_purge(region_model *model, region_model_context *ctxt)
Definition svalue.h:1524
region_model_context * m_ctxt
Definition svalue.h:1532
region_model * m_model
Definition svalue.h:1531
Definition svalue.h:1553
void accept(visitor *v) const final override
bool lhs_value_p() const
const gimple * get_stmt() const
Definition svalue.h:1619
const conjured_svalue * dyn_cast_conjured_svalue() const final override
Definition svalue.h:1604
enum svalue_kind get_kind() const final override
Definition svalue.h:1603
const region * m_id_reg
Definition svalue.h:1625
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:1624
void print_dump_widget_label(pretty_printer *pp) const final override
unsigned m_idx
Definition svalue.h:1626
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const region * get_id_region() const
Definition svalue.h:1620
conjured_svalue(symbol::id_t id, tree type, const gimple *stmt, const region *id_reg, unsigned idx)
Definition svalue.h:1595
Definition svalue.h:1801
tree m_fndecl
Definition svalue.h:1901
unsigned get_num_inputs() const
Definition svalue.h:1892
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:1891
static const unsigned MAX_INPUTS
Definition svalue.h:1805
const svalue * get_input(unsigned idx) const
Definition svalue.h:1893
enum svalue_kind get_kind() const final override
Definition svalue.h:1871
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:1858
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1903
unsigned m_num_inputs
Definition svalue.h:1902
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:1876
void print_dump_widget_label(pretty_printer *pp) const final override
Definition svalue.h:317
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:357
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:359
constant_svalue(symbol::id_t id, tree type, tree cst_expr)
Definition svalue.h:348
tree get_constant() const
Definition svalue.h:373
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:388
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:672
const initial_svalue * dyn_cast_initial_svalue() const final override
Definition svalue.h:682
const region * get_region() const
Definition svalue.h:698
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:701
bool implicitly_live_p(const svalue_set *, const region_model *) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:680
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:674
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:1257
placeholder_svalue(symbol::id_t id, tree type, const char *name)
Definition svalue.h:1252
const char * m_name
Definition svalue.h:1272
const char * get_name() const
Definition svalue.h:1269
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:467
enum poison_kind get_poison_kind() const
Definition svalue.h:520
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:503
void dump_to_pp(pretty_printer *pp, bool simple) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:501
bool can_have_associated_state_p() const final override
Definition svalue.h:523
enum poison_kind m_kind
Definition svalue.h:526
poisoned_svalue(enum poison_kind kind, symbol::id_t id, tree type)
Definition svalue.h:498
void print_dump_widget_label(pretty_printer *pp) const final override
Definition region-model.h:748
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
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:291
static tristate eval_condition(const region_svalue *lhs_ptr, enum tree_code op, const region_svalue *rhs_ptr, const region_model &model)
Definition region.h:127
Definition svalue.h:1005
const repeated_svalue * dyn_cast_repeated_svalue() const final override
Definition svalue.h:1047
const svalue * m_inner_svalue
Definition svalue.h:1074
const svalue * get_inner_svalue() const
Definition svalue.h:1063
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:1062
enum svalue_kind get_kind() const final override
Definition svalue.h:1046
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:1073
Definition svalue.h:586
const setjmp_svalue * dyn_cast_setjmp_svalue() const final override
Definition svalue.h:625
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:623
setjmp_svalue(const setjmp_record &setjmp_record, symbol::id_t id, tree type)
Definition svalue.h:617
const setjmp_record & get_setjmp_record() const
Definition svalue.h:639
void print_dump_widget_label(pretty_printer *pp) const final override
setjmp_record m_setjmp_record
Definition svalue.h:642
int get_enode_index() const
Definition svalue.h:919
const svalue * get_parent() const
Definition svalue.h:974
const region * m_subregion
Definition svalue.h:979
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:956
const region * get_subregion() const
Definition svalue.h:975
const svalue * m_parent_svalue
Definition svalue.h:978
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:957
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:720
void accept(visitor *v) const final override
const svalue * m_arg
Definition svalue.h:790
unaryop_svalue(symbol::id_t id, tree type, enum tree_code op, const svalue *arg)
Definition svalue.h:755
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const svalue * get_arg() const
Definition svalue.h:779
enum tree_code get_op() const
Definition svalue.h:778
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:762
const unaryop_svalue * dyn_cast_unaryop_svalue() const final override
Definition svalue.h:764
enum tree_code m_op
Definition svalue.h:789
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:441
unknown_svalue(symbol::id_t id, tree type)
Definition svalue.h:417
void print_dump_widget_label(pretty_printer *pp) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:421
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:1203
const unmergeable_svalue * dyn_cast_unmergeable_svalue() const final override
Definition svalue.h:1212
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:1210
void accept(visitor *v) const final override
unmergeable_svalue(symbol::id_t id, const svalue *arg)
Definition svalue.h:1205
const svalue * get_arg() const
Definition svalue.h:1226
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:1229
Definition region-model.h:223
Definition svalue.h:1298
const supernode * get_snode() const
Definition svalue.h:1372
void dump_to_pp(pretty_printer *pp, bool simple) const final override
const svalue * m_base_sval
Definition svalue.h:1383
const svalue * get_base_svalue() const
Definition svalue.h:1373
widening_svalue(symbol::id_t id, tree type, const supernode *snode, const svalue *base_sval, const svalue *iter_sval)
Definition svalue.h:1343
direction_t
Definition svalue.h:1337
@ DIR_UNKNOWN
Definition svalue.h:1340
@ DIR_DESCENDING
Definition svalue.h:1339
@ DIR_ASCENDING
Definition svalue.h:1338
const widening_svalue * dyn_cast_widening_svalue() const final override
Definition svalue.h:1357
void print_dump_widget_label(pretty_printer *pp) const final override
enum svalue_kind get_kind() const final override
Definition svalue.h:1356
const svalue * get_iter_svalue() const
Definition svalue.h:1374
tristate eval_condition_without_cm(enum tree_code op, tree rhs_cst) const
const supernode * m_snode
Definition svalue.h:1382
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:1384
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:800
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:447
@ uninit
Definition svalue.h:449
@ freed
Definition svalue.h:452
@ popped_stack
Definition svalue.h:458
@ deleted
Definition svalue.h:455
const char * poison_kind_to_str(enum poison_kind)
hash_set< const svalue * > svalue_set
Definition common.h:76
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:1664
unsigned m_num_inputs
Definition svalue.h:1713
bool is_deleted() const
Definition svalue.h:1704
void mark_empty()
Definition svalue.h:1703
hashval_t hash() const
Definition svalue.h:1676
bool is_empty() const
Definition svalue.h:1708
unsigned m_output_idx
Definition svalue.h:1712
void mark_deleted()
Definition svalue.h:1702
const char * m_asm_string
Definition svalue.h:1711
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1714
tree m_type
Definition svalue.h:1710
bool is_empty() const
Definition svalue.h:846
enum tree_code m_op
Definition svalue.h:849
hashval_t hash() const
Definition svalue.h:825
const svalue * m_arg1
Definition svalue.h:851
tree m_type
Definition svalue.h:848
void mark_deleted()
Definition svalue.h:843
key_t(tree type, enum tree_code op, const svalue *arg0, const svalue *arg1)
Definition svalue.h:820
void mark_empty()
Definition svalue.h:844
bool is_deleted() const
Definition svalue.h:845
const svalue * m_arg0
Definition svalue.h:850
Definition store.h:234
bool is_deleted() const
Definition svalue.h:1129
key_t(tree type, const bit_range &bits, const svalue *inner_svalue)
Definition svalue.h:1106
hashval_t hash() const
Definition svalue.h:1112
bool is_empty() const
Definition svalue.h:1130
void mark_empty()
Definition svalue.h:1128
bit_range m_bits
Definition svalue.h:1133
void mark_deleted()
Definition svalue.h:1127
const svalue * m_inner_svalue
Definition svalue.h:1134
tree m_type
Definition svalue.h:1132
Definition complexity.h:31
Definition svalue.h:1427
bool is_deleted() const
Definition svalue.h:1448
tree m_type
Definition svalue.h:1451
void mark_empty()
Definition svalue.h:1447
hashval_t hash() const
Definition svalue.h:1432
bool is_empty() const
Definition svalue.h:1449
const concrete_binding_map * m_map_ptr
Definition svalue.h:1452
void mark_deleted()
Definition svalue.h:1446
key_t(tree type, const concrete_binding_map *map_ptr)
Definition svalue.h:1428
unsigned m_idx
Definition svalue.h:1592
bool is_deleted() const
Definition svalue.h:1583
void mark_empty()
Definition svalue.h:1582
bool is_empty() const
Definition svalue.h:1587
const gimple * m_stmt
Definition svalue.h:1590
void mark_deleted()
Definition svalue.h:1581
key_t(tree type, const gimple *stmt, const region *id_reg, unsigned idx)
Definition svalue.h:1558
tree m_type
Definition svalue.h:1589
hashval_t hash() const
Definition svalue.h:1562
const region * m_id_reg
Definition svalue.h:1591
void mark_empty()
Definition svalue.h:1845
tree m_fndecl
Definition svalue.h:1853
hashval_t hash() const
Definition svalue.h:1821
const svalue * m_input_arr[MAX_INPUTS]
Definition svalue.h:1855
bool is_empty() const
Definition svalue.h:1850
tree m_type
Definition svalue.h:1852
void mark_deleted()
Definition svalue.h:1844
unsigned m_num_inputs
Definition svalue.h:1854
bool is_deleted() const
Definition svalue.h:1846
key_t(tree type, tree fndecl, const vec< const svalue * > &inputs)
Definition svalue.h:1810
bool is_empty() const
Definition svalue.h:342
void mark_deleted()
Definition svalue.h:339
bool is_deleted() const
Definition svalue.h:341
key_t(tree type, tree cst)
Definition svalue.h:322
tree m_cst
Definition svalue.h:345
hashval_t hash() const
Definition svalue.h:326
void mark_empty()
Definition svalue.h:340
tree m_type
Definition svalue.h:344
bool operator==(const key_t &other) const
Definition svalue.h:334
Definition region-model.h:1204
void mark_deleted()
Definition svalue.h:489
bool is_deleted() const
Definition svalue.h:491
hashval_t hash() const
Definition svalue.h:476
enum poison_kind m_kind
Definition svalue.h:494
bool is_empty() const
Definition svalue.h:492
key_t(enum poison_kind kind, tree type)
Definition svalue.h:472
bool operator==(const key_t &other) const
Definition svalue.h:484
tree m_type
Definition svalue.h:495
void mark_empty()
Definition svalue.h:490
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:1037
void mark_deleted()
Definition svalue.h:1032
const svalue * m_outer_size
Definition svalue.h:1038
hashval_t hash() const
Definition svalue.h:1016
void mark_empty()
Definition svalue.h:1033
bool is_empty() const
Definition svalue.h:1035
key_t(tree type, const svalue *outer_size, const svalue *inner_svalue)
Definition svalue.h:1010
const svalue * m_inner_svalue
Definition svalue.h:1039
bool is_deleted() const
Definition svalue.h:1034
Definition svalue.h:551
setjmp_record(const exploded_node *enode, const superedge *sedge, const gcall &setjmp_call)
Definition svalue.h:552
static int cmp(const setjmp_record &rec1, const setjmp_record &rec2)
const exploded_node * m_enode
Definition svalue.h:575
const gcall * m_setjmp_call
Definition svalue.h:577
void add_to_hash(inchash::hash *hstate) const
Definition svalue.h:566
const superedge * m_sedge
Definition svalue.h:576
key_t(const setjmp_record &record, tree type)
Definition svalue.h:591
hashval_t hash() const
Definition svalue.h:595
tree m_type
Definition svalue.h:614
setjmp_record m_record
Definition svalue.h:613
void mark_deleted()
Definition svalue.h:608
void mark_empty()
Definition svalue.h:609
bool is_deleted() const
Definition svalue.h:610
bool is_empty() const
Definition svalue.h:611
void mark_empty()
Definition svalue.h:945
void mark_deleted()
Definition svalue.h:944
bool is_deleted() const
Definition svalue.h:946
hashval_t hash() const
Definition svalue.h:928
tree m_type
Definition svalue.h:949
const svalue * m_parent_svalue
Definition svalue.h:950
key_t(tree type, const svalue *parent_svalue, const region *subregion)
Definition svalue.h:924
const region * m_subregion
Definition svalue.h:951
bool is_empty() const
Definition svalue.h:947
tree m_type
Definition svalue.h:750
bool is_deleted() const
Definition svalue.h:747
void mark_empty()
Definition svalue.h:746
bool is_empty() const
Definition svalue.h:748
hashval_t hash() const
Definition svalue.h:729
enum tree_code m_op
Definition svalue.h:751
const svalue * m_arg
Definition svalue.h:752
void mark_deleted()
Definition svalue.h:745
key_t(tree type, enum tree_code op, const svalue *arg)
Definition svalue.h:725
bool is_empty() const
Definition svalue.h:1328
const supernode * m_snode
Definition svalue.h:1331
const svalue * m_base_sval
Definition svalue.h:1332
void mark_deleted()
Definition svalue.h:1325
tree m_type
Definition svalue.h:1330
hashval_t hash() const
Definition svalue.h:1309
bool is_deleted() const
Definition svalue.h:1327
key_t(tree type, const supernode *snode, const svalue *base_sval, const svalue *iter_sval)
Definition svalue.h:1303
const svalue * m_iter_sval
Definition svalue.h:1333
void mark_empty()
Definition svalue.h:1326
static const bool empty_zero_p
Definition svalue.h:1788
static const bool empty_zero_p
Definition svalue.h:909
static const bool empty_zero_p
Definition svalue.h:1186
static const bool empty_zero_p
Definition svalue.h:1509
static const bool empty_zero_p
Definition svalue.h:1642
static const bool empty_zero_p
Definition svalue.h:1919
static const bool empty_zero_p
Definition svalue.h:404
static const bool empty_zero_p
Definition svalue.h:542
static const bool empty_zero_p
Definition svalue.h:307
static const bool empty_zero_p
Definition svalue.h:1090
static const bool empty_zero_p
Definition svalue.h:658
static const bool empty_zero_p
Definition svalue.h:995
static const bool empty_zero_p
Definition svalue.h:806
static const bool empty_zero_p
Definition svalue.h:1400
Definition hash-traits.h:466
Definition gimple.h:355
Definition gimple.h:224
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:601
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