summaryrefslogtreecommitdiff
path: root/compiler/llvmGen/LlvmCodeGen/Base.hs
Commit message (Collapse)AuthorAgeFilesLines
* Bump supported llvm version to 3.4.Austin Seipp2013-08-141-1/+1
| | | | | | | The compiler can bootstrap and run all tests fine, given a copy of LLVM built on Jul 27 2013. Signed-off-by: Austin Seipp <aseipp@pobox.com>
* LLVM refactor cleanupsPeter Wortmann2013-06-271-24/+33
| | | | | Slightly more documentation, removed unused label map (huh), removed MonadIO instance on LlvmM to improve encapsulation.
* Major Llvm refactoringPeter Wortmann2013-06-271-98/+295
| | | | | | | | | | | | | | | | | | | | | | 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.
* Extend globals to aliasesPeter Wortmann2013-06-271-1/+1
| | | | | Also give them a proper constructor - getGlobalVar and getGlobalValue map directly to the accessors.
* Use SDoc for all LLVM pretty-printingPeter Wortmann2013-06-271-1/+1
| | | | | | | 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.
* Add support for passing SSE vectors in registers.Geoffrey Mainland2013-02-011-5/+6
| | | | | | | 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.
* Add Cmm support for representing 128-bit-wide SIMD vectors.Geoffrey Mainland2013-02-011-1/+2
|
* Up supported LLVM version to 3.3.David Terei2013-01-181-1/+1
| | | | | Actual support is in progress but we will accept bugs against these version. LLVM 3.2 seems in good shape at this point anyway.
* Remove OldCmm, convert backends to consume new CmmSimon Marlow2012-11-121-1/+1
| | | | | | | | | | | | | | | | | | 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.
* Generate correct LLVM for the new register allocation scheme.Geoffrey Mainland2012-10-301-14/+24
| | | | | | | | | | | | | 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.
* Remove the old codegenSimon Marlow2012-10-191-1/+1
| | | | | Except for CgUtils.fixStgRegisters that is used in the NCG and LLVM backends, and should probably be moved somewhere else.
* Move wORD_SIZE into platformConstantsIan Lynagh2012-09-161-6/+5
|
* Pass DynFlags down to llvmWordIan Lynagh2012-09-161-18/+18
|
* Pass DynFlags down to gcWordIan Lynagh2012-09-121-2/+2
|
* Move activeStgRegs into CodeGen.PlatformIan Lynagh2012-08-211-6/+9
|
* Fix inverted test for platformUnregisterised (should fix the optllvm breakage)Simon Marlow2012-08-211-2/+2
|
* Add "Unregisterised" as a field in the settings fileIan Lynagh2012-08-071-10/+11
| | | | | | To explicitly choose whether you want an unregisterised build you now need to use the "--enable-unregisterised"/"--disable-unregisterised" configure flags.
* Warn if using unsupported version of LLVM.David Terei2012-06-251-2/+9
|
* Use SDoc rather than Doc in LLVMIan Lynagh2012-06-121-1/+4
| | | | | In particular, this makes life simpler when we want to use a general GHC SDoc in the middle of some LLVM.
* Add '-freg-liveness' flag to control if STG liveness informationDavid Terei2012-01-121-5/+11
| | | | is used for optimisation. (enabled by default)
* Fix trac # 5486David Terei2011-12-051-3/+25
| | | | | | | | | LLVM has a problem when the user imports some FFI types like memcpy and memset in a manner that conflicts with the types that GHC uses internally. So now we pre-initialise the environment with the most general types for these functions.
* Formatt wibbleDavid Terei2011-12-031-1/+0
|
* Add CCS for llvmDavid Terei2011-12-031-9/+18
|
* More CPP removal: pprDynamicLinkerAsmLabel in CLabelIan Lynagh2011-10-021-20/+26
| | | | And some knock-on changes
* Renaming onlySimon Peyton Jones2011-08-251-2/+2
| | | | | CmmTop -> CmmDecl CmmPgm -> CmmGroup
* Refactoring: explicitly mark whether we have an info table in RawCmmMax Bolingbroke2011-07-061-1/+1
| | | | | | | | | | | | 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!
* Refactoring: use a structured CmmStatics type rather than [CmmStatic]Max Bolingbroke2011-07-051-1/+1
| | | | | | | | | | | | | | | | | | I observed that the [CmmStatics] within CmmData uses the list in a very stylised way. The first item in the list is almost invariably a CmmDataLabel. Many parts of the compiler pattern match on this list and fail if this is not true. This patch makes the invariant explicit by introducing a structured type CmmStatics that holds the label and the list of remaining [CmmStatic]. There is one wrinkle: the x86 backend sometimes wants to output an alignment directive just before the label. However, this can be easily fixed up by parameterising the native codegen over the type of CmmStatics (though the GenCmmTop parameterisation) and using a pair (Alignment, CmmStatics) there instead. As a result, I think we will be able to remove CmmAlign and CmmDataLabel from the CmmStatic data type, thus nuking a lot of code and failing pattern matches. This change will come as part of my next patch.
* Fix LLVM backend in unregisterised build to use CDavid Terei2011-06-271-1/+3
| | | | | | calling convention. Patch based on one by Karel Gardas.
* Add new mem{cpy,set,move} cmm prim ops.David Terei2011-05-311-9/+28
|
* Merge in new code generator branch.Simon Marlow2011-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* LLVM: Fix various typos in commentsDavid Terei2010-07-071-1/+1
|
* LLVM: Fix test '2047' under linux-x64David Terei2010-06-281-5/+5
|
* Add noalias and nocapture attributes to pointer stg registersDavid Terei2010-06-281-3/+7
| | | | | | | | At the moment this gives a very slight performance boost of around 1 - 2%. Future changes to the generated code though so that pointers are kept as pointers more often instead of being cast to integer types straight away should hopefully improve the benefit this brings.
* Add support for parameter attributes to the llvm BE bindingDavid Terei2010-06-241-9/+19
| | | | | | These allow annotations of the code produced by the backend which should bring some perforamnce gains. At the moment the attributes aren't being used though.
* Declare some top level globals to be constant when appropriateDavid Terei2010-06-211-2/+2
| | | | | | | This involved removing the old constant handling mechanism which was fairly hard to use. Now being constant or not is simply a property of a global variable instead of a separate type.
* Add support of TNTC to llvm backendDavid Terei2010-06-181-11/+18
| | | | | | | We do this through a gnu as feature called subsections, where you can put data/code into a numbered subsection and those subsections will be joined together in descending order by gas at compile time.
* Add new LLVM code generator to GHC. (Version 2)David Terei2010-06-151-0/+164
This was done as part of an honours thesis at UNSW, the paper describing the work and results can be found at: http://www.cse.unsw.edu.au/~pls/thesis/davidt-thesis.pdf A Homepage for the backend can be found at: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM Quick summary of performance is that for the 'nofib' benchmark suite, runtimes are within 5% slower than the NCG and generally better than the C code generator. For some code though, such as the DPH projects benchmark, the LLVM code generator outperforms the NCG and C code generator by about a 25% reduction in run times.