summaryrefslogtreecommitdiff
path: root/compiler/llvmGen/Llvm
Commit message (Collapse)AuthorAgeFilesLines
* llvmGen: Fix typo in readnone attributeBen Gamari2020-01-201-1/+1
|
* Fix endian handling of LLVM backendStefan Schulze Frielinghaus2019-11-281-10/+4
| | | | | Get rid of CPP macro WORDS_BIGENDIAN which is not defined anymore, and replace it by DynFlag. This fixes partially #17337.
* asm-emit-time IND_STATIC eliminationGabor Greif2019-04-151-0/+1
| | | | | | | | | | | | When a new closure identifier is being established to a local or exported closure already emitted into the same module, refrain from adding an IND_STATIC closure, and instead emit an assembly-language alias. Inter-module IND_STATIC objects still remain, and need to be addressed by other measures. Binary-size savings on nofib are around 0.1%.
* Update Trac ticket URLs to point to GitLabRyan Scott2019-03-151-1/+1
| | | | | This moves all URL references to Trac tickets to their corresponding GitLab counterparts.
* Rename literal constructorsSylvain Henry2018-11-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | In a previous patch we replaced some built-in literal constructors (MachInt, MachWord, etc.) with a single LitNumber constructor. In this patch we replace the `Mach` prefix of the remaining constructors with `Lit` for consistency (e.g., LitChar, LitLabel, etc.). Sadly the name `LitString` was already taken for a kind of FastString and it would become misleading to have both `LitStr` (literal constructor renamed after `MachStr`) and `LitString` (FastString variant). Hence this patch renames the FastString variant `PtrString` (which is more accurate) and the literal string constructor now uses the least surprising `LitString` name. Both `Literal` and `LitString/PtrString` have recently seen breaking changes so doing this kind of renaming now shouldn't harm much. Reviewers: hvr, goldfire, bgamari, simonmar, jrtc27, tdammers Subscribers: tdammers, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4881
* another minor refactoringGabor Greif2018-11-221-4/+4
|
* Revert "Multiple fixes / improvements for LLVM backend"Ben Gamari2018-11-071-1/+1
| | | | This reverts commit adcb5fb47c0942671d409b940d8884daa9359ca4.
* Multiple fixes / improvements for LLVM backendKavon Farvardin2018-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix for #13904 -- stop "trashing" callee-saved registers, since it is not actually doing anything useful. - Fix for #14251 -- fixes the calling convention for functions passing raw SSE-register values by adding padding as needed to get the values in the right registers. This problem cropped up when some args were unused an dropped from the live list. - Fixed a typo in 'readnone' attribute - Added 'lower-expect' pass to level 0 LLVM optimization passes to improve block layout in LLVM for stack checks, etc. Test Plan: `make test WAYS=optllvm` and `make test WAYS=llvm` Reviewers: bgamari, simonmar, angerman Reviewed By: angerman Subscribers: rwbarton, carter GHC Trac Issues: #13904, #14251 Differential Revision: https://phabricator.haskell.org/D5190
* Allow CmmLabelDiffOff with different widthsSimon Marlow2018-05-161-0/+4
| | | | | | | | | | | | | | | | | | Summary: This change makes it possible to generate a static 32-bit relative label offset on x86_64. Currently we can only generate word-sized label offsets. This will be used in D4634 to shrink info tables. See D4632 for more details. Test Plan: See D4632 Reviewers: bgamari, niteria, michalt, erikd, jrtc27, osa1 Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4633
* A bunch of typofixesGabor Greif2017-09-261-2/+2
|
* compiler: introduce custom "GhcPrelude" PreludeHerbert Valerio Riedel2017-09-194-0/+8
| | | | | | | | | | | | | | | | | | This switches the compiler/ component to get compiled with -XNoImplicitPrelude and a `import GhcPrelude` is inserted in all modules. This is motivated by the upcoming "Prelude" re-export of `Semigroup((<>))` which would cause lots of name clashes in every modulewhich imports also `Outputable` Reviewers: austin, goldfire, bgamari, alanz, simonmar Reviewed By: bgamari Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari Differential Revision: https://phabricator.haskell.org/D3989
* Fix note references and some typosGabor Greif2017-07-262-3/+3
|
* Typos in comments [ci skip]Gabor Greif2017-05-261-1/+1
|
* Prefer #if defined to #ifdefBen Gamari2017-04-281-1/+1
| | | | Our new CPP linter enforces this.
* Honour -dsuppress-uniques more thoroughlySimon Peyton Jones2017-02-171-1/+1
| | | | | | | | | | | I found that tests parser/should_compile/DumpRenamedAst and friends were printing uniques, which makes the test fragile. But -dsuppress-uniques made no difference! It turned out that pprName wasn't properly consulting Opt_SuppressUniques. This patch fixes the problem, and updates those three tests to use -dsuppress-uniques
* Spelling fixes in comments [ci skip]Gabor Greif2017-01-182-2/+2
|
* Typos in manual, comments and testsGabor Greif2017-01-121-1/+1
|
* Switch to LLVM version 3.8Erik de Castro Lopo2016-07-072-1/+9
| | | | | | | | | | | | | | LLVM 3.8 was released a couple of months ago. Test Plan: Build and test on x86_64/linux (perf-llvm) and armhf/linux. Reviewers: austin, hvr, rwbarton, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2382
* llvmGen: Add strictness to metadata fieldsBen Gamari2016-06-191-5/+5
|
* llvmGen: Consolidate MetaExpr pretty-printingBen Gamari2016-06-182-13/+5
| | | | Previously this logic was duplicated needlessly.
* llvmGen: Make metadata ids a newtypeBen Gamari2016-06-182-10/+18
| | | | | These were previously just represented as Ints which was needlessly vague.
* Test for undef bugs in the LLVM backend when validatingReid Barton2016-01-271-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | In an attempt to catch bugs involving using undef values, replace undef literals by values likely to cause crashes or test failures. We do this only when validating since it is a deoptimization. This depends on D1857 to catch such bugs in the RTS (such as #11487). Test Plan: Did a build with ``` BuildFlavour = quick-llvm SRC_HC_OPTS_STAGE1 = -fllvm-fill-undef-with-garbage ``` The build crashed when running ghc-stage2, as expected. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1858
* Switch to LLVM version 3.7Erik de Castro Lopo2015-10-142-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | Before this commit, GHC only supported LLVM 3.6. Now it only supports LLVM 3.7 which was released in August 2015. LLVM version 3.6 and earlier do not work on AArch64/Arm64, but 3.7 does. Also: * Add CC_Ghc constructor to LlvmCallConvention. * Replace `maxSupportLlvmVersion`/`minSupportLlvmVersion` with a single `supportedLlvmVersion` variable. * Get `supportedLlvmVersion` from version specified in configure.ac. * Drop llvmVersion field from DynFlags (no longer needed because only one version is supported). Test Plan: Validate on x86_64 and arm Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1320 GHC Trac Issues: #10953
* Revert "Switch to LLVM version 3.7"Erik de Castro Lopo2015-10-102-16/+10
| | | | | | Pushed by mistacke before it was ready. This reverts commit 5dc3db743ec477978b9727a313951be44dbd170f.
* Switch to LLVM version 3.7Erik de Castro Lopo2015-10-102-13/+19
|
* LLVM: Implement atomic operations in terms of LLVM primitivesBen Gamari2015-10-023-3/+67
| | | | | | | | | | | | | | | | | | | This fixes Trac #7883. This adds proper support for, * `MO_AtomicRMW` * `MO_AtomicWrite` * `MO_CmpXChg` Test Plan: Validate Reviewers: rrnewton, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1282 GHC Trac Issues: #7883
* Support MO_{Add,Sub}IntC and MO_Add2 in the LLVM backendMichal Terepeta2015-07-043-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | This includes: - Adding new LlvmType called LMStructP that represents an unpacked struct (this is necessary since LLVM's instructions the llvm.sadd.with.overflow.* return an unpacked struct). - Modifications to LlvmCodeGen.CodeGen to generate the LLVM instructions for the primops. - Modifications to StgCmmPrim to actually use those three instructions if we use the LLVM backend (so far they were only used for NCG). Test Plan: validate Reviewers: austin, rwbarton, bgamari Reviewed By: bgamari Subscribers: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D991 GHC Trac Issues: #9430
* llvmGen: move to LLVM 3.6 exclusivelyBen Gamari2015-02-093-27/+37
| | | | | | | | | | | | | | | | | | | Summary: Rework llvmGen to use LLVM 3.6 exclusively. The plans for the 7.12 release are to ship LLVM alongside GHC in the interests of user (and developer) sanity. Along the way, refactor TNTC support to take advantage of the new `prefix` data support in LLVM 3.6. This allows us to drop the section-reordering component of the LLVM mangler. Test Plan: Validate, look at emitted code Reviewers: dterei, austin, scpmw Reviewed By: austin Subscribers: erikd, awson, spacekitteh, thomie, carter Differential Revision: https://phabricator.haskell.org/D530 GHC Trac Issues: #10074
* llvmGen: Compatibility with LLVM 3.5 (re #9142)Ben Gamari2014-11-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to changes in LLVM 3.5 aliases now may only refer to definitions. Previously to handle symbols defined outside of the current commpilation unit GHC would emit both an `external` declaration, as well as an alias pointing to it, e.g., @stg_BCO_info = external global i8 @stg_BCO_info$alias = alias private i8* @stg_BCO_info Where references to `stg_BCO_info` will use the alias `stg_BCO_info$alias`. This is not permitted under the new alias behavior, resulting in errors resembling, Alias must point to a definition i8* @"stg_BCO_info$alias" To fix this, we invert the naming relationship between aliases and definitions. That is, now the symbol definition takes the name `@stg_BCO_info$def` and references use the actual name, `@stg_BCO_info`. This means the external symbols can be handled by simply emitting an `external` declaration, @stg_BCO_info = external global i8 Whereas in the case of a forward declaration we emit, @stg_BCO_info = alias private i8* @stg_BCO_info$def Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D155
* Revert change to alias handling in ppLlvmGlobal introduced in d87fa34, which ↵Luke Iannini2014-11-211-1/+1
| | | | | | requires LLVM 3.6. Signed-off-by: Austin Seipp <austin@well-typed.com>
* arm64: 64bit iOS and SMP support (#7942)Luke Iannini2014-11-191-1/+1
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Re-add more primops for atomic ops on byte arraysJohan Tibell2014-06-302-6/+19
| | | | | | | | | | | | | | | | | | | | | | | This is the second attempt to add this functionality. The first attempt was reverted in 950fcae46a82569e7cd1fba1637a23b419e00ecd, due to register allocator failure on x86. Given how the register allocator currently works, we don't have enough registers on x86 to support cmpxchg using complicated addressing modes. Instead we fall back to a simpler addressing mode on x86. Adds the following primops: * atomicReadIntArray# * atomicWriteIntArray# * fetchSubIntArray# * fetchOrIntArray# * fetchXorIntArray# * fetchAndIntArray# Makes these pre-existing out-of-line primops inline: * fetchAddIntArray# * casIntArray#
* Revert "Add more primops for atomic ops on byte arrays"Johan Tibell2014-06-262-19/+6
| | | | | | | | This commit caused the register allocator to fail on i386. This reverts commit d8abf85f8ca176854e9d5d0b12371c4bc402aac3 and 04dd7cb3423f1940242fdfe2ea2e3b8abd68a177 (the second being a fix to the first).
* Add more primops for atomic ops on byte arraysJohan Tibell2014-06-242-6/+19
| | | | | | | | | | | | | | | | | | | Summary: Add more primops for atomic ops on byte arrays Adds the following primops: * atomicReadIntArray# * atomicWriteIntArray# * fetchSubIntArray# * fetchOrIntArray# * fetchXorIntArray# * fetchAndIntArray# Makes these pre-existing out-of-line primops inline: * fetchAddIntArray# * casIntArray#
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-152-1/+3
| | | | | | | | | | | | | | | | | | In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
* Fix new Haddock doc parse failures.Austin Seipp2014-01-121-7/+6
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix bug in LLVM code generatorBen Lippmeier2013-11-141-1/+5
| | | | The bitcast operation always needs a type for the source.
* Remove spurious extra brace in LLVM metadataPeter Wortmann2013-07-051-1/+1
| | | | | | | This actually caused a segfault in the optimized stage 2 compiler due to wrong TBAA data. Signed-off-by: David Terei <davidterei@gmail.com>
* LLVM refactor cleanupsPeter Wortmann2013-06-271-1/+0
| | | | | Slightly more documentation, removed unused label map (huh), removed MonadIO instance on LlvmM to improve encapsulation.
* Major Llvm refactoringPeter Wortmann2013-06-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* Use full contents size for arraysPeter Wortmann2013-06-271-1/+3
| | | | | | I am not quite sure at what point it makes sense to look at arrays as pointers, but I ran into at least one use case that strongly suggested doing it this way (calculating the actual size of structures, to be exact).
* Rewrite ppLlvmBlock to use standard library "break"Peter Wortmann2013-06-271-13/+8
|
* Extend globals to aliasesPeter Wortmann2013-06-272-15/+19
| | | | | Also give them a proper constructor - getGlobalVar and getGlobalValue map directly to the accessors.
* Use SDoc for all LLVM pretty-printingPeter Wortmann2013-06-273-269/+267
| | | | | | | 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.
* Iteration on dterei's metadata designPeter Wortmann2013-06-274-81/+32
| | | | | | | | | | | | | | | | | | | | | - 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
* Add ability to call functions with metadata as arguments to LLVMDavid Terei2013-06-274-15/+50
| | | | backend.
* Rework LLVM metadata representation to be more accurate.David Terei2013-06-274-60/+141
|
* Fixed moer tyopsGabor Greif2013-04-251-8/+8
|
* Tell LLVM that all vector stores and loads are potentially unaligned.Geoffrey Mainland2013-02-011-3/+22
|
* Add support for LLVM vectors.Geoffrey Mainland2013-02-013-26/+70
| | | | | This patch adds support for LLVM vectors and vector operations to our internal LLVM abstract syntax data types.