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
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
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.
32 range_tracer (const char *name
= "");
33 unsigned header (const char *str
);
34 void trailer (unsigned counter
, const char *caller
, bool result
, tree name
,
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
);
41 unsigned do_header (const char *str
);
42 void print_prefix (unsigned idx
, bool blanks
);
43 static const unsigned bump
= 2;
45 static const unsigned name_len
= 100;
46 char component
[name_len
];
51 // If tracing is enabled, start a new trace header, returning the trace index.
52 // Otherwise return 0.
55 range_tracer::header (const char *str
)
58 return do_header (str
);
62 // RAII class to change current dump_file and dump_flags, and restore
63 // when the object goes out of scope.
68 push_dump_file (FILE *, dump_flags_t
);
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