Line data Source code
1 : /* go-lang.cc -- Go frontend gcc interface.
2 : Copyright (C) 2009-2026 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 : #include "config.h"
21 : #include "system.h"
22 : #include "coretypes.h"
23 : #include "target.h"
24 : #include "tree.h"
25 : #include "gimple-expr.h"
26 : #include "diagnostic.h"
27 : #include "opts.h"
28 : #include "fold-const.h"
29 : #include "gimplify.h"
30 : #include "stor-layout.h"
31 : #include "debug.h"
32 : #include "convert.h"
33 : #include "langhooks.h"
34 : #include "langhooks-def.h"
35 : #include "common/common-target.h"
36 :
37 : #include <mpfr.h>
38 :
39 : #include "go-c.h"
40 : #include "go-gcc.h"
41 :
42 : #ifndef TARGET_AIX_OS
43 : #define TARGET_AIX_OS 0
44 : #endif
45 :
46 : /* Language-dependent contents of a type. */
47 :
48 : struct GTY(()) lang_type
49 : {
50 : char dummy;
51 : };
52 :
53 : /* Language-dependent contents of a decl. */
54 :
55 : struct GTY(()) lang_decl
56 : {
57 : char dummy;
58 : };
59 :
60 : /* Language-dependent contents of an identifier. This must include a
61 : tree_identifier. */
62 :
63 : struct GTY(()) lang_identifier
64 : {
65 : struct tree_identifier common;
66 : };
67 :
68 : /* The resulting tree type. */
69 :
70 : union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
71 : chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
72 : lang_tree_node
73 : {
74 : union tree_node GTY((tag ("0"),
75 : desc ("tree_node_structure (&%h)"))) generic;
76 : struct lang_identifier GTY((tag ("1"))) identifier;
77 : };
78 :
79 : /* We don't use language_function. */
80 :
81 : struct GTY(()) language_function
82 : {
83 : int dummy;
84 : };
85 :
86 : /* Option information we need to pass to go_create_gogo. */
87 :
88 : static const char *go_pkgpath = NULL;
89 : static const char *go_prefix = NULL;
90 : static const char *go_relative_import_path = NULL;
91 : static const char *go_c_header = NULL;
92 : static const char *go_embedcfg = NULL;
93 : static const char *go_importcfg = NULL;
94 :
95 : /* Language hooks. */
96 :
97 : static bool
98 4646 : go_langhook_init (void)
99 : {
100 4646 : build_common_tree_nodes (false);
101 :
102 : /* We must create the gogo IR after calling build_common_tree_nodes
103 : (because Gogo::define_builtin_function_trees refers indirectly
104 : to, e.g., unsigned_char_type_node) but before calling
105 : build_common_builtin_nodes (because it calls, indirectly,
106 : go_type_for_size). */
107 4646 : struct go_create_gogo_args args;
108 4646 : args.int_type_size = INT_TYPE_SIZE;
109 4646 : args.pointer_size = POINTER_SIZE;
110 4646 : args.pkgpath = go_pkgpath;
111 4646 : args.prefix = go_prefix;
112 4646 : args.relative_import_path = go_relative_import_path;
113 4646 : args.c_header = go_c_header;
114 4646 : args.embedcfg = go_embedcfg;
115 4646 : args.importcfg = go_importcfg;
116 4646 : args.check_divide_by_zero = go_check_divide_zero;
117 4646 : args.check_divide_overflow = go_check_divide_overflow;
118 4646 : args.compiling_runtime = go_compiling_runtime;
119 4646 : args.debug_escape_level = go_debug_escape_level;
120 4646 : args.debug_escape_hash = go_debug_escape_hash;
121 4646 : args.nil_check_size_threshold = TARGET_AIX_OS ? -1 : 4096;
122 4646 : args.debug_optimization = go_debug_optimization;
123 4646 : args.need_eqtype = TARGET_AIX_OS ? true : false;
124 4646 : args.linemap = go_get_linemap();
125 4646 : args.backend = go_get_backend();
126 4646 : go_create_gogo (&args);
127 :
128 4646 : build_common_builtin_nodes ();
129 :
130 : /* The default precision for floating point numbers. This is used
131 : for floating point constants with abstract type. This may
132 : eventually be controllable by a command line option. */
133 4646 : mpfr_set_default_prec (256);
134 :
135 : /* If necessary, override GCC's choice of minimum and maximum
136 : exponents. This should only affect GCC middle-end
137 : compilation-time, not correctness. */
138 4646 : mpfr_exp_t exp = mpfr_get_emax ();
139 4646 : if (exp < (1 << 16) - 1)
140 4646 : mpfr_set_emax ((1 << 16) - 1);
141 4646 : exp = mpfr_get_emin ();
142 4646 : if (exp > - ((1 << 16) - 1))
143 4646 : mpfr_set_emin (- ((1 << 16) - 1));
144 :
145 : /* Go uses exceptions. */
146 4646 : using_eh_for_cleanups ();
147 :
148 4646 : return true;
149 : }
150 :
151 : /* The option mask. */
152 :
153 : static unsigned int
154 55781 : go_langhook_option_lang_mask (void)
155 : {
156 55781 : return CL_Go;
157 : }
158 :
159 : /* Initialize the options structure. */
160 :
161 : static void
162 4646 : go_langhook_init_options_struct (struct gcc_options *opts)
163 : {
164 : /* Go says that signed overflow is precisely defined. */
165 4646 : opts->x_flag_wrapv = 1;
166 :
167 : /* We default to using strict aliasing, since Go pointers are safe.
168 : This is turned off for code that imports the "unsafe" package,
169 : because using unsafe.pointer violates C style aliasing
170 : requirements. */
171 4646 : opts->x_flag_strict_aliasing = 1;
172 :
173 : /* Default to avoiding range issues for complex multiply and
174 : divide. */
175 4646 : opts->x_flag_complex_method = 2;
176 :
177 : /* The builtin math functions should not set errno. */
178 4646 : opts->x_flag_errno_math = 0;
179 4646 : opts->frontend_set_flag_errno_math = true;
180 :
181 : /* Exceptions are used to handle recovering from panics. */
182 4646 : opts->x_flag_exceptions = 1;
183 4646 : opts->x_flag_non_call_exceptions = 1;
184 :
185 : /* We need to keep pointers live for the garbage collector. */
186 4646 : opts->x_flag_keep_gc_roots_live = 1;
187 :
188 : /* Go programs expect runtime.Callers to work, and that uses
189 : libbacktrace that uses debug info. Set the debug info level to 1
190 : by default. In post_options we will set the debug type if the
191 : debug info level was not set back to 0 on the command line. */
192 4646 : opts->x_debug_info_level = DINFO_LEVEL_TERSE;
193 4646 : }
194 :
195 : /* Infrastructure for a vector of char * pointers. */
196 :
197 : typedef const char *go_char_p;
198 :
199 : /* The list of directories to search after all the Go specific
200 : directories have been searched. */
201 :
202 : static vec<go_char_p> go_search_dirs;
203 :
204 : /* Handle Go specific options. Return 0 if we didn't do anything. */
205 :
206 : static bool
207 45930 : go_langhook_handle_option (
208 : size_t scode,
209 : const char *arg,
210 : HOST_WIDE_INT value,
211 : int kind ATTRIBUTE_UNUSED,
212 : location_t loc ATTRIBUTE_UNUSED,
213 : const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
214 : {
215 45930 : enum opt_code code = (enum opt_code) scode;
216 45930 : bool ret = true;
217 :
218 45930 : switch (code)
219 : {
220 4487 : case OPT_I:
221 4487 : go_add_search_path (arg);
222 4487 : break;
223 :
224 34349 : case OPT_L:
225 : /* A -L option is assumed to come from the compiler driver.
226 : This is a system directory. We search the following
227 : directories, if they exist, before this one:
228 : dir/go/VERSION
229 : dir/go/VERSION/MACHINE
230 : This is like include/c++. */
231 34349 : {
232 34349 : static const char dir_separator_str[] = { DIR_SEPARATOR, 0 };
233 34349 : size_t len;
234 34349 : char *p;
235 34349 : struct stat st;
236 :
237 34349 : len = strlen (arg);
238 34349 : p = XALLOCAVEC (char,
239 : (len + sizeof "go" + sizeof DEFAULT_TARGET_VERSION
240 : + sizeof DEFAULT_TARGET_MACHINE + 3));
241 34349 : strcpy (p, arg);
242 34349 : if (len > 0 && !IS_DIR_SEPARATOR (p[len - 1]))
243 34349 : strcat (p, dir_separator_str);
244 34349 : strcat (p, "go");
245 34349 : strcat (p, dir_separator_str);
246 34349 : strcat (p, DEFAULT_TARGET_VERSION);
247 34349 : if (stat (p, &st) == 0 && S_ISDIR (st.st_mode))
248 : {
249 0 : go_add_search_path (p);
250 0 : strcat (p, dir_separator_str);
251 0 : strcat (p, DEFAULT_TARGET_MACHINE);
252 0 : if (stat (p, &st) == 0 && S_ISDIR (st.st_mode))
253 0 : go_add_search_path (p);
254 : }
255 :
256 : /* Search ARG too, but only after we've searched to Go
257 : specific directories for all -L arguments. */
258 34349 : go_search_dirs.safe_push (arg);
259 : }
260 34349 : break;
261 :
262 0 : case OPT_fgo_dump_:
263 0 : ret = go_enable_dump (arg) ? true : false;
264 0 : break;
265 :
266 0 : case OPT_fgo_optimize_:
267 0 : ret = go_enable_optimize (arg, value) ? true : false;
268 0 : break;
269 :
270 2014 : case OPT_fgo_pkgpath_:
271 2014 : go_pkgpath = arg;
272 2014 : break;
273 :
274 0 : case OPT_fgo_prefix_:
275 0 : go_prefix = arg;
276 0 : break;
277 :
278 16 : case OPT_fgo_relative_import_path_:
279 16 : go_relative_import_path = arg;
280 16 : break;
281 :
282 4 : case OPT_fgo_c_header_:
283 4 : go_c_header = arg;
284 4 : break;
285 :
286 8 : case OPT_fgo_embedcfg_:
287 8 : go_embedcfg = arg;
288 8 : break;
289 :
290 380 : case OPT_fgo_importcfg_:
291 380 : go_importcfg = arg;
292 380 : break;
293 :
294 : default:
295 : /* Just return 1 to indicate that the option is valid. */
296 : break;
297 : }
298 :
299 45930 : return ret;
300 : }
301 :
302 : /* Run after parsing options. */
303 :
304 : static bool
305 4646 : go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
306 : {
307 4646 : unsigned int ix;
308 4646 : const char *dir;
309 :
310 4646 : gcc_assert (num_in_fnames > 0);
311 :
312 38995 : FOR_EACH_VEC_ELT (go_search_dirs, ix, dir)
313 34349 : go_add_search_path (dir);
314 4646 : go_search_dirs.release ();
315 :
316 4646 : if (flag_excess_precision == EXCESS_PRECISION_DEFAULT)
317 4646 : flag_excess_precision = EXCESS_PRECISION_STANDARD;
318 :
319 : /* Tail call optimizations can confuse uses of runtime.Callers. */
320 4646 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
321 : flag_optimize_sibling_calls, 0);
322 :
323 : /* Partial inlining can confuses uses of runtime.Callers.
324 : See https://gcc.gnu.org/PR91663. */
325 4646 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
326 : flag_partial_inlining, 0);
327 :
328 : /* Go programs expect runtime.Callers to give the right answers,
329 : which means that we can't combine functions even if they look the
330 : same. */
331 4646 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
332 : flag_ipa_icf_functions, 0);
333 :
334 : /* If the debug info level is still 1, as set in init_options, make
335 : sure that some debugging type is selected. */
336 4646 : if (global_options.x_debug_info_level == DINFO_LEVEL_TERSE
337 1275 : && global_options.x_write_symbols == NO_DEBUG)
338 0 : global_options.x_write_symbols = PREFERRED_DEBUGGING_TYPE;
339 :
340 : /* We turn on stack splitting if we can. */
341 4646 : if (targetm_common.supports_split_stack (false, &global_options))
342 4646 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
343 : flag_split_stack, 1);
344 :
345 : /* If stack splitting is turned on, and the user did not explicitly
346 : request function partitioning, turn off partitioning, as it
347 : confuses the linker when trying to handle partitioned split-stack
348 : code that calls a non-split-stack function. */
349 4646 : if (global_options.x_flag_split_stack
350 4646 : && global_options.x_flag_reorder_blocks_and_partition)
351 2676 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
352 : flag_reorder_blocks_and_partition, 0);
353 :
354 : /* Returning false means that the backend should be used. */
355 4646 : return false;
356 : }
357 :
358 : static void
359 4646 : go_langhook_parse_file (void)
360 : {
361 4646 : go_parse_input_files (in_fnames, num_in_fnames, flag_syntax_only,
362 4646 : go_require_return_statement);
363 :
364 : /* Final processing of globals and early debug info generation. */
365 4646 : go_write_globals ();
366 4646 : }
367 :
368 : static tree
369 4158943 : go_langhook_type_for_size (unsigned int bits, int unsignedp)
370 : {
371 4158943 : tree type;
372 4158943 : if (unsignedp)
373 : {
374 3886927 : if (bits == INT_TYPE_SIZE)
375 1725123 : type = unsigned_type_node;
376 2161804 : else if (bits == CHAR_TYPE_SIZE)
377 48606 : type = unsigned_char_type_node;
378 2113198 : else if (bits == SHORT_TYPE_SIZE)
379 2472 : type = short_unsigned_type_node;
380 2170964 : else if (bits == LONG_TYPE_SIZE)
381 2050339 : type = long_unsigned_type_node;
382 60387 : else if (bits == LONG_LONG_TYPE_SIZE)
383 60238 : type = long_long_unsigned_type_node;
384 : else
385 149 : type = make_unsigned_type(bits);
386 : }
387 : else
388 : {
389 272016 : if (bits == INT_TYPE_SIZE)
390 98072 : type = integer_type_node;
391 173944 : else if (bits == CHAR_TYPE_SIZE)
392 774 : type = signed_char_type_node;
393 173170 : else if (bits == SHORT_TYPE_SIZE)
394 872 : type = short_integer_type_node;
395 174510 : else if (bits == LONG_TYPE_SIZE)
396 170000 : type = long_integer_type_node;
397 2298 : else if (bits == LONG_LONG_TYPE_SIZE)
398 2126 : type = long_long_integer_type_node;
399 : else
400 172 : type = make_signed_type(bits);
401 : }
402 4158943 : return type;
403 : }
404 :
405 : static tree
406 3988722 : go_langhook_type_for_mode (machine_mode mode, int unsignedp)
407 : {
408 3988722 : tree type;
409 : /* Go has no vector types. Build them here. FIXME: It does not
410 : make sense for the middle-end to ask the frontend for a type
411 : which the frontend does not support. However, at least for now
412 : it is required. See PR 46805. */
413 3988722 : if (GET_MODE_CLASS (mode) == MODE_VECTOR_BOOL
414 3988722 : && valid_vector_subparts_p (GET_MODE_NUNITS (mode)))
415 : {
416 0 : unsigned int elem_bits = vector_element_size (GET_MODE_PRECISION (mode),
417 : GET_MODE_NUNITS (mode));
418 0 : tree bool_type = build_nonstandard_boolean_type (elem_bits);
419 0 : return build_vector_type_for_mode (bool_type, mode);
420 : }
421 3982929 : else if (VECTOR_MODE_P (mode)
422 3994515 : && valid_vector_subparts_p (GET_MODE_NUNITS (mode)))
423 : {
424 5793 : tree inner;
425 :
426 11586 : inner = go_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp);
427 5793 : if (inner != NULL_TREE)
428 5793 : return build_vector_type_for_mode (inner, mode);
429 : return NULL_TREE;
430 : }
431 :
432 3982929 : scalar_int_mode imode;
433 3982929 : scalar_float_mode fmode;
434 3982929 : complex_mode cmode;
435 3982929 : if (is_int_mode (mode, &imode))
436 7834442 : return go_langhook_type_for_size (GET_MODE_BITSIZE (imode), unsignedp);
437 65708 : else if (is_float_mode (mode, &fmode))
438 : {
439 74010 : switch (GET_MODE_BITSIZE (fmode))
440 : {
441 420 : case 32:
442 420 : return float_type_node;
443 25216 : case 64:
444 25216 : return double_type_node;
445 11369 : default:
446 : // We have to check for long double in order to support
447 : // i386 excess precision.
448 11369 : if (fmode == TYPE_MODE(long_double_type_node))
449 11369 : return long_double_type_node;
450 : }
451 : }
452 28703 : else if (is_complex_float_mode (mode, &cmode))
453 : {
454 55760 : switch (GET_MODE_BITSIZE (cmode))
455 : {
456 4650 : case 64:
457 4650 : return complex_float_type_node;
458 4646 : case 128:
459 4646 : return complex_double_type_node;
460 18584 : default:
461 : // We have to check for long double in order to support
462 : // i386 excess precision.
463 18584 : if (cmode == TYPE_MODE(complex_long_double_type_node))
464 4646 : return complex_long_double_type_node;
465 : }
466 : }
467 :
468 : #if HOST_BITS_PER_WIDE_INT >= 64
469 : /* The middle-end and some backends rely on TImode being supported
470 : for 64-bit HWI. */
471 14761 : if (mode == TImode)
472 : {
473 0 : type = build_nonstandard_integer_type (GET_MODE_BITSIZE (TImode),
474 : unsignedp);
475 0 : if (type && TYPE_MODE (type) == TImode)
476 : return type;
477 : }
478 : #endif
479 : return NULL_TREE;
480 : }
481 :
482 : /* Record a builtin function. We just ignore builtin functions. */
483 :
484 : static tree
485 803758 : go_langhook_builtin_function (tree decl)
486 : {
487 803758 : return decl;
488 : }
489 :
490 : /* Return true if we are in the global binding level. */
491 :
492 : static bool
493 91586 : go_langhook_global_bindings_p (void)
494 : {
495 91586 : return current_function_decl == NULL_TREE;
496 : }
497 :
498 : /* Push a declaration into the current binding level. We can't
499 : usefully implement this since we don't want to convert from tree
500 : back to one of our internal data structures. I think the only way
501 : this is used is to record a decl which is to be returned by
502 : getdecls, and we could implement it for that purpose if
503 : necessary. */
504 :
505 : static tree
506 0 : go_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
507 : {
508 0 : gcc_unreachable ();
509 : }
510 :
511 : /* This hook is used to get the current list of declarations as trees.
512 : We don't support that; instead we use the write_globals hook. */
513 :
514 : static tree
515 0 : go_langhook_getdecls (void)
516 : {
517 0 : return NULL;
518 : }
519 :
520 : /* Go specific gimplification. We need to gimplify
521 : CALL_EXPR_STATIC_CHAIN, because the gimplifier doesn't handle
522 : it. */
523 :
524 : static int
525 91692021 : go_langhook_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
526 : {
527 91692021 : if (TREE_CODE (*expr_p) == CALL_EXPR
528 91692021 : && CALL_EXPR_STATIC_CHAIN (*expr_p) != NULL_TREE)
529 28158 : gimplify_expr (&CALL_EXPR_STATIC_CHAIN (*expr_p), pre_p, post_p,
530 : is_gimple_val, fb_rvalue);
531 91692021 : return GS_UNHANDLED;
532 : }
533 :
534 : /* Return a decl for the exception personality function. The function
535 : itself is implemented in libgo/runtime/go-unwind.c. */
536 :
537 : static tree
538 8318 : go_langhook_eh_personality (void)
539 : {
540 8318 : static tree personality_decl;
541 8318 : if (personality_decl == NULL_TREE)
542 : {
543 882 : personality_decl = build_personality_function ("gccgo");
544 882 : go_preserve_from_gc (personality_decl);
545 : }
546 8318 : return personality_decl;
547 : }
548 :
549 : /* Get a value for the SARIF v2.1.0 "artifact.sourceLanguage" property,
550 : based on the list in SARIF v2.1.0 Appendix J. */
551 :
552 : static const char *
553 0 : go_get_sarif_source_language (const char *)
554 : {
555 0 : return "go";
556 : }
557 :
558 : /* Functions called directly by the generic backend. */
559 :
560 : tree
561 25682 : convert (tree type, tree expr)
562 : {
563 25682 : if (type == error_mark_node
564 25682 : || expr == error_mark_node
565 51364 : || TREE_TYPE (expr) == error_mark_node)
566 : return error_mark_node;
567 :
568 25682 : if (type == TREE_TYPE (expr))
569 : return expr;
570 :
571 24477 : if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
572 126 : return fold_convert (type, expr);
573 :
574 24351 : switch (TREE_CODE (type))
575 : {
576 0 : case VOID_TYPE:
577 0 : case BOOLEAN_TYPE:
578 0 : return fold_convert (type, expr);
579 5769 : case INTEGER_TYPE:
580 5769 : return fold (convert_to_integer (type, expr));
581 0 : case POINTER_TYPE:
582 0 : return fold (convert_to_pointer (type, expr));
583 18346 : case REAL_TYPE:
584 18346 : return fold (convert_to_real (type, expr));
585 236 : case COMPLEX_TYPE:
586 236 : return fold (convert_to_complex (type, expr));
587 0 : default:
588 0 : break;
589 : }
590 :
591 0 : gcc_unreachable ();
592 : }
593 :
594 : /* FIXME: This is a hack to preserve trees that we create from the
595 : garbage collector. */
596 :
597 : static GTY(()) tree go_gc_root;
598 :
599 : void
600 3888148 : go_preserve_from_gc (tree t)
601 : {
602 3888148 : go_gc_root = tree_cons (NULL_TREE, t, go_gc_root);
603 3888148 : }
604 :
605 : /* Convert an identifier for use in an error message. */
606 :
607 : const char *
608 275708 : go_localize_identifier (const char *ident)
609 : {
610 275708 : return identifier_to_locale (ident);
611 : }
612 :
613 : #undef LANG_HOOKS_NAME
614 : #undef LANG_HOOKS_INIT
615 : #undef LANG_HOOKS_OPTION_LANG_MASK
616 : #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
617 : #undef LANG_HOOKS_HANDLE_OPTION
618 : #undef LANG_HOOKS_POST_OPTIONS
619 : #undef LANG_HOOKS_PARSE_FILE
620 : #undef LANG_HOOKS_TYPE_FOR_MODE
621 : #undef LANG_HOOKS_TYPE_FOR_SIZE
622 : #undef LANG_HOOKS_BUILTIN_FUNCTION
623 : #undef LANG_HOOKS_GLOBAL_BINDINGS_P
624 : #undef LANG_HOOKS_PUSHDECL
625 : #undef LANG_HOOKS_GETDECLS
626 : #undef LANG_HOOKS_GIMPLIFY_EXPR
627 : #undef LANG_HOOKS_EH_PERSONALITY
628 : #undef LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE
629 :
630 : #define LANG_HOOKS_NAME "GNU Go"
631 : #define LANG_HOOKS_INIT go_langhook_init
632 : #define LANG_HOOKS_OPTION_LANG_MASK go_langhook_option_lang_mask
633 : #define LANG_HOOKS_INIT_OPTIONS_STRUCT go_langhook_init_options_struct
634 : #define LANG_HOOKS_HANDLE_OPTION go_langhook_handle_option
635 : #define LANG_HOOKS_POST_OPTIONS go_langhook_post_options
636 : #define LANG_HOOKS_PARSE_FILE go_langhook_parse_file
637 : #define LANG_HOOKS_TYPE_FOR_MODE go_langhook_type_for_mode
638 : #define LANG_HOOKS_TYPE_FOR_SIZE go_langhook_type_for_size
639 : #define LANG_HOOKS_BUILTIN_FUNCTION go_langhook_builtin_function
640 : #define LANG_HOOKS_GLOBAL_BINDINGS_P go_langhook_global_bindings_p
641 : #define LANG_HOOKS_PUSHDECL go_langhook_pushdecl
642 : #define LANG_HOOKS_GETDECLS go_langhook_getdecls
643 : #define LANG_HOOKS_GIMPLIFY_EXPR go_langhook_gimplify_expr
644 : #define LANG_HOOKS_EH_PERSONALITY go_langhook_eh_personality
645 : #define LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE go_get_sarif_source_language
646 :
647 : struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
648 :
649 : #include "gt-go-go-lang.h"
650 : #include "gtype-go.h"
|