This is the mail archive of the gcc-help@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]

PowerPC, small data operands and section names


Dear GCC experts:

Currently, in the gcc-3.x.x file gcc/config/rs6000/rs6000.c, with
-msdata=sysv
or -msdata=eabi, the compiler allocates the small objects of static
storage
duration (global variables) to loader sections .sbss, .sdata, .sbss2,
.sdata2.
The size threshold is specified with the -G compiler option.

In addition to section allocation, the compiler uses efficient load and
store
instruction sequences (with the @sda21 or @sdarel operand relocation
modifiers)
for these small objects. The maximum displacement is 32K from symbols
_SDA_BASE... This is part of the PowerPC (E)ABI specifications.

Here is an improvement suggestion: I would like the compiler to base its

decision about efficient instructions on the actual object section, not
on the
size of small objects.

When small objects are explicitly allocated to named sections (e.g. in a

peripheral memory section), the linker may complain that the @sda21 or
@sdarel
relocation modifiers are not within the 32KB limit. The suggestion would
fix
this.

In addition, this would give the programmer greater control over which
objects
are accessed efficiently.

I identified the function small_data_operand in the file
gcc/config/rs6000/rs6000.c as the decision to use the @sda21 or @sdarel
relocation modifiers (other uses of the variable g_switch_value is where
the
section allocation decision is made). I don't understand how the RTL
data (type
rtx) manipulated when emitting assembler instructions is related to the
"tree"
type used when allocating data declarations to sections.

Main Question: Is there a way to retrieve the "tree" of a symbol from
the "rtx"
of the load/store instruction? From this, It should then be possible to
base the
decision in small_data_operand on section information rather than on the
size
information.

Basically, the PowerPC (E)ABI reserves the %r2 and/or  %r13 registers
for
"system" use. The above suggestion would give the embedded developer
greater
freedom and control over their use.

Many thanks for your attention.


--

- Thierry Moreau

CONNOTECH Experts-conseils inc.
9130 Place de Montgolfier
Montreal, Qc
H2M 2A1

Tel.: (514)385-5691
Fax:  (514)385-5900

e-mail: thierry.moreau@connotech.com



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