GCC Middle and Back End API Reference
symbolic-memory-offsets.h
Go to the documentation of this file.
1/* A (base_region, symbolic bit offset) pair for representing
2 where a region starts in memory.
3 Copyright (C) 2026 Free Software Foundation, Inc.
4 Contributed by David Malcolm <dmalcolm@redhat.com>.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it
9under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
22#ifndef GCC_ANALYZER_SYMBOLIC_MEMORY_OFFSETS_H
23#define GCC_ANALYZER_SYMBOLIC_MEMORY_OFFSETS_H
24
26
27namespace ana {
28namespace symbolic {
29
30/* A (base_region, symbolic bit offset) pair for representing
31 where a region starts in memory.
32 Note that these have a granularity of *bits*. */
33
35{
36public:
38
39 memory_offset (const region &base_reg,
40 const symbolic_bit_offset &bit_offset)
41 : m_base_reg (base_reg),
42 m_bit_offset (bit_offset)
43 {
44 }
45
46 void dump () const;
47
48 bool
49 operator== (const memory_offset &other) const
50 {
51 return (&m_base_reg == &other.m_base_reg
52 && &m_bit_offset == &other.m_bit_offset);
53 }
54
55 bool
56 operator!= (const memory_offset &other) const
57 {
58 return !(*this == other);
59 }
60
61 int
62 cmp (const memory_offset &other) const;
63
64 bool
66 {
67 return m_bit_offset.is_zero_p ();
68 }
69
70 bool non_null_p () const;
71
72 std::unique_ptr<text_art::tree_widget>
74
75 void
77
78 std::unique_ptr<json::object>
79 to_json () const;
80
81 const region &
82 get_base_region () const { return m_base_reg; }
83
85 get_bit_offset () const { return m_bit_offset; }
86
87private:
90};
91
92} // namespace ana::symbolic
93
94} // namespace ana
95
96#endif /* GCC_ANALYZER_SYMBOLIC_MEMORY_OFFSETS_H */
Definition region.h:130
bool operator!=(const memory_offset &other) const
Definition symbolic-memory-offsets.h:56
std::unique_ptr< json::object > to_json() const
const region & get_base_region() const
Definition symbolic-memory-offsets.h:82
const symbolic_bit_offset & m_bit_offset
Definition symbolic-memory-offsets.h:89
void accept_node_visitor(symbolic::node_visitor &v) const
int cmp(const memory_offset &other) const
symbolic::scalar< integer_with_unit< units::bit > > symbolic_bit_offset
Definition symbolic-memory-offsets.h:37
bool zero_offset_p() const
Definition symbolic-memory-offsets.h:65
const region & m_base_reg
Definition symbolic-memory-offsets.h:88
const symbolic_bit_offset & get_bit_offset() const
Definition symbolic-memory-offsets.h:85
memory_offset(const region &base_reg, const symbolic_bit_offset &bit_offset)
Definition symbolic-memory-offsets.h:39
std::unique_ptr< text_art::tree_widget > make_dump_widget(node_dump_state &nds) const
bool operator==(const memory_offset &other) const
Definition symbolic-memory-offsets.h:49
Definition symbolic-nodes.h:502
Definition symbolic-scalars.h:67
bool is_zero_p() const
Definition common.h:74
Definition access-diagram.h:30
@ other
Definition common.h:535
symbolic::scalar< integer_with_unit< units::bit > > symbolic_bit_offset
Definition symbolic-scalars.h:193
Definition symbolic-nodes.h:276