GCC Middle and Back End API Reference
access-diagram.h
Go to the documentation of this file.
1/* Text art visualizations within -fanalyzer.
2 Copyright (C) 2023-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_ACCESS_DIAGRAM_H
22#define GCC_ANALYZER_ACCESS_DIAGRAM_H
23
24#include "text-art/canvas.h"
25#include "text-art/theme.h"
26#include "text-art/widget.h"
27
28#include "analyzer/store.h"
29
30namespace ana {
31
33{
34public:
35 bit_size_expr (const symbolic_bit_size &num_bits) : m_num_bits (num_bits) {}
36
37 std::unique_ptr<text_art::styled_string>
39 const region_model &model,
40 const char *concrete_single_bit_fmt,
41 const char *concrete_plural_bits_fmt,
42 const char *concrete_single_byte_fmt,
43 const char *concrete_plural_bytes_fmt,
44 const char *symbolic_bits_fmt,
45 const char *symbolic_bytes_fmt) const;
47 const region_model &model) const;
48
49private:
51};
52
54{
56 enum access_direction dir,
57 const symbolic::memory_range &attempted_range,
58 const svalue *sval_hint)
59 : m_model (model),
60 m_dir (dir),
61 m_attempted_range (attempted_range),
62 m_sval_hint (sval_hint)
63 {}
64
66 {
67 return m_model.get_manager ();
68 }
69
70 /* Get the valid bits to access within the base region. */
72
73 /* Get the actual bits accessed within the base region. */
75
78
79 const region &
81
86};
87
89{
90public:
92 diagnostics::paths::event_id_t region_creation_event_id,
94 const text_art::theme &theme,
95 logger *logger);
96 const char *get_desc () const override
97 {
98 return "access_diagram";
99 }
100};
101
102} // namespace ana
103
104#endif /* GCC_ANALYZER_ACCESS_DIAGRAM_H */
const char * get_desc() const override
Definition access-diagram.h:96
access_diagram(const access_operation &op, diagnostics::paths::event_id_t region_creation_event_id, text_art::style_manager &sm, const text_art::theme &theme, logger *logger)
bit_size_expr(const symbolic_bit_size &num_bits)
Definition access-diagram.h:35
bool maybe_print_for_user(pretty_printer *pp, const region_model &model) const
std::unique_ptr< text_art::styled_string > maybe_get_formatted_str(text_art::style_manager &sm, const region_model &model, const char *concrete_single_bit_fmt, const char *concrete_plural_bits_fmt, const char *concrete_single_byte_fmt, const char *concrete_plural_bytes_fmt, const char *symbolic_bits_fmt, const char *symbolic_bytes_fmt) const
const symbolic_bit_size & m_num_bits
Definition access-diagram.h:50
Definition analyzer-logging.h:36
Definition region-model-manager.h:36
Definition region-model.h:289
region_model_manager * get_manager() const
Definition region-model.h:502
Definition region.h:154
Definition svalue.h:82
Definition symbolic-memory-ranges.h:34
const region & get_base_region() const
Definition symbolic-memory-ranges.h:62
Definition pretty-print.h:241
Definition types.h:348
Definition theme.h:30
Definition widget.h:137
Definition access-diagram.h:30
symbolic::scalar< integer_with_unit< units::bit > > symbolic_bit_size
Definition symbolic-scalars.h:194
symbolic::range< integer_with_unit< units::bit > > symbolic_bit_range
Definition common.h:124
access_direction
Definition common.h:371
diagnostic_event_id_t event_id_t
Definition event-id.h:66
Definition access-diagram.h:54
symbolic::memory_range m_attempted_range
Definition access-diagram.h:84
const region_model & m_model
Definition access-diagram.h:82
bool maybe_get_invalid_before_bits(symbolic_bit_range *out) const
region_model_manager * get_manager() const
Definition access-diagram.h:65
enum access_direction m_dir
Definition access-diagram.h:83
symbolic_bit_range get_actual_bits() const
access_operation(const region_model &model, enum access_direction dir, const symbolic::memory_range &attempted_range, const svalue *sval_hint)
Definition access-diagram.h:55
symbolic_bit_range get_valid_bits() const
const region & get_base_region() const
Definition access-diagram.h:80
bool maybe_get_invalid_after_bits(symbolic_bit_range *out) const
const svalue * m_sval_hint
Definition access-diagram.h:85