| 1 | /* Data structure definitions for common hooks. |
| 2 | Copyright (C) 2010-2025 Free Software Foundation, Inc. |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or modify it |
| 5 | under the terms of the GNU General Public License as published by the |
| 6 | Free Software Foundation; either version 3, or (at your option) any |
| 7 | later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program; see the file COPYING3. If not see |
| 16 | <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | In other words, you are welcome to use, share and improve this program. |
| 19 | You are forbidden to forbid anyone else to use, share and improve |
| 20 | what you give them. Help stamp out software-hoarding! */ |
| 21 | |
| 22 | #ifndef GCC_COMMON_TARGET_H |
| 23 | #define GCC_COMMON_TARGET_H |
| 24 | |
| 25 | |
| 26 | /* Sets of optimization levels at which an option may be enabled by |
| 27 | default_options_optimization. */ |
| 28 | enum opt_levels |
| 29 | { |
| 30 | OPT_LEVELS_NONE, /* No levels (mark end of array). */ |
| 31 | OPT_LEVELS_ALL, /* All levels (used by targets to disable options |
| 32 | enabled in target-independent code). */ |
| 33 | OPT_LEVELS_0_ONLY, /* -O0 only. */ |
| 34 | OPT_LEVELS_1_PLUS, /* -O1 and above, including -Os and -Og. */ |
| 35 | OPT_LEVELS_1_PLUS_SPEED_ONLY, /* -O1 and above, but not -Os or -Og. */ |
| 36 | OPT_LEVELS_1_PLUS_NOT_DEBUG, /* -O1 and above, but not -Og. */ |
| 37 | OPT_LEVELS_2_PLUS, /* -O2 and above, including -Os. */ |
| 38 | OPT_LEVELS_2_PLUS_SPEED_ONLY, /* -O2 and above, but not -Os or -Og. */ |
| 39 | OPT_LEVELS_3_PLUS, /* -O3 and above. */ |
| 40 | OPT_LEVELS_3_PLUS_AND_SIZE, /* -O3 and above and -Os. */ |
| 41 | OPT_LEVELS_SIZE, /* -Os only. */ |
| 42 | OPT_LEVELS_FAST /* -Ofast only. */ |
| 43 | }; |
| 44 | |
| 45 | /* Description of options to enable by default at given levels. */ |
| 46 | struct default_options |
| 47 | { |
| 48 | /* The levels at which to enable the option. */ |
| 49 | enum opt_levels levels; |
| 50 | |
| 51 | /* The option index and argument or enabled/disabled sense of the |
| 52 | option, as passed to handle_generated_option. If ARG is NULL and |
| 53 | the option allows a negative form, the option is considered to be |
| 54 | passed in negative form when the optimization level is not one of |
| 55 | those in LEVELS (in order to handle changes to the optimization |
| 56 | level with the "optimize" attribute). */ |
| 57 | size_t opt_index; |
| 58 | const char *arg; |
| 59 | int value; |
| 60 | }; |
| 61 | |
| 62 | #define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME; |
| 63 | #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS; |
| 64 | #define DEFHOOK_UNDOC DEFHOOK |
| 65 | #define HOOKSTRUCT(FRAGMENT) FRAGMENT |
| 66 | |
| 67 | #include "common-target.def" |
| 68 | |
| 69 | extern struct gcc_targetm_common targetm_common; |
| 70 | |
| 71 | #endif /* GCC_C_TARGET_H */ |
| 72 | |