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


On 5/15/06, Rask Ingemann Lambertsen <rask@sygehus.dk> wrote:
On Mon, May 15, 2006 at 12:09:00AM +0800, RÃmy Saissy wrote:
> To manage the manipulation of the register class, I added entries in
> the i386.md file.
>
> ;; get a value from a segment register.
> (define_insn "store_seg"
>  [(set (match_operand:SI 0 "nonimmediate_operand" "")
>        (match_operand:SI 1 "general_operand" "s"))]
>        ""
>        "movl\t%1,%0")

Operand 0 should have a constraint of "=rm" or so. Operand 1 should have a
predicate of "register_operand".

> ;; set a value in a segment register.
> (define_insn "load_seg"
>  [(set (match_operand:SI 0 "general_operand" "=s")
>        (match_operand:SI 1 "register_operand" ""))]
>        ""
>        "movl\t%1,%0")

Operand 1 should have a predicate of "nonimmediate_operand" and a constraint
of "rm".

Also, aren't the segment registers HImode registers? Above, you wrote:

>    register short a __asm__ ("es");
              ^^^^^
And have you adjusted HARD_REGNO_MODE_OK() and HARD_REGNO_NREGS() accordingly?

Thank you for your suggestions, I have fixed it and modified the
HARD_REGNO_MODE_OK() and HARD_REGNO_NREGS() as you told me.
However, the compilation of gcc still fails but with another error:
../.././gcc/libgcc2.c:1477: error: unable to generate reloads for:
(insn 61 60 62 1 ../.././gcc/libgcc2.c:1475 (set (reg:HI 0 ax [70])
       (mem/c:HI (plus:SI (reg/f:SI 6 bp)
               (const_int -2 [0xfffffffe])) [0 S2 A8])) 29 {load_seg} (nil)
   (nil))
../.././gcc/libgcc2.c:1477: internal compiler error: in find_reloads,
at reload.c:3734
Please submit a full bug report,

If I'm not wrong, this is when the compiler compiles itself with a
freshly generated binary.
Since I don't want to let the register allocator decide by itself
which segment register to use
(there is no need of it in fact), I tried to set the entries in
FIXED_REGISTERS to 0 instead of 1 but I still get the error.
I think it is not normal to have this error since no code use the 's'
__asm__() in gcc source and since the segment registers are in a
different class but I don't really know how to fix it.
What should I modify in the i386.{c,h,md}?
Thank you very much.


-- RÃmy Saissy JabberID: remy.saissy@jabber.fr 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.

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