http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47855

--- Comment #1 from Carrot <carrot at google dot com> 2011-02-25 07:18:07 UTC 
---
I printed out the address of each instruction from function arm_reorg()

id=173 addr=0
id=2 addr=4
id=3 addr=8
id=15 addr=12
id=18 addr=16
id=199 addr=24
id=21 addr=26
id=23 addr=30
id=26 addr=34
id=28 addr=42
id=29 addr=46
id=31 addr=50
id=34 addr=54
id=36 addr=62
id=37 addr=66
id=39 addr=70
id=40 addr=74
id=43 addr=78
id=44 addr=82
id=45 addr=86
id=48 addr=90
id=201 addr=98
id=198 addr=102
id=55 addr=104
id=58 addr=108
id=59 addr=112
id=60 addr=116
id=196 addr=120
id=63 addr=122
id=197 addr=126
id=203 addr=128
id=71 addr=132
id=195 addr=136
id=74 addr=138
id=77 addr=142
id=78 addr=146
id=80 addr=150
id=81 addr=154
id=83 addr=158
id=84 addr=162
id=85 addr=166
id=193 addr=170
id=194 addr=172
id=93 addr=174
id=205 addr=178
id=192 addr=182
id=99 addr=184
id=207 addr=188
id=104 addr=192
id=6 addr=196
id=115 addr=200
id=176 addr=200

The GCC computed function length is more than 200 bytes, much larger than the
actual 126 bytes. Apparently there are a lot of length attribute errors! Take
the second instruction as an example,

 55 (insn:TI 2 174 3 2 (set (reg/v/f:SI 5 r5 [orig:149 in ] [149])
 56         (reg:SI 0 r0 [ in ])) src/t08.c:19 694 {*thumb2_movsi_insn}
 57      (nil))

or 
     mov   r5, r0

It should has a length of 2. The matched insn pattern is

 167 (define_insn "*thumb2_movsi_insn"
 168   [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,l
,*hk,m,*m")
 169         (match_operand:SI 1 "general_operand"      "rk
,I,K,j,mi,*mi,l,*hk"     ))]
 170   "TARGET_THUMB2 && ! TARGET_IWMMXT
 171    && !(TARGET_HARD_FLOAT && TARGET_VFP)
 172    && (   register_operand (operands[0], SImode)
 173        || register_operand (operands[1], SImode))"
 174   "@
 175    mov%?\\t%0, %1
 176    mov%?\\t%0, %1
 177    mvn%?\\t%0, #%B1
 178    movw%?\\t%0, %1
 179    ldr%?\\t%0, %1
 180    ldr%?\\t%0, %1
 181    str%?\\t%1, %0
 182    str%?\\t%1, %0"
 183   [(set_attr "type" "*,*,*,*,load1,load1,store1,store1")
 184    (set_attr "predicable" "yes")
 185    (set_attr "pool_range" "*,*,*,*,1020,4096,*,*")
 186    (set_attr "neg_pool_range" "*,*,*,*,0,0,*,*")]
 187 )

It doesn't specify length, so gcc takes the default value of 4.

>From this test case I can find at least the following patterns containing wrong
length attribute.

push_multi
thumb2_movsi_insn
thumb2_cbnz
thumb2_cbz
arm_cmpsi_insn
arm_cond_branch
arm_addsi3
arm_jump
arm_cond_branch
arm_movqi_insn

Reply via email to