Patch to let alias analysis know about stack and frame pointer..
Richard Henderson
rth@cygnus.com
Sat Jul 31 22:30:00 GMT 1999
On Sun, Jul 11, 1999 at 10:49:05PM +0200, Jan Hubicka wrote:
> OK. Let consider following:
> test(int a, int b)
> {
> asm("":::"bx");
> return a+b;
> }
The problem is that init_alias_analysis can't handle the prologue
and epilogue as rtl.
We begin by setting up the initial base values just fine --
new_reg_base_value[FRAME_POINTER_REGNUM]
= gen_rtx_ADDRESS (Pmode, frame_pointer_rtx);
But then later when we see any one of
(insn/f:TI 29 27 4 (set (reg:SI 6 ebp)
(reg:SI 7 esp)) 36 {*movsi_2}
(nil))
(insn:TI 34 33 14 (parallel[
(set (reg:SI 7 esp)
(reg:SI 6 ebp))
(set (reg:SI 6 ebp)
(reg:SI 6 ebp))
] ) 476 {epilogue_deallocate_stack}
(nil))
(insn:TI 35 14 16 (parallel[
(set (reg:SI 6 ebp)
(mem:SI (reg:SI 7 esp) 0))
(set (reg:SI 7 esp)
(plus:SI (reg:SI 7 esp)
(const_int 4 [0x4])))
] ) 34 {popsi1}
(nil))
and record_set decides we have a non-constant pointer value and
clears the initial base value we set up.
One solution is to simply ignore prologue and epilogue insns in
init_alias_analysis. We'll still get the right dependancies in
the scans in sched_analyze_insn and friends.
r~
PS. Oops, forgot the prototype.
* function.c (prologue_epilogue_contains): New function.
* alias.c (init_alias_analysis): Use it to ignore these sequences.
Index: function.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/function.c,v
retrieving revision 1.91
diff -c -p -d -r1.91 function.c
*** function.c 1999/05/20 22:22:34 1.91
--- function.c 1999/07/11 21:35:15
*************** contains (insn, vec)
*** 6684,6689 ****
--- 6684,6700 ----
}
return 0;
}
+
+ int
+ prologue_epilogue_contains (insn)
+ rtx insn;
+ {
+ if (prologue && contains (insn, prologue))
+ return 1;
+ if (epilogue && contains (insn, epilogue))
+ return 1;
+ return 0;
+ }
#endif /* HAVE_prologue || HAVE_epilogue */
/* Generate the prologue and epilogue RTL if the machine supports it. Thread
Index: alias.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/alias.c,v
retrieving revision 1.53
diff -c -p -d -r1.53 alias.c
*** alias.c 1999/05/30 23:51:39 1.53
--- alias.c 1999/07/11 21:35:15
*************** init_alias_analysis ()
*** 1468,1473 ****
--- 1468,1475 ----
/* Walk the insns adding values to the new_reg_base_value array. */
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{
+ if (prologue_epilogue_contains (insn))
+ continue;
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
{
rtx note, set;
More information about the Gcc-patches
mailing list