RISC-V: far-branch: Handle far jumps and branches for functions larger than 1MB
[official-gcc.git] / libcc1 / compiler.hh
blobc25c0b7396e2f99f321053163004e80bc9f85996
1 /* Compiler handling for plugin
2 Copyright (C) 2014-2023 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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/>. */
20 #ifndef CC1_PLUGIN_COMPILER_HH
21 #define CC1_PLUGIN_COMPILER_HH
23 namespace cc1_plugin
26 // Base class for compiler.
27 class compiler
29 public:
30 explicit compiler (bool v)
31 : verbose (v)
35 virtual ~compiler () = default;
37 // Find the compiler. BASE is the base name of the compiler, see
38 // compiler-name.hh. This sets COMPILER to the resulting path.
39 // Returns nullptr on success, or a malloc'd error string on
40 // failure.
41 virtual char *find (const char *base, std::string &compiler) const;
43 void set_verbose (bool v)
45 verbose = v;
48 protected:
49 bool verbose;
52 /* Compiler to set by set_triplet_regexp. */
53 class compiler_triplet_regexp : public compiler
55 private:
56 std::string triplet_regexp_;
57 public:
59 char *find (const char *base, std::string &compiler) const override;
61 compiler_triplet_regexp (bool v, const char *triplet_regexp)
62 : compiler (v), triplet_regexp_ (triplet_regexp)
67 /* Compiler to set by set_driver_filename. */
68 class compiler_driver_filename : public compiler
70 private:
71 std::string driver_filename_;
72 public:
73 char *find (const char *base, std::string &compiler) const override;
75 compiler_driver_filename (bool v, const char *driver_filename)
76 : compiler (v), driver_filename_ (driver_filename)
83 #endif // CC1_PLUGIN_COMPILER_HH