GCC Middle and Back End API Reference
ranges.h
Go to the documentation of this file.
1
/* Symbolic offsets and ranges.
2
Copyright (C) 2023-2024 Free Software Foundation, Inc.
3
Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5
This file is part of GCC.
6
7
GCC is free software; you can redistribute it and/or modify it
8
under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3, or (at your option)
10
any later version.
11
12
GCC is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
General Public License for more details.
16
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING3. If not see
19
<http://www.gnu.org/licenses/>. */
20
21
#ifndef GCC_ANALYZER_RANGES_H
22
#define GCC_ANALYZER_RANGES_H
23
24
namespace
ana
{
25
26
/* Wrapper around an svalue for a value measured in bytes. */
27
28
class
symbolic_byte_offset
29
{
30
public
:
31
explicit
symbolic_byte_offset
(
int
i
,
region_model_manager
&
mgr
);
32
symbolic_byte_offset
(
const
svalue
*
num_bytes_sval
);
33
explicit
symbolic_byte_offset
(
region_offset
offset
,
34
region_model_manager
&
mgr
);
35
36
const
svalue
*
get_svalue
()
const
{
return
m_num_bytes_sval
; }
37
tree
maybe_get_constant
()
const
;
38
39
void
dump_to_pp
(
pretty_printer
*pp,
bool
)
const
;
40
void
dump
(
bool
)
const
;
41
42
json::value
*
to_json
()
const
;
43
44
bool
operator==
(
const
symbolic_byte_offset
&other)
const
45
{
46
return
m_num_bytes_sval
== other.
m_num_bytes_sval
;
47
}
48
49
private
:
50
const
svalue
*
m_num_bytes_sval
;
51
};
52
53
/* A range of byte offsets, where both the start and size of the
54
range can be symbolic. */
55
56
class
symbolic_byte_range
57
{
58
public
:
59
symbolic_byte_range
(
symbolic_byte_offset
start,
60
symbolic_byte_offset
size)
61
:
m_start
(start),
62
m_size
(size)
63
{
64
}
65
66
symbolic_byte_range
(
region_offset
start,
67
const
svalue
*
num_bytes
,
68
region_model_manager
&
mgr
);
69
70
void
dump_to_pp
(
pretty_printer
*pp,
71
bool
simple
,
72
region_model_manager
&
mgr
)
const
;
73
void
dump
(
bool
,
region_model_manager
&
mgr
)
const
;
74
75
json::value
*
to_json
()
const
;
76
77
bool
empty_p
()
const
;
78
79
symbolic_byte_offset
get_start_byte_offset
()
const
80
{
81
return
m_start
;
82
}
83
symbolic_byte_offset
get_last_byte_offset
(
region_model_manager
&
mgr
)
const
;
84
symbolic_byte_offset
get_size_in_bytes
()
const
85
{
86
return
m_size
;
87
}
88
symbolic_byte_offset
get_next_byte_offset
(
region_model_manager
&
mgr
)
const
;
89
90
tristate
intersection
(
const
symbolic_byte_range
&other,
91
const
region_model
&
model
)
const
;
92
93
private
:
94
symbolic_byte_offset
m_start
;
95
symbolic_byte_offset
m_size
;
96
};
97
98
}
// namespace ana
99
100
#endif
/* GCC_ANALYZER_RANGES_H */
ana::region_model_manager
Definition
region-model-manager.h:32
ana::region_model
Definition
region-model.h:258
ana::region_offset
Definition
analyzer.h:192
ana::svalue
Definition
svalue.h:90
ana::symbolic_byte_offset
Definition
ranges.h:29
ana::symbolic_byte_offset::get_svalue
const svalue * get_svalue() const
Definition
ranges.h:36
ana::symbolic_byte_offset::m_num_bytes_sval
const svalue * m_num_bytes_sval
Definition
ranges.h:50
ana::symbolic_byte_offset::symbolic_byte_offset
symbolic_byte_offset(region_offset offset, region_model_manager &mgr)
ana::symbolic_byte_offset::dump_to_pp
void dump_to_pp(pretty_printer *pp, bool) const
ana::symbolic_byte_offset::symbolic_byte_offset
symbolic_byte_offset(int i, region_model_manager &mgr)
ana::symbolic_byte_offset::operator==
bool operator==(const symbolic_byte_offset &other) const
Definition
ranges.h:44
ana::symbolic_byte_offset::dump
void dump(bool) const
ana::symbolic_byte_offset::maybe_get_constant
tree maybe_get_constant() const
ana::symbolic_byte_offset::symbolic_byte_offset
symbolic_byte_offset(const svalue *num_bytes_sval)
ana::symbolic_byte_offset::to_json
json::value * to_json() const
ana::symbolic_byte_range
Definition
ranges.h:57
ana::symbolic_byte_range::get_last_byte_offset
symbolic_byte_offset get_last_byte_offset(region_model_manager &mgr) const
ana::symbolic_byte_range::m_size
symbolic_byte_offset m_size
Definition
ranges.h:95
ana::symbolic_byte_range::empty_p
bool empty_p() const
ana::symbolic_byte_range::to_json
json::value * to_json() const
ana::symbolic_byte_range::symbolic_byte_range
symbolic_byte_range(symbolic_byte_offset start, symbolic_byte_offset size)
Definition
ranges.h:59
ana::symbolic_byte_range::intersection
tristate intersection(const symbolic_byte_range &other, const region_model &model) const
ana::symbolic_byte_range::dump
void dump(bool, region_model_manager &mgr) const
ana::symbolic_byte_range::dump_to_pp
void dump_to_pp(pretty_printer *pp, bool simple, region_model_manager &mgr) const
ana::symbolic_byte_range::m_start
symbolic_byte_offset m_start
Definition
ranges.h:94
ana::symbolic_byte_range::symbolic_byte_range
symbolic_byte_range(region_offset start, const svalue *num_bytes, region_model_manager &mgr)
ana::symbolic_byte_range::get_size_in_bytes
symbolic_byte_offset get_size_in_bytes() const
Definition
ranges.h:84
ana::symbolic_byte_range::get_next_byte_offset
symbolic_byte_offset get_next_byte_offset(region_model_manager &mgr) const
ana::symbolic_byte_range::get_start_byte_offset
symbolic_byte_offset get_start_byte_offset() const
Definition
ranges.h:79
json::value
Definition
json.h:79
pretty_printer
Definition
pretty-print.h:244
tristate
Definition
tristate.h:26
tree
union tree_node * tree
Definition
coretypes.h:97
ggc_alloc
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition
ggc.h:184
ana
Definition
access-diagram.h:30
i
i
Definition
poly-int.h:772
offset
rtx offset
Definition
postreload.cc:691
gcc
analyzer
ranges.h
Generated by
1.10.0