GCC Middle and Back End API Reference
gimple-range-trace.h
Go to the documentation of this file.
1/* Header file for the GIMPLE range tracing/debugging facilities.
2 Copyright (C) 2021-2024 Free Software Foundation, Inc.
3 Contributed by Andrew MacLeod <amacleod@redhat.com>
4 and Aldy Hernandez <aldyh@redhat.com>.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 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_GIMPLE_RANGE_TRACE_H
23#define GCC_GIMPLE_RANGE_TRACE_H
24
25// This class manages range tracing for the ranger and gori components.
26// Tracing will provide a unique integer index whenever a new trace
27// is started. This can be used to identify where a calculation has gone wrong.
28
30{
31public:
32 range_tracer (const char *name = "");
33 unsigned header (const char *str);
34 void trailer (unsigned counter, const char *caller, bool result, tree name,
35 const vrange &r);
36 void print (unsigned counter, const char *str);
37 inline void enable_trace () { tracing = true; }
38 inline void disable_trace () { tracing = false; }
39 virtual void breakpoint (unsigned index);
40private:
41 unsigned do_header (const char *str);
42 void print_prefix (unsigned idx, bool blanks);
43 static const unsigned bump = 2;
44 unsigned indent;
45 static const unsigned name_len = 100;
47 bool tracing;
48};
49
50
51// If tracing is enabled, start a new trace header, returning the trace index.
52// Otherwise return 0.
53
54inline unsigned
55range_tracer::header (const char *str)
56{
57 if (tracing)
58 return do_header (str);
59 return 0;
60}
61
62// RAII class to change current dump_file and dump_flags, and restore
63// when the object goes out of scope.
64
74
75void dump_ranger (FILE *);
76void dump_ranger (FILE *, const vec<basic_block> &path);
77
78#endif // GCC_GIMPLE_RANGE_TRACE_H
Definition gimple-range-trace.h:66
FILE * old_dump_file
Definition gimple-range-trace.h:71
dump_flags_t old_dump_flags
Definition gimple-range-trace.h:72
push_dump_file(FILE *, dump_flags_t)
Definition gimple-range-trace.cc:164
~push_dump_file()
Definition gimple-range-trace.cc:174
Definition gimple-range-trace.h:30
void trailer(unsigned counter, const char *caller, bool result, tree name, const vrange &r)
Definition gimple-range-trace.cc:104
void print(unsigned counter, const char *str)
Definition gimple-range-trace.cc:95
void disable_trace()
Definition gimple-range-trace.h:38
static const unsigned name_len
Definition gimple-range-trace.h:45
virtual void breakpoint(unsigned index)
Definition gimple-range-trace.cc:44
static const unsigned bump
Definition gimple-range-trace.h:43
range_tracer(const char *name="")
Definition gimple-range-trace.cc:50
void print_prefix(unsigned idx, bool blanks)
Definition gimple-range-trace.cc:62
void enable_trace()
Definition gimple-range-trace.h:37
unsigned header(const char *str)
Definition gimple-range-trace.h:55
unsigned do_header(const char *str)
Definition gimple-range-trace.cc:80
unsigned indent
Definition gimple-range-trace.h:44
bool tracing
Definition gimple-range-trace.h:47
Definition value-range.h:78
union tree_node * tree
Definition coretypes.h:97
enum dump_flag dump_flags_t
Definition dumpfile.h:209
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
void dump_ranger(FILE *)
Definition gimple-range-trace.cc:183
poly_int< N, C > r
Definition poly-int.h:770
Definition tree-predcom.cc:369
Definition vec.h:450