1. 16 Oct, 2013 1 commit
  2. 12 Nov, 2012 2 commits
    • Simon Marlow's avatar
      Fix warnings · 92957808
      Simon Marlow authored
      92957808
    • Simon Marlow's avatar
      Remove OldCmm, convert backends to consume new Cmm · d92bd17f
      Simon Marlow authored
      This removes the OldCmm data type and the CmmCvt pass that converts
      new Cmm to OldCmm.  The backends (NCGs, LLVM and C) have all been
      converted to consume new Cmm.
      
      The main difference between the two data types is that conditional
      branches in new Cmm have both true/false successors, whereas in OldCmm
      the false case was a fallthrough.  To generate slightly better code we
      occasionally need to invert a conditional to ensure that the
      branch-not-taken becomes a fallthrough; this was previously done in
      CmmCvt, and it is now done in CmmContFlowOpt.
      
      We could go further and use the Hoopl Block representation for native
      code, which would mean that we could use Hoopl's postorderDfs and
      analyses for native code, but for now I've left it as is, using the
      old ListGraph representation for native code.
      d92bd17f
  3. 30 Oct, 2012 1 commit
  4. 23 Oct, 2012 1 commit
  5. 08 Oct, 2012 1 commit
    • Simon Marlow's avatar
      Produce new-style Cmm from the Cmm parser · a7c0387d
      Simon Marlow authored
      The main change here is that the Cmm parser now allows high-level cmm
      code with argument-passing and function calls.  For example:
      
      foo ( gcptr a, bits32 b )
      {
        if (b > 0) {
           // we can make tail calls passing arguments:
           jump stg_ap_0_fast(a);
        }
      
        return (x,y);
      }
      
      More details on the new cmm syntax are in Note [Syntax of .cmm files]
      in CmmParse.y.
      
      The old syntax is still more-or-less supported for those occasional
      code fragments that really need to explicitly manipulate the stack.
      However there are a couple of differences: it is now obligatory to
      give a list of live GlobalRegs on every jump, e.g.
      
        jump %ENTRY_CODE(Sp(0)) [R1];
      
      Again, more details in Note [Syntax of .cmm files].
      
      I have rewritten most of the .cmm files in the RTS into the new
      syntax, except for AutoApply.cmm which is generated by the genapply
      program: this file could be generated in the new syntax instead and
      would probably be better off for it, but I ran out of enthusiasm.
      
      Some other changes in this batch:
      
       - The PrimOp calling convention is gone, primops now use the ordinary
         NativeNodeCall convention.  This means that primops and "foreign
         import prim" code must be written in high-level cmm, but they can
         now take more than 10 arguments.
      
       - CmmSink now does constant-folding (should fix #7219)
      
       - .cmm files now go through the cmmPipeline, and as a result we
         generate better code in many cases.  All the object files generated
         for the RTS .cmm files are now smaller.  Performance should be
         better too, but I haven't measured it yet.
      
       - RET_DYN frames are removed from the RTS, lots of code goes away
      
       - we now have some more canned GC points to cover unboxed-tuples with
         2-4 pointers, which will reduce code size a little.
      a7c0387d
  6. 25 Sep, 2012 1 commit
  7. 12 Sep, 2012 1 commit
  8. 06 Aug, 2012 2 commits
  9. 30 Jul, 2012 1 commit
    • Simon Marlow's avatar
      New codegen: do not split proc-points when using the NCG · f1ed6a10
      Simon Marlow authored
      Proc-point splitting is only required by backends that do not support
      having proc-points within a code block (that is, everything except the
      native backend, i.e. LLVM and C).
      
      Not doing proc-point splitting saves some compilation time, and might
      produce slightly better code in some cases.
      f1ed6a10
  10. 04 Jul, 2012 1 commit
  11. 20 Jun, 2012 1 commit
  12. 12 Jun, 2012 1 commit
  13. 15 Mar, 2012 1 commit
  14. 09 Mar, 2012 1 commit
  15. 06 Mar, 2012 2 commits
  16. 02 Mar, 2012 1 commit
  17. 27 Feb, 2012 1 commit
  18. 23 Feb, 2012 1 commit
  19. 15 Feb, 2012 1 commit
    • Simon Marlow's avatar
      Improvements to the mini-inliner · 3d8ab554
      Simon Marlow authored
       - inline x = R1, even if x occurs many times
       - inline past a store, if the expression is not a load
         (we could further refine this of course, but the idea here
         is to get reasonable code for not much effort)
      3d8ab554
  20. 10 Jan, 2012 1 commit
    • dterei's avatar
      Track STG live register information for use in LLVM · 4384e146
      dterei authored
      We now carry around with CmmJump statements a list of
      the STG registers that are live at that jump site.
      This is used by the LLVM backend so it can avoid
      unnesecarily passing around dead registers, improving
      perfromance. This gives us the framework to finally
      fix trac #4308.
      4384e146
  21. 06 Jan, 2012 2 commits
  22. 29 Nov, 2011 1 commit
  23. 05 Nov, 2011 3 commits
  24. 25 Aug, 2011 1 commit
  25. 06 Jul, 2011 1 commit
    • batterseapower's avatar
      Refactoring: explicitly mark whether we have an info table in RawCmm · 41ca0b8d
      batterseapower authored
      I introduced this to support explicitly recording the info table label
      in RawCmm for another patch I am working on, but it turned out to lead
      to significant simplification in those parts of the compiler that
      consume RawCmm.
      
      Now, instead of lots of tests for null [CmmStatic] we have a simple
      test of a Maybe, and have reduced the number of guys that need to know
      how to convert entry->info labels by a TON. There are only 3 callers
      of that function now!
      41ca0b8d
  26. 23 Jun, 2011 1 commit
    • tibbe's avatar
      Iteratively try to fold expressions before constant propagation · e9bc0dde
      tibbe authored
      Before this change the constant expression
      
         _ccI::I64 = (16 >> 7) + 1;
      
      wouldn't be propagated, as it wouldn't be completely folded.  This
      meant that this expression wouldn't be unrolled
      
          thawArray# arr# 0# 16# s#
      
      The new code generator already does this correctly.
      e9bc0dde
  27. 17 Jun, 2011 1 commit
    • Edward Z. Yang's avatar
      Port MachOp folding to new code generator. · b8e0ce7b
      Edward Z. Yang authored
      
      
          * Rewrote cmmMachOpFold to cmmMachOpFoldM, which returns
            Nothing if no folding took place.
          * Wrote some generic mapping functions which take functions
            of form 'a -> Maybe a' and are smart about sharing.
          * Split up optimizations from PIC and PPC work in the native
            codegen, so they'll be easier to turn off later
            (they are not currently being turned off, however.)
          * Whitespace fixes!
      
      ToDo: Turn off MachOp folding when new codegenerator is being used.
      Signed-off-by: Edward Z. Yang's avatarEdward Z. Yang <ezyang@mit.edu>
      b8e0ce7b
  28. 01 Jun, 2011 2 commits
    • tibbe's avatar
      Fold constants during forward substitution in the Cmm mini-inliner · e97f2980
      tibbe authored and Simon Marlow's avatar Simon Marlow committed
      This exposes new constants that can be propagated.
      e97f2980
    • tibbe's avatar
      Implement forward substitution of constants in the Cmm mini-inliner · ea44eadf
      tibbe authored and Simon Marlow's avatar Simon Marlow committed
      Currently the mini-inliner would only forward substitute assignments
      to registers that were used exactly once, to not risk duplicating
      computation.  For constants there's no such risk so we always
      substitute.  Prior to the change the Cmm
      
          fn
          {
              bits64 a, b;
      
              a = 1;
              b = a + a;
              RET_N(b);
          }
      
      would be optimized as
      
          fn()    { []
                  }
              ca: _cb::I64 = 1;
                  R1 = _cb::I64 + _cb::I64;
                  jump (I64[Sp + 0]) ();
          }
      
      but after it would be optimized as
      
          fn()    { []
                  }
              ca: R1 = 2;
                  jump (I64[Sp + 0]) ();
          }
      
      Note that this pass does not deal with the now dead assignment.
      ea44eadf
  29. 05 May, 2011 1 commit
  30. 30 Apr, 2011 1 commit
  31. 05 Apr, 2011 1 commit
  32. 25 Mar, 2011 1 commit
  33. 24 Jan, 2011 1 commit
    • Simon Marlow's avatar
      Merge in new code generator branch. · 889c084e
      Simon Marlow authored
      This changes the new code generator to make use of the Hoopl package
      for dataflow analysis.  Hoopl is a new boot package, and is maintained
      in a separate upstream git repository (as usual, GHC has its own
      lagging darcs mirror in http://darcs.haskell.org/packages/hoopl).
      
      During this merge I squashed recent history into one patch.  I tried
      to rebase, but the history had some internal conflicts of its own
      which made rebase extremely confusing, so I gave up. The history I
      squashed was:
      
        - Update new codegen to work with latest Hoopl
        - Add some notes on new code gen to cmm-notes
        - Enable Hoopl lag package.
        - Add SPJ note to cmm-notes
        - Improve GC calls on new code generator.
      
      Work in this branch was done by:
         - Milan Straka <fox@ucw.cz>
         - John Dias <dias@cs.tufts.edu>
         - David Terei <davidterei@gmail.com>
      
      Edward Z. Yang <ezyang@mit.edu> merged in further changes from GHC HEAD
      and fixed a few bugs.
      889c084e