Commit 6f197850 by H.J. Lu Committed by H.J. Lu

Update alignment on local variables.

2011-04-14  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/48608
	* cfgexpand.c (get_decl_align_unit): Renamed to ...
	(align_local_variable): This.  Update DECL_ALIGN.
	(add_stack_var): Updated.
	(expand_one_stack_var): Likewise.

From-SVN: r172438
parent 545f261b
2011-04-14 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/48608
* cfgexpand.c (get_decl_align_unit): Renamed to ...
(align_local_variable): This. Update DECL_ALIGN.
(add_stack_var): Updated.
(expand_one_stack_var): Likewise.
2011-04-14 Richard Guenther <rguenther@suse.de> 2011-04-14 Richard Guenther <rguenther@suse.de>
* tree-ssa-dse.c (struct dse_global_data, struct dse_block_local_data): * tree-ssa-dse.c (struct dse_global_data, struct dse_block_local_data):
......
...@@ -205,13 +205,14 @@ static bool has_protected_decls; ...@@ -205,13 +205,14 @@ static bool has_protected_decls;
smaller than our cutoff threshold. Used for -Wstack-protector. */ smaller than our cutoff threshold. Used for -Wstack-protector. */
static bool has_short_buffer; static bool has_short_buffer;
/* Discover the byte alignment to use for DECL. Ignore alignment /* Compute the byte alignment to use for DECL. Ignore alignment
we can't do with expected alignment of the stack boundary. */ we can't do with expected alignment of the stack boundary. */
static unsigned int static unsigned int
get_decl_align_unit (tree decl) align_local_variable (tree decl)
{ {
unsigned int align = LOCAL_DECL_ALIGNMENT (decl); unsigned int align = LOCAL_DECL_ALIGNMENT (decl);
DECL_ALIGN (decl) = align;
return align / BITS_PER_UNIT; return align / BITS_PER_UNIT;
} }
...@@ -273,7 +274,7 @@ add_stack_var (tree decl) ...@@ -273,7 +274,7 @@ add_stack_var (tree decl)
variables that are simultaneously live. */ variables that are simultaneously live. */
if (v->size == 0) if (v->size == 0)
v->size = 1; v->size = 1;
v->alignb = get_decl_align_unit (SSAVAR (decl)); v->alignb = align_local_variable (SSAVAR (decl));
/* All variables are initially in their own partition. */ /* All variables are initially in their own partition. */
v->representative = stack_vars_num; v->representative = stack_vars_num;
...@@ -905,7 +906,7 @@ expand_one_stack_var (tree var) ...@@ -905,7 +906,7 @@ expand_one_stack_var (tree var)
unsigned byte_align; unsigned byte_align;
size = tree_low_cst (DECL_SIZE_UNIT (SSAVAR (var)), 1); size = tree_low_cst (DECL_SIZE_UNIT (SSAVAR (var)), 1);
byte_align = get_decl_align_unit (SSAVAR (var)); byte_align = align_local_variable (SSAVAR (var));
/* We handle highly aligned variables in expand_stack_vars. */ /* We handle highly aligned variables in expand_stack_vars. */
gcc_assert (byte_align * BITS_PER_UNIT <= MAX_SUPPORTED_STACK_ALIGNMENT); gcc_assert (byte_align * BITS_PER_UNIT <= MAX_SUPPORTED_STACK_ALIGNMENT);
......
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