This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: arm-elf bad code generation
- To: Philip Blundell <pb at labs dot futuretv dot com>
- Subject: Re: arm-elf bad code generation
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Wed, 23 Aug 2000 16:20:15 +0100
- Cc: nickc at cygnus dot com, gcc-bugs at gcc dot gnu dot org
- Cc: rearnsha at arm dot com
- Organization: ARM Ltd.
- Reply-To: rearnsha at arm dot com
> In message <200008221508.QAA11498@cam-mail2.cambridge.arm.com>, Richard Earnsha
> w writes:
> >Hmm, arm_expand_prologue inserts the following CLOBBER which is supposed
> >to prevent moves across this point. The question is, why doesn't it?
> >Maybe it's an alias set problem, but I don't know the details of how that
> >works.
>
> Well, the CLOBBER certainly does get generated. In the .21.ce2 dump I see:
>
> (insn/f 440 438 441 (set (reg:SI 13 sp)
> (plus:SI (reg:SI 13 sp)
> (const_int -32 [0xffffffe0]))) -1 (nil)
> (nil))
>
> (insn 441 440 442 (clobber (mem:BLK (reg:SI 13 sp) 0)) -1 (nil)
> (nil))
It seems that the alias analysis code thinks that it isn't possible for
the stack and frame to be aliased, so it blithely ignores the current
clobber instruction. I've rewritten the code to make it more explicit
that the clobber is relevant to both the stack adjustment insn and
frame-pointer stores. Your code now looks to be compiling correctly.
2000-08-23 Richard Earnshaw (rearnsha@arm.com)
* arm.c (arm_expand_prologue): Ensure that the stack-adjustment
barrier can't be ignored by the alias analysis code.
Index: arm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/arm/arm.c,v
retrieving revision 1.101
diff -p -r1.101 arm.c
*** arm.c 2000/08/15 15:14:06 1.101
--- arm.c 2000/08/23 15:09:35
*************** arm_expand_prologue ()
*** 7430,7437 ****
insn = emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
amount));
RTX_FRAME_RELATED_P (insn) = 1;
! emit_insn (gen_rtx_CLOBBER (VOIDmode,
! gen_rtx_MEM (BLKmode, stack_pointer_rtx)));
}
/* If we are profiling, make sure no instructions are scheduled before
--- 7430,7448 ----
insn = emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
amount));
RTX_FRAME_RELATED_P (insn) = 1;
!
! /* If the frame pointer is needed, emit a special barrier that
! will prevent the scheduler from moving stores to the frame
! before the stack adjustment. */
! if (frame_pointer_needed)
! {
! rtx unspec = gen_rtx_UNSPEC (SImode,
! gen_rtvec (2, stack_pointer_rtx,
! hard_frame_pointer_rtx), 4);
!
! emit_insn (gen_rtx_CLOBBER (VOIDmode,
! gen_rtx_MEM (BLKmode, unspec)));
! }
}
/* If we are profiling, make sure no instructions are scheduled before