Changes between Version 25 and Version 26 of Commentary/Compiler/NewCodeGenStupidity


Ignore:
Timestamp:
Apr 27, 2011 9:57:20 AM (4 years ago)
Author:
ezyang
Comment:

add old codegen

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/NewCodeGenStupidity

    v25 v26  
    282282== Stupid spills ==
    283283
    284 If something is already in memory, why do we have to spill it again? Well, it's because the spiller isn't clever enough:
     284If something is already in memory, why do we have to spill it again?
     285
     286{{{
     287module Foo where
     288foo a b c d e f g h
     289    = case baz a of
     290        True -> bar a b c d e f g h
     291        False -> 0
     292
     293baz 3 = True
     294baz _ = False
     295bar a b c d e f g h = a * b + c * d + e * f * g * h
     296}}}
     297
     298Well, it's because the spiller isn't clever enough:
    285299
    286300{{{
     
    329343}}}
    330344
    331 Ick!
     345Ick! The old codegen was much better...
     346
     347{{{
     348Foo.foo_entry()
     349        { [const Foo.foo_slow-Foo.foo_info;, const 9;,
     350       const Foo.foo_srt-Foo.foo_info;, const 589824;, const 0;,
     351const 196623;]
     352        }
     353    cqM:
     354        if ((Sp + -12) < I32[BaseReg + 84]) goto cqO;
     355        I32[Sp - 8] = I32[Sp + 4];
     356        I32[Sp - 12] = I32[Sp + 0];
     357        I32[Sp - 4] = smz_info;
     358        Sp = Sp - 12;
     359        jump Foo.baz_info ();
     360    cqO:
     361        R1 = Foo.foo_closure;
     362        Sp = Sp + 0;
     363        jump (I32[BaseReg - 4]) ();
     364}
     365
     366smz_ret()
     367        { [const Foo.foo_srt-smz_info;, const 9;, const 65568;]
     368        }
     369    cqx:
     370        if (R1 & 3 >= 2) goto cqC;
     371        Hp = Hp + 8;
     372        if (Hp > I32[BaseReg + 92]) goto cqA;
     373        I32[Hp - 4] = sat_smA_info;
     374        I32[Sp + 36] = Hp - 4;
     375        I32[Sp + 32] = stg_ap_p_info;
     376        I32[Sp + 28] = I32[Sp + 4];
     377        Sp = Sp + 28;
     378        jump GHC.Num.fromInteger_info ();
     379    cqC:
     380        Sp = Sp + 4;
     381        jump Foo.bar_info ();
     382    cqB: jump (I32[BaseReg - 8]) ();
     383    cqA:
     384        I32[BaseReg + 112] = 8;
     385        goto cqB;
     386}
     387}}}