GCC Middle and Back End API Reference
record-layout.h
Go to the documentation of this file.
1/* Declaration of class record_layout.
2 Copyright (C) 2022-2024 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_RECORD_LAYOUT_H
22#define GCC_ANALYZER_RECORD_LAYOUT_H
23
24#include "analyzer/store.h"
25
26namespace ana {
27
28/* Information of the layout of a RECORD_TYPE, capturing it as a vector
29 of items, where each item is either a field or padding. */
30
32{
33public:
34 /* An item within a record; either a field, or padding after a field. */
35 struct item
36 {
37 public:
38 item (const bit_range &br,
39 tree field,
40 bool is_padding)
41 : m_bit_range (br),
42 m_field (field),
44 {
45 }
46
55
57 {
59 }
60
61 void dump_to_pp (pretty_printer *pp) const
62 {
63 if (m_is_padding)
64 pp_printf (pp, "padding after %qD", m_field);
65 else
66 pp_printf (pp, "%qD", m_field);
67 pp_string (pp, ", ");
69 }
70
74 };
75
77
78 void dump_to_pp (pretty_printer *pp) const;
79 DEBUG_FUNCTION void dump () const;
80
82
83private:
85
87};
88
89} // namespace ana
90
91#endif /* GCC_ANALYZER_RECORD_LAYOUT_H */
Definition record-layout.h:32
auto_vec< item > m_items
Definition record-layout.h:86
DEBUG_FUNCTION void dump() const
record_layout(tree record_type)
void maybe_pad_to(bit_offset_t next_offset)
void dump_to_pp(pretty_printer *pp) const
const record_layout::item * get_item_at(bit_offset_t offset) const
Definition vec.h:1656
Definition pretty-print.h:244
union tree_node * tree
Definition coretypes.h:97
static void record_type(type_p type)
Definition gengtype-state.cc:1426
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
Definition access-diagram.h:30
offset_int bit_offset_t
Definition analyzer.h:179
rtx offset
Definition postreload.cc:691
void pp_printf(pretty_printer *pp, const char *msg,...)
Definition pretty-print.cc:2180
void pp_string(pretty_printer *pp, const char *str)
Definition pretty-print.cc:2235
Definition store.h:231
bool contains_p(bit_offset_t offset) const
Definition store.h:261
bit_offset_t get_next_bit_offset() const
Definition store.h:251
void dump_to_pp(pretty_printer *pp) const
bit_offset_t get_start_bit_offset() const
Definition store.h:247
Definition record-layout.h:36
bit_offset_t get_next_bit_offset() const
Definition record-layout.h:51
item(const bit_range &br, tree field, bool is_padding)
Definition record-layout.h:38
bool m_is_padding
Definition record-layout.h:73
void dump_to_pp(pretty_printer *pp) const
Definition record-layout.h:61
bit_range m_bit_range
Definition record-layout.h:71
bool contains_p(bit_offset_t offset) const
Definition record-layout.h:56
bit_offset_t get_start_bit_offset() const
Definition record-layout.h:47
tree m_field
Definition record-layout.h:72
#define DEBUG_FUNCTION
Definition system.h:1242