Re: Question on gcc RTL and scheduling step.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Segher,

- Yes, DImode is a two register mode in my backend.
/static int hard_regno_nregs_internal(int regno, enum machine_mode mod)
{
...
//return (GET_MODE_SIZE (mode) + reg_size - 1) / reg_size;//
}
/- In the example, file "use_manyregs.c.299r.sched2, line 95, I find:

;; *      11--> b  0: i  44 {{%r31=%r31+0x18;%r0=[%r31+0x10];%r18=[%r31+0x8];clobber %r1;clobber %r19;};pc=return;}:LDST**
*
(This is the 'patched' version - I added the 'clobber' statements.)
In the same file, the RTL I emitted:

***(insn:TI 44 27 28 2 (parallel [
            (parallel [
                    (set (reg/f:SI 31 %r31)
                        (plus:SI (reg/f:SI 31 %r31)
                            (const_int 24 [0x18])))
                    (set (reg:DI 0 %r0)
                        (mem/c:DI (plus:SI (reg/f:SI 31 %r31)
                                (const_int 16 [0x10])) [2  S8 A64]))
                    (set (reg:DI 18 %r18)
                        (mem/c:DI (plus:SI (reg/f:SI 31 %r31)
                                (const_int 8 [0x8])) [2  S8 A64]))
                    (clobber:SI (reg:DI 1 %r1))
                    (clobber:SI (reg:DI 19 %r19))
                ])
            (set (pc)
                (return))

*Note that, the statement on line 95 does not contain the mode the register is used in. The result of this, is that the scheduler cannot find the operation on R18 also clobbers R19. In my opinion, this is wrong, as the function /hard_regno_nregs()/ is correctly defined.
Anyway, the addition of the "clobber" statements fix it.
On the (set (pc) (return)) and (return) statements, I think you are right. I mean, the use of (return) leads to the double "parallel" statement in the RTL. (With (set (pc) (return))
there is only one "parallel", and then the tool misunderstands.)

Best Regards,

Henri.
*
*


On 02/26/2020 05:38 PM, Segher Boessenkool wrote:
[ Top-post do please not. ]

On Wed, Feb 26, 2020 at 04:11:06PM +0100, Henri Cloetens wrote:
- On the issue of the restore of R18 in mode DI, it seems from
   analysing the log file that the compiler does not understand this
   also affects R19. This looks a bug to me ??. Anyway, I have resolved
   this, by adding a 'clobber' statement to R19 when R18 is written
   in mode 'DI'.
You haven't showed any evidence like this, so it's hard for use to help
you with this at all.  *Is* DImode a two register mode in your backend?

- The other issue, I have changed ((set) (pc) (return)) to (return),
   but, as far as I understand the logfiles, and the documentation,
   both forms are equivalent. Anyway, after fixing the first issue, I do
   not see the second issue any more.
The docs say
   Note that an insn pattern of @code{(return)} is logically equivalent to
   @code{(set (pc) (return))}, but the latter form is never used.

If something is never used, then not everything might expect that form,
that's all.


Segher





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux