Commit c1a569ef by Eric Botcazou Committed by Eric Botcazou

gigi.h (record_builtin_type): Adjust comment.

	* gcc-interface/gigi.h (record_builtin_type): Adjust comment.
	(tree create_type_decl): Likewise.
	(create_var_decl_1): Add artificial_p and debug_info_p parameters.
	(create_var_decl): Likewise.
	(create_true_var_decl): Delete.
	(create_subprog_decl): Add debug_info_p parameter.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Add artificial_p local
	variable and use it throughout.  Remove DECL_ARTIFICIAL settings.
	<E_Variable>: Adjust calls to create_var_decl and create_var_decl_1.
	Remove DECL_IGNORED_P settings.
	<E_Enumeration_Type>: Likewise.
	<E_Record_Type>: Likewise.
	<E_Subprogram_Type>: Likewise.  Remove artificial_flag local variable.
	Adjust call to create_subprog_decl.
	(get_minimal_subprog_decl): Likewise.
	(elaborate_expression_1): Adjust call to create_var_decl.
	* gcc-interface/trans.c (gigi): Adjust calls to create_var_decl and
	create_subprog_decl.  Remove DECL_ARTIFICIAL & DECL_IGNORED_P settings.
	* gcc-interface/utils.c (maybe_pad_type): Likewise.
	(record_builtin_type): Adjust comment.
	(create_type_stub_decl): Remove obsolete comment.
	(create_var_decl_1): Add artificial_p and debug_info_p parameters.
	Set DECL_ARTIFICIAL and DECL_IGNORED_P accordingly.
	(create_subprog_decl): Add debug_info_p parameter.  Set DECL_IGNORED_P
	accordingly.

From-SVN: r224699
parent 034e7d49
2015-06-19 Eric Botcazou <ebotcazou@adacore.com> 2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (record_builtin_type): Adjust comment.
(tree create_type_decl): Likewise.
(create_var_decl_1): Add artificial_p and debug_info_p parameters.
(create_var_decl): Likewise.
(create_true_var_decl): Delete.
(create_subprog_decl): Add debug_info_p parameter.
* gcc-interface/decl.c (gnat_to_gnu_entity): Add artificial_p local
variable and use it throughout. Remove DECL_ARTIFICIAL settings.
<E_Variable>: Adjust calls to create_var_decl and create_var_decl_1.
Remove DECL_IGNORED_P settings.
<E_Enumeration_Type>: Likewise.
<E_Record_Type>: Likewise.
<E_Subprogram_Type>: Likewise. Remove artificial_flag local variable.
Adjust call to create_subprog_decl.
(get_minimal_subprog_decl): Likewise.
(elaborate_expression_1): Adjust call to create_var_decl.
* gcc-interface/trans.c (gigi): Adjust calls to create_var_decl and
create_subprog_decl. Remove DECL_ARTIFICIAL & DECL_IGNORED_P settings.
* gcc-interface/utils.c (maybe_pad_type): Likewise.
(record_builtin_type): Adjust comment.
(create_type_stub_decl): Remove obsolete comment.
(create_var_decl_1): Add artificial_p and debug_info_p parameters.
Set DECL_ARTIFICIAL and DECL_IGNORED_P accordingly.
(create_subprog_decl): Add debug_info_p parameter. Set DECL_IGNORED_P
accordingly.
2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/misc.c (LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL): Define.
2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Make sure * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Make sure
the size of a padding type built around the return type is positive. the size of a padding type built around the return type is positive.
* gcc-interface/trans.c (gnat_to_gnu) <N_Simple_Return_Statement>: * gcc-interface/trans.c (gnat_to_gnu) <N_Simple_Return_Statement>:
......
...@@ -599,7 +599,7 @@ extern void build_dummy_unc_pointer_types (Entity_Id gnat_desig_type, ...@@ -599,7 +599,7 @@ extern void build_dummy_unc_pointer_types (Entity_Id gnat_desig_type,
tree gnu_desig_type); tree gnu_desig_type);
/* Record TYPE as a builtin type for Ada. NAME is the name of the 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. */ ARTIFICIAL_P is true if the type was generated by the compiler. */
extern void record_builtin_type (const char *name, tree type, extern void record_builtin_type (const char *name, tree type,
bool artificial_p); bool artificial_p);
...@@ -660,10 +660,10 @@ extern tree create_range_type (tree type, tree min, tree max); ...@@ -660,10 +660,10 @@ extern tree create_range_type (tree type, tree min, tree max);
extern tree create_type_stub_decl (tree type_name, tree type); extern tree create_type_stub_decl (tree type_name, tree type);
/* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE /* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE
is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if this is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
is a declaration that was generated by the compiler. DEBUG_INFO_P is declaration was generated by the compiler. DEBUG_INFO_P is true if we
true if we need to write debug information about this type. GNAT_NODE need to write debug information about this type. GNAT_NODE is used for
is used for the position of the decl. */ the position of the decl. */
extern tree create_type_decl (tree type_name, tree type, bool artificial_p, extern tree create_type_decl (tree type_name, tree type, bool artificial_p,
bool debug_info_p, Node_Id gnat_node); bool debug_info_p, Node_Id gnat_node);
...@@ -686,32 +686,28 @@ extern tree create_type_decl (tree type_name, tree type, bool artificial_p, ...@@ -686,32 +686,28 @@ extern tree create_type_decl (tree type_name, tree type, bool artificial_p,
STATIC_FLAG is only relevant when not at top level. In that case STATIC_FLAG is only relevant when not at top level. In that case
it indicates whether to always allocate storage to the variable. it indicates whether to always allocate storage to the variable.
ARTIFICIAL_P is true if the variable was generated by the compiler.
DEBUG_INFO_P is true if we need to write debug information for it.
GNAT_NODE is used for the position of the decl. */ GNAT_NODE is used for the position of the decl. */
extern tree extern tree
create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
bool const_flag, bool public_flag, bool extern_flag, bool const_flag, bool public_flag, bool extern_flag,
bool static_flag, bool const_decl_allowed_p, bool static_flag, bool artificial_p, bool debug_info_p,
struct attrib *attr_list, Node_Id gnat_node); bool const_decl_allowed_p, struct attrib *attr_list,
Node_Id gnat_node);
/* Wrapper around create_var_decl_1 for cases where we don't care whether /* Wrapper around create_var_decl_1 for cases where we don't care whether
a VAR or a CONST decl node is created. */ a VAR or a CONST decl node is created. */
#define create_var_decl(var_name, asm_name, type, var_init, \ #define create_var_decl(var_name, asm_name, type, var_init, \
const_flag, public_flag, extern_flag, \ const_flag, public_flag, extern_flag, \
static_flag, attr_list, gnat_node) \ static_flag, artificial_p, debug_info_p,\
create_var_decl_1 (var_name, asm_name, type, var_init, \ attr_list, gnat_node) \
const_flag, public_flag, extern_flag, \
static_flag, true, attr_list, gnat_node)
/* Wrapper around create_var_decl_1 for cases where a VAR_DECL node is
required. The primary intent is for DECL_CONST_CORRESPONDING_VARs, which
must be VAR_DECLs and on which we want TREE_READONLY set to have them
possibly assigned to a readonly data section. */
#define create_true_var_decl(var_name, asm_name, type, var_init, \
const_flag, public_flag, extern_flag, \
static_flag, attr_list, gnat_node) \
create_var_decl_1 (var_name, asm_name, type, var_init, \ create_var_decl_1 (var_name, asm_name, type, var_init, \
const_flag, public_flag, extern_flag, \ const_flag, public_flag, extern_flag, \
static_flag, false, attr_list, gnat_node) static_flag, artificial_p, debug_info_p, \
true, attr_list, gnat_node)
/* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is /* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is
its type and RECORD_TYPE is the type of the enclosing record. If SIZE is its type and RECORD_TYPE is the type of the enclosing record. If SIZE is
...@@ -739,14 +735,19 @@ extern tree create_label_decl (tree label_name, Node_Id gnat_node); ...@@ -739,14 +735,19 @@ extern tree create_label_decl (tree label_name, Node_Id gnat_node);
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the DECL_CHAIN field). PARM_DECL nodes chained through the DECL_CHAIN field).
INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is appropriate fields in the FUNCTION_DECL.
used for the position of the decl. */
ARTIFICIAL_P is true if the subprogram was generated by the compiler.
DEBUG_INFO_P is true if we need to write debug information for it.
GNAT_NODE is used for the position of the decl. */
extern tree create_subprog_decl (tree subprog_name, tree asm_name, extern tree create_subprog_decl (tree subprog_name, tree asm_name,
tree subprog_type, tree param_decl_list, tree subprog_type, tree param_decl_list,
enum inline_status_t inline_status, enum inline_status_t inline_status,
bool public_flag, bool extern_flag, bool public_flag, bool extern_flag,
bool artificial_flag, bool artificial_p, bool debug_info_p,
struct attrib *attr_list, Node_Id gnat_node); struct attrib *attr_list, Node_Id gnat_node);
/* Process the attributes in ATTR_LIST for NODE, which is either a DECL or /* Process the attributes in ATTR_LIST for NODE, which is either a DECL or
......
...@@ -1377,8 +1377,25 @@ maybe_pad_type (tree type, tree size, unsigned int align, ...@@ -1377,8 +1377,25 @@ maybe_pad_type (tree type, tree size, unsigned int align,
&& !(TREE_CODE (TYPE_NAME (type)) == TYPE_DECL && !(TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_IGNORED_P (TYPE_NAME (type)))) && DECL_IGNORED_P (TYPE_NAME (type))))
{ {
tree marker = make_node (RECORD_TYPE);
tree name = TYPE_IDENTIFIER (record); tree name = TYPE_IDENTIFIER (record);
tree size_unit = TYPE_SIZE_UNIT (record);
/* A variable that holds the size is required even with no encoding since
it will be referenced by debugging information attributes. At global
level, we need a single variable across all translation units. */
if (size
&& TREE_CODE (size) != INTEGER_CST
&& (definition || global_bindings_p ()))
{
size_unit
= create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype,
size_unit, true, global_bindings_p (),
!definition && global_bindings_p (), false,
true, true, NULL, gnat_entity);
TYPE_SIZE_UNIT (record) = size_unit;
}
tree marker = make_node (RECORD_TYPE);
tree orig_name = TYPE_IDENTIFIER (type); tree orig_name = TYPE_IDENTIFIER (type);
TYPE_NAME (marker) = concat_name (name, "XVS"); TYPE_NAME (marker) = concat_name (name, "XVS");
...@@ -1388,14 +1405,9 @@ maybe_pad_type (tree type, tree size, unsigned int align, ...@@ -1388,14 +1405,9 @@ maybe_pad_type (tree type, tree size, unsigned int align,
marker, NULL_TREE, NULL_TREE, marker, NULL_TREE, NULL_TREE,
0, 0), 0, 0),
0, true); 0, true);
TYPE_SIZE_UNIT (marker) = size_unit;
add_parallel_type (record, marker); add_parallel_type (record, marker);
if (definition && size && TREE_CODE (size) != INTEGER_CST)
TYPE_SIZE_UNIT (marker)
= create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype,
TYPE_SIZE_UNIT (record), false, false, false,
false, NULL, gnat_entity);
} }
rest_of_record_type_compilation (record); rest_of_record_type_compilation (record);
...@@ -1537,7 +1549,7 @@ relate_alias_sets (tree gnu_new_type, tree gnu_old_type, enum alias_set_op op) ...@@ -1537,7 +1549,7 @@ relate_alias_sets (tree gnu_new_type, tree gnu_old_type, enum alias_set_op op)
} }
/* Record TYPE as a builtin type for Ada. NAME is the name of the 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. */ ARTIFICIAL_P is true if the type was generated by the compiler. */
void void
record_builtin_type (const char *name, tree type, bool artificial_p) record_builtin_type (const char *name, tree type, bool artificial_p)
...@@ -2241,9 +2253,6 @@ create_range_type (tree type, tree min, tree max) ...@@ -2241,9 +2253,6 @@ create_range_type (tree type, tree min, tree max)
tree tree
create_type_stub_decl (tree type_name, tree type) create_type_stub_decl (tree type_name, tree type)
{ {
/* Using a named TYPE_DECL ensures that a type name marker is emitted in
STABS while setting DECL_ARTIFICIAL ensures that no DW_TAG_typedef is
emitted in DWARF. */
tree type_decl = build_decl (input_location, TYPE_DECL, type_name, type); tree type_decl = build_decl (input_location, TYPE_DECL, type_name, type);
DECL_ARTIFICIAL (type_decl) = 1; DECL_ARTIFICIAL (type_decl) = 1;
TYPE_ARTIFICIAL (type) = 1; TYPE_ARTIFICIAL (type) = 1;
...@@ -2251,10 +2260,10 @@ create_type_stub_decl (tree type_name, tree type) ...@@ -2251,10 +2260,10 @@ create_type_stub_decl (tree type_name, tree type)
} }
/* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE /* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE
is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if this is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
is a declaration that was generated by the compiler. DEBUG_INFO_P is declaration was generated by the compiler. DEBUG_INFO_P is true if we
true if we need to write debug information about this type. GNAT_NODE need to write debug information about this type. GNAT_NODE is used for
is used for the position of the decl. */ the position of the decl. */
tree tree
create_type_decl (tree type_name, tree type, bool artificial_p, create_type_decl (tree type_name, tree type, bool artificial_p,
...@@ -2322,13 +2331,18 @@ create_type_decl (tree type_name, tree type, bool artificial_p, ...@@ -2322,13 +2331,18 @@ create_type_decl (tree type_name, tree type, bool artificial_p,
STATIC_FLAG is only relevant when not at top level. In that case STATIC_FLAG is only relevant when not at top level. In that case
it indicates whether to always allocate storage to the variable. it indicates whether to always allocate storage to the variable.
ARTIFICIAL_P is true if the variable was generated by the compiler.
DEBUG_INFO_P is true if we need to write debug information for it.
GNAT_NODE is used for the position of the decl. */ GNAT_NODE is used for the position of the decl. */
tree tree
create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
bool const_flag, bool public_flag, bool extern_flag, bool const_flag, bool public_flag, bool extern_flag,
bool static_flag, bool const_decl_allowed_p, bool static_flag, bool artificial_p, bool debug_info_p,
struct attrib *attr_list, Node_Id gnat_node) bool const_decl_allowed_p, struct attrib *attr_list,
Node_Id gnat_node)
{ {
/* Whether the object has static storage duration, either explicitly or by /* Whether the object has static storage duration, either explicitly or by
virtue of being declared at the global level. */ virtue of being declared at the global level. */
...@@ -2379,10 +2393,14 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, ...@@ -2379,10 +2393,14 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
if (var_init && !init_const && global_bindings_p ()) if (var_init && !init_const && global_bindings_p ())
Check_Elaboration_Code_Allowed (gnat_node); Check_Elaboration_Code_Allowed (gnat_node);
/* Attach the initializer, if any. */
DECL_INITIAL (var_decl) = var_init; DECL_INITIAL (var_decl) = var_init;
TREE_READONLY (var_decl) = const_flag;
/* Directly set some flags. */
DECL_ARTIFICIAL (var_decl) = artificial_p;
DECL_EXTERNAL (var_decl) = extern_flag; DECL_EXTERNAL (var_decl) = extern_flag;
TREE_CONSTANT (var_decl) = constant_p; TREE_CONSTANT (var_decl) = constant_p;
TREE_READONLY (var_decl) = const_flag;
/* We need to allocate static storage for an object with static storage /* We need to allocate static storage for an object with static storage
duration if it isn't external. */ duration if it isn't external. */
...@@ -2402,14 +2420,18 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, ...@@ -2402,14 +2420,18 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
&& !have_global_bss_p ()) && !have_global_bss_p ())
DECL_COMMON (var_decl) = 1; DECL_COMMON (var_decl) = 1;
/* For an external constant whose initializer is not absolute, do not emit /* Do not emit debug info for a CONST_DECL if optimization isn't enabled,
debug info. In DWARF this would mean a global relocation in a read-only since we will create an associated variable. Likewise for an external
section which runs afoul of the PE-COFF run-time relocation mechanism. */ constant whose initializer is not absolute, because this would mean a
if (extern_flag global relocation in a read-only section which runs afoul of the PE-COFF
run-time relocation mechanism. */
if (!debug_info_p
|| (TREE_CODE (var_decl) == CONST_DECL && !optimize)
|| (extern_flag
&& constant_p && constant_p
&& var_init && var_init
&& initializer_constant_valid_p (var_init, TREE_TYPE (var_init)) && initializer_constant_valid_p (var_init, TREE_TYPE (var_init))
!= null_pointer_node) != null_pointer_node))
DECL_IGNORED_P (var_decl) = 1; DECL_IGNORED_P (var_decl) = 1;
if (TYPE_VOLATILE (type)) if (TYPE_VOLATILE (type))
...@@ -3023,15 +3045,21 @@ create_label_decl (tree label_name, Node_Id gnat_node) ...@@ -3023,15 +3045,21 @@ create_label_decl (tree label_name, Node_Id gnat_node)
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the DECL_CHAIN field). PARM_DECL nodes chained through the DECL_CHAIN field).
INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is appropriate fields in the FUNCTION_DECL.
used for the position of the decl. */
ARTIFICIAL_P is true if the subprogram was generated by the compiler.
DEBUG_INFO_P is true if we need to write debug information for it.
GNAT_NODE is used for the position of the decl. */
tree tree
create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type, create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
tree param_decl_list, enum inline_status_t inline_status, tree param_decl_list, enum inline_status_t inline_status,
bool public_flag, bool extern_flag, bool artificial_flag, bool public_flag, bool extern_flag, bool artificial_p,
struct attrib *attr_list, Node_Id gnat_node) bool debug_info_p, struct attrib *attr_list,
Node_Id gnat_node)
{ {
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name, tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name,
subprog_type); subprog_type);
...@@ -3039,7 +3067,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type, ...@@ -3039,7 +3067,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
TREE_TYPE (subprog_type)); TREE_TYPE (subprog_type));
DECL_ARGUMENTS (subprog_decl) = param_decl_list; DECL_ARGUMENTS (subprog_decl) = param_decl_list;
DECL_ARTIFICIAL (subprog_decl) = artificial_flag; DECL_ARTIFICIAL (subprog_decl) = artificial_p;
DECL_EXTERNAL (subprog_decl) = extern_flag; DECL_EXTERNAL (subprog_decl) = extern_flag;
switch (inline_status) switch (inline_status)
...@@ -3062,13 +3090,16 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type, ...@@ -3062,13 +3090,16 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
case is_enabled: case is_enabled:
DECL_DECLARED_INLINE_P (subprog_decl) = 1; DECL_DECLARED_INLINE_P (subprog_decl) = 1;
DECL_NO_INLINE_WARNING_P (subprog_decl) = artificial_flag; DECL_NO_INLINE_WARNING_P (subprog_decl) = artificial_p;
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
if (!debug_info_p)
DECL_IGNORED_P (subprog_decl) = 1;
TREE_PUBLIC (subprog_decl) = public_flag; TREE_PUBLIC (subprog_decl) = public_flag;
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type); TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type); TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type);
......
2015-06-19 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/debug1.ads: Adjust.
2015-06-19 Jim Wilson <jim.wilson@linaro.org> 2015-06-19 Jim Wilson <jim.wilson@linaro.org>
* gcc.target/aarch64/fmovd-zero-mem.c: New. * gcc.target/aarch64/fmovd-zero-mem.c: New.
......
...@@ -11,4 +11,4 @@ package Debug1 is ...@@ -11,4 +11,4 @@ package Debug1 is
end Debug1; end Debug1;
-- { dg-final { scan-assembler-times "DW_AT_artificial" 17 } } -- { dg-final { scan-assembler-times "DW_AT_artificial" 15 } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment