------- Comment #33 from hjl dot tools at gmail dot com  2009-01-21 02:14 
-------
For

 psim_set_halt_and_restart(system, &halt, ((void *)0));
  if (_setjmp (halt))
    return;
  last_cpu = psim_last_cpu(system);
  psim_set_halt_and_restart(system, &halt, &restart);
  if (_setjmp (restart)) {
    current_cpu = psim_last_cpu(system);
    do { if (1) { if (!(current_cpu >= 0 && current_cpu < nr_cpus))
        { error("%s:%d: assertion failed - %s\n",
                filter_filename("xxx.c"), 59, "current_cpu >= 0 && current_cpu
< nr_cpus");
        } } } while (0);
  }
  else {
    current_cpu = last_cpu;
    do { if (1) { if (!(current_cpu >= -1 && current_cpu < nr_cpus))
        {
          error("%s:%d: assertion failed - %s\n",
                filter_filename("xxx.c"), 63, "current_cpu >= -1 && current_cpu
< nr_cpus");
        } } } while (0);
  }
  while (1) {
...
    {     
      cpu *processor = processors[current_cpu];
      unsigned_word cia =
        cpu_get_program_counter(processor);
      idecode_cache *cache_entry =
        cpu_icache_entry(processor, cia);
      if (cache_entry->address == cia) {
        idecode_semantic *semantic = cache_entry->semantic;
        cia = semantic(processor, cache_entry, cia);
        cpu_set_program_counter(processor, cia);
      }       
}

IRA allocates stack slots

init_insns for 186: (insn_list:REG_DEP_TRUE 349 (nil))
      Coalescing spilled allocnos a32r60->a94r74
      Coalescing spilled allocnos a33r87->a50r73
      Coalescing spilled allocnos a10r91->a94r74
      Coalescing spilled allocnos a13r100->a50r73
      Slot 1 (freq,size): a10r91(5,4) a32r60(292,4) a94r74(412,8)
      Slot 2 (freq,size): a13r100(5,8) a33r87(123,8) a50r73(255,8)
      Slot 3 (freq,size): a9r103(65,4)
      Slot 4 (freq,size): a8r102(63,8)
      Slot 5 (freq,size): a7r101(2,8)
      Assigning 101(freq=2) a new slot 4
      Assigning 102(freq=63) a new slot 3
      Assigning 103(freq=65) a new slot 2
      Assigning 73(freq=255) a new slot 1
      Assigning 87(freq=123) slot 1 of 73
      Assigning 100(freq=5) slot 1 of 73 87
      Assigning 74(freq=412) a new slot 0
      Assigning 60(freq=292) slot 0 of 74
      Assigning 91(freq=5) slot 0 of 60 74

for

(note:HI 37 36 38 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn:HI 38 37 39 4 ../bar.c:613 (set (reg:DI 5 di)
        (reg/v/f:DI 100 [ system ])) 89 {*movdi_1_rex64} (expr_list:REG_DEAD
(reg/v/f:DI 100 [ system ])
        (nil)))

(call_insn:HI 39 38 40 4 ../bar.c:613 (set (reg:SI 0 ax)
        (call (mem:QI (symbol_ref:DI ("psim_last_cpu") [flags 0x41]
<function_decl 0x7f2d2d62e400 psim_last_cpu>) [0 S1 A8])
            (const_int 0 [0x0]))) 904 {*call_value_0_rex64} (expr_list:REG_DEAD
(reg:DI 5 di)
        (nil))
    (expr_list:REG_DEP_TRUE (use (reg:DI 5 di))
        (nil)))
...
(insn:HI 308 307 315 42 ../bar.c:631 (set (reg/v/f:DI 87 [ cache_entry ])
        (plus:DI (plus:DI (reg/v/f:DI 89 [ processor ])
                (reg:DI 136))
            (const_int 4632 [0x1218]))) 273 {*lea_2_rex64} (nil))

(insn:HI 315 308 316 42 ../bar.c:632 (parallel [
            (set (reg:DI 145)
                (plus:DI (reg/v/f:DI 89 [ processor ])
                    (reg:DI 136)))
            (clobber (reg:CC 17 flags))
        ]) 280 {*adddi_1_rex64} (expr_list:REG_DEAD (reg:DI 136)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

It generates:

(insn:HI 38 37 39 4 ../bar.c:613 (set (reg:DI 5 di)
        (mem/c:DI (plus:DI (reg/f:DI 7 sp)
                (const_int 32 [0x20])) [42 %sfp+-448 S8 A64])) 89
{*movdi_1_rex64} (nil))

(call_insn:HI 39 38 40 4 ../bar.c:613 (set (reg:SI 0 ax)
        (call (mem:QI (symbol_ref:DI ("psim_last_cpu") [flags 0x41]
<function_decl 0x7f2d2d62e400 psim_last_cpu>) [0 S1 A8])
            (const_int 0 [0x0]))) 904 {*call_value_0_rex64} (nil)
    (expr_list:REG_DEP_TRUE (use (reg:DI 5 di))
        (nil)))
...
(insn:HI 308 307 525 43 ../bar.c:631 (set (reg:DI 1 dx)
        (plus:DI (plus:DI (reg/v/f:DI 43 r14 [orig:89 processor ] [89])
                (reg:DI 0 ax [136]))
            (const_int 4632 [0x1218]))) 273 {*lea_2_rex64} (nil))

(insn 525 308 315 43 ../bar.c:631 (set (mem/c:DI (plus:DI (reg/f:DI 7 sp)
                (const_int 32 [0x20])) [42 %sfp+-448 S8 A64])
        (reg:DI 1 dx)) 89 {*movdi_1_rex64} (nil))

(insn:HI 315 525 316 43 ../bar.c:632 (parallel [
            (set (reg:DI 0 ax [145])
                (plus:DI (reg/v/f:DI 43 r14 [orig:89 processor ] [89])
                    (reg:DI 0 ax [136])))
            (clobber (reg:CC 17 flags))
        ]) 280 {*adddi_1_rex64} (nil))

The problem is

      Assigning 73(freq=255) a new slot 1
      Assigning 87(freq=123) slot 1 of 73
      Assigning 100(freq=5) slot 1 of 73 87

100 needs a separate slot. We can't share it with 73 and 87.


-- 


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

Reply via email to