Ross Ridge wrote:
   You won't be able to.  You're going to need to write your own code that,
   during the conversion of the tree to RTL, creates RTL expressions which
   indicate that the memory references use segment registers.  This probably
   won't be easy since there are a lot of contexts where your "far" pointer
   can be used.  I suspect this is where you're going to give up on your
   project, but if you do then RTL expressions you'll need to create should
   probably look like:


   (mem:SI (plus:SI (unspec:SI [(reg:HI fs)] SEGREF) (reg:SI var)))


   After getting GCC to generate expressions like these, then it's a
   realtively simple case of modifying ix86_decompose_address() to handle
   the unspec.  You might also need to change other backend code for
   handling addresses.

   Ross Ridge

Hi,
if I understand well, to make gcc generating rtx according to an
__attribute__((far("fs")))
on a pointer I only have to add or modify rtx in the i386.md file and
add an UNSPEC among the constants ?
Actually, it is not specifically for this attribute but more to
understand how does gcc manage attributes internally.

What I understand is that there is two kind of managment for attribute :
- The attribute is handled before the tree -> rtl conversion so some
code has to be added
  in the C source code and this code removes the attribute from the
tree once it has
  finished its job.
- the attribute is handled during the tree -> rtl conversion so some
code is added in the .md
  file and gcc consider the attribute node of the tree as an UNSPEC rtx class.
  After what it looks for an rtx pattern which match with this UNSPEC.
  Therefore, I can consider the following relationship:

  (mem:SI (plus:SI (unspec:SI [(reg:HI fs)] SEGREF) (reg:SI var)))
       |                           |                    |
              |
      \/                          \/                   \/
             \/
      int *                 __attribute__((far("fs")))                      p;

If these are right, I have some questions:
- does (reg:HI fs) care about the type of the parameter fs ? (a
string in the C code)
- how does gcc recognize such an expression ? I mean (reg:SI var) is
a register in SImode
  but there is no indication about the storage of p in the C souce.
Does it begin by
  identifying that the pattern matches the unspec and then try to put
p in a register as
  written in the pattern?

Thanks for your help.
Have a great day.


--
Rémy Saissy            JabberID: [EMAIL PROTECTED]
                               Web:     http://remysaissy.free.fr
"L'homme qui a le plus vécu n'est pas celui qui a compté le plus d'années,
mais celui qui a le plus senti la vie."
J.-J. Rousseau, Emile.

Reply via email to