Line data Source code
1 : /* pass-events.h - pub/sub messages about GCC optimization passes.
2 : Copyright (C) 2025 Free Software Foundation, Inc.
3 :
4 : This file is part of GCC.
5 :
6 : GCC is free software; you can redistribute it and/or modify it under
7 : the terms of the GNU General Public License as published by the Free
8 : Software Foundation; either version 3, or (at your option) any later
9 : version.
10 :
11 : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 : WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 : for more details.
15 :
16 : You should have received a copy of the GNU General Public License
17 : along with GCC; see the file COPYING3. If not see
18 : <http://www.gnu.org/licenses/>. */
19 :
20 : #ifndef GCC_TOPICS_PASS_EVENTS_H
21 : #define GCC_TOPICS_PASS_EVENTS_H
22 :
23 : #include "pub-sub.h"
24 :
25 : namespace gcc {
26 : namespace topics {
27 :
28 : /* A topic for messages relating to GCC optimization passes. */
29 :
30 : namespace pass_events {
31 :
32 : struct before_pass
33 : {
34 : opt_pass *pass;
35 : function *fun;
36 : };
37 :
38 : struct after_pass
39 : {
40 : opt_pass *pass;
41 : function *fun;
42 : };
43 :
44 : /* Abstract base class for a subscriber to messages about
45 : GCC optimization passes. */
46 :
47 2 : struct subscriber
48 : {
49 : virtual ~subscriber () = default;
50 :
51 : virtual void on_message (const before_pass &) = 0;
52 : virtual void on_message (const after_pass &) = 0;
53 : };
54 :
55 : } // namespace gcc::topics::pass_events
56 : } // namespace gcc::topics
57 : } // namespace gcc
58 :
59 : #endif /* ! GCC_TOPICS_PASS_EVENTS_H */
|