* *
* C Header File *
* *
- * Copyright (C) 1992-2010, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2011, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
/* Start a new statement group chained to the previous group. */
extern void start_stmt_group (void);
-/* Add GNU_STMT to the current BLOCK_STMT node. */
+/* Add GNU_STMT to the current statement group. If it is an expression with
+ no effects, it is ignored. */
extern void add_stmt (tree gnu_stmt);
-/* Similar, but set the location of GNU_STMT to that of GNAT_NODE. */
+/* Similar, but the statement is always added, regardless of side-effects. */
+extern void add_stmt_force (tree gnu_stmt);
+
+/* Like add_stmt, but set the location of GNU_STMT to that of GNAT_NODE. */
extern void add_stmt_with_node (tree gnu_stmt, Node_Id gnat_node);
+/* Similar, but the statement is always added, regardless of side-effects. */
+extern void add_stmt_with_node_force (tree gnu_stmt, Node_Id gnat_node);
+
/* Return code corresponding to the current code group. It is normally
a STATEMENT_LIST, but may also be a BIND_EXPR or TRY_FINALLY_EXPR if
BLOCK or cleanups were set. */
mark_visited (EXP); \
} while (0)
-/* Finalize any From_With_Type incomplete types. We do this after processing
- our compilation unit and after processing its spec, if this is a body. */
+/* Finalize the processing of From_With_Type incomplete types. */
extern void finalize_from_with_types (void);
/* Return the equivalent type to be used for GNAT_ENTITY, if it's a
/* Given GNAT_ENTITY, an object (constant, variable, parameter, exception)
and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the
size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null.
- BY_REF is true if the object is used by reference. */
+ BY_REF is true if the object is used by reference and BY_DOUBLE_REF is
+ true if the object is used by double reference. */
extern void annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size,
- bool by_ref);
+ bool by_ref, bool by_double_ref);
+
+/* Return the variant part of RECORD_TYPE, if any. Otherwise return NULL. */
+extern tree get_variant_part (tree record_type);
/* Given a type T, a FIELD_DECL F, and a replacement value R, return a new
type with all size expressions that contain F updated by replacing F
Nat Num_Source_Lines;
};
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* This is the main program of the back-end. It sets up all the table
structures and then generates code. */
extern void gigi (Node_Id gnat_root, int max_gnat_node,
Entity_Id standard_exception_type,
Int gigi_operating_mode);
+#ifdef __cplusplus
+}
+#endif
+
/* GNAT_NODE is the root of some GNAT tree. Return the root of the
GCC tree corresponding to that GNAT tree. Normally, no code is generated;
we just return an equivalent tree which is used elsewhere to generate
if none. */
extern tree get_exception_label (char kind);
+/* Return the decl for the current elaboration procedure. */
+extern tree get_elaboration_procedure (void);
+
/* If nonzero, pretend we are allocating at global level. */
extern int force_global;
ADT_longjmp_decl,
ADT_update_setjmp_buf_decl,
ADT_raise_nodefer_decl,
+ ADT_reraise_zcx_decl,
ADT_begin_handler_decl,
ADT_end_handler_decl,
ADT_others_decl,
ADT_all_others_decl,
ADT_LAST};
+/* Define kind of exception information associated with raise statements. */
+enum exception_info_kind
+{
+ /* Simple exception information: file:line. */
+ exception_simple,
+ /* Range exception information: file:line + index, first, last. */
+ exception_range,
+ /* Column exception information: file:line:column. */
+ exception_column
+};
+
extern GTY(()) tree gnat_std_decls[(int) ADT_LAST];
extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1];
+extern GTY(()) tree gnat_raise_decls_ext[(int) LAST_REASON_CODE + 1];
#define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type]
#define except_type_node gnat_std_decls[(int) ADT_except_type]
#define longjmp_decl gnat_std_decls[(int) ADT_longjmp_decl]
#define update_setjmp_buf_decl gnat_std_decls[(int) ADT_update_setjmp_buf_decl]
#define raise_nodefer_decl gnat_std_decls[(int) ADT_raise_nodefer_decl]
+#define reraise_zcx_decl gnat_std_decls[(int) ADT_reraise_zcx_decl]
#define begin_handler_decl gnat_std_decls[(int) ADT_begin_handler_decl]
#define others_decl gnat_std_decls[(int) ADT_others_decl]
#define all_others_decl gnat_std_decls[(int) ADT_all_others_decl]
/* Routines expected by the gcc back-end. They must have exactly the same
prototype and names as below. */
-/* Returns nonzero if we are currently in the global binding level. */
-extern int global_bindings_p (void);
+/* Return true if we are in the global binding level. */
+extern bool global_bindings_p (void);
/* Enter and exit a new binding level. */
extern void gnat_pushlevel (void);
extern void gnat_poplevel (void);
+extern void gnat_zaplevel (void);
/* Set SUPERCONTEXT of the BLOCK for the current binding level to FNDECL
and point FNDECL to this BLOCK. */
transparently converted to each other. */
extern int gnat_types_compatible_p (tree t1, tree t2);
+/* Return true if EXPR is a useless type conversion. */
+extern bool gnat_useless_type_conversion (tree expr);
+
+/* Return true if T, a FUNCTION_TYPE, has the specified list of flags. */
+extern bool fntype_same_flags_p (const_tree, tree, bool, bool, bool);
+
/* Create an expression whose value is that of EXPR,
converted to type TYPE. The TREE_TYPE of the value
is always TYPE. This function implements all reasonable
/* Make a dummy type corresponding to GNAT_TYPE. */
extern tree make_dummy_type (Entity_Id gnat_type);
-/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */
-extern void record_builtin_type (const char *name, tree type);
+/* Return the dummy type that was made for GNAT_TYPE, if any. */
+extern tree get_dummy_type (Entity_Id gnat_type);
+
+/* Build dummy fat and thin pointer types whose designated type is specified
+ by GNAT_DESIG_TYPE/GNU_DESIG_TYPE and attach them to the latter. */
+extern void build_dummy_unc_pointer_types (Entity_Id gnat_desig_type,
+ tree gnu_desig_type);
+
+/* Record TYPE as a builtin type for Ada. NAME is the name of the type.
+ ARTIFICIAL_P is true if it's a type that was generated by the compiler. */
+extern void record_builtin_type (const char *name, tree type,
+ bool artificial_p);
+
+/* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST,
+ finish constructing the record type as a fat pointer type. */
+extern void finish_fat_pointer_type (tree record_type, tree field_list);
/* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST,
finish constructing the record or union type. If REP_LEVEL is zero, this
/* Append PARALLEL_TYPE on the chain of parallel types for decl. */
extern void add_parallel_type (tree decl, tree parallel_type);
-/* Return the parallel type associated to a type, if any. */
-extern tree get_parallel_type (tree type);
-
/* Return a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the
subprogram. If it is VOID_TYPE, then we are dealing with a procedure,
otherwise we are dealing with a function. PARAM_DECL_LIST is a list of
tree record_type, tree size, tree pos,
int packed, int addressable);
-/* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter,
- PARAM_TYPE is its type. READONLY is true if the parameter is
- readonly (either an In parameter or an address of a pass-by-ref
- parameter). */
+/* Return a PARM_DECL node. PARAM_NAME is the name of the parameter and
+ PARAM_TYPE is its type. READONLY is true if the parameter is readonly
+ (either an In parameter or an address of a pass-by-ref parameter). */
extern tree create_param_decl (tree param_name, tree param_type,
bool readonly);
-/* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
+/* Return a LABEL_DECL node for LABEL_NAME. */
+extern tree create_label_decl (tree label_name);
+
+/* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
- PARM_DECL nodes chained through the TREE_CHAIN field).
+ PARM_DECL nodes chained through the DECL_CHAIN field).
- INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, and ATTR_LIST are used to set the
- appropriate fields in the FUNCTION_DECL. GNAT_NODE gives the location. */
+ INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are
+ used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is
+ used for the position of the decl. */
extern tree create_subprog_decl (tree subprog_name, tree asm_name,
- tree subprog_type, tree param_decl_list,
- bool inlinee_flag, bool public_flag,
- bool extern_flag,
+ tree subprog_type, tree param_decl_list,
+ bool inline_flag, bool public_flag,
+ bool extern_flag, bool artificial_flag,
struct attrib *attr_list, Node_Id gnat_node);
-/* Returns a LABEL_DECL node for LABEL_NAME. */
-extern tree create_label_decl (tree label_name);
-
/* Set up the framework for generating code for SUBPROG_DECL, a subprogram
body. This routine needs to be invoked before processing the declarations
appearing in the subprogram. */
extern void begin_subprog_body (tree subprog_decl);
-/* Finish the definition of the current subprogram BODY and finalize it. */
+/* Finish translating the current subprogram and set its BODY. */
extern void end_subprog_body (tree body);
+/* Wrap up compilation of SUBPROG_DECL, a subprogram body. */
+extern void rest_of_subprog_body_compilation (tree subprog_decl);
+
/* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs.
Return a constructor for the template. */
extern tree build_vms_descriptor32 (tree type, Mechanism_Type mech,
Entity_Id gnat_entity);
-/* Build a stub for the subprogram specified by the GCC tree GNU_SUBPROG
- and the GNAT node GNAT_SUBPROG. */
-extern void build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog);
-
/* Build a type to be used to represent an aliased object whose nominal type
is an unconstrained array. This consists of a RECORD_TYPE containing a
field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ARRAY_TYPE.
component of an aggregate type. */
extern bool type_for_nonaliased_component_p (tree gnu_type);
+/* Return true if TYPE is a smaller form of ORIG_TYPE. */
+extern bool smaller_form_type_p (tree type, tree orig_type);
+
/* Return the base type of TYPE. */
extern tree get_base_type (tree type);
extern tree build_cond_expr (tree result_type, tree condition_operand,
tree true_operand, tree false_operand);
-/* Similar, but for RETURN_EXPR. */
-extern tree build_return_expr (tree ret_obj, tree ret_val);
-
-/* Build a CALL_EXPR to call FUNDECL with one argument, ARG. Return
- the CALL_EXPR. */
-extern tree build_call_1_expr (tree fundecl, tree arg);
-
-/* Build a CALL_EXPR to call FUNDECL with two argument, ARG1 & ARG2. Return
- the CALL_EXPR. */
-extern tree build_call_2_expr (tree fundecl, tree arg1, tree arg2);
+/* Similar, but for COMPOUND_EXPR. */
+extern tree build_compound_expr (tree result_type, tree stmt_operand,
+ tree expr_operand);
-/* Likewise to call FUNDECL with no arguments. */
-extern tree build_call_0_expr (tree fundecl);
+/* Conveniently construct a function call expression. FNDECL names the
+ function to be called, N is the number of arguments, and the "..."
+ parameters are the argument expressions. Unlike build_call_expr
+ this doesn't fold the call, hence it will always return a CALL_EXPR. */
+extern tree build_call_n_expr (tree fndecl, int n, ...);
/* Call a function that raises an exception and pass the line number and file
name, if requested. MSG says which exception function to call.
(N_Raise_{Constraint,Storage,Program}_Error). */
extern tree build_call_raise (int msg, Node_Id gnat_node, char kind);
+/* Similar to build_call_raise, for an index or range check exception as
+ determined by MSG, with extra information generated of the form
+ "INDEX out of range FIRST..LAST". */
+extern tree build_call_raise_range (int msg, Node_Id gnat_node,
+ tree index, tree first, tree last);
+
+/* Similar to build_call_raise, with extra information about the column
+ where the check failed. */
+extern tree build_call_raise_column (int msg, Node_Id gnat_node);
+
/* Return a CONSTRUCTOR of TYPE whose elements are V. This is not the
same as build_constructor in the language-independent tree.c. */
extern tree gnat_build_constructor (tree type, VEC(constructor_elt,gc) *v);
Entity_Id gnat_proc, Entity_Id gnat_pool,
Node_Id gnat_node, bool);
-/* Fill in a VMS descriptor for EXPR and return a constructor for it.
- GNAT_FORMAL is how we find the descriptor record. GNAT_ACTUAL is how
- we derive the source location on a C_E */
-extern tree fill_vms_descriptor (tree expr, Entity_Id gnat_formal,
+/* Fill in a VMS descriptor of GNU_TYPE for GNU_EXPR and return the result.
+ GNAT_ACTUAL is the actual parameter for which the descriptor is built. */
+extern tree fill_vms_descriptor (tree gnu_type, tree gnu_expr,
Node_Id gnat_actual);
+/* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular
+ pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit)
+ pointer type of GNU_EXPR. BY_REF is true if the result is to be used by
+ reference. GNAT_SUBPROG is the subprogram to which the VMS descriptor is
+ passed. */
+extern tree convert_vms_descriptor (tree gnu_type, tree gnu_expr,
+ tree gnu_expr_alt_type, bool by_ref,
+ Entity_Id gnat_subprog);
+
/* Indicate that we need to take the address of T and that it therefore
should not be allocated in a register. Returns true if successful. */
extern bool gnat_mark_addressable (tree t);
/* Return the precision of the FP mode with size SIZE. */
extern int fp_size_to_prec (int size);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* These functions return the basic data type sizes and related parameters
about the target machine. */
-
extern Pos get_target_bits_per_unit (void);
extern Pos get_target_bits_per_word (void);
extern Pos get_target_char_size (void);
extern Pos get_target_long_double_size (void);
extern Pos get_target_pointer_size (void);
extern Pos get_target_maximum_default_alignment (void);
-extern Pos get_target_default_allocator_alignment (void);
+extern Pos get_target_system_allocator_alignment (void);
extern Pos get_target_maximum_allowed_alignment (void);
extern Pos get_target_maximum_alignment (void);
extern Nat get_float_words_be (void);
extern Nat get_target_double_float_alignment (void);
extern Nat get_target_double_scalar_alignment (void);
+/* This function is called by the front-end to enumerate all the supported
+ modes for the machine, as well as some predefined C types. */
+extern void enumerate_modes (void (*f) (const char *, int, int, int, int, int,
+ int));
+
+#ifdef __cplusplus
+}
+#endif
+
/* Let code know whether we are targetting VMS without need of
intrusive preprocessor directives. */
#ifndef TARGET_ABI_OPEN_VMS