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]

Re: Patch to detect constant functions (version 2)


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~


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