1. 23 Sep, 2013 2 commits
    • gmainlan@microsoft.com's avatar
      0b561f17
    • gmainlan@microsoft.com's avatar
      SIMD primops are now generated using schemas that are polymorphic in · 16b350a4
      gmainlan@microsoft.com authored
      width and element type.
      
      SIMD primops are now polymorphic in vector size and element type, but
      only internally to the compiler. More specifically, utils/genprimopcode
      has been extended so that it "knows" about SIMD vectors. This allows us
      to, for example, write a single definition for the "add two vectors"
      primop in primops.txt.pp and have it instantiated at many vector types.
      This generates a primop in GHC.Prim for each vector type at which "add
      two vectors" is instantiated, but only one data constructor for the
      PrimOp data type, so the code generator is much, much simpler.
      16b350a4
  2. 20 Sep, 2013 1 commit
  3. 06 Sep, 2013 1 commit
    • thoughtpolice's avatar
      Add basic support for GHCJS · b372e8ea
      thoughtpolice authored
      
      
      This patch encompasses most of the basic infrastructure for GHCJS. It
      includes:
      
        * A new extension, -XJavaScriptFFI
        * A new architecture, ArchJavaScript
        * Parser and lexer support for 'foreign import javascript', only
          available under -XJavaScriptFFI, using ArchJavaScript.
        * As a knock-on, there is also a new 'WayCustom' constructor in
          DynFlags, so clients of the GHC API can add custom 'tags' to their
          built files. This should be useful for other users as well.
      
      The remaining changes are really just the resulting fallout, making sure
      all the cases are handled appropriately for DynFlags and Platform.
      Authored-by: Luite Stegeman's avatarLuite Stegeman <stegeman@gmail.com>
      Signed-off-by: thoughtpolice's avatarAustin Seipp <aseipp@pobox.com>
      b372e8ea
  4. 17 Jul, 2013 1 commit
  5. 05 Jul, 2013 1 commit
  6. 27 Jun, 2013 5 commits
    • Peter Wortmann's avatar
      Major Llvm refactoring · a948fe83
      Peter Wortmann authored
      This combined patch reworks the LLVM backend in a number of ways:
      
      1. Most prominently, we introduce a LlvmM monad carrying the contents of
         the old LlvmEnv around. This patch completely removes LlvmEnv and
         refactors towards standard library monad combinators wherever possible.
      
      2. Support for streaming - we can now generate chunks of Llvm for Cmm as
         it comes in. This might improve our speed.
      
      3. To allow streaming, we need a more flexible way to handle forward
         references. The solution (getGlobalPtr) unifies LlvmCodeGen.Data
         and getHsFunc as well.
      
      4. Skip alloca-allocation for registers that are actually never written.
         LLVM will automatically eliminate these, but output is smaller and
         friendlier to human eyes this way.
      
      5. We use LlvmM to collect references for llvm.used. This allows places
         other than cmmProcLlvmGens to generate entries.
      a948fe83
    • Peter Wortmann's avatar
      Extend globals to aliases · 720a87c7
      Peter Wortmann authored
      Also give them a proper constructor - getGlobalVar and getGlobalValue
      map directly to the accessors.
      720a87c7
    • Peter Wortmann's avatar
      Use SDoc for all LLVM pretty-printing · 99d39221
      Peter Wortmann authored
      This patch reworks some parts of the LLVM pretty-printing code that were
      still using Show and String. Now we should be using SDoc and Outputable
      throughout. Note that many get*Name functions become pp*Name
      here as a side-effect.
      99d39221
    • Peter Wortmann's avatar
      Iteration on dterei's metadata design · 12148d91
      Peter Wortmann authored
      - MetaArgs is not needed, as variables are already meta data
      
      - Same goes for MetaVal - its only reason for existing seems to be to
        support LLVM's strange pretty-printing for meta-data annotations, and
        I feel that is better to keep the data structure clean and handle it in
        the pretty-printing instead.
      
      - Rename "MetaData" to "MetaAnnot". Meta-data is still meta-data when it
        is not associated with an expression or statement - for example compile
        unit data for debugging. I feel the old name was a bit misleading.
      
      - Make the renamed MetaAnnot a proper data type instead of a type alias
        for a pair.
      
      - Rename "MetaExpr" constructor to "MetaStruct". As the data is much more
        like a LLVM structure (not array, as it can contain values).
      
      - Fix a warning
      12148d91
    • dterei's avatar
      280a7ec6
  7. 11 Jun, 2013 2 commits
  8. 09 Jun, 2013 2 commits
    • ian@well-typed.com's avatar
      Fix warnings · 86ca77ec
      ian@well-typed.com authored
      86ca77ec
    • ian@well-typed.com's avatar
      Add support for byte endian swapping for Word 16/32/64. · 1c5b0511
      ian@well-typed.com authored
      * Exposes bSwap{,16,32,64}# primops
      * Add a new machops MO_BSwap
      * Use a Stg implementation (hs_bswap{16,32,64}) for other implementation
        in NCG.
      * Generate bswap in X86 NCG for 32 and 64 bits, and for 16 bits, bswap+shr
        instead of using xchg.
      * Generate llvm.bswap intrinsics in llvm codegen.
      
      Patch from Vincent Hanquez.
      1c5b0511
  9. 01 Feb, 2013 6 commits
    • gmainlan@microsoft.com's avatar
      Mimic OldCmm basic block ordering in the LLVM backend. · b39e4de1
      gmainlan@microsoft.com authored
      In OldCmm, the false case of a conditional was a fallthrough. In Cmm,
      conditionals have both true and false successors. When we convert Cmm to LLVM,
      we now first re-order Cmm blocks so that the false successor of a conditional
      occurs next in the list of basic blocks, i.e., it is a fallthrough, just like it
      (necessarily) did in OldCmm. Surprisingly, this can make a big performance
      difference.
      b39e4de1
    • gmainland's avatar
      Add prefetch primops. · cc56f34e
      gmainland authored
      cc56f34e
    • gmainlan@microsoft.com's avatar
      Add support for passing SSE vectors in registers. · 33bfc6a7
      gmainlan@microsoft.com authored
      This patch adds support for 6 XMM registers on x86-64 which overlap with the F
      and D registers and may hold 128-bit wide SIMD vectors. Because there is not a
      good way to attach type information to STG registers, we aggressively bitcast in
      the LLVM back-end.
      33bfc6a7
    • pmonday's avatar
      3984b912
    • gmainlan@microsoft.com's avatar
      Add the Float32X4# primitive type and associated primops. · 4af62075
      gmainlan@microsoft.com authored
      This patch lays the groundwork needed for primop support for SIMD vectors. In
      addition to the groundwork, we add support for the FloatX4# primitive type and
      associated primops.
      
       * Add the FloatX4# primitive type and associated primops.
       * Add CodeGen support for Float vectors.
       * Compile vector operations to LLVM vector operations in the LLVM code
         generator.
       * Make the x86 native backend fail gracefully when encountering vector primops.
       * Only generate primop wrappers for vector primops when using LLVM.
      4af62075
    • gmainlan@microsoft.com's avatar
      Always pass vector values on the stack. · 6480a35c
      gmainlan@microsoft.com authored
      Vector values are now always passed on the stack. This isn't particularly
      efficient, but it will have to do for now.
      6480a35c
  10. 23 Jan, 2013 2 commits
    • Simon Marlow's avatar
      fix validate-breaking warning · 39148b8a
      Simon Marlow authored
      39148b8a
    • dterei's avatar
      Fix our handling of literals and types in LLVM (#7575). · 1a703068
      dterei authored
      This bug was introduced in the recent fix for #7571, that extended some
      existing infastructure in the LLVM backend that handled the conflict
      between LLVM's return type from comparison operations (i1) and what GHC
      expects (word). By extending it to handle literals though, we forced all
      literals to be i1 or word, breaking other code.
      
      This patch resolves this breakage and handles #7571 still, cleaning up
      the code for both a little. The overall approach is not ideal but
      changing that is left for the future.
      1a703068
  11. 22 Jan, 2013 1 commit
  12. 03 Jan, 2013 1 commit
  13. 13 Dec, 2012 1 commit
  14. 12 Nov, 2012 3 commits
    • Simon Marlow's avatar
      a1ebe37d
    • 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
  15. 30 Oct, 2012 3 commits
    • gmainlan@microsoft.com's avatar
      Generate correct LLVM for the new register allocation scheme. · dcf88e66
      gmainlan@microsoft.com authored
      We now have accurate global register liveness information attached to all Cmm
      procedures and jumps. With this patch, the LLVM back end uses this information
      to pass only the live floating point (F and D) registers on tail calls. This
      makes the LLVM back end compatible with the new register allocation strategy.
      
      Ideally the GHC LLVM calling convention would put all registers that are always
      live first in the parameter sequence. Unfortunately the specification is written
      so that on x86-64 SpLim (always live) is passed after the R registers. Therefore
      we must always pass *something* in the R registers, so we pass the LLVM value
      undef.
      dcf88e66
    • gmainlan@microsoft.com's avatar
      Attach global register liveness info to Cmm procedures. · 5ee08ddf
      gmainlan@microsoft.com authored
      All Cmm procedures now include the set of global registers that are live on
      procedure entry, i.e., the global registers used to pass arguments to the
      procedure. Only global registers that are use to pass arguments are included in
      this list.
      5ee08ddf
    • gmainlan@microsoft.com's avatar
      Cmm jumps always have live register information. · 8e816844
      gmainlan@microsoft.com authored
      Jumps now always have live register information attached, so drop Maybes.
      8e816844
  16. 19 Oct, 2012 1 commit
    • Simon Marlow's avatar
      Remove the old codegen · 6fbd46b0
      Simon Marlow authored
      Except for CgUtils.fixStgRegisters that is used in the NCG and LLVM
      backends, and should probably be moved somewhere else.
      6fbd46b0
  17. 16 Oct, 2012 1 commit
    • ian@well-typed.com's avatar
      Some alpha renaming · cd33eefd
      ian@well-typed.com authored
      Mostly d -> g (matching DynFlag -> GeneralFlag).
      Also renamed if* to when*, matching the Haskell if/when names
      cd33eefd
  18. 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
  19. 16 Sep, 2012 2 commits
  20. 12 Sep, 2012 2 commits
  21. 21 Aug, 2012 1 commit