Loading...

gcc@gcc.gnu.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

PR51782: Missing address-space information in .expand Georg-Johann Lay Fri Feb 17 04:00:52 2012

I had a look into this again for the following small C program:

struct rgb { char r; };

char read_bug (const __flash struct rgb *s)
{
    struct rgb t = *s;

    return t.r;
}

char read_ok (const __flash struct rgb *s)
{
    return s->r;
}


compiled as

> avr-gcc flash-move.c -S -Os -dp -fdump-rtl-expand-details

and with the patch applied to tree-pretty-print.c

With that patch .expand dump reads:


read_bug (const struct rgb * s)
{
  char t$r;

  # BLOCK 2 freq:10000
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  t$r_4 = s_1(D){address-space-1 ->}r;
  return t$r_4;
  # SUCC: EXIT [100.0%]
}

;; Generating RTL for gimple basic block 2
;; return t$r_4;

(insn 6 5 7 (set (reg:QI 46)
        (mem:QI (reg/v/f:HI 44 [ s ]) [0 s_1(D){address-space-1 ->}r+0 S1 A8]))
flash-move.c:7 -1
     (nil))
...


which is wrong because in insn 6 there is no "AS1" in the memory attributes.
Just compare with the respective dump of insn 6 of read_ok, which is correct:

(insn 6 5 7 (set (reg:QI 46)
        (mem:QI (reg/v/f:HI 44 [ s ]) [0 s_1(D){address-space-1 ->}r+0 S1 A8
AS1])) flash-move.c:12 -1
     (nil))

Thus, the problem appears to be at a completely different place.
Or the changes to tree-pretty-print just serve to confuse myself...

Johann

;; Function read_bug (read_bug, funcdef_no=0, decl_uid=1320, cgraph_uid=0)

read_bug (const struct rgb * s)
{
  char t$r;

  # BLOCK 2 freq:10000
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  t$r_4 = s_1(D){address-space-1 ->}r;
  return t$r_4;
  # SUCC: EXIT [100.0%] 

}



Partition map 

Partition 1 (s_1(D) - 1 )
Partition 3 (.MEM_3(D) - 3 )
Partition 4 (t$r_4 - 4 )
Partition 5 (.MEM_5 - 5 )


Partition map 

Partition 0 (s_1(D) - 1 )


Live on entry to BB2 : s_1(D)  

Conflict graph:

After sorting:
Coalesce List:

Partition map 

Partition 0 (s_1(D) - 1 )

After Coalescing:

Partition map 

Partition 0 (s_1(D) - 1 )
Partition 1 (t$r_4 - 4 )


Replacing Expressions
t$r_4 replace with --> t$r_4 = s_1(D){address-space-1 ->}r;


read_bug (const struct rgb * s)
{
  char t$r;

  # BLOCK 2 freq:10000
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  t$r_4 = s_1(D){address-space-1 ->}r;
  return t$r_4;
  # SUCC: EXIT [100.0%] 

}



;; Generating RTL for gimple basic block 2

;; return t$r_4;

(insn 6 5 7 (set (reg:QI 46)
        (mem:QI (reg/v/f:HI 44 [ s ]) [0 s_1(D){address-space-1 ->}r+0 S1 A8])) 
flash-move.c:7 -1
     (nil))

(insn 7 6 8 (set (reg:QI 43 [ <retval> ])
        (reg:QI 46)) flash-move.c:7 -1
     (nil))

(jump_insn 8 7 9 (set (pc)
        (label_ref 0)) flash-move.c:7 -1
     (nil))

(barrier 9 8 0)


;;
;; Full RTL generated for this function:
;;
(note 1 0 4 NOTE_INSN_DELETED)

(note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 2 4 3 2 (set (reg/v/f:HI 44 [ s ])
        (reg:HI 24 r24 [ s ])) flash-move.c:4 -1
     (nil))

(note 3 2 5 2 NOTE_INSN_FUNCTION_BEG)

(note 5 3 6 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(insn 6 5 7 3 (set (reg:QI 46)
        (mem:QI (reg/v/f:HI 44 [ s ]) [0 s_1(D){address-space-1 ->}r+0 S1 A8])) 
flash-move.c:7 -1
     (nil))

(insn 7 6 8 3 (set (reg:QI 43 [ <retval> ])
        (reg:QI 46)) flash-move.c:7 -1
     (nil))

(jump_insn 8 7 9 3 (set (pc)
        (label_ref 10)) flash-move.c:7 -1
     (nil)
 -> 10)

(barrier 9 8 15)

(note 15 9 12 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 12 15 13 4 (clobber (reg/i:QI 24 r24)) flash-move.c:8 -1
     (nil))

(insn 13 12 10 4 (clobber (reg:QI 43 [ <retval> ])) flash-move.c:8 -1
     (nil))

(code_label 10 13 16 5 1 "" [1 uses])

(note 16 10 11 5 [bb 5] NOTE_INSN_BASIC_BLOCK)

(insn 11 16 14 5 (set (reg/i:QI 24 r24)
        (reg:QI 43 [ <retval> ])) flash-move.c:8 -1
     (nil))

(insn 14 11 0 5 (use (reg/i:QI 24 r24)) flash-move.c:8 -1
     (nil))

;; Function read_ok (read_ok, funcdef_no=1, decl_uid=1324, cgraph_uid=1)

read_ok (const struct rgb * s)
{
  char D.1327;

  # BLOCK 2 freq:10000
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  D.1327_2 = s_1(D){address-space-1 ->}r;
  return D.1327_2;
  # SUCC: EXIT [100.0%] 

}



Partition map 

Partition 1 (s_1(D) - 1 )
Partition 2 (D.1327_2 - 2 )
Partition 3 (.MEM_3(D) - 3 )


Partition map 

Partition 0 (s_1(D) - 1 )


Live on entry to BB2 : s_1(D)  

Conflict graph:

After sorting:
Coalesce List:

Partition map 

Partition 0 (s_1(D) - 1 )

After Coalescing:

Partition map 

Partition 0 (s_1(D) - 1 )
Partition 1 (D.1327_2 - 2 )


Replacing Expressions
D.1327_2 replace with --> D.1327_2 = s_1(D){address-space-1 ->}r;


read_ok (const struct rgb * s)
{
  char D.1327;

  # BLOCK 2 freq:10000
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  D.1327_2 = s_1(D){address-space-1 ->}r;
  return D.1327_2;
  # SUCC: EXIT [100.0%] 

}



;; Generating RTL for gimple basic block 2

;; return D.1327_2;

(insn 6 5 7 (set (reg:QI 46)
        (mem:QI (reg/v/f:HI 44 [ s ]) [0 s_1(D){address-space-1 ->}r+0 S1 A8 
AS1])) flash-move.c:12 -1
     (nil))

(insn 7 6 8 (set (reg:QI 43 [ <retval> ])
        (reg:QI 46)) flash-move.c:12 -1
     (nil))

(jump_insn 8 7 9 (set (pc)
        (label_ref 0)) flash-move.c:12 -1
     (nil))

(barrier 9 8 0)


;;
;; Full RTL generated for this function:
;;
(note 1 0 4 NOTE_INSN_DELETED)

(note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 2 4 3 2 (set (reg/v/f:HI 44 [ s ])
        (reg:HI 24 r24 [ s ])) flash-move.c:11 -1
     (nil))

(note 3 2 5 2 NOTE_INSN_FUNCTION_BEG)

(note 5 3 6 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(insn 6 5 7 3 (set (reg:QI 46)
        (mem:QI (reg/v/f:HI 44 [ s ]) [0 s_1(D){address-space-1 ->}r+0 S1 A8 
AS1])) flash-move.c:12 -1
     (nil))

(insn 7 6 8 3 (set (reg:QI 43 [ <retval> ])
        (reg:QI 46)) flash-move.c:12 -1
     (nil))

(jump_insn 8 7 9 3 (set (pc)
        (label_ref 10)) flash-move.c:12 -1
     (nil)
 -> 10)

(barrier 9 8 15)

(note 15 9 12 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 12 15 13 4 (clobber (reg/i:QI 24 r24)) flash-move.c:13 -1
     (nil))

(insn 13 12 10 4 (clobber (reg:QI 43 [ <retval> ])) flash-move.c:13 -1
     (nil))

(code_label 10 13 16 5 2 "" [1 uses])

(note 16 10 11 5 [bb 5] NOTE_INSN_BASIC_BLOCK)

(insn 11 16 14 5 (set (reg/i:QI 24 r24)
        (reg:QI 43 [ <retval> ])) flash-move.c:13 -1
     (nil))

(insn 14 11 0 5 (use (reg/i:QI 24 r24)) flash-move.c:13 -1
     (nil))