Extend fold_vec_perm to handle VLA vector_cst.
[official-gcc.git] / libcc1 / libcc1plugin.cc
blob283eaf206850c6505127a92a1138092d1e320ab0
1 /* Library interface to C front end
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 #include <cc1plugin-config.h>
22 #undef PACKAGE_NAME
23 #undef PACKAGE_STRING
24 #undef PACKAGE_TARNAME
25 #undef PACKAGE_VERSION
27 #include "../gcc/config.h"
29 #undef PACKAGE_NAME
30 #undef PACKAGE_STRING
31 #undef PACKAGE_TARNAME
32 #undef PACKAGE_VERSION
34 #define INCLUDE_MEMORY
35 #include "gcc-plugin.h"
36 #include "system.h"
37 #include "coretypes.h"
38 #include "stringpool.h"
40 #include "gcc-interface.h"
41 #include "hash-set.h"
42 #include "machmode.h"
43 #include "vec.h"
44 #include "double-int.h"
45 #include "input.h"
46 #include "alias.h"
47 #include "symtab.h"
48 #include "options.h"
49 #include "wide-int.h"
50 #include "inchash.h"
51 #include "tree.h"
52 #include "fold-const.h"
53 #include "stor-layout.h"
54 #include "c-tree.h"
55 #include "toplev.h"
56 #include "timevar.h"
57 #include "hash-table.h"
58 #include "tm.h"
59 #include "c-family/c-pragma.h"
60 #include "c-lang.h"
61 #include "diagnostic.h"
62 #include "langhooks.h"
63 #include "langhooks-def.h"
65 #include "callbacks.hh"
66 #include "connection.hh"
67 #include "marshall.hh"
68 #include "rpc.hh"
69 #include "gcc-c-interface.h"
70 #include "context.hh"
72 #include <vector>
74 using namespace cc1_plugin;
78 // A wrapper for pushdecl that doesn't let gdb have a chance to
79 // instantiate a symbol.
81 static void
82 pushdecl_safe (tree decl)
84 void (*save) (enum c_oracle_request, tree identifier);
86 save = c_binding_oracle;
87 c_binding_oracle = NULL;
88 pushdecl (decl);
89 c_binding_oracle = save;
94 static void
95 plugin_binding_oracle (enum c_oracle_request kind, tree identifier)
97 enum gcc_c_oracle_request request;
99 gcc_assert (current_context != NULL);
101 switch (kind)
103 case C_ORACLE_SYMBOL:
104 request = GCC_C_ORACLE_SYMBOL;
105 break;
106 case C_ORACLE_TAG:
107 request = GCC_C_ORACLE_TAG;
108 break;
109 case C_ORACLE_LABEL:
110 request = GCC_C_ORACLE_LABEL;
111 break;
112 default:
113 abort ();
116 int ignore;
117 cc1_plugin::call (current_context, "binding_oracle", &ignore,
118 request, IDENTIFIER_POINTER (identifier));
121 static void
122 plugin_pragma_user_expression (cpp_reader *)
124 c_binding_oracle = plugin_binding_oracle;
127 static void
128 plugin_init_extra_pragmas (void *, void *)
130 c_register_pragma ("GCC", "user_expression", plugin_pragma_user_expression);
135 // Maybe rewrite a decl to its address.
136 static tree
137 address_rewriter (tree *in, int *walk_subtrees, void *arg)
139 plugin_context *ctx = (plugin_context *) arg;
141 if (!DECL_P (*in) || DECL_NAME (*in) == NULL_TREE)
142 return NULL_TREE;
144 decl_addr_value value;
145 value.decl = *in;
146 decl_addr_value *found_value = ctx->address_map.find (&value);
147 if (found_value != NULL)
149 else if (DECL_IS_UNDECLARED_BUILTIN (*in))
151 gcc_address address;
153 if (!cc1_plugin::call (ctx, "address_oracle", &address,
154 IDENTIFIER_POINTER (DECL_NAME (*in))))
155 return NULL_TREE;
156 if (address == 0)
157 return NULL_TREE;
159 // Insert the decl into the address map in case it is referenced
160 // again.
161 value.address = build_int_cst_type (ptr_type_node, address);
162 decl_addr_value **slot = ctx->address_map.find_slot (&value, INSERT);
163 gcc_assert (*slot == NULL);
164 *slot
165 = static_cast<decl_addr_value *> (xmalloc (sizeof (decl_addr_value)));
166 **slot = value;
167 found_value = *slot;
169 else
170 return NULL_TREE;
172 if (found_value->address != error_mark_node)
174 // We have an address for the decl, so rewrite the tree.
175 tree ptr_type = build_pointer_type (TREE_TYPE (*in));
176 *in = fold_build1 (INDIRECT_REF, TREE_TYPE (*in),
177 fold_build1 (CONVERT_EXPR, ptr_type,
178 found_value->address));
181 *walk_subtrees = 0;
183 return NULL_TREE;
186 // When generating code for gdb, we want to be able to use absolute
187 // addresses to refer to otherwise external objects that gdb knows
188 // about. gdb passes in these addresses when building decls, and then
189 // before gimplification we go through the trees, rewriting uses to
190 // the equivalent of "*(TYPE *) ADDR".
191 static void
192 rewrite_decls_to_addresses (void *function_in, void *)
194 tree function = (tree) function_in;
196 // Do nothing if we're not in gdb.
197 if (current_context == NULL)
198 return;
200 walk_tree (&DECL_SAVED_TREE (function), address_rewriter, current_context,
201 NULL);
206 gcc_decl
207 plugin_build_decl (cc1_plugin::connection *self,
208 const char *name,
209 enum gcc_c_symbol_kind sym_kind,
210 gcc_type sym_type_in,
211 const char *substitution_name,
212 gcc_address address,
213 const char *filename,
214 unsigned int line_number)
216 plugin_context *ctx = static_cast<plugin_context *> (self);
217 tree identifier = get_identifier (name);
218 enum tree_code code;
219 tree decl;
220 tree sym_type = convert_in (sym_type_in);
222 switch (sym_kind)
224 case GCC_C_SYMBOL_FUNCTION:
225 code = FUNCTION_DECL;
226 break;
228 case GCC_C_SYMBOL_VARIABLE:
229 code = VAR_DECL;
230 break;
232 case GCC_C_SYMBOL_TYPEDEF:
233 code = TYPE_DECL;
234 break;
236 case GCC_C_SYMBOL_LABEL:
237 // FIXME: we aren't ready to handle labels yet.
238 // It isn't clear how to translate them properly
239 // and in any case a "goto" isn't likely to work.
240 return convert_out (error_mark_node);
242 default:
243 abort ();
246 location_t loc = ctx->get_location_t (filename, line_number);
248 decl = build_decl (loc, code, identifier, sym_type);
249 TREE_USED (decl) = 1;
250 TREE_ADDRESSABLE (decl) = 1;
252 if (sym_kind != GCC_C_SYMBOL_TYPEDEF)
254 decl_addr_value value;
256 DECL_EXTERNAL (decl) = 1;
257 value.decl = decl;
258 if (substitution_name != NULL)
260 // If the translator gave us a name without a binding,
261 // we can just substitute error_mark_node, since we know the
262 // translator will be reporting an error anyhow.
263 value.address
264 = lookup_name (get_identifier (substitution_name));
265 if (value.address == NULL_TREE)
266 value.address = error_mark_node;
268 else
269 value.address = build_int_cst_type (ptr_type_node, address);
270 decl_addr_value **slot = ctx->address_map.find_slot (&value, INSERT);
271 gcc_assert (*slot == NULL);
272 *slot
273 = static_cast<decl_addr_value *> (xmalloc (sizeof (decl_addr_value)));
274 **slot = value;
277 return convert_out (ctx->preserve (decl));
281 plugin_bind (cc1_plugin::connection *,
282 gcc_decl decl_in, int is_global)
284 tree decl = convert_in (decl_in);
285 c_bind (DECL_SOURCE_LOCATION (decl), decl, is_global);
286 rest_of_decl_compilation (decl, is_global, 0);
287 return 1;
291 plugin_tagbind (cc1_plugin::connection *self,
292 const char *name, gcc_type tagged_type,
293 const char *filename, unsigned int line_number)
295 plugin_context *ctx = static_cast<plugin_context *> (self);
296 tree t = convert_in (tagged_type), x;
297 c_pushtag (ctx->get_location_t (filename, line_number),
298 get_identifier (name), t);
300 /* Propagate the newly-added type name so that previously-created
301 variant types are not disconnected from their main variants. */
302 for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x))
303 TYPE_NAME (x) = TYPE_NAME (t);
305 return 1;
308 gcc_type
309 plugin_build_pointer_type (cc1_plugin::connection *,
310 gcc_type base_type)
312 // No need to preserve a pointer type as the base type is preserved.
313 return convert_out (build_pointer_type (convert_in (base_type)));
316 // TYPE_NAME needs to be a valid pointer, even if there is no name available.
318 static tree
319 build_anonymous_node (enum tree_code code)
321 tree node = make_node (code);
322 tree type_decl = build_decl (input_location, TYPE_DECL, NULL_TREE, node);
323 TYPE_NAME (node) = type_decl;
324 TYPE_STUB_DECL (node) = type_decl;
325 return node;
328 gcc_type
329 plugin_build_record_type (cc1_plugin::connection *self)
331 plugin_context *ctx = static_cast<plugin_context *> (self);
332 return convert_out (ctx->preserve (build_anonymous_node (RECORD_TYPE)));
335 gcc_type
336 plugin_build_union_type (cc1_plugin::connection *self)
338 plugin_context *ctx = static_cast<plugin_context *> (self);
339 return convert_out (ctx->preserve (build_anonymous_node (UNION_TYPE)));
343 plugin_build_add_field (cc1_plugin::connection *,
344 gcc_type record_or_union_type_in,
345 const char *field_name,
346 gcc_type field_type_in,
347 unsigned long bitsize,
348 unsigned long bitpos)
350 tree record_or_union_type = convert_in (record_or_union_type_in);
351 tree field_type = convert_in (field_type_in);
353 gcc_assert (TREE_CODE (record_or_union_type) == RECORD_TYPE
354 || TREE_CODE (record_or_union_type) == UNION_TYPE);
356 /* Note that gdb does not preserve the location of field decls, so
357 we can't provide a decent location here. */
358 tree decl = build_decl (BUILTINS_LOCATION, FIELD_DECL,
359 get_identifier (field_name), field_type);
360 DECL_FIELD_CONTEXT (decl) = record_or_union_type;
362 if (TREE_CODE (field_type) == INTEGER_TYPE
363 && TYPE_PRECISION (field_type) != bitsize)
365 DECL_BIT_FIELD_TYPE (decl) = field_type;
366 TREE_TYPE (decl)
367 = c_build_bitfield_integer_type (bitsize, TYPE_UNSIGNED (field_type));
370 SET_DECL_MODE (decl, TYPE_MODE (TREE_TYPE (decl)));
372 // There's no way to recover this from DWARF.
373 SET_DECL_OFFSET_ALIGN (decl, TYPE_PRECISION (pointer_sized_int_node));
375 tree pos = bitsize_int (bitpos);
376 pos_from_bit (&DECL_FIELD_OFFSET (decl), &DECL_FIELD_BIT_OFFSET (decl),
377 DECL_OFFSET_ALIGN (decl), pos);
379 DECL_SIZE (decl) = bitsize_int (bitsize);
380 DECL_SIZE_UNIT (decl) = size_int ((bitsize + BITS_PER_UNIT - 1)
381 / BITS_PER_UNIT);
383 DECL_CHAIN (decl) = TYPE_FIELDS (record_or_union_type);
384 TYPE_FIELDS (record_or_union_type) = decl;
386 return 1;
390 plugin_finish_record_or_union (cc1_plugin::connection *,
391 gcc_type record_or_union_type_in,
392 unsigned long size_in_bytes)
394 tree record_or_union_type = convert_in (record_or_union_type_in);
396 gcc_assert (TREE_CODE (record_or_union_type) == RECORD_TYPE
397 || TREE_CODE (record_or_union_type) == UNION_TYPE);
399 /* We built the field list in reverse order, so fix it now. */
400 TYPE_FIELDS (record_or_union_type)
401 = nreverse (TYPE_FIELDS (record_or_union_type));
403 if (TREE_CODE (record_or_union_type) == UNION_TYPE)
405 /* Unions can just be handled by the generic code. */
406 layout_type (record_or_union_type);
408 else
410 // FIXME there's no way to get this from DWARF,
411 // or even, it seems, a particularly good way to deduce it.
412 SET_TYPE_ALIGN (record_or_union_type,
413 TYPE_PRECISION (pointer_sized_int_node));
415 TYPE_SIZE (record_or_union_type) = bitsize_int (size_in_bytes
416 * BITS_PER_UNIT);
417 TYPE_SIZE_UNIT (record_or_union_type) = size_int (size_in_bytes);
419 compute_record_mode (record_or_union_type);
420 finish_bitfield_layout (record_or_union_type);
421 // FIXME we have no idea about TYPE_PACKED
424 tree t = record_or_union_type, x;
425 for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x))
427 /* Like finish_struct, update the qualified variant types. */
428 TYPE_FIELDS (x) = TYPE_FIELDS (t);
429 TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t);
430 C_TYPE_FIELDS_READONLY (x) = C_TYPE_FIELDS_READONLY (t);
431 C_TYPE_FIELDS_VOLATILE (x) = C_TYPE_FIELDS_VOLATILE (t);
432 C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t);
433 /* We copy these fields too. */
434 SET_TYPE_ALIGN (x, TYPE_ALIGN (t));
435 TYPE_SIZE (x) = TYPE_SIZE (t);
436 TYPE_SIZE_UNIT (x) = TYPE_SIZE_UNIT (t);
437 if (x != record_or_union_type)
438 compute_record_mode (x);
441 return 1;
444 gcc_type
445 plugin_build_enum_type (cc1_plugin::connection *self,
446 gcc_type underlying_int_type_in)
448 tree underlying_int_type = convert_in (underlying_int_type_in);
450 if (underlying_int_type == error_mark_node)
451 return convert_out (error_mark_node);
453 tree result = build_anonymous_node (ENUMERAL_TYPE);
455 TYPE_PRECISION (result) = TYPE_PRECISION (underlying_int_type);
456 TYPE_UNSIGNED (result) = TYPE_UNSIGNED (underlying_int_type);
458 plugin_context *ctx = static_cast<plugin_context *> (self);
459 return convert_out (ctx->preserve (result));
463 plugin_build_add_enum_constant (cc1_plugin::connection *,
464 gcc_type enum_type_in,
465 const char *name,
466 unsigned long value)
468 tree cst, decl, cons;
469 tree enum_type = convert_in (enum_type_in);
471 gcc_assert (TREE_CODE (enum_type) == ENUMERAL_TYPE);
473 cst = build_int_cst (enum_type, value);
474 /* Note that gdb does not preserve the location of enum constants,
475 so we can't provide a decent location here. */
476 decl = build_decl (BUILTINS_LOCATION, CONST_DECL,
477 get_identifier (name), enum_type);
478 DECL_INITIAL (decl) = cst;
479 pushdecl_safe (decl);
481 cons = tree_cons (DECL_NAME (decl), cst, TYPE_VALUES (enum_type));
482 TYPE_VALUES (enum_type) = cons;
484 return 1;
488 plugin_finish_enum_type (cc1_plugin::connection *,
489 gcc_type enum_type_in)
491 tree enum_type = convert_in (enum_type_in);
492 tree minnode, maxnode, iter;
494 iter = TYPE_VALUES (enum_type);
495 minnode = maxnode = TREE_VALUE (iter);
496 for (iter = TREE_CHAIN (iter);
497 iter != NULL_TREE;
498 iter = TREE_CHAIN (iter))
500 tree value = TREE_VALUE (iter);
501 if (tree_int_cst_lt (maxnode, value))
502 maxnode = value;
503 if (tree_int_cst_lt (value, minnode))
504 minnode = value;
506 TYPE_MIN_VALUE (enum_type) = minnode;
507 TYPE_MAX_VALUE (enum_type) = maxnode;
509 layout_type (enum_type);
511 return 1;
514 gcc_type
515 plugin_build_function_type (cc1_plugin::connection *self,
516 gcc_type return_type_in,
517 const struct gcc_type_array *argument_types_in,
518 int is_varargs)
520 tree return_type = convert_in (return_type_in);
521 tree result;
523 std::vector<tree> argument_types (argument_types_in->n_elements);
524 for (int i = 0; i < argument_types_in->n_elements; ++i)
525 argument_types[i] = convert_in (argument_types_in->elements[i]);
527 if (is_varargs)
528 result = build_varargs_function_type_array (return_type,
529 argument_types_in->n_elements,
530 argument_types.data ());
531 else
532 result = build_function_type_array (return_type,
533 argument_types_in->n_elements,
534 argument_types.data ());
536 plugin_context *ctx = static_cast<plugin_context *> (self);
537 return convert_out (ctx->preserve (result));
540 /* Return a builtin type associated with BUILTIN_NAME. */
542 static tree
543 safe_lookup_builtin_type (const char *builtin_name)
545 tree result = NULL_TREE;
547 if (!builtin_name)
548 return result;
550 result = identifier_global_value (get_identifier (builtin_name));
552 if (!result)
553 return result;
555 gcc_assert (TREE_CODE (result) == TYPE_DECL);
556 result = TREE_TYPE (result);
557 return result;
560 static gcc_type
561 plugin_int_check (cc1_plugin::connection *self,
562 int is_unsigned, unsigned long size_in_bytes,
563 tree result)
565 if (result == NULL_TREE)
566 result = error_mark_node;
567 else
569 gcc_assert (!TYPE_UNSIGNED (result) == !is_unsigned);
570 gcc_assert (TREE_CODE (TYPE_SIZE (result)) == INTEGER_CST);
571 gcc_assert (TYPE_PRECISION (result) == BITS_PER_UNIT * size_in_bytes);
573 plugin_context *ctx = static_cast<plugin_context *> (self);
574 ctx->preserve (result);
576 return convert_out (result);
579 gcc_type
580 plugin_int_type_v0 (cc1_plugin::connection *self,
581 int is_unsigned, unsigned long size_in_bytes)
583 tree result = c_common_type_for_size (BITS_PER_UNIT * size_in_bytes,
584 is_unsigned);
586 return plugin_int_check (self, is_unsigned, size_in_bytes, result);
589 gcc_type
590 plugin_int_type (cc1_plugin::connection *self,
591 int is_unsigned, unsigned long size_in_bytes,
592 const char *builtin_name)
594 if (!builtin_name)
595 return plugin_int_type_v0 (self, is_unsigned, size_in_bytes);
597 tree result = safe_lookup_builtin_type (builtin_name);
598 gcc_assert (!result || TREE_CODE (result) == INTEGER_TYPE);
600 return plugin_int_check (self, is_unsigned, size_in_bytes, result);
603 gcc_type
604 plugin_char_type (cc1_plugin::connection *)
606 return convert_out (char_type_node);
609 gcc_type
610 plugin_float_type_v0 (cc1_plugin::connection *,
611 unsigned long size_in_bytes)
613 if (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (float_type_node))
614 return convert_out (float_type_node);
615 if (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (double_type_node))
616 return convert_out (double_type_node);
617 if (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (long_double_type_node))
618 return convert_out (long_double_type_node);
619 return convert_out (error_mark_node);
622 gcc_type
623 plugin_float_type (cc1_plugin::connection *self,
624 unsigned long size_in_bytes,
625 const char *builtin_name)
627 if (!builtin_name)
628 return plugin_float_type_v0 (self, size_in_bytes);
630 tree result = safe_lookup_builtin_type (builtin_name);
632 if (!result)
633 return convert_out (error_mark_node);
635 gcc_assert (SCALAR_FLOAT_TYPE_P (result));
636 gcc_assert (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (result));
638 return convert_out (result);
641 gcc_type
642 plugin_void_type (cc1_plugin::connection *)
644 return convert_out (void_type_node);
647 gcc_type
648 plugin_bool_type (cc1_plugin::connection *)
650 return convert_out (boolean_type_node);
653 gcc_type
654 plugin_build_array_type (cc1_plugin::connection *self,
655 gcc_type element_type_in, int num_elements)
657 tree element_type = convert_in (element_type_in);
658 tree result;
660 if (num_elements == -1)
661 result = build_array_type (element_type, NULL_TREE);
662 else
663 result = build_array_type_nelts (element_type, num_elements);
665 plugin_context *ctx = static_cast<plugin_context *> (self);
666 return convert_out (ctx->preserve (result));
669 gcc_type
670 plugin_build_vla_array_type (cc1_plugin::connection *self,
671 gcc_type element_type_in,
672 const char *upper_bound_name)
674 tree element_type = convert_in (element_type_in);
675 tree upper_bound = lookup_name (get_identifier (upper_bound_name));
676 tree range = build_index_type (upper_bound);
678 tree result = build_array_type (element_type, range);
679 C_TYPE_VARIABLE_SIZE (result) = 1;
681 plugin_context *ctx = static_cast<plugin_context *> (self);
682 return convert_out (ctx->preserve (result));
685 gcc_type
686 plugin_build_qualified_type (cc1_plugin::connection *,
687 gcc_type unqualified_type_in,
688 enum gcc_qualifiers qualifiers)
690 tree unqualified_type = convert_in (unqualified_type_in);
691 int quals = 0;
693 if ((qualifiers & GCC_QUALIFIER_CONST) != 0)
694 quals |= TYPE_QUAL_CONST;
695 if ((qualifiers & GCC_QUALIFIER_VOLATILE) != 0)
696 quals |= TYPE_QUAL_VOLATILE;
697 if ((qualifiers & GCC_QUALIFIER_RESTRICT) != 0)
698 quals |= TYPE_QUAL_RESTRICT;
700 return convert_out (build_qualified_type (unqualified_type, quals));
703 gcc_type
704 plugin_build_complex_type (cc1_plugin::connection *self,
705 gcc_type base_type)
707 plugin_context *ctx = static_cast<plugin_context *> (self);
708 return convert_out (ctx->preserve (build_complex_type (convert_in (base_type))));
711 gcc_type
712 plugin_build_vector_type (cc1_plugin::connection *self,
713 gcc_type base_type, int nunits)
715 plugin_context *ctx = static_cast<plugin_context *> (self);
716 return convert_out (ctx->preserve (build_vector_type (convert_in (base_type),
717 nunits)));
721 plugin_build_constant (cc1_plugin::connection *self, gcc_type type_in,
722 const char *name, unsigned long value,
723 const char *filename, unsigned int line_number)
725 plugin_context *ctx = static_cast<plugin_context *> (self);
726 tree cst, decl;
727 tree type = convert_in (type_in);
729 cst = build_int_cst (type, value);
730 decl = build_decl (ctx->get_location_t (filename, line_number),
731 CONST_DECL, get_identifier (name), type);
732 DECL_INITIAL (decl) = cst;
733 pushdecl_safe (decl);
735 return 1;
738 gcc_type
739 plugin_error (cc1_plugin::connection *,
740 const char *message)
742 error ("%s", message);
743 return convert_out (error_mark_node);
748 #ifdef __GNUC__
749 #pragma GCC visibility push(default)
750 #endif
753 plugin_init (struct plugin_name_args *plugin_info,
754 struct plugin_gcc_version *)
756 generic_plugin_init (plugin_info, GCC_C_FE_VERSION_1);
758 register_callback (plugin_info->base_name, PLUGIN_PRAGMAS,
759 plugin_init_extra_pragmas, NULL);
760 register_callback (plugin_info->base_name, PLUGIN_PRE_GENERICIZE,
761 rewrite_decls_to_addresses, NULL);
763 #define GCC_METHOD0(R, N) \
765 cc1_plugin::callback_ftype *fun \
766 = cc1_plugin::invoker<R>::invoke<plugin_ ## N>; \
767 current_context->add_callback (# N, fun); \
769 #define GCC_METHOD1(R, N, A) \
771 cc1_plugin::callback_ftype *fun \
772 = cc1_plugin::invoker<R, A>::invoke<plugin_ ## N>; \
773 current_context->add_callback (# N, fun); \
775 #define GCC_METHOD2(R, N, A, B) \
777 cc1_plugin::callback_ftype *fun \
778 = cc1_plugin::invoker<R, A, B>::invoke<plugin_ ## N>; \
779 current_context->add_callback (# N, fun); \
781 #define GCC_METHOD3(R, N, A, B, C) \
783 cc1_plugin::callback_ftype *fun \
784 = cc1_plugin::invoker<R, A, B, C>::invoke<plugin_ ## N>; \
785 current_context->add_callback (# N, fun); \
787 #define GCC_METHOD4(R, N, A, B, C, D) \
789 cc1_plugin::callback_ftype *fun \
790 = cc1_plugin::invoker<R, A, B, C, \
791 D>::invoke<plugin_ ## N>; \
792 current_context->add_callback (# N, fun); \
794 #define GCC_METHOD5(R, N, A, B, C, D, E) \
796 cc1_plugin::callback_ftype *fun \
797 = cc1_plugin::invoker<R, A, B, C, D, \
798 E>::invoke<plugin_ ## N>; \
799 current_context->add_callback (# N, fun); \
801 #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
803 cc1_plugin::callback_ftype *fun \
804 = cc1_plugin::invoker<R, A, B, C, D, \
805 E, F, G>::invoke<plugin_ ## N>; \
806 current_context->add_callback (# N, fun); \
809 #include "gcc-c-fe.def"
811 #undef GCC_METHOD0
812 #undef GCC_METHOD1
813 #undef GCC_METHOD2
814 #undef GCC_METHOD3
815 #undef GCC_METHOD4
816 #undef GCC_METHOD5
817 #undef GCC_METHOD7
819 return 0;