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>
* 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
the size of a padding type built around the return type is positive.
* 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,
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. */
ARTIFICIAL_P is true if the type was generated by the compiler. */
extern void record_builtin_type (const char *name, tree type,
bool artificial_p);
......@@ -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);
/* 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 declaration that was generated by the compiler. DEBUG_INFO_P is
true if we need to write debug information about this type. GNAT_NODE
is used for the position of the decl. */
is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
declaration was generated by the compiler. DEBUG_INFO_P is true if we
need to write debug information about this type. GNAT_NODE is used for
the position of the decl. */
extern tree create_type_decl (tree type_name, tree type, bool artificial_p,
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,
STATIC_FLAG is only relevant when not at top level. In that case
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. */
extern tree
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 static_flag, bool const_decl_allowed_p,
struct attrib *attr_list, Node_Id gnat_node);
bool static_flag, bool artificial_p, bool debug_info_p,
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
a VAR or a CONST decl node is created. */
#define create_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, \
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) \
static_flag, artificial_p, debug_info_p,\
attr_list, gnat_node) \
create_var_decl_1 (var_name, asm_name, type, var_init, \
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
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);
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the DECL_CHAIN field).
INLINE_STATUS, 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. */
INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
appropriate fields in the FUNCTION_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,
tree subprog_type, tree param_decl_list,
enum inline_status_t inline_status,
bool public_flag, bool extern_flag,
bool artificial_flag,
bool artificial_p, bool debug_info_p,
struct attrib *attr_list, Node_Id gnat_node);
/* 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,
&& !(TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_IGNORED_P (TYPE_NAME (type))))
{
tree marker = make_node (RECORD_TYPE);
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);
TYPE_NAME (marker) = concat_name (name, "XVS");
......@@ -1388,14 +1405,9 @@ maybe_pad_type (tree type, tree size, unsigned int align,
marker, NULL_TREE, NULL_TREE,
0, 0),
0, true);
TYPE_SIZE_UNIT (marker) = size_unit;
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);
......@@ -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.
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
record_builtin_type (const char *name, tree type, bool artificial_p)
......@@ -2241,9 +2253,6 @@ create_range_type (tree type, tree min, tree max)
tree
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);
DECL_ARTIFICIAL (type_decl) = 1;
TYPE_ARTIFICIAL (type) = 1;
......@@ -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
is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if this
is a declaration that was generated by the compiler. DEBUG_INFO_P is
true if we need to write debug information about this type. GNAT_NODE
is used for the position of the decl. */
is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
declaration was generated by the compiler. DEBUG_INFO_P is true if we
need to write debug information about this type. GNAT_NODE is used for
the position of the decl. */
tree
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
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. */
tree
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 static_flag, bool const_decl_allowed_p,
struct attrib *attr_list, Node_Id gnat_node)
bool static_flag, bool artificial_p, bool debug_info_p,
bool const_decl_allowed_p, struct attrib *attr_list,
Node_Id gnat_node)
{
/* Whether the object has static storage duration, either explicitly or by
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,
if (var_init && !init_const && global_bindings_p ())
Check_Elaboration_Code_Allowed (gnat_node);
/* Attach the initializer, if any. */
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;
TREE_CONSTANT (var_decl) = constant_p;
TREE_READONLY (var_decl) = const_flag;
/* We need to allocate static storage for an object with static storage
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,
&& !have_global_bss_p ())
DECL_COMMON (var_decl) = 1;
/* For an external constant whose initializer is not absolute, do not emit
debug info. In DWARF this would mean a global relocation in a read-only
section which runs afoul of the PE-COFF run-time relocation mechanism. */
if (extern_flag
/* Do not emit debug info for a CONST_DECL if optimization isn't enabled,
since we will create an associated variable. Likewise for an external
constant whose initializer is not absolute, because this would mean a
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
&& var_init
&& initializer_constant_valid_p (var_init, TREE_TYPE (var_init))
!= null_pointer_node)
!= null_pointer_node))
DECL_IGNORED_P (var_decl) = 1;
if (TYPE_VOLATILE (type))
......@@ -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
PARM_DECL nodes chained through the DECL_CHAIN field).
INLINE_STATUS, 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. */
INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
appropriate fields in the FUNCTION_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
create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
tree param_decl_list, enum inline_status_t inline_status,
bool public_flag, bool extern_flag, bool artificial_flag,
struct attrib *attr_list, Node_Id gnat_node)
bool public_flag, bool extern_flag, bool artificial_p,
bool debug_info_p, struct attrib *attr_list,
Node_Id gnat_node)
{
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name,
subprog_type);
......@@ -3039,7 +3067,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
TREE_TYPE (subprog_type));
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;
switch (inline_status)
......@@ -3062,13 +3090,16 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
case is_enabled:
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;
default:
gcc_unreachable ();
}
if (!debug_info_p)
DECL_IGNORED_P (subprog_decl) = 1;
TREE_PUBLIC (subprog_decl) = public_flag;
TREE_READONLY (subprog_decl) = TYPE_READONLY (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>
* gcc.target/aarch64/fmovd-zero-mem.c: New.
......
......@@ -11,4 +11,4 @@ package Debug1 is
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