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]

[named address] ice-on-valid: in postreload.c:reload_cse_simplify_operands


Trying to make named address space support work for target AVR,
I am facing the following problem:

For generic AS, there are three valid base pointer registers
X , Y and Z.

For the new __pgm AS, only Z is available without offset.

The problem is now that addresses.h:base_reg_class() does not
pass down AS information, i.e. addr_space_t down to target hook
MODE_CODE_BASE_REG_CLASS.

Likewise for REGNO_MODE_CODE_OK_FOR_BASE_P.

The MODE argument that both of these get describe the mode of
the MEM but not the mode associated with the AS.

Thus, it is not possible to provide proper implementations of
these hooks.  IRA/reload choses the wrong hard register so
that in postreload no constraints match, i.e.
TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P returns wrong for that
hard register (which is right) so that postreload busts.

I'd just like to reassure me that I didn't do something fundamentally
wrong and named address space support if not yet smoothly supported
in GCC.

FYI, the C source is

int read_from_pgm_2 (int * const __pgm * const addr)
{
    return **addr;
}

===== Prior to reload: PHI is attached to __pgm, i.e. AS1, looks fine:

(insn 2 4 3 2 (set (reg/v/f:PHI 45 [ addr ])
        (reg:PHI 24 r24 [ addr ])) pgm.c:42 8 {*movphi}
     (nil))

(note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)

(insn 6 3 7 2 (set (reg/f:HI 47 [ *addr_1(D) ])
        (mem/f:HI (reg/v/f:PHI 45 [ addr ]) [2 *addr_1(D)+0 S2 A8 AS1])) pgm.c:43 7 {*movhi}
     (expr_list:REG_DEAD (reg/v/f:PHI 45 [ addr ])
        (nil)))

(note 7 6 12 2 NOTE_INSN_DELETED)

(insn 12 7 15 2 (set (reg/i:HI 24 r24)
        (mem:HI (reg/f:HI 47 [ *addr_1(D) ]) [3 *D.1949_2+0 S2 A8])) pgm.c:44 7 {*movhi}
     (expr_list:REG_DEAD (reg/f:HI 47 [ *addr_1(D) ])
        (nil)))

(insn 15 12 0 2 (use (reg/i:HI 24 r24)) pgm.c:44 -1
     (nil))


===== After reload

(insn 20 3 6 2 (set (reg:PHI 26 r26)
        (reg/v/f:PHI 24 r24 [orig:45 addr ] [45])) pgm.c:43 8 {*movphi}
     (nil))

(insn 6 20 7 2 (set (reg/f:HI 30 r30 [orig:47 *addr_1(D) ] [47])
        (mem/f:HI (reg:PHI 26 r26) [2 *addr_1(D)+0 S2 A8 AS1])) pgm.c:43 7 {*movhi}
     (nil))

(note 7 6 12 2 NOTE_INSN_DELETED)

(insn 12 7 15 2 (set (reg/i:HI 24 r24)
        (mem:HI (reg/f:HI 30 r30 [orig:47 *addr_1(D) ] [47]) [3 *D.1949_2+0 S2 A8])) pgm.c:44 7 {*movhi}
     (nil))

(insn 15 12 18 2 (use (reg/i:HI 24 r24)) pgm.c:44 -1
     (nil))

The register names are (X=r26, invalid to load from AS1 in insn 6).

Johann


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