annotate gcc/objc/objc-runtime-hooks.h @ 127:4c56639505ff

fix function.c and add CbC-example Makefile
author mir3636
date Wed, 11 Apr 2018 18:46:58 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Hooks to abstract the runtime meta-data generation for Objective C.
kono
parents:
diff changeset
2 Copyright (C) 2011-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
3 Contributed by Iain Sandoe
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
10 any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
15 GNU General Public License for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 #ifndef _OBJC_RUNTIME_HOOKS_H_
kono
parents:
diff changeset
22 #define _OBJC_RUNTIME_HOOKS_H_
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 /* A set of hooks for the front end to obtain runtime-specific actions. */
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 /* Objective-C supports several runtime library variants:
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 "GNU" runtime selected by -fgnu-runtime (currently at ABI version 8).
kono
parents:
diff changeset
29 "NeXT" runtime (selected by -fnext-runtime) and installed on OSX/Darwin
kono
parents:
diff changeset
30 systems at API version 1 (for m32 code) and version 2 (for m64 code).
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 The runtimes require different data types/layouts, method call mechanisms
kono
parents:
diff changeset
33 and so on, and the purpose of this interface is to abstract such
kono
parents:
diff changeset
34 differences from the parser's perspective. */
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 /* TODO: Do we want the initial underscore ? */
kono
parents:
diff changeset
37 struct objc_runtime_hooks
kono
parents:
diff changeset
38 {
kono
parents:
diff changeset
39 /* TODO: Expand comments in this file. */
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 /* Initialize for this runtime. */
kono
parents:
diff changeset
42 void (*initialize) (void);
kono
parents:
diff changeset
43 const char *default_constant_string_class_name;
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 /* FIXME: Having to check this name should not be necessary. */
kono
parents:
diff changeset
46 const char *tag_getclass;
kono
parents:
diff changeset
47 /* id for superclass class field - named differently in the existing
kono
parents:
diff changeset
48 runtimes. */
kono
parents:
diff changeset
49 tree (*super_superclassfield_ident) (void);
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 /* Obtain a class decl for the identifier. */
kono
parents:
diff changeset
52 tree (*class_decl) (tree);
kono
parents:
diff changeset
53 /* Obtain a metaclass decl for the identifier. */
kono
parents:
diff changeset
54 tree (*metaclass_decl) (tree);
kono
parents:
diff changeset
55 /* Obtain a category decl for the identifier. */
kono
parents:
diff changeset
56 tree (*category_decl) (tree);
kono
parents:
diff changeset
57 /* Obtain a protocol decl for the identifier. */
kono
parents:
diff changeset
58 tree (*protocol_decl) (tree);
kono
parents:
diff changeset
59 /* Obtain a string decl, to be placed in the nominated string-section. */
kono
parents:
diff changeset
60 tree (*string_decl) (tree, const char *, string_section);
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 /* Obtain a class reference, generating the fwd def. if necessary. */
kono
parents:
diff changeset
63 tree (*get_class_reference) (tree);
kono
parents:
diff changeset
64 /* build/get selector reference. */
kono
parents:
diff changeset
65 tree (*build_selector_reference) (location_t, tree, tree);
kono
parents:
diff changeset
66 /* Get a protocol reference, generating the forward def. if necessary. */
kono
parents:
diff changeset
67 tree (*get_protocol_reference) (location_t, tree);
kono
parents:
diff changeset
68 /* Get an ivar ref. re the base. */
kono
parents:
diff changeset
69 tree (*build_ivar_reference) (location_t, tree, tree);
kono
parents:
diff changeset
70 /* Get a reference to {meta}class' super. */
kono
parents:
diff changeset
71 tree (*get_class_super_ref) (location_t, struct imp_entry *, bool);
kono
parents:
diff changeset
72 /* Get a reference to Category {meta}class' super. */
kono
parents:
diff changeset
73 tree (*get_category_super_ref) (location_t, struct imp_entry *, bool);
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 /* Receiver is class Object, check runtime-specific. */
kono
parents:
diff changeset
76 tree (*receiver_is_class_object) (tree);
kono
parents:
diff changeset
77 /* Get the start of a method argument type list (receiver, _cmd). */
kono
parents:
diff changeset
78 void (*get_arg_type_list_base) (vec<tree, va_gc> **, tree, int, int);
kono
parents:
diff changeset
79 /* Build method call. */
kono
parents:
diff changeset
80 tree (*build_objc_method_call) (location_t, tree, tree, tree, tree, tree, int);
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 /* Check for or otherwise handle a request to check that the constant
kono
parents:
diff changeset
83 string class reference is set-up & OK. */
kono
parents:
diff changeset
84 bool (*setup_const_string_class_decl) (void);
kono
parents:
diff changeset
85 /* Return the tree reprenting a const string constructor for the arg.
kono
parents:
diff changeset
86 Most of the data are in global trees. */
kono
parents:
diff changeset
87 tree (*build_const_string_constructor) (location_t, tree, int);
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 /* Exceptions. */
kono
parents:
diff changeset
90 tree (*build_throw_stmt) (location_t, tree, bool);
kono
parents:
diff changeset
91 tree (*build_exc_ptr) (struct objc_try_context **);
kono
parents:
diff changeset
92 tree (*begin_catch) (struct objc_try_context **, tree, tree, tree, bool);
kono
parents:
diff changeset
93 void (*finish_catch) (struct objc_try_context **, tree);
kono
parents:
diff changeset
94 tree (*finish_try_stmt) (struct objc_try_context **);
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 /* Emit all the metadata required by the runtime - based on the tables built
kono
parents:
diff changeset
97 during parsing. */
kono
parents:
diff changeset
98 void (*generate_metadata) (void);
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 };
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 /* For shared support that needs to access these. */
kono
parents:
diff changeset
103 extern objc_runtime_hooks runtime;
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 /* One per runtime at present.
kono
parents:
diff changeset
106 TODO: Make into some kind of configury-generated table. */
kono
parents:
diff changeset
107 extern bool objc_gnu_runtime_abi_01_init (objc_runtime_hooks *);
kono
parents:
diff changeset
108 extern bool objc_next_runtime_abi_01_init (objc_runtime_hooks *);
kono
parents:
diff changeset
109 extern bool objc_next_runtime_abi_02_init (objc_runtime_hooks *);
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 #endif /* _OBJC_RUNTIME_HOOKS_H_ */