[gnu.gcc.bug] follow up

adam@UUNET.UU.NET (Adam R de Boor) (11/12/88)

having looked at it (the structure passing bug mentioned in my second letter of 
the day) some more, there appear to be two problems in the reloading
phase.

	1) why is pseudoreg 56 assigned to d0 when it can more profitably be
	   assigned to some register that isn't trashed across a call? As
	   a corollary, why doesn't the code realize d0 has been trashed?
	   I'm using an unmodified tm-m68k.c, which states d0 is hosed
	   on a call.
	2) why once it decides the two expressions are the same and substitutes
	   (reg:SI 0) for (plus:SI (reg:SI 14) (const_int -12)) in both
	   places, does it insist on adding (reg:SI 14) in the second
	   instance?

An interesting thing is that when the passes in reload() to find spill
registers are complete, n_spills is 1, as is spill_reg[0] (I believe that's
the name), even though d1 is never used.


The rtl produced after the reload pass by my version is:

;; Function main

;; Register dispositions: 56 in 0 

;; Hard regs used:  0 9 14

(note 1 0 2 ("q.c") 4)

(note 2 1 3 "" -1)

(note 3 2 4 "" -2)

(note 4 3 5 ("q.c") 6)

(note 5 4 6 "" -4)

(code_label 6 5 7 2)

(note 7 6 8 "" -1)

(note 8 7 29 ("q.c") 7)

;; Why not calculate into (reg:SI 9) here?
;; (set (reg:SI 9) (reg:SI 14)) 
;; (set (reg:SI 9) (plus:SI (reg:SI 9) (const_int -12)))
;; would seem a more reasonable encoding.
;;	-- ardeb
(insn 29 8 9 (set (reg:SI 0)
       (const_int -12)) -1 (nil)
   (nil))

(insn:QI 9 29 10 (set (reg:SI 0)
       (plus:SI (reg:SI 0)
           (reg:SI 14))) 81 (nil)
   (nil))

(insn 10 9 11 (set (reg:SI 9)
       (reg:SI 0)) 33 (nil)
   (nil))

(insn 11 10 12 (use (reg:SI 9)) -1 (nil)
   (nil))

;; (reg:SI 0) trashed here
(call_insn 12 11 13 (call (mem:QI (symbol_ref:SI ("foop")))
       (const_int 0)) 246 (nil)
   (nil))

(note 13 12 14 ("q.c") 8)

(insn 14 13 15 (set (cc0)
       (mem/s:SI (plus:SI (reg:SI 0)
               (reg:SI 14)))) 2 (nil)
   (nil))

(jump_insn 15 14 16 (set (pc)
       (if_then_else (eq (cc0)
               (const_int 0))
           (pc)
           (label_ref 20))) 228 (nil)
   (nil))

(note 16 15 17 "" -1)

(note 17 16 18 ("q.c") 9)

(jump_insn 18 17 19 (set (pc)
       (label_ref 24)) 242 (nil)
   (nil))

(barrier 19 18 20)

(code_label 20 19 21 4)

(jump_insn 21 20 22 (set (pc)
       (label_ref 6)) 242 (nil)
   (nil))

(barrier 22 21 23)

(note 23 22 24 "" -5)

(code_label 24 23 25 3)

(note 25 24 26 "" -3)

(note 26 25 27 "" -6)

(note 27 26 28 ("q.c") 12)

(code_label 28 27 0 1)


--------------------------------------------------

The rtl from which this is generated is:


;; Function main

57 registers.

Register 56 used 2 times across 0 insns.

0 basic blocks.

;; Register 56 in 0.
(note 1 0 2 "" -1)

(note 2 1 3 "" -2)

(note 3 2 4 "" -4)

(code_label 4 3 5 2)

(note 5 4 6 "" -1)

(insn 6 5 7 (set (reg:SI 56)
       (plus:SI (reg:SI 14)
           (const_int -12))) 81 (nil)
   (nil))

(insn 7 6 8 (set (reg:SI 9)
       (reg:SI 56)) 33 (nil)
   (nil))

(insn 8 7 9 (use (reg:SI 9)) -1 (nil)
   (nil))

(call_insn 9 8 10 (call (mem:QI (symbol_ref:SI ("foop")))
       (const_int 0)) 246 (nil)
   (nil))

(insn 10 9 11 (set (cc0)
       (mem/s:SI (plus:SI (reg:SI 14)
               (const_int -12)))) 2 (nil)
   (nil))

(jump_insn 11 10 12 (set (pc)
       (if_then_else (eq (cc0)
               (const_int 0))
           (pc)
           (label_ref 15))) 228 (nil)
   (nil))

(note 12 11 13 "" -1)

(jump_insn 13 12 14 (set (pc)
       (label_ref 19)) 242 (nil)
   (nil))

(barrier 14 13 15)

(code_label 15 14 16 4)

(jump_insn 16 15 17 (set (pc)
       (label_ref 4)) 242 (nil)
   (nil))

(barrier 17 16 18)

(note 18 17 19 "" -5)

(code_label 19 18 20 3)

(note 20 19 21 "" -3)

(note 21 20 22 "" -6)

(code_label 22 21 0 1)

--------------------------------------------------
I will look at it some more tomorrow.

a