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: mips address splitting breaks named section support


I don't believe that this is an appropriate patch.  .sdata is a special
section name.  It is one of the predefined sections, and it is one that is
accessed via the GP register.  However, most sections are not accessed via
the GP register.  No user named section for instance will be accessed via the
GP register.  Hence we shouldn't be disabling address splitting for any
variable that has a section attribute.  Rather we should determine which
predefined sections are accessed off the GP, check for those section names,
and if it is one of them, then we set SYMBOL_REF_FLAG for that variable.

This change incidentally may result in poorly optimized code for variables
assigned to non-GP sections.  This is because we also use SYMBOL_REF_FLAG
for some optimizations.  Note that mips_address_cost depends on whether
SYMBOL_REF_FLAG is set, since normal addresses take two instructions to
load from, but a GP relative address can always be accessed in a single
instruction.

There is also code in simple_memory_operand that uses SYMBOL_REF_FLAG, but
it was ifdefed out a long time ago because of a bug, and never reenabled.
If this code was reenabled, then we would get incorrect code for any variable
that had SYMBOL_REF_FLAG set but was not in a GP accessed section.  This
is because we would think that a load could go in a delay slot because it
was a single instruction, which is not true if the variable is not accessed
off the GP.

Jim


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