This is the mail archive of the 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: Segment registers support for i386

Ross Ridge wrote:
Remy Saissy wrote:

What I understand is that there is two kind of managment for attribute :

Attributes are handled in various different ways depending on what the
attribute does.  To handle your case correctly, you'ld have to change how
the tree to RTL conversion generates RTL addresses expressions whenever
a pointer with the "far" attribute is dereferenced.  This is probably
going to be a lot work.

I've looked for a target specific callback to modify but I've found nothing, even in the gcc internals info pages. Do you mean I would have to modify some code outside of the i386 directory ? Or maybe to add such a callback if it doesn't exist ;) In which file does the tree to RTL conversion code is located ?

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;

No, that's not what the RTL expression represents.  Declarations aren't
represented in RTL.  The example RTL expression I gave is just an
expression, not a full RTL instruction.  It's something that could be
used as the memory operand of an instruction.  The RTL expression I gave
would correspond to a C expression (not a statement) like this:

*(int * __atribute__((far("fs")))) var

Ok, I thanks for the precisions :)

does (reg:HI fs) care about the type of the parameter fs ?

See the GCC Internals documentation.  In my example, since I don't know
what the actual hard register number you assigned to the FS segment
register, I just put "fs" in the place where the actual register number
would appear.  Similarily, the "var" in  "(reg:SI var)" represents
the number of the pseudo-register GCC would allocate for an automatic
variable named "var".

Does it mean that an RTL expression which use reg: force gcc to use a particular pseudo register ? Is there something I should care about when I choose the number of this pseudo register ?

how does gcc recognize such an expression ?

Since this expression is a memory operand, it's recognized by the
GO_IF_LEGITIMATE_ADDRESS() macro.  In the i386 port, that's implemented
by legitimate_address_p() in "i386.c".

Ok thank you very much.

Ross Ridge

RÃmy Saissy            JabberID:
"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.

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