GCC Middle and Back End API Reference
symbolic-pointers.h
Go to the documentation of this file.
1/* A (cluster_region, symbolic byte offset) pair.
2 Copyright (C) 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_SYMBOLIC_POINTERS_H
22#define GCC_ANALYZER_SYMBOLIC_POINTERS_H
23
25
26namespace ana {
27namespace symbolic {
28
29/* A (cluster_region, symbolic byte offset) pair.
30 Note that these have a granularity of *bytes*. */
31
33{
34public:
36
37 pointer (const cluster_region &cluster_reg,
38 const symbolic_byte_offset &byte_offset)
39 : m_cluster_reg (cluster_reg),
40 m_byte_offset (byte_offset)
41 {
42 }
43
44 void dump () const;
45
46 bool
47 operator== (const pointer &other) const
48 {
49 return (&m_cluster_reg == &other.m_cluster_reg
50 && &m_byte_offset == &other.m_byte_offset);
51 }
52
53 bool
54 operator!= (const pointer &other) const
55 {
56 return !(*this == other);
57 }
58
59 int
60 cmp (const pointer &other) const;
61
62 bool
64 {
65 return m_byte_offset.is_zero_p ();
66 }
67
68 bool non_null_p () const;
69
70 std::unique_ptr<text_art::tree_widget>
72
73 void
75
76 std::unique_ptr<json::object>
77 to_json () const;
78
79 /* Deprecated (poor terminology); use get_cluster_region instead. */
80 const cluster_region &
81 get_base_region () const { return m_cluster_reg; }
82
83 const cluster_region &
84 get_cluster_region () const { return m_cluster_reg; }
85
87 get_byte_offset () const { return m_byte_offset; }
88
89 static tristate
90 eval_condition (const pointer &lhs_ptr,
91 enum tree_code op,
92 const pointer &rhs_ptr,
93 const region_model &model);
94
95private:
98};
99
100} // namespace ana::symbolic
101
102} // namespace ana
103
104#endif /* GCC_ANALYZER_SYMBOLIC_POINTERS_H */
Definition region.h:537
Definition region-model.h:289
Definition symbolic-nodes.h:502
symbolic::scalar< integer_with_unit< units::byte > > symbolic_byte_offset
Definition symbolic-pointers.h:35
bool operator==(const pointer &other) const
Definition symbolic-pointers.h:47
bool non_null_p() const
std::unique_ptr< json::object > to_json() const
const symbolic_byte_offset & m_byte_offset
Definition symbolic-pointers.h:97
const cluster_region & m_cluster_reg
Definition symbolic-pointers.h:96
const symbolic_byte_offset & get_byte_offset() const
Definition symbolic-pointers.h:87
int cmp(const pointer &other) const
void accept_node_visitor(symbolic::node_visitor &v) const
bool zero_offset_p() const
Definition symbolic-pointers.h:63
const cluster_region & get_base_region() const
Definition symbolic-pointers.h:81
pointer(const cluster_region &cluster_reg, const symbolic_byte_offset &byte_offset)
Definition symbolic-pointers.h:37
static tristate eval_condition(const pointer &lhs_ptr, enum tree_code op, const pointer &rhs_ptr, const region_model &model)
const cluster_region & get_cluster_region() const
Definition symbolic-pointers.h:84
bool operator!=(const pointer &other) const
Definition symbolic-pointers.h:54
std::unique_ptr< text_art::tree_widget > make_dump_widget(node_dump_state &nds) const
Definition symbolic-scalars.h:67
bool is_zero_p() const
Definition tristate.h:26
tree_code
Definition genmatch.cc:1011
Definition common.h:74
Definition access-diagram.h:30
@ other
Definition common.h:536
symbolic::scalar< integer_with_unit< units::byte > > symbolic_byte_offset
Definition symbolic-scalars.h:196
Definition symbolic-nodes.h:276