8sa1-gcc/gcc/objc/objc-runtime-hooks.h
Nathan Froyd 6174da1b28 don't use build_function_type in the ObjC/C++ frontends
don't use build_function_type in the ObjC/C++ frontends
	* objc-runtime-shared-support.h (get_arg_type_list): Delete.
	(build_function_type_for_method): Declare.
	* objc-runtime-hooks.h (struct _objc_runtime_hooks_r): Change
	type of get_arg_type_base_list field.
	* objc-act.h (OBJC_VOID_AT_END): Delete.
	* objc-act.c (get_arg_type_list): Delete.
	(build_function_type_for_method): New function.
	(objc_decl_method_attributes): Call build_function_type_for_method.
	(really_start_method): Likewise.
	* objc-gnu-runtime-abi-01.c
	(gnu_runtime_abi_01_get_type_arg_list_base): Change prototype and
	adjust function accordingly.  Update header comment.
	(build_objc_method_call): Call build_function_type_for_method.
	* objc-next-runtime-abi-01.c
	(next_runtime_abi_01_get_type_arg_list_base): Change prototype and
	adjust function accordingly.  Update header comment.
	(build_objc_method_call): Call build_function_type_for_method.
	* objc-next-runtime-abi-02.c
	(next_runtime_abi_02_get_type_arg_list_base): Change prototype and
	adjust function accordingly.  Update header comment.
	(objc_copy_to_temp_side_effect_params): Take fntype instead of a
	typelist.  Use function_args_iterator for traversing fntype.
	(build_v2_build_objc_method_call): Adjust call to it.
	Call build_function_type_for_method

From-SVN: r173465
2011-05-06 01:37:00 +00:00

112 lines
4.5 KiB
C

/* Hooks to abstract the runtime meta-data generation for Objective C.
Copyright (C) 2011 Free Software Foundation, Inc.
Contributed by Iain Sandoe
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef _OBJC_RUNTIME_HOOKS_H_
#define _OBJC_RUNTIME_HOOKS_H_
/* A set of hooks for the front end to obtain runtime-specific actions. */
/* Objective-C supports several runtime library variants:
"GNU" runtime selected by -fgnu-runtime (currently at ABI version 8).
"NeXT" runtime (selected by -fnext-runtime) and installed on OSX/Darwin
systems at API version 1 (for m32 code) and version 2 (for m64 code).
The runtimes require different data types/layouts, method call mechanisms
and so on, and the purpose of this interface is to abstract such
differences from the parser's perspective. */
/* TODO: Do we want the initial underscore ? */
typedef struct _objc_runtime_hooks_r
{
/* TODO: Expand comments in this file. */
/* Initialize for this runtime. */
void (*initialize) (void);
const char *default_constant_string_class_name;
/* FIXME: Having to check this name should not be necessary. */
const char *tag_getclass;
/* id for superclass class field - named differently in the existing
runtimes. */
tree (*super_superclassfield_ident) (void);
/* Obtain a class decl for the identifier. */
tree (*class_decl) (tree);
/* Obtain a metaclass decl for the identifier. */
tree (*metaclass_decl) (tree);
/* Obtain a category decl for the identifier. */
tree (*category_decl) (tree);
/* Obtain a protocol decl for the identifier. */
tree (*protocol_decl) (tree);
/* Obtain a string decl, to be placed in the nominated string-section. */
tree (*string_decl) (tree, const char *, string_section);
/* Obtain a class reference, generating the fwd def. if necessary. */
tree (*get_class_reference) (tree);
/* build/get selector reference. */
tree (*build_selector_reference) (location_t, tree, tree);
/* Get a protocol reference, generating the forward def. if necessary. */
tree (*get_protocol_reference) (location_t, tree);
/* Get an ivar ref. re the base. */
tree (*build_ivar_reference) (location_t, tree, tree);
/* Get a reference to {meta}class' super. */
tree (*get_class_super_ref) (location_t, struct imp_entry *, bool);
/* Get a reference to Category {meta}class' super. */
tree (*get_category_super_ref) (location_t, struct imp_entry *, bool);
/* Receiver is class Object, check runtime-specific. */
tree (*receiver_is_class_object) (tree);
/* Get the start of a method argument type list (receiver, _cmd). */
void (*get_arg_type_list_base) (VEC(tree,gc) **, tree, int, int);
/* Build method call. */
tree (*build_objc_method_call) (location_t, tree, tree, tree, tree, tree, int);
/* Check for or otherwise handle a request to check that the constant
string class reference is set-up & OK. */
bool (*setup_const_string_class_decl) (void);
/* Return the tree reprenting a const string constructor for the arg.
Most of the data are in global trees. */
tree (*build_const_string_constructor) (location_t, tree, int);
/* Exceptions. */
tree (*build_throw_stmt) (location_t, tree, bool);
tree (*build_exc_ptr) (struct objc_try_context **);
tree (*begin_catch) (struct objc_try_context **, tree, tree, tree, bool);
void (*finish_catch) (struct objc_try_context **, tree);
tree (*finish_try_stmt) (struct objc_try_context **);
/* Emit all the metadata required by the runtime - based on the tables built
during parsing. */
void (*generate_metadata) (void);
} objc_runtime_hooks;
/* For shared support that needs to access these. */
extern objc_runtime_hooks runtime;
/* One per runtime at present.
TODO: Make into some kind of configury-generated table. */
extern bool objc_gnu_runtime_abi_01_init (objc_runtime_hooks *);
extern bool objc_next_runtime_abi_01_init (objc_runtime_hooks *);
extern bool objc_next_runtime_abi_02_init (objc_runtime_hooks *);
#endif /* _OBJC_RUNTIME_HOOKS_H_ */