builtins.c (get_pointer_alignment): Honor DECL_ALIGN on a FUNCTION_DECL.
* builtins.c (get_pointer_alignment): Honor DECL_ALIGN on a FUNCTION_DECL. * tree.c (build_decl_stat): Move code from here... (make_node_stat): ... to here. Don't uselessly clear DECL_USER_ALIGN. (expr_align): Honor DECL_ALIGN on a FUNCTION_DECL. Add comment about using DECL_ALIGN of LABEL_DECL and CONST_DECL. * tree.h (DECL_USER_ALIGN): Fix misplaced comment. * varasm.c (assemble_start_function): Use DECL_ALIGN instead of FUNCTION_BOUNDARY. From-SVN: r126588
This commit is contained in:
parent
0f3943ec66
commit
d872ada017
5 changed files with 27 additions and 21 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2007-07-12 Geoffrey Keating <geoffk@apple.com>
|
||||||
|
|
||||||
|
* builtins.c (get_pointer_alignment): Honor DECL_ALIGN on a
|
||||||
|
FUNCTION_DECL.
|
||||||
|
* tree.c (build_decl_stat): Move code from here...
|
||||||
|
(make_node_stat): ... to here. Don't uselessly clear DECL_USER_ALIGN.
|
||||||
|
(expr_align): Honor DECL_ALIGN on a FUNCTION_DECL. Add comment
|
||||||
|
about using DECL_ALIGN of LABEL_DECL and CONST_DECL.
|
||||||
|
* tree.h (DECL_USER_ALIGN): Fix misplaced comment.
|
||||||
|
* varasm.c (assemble_start_function): Use DECL_ALIGN instead of
|
||||||
|
FUNCTION_BOUNDARY.
|
||||||
|
|
||||||
2007-07-12 Dorit Nuzman <dorit@il.ibm.com>
|
2007-07-12 Dorit Nuzman <dorit@il.ibm.com>
|
||||||
|
|
||||||
* target.h (builtin_vectorization_cost): Add new target builtin.
|
* target.h (builtin_vectorization_cost): Add new target builtin.
|
||||||
|
|
|
@ -355,9 +355,7 @@ get_pointer_alignment (tree exp, unsigned int max_align)
|
||||||
else if (offset)
|
else if (offset)
|
||||||
inner = MIN (inner, BITS_PER_UNIT);
|
inner = MIN (inner, BITS_PER_UNIT);
|
||||||
}
|
}
|
||||||
if (TREE_CODE (exp) == FUNCTION_DECL)
|
if (DECL_P (exp))
|
||||||
align = FUNCTION_BOUNDARY;
|
|
||||||
else if (DECL_P (exp))
|
|
||||||
align = MIN (inner, DECL_ALIGN (exp));
|
align = MIN (inner, DECL_ALIGN (exp));
|
||||||
#ifdef CONSTANT_ALIGNMENT
|
#ifdef CONSTANT_ALIGNMENT
|
||||||
else if (CONSTANT_CLASS_P (exp))
|
else if (CONSTANT_CLASS_P (exp))
|
||||||
|
|
22
gcc/tree.c
22
gcc/tree.c
|
@ -588,9 +588,13 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
|
||||||
DECL_IN_SYSTEM_HEADER (t) = in_system_header;
|
DECL_IN_SYSTEM_HEADER (t) = in_system_header;
|
||||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
|
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
|
||||||
{
|
{
|
||||||
if (code != FUNCTION_DECL)
|
if (code == FUNCTION_DECL)
|
||||||
|
{
|
||||||
|
DECL_ALIGN (t) = FUNCTION_BOUNDARY;
|
||||||
|
DECL_MODE (t) = FUNCTION_MODE;
|
||||||
|
}
|
||||||
|
else
|
||||||
DECL_ALIGN (t) = 1;
|
DECL_ALIGN (t) = 1;
|
||||||
DECL_USER_ALIGN (t) = 0;
|
|
||||||
/* We have not yet computed the alias set for this declaration. */
|
/* We have not yet computed the alias set for this declaration. */
|
||||||
DECL_POINTER_ALIAS_SET (t) = -1;
|
DECL_POINTER_ALIAS_SET (t) = -1;
|
||||||
}
|
}
|
||||||
|
@ -1914,14 +1918,13 @@ expr_align (tree t)
|
||||||
align1 = expr_align (TREE_OPERAND (t, 2));
|
align1 = expr_align (TREE_OPERAND (t, 2));
|
||||||
return MIN (align0, align1);
|
return MIN (align0, align1);
|
||||||
|
|
||||||
|
/* FIXME: LABEL_DECL and CONST_DECL never have DECL_ALIGN set
|
||||||
|
meaningfully, it's always 1. */
|
||||||
case LABEL_DECL: case CONST_DECL:
|
case LABEL_DECL: case CONST_DECL:
|
||||||
case VAR_DECL: case PARM_DECL: case RESULT_DECL:
|
case VAR_DECL: case PARM_DECL: case RESULT_DECL:
|
||||||
if (DECL_ALIGN (t) != 0)
|
|
||||||
return DECL_ALIGN (t);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FUNCTION_DECL:
|
case FUNCTION_DECL:
|
||||||
return FUNCTION_BOUNDARY;
|
gcc_assert (DECL_ALIGN (t) != 0);
|
||||||
|
return DECL_ALIGN (t);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -3311,11 +3314,6 @@ build_decl_stat (enum tree_code code, tree name, tree type MEM_STAT_DECL)
|
||||||
|
|
||||||
if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
|
if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
|
||||||
layout_decl (t, 0);
|
layout_decl (t, 0);
|
||||||
else if (code == FUNCTION_DECL)
|
|
||||||
{
|
|
||||||
DECL_MODE (t) = FUNCTION_MODE;
|
|
||||||
DECL_ALIGN (t) = FUNCTION_BOUNDARY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2589,10 +2589,8 @@ struct tree_memory_partition_tag GTY(())
|
||||||
#define DECL_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.align)
|
#define DECL_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.align)
|
||||||
/* The alignment of NODE, in bytes. */
|
/* The alignment of NODE, in bytes. */
|
||||||
#define DECL_ALIGN_UNIT(NODE) (DECL_ALIGN (NODE) / BITS_PER_UNIT)
|
#define DECL_ALIGN_UNIT(NODE) (DECL_ALIGN (NODE) / BITS_PER_UNIT)
|
||||||
/* For FIELD_DECLs, off_align holds the number of low-order bits of
|
/* Set if the alignment of this DECL has been set by the user, for
|
||||||
DECL_FIELD_OFFSET which are known to be always zero.
|
example with an 'aligned' attribute. */
|
||||||
DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET
|
|
||||||
has. */
|
|
||||||
#define DECL_USER_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.user_align)
|
#define DECL_USER_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.user_align)
|
||||||
/* Holds the machine mode corresponding to the declaration of a variable or
|
/* Holds the machine mode corresponding to the declaration of a variable or
|
||||||
field. Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
|
field. Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
|
||||||
|
|
|
@ -1638,7 +1638,7 @@ assemble_start_function (tree decl, const char *fnname)
|
||||||
if (flag_reorder_blocks_and_partition)
|
if (flag_reorder_blocks_and_partition)
|
||||||
{
|
{
|
||||||
switch_to_section (unlikely_text_section ());
|
switch_to_section (unlikely_text_section ());
|
||||||
assemble_align (FUNCTION_BOUNDARY);
|
assemble_align (DECL_ALIGN (decl));
|
||||||
ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_label);
|
ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_label);
|
||||||
|
|
||||||
/* When the function starts with a cold section, we need to explicitly
|
/* When the function starts with a cold section, we need to explicitly
|
||||||
|
@ -1648,7 +1648,7 @@ assemble_start_function (tree decl, const char *fnname)
|
||||||
&& BB_PARTITION (ENTRY_BLOCK_PTR->next_bb) == BB_COLD_PARTITION)
|
&& BB_PARTITION (ENTRY_BLOCK_PTR->next_bb) == BB_COLD_PARTITION)
|
||||||
{
|
{
|
||||||
switch_to_section (text_section);
|
switch_to_section (text_section);
|
||||||
assemble_align (FUNCTION_BOUNDARY);
|
assemble_align (DECL_ALIGN (decl));
|
||||||
ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label);
|
ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label);
|
||||||
hot_label_written = true;
|
hot_label_written = true;
|
||||||
first_function_block_is_cold = true;
|
first_function_block_is_cold = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue