This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[repost] Patch: PR 4763, 4529, others (-fomit-frame-pointer)



Reference: PR 4763, 4529

May Also Fix: PR 4759, 4596, 4048, others

----------------------------------------------------

ChangeLog:

2001-11-10  Brad Kaiser  <bkaiser@acelink.net>

        * reload1.c (elimination_effects): Change test from CONSTANT_P()
          to function_invariant_p() to keep the argp->stack_ptr elimination
          alive, and prevent bad asm code and ICE's using -fomit-frame-pointer

----------------------------------------------------

Discussion and Rationale:

The invalid assembly code generated with -fomit-frame-pointer set occurs
when the "argp" to "hard stack ptr" register elimination is wrongly
marked invalid.  This occurs because the compiler believes 'argp'
to have been used in a non-"mem" context, which does not seem
correct, since it is just a constant offset from another register.

Replacing the 'CONSTANT_P' test with the less restrictive
'function_invariant_p' avoids the 'elimination_effects()' call
that causes 'argp' to be wrongly marked as "referenced outside mem",
thus keeping the "argp->sp" elimination alive without, I hope,
introducing any other bugs.

Brad Kaiser
(bkaiser@acelink.net)

----------------- patch follows ---------------------------
*** gcc-3.0.2/gcc/reload1.c	Thu Nov  1 22:36:49 2001
--- gcc-3.0.2p1/gcc/reload1.c	Fri Nov  2 10:46:32 2001
*************** elimination_effects (x, mem_mode)
*** 2714,2720 ****
  	}
        else if (reg_renumber[regno] < 0 && reg_equiv_constant
  	       && reg_equiv_constant[regno]
! 	       && ! CONSTANT_P (reg_equiv_constant[regno]))
  	elimination_effects (reg_equiv_constant[regno], mem_mode);
        return;
  
--- 2714,2720 ----
  	}
        else if (reg_renumber[regno] < 0 && reg_equiv_constant
  	       && reg_equiv_constant[regno]
! 	       && ! function_invariant_p (reg_equiv_constant[regno]))
  	elimination_effects (reg_equiv_constant[regno], mem_mode);
        return;
----------------- end of patch ----------------------------  



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]