GCC Middle and Back End API Reference
symbolic-pointers.h
Go to the documentation of this file.
1/* A (base_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 (base_region, symbolic byte offset) pair.
30 Note that these have a granularity of *bytes*. */
31
33{
34public:
36
37 pointer (const region &base_reg,
38 const symbolic_byte_offset &byte_offset)
39 : m_base_reg (base_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_base_reg == &other.m_base_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 const region &
80 get_base_region () const { return m_base_reg; }
81
83 get_byte_offset () const { return m_byte_offset; }
84
85 static tristate
86 eval_condition (const pointer &lhs_ptr,
87 enum tree_code op,
88 const pointer &rhs_ptr,
89 const region_model &model);
90
91private:
94};
95
96} // namespace ana::symbolic
97
98} // namespace ana
99
100#endif /* GCC_ANALYZER_SYMBOLIC_POINTERS_H */
Definition region-model.h:289
Definition region.h:130
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 region & m_base_reg
Definition symbolic-pointers.h:92
const symbolic_byte_offset & m_byte_offset
Definition symbolic-pointers.h:93
const region & get_base_region() const
Definition symbolic-pointers.h:80
const symbolic_byte_offset & get_byte_offset() const
Definition symbolic-pointers.h:83
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
pointer(const region &base_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)
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:535
symbolic::scalar< integer_with_unit< units::byte > > symbolic_byte_offset
Definition symbolic-scalars.h:196
Definition symbolic-nodes.h:276