mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-17 06:08:54 +08:00
builtins.c (expand_builtin_alloca): allocate_dynamic_stack_space returns Pmode pseudo, but we need ptr_mode.
* builtins.c (expand_builtin_alloca): allocate_dynamic_stack_space returns Pmode pseudo, but we need ptr_mode. * explow.c (allocate_dynamic_stack_space): Use plus_constant. Remove bogus conversions; use HOST_WIDE_INT for size. Don't use TARGET if wrong mode. From-SVN: r39390
This commit is contained in:
parent
fcbfaa65a5
commit
d54571406e
@ -1,5 +1,11 @@
|
|||||||
Thu Feb 1 07:22:41 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
Thu Feb 1 07:22:41 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||||
|
|
||||||
|
* builtins.c (expand_builtin_alloca): allocate_dynamic_stack_space
|
||||||
|
returns Pmode pseudo, but we need ptr_mode.
|
||||||
|
* explow.c (allocate_dynamic_stack_space): Use plus_constant.
|
||||||
|
Remove bogus conversions; use HOST_WIDE_INT for size.
|
||||||
|
Don't use TARGET if wrong mode.
|
||||||
|
|
||||||
* config/i386/i386.c (ix86_compute_frame_size): Allow
|
* config/i386/i386.c (ix86_compute_frame_size): Allow
|
||||||
stack_alignment_needed to be non-default even if size is zero.
|
stack_alignment_needed to be non-default even if size is zero.
|
||||||
|
|
||||||
|
@ -3095,12 +3095,14 @@ expand_builtin_frame_address (exp)
|
|||||||
/* Expand a call to the alloca builtin, with arguments ARGLIST. Return 0 if
|
/* Expand a call to the alloca builtin, with arguments ARGLIST. Return 0 if
|
||||||
we failed and the caller should emit a normal call, otherwise try to get
|
we failed and the caller should emit a normal call, otherwise try to get
|
||||||
the result in TARGET, if convenient. */
|
the result in TARGET, if convenient. */
|
||||||
|
|
||||||
static rtx
|
static rtx
|
||||||
expand_builtin_alloca (arglist, target)
|
expand_builtin_alloca (arglist, target)
|
||||||
tree arglist;
|
tree arglist;
|
||||||
rtx target;
|
rtx target;
|
||||||
{
|
{
|
||||||
rtx op0;
|
rtx op0;
|
||||||
|
rtx result;
|
||||||
|
|
||||||
if (!validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE))
|
if (!validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE))
|
||||||
return 0;
|
return 0;
|
||||||
@ -3109,13 +3111,20 @@ expand_builtin_alloca (arglist, target)
|
|||||||
op0 = expand_expr (TREE_VALUE (arglist), NULL_RTX, VOIDmode, 0);
|
op0 = expand_expr (TREE_VALUE (arglist), NULL_RTX, VOIDmode, 0);
|
||||||
|
|
||||||
/* Allocate the desired space. */
|
/* Allocate the desired space. */
|
||||||
return allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
|
result = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
|
||||||
|
|
||||||
|
#ifdef POINTERS_EXTEND_UNSIGNED
|
||||||
|
result = convert_memory_address (ptr_mode, result);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expand a call to the ffs builtin. The arguments are in ARGLIST.
|
/* Expand a call to the ffs builtin. The arguments are in ARGLIST.
|
||||||
Return 0 if a normal call should be emitted rather than expanding the
|
Return 0 if a normal call should be emitted rather than expanding the
|
||||||
function in-line. If convenient, the result should be placed in TARGET.
|
function in-line. If convenient, the result should be placed in TARGET.
|
||||||
SUBTARGET may be used as the target for computing one of EXP's operands. */
|
SUBTARGET may be used as the target for computing one of EXP's operands. */
|
||||||
|
|
||||||
static rtx
|
static rtx
|
||||||
expand_builtin_ffs (arglist, target, subtarget)
|
expand_builtin_ffs (arglist, target, subtarget)
|
||||||
tree arglist;
|
tree arglist;
|
||||||
@ -3138,6 +3147,7 @@ expand_builtin_ffs (arglist, target, subtarget)
|
|||||||
|
|
||||||
/* If the string passed to fputs is a constant and is one character
|
/* If the string passed to fputs is a constant and is one character
|
||||||
long, we attempt to transform this call into __builtin_fputc(). */
|
long, we attempt to transform this call into __builtin_fputc(). */
|
||||||
|
|
||||||
static rtx
|
static rtx
|
||||||
expand_builtin_fputs (arglist, ignore)
|
expand_builtin_fputs (arglist, ignore)
|
||||||
tree arglist;
|
tree arglist;
|
||||||
|
25
gcc/explow.c
25
gcc/explow.c
@ -1294,15 +1294,10 @@ allocate_dynamic_stack_space (size, target, known_align)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (MUST_ALIGN)
|
if (MUST_ALIGN)
|
||||||
{
|
size
|
||||||
if (GET_CODE (size) == CONST_INT)
|
= force_operand (plus_constant (size,
|
||||||
size = GEN_INT (INTVAL (size)
|
BIGGEST_ALIGNMENT / BITS_PER_UNIT - 1),
|
||||||
+ (BIGGEST_ALIGNMENT / BITS_PER_UNIT - 1));
|
NULL_RTX);
|
||||||
else
|
|
||||||
size = expand_binop (Pmode, add_optab, size,
|
|
||||||
GEN_INT (BIGGEST_ALIGNMENT / BITS_PER_UNIT - 1),
|
|
||||||
NULL_RTX, 1, OPTAB_LIB_WIDEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SETJMP_VIA_SAVE_AREA
|
#ifdef SETJMP_VIA_SAVE_AREA
|
||||||
/* If setjmp restores regs from a save area in the stack frame,
|
/* If setjmp restores regs from a save area in the stack frame,
|
||||||
@ -1325,12 +1320,12 @@ allocate_dynamic_stack_space (size, target, known_align)
|
|||||||
#if !defined(PREFERRED_STACK_BOUNDARY) || !defined(MUST_ALIGN) || (PREFERRED_STACK_BOUNDARY != BIGGEST_ALIGNMENT)
|
#if !defined(PREFERRED_STACK_BOUNDARY) || !defined(MUST_ALIGN) || (PREFERRED_STACK_BOUNDARY != BIGGEST_ALIGNMENT)
|
||||||
/* If anyone creates a target with these characteristics, let them
|
/* If anyone creates a target with these characteristics, let them
|
||||||
know that our optimization cannot work correctly in such a case. */
|
know that our optimization cannot work correctly in such a case. */
|
||||||
abort();
|
abort ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (GET_CODE (size) == CONST_INT)
|
if (GET_CODE (size) == CONST_INT)
|
||||||
{
|
{
|
||||||
int new = INTVAL (size) / align * align;
|
HOST_WIDE_INT new = INTVAL (size) / align * align;
|
||||||
|
|
||||||
if (INTVAL (size) != new)
|
if (INTVAL (size) != new)
|
||||||
setjmpless_size = GEN_INT (new);
|
setjmpless_size = GEN_INT (new);
|
||||||
@ -1395,9 +1390,10 @@ allocate_dynamic_stack_space (size, target, known_align)
|
|||||||
if (flag_stack_check && ! STACK_CHECK_BUILTIN)
|
if (flag_stack_check && ! STACK_CHECK_BUILTIN)
|
||||||
probe_stack_range (STACK_CHECK_MAX_FRAME_SIZE + STACK_CHECK_PROTECT, size);
|
probe_stack_range (STACK_CHECK_MAX_FRAME_SIZE + STACK_CHECK_PROTECT, size);
|
||||||
|
|
||||||
/* Don't use a TARGET that isn't a pseudo. */
|
/* Don't use a TARGET that isn't a pseudo or is the wrong mode. */
|
||||||
if (target == 0 || GET_CODE (target) != REG
|
if (target == 0 || GET_CODE (target) != REG
|
||||||
|| REGNO (target) < FIRST_PSEUDO_REGISTER)
|
|| REGNO (target) < FIRST_PSEUDO_REGISTER
|
||||||
|
|| GET_MODE (target) != Pmode)
|
||||||
target = gen_reg_rtx (Pmode);
|
target = gen_reg_rtx (Pmode);
|
||||||
|
|
||||||
mark_reg_pointer (target, known_align);
|
mark_reg_pointer (target, known_align);
|
||||||
@ -1422,7 +1418,6 @@ allocate_dynamic_stack_space (size, target, known_align)
|
|||||||
if (mode == VOIDmode)
|
if (mode == VOIDmode)
|
||||||
mode = Pmode;
|
mode = Pmode;
|
||||||
|
|
||||||
size = convert_modes (mode, ptr_mode, size, 1);
|
|
||||||
pred = insn_data[(int) CODE_FOR_allocate_stack].operand[1].predicate;
|
pred = insn_data[(int) CODE_FOR_allocate_stack].operand[1].predicate;
|
||||||
if (pred && ! ((*pred) (size, mode)))
|
if (pred && ! ((*pred) (size, mode)))
|
||||||
size = copy_to_mode_reg (mode, size);
|
size = copy_to_mode_reg (mode, size);
|
||||||
@ -1435,7 +1430,6 @@ allocate_dynamic_stack_space (size, target, known_align)
|
|||||||
#ifndef STACK_GROWS_DOWNWARD
|
#ifndef STACK_GROWS_DOWNWARD
|
||||||
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
||||||
#endif
|
#endif
|
||||||
size = convert_modes (Pmode, ptr_mode, size, 1);
|
|
||||||
|
|
||||||
/* Check stack bounds if necessary. */
|
/* Check stack bounds if necessary. */
|
||||||
if (current_function_limit_stack)
|
if (current_function_limit_stack)
|
||||||
@ -1474,6 +1468,7 @@ allocate_dynamic_stack_space (size, target, known_align)
|
|||||||
REG_NOTES (note_target));
|
REG_NOTES (note_target));
|
||||||
}
|
}
|
||||||
#endif /* SETJMP_VIA_SAVE_AREA */
|
#endif /* SETJMP_VIA_SAVE_AREA */
|
||||||
|
|
||||||
#ifdef STACK_GROWS_DOWNWARD
|
#ifdef STACK_GROWS_DOWNWARD
|
||||||
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user