This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to detect constant functions (version 2)
- To: John Wehle <john at feith dot com>
- Subject: Re: Patch to detect constant functions (version 2)
- From: Richard Henderson <rth at cygnus dot com>
- Date: Wed, 18 Aug 1999 10:11:15 -0700
- Cc: gcc-patches at gcc dot gnu dot org
- References: <199908181700.NAA14497@jwlab.FEITH.COM>
On Wed, Aug 18, 1999 at 01:00:42PM -0400, John Wehle wrote:
> + case SUBREG:
> + /* Global registers are not local. */
> + if (GET_CODE (SUBREG_REG (x)) == REG
> + && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
> + && global_regs[REGNO (SUBREG_REG (x)) + SUBREG_WORD (x)])
> + return 1;
> + return 0;
Still not right for (subreg:QI (mem:SI (symbol_ref:SI "foo"))).
> + if (TREE_READONLY (current_function_decl)
> + || TREE_THIS_VOLATILE (current_function_decl)
> + || TYPE_MODE (TREE_TYPE (current_function_decl)) == VOIDmode)
> + return;
Something that Jeff mentioned last night is that non-static functions
in shared libraries may be overridden. How to designate that you're
building for a shared library (or on a system that doesn't override
symbols) is something that will need consider. Most of the time it is
with -fpic, but there are exceptions -- hp/ux and aix come to mind.
In the mean time, we can only do this for static functions.
r~