xref: /dflybsd-src/contrib/gcc-8.0/gcc/context.h (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj /* context.h - Holder for global state
2*38fd1498Szrj    Copyright (C) 2013-2018 Free Software Foundation, Inc.
3*38fd1498Szrj 
4*38fd1498Szrj This file is part of GCC.
5*38fd1498Szrj 
6*38fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
7*38fd1498Szrj the terms of the GNU General Public License as published by the Free
8*38fd1498Szrj Software Foundation; either version 3, or (at your option) any later
9*38fd1498Szrj version.
10*38fd1498Szrj 
11*38fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12*38fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
13*38fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*38fd1498Szrj for more details.
15*38fd1498Szrj 
16*38fd1498Szrj You should have received a copy of the GNU General Public License
17*38fd1498Szrj along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj 
20*38fd1498Szrj #ifndef GCC_CONTEXT_H
21*38fd1498Szrj #define GCC_CONTEXT_H
22*38fd1498Szrj 
23*38fd1498Szrj namespace gcc {
24*38fd1498Szrj 
25*38fd1498Szrj class pass_manager;
26*38fd1498Szrj class dump_manager;
27*38fd1498Szrj 
28*38fd1498Szrj /* GCC's internal state can be divided into zero or more
29*38fd1498Szrj    "parallel universe" of state; an instance of this class is one such
30*38fd1498Szrj    context of state.  */
31*38fd1498Szrj class context
32*38fd1498Szrj {
33*38fd1498Szrj public:
34*38fd1498Szrj   context ();
35*38fd1498Szrj   ~context ();
36*38fd1498Szrj 
37*38fd1498Szrj   /* The flag shows if there are symbols to be streamed for offloading.  */
38*38fd1498Szrj   bool have_offload;
39*38fd1498Szrj 
40*38fd1498Szrj   /* Pass-management.  */
41*38fd1498Szrj 
set_passes(pass_manager * m)42*38fd1498Szrj   void set_passes (pass_manager *m)
43*38fd1498Szrj   {
44*38fd1498Szrj     gcc_assert (!m_passes);
45*38fd1498Szrj     m_passes = m;
46*38fd1498Szrj   }
47*38fd1498Szrj 
get_passes()48*38fd1498Szrj   pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; }
49*38fd1498Szrj 
50*38fd1498Szrj   /* Handling dump files.  */
51*38fd1498Szrj 
get_dumps()52*38fd1498Szrj   dump_manager *get_dumps () {gcc_assert (m_dumps); return m_dumps; }
53*38fd1498Szrj 
54*38fd1498Szrj private:
55*38fd1498Szrj   /* Pass-management.  */
56*38fd1498Szrj   pass_manager *m_passes;
57*38fd1498Szrj 
58*38fd1498Szrj   /* Dump files.  */
59*38fd1498Szrj   dump_manager *m_dumps;
60*38fd1498Szrj 
61*38fd1498Szrj }; // class context
62*38fd1498Szrj 
63*38fd1498Szrj } // namespace gcc
64*38fd1498Szrj 
65*38fd1498Szrj /* The global singleton context aka "g".
66*38fd1498Szrj    (the name is chosen to be easy to type in a debugger).  */
67*38fd1498Szrj extern gcc::context *g;
68*38fd1498Szrj 
69*38fd1498Szrj #endif /* ! GCC_CONTEXT_H */
70