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]

Re: sh symbol_ref_flags usage


On Apr 17, 2003, Richard Henderson <rth at twiddle dot net> wrote:

>         * config/sh/sh.c (gen_datalabel_ref): Don't add
>         SH_DATALABEL_ENCODING.

Hmm...  I don't think it's really that simple.  The same symbol may be
referenced using both DATALABEL and non-DATALABEL references.  See,
for example, the casesi pattern:

      emit_move_insn (reg3, gen_datalabel_ref (gen_rtx_LABEL_REF
					       (DImode, operands[3])));
      emit_insn (gen_casesi_load_media (reg4, reg3, reg2, operands[3]));

It is essential that the label is referenced with DATALABEL in the
first case, and without in the second.

Similarly, other labels must be referenced using DATALABEL when
loading constants from them (SHcompact constant pool), but not when
initializing branch-target addresses with them (SHmedia PT
instruction).  I don't see that using something as simple as
SYMBOL_REF_FUNCTION_P can accomplish this.

We probably need some machine-specific flag in the symbol reference to
tell how the symbol is being referenced.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer


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