1 /* d-tree.h -- Definitions and declarations for code generation.
2    Copyright (C) 2006-2020 Free Software Foundation, Inc.
3 
4 GCC is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8 
9 GCC 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 GCC; see the file COPYING3.  If not see
16 <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef GCC_D_TREE_H
19 #define GCC_D_TREE_H
20 
21 /* Forward type declarations to avoid including unnecessary headers.  */
22 
23 class Dsymbol;
24 class Declaration;
25 class AggregateDeclaration;
26 class ClassDeclaration;
27 class EnumDeclaration;
28 class FuncDeclaration;
29 class StructDeclaration;
30 class TypeInfoDeclaration;
31 class VarDeclaration;
32 class Expression;
33 class ClassReferenceExp;
34 class Module;
35 class Statement;
36 class Type;
37 class TypeFunction;
38 class Parameter;
39 struct BaseClass;
40 struct Scope;
41 struct Loc;
42 
43 template <typename TYPE> struct Array;
44 typedef Array<Expression *> Expressions;
45 
46 /* Usage of TREE_LANG_FLAG_?:
47    0: METHOD_CALL_EXPR
48    1: CALL_EXPR_ARGS_ORDERED (in CALL_EXPR).
49 
50    Usage of TYPE_LANG_FLAG_?:
51    0: TYPE_SHARED
52    1: TYPE_IMAGINARY_FLOAT (in REAL_TYPE).
53       ANON_AGGR_TYPE_P (in RECORD_TYPE, UNION_TYPE).
54    2: CLASS_TYPE_P (in RECORD_TYPE).
55    3: TYPE_DYNAMIC_ARRAY (in RECORD_TYPE).
56    4: TYPE_DELEGATE (in RECORD_TYPE).
57    5: TYPE_ASSOCIATIVE_ARRAY (in RECORD_TYPE).
58 
59    Usage of DECL_LANG_FLAG_?:
60    0: LABEL_VARIABLE_CASE (in LABEL_DECL).
61       DECL_BUILT_IN_CTFE (in FUNCTION_DECL).
62    1: DECL_IN_UNITTEST_CONDITION_P (in FUNCTION_DECL).  */
63 
64 /* The kinds of scopes we recognize.  */
65 
66 enum level_kind
67 {
68   level_block,		/* An ordinary block scope.  */
69   level_try,		/* A try-block.  */
70   level_catch,		/* A catch-block.  */
71   level_finally,	/* A finally-block.  */
72   level_cond,		/* The scope for an if condition.  */
73   level_switch,		/* The scope for a switch statement.  */
74   level_loop,		/* A for, do-while, or unrolled-loop block.  */
75   level_with,		/* The scope for a with statement.  */
76   level_function	/* The block representing an entire function.  */
77 };
78 
79 /* List of codes for internally recognised compiler intrinsics.  */
80 
81 enum intrinsic_code
82 {
83 #define DEF_D_INTRINSIC(CODE, A, N, M, D, C) INTRINSIC_ ## CODE,
84 
85 #include "intrinsics.def"
86 
87 #undef DEF_D_INTRINSIC
88   INTRINSIC_LAST
89 };
90 
91 /* For use with break and continue statements.  */
92 
93 enum bc_kind
94 {
95   bc_break    = 0,
96   bc_continue = 1
97 };
98 
99 /* The datatype used to implement D scope.  It is needed primarily to support
100    the back-end, but also helps debugging information for local variables.  */
101 
102 struct GTY((chain_next ("%h.level_chain"))) binding_level
103 {
104   /* A chain of declarations for all variables, constants and functions.
105      These are in the reverse of the order supplied.  */
106   tree names;
107 
108   /* For each level (except the global one), a chain of BLOCK nodes for
109      all the levels that were entered and exited one level down.  */
110   tree blocks;
111 
112   /* The binding level this one is contained in.  */
113   binding_level *level_chain;
114 
115   /* The kind of scope this object represents.  */
116   ENUM_BITFIELD (level_kind) kind : 4;
117 };
118 
119 /* The binding level currently in effect.  */
120 extern GTY(()) binding_level *current_binding_level;
121 extern GTY(()) binding_level *global_binding_level;
122 
123 /* Used only for jumps to as-yet undefined labels, since jumps to
124    defined labels can have their validity checked immediately.  */
125 
126 struct GTY((chain_next ("%h.next"))) d_label_use_entry
127 {
128   d_label_use_entry *next;
129 
130   /* The frontend Statement associated with the jump.  */
131   Statement * GTY((skip)) statement;
132 
133   /* The binding level to which this entry is *currently* attached.
134      This is initially the binding level in which the goto appeared,
135      but is modified as scopes are closed.  */
136   binding_level *level;
137 };
138 
139 /* A list of all LABEL_DECLs in the function that have names.  Here so
140    we can clear out their names' definitions at the end of the
141    function, and so we can check the validity of jumps to these labels.  */
142 
143 struct GTY(()) d_label_entry
144 {
145   /* The label decl itself.  */
146   tree label;
147 
148   /* The frontend Statement associated with the label.  */
149   Statement * GTY((skip)) statement;
150 
151   /* The binding level to which the label is *currently* attached.
152      This is initially set to the binding level in which the label
153      is defined, but is modified as scopes are closed.  */
154   binding_level *level;
155 
156   /* A list of forward references of the label.  */
157   d_label_use_entry *fwdrefs;
158 
159   /* The following bits are set after the label is defined, and are
160      updated as scopes are popped.  They indicate that a backward jump
161      to the label will illegally enter a scope of the given flavor.  */
162   bool in_try_scope;
163   bool in_catch_scope;
164 
165   /* If set, the label we reference represents a break/continue pair.  */
166   bool bc_label;
167 };
168 
169 /* Frame information for a function declaration.  */
170 
171 struct GTY(()) tree_frame_info
172 {
173   struct tree_common common;
174   tree frame_type;
175 };
176 
177 /* True if the function creates a nested frame.  */
178 #define FRAMEINFO_CREATES_FRAME(NODE) \
179   (TREE_LANG_FLAG_0 (FUNCFRAME_INFO_CHECK (NODE)))
180 
181 /* True if the function has a static chain passed in its DECL_ARGUMENTS.  */
182 #define FRAMEINFO_STATIC_CHAIN(NODE) \
183   (TREE_LANG_FLAG_1 (FUNCFRAME_INFO_CHECK (NODE)))
184 
185 /* True if the function frame is a closure (initialized on the heap).  */
186 #define FRAMEINFO_IS_CLOSURE(NODE) \
187   (TREE_LANG_FLAG_2 (FUNCFRAME_INFO_CHECK (NODE)))
188 
189 #define FRAMEINFO_TYPE(NODE) \
190   (((tree_frame_info *) FUNCFRAME_INFO_CHECK (NODE))->frame_type)
191 
192 /* Language-dependent contents of an identifier.  */
193 
194 struct GTY(()) lang_identifier
195 {
196   struct tree_identifier common;
197 
198   /* The identifier as the user sees it.  */
199   tree pretty_ident;
200 
201   /* The back-end tree associated with this identifier.  */
202   tree decl_tree;
203 
204   /* The frontend Declaration associated with this identifier.  */
205   Declaration * GTY((skip)) dsymbol;
206   AggregateDeclaration * GTY((skip)) daggregate;
207 };
208 
209 #define IDENTIFIER_LANG_SPECIFIC(NODE) \
210   ((struct lang_identifier *) IDENTIFIER_NODE_CHECK (NODE))
211 
212 #define IDENTIFIER_PRETTY_NAME(NODE) \
213   (IDENTIFIER_LANG_SPECIFIC (NODE)->pretty_ident)
214 
215 #define IDENTIFIER_DECL_TREE(NODE) \
216   (IDENTIFIER_LANG_SPECIFIC (NODE)->decl_tree)
217 
218 #define IDENTIFIER_DSYMBOL(NODE) \
219   (IDENTIFIER_LANG_SPECIFIC (NODE)->dsymbol)
220 
221 #define IDENTIFIER_DAGGREGATE(NODE) \
222   (IDENTIFIER_LANG_SPECIFIC (NODE)->daggregate)
223 
224 /* Global state pertinent to the current function.  */
225 
226 struct GTY(()) language_function
227 {
228   /* Our function and enclosing module.  */
229   FuncDeclaration * GTY((skip)) function;
230   Module * GTY((skip)) module;
231 
232   /* Static chain of function, for D2, this is a closure.  */
233   tree static_chain;
234 
235   /* Stack of statement lists being collected while we are
236      compiling the function.  */
237   vec<tree, va_gc> *stmt_list;
238 
239   /* Variables that are in scope that will need destruction later.  */
240   vec<tree, va_gc> *vars_in_scope;
241 
242   /* Table of all used or defined labels in the function.  */
243   hash_map<Statement *, d_label_entry> *labels;
244 };
245 
246 /* The D front end types have not been integrated into the GCC garbage
247    collection system.  Handle this by using the "skip" attribute.  */
248 
249 struct GTY(()) lang_decl
250 {
251   Declaration * GTY((skip)) decl;
252 
253   /* FIELD_DECL in frame struct that this variable is allocated in.  */
254   tree frame_field;
255 
256   /* RESULT_DECL in a function that returns by nrvo.  */
257   tree named_result;
258 
259   /* Chain of DECL_LANG_THUNKS in a function.  */
260   tree thunks;
261 
262   /* In a FUNCTION_DECL, this is the THUNK_LANG_OFFSET.  */
263   int offset;
264 
265   /* In a FUNCTION_DECL, if this is an intrinsic, the code for it.  */
266   enum intrinsic_code intrinsic;
267 
268   /* FUNCFRAME_INFO in a function that has non-local references.  */
269   tree frame_info;
270 };
271 
272 /* The current D per-function global variables.  */
273 
274 #define d_function_chain (cfun ? cfun->language : NULL)
275 
276 /* The D frontend Declaration AST for GCC decl NODE.  */
277 #define DECL_LANG_FRONTEND(NODE) \
278   (DECL_LANG_SPECIFIC (NODE) \
279    ? DECL_LANG_SPECIFIC (NODE)->decl : NULL)
280 
281 #define SET_DECL_LANG_FRAME_FIELD(NODE, VAL) \
282   DECL_LANG_SPECIFIC (NODE)->frame_field = VAL
283 
284 #define DECL_LANG_FRAME_FIELD(NODE) \
285   (DECL_P (NODE) \
286    ? DECL_LANG_SPECIFIC (NODE)->frame_field : NULL)
287 
288 #define SET_DECL_LANG_NRVO(NODE, VAL) \
289   DECL_LANG_SPECIFIC (NODE)->named_result = VAL
290 
291 #define DECL_LANG_NRVO(NODE) \
292   (DECL_P (NODE) \
293    ? DECL_LANG_SPECIFIC (NODE)->named_result : NULL)
294 
295 #define DECL_LANG_THUNKS(NODE) \
296   DECL_LANG_SPECIFIC (NODE)->thunks
297 
298 #define THUNK_LANG_OFFSET(NODE) \
299   DECL_LANG_SPECIFIC (NODE)->offset
300 
301 #define DECL_INTRINSIC_CODE(NODE) \
302   DECL_LANG_SPECIFIC (NODE)->intrinsic
303 
304 #define DECL_LANG_FRAMEINFO(NODE) \
305   DECL_LANG_SPECIFIC (NODE)->frame_info
306 
307 /* The lang_type field is not set for every GCC type.  */
308 
309 struct GTY(()) lang_type
310 {
311   Type * GTY((skip)) type;
312 };
313 
314 /* The D frontend Type AST for GCC type NODE.  */
315 #define TYPE_LANG_FRONTEND(NODE) \
316   (TYPE_LANG_SPECIFIC (NODE) \
317    ? TYPE_LANG_SPECIFIC (NODE)->type : NULL)
318 
319 
320 enum d_tree_node_structure_enum
321 {
322   TS_D_GENERIC,
323   TS_D_IDENTIFIER,
324   TS_D_FRAMEINFO,
325   LAST_TS_D_ENUM
326 };
327 
328 /* The resulting tree type.  */
329 
330 union GTY((desc ("d_tree_node_structure (&%h)"),
331 	   chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON)"
332 		       " ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
333 lang_tree_node
334 {
335   union tree_node GTY ((tag ("TS_D_GENERIC"),
336 			desc ("tree_node_structure (&%h)"))) generic;
337   lang_identifier GTY ((tag ("TS_D_IDENTIFIER"))) identifier;
338   tree_frame_info GTY ((tag ("TS_D_FRAMEINFO"))) frameinfo;
339 };
340 
341 /* True if the Tdelegate typed expression is not really a variable,
342    but a literal function / method reference.  */
343 #define METHOD_CALL_EXPR(NODE) \
344   (TREE_LANG_FLAG_0 (NODE))
345 
346 /* True if all arguments in a call expression should be evaluated in the
347    order they are given (left to right).  */
348 #define CALL_EXPR_ARGS_ORDERED(NODE) \
349   (TREE_LANG_FLAG_1 (CALL_EXPR_CHECK (NODE)))
350 
351 /* True if the type was declared 'shared'.  */
352 #define TYPE_SHARED(NODE) \
353   (TYPE_LANG_FLAG_0 (NODE))
354 
355 /* True if the type is an imaginary float type.  */
356 #define TYPE_IMAGINARY_FLOAT(NODE) \
357   (TYPE_LANG_FLAG_1 (REAL_TYPE_CHECK (NODE)))
358 
359 /* True if the type is an anonymous record or union.  */
360 #define ANON_AGGR_TYPE_P(NODE) \
361   (TYPE_LANG_FLAG_1 (RECORD_OR_UNION_CHECK (NODE)))
362 
363 /* True if the type is the underlying record for a class.  */
364 #define CLASS_TYPE_P(NODE) \
365   (TYPE_LANG_FLAG_2 (RECORD_TYPE_CHECK (NODE)))
366 
367 /* True if the type is a D dynamic array.  */
368 #define TYPE_DYNAMIC_ARRAY(NODE) \
369   (TYPE_LANG_FLAG_3 (RECORD_TYPE_CHECK (NODE)))
370 
371 /* True if the type is a D delegate.  */
372 #define TYPE_DELEGATE(NODE) \
373   (TYPE_LANG_FLAG_4 (RECORD_TYPE_CHECK (NODE)))
374 
375 /* True if the type is a D associative array.  */
376 #define TYPE_ASSOCIATIVE_ARRAY(NODE) \
377   (TYPE_LANG_FLAG_5 (RECORD_TYPE_CHECK (NODE)))
378 
379 /* True if the decl is a variable case label decl.  */
380 #define LABEL_VARIABLE_CASE(NODE) \
381   (DECL_LANG_FLAG_0 (LABEL_DECL_CHECK (NODE)))
382 
383 /* True if the decl is a CTFE built-in.  */
384 #define DECL_BUILT_IN_CTFE(NODE) \
385   (DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE)))
386 
387 /* True if the decl is only compiled in when unittests are turned on.  */
388 #define DECL_IN_UNITTEST_CONDITION_P(NODE) \
389   (DECL_LANG_FLAG_1 (FUNCTION_DECL_CHECK (NODE)))
390 
391 enum d_tree_index
392 {
393   DTI_VTABLE_ENTRY_TYPE,
394   DTI_VTBL_PTR_TYPE,
395   DTI_VTBL_INTERFACE_TYPE,
396 
397   DTI_BOOL_TYPE,
398   DTI_CHAR_TYPE,
399   DTI_WCHAR_TYPE,
400   DTI_DCHAR_TYPE,
401 
402   DTI_BYTE_TYPE,
403   DTI_UBYTE_TYPE,
404   DTI_SHORT_TYPE,
405   DTI_USHORT_TYPE,
406   DTI_INT_TYPE,
407   DTI_UINT_TYPE,
408   DTI_LONG_TYPE,
409   DTI_ULONG_TYPE,
410   DTI_CENT_TYPE,
411   DTI_UCENT_TYPE,
412 
413   DTI_IFLOAT_TYPE,
414   DTI_IDOUBLE_TYPE,
415   DTI_IREAL_TYPE,
416 
417   DTI_UNKNOWN_TYPE,
418 
419   DTI_ARRAY_TYPE,
420   DTI_NULL_ARRAY,
421 
422   DTI_MAX
423 };
424 
425 extern GTY(()) tree d_global_trees[DTI_MAX];
426 
427 #define vtable_entry_type		d_global_trees[DTI_VTABLE_ENTRY_TYPE]
428 #define vtbl_ptr_type_node		d_global_trees[DTI_VTBL_PTR_TYPE]
429 #define vtbl_interface_type_node	d_global_trees[DTI_VTBL_INTERFACE_TYPE]
430 /* D built-in language types.  */
431 #define d_bool_type			d_global_trees[DTI_BOOL_TYPE]
432 #define d_byte_type			d_global_trees[DTI_BYTE_TYPE]
433 #define d_ubyte_type			d_global_trees[DTI_UBYTE_TYPE]
434 #define d_short_type			d_global_trees[DTI_SHORT_TYPE]
435 #define d_ushort_type			d_global_trees[DTI_USHORT_TYPE]
436 #define d_int_type			d_global_trees[DTI_INT_TYPE]
437 #define d_uint_type			d_global_trees[DTI_UINT_TYPE]
438 #define d_long_type			d_global_trees[DTI_LONG_TYPE]
439 #define d_ulong_type			d_global_trees[DTI_ULONG_TYPE]
440 #define d_cent_type			d_global_trees[DTI_CENT_TYPE]
441 #define d_ucent_type			d_global_trees[DTI_UCENT_TYPE]
442 /* Imaginary floating-point types.  */
443 #define ifloat_type_node		d_global_trees[DTI_IFLOAT_TYPE]
444 #define idouble_type_node		d_global_trees[DTI_IDOUBLE_TYPE]
445 #define ireal_type_node			d_global_trees[DTI_IREAL_TYPE]
446 /* UTF-8, 16 and 32 types.  */
447 #define char8_type_node			d_global_trees[DTI_CHAR_TYPE]
448 #define char16_type_node		d_global_trees[DTI_DCHAR_TYPE]
449 #define char32_type_node		d_global_trees[DTI_WCHAR_TYPE]
450 /* Empty record type used as placeholder when real type is unknown.  */
451 #define unknown_type_node		d_global_trees[DTI_UNKNOWN_TYPE]
452 /* Generic dynamic array type void[].  */
453 #define array_type_node			d_global_trees[DTI_ARRAY_TYPE]
454 /* Null initializer for dynamic arrays.  */
455 #define null_array_node			d_global_trees[DTI_NULL_ARRAY]
456 
457 /* A prefix for internal variables, which are not user-visible.  */
458 #if !defined (NO_DOT_IN_LABEL)
459 # define GDC_PREFIX(x) "gdc." x
460 #elif !defined (NO_DOLLAR_IN_LABEL)
461 # define GDC_PREFIX(x) "gdc$" x
462 #else
463 # define GDC_PREFIX(x) "gdc_" x
464 #endif
465 
466 /* Internally recognised D runtime library functions.  */
467 
468 enum libcall_fn
469 {
470 #define DEF_D_RUNTIME(CODE, N, T, P, F) LIBCALL_ ## CODE,
471 
472 #include "runtime.def"
473 
474 #undef DEF_D_RUNTIME
475   LIBCALL_LAST
476 };
477 
478 /* Gate for when the D frontend makes an early call into the codegen pass, such
479    as when it requires target information or CTFE evaluation.  As full semantic
480    may not be completed, we only want to build the superficial tree structure
481    without finishing any decls or types.  */
482 extern bool doing_semantic_analysis_p;
483 
484 /* In d-attribs.c.  */
485 extern tree insert_type_attribute (tree, const char *, tree = NULL_TREE);
486 extern tree insert_decl_attribute (tree, const char *, tree = NULL_TREE);
487 extern void apply_user_attributes (Dsymbol *, tree);
488 
489 /* In d-builtins.cc.  */
490 extern const attribute_spec d_langhook_attribute_table[];
491 extern const attribute_spec d_langhook_common_attribute_table[];
492 
493 extern tree d_builtin_function (tree);
494 extern tree d_builtin_function_ext_scope (tree);
495 extern void d_init_builtins (void);
496 extern void d_register_builtin_type (tree, const char *);
497 extern void d_build_builtins_module (Module *);
498 extern void d_maybe_set_builtin (Module *);
499 extern Expression *d_eval_constant_expression (tree);
500 extern void d_init_versions (void);
501 
502 /* In d-codegen.cc.  */
503 extern location_t make_location_t (const Loc &);
504 extern tree d_decl_context (Dsymbol *);
505 extern tree copy_aggregate_type (tree);
506 extern bool declaration_reference_p (Declaration *);
507 extern tree declaration_type (Declaration *);
508 extern bool parameter_reference_p (Parameter *);
509 extern tree parameter_type (Parameter *);
510 extern tree build_integer_cst (dinteger_t, tree = d_int_type);
511 extern tree build_float_cst (const real_t &, Type *);
512 extern tree d_array_length (tree);
513 extern tree d_array_ptr (tree);
514 extern tree d_array_value (tree, tree, tree);
515 extern tree get_array_length (tree, Type *);
516 extern tree build_class_binfo (tree, ClassDeclaration *);
517 extern tree build_interface_binfo (tree, ClassDeclaration *, unsigned &);
518 extern tree delegate_method (tree);
519 extern tree delegate_object (tree);
520 extern tree build_delegate_cst (tree, tree, Type *);
521 extern tree build_method_call (tree, tree, Type *);
522 extern void extract_from_method_call (tree, tree &, tree &);
523 extern tree build_typeof_null_value (Type *);
524 extern tree build_vindex_ref (tree, tree, size_t);
525 extern tree d_save_expr (tree);
526 extern tree stabilize_expr (tree *);
527 extern tree build_target_expr (tree, tree);
528 extern tree force_target_expr (tree);
529 extern tree build_address (tree);
530 extern tree d_mark_addressable (tree);
531 extern tree d_mark_used (tree);
532 extern tree d_mark_read (tree);
533 extern bool identity_compare_p (StructDeclaration *);
534 extern tree build_float_identity (tree_code, tree, tree);
535 extern tree build_struct_comparison (tree_code, StructDeclaration *,
536 				     tree, tree);
537 extern tree build_array_struct_comparison (tree_code, StructDeclaration *,
538 					   tree, tree, tree);
539 extern tree build_struct_literal (tree, vec<constructor_elt, va_gc> *);
540 extern tree component_ref (tree, tree);
541 extern tree build_assign (tree_code, tree, tree);
542 extern tree modify_expr (tree, tree);
543 extern tree build_nop (tree, tree);
544 extern tree build_vconvert (tree, tree);
545 extern tree build_boolop (tree_code, tree, tree);
546 extern tree build_condition (tree, tree, tree, tree);
547 extern tree build_vcondition (tree, tree, tree);
548 extern tree compound_expr (tree, tree);
549 extern tree return_expr (tree);
550 extern tree size_mult_expr (tree, tree);
551 extern tree real_part (tree);
552 extern tree imaginary_part (tree);
553 extern tree complex_expr (tree, tree, tree);
554 extern tree indirect_ref (tree, tree);
555 extern tree build_deref (tree);
556 extern tree build_array_index (tree, tree);
557 extern tree build_offset_op (tree_code, tree, tree);
558 extern tree build_offset (tree, tree);
559 extern tree build_memref (tree, tree, tree);
560 extern tree build_array_set (tree, tree, tree);
561 extern tree build_array_from_val (Type *, tree);
562 extern tree void_okay_p (tree);
563 extern tree build_bounds_condition (const Loc &, tree, tree, bool);
564 extern bool array_bounds_check (void);
565 extern tree bind_expr (tree, tree);
566 extern TypeFunction *get_function_type (Type *);
567 extern bool call_by_alias_p (FuncDeclaration *, FuncDeclaration *);
568 extern tree d_build_call_expr (FuncDeclaration *, tree, Expressions *);
569 extern tree d_build_call (TypeFunction *, tree, tree, Expressions *);
570 extern tree d_assert_call (const Loc &, libcall_fn, tree = NULL_TREE);
571 extern tree build_float_modulus (tree, tree, tree);
572 extern tree build_vthis_function (tree, tree);
573 extern tree error_no_frame_access (Dsymbol *);
574 extern tree get_frame_for_symbol (Dsymbol *);
575 extern tree build_vthis (AggregateDeclaration *);
576 extern void build_closure (FuncDeclaration *);
577 extern tree get_frameinfo (FuncDeclaration *);
578 extern tree get_framedecl (FuncDeclaration *, FuncDeclaration *);
579 
580 /* In d-convert.cc.  */
581 extern bool decl_with_nonnull_addr_p (const_tree);
582 extern tree d_truthvalue_conversion (tree);
583 extern tree d_convert (tree, tree);
584 extern tree convert_expr (tree, Type *, Type *);
585 extern tree convert_for_rvalue (tree, Type *, Type *);
586 extern tree convert_for_assignment (tree, Type *, Type *);
587 extern tree convert_for_argument (tree, Parameter *);
588 extern tree convert_for_condition (tree, Type *);
589 extern tree d_array_convert (Expression *);
590 extern tree d_array_convert (Type *, Expression *);
591 
592 /* In d-incpath.cc.  */
593 extern void add_import_paths (const char *, const char *, bool);
594 
595 /* In d-lang.cc.  */
596 extern void d_add_builtin_module (Module *);
597 extern void d_add_entrypoint_module (Module *, Module *);
598 extern d_tree_node_structure_enum d_tree_node_structure (lang_tree_node *);
599 extern struct lang_type *build_lang_type (Type *);
600 extern struct lang_decl *build_lang_decl (Declaration *);
601 extern tree d_pushdecl (tree);
602 extern tree d_unsigned_type (tree);
603 extern tree d_signed_type (tree);
604 extern void d_keep (tree);
605 
606 /* In decl.cc.  */
607 extern const char *d_mangle_decl (Dsymbol *);
608 extern tree mangle_internal_decl (Dsymbol *, const char *, const char *);
609 extern void build_decl_tree (Dsymbol *);
610 extern tree get_symbol_decl (Declaration *);
611 extern tree declare_extern_var (tree, tree);
612 extern void declare_local_var (VarDeclaration *);
613 extern tree build_local_temp (tree);
614 extern tree get_decl_tree (Declaration *);
615 extern void d_finish_decl (tree);
616 extern tree make_thunk (FuncDeclaration *, int);
617 extern tree start_function (FuncDeclaration *);
618 extern void finish_function (tree);
619 extern void mark_needed (tree);
620 extern unsigned base_vtable_offset (ClassDeclaration *, BaseClass *);
621 extern tree get_vtable_decl (ClassDeclaration *);
622 extern tree build_new_class_expr (ClassReferenceExp *);
623 extern tree aggregate_initializer_decl (AggregateDeclaration *);
624 extern tree layout_struct_initializer (StructDeclaration *);
625 extern tree layout_class_initializer (ClassDeclaration *);
626 extern tree enum_initializer_decl (EnumDeclaration *);
627 extern tree build_artificial_decl (tree, tree, const char * = NULL);
628 extern tree create_field_decl (tree, const char *, int, int);
629 extern void build_type_decl (tree, Dsymbol *);
630 extern void d_comdat_linkage (tree);
631 extern void d_linkonce_linkage (tree);
632 
633 /* In expr.cc.  */
634 extern tree build_expr (Expression *, bool = false);
635 extern tree build_expr_dtor (Expression *);
636 extern tree build_return_dtor (Expression *, Type *, TypeFunction *);
637 
638 /* In imports.cc.  */
639 extern tree build_import_decl (Dsymbol *);
640 
641 /* In intrinsics.cc.  */
642 extern void maybe_set_intrinsic (FuncDeclaration *);
643 extern tree maybe_expand_intrinsic (tree);
644 
645 /* In modules.cc.  */
646 extern void build_module_tree (Module *);
647 extern tree d_module_context (void);
648 extern void register_module_decl (Declaration *);
649 extern void d_finish_compilation (tree *, int);
650 
651 /* In runtime.cc.  */
652 extern tree build_libcall (libcall_fn, Type *, int ...);
653 
654 /* In typeinfo.cc.  */
655 extern bool have_typeinfo_p (ClassDeclaration *);
656 extern tree layout_typeinfo (TypeInfoDeclaration *);
657 extern tree layout_classinfo (ClassDeclaration *);
658 extern tree get_typeinfo_decl (TypeInfoDeclaration *);
659 extern tree get_classinfo_decl (ClassDeclaration *);
660 extern void check_typeinfo_type (const Loc &, Scope *);
661 extern tree build_typeinfo (const Loc &, Type *);
662 extern void create_typeinfo (Type *, Module *);
663 extern void create_tinfo_types (Module *);
664 extern void layout_cpp_typeinfo (ClassDeclaration *);
665 extern tree get_cpp_typeinfo_decl (ClassDeclaration *);
666 extern bool speculative_type_p (Type *);
667 
668 /* In toir.cc.  */
669 extern void push_binding_level (level_kind);
670 extern tree pop_binding_level (void);
671 extern void push_stmt_list (void);
672 extern tree pop_stmt_list (void);
673 extern void add_stmt (tree);
674 extern void build_function_body (FuncDeclaration *);
675 
676 /* In types.cc.  */
677 extern bool valist_array_p (Type *);
678 extern bool empty_aggregate_p (tree);
679 extern bool same_type_p (Type *, Type *);
680 extern Type *get_object_type (void);
681 extern tree make_array_type (Type *, unsigned HOST_WIDE_INT);
682 extern tree make_struct_type (const char *, int n, ...);
683 extern tree insert_type_modifiers (tree, unsigned);
684 extern void insert_aggregate_field (tree, tree, size_t);
685 extern void finish_aggregate_type (unsigned, unsigned, tree);
686 extern tree build_ctype (Type *);
687 
688 #endif  /* GCC_D_TREE_H  */
689