aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2012-05-29 14:44:47 +0000
committerMichael Matz <matz@suse.de>2012-05-29 14:44:47 +0000
commit7ab5448db989865f8f8d24c7b4ceaa13d3ef8100 (patch)
tree9cac16ca3b03c2c66c24eeab8ec66e412d413342 /gcc/function.c
parentfa8e24c2d0ce8b5da092085756d6f7bf8e25ab1c (diff)
* rtl.h (assign_stack_temp, assign_stack_temp_for_type,
assign_temp): Remove 'keep' argument. (mark_temp_addr_taken): Remove prototype. * tree.h (expand_decl): Remove prototype. * function.c (struct temp_slot): Remove addr_taken and keep member. (assign_stack_temp_for_type) Don't initialize above, remove keep argument. (assign_stack_temp, assign_temp): Remove keep argument. (mark_temp_addr_taken): Remove. (preserve_temp_slots): Remove handling of addr_taken and keep members. (free_temp_slots): Ditto. * expr.c (expand_expr_real_1 <COMPOUND_LITERAL_EXPR>): Remove dead code. * stmt.c (expand_asm_operands): Remove dead code. (expand_decl): Remove. * c-decl.c (finish_struct): Don't call expand_decl. * builtins.c (expand_builtin_cexpi): Adjust calls to assign_temp and assign_stack_temp. * calls.c (save_fixed_argument_area, initialize_argument_information, expand_call, emit_library_call_value_1, store_one_arg): Ditto. * expmed.c (extract_bit_field_1): Ditto. * expr.c (emit_group_load_1, emit_group_store, copy_blkmode_from_reg, emit_push_insn, expand_assignment, store_field, expand_constructor, expand_cond_expr_using_cmove, expand_expr_real_2, expand_expr_real_1): Ditto. * stmt.c (expand_asm_operands, expand_return): Ditto. * function.c (pop_temp_slots): Call free_temp_slots. * calls.c (store_one_arg): Don't call preserve_temp_slots or free_temp_slots. * expr.c (expand_assignment): Don't call free_temp_slots. * config/arm/arm.c (neon_expand_vector_init): Ditto. * config/i386/i386.c (ix86_expand_vector_set): Ditto. (ix86_expand_vector_extract): Ditto. * config/ia64/ia64.c (spill_xfmode_rfmode_operand, ia64_expand_movxf_movrf): Ditto. * config/mips/mips.c (mips_expand_vi_general): Ditto. * config/mmix/mmix.md (floatdisf2, floatunsdisf2, truncdfsf2, extendsfdf2): Ditto. * config/rs6000/rs6000.c (rs6000_expand_vector_init, rs6000_expand_vector_set, rs6000_expand_vector_extract, rs6000_allocate_stack_temp): Ditto. * config/rs6000/rs6000.md (fix_trunctfsi2_fprs): Ditto. * config/sparc/sparc.c (emit_soft_tfmode_libcall, sparc_emit_float_lib_cmp, sparc_emit_float_lib_cmp, sparc_expand_vector_init): Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@187965 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c140
1 files changed, 18 insertions, 122 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 0fd4d36bfcc..87edf7abbcd 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -527,7 +527,6 @@ assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align)
return assign_stack_local_1 (mode, size, align, ASLK_RECORD_PAD);
}
-
/* In order to evaluate some expressions, such as function calls returning
structures in memory, we need to temporarily allocate stack locations.
We record each allocated temporary in the following structure.
@@ -540,11 +539,7 @@ assign_stack_local (enum machine_mode mode, HOST_WIDE_INT size, int align)
result could be in a temporary, we preserve it if we can determine which
one it is in. If we cannot determine which temporary may contain the
result, all temporaries are preserved. A temporary is preserved by
- pretending it was allocated at the previous nesting level.
-
- Automatic variables are also assigned temporary slots, at the nesting
- level where they are defined. They are marked a "kept" so that
- free_temp_slots will not free them. */
+ pretending it was allocated at the previous nesting level. */
struct GTY(()) temp_slot {
/* Points to next temporary slot. */
@@ -564,12 +559,8 @@ struct GTY(()) temp_slot {
unsigned int align;
/* Nonzero if this temporary is currently in use. */
char in_use;
- /* Nonzero if this temporary has its address taken. */
- char addr_taken;
/* Nesting level at which this slot is being used. */
int level;
- /* Nonzero if this should survive a call to free_temp_slots. */
- int keep;
/* The offset of the slot from the frame_pointer, including extra space
for alignment. This info is for combine_temp_slots. */
HOST_WIDE_INT base_offset;
@@ -775,17 +766,11 @@ find_temp_slot_from_address (rtx x)
SIZE is the size in units of the space required. We do no rounding here
since assign_stack_local will do any required rounding.
- KEEP is 1 if this slot is to be retained after a call to
- free_temp_slots. Automatic variables for a block are allocated
- with this flag. KEEP values of 2 or 3 were needed respectively
- for variables whose lifetime is controlled by CLEANUP_POINT_EXPRs
- or for SAVE_EXPRs, but they are now unused.
-
TYPE is the type that will be used for the stack slot. */
rtx
assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
- int keep, tree type)
+ tree type)
{
unsigned int align;
struct temp_slot *p, *best_p = 0, *selected = NULL, **pp;
@@ -795,9 +780,6 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
of a variable size. */
gcc_assert (size != -1);
- /* These are now unused. */
- gcc_assert (keep <= 1);
-
align = get_stack_local_alignment (type, mode);
/* Try to find an available, already-allocated temporary of the proper
@@ -846,7 +828,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
if (best_p->size - rounded_size >= alignment)
{
p = ggc_alloc_temp_slot ();
- p->in_use = p->addr_taken = 0;
+ p->in_use = 0;
p->size = best_p->size - rounded_size;
p->base_offset = best_p->base_offset + rounded_size;
p->full_size = best_p->full_size - rounded_size;
@@ -918,10 +900,8 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
p = selected;
p->in_use = 1;
- p->addr_taken = 0;
p->type = type;
p->level = temp_slot_level;
- p->keep = keep;
pp = temp_slots_at_level (p->level);
insert_slot_to_list (p, pp);
@@ -946,26 +926,25 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
}
/* Allocate a temporary stack slot and record it for possible later
- reuse. First three arguments are same as in preceding function. */
+ reuse. First two arguments are same as in preceding function. */
rtx
-assign_stack_temp (enum machine_mode mode, HOST_WIDE_INT size, int keep)
+assign_stack_temp (enum machine_mode mode, HOST_WIDE_INT size)
{
- return assign_stack_temp_for_type (mode, size, keep, NULL_TREE);
+ return assign_stack_temp_for_type (mode, size, NULL_TREE);
}
/* Assign a temporary.
If TYPE_OR_DECL is a decl, then we are doing it on behalf of the decl
and so that should be used in error messages. In either case, we
allocate of the given type.
- KEEP is as for assign_stack_temp.
MEMORY_REQUIRED is 1 if the result must be addressable stack memory;
it is 0 if a register is OK.
DONT_PROMOTE is 1 if we should not promote values in register
to wider modes. */
rtx
-assign_temp (tree type_or_decl, int keep, int memory_required,
+assign_temp (tree type_or_decl, int memory_required,
int dont_promote ATTRIBUTE_UNUSED)
{
tree type, decl;
@@ -1011,7 +990,7 @@ assign_temp (tree type_or_decl, int keep, int memory_required,
size = 1;
}
- tmp = assign_stack_temp_for_type (mode, size, keep, type);
+ tmp = assign_stack_temp_for_type (mode, size, type);
return tmp;
}
@@ -1139,32 +1118,10 @@ update_temp_slot_address (rtx old_rtx, rtx new_rtx)
insert_temp_slot_address (new_rtx, p);
}
-/* If X could be a reference to a temporary slot, mark the fact that its
- address was taken. */
-
-void
-mark_temp_addr_taken (rtx x)
-{
- struct temp_slot *p;
-
- if (x == 0)
- return;
-
- /* If X is not in memory or is at a constant address, it cannot be in
- a temporary slot. */
- if (!MEM_P (x) || CONSTANT_P (XEXP (x, 0)))
- return;
-
- p = find_temp_slot_from_address (XEXP (x, 0));
- if (p != 0)
- p->addr_taken = 1;
-}
-
/* If X could be a reference to a temporary slot, mark that slot as
belonging to the to one level higher than the current level. If X
matched one of our slots, just mark that one. Otherwise, we can't
- easily predict which it is, so upgrade all of them. Kept slots
- need not be touched.
+ easily predict which it is, so upgrade all of them.
This is called when an ({...}) construct occurs and a statement
returns a value in memory. */
@@ -1174,43 +1131,18 @@ preserve_temp_slots (rtx x)
{
struct temp_slot *p = 0, *next;
- /* If there is no result, we still might have some objects whose address
- were taken, so we need to make sure they stay around. */
if (x == 0)
- {
- for (p = *temp_slots_at_level (temp_slot_level); p; p = next)
- {
- next = p->next;
-
- if (p->addr_taken)
- move_slot_to_level (p, temp_slot_level - 1);
- }
-
- return;
- }
+ return;
/* If X is a register that is being used as a pointer, see if we have
- a temporary slot we know it points to. To be consistent with
- the code below, we really should preserve all non-kept slots
- if we can't find a match, but that seems to be much too costly. */
+ a temporary slot we know it points to. */
if (REG_P (x) && REG_POINTER (x))
p = find_temp_slot_from_address (x);
/* If X is not in memory or is at a constant address, it cannot be in
- a temporary slot, but it can contain something whose address was
- taken. */
+ a temporary slot. */
if (p == 0 && (!MEM_P (x) || CONSTANT_P (XEXP (x, 0))))
- {
- for (p = *temp_slots_at_level (temp_slot_level); p; p = next)
- {
- next = p->next;
-
- if (p->addr_taken)
- move_slot_to_level (p, temp_slot_level - 1);
- }
-
- return;
- }
+ return;
/* First see if we can find a match. */
if (p == 0)
@@ -1218,23 +1150,8 @@ preserve_temp_slots (rtx x)
if (p != 0)
{
- /* Move everything at our level whose address was taken to our new
- level in case we used its address. */
- struct temp_slot *q;
-
if (p->level == temp_slot_level)
- {
- for (q = *temp_slots_at_level (temp_slot_level); q; q = next)
- {
- next = q->next;
-
- if (p != q && q->addr_taken)
- move_slot_to_level (q, temp_slot_level - 1);
- }
-
- move_slot_to_level (p, temp_slot_level - 1);
- p->addr_taken = 0;
- }
+ move_slot_to_level (p, temp_slot_level - 1);
return;
}
@@ -1242,9 +1159,7 @@ preserve_temp_slots (rtx x)
for (p = *temp_slots_at_level (temp_slot_level); p; p = next)
{
next = p->next;
-
- if (!p->keep)
- move_slot_to_level (p, temp_slot_level - 1);
+ move_slot_to_level (p, temp_slot_level - 1);
}
}
@@ -1260,12 +1175,8 @@ free_temp_slots (void)
for (p = *temp_slots_at_level (temp_slot_level); p; p = next)
{
next = p->next;
-
- if (!p->keep)
- {
- make_slot_available (p);
- some_available = true;
- }
+ make_slot_available (p);
+ some_available = true;
}
if (some_available)
@@ -1289,22 +1200,7 @@ push_temp_slots (void)
void
pop_temp_slots (void)
{
- struct temp_slot *p, *next;
- bool some_available = false;
-
- for (p = *temp_slots_at_level (temp_slot_level); p; p = next)
- {
- next = p->next;
- make_slot_available (p);
- some_available = true;
- }
-
- if (some_available)
- {
- remove_unused_temp_slot_addresses ();
- combine_temp_slots ();
- }
-
+ free_temp_slots ();
temp_slot_level--;
}