Daily bump.
[official-gcc.git] / gcc / gimple-range-trace.h
blobd3e69e03543b963987180a81829db349b6ca7d76
1 /* Header file for the GIMPLE range tracing/debugging facilties.
2 Copyright (C) 2021 Free Software Foundation, Inc.
3 Contributed by Andrew MacLeod <amacleod@redhat.com>
4 and Aldy Hernandez <aldyh@redhat.com>.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_RANGE_TRACE_H
23 #define GCC_GIMPLE_RANGE_TRACE_H
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.
29 class range_tracer
31 public:
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 irange &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);
40 private:
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;
46 char component[name_len];
47 bool tracing;
51 // If tracing is enabled, start a new trace header, returning the trace index.
52 // Otherwise return 0.
54 inline unsigned
55 range_tracer::header (const char *str)
57 if (tracing)
58 return do_header (str);
59 return 0;
62 // RAII class to change current dump_file and dump_flags, and restore
63 // when the object goes out of scope.
65 class push_dump_file
67 public:
68 push_dump_file (FILE *, dump_flags_t);
69 ~push_dump_file ();
70 private:
71 FILE *old_dump_file;
72 dump_flags_t old_dump_flags;
75 void dump_ranger (FILE *);
76 void dump_ranger (FILE *, const vec<basic_block> &path);
78 #endif // GCC_GIMPLE_RANGE_TRACE_H