summaryrefslogtreecommitdiff
path: root/compiler/llvmGen
Commit message (Collapse)AuthorAgeFilesLines
* llvm backend: Put string constants in .rodata.str.* sections (#13265)Reid Barton2017-03-091-5/+12
| | | | | | | | | | | | | | | | | | | | | The .cstring.* sections don't get merged by the linker (bfd or gold). That's bad, and especially bad in #13265 where it caused the number of sections to exceed what is apparently an internal limit in ld.bfd. Test Plan: I can only test this on Linux, and I am guessing at what the correct behavior is on Mac OS and Windows (and AIX I suppose). Testers on other platforms would be much appreciated, though I understand that the LLVM backend is broken on Mac OS currently for other reasons (#13378). Reviewers: olsner, austin, xnyhps, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3282
* Generate better fp abs for X86 and llvm with default cmm otherwiseDominic Steinitz2017-03-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Currently we have this in libraries/base/GHC/Float.hs: ``` abs x | x == 0 = 0 -- handles (-0.0) | x > 0 = x | otherwise = negateFloat x ``` But 3-4 years ago it was noted that this was inefficient: https://mail.haskell.org/pipermail/libraries/2013-April/019690.html We can generate better code for X86 and llvm and for others generate some custom cmm code which is similar to what the compiler generates now. Reviewers: austin, simonmar, hvr, bgamari Reviewed By: bgamari Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3265
* Mangle .subsections_via_symbols away.Moritz Angermann2017-03-061-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | This is a rather stupid mangler hack. However, when using prefix data with llvm, on systems that support -dead_strip (macOS, iOS), the prefix data is stipped. llvm generiously adds .subsections_via_symbols for macho in any case. Thus we use our trusted mangler to drop the .subsections_via_symbols line from the assembly. This ultimately means that for (macOS, llvm), and (iOS, llvm) will not benefit from -dead_strip. Yet, this patch will allow building ghc on macOS again. Test Plan: build ghc with llvm on macOS Reviewers: rwbarton, bgamari, austin Reviewed By: rwbarton, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3287
* Upgrade UniqSet to a newtypeDavid Feuer2017-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet` has a key invariant `UniqFM` does not. For example, `fmap` over `UniqSet` will generally produce nonsense. * Upgrade `UniqSet` from a type synonym to a newtype. * Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`. * Use cached unique in `tyConsOfType` by replacing `unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`. Reviewers: austin, hvr, goldfire, simonmar, niteria, bgamari Reviewed By: niteria Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3146
* 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
* Ditch static flagsSylvain Henry2017-02-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts the 4 lasting static flags (read from the command line and unsafely stored in immutable global variables) into dynamic flags. Most use cases have been converted into reading them from a DynFlags. In cases for which we don't have easy access to a DynFlags, we read from 'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'. It's not perfect (not thread-safe) but it is still better as we can set/unset these 4 flags before each run when using GHC API. Updates haddock submodule. Rebased and finished by: bgamari Test Plan: validate Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2839 GHC Trac Issues: #8440
* Spelling fixes in comments [ci skip]Gabor Greif2017-01-182-2/+2
|
* LLVM: Tweak TBAA metadata codegenErik de Castro Lopo2017-01-162-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | This change is requred for llvm 4.0. GHC doesn't use that version yet, but this change is just as valid for versions eariler than 4.0. Two changes needed: * Previously, GHC defined a `topN` node in the TBAA heiarchy and some IR instructions referenced that node. With LLVM 4.0 the root node can no longer be referenced by IR instructions, so we introduce a new element `rootN` and make `topN` a child of that. * Previously the root TBAA node was rendered as "!0 = !{!"root", null}". With LLVM 4.0 that needs to be "!0 = !{!"root"}" which is also accepted by earlier versions. Test Plan: Build with quick-llvm BuildFlavor and run tests Reviewers: bgamari, drbo, austin, angerman, michalt, DemiMarie Reviewed By: DemiMarie Subscribers: mpickering, DemiMarie, thomie Differential Revision: https://phabricator.haskell.org/D2975
* Typos in manual, comments and testsGabor Greif2017-01-121-1/+1
|
* Fix terminal corruption bug and clean up SDoc interface.Phil Ruffwind2017-01-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | | - Fix #13076 by wrapping `printDoc_` so that the terminal color is reset even if an exception occurs. - Add `printSDoc`, `printSDocLn`, and `bufLeftRenderSDoc` to keep `SDoc` values abstract (they are wrappers of `printDoc_`, `printDoc`, and `bufLeftRender` respectively). - Remove unused function: `printForAsm` Test Plan: manual Reviewers: RyanGlScott, austin, dfeuer, bgamari Reviewed By: dfeuer, bgamari Subscribers: dfeuer, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2932 GHC Trac Issues: #13076
* Typos in commentsGabor Greif2016-12-161-1/+1
|
* Fix LLVM TBAA metadataDemi Obenour2016-12-092-12/+8
| | | | | | | | | | | | | | | | | | | | | | Accesses through a Cmm local are currently reported as having the "other" type, which can only alias other "other" accesses. However, this assumption is incorrect, which can result in silent bad LLVM codegen. Fixes #9308. Fixes #9504. Test Plan: GHC CI Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2758 GHC Trac Issues: #9125, #9308, #9504
* Reduce the size of string literals in binaries.Thijs Alkemade2016-12-061-0/+2
| | | | | | | | | | | | | | | Removed the alignment for strings and mark then as cstring sections in the generated asm so the linker can merge duplicate sections. Reviewers: rwbarton, trofi, austin, trommler, simonmar, hvr, bgamari Reviewed By: hvr, bgamari Subscribers: simonpj, hvr, thomie Differential Revision: https://phabricator.haskell.org/D1290 GHC Trac Issues: #9577
* LLVM generate llvm.expect for conditional branchesAlex Biehl2016-11-171-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds likeliness annotations to heap and and stack checks and modifies the llvm codegen to recognize those to help it generate better code. So with this patch ``` ... if ((Sp + 8) - 24 < SpLim) (likely: False) goto c23c; else goto c23d; ... ``` roughly generates: ``` %ln23k = icmp ult i64 %ln23j, %SpLim_Arg %ln23m = call ccc i1 (i1, i1) @llvm.expect.i1( i1 %ln23k, i1 0 ) br i1 %ln23m, label %c23c, label %c23d ``` Note the call to `llvm.expect` which denotes the expected result for the comparison. Test Plan: Look at assembler code with and without this patch. If the heap-checks moved out of the way we are happy. Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2688 GHC Trac Issues: #8321
* 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
* Adds x86_64-apple-darwin14 target.Moritz Angermann2016-07-051-7/+10
| | | | | | | | | | | | | | | | | | x86_64-apple-darwin14, is the target for the 64bit simulator. Ideally, we'd have (i386|armv7|arm64|x64_86)-apple-ios, yet, many #ifdefs depend on `darwin`, notably libffi. Hence, this only adds x86_64-apple-darwin14 as a target. This also updates the comment to add the `-S` flag, and dump the output to stdout; and adjusts the `datalayout` and `triple` values, as obtained through the method mentioned in the comment. Reviewers: hvr, erikd, austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2378
* Remove uniqSetToListBartosz Nitka2016-07-011-1/+4
| | | | | | | This documents nondeterminism in code generation and removes the nondeterministic ufmToList function. In the future someone will have to use nonDetEltsUFM (with proper explanation) or pprUFM.
* 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-185-20/+30
| | | | | These were previously just represented as Ints which was needlessly vague.
* ErrUtils: Add timings to compiler phasesBen Gamari2016-03-242-4/+6
| | | | | | | | | | | | | | | | | | | | | | | This adds timings and allocation figures to the compiler's output when run with `-v2` in an effort to ease performance analysis. Todo: * Documentation * Where else should we add these? * Perhaps we should remove some of the now-arguably-redundant `showPass` occurrences where they are * Must we force more? * Perhaps we should place this behind a `-ftimings` instead of `-v2` Test Plan: `ghc -v2 Test.hs`, look at the output Reviewers: hvr, goldfire, simonmar, austin Reviewed By: simonmar Subscribers: angerman, michalt, niteria, ezyang, thomie Differential Revision: https://phabricator.haskell.org/D1959
* LlvmCodeGen: Fix generation of malformed LLVM blocksErik de Castro Lopo2016-03-121-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 673efccb3b uncovered a bug in LLVM code generation that produced LLVM code that the LLVM compiler refused to compile: { clpH: br label %clpH } This may well be a bug in LLVM itself. The solution is to keep the existing entry label and rewrite the function as: { clpH: br label %nPV nPV: br label %nPV } Thanks to Ben Gamari for pointing me in the right direction on this one. Test Plan: Build GHC with BuildFlavour=quick-llvm Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1996 GHC Trac Issues: #11649
* Add MonadUnique instance for LlvmMBen Gamari2016-03-112-9/+16
| | | | | | | | | | Reviewers: erikd, austin Reviewed By: erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1994
* 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
* Typos in commentsGabor Greif2016-01-271-1/+1
|
* Remove some redundant definitions/constraintsHerbert Valerio Riedel2015-12-311-1/+0
| | | | | | Starting with GHC 7.10 and base-4.8, `Monad` implies `Applicative`, which allows to simplify some definitions to exploit the superclass relationship. This a first refactoring to that end.
* Drop pre-AMP compatibility CPP conditionalsHerbert Valerio Riedel2015-12-312-7/+0
| | | | | | | | | | | | Since GHC 8.1/8.2 only needs to be bootstrap-able by GHC 7.10 and GHC 8.0 (and GHC 8.2), we can now finally drop all that pre-AMP compatibility CPP-mess for good! Reviewers: austin, goldfire, bgamari Subscribers: goldfire, thomie, erikd Differential Revision: https://phabricator.haskell.org/D1724
* LLVM backend: Show expected LLVM version in warnings/errorsÖmer Sinan Ağacan2015-12-182-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before: [1 of 1] Compiling Main ( Main.hs, Main.o ) You are using a new version of LLVM that hasn't been tested yet! We will try though... After: [1 of 1] Compiling Main ( Main.hs, Main.o ) You are using an unsupported version of LLVM! Currently only 3.7 is supported. We will try though... Before: [1 of 1] Compiling Main ( Main.hs, Main.o ) <no location info>: Warning: Couldn't figure out LLVM version! Make sure you have installed LLVM ghc: could not execute: opt After: [1 of 1] Compiling Main ( Main.hs, Main.o ) <no location info>: error: Warning: Couldn't figure out LLVM version! Make sure you have installed LLVM 3.7 ghc-stage1: could not execute: opt Reviewers: austin, rwbarton, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1658
* Make HasDynFlags more transformers friendlyHerbert Valerio Riedel2015-12-081-5/+5
| | | | | | | | | | | | | | | | | Ideally, we'd have the more general instance (MonadTrans t, Monad m, HasDynFlags m) => HasDynFlags (t m) where getDynFlags = lift getDynFlags definition. However, that one would overlap with the `HasDynFlags (GhcT m)` instance. Instead we define instances for a couple of common Monad transformers explicitly in order to avoid nasty overlapping instances. This is a preparatory refactoring for #10874 Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D1581
* Implement warnings for Semigroups as parent of MonoidDavid Luposchainsky2015-11-291-0/+10
| | | | | | | | | | | | | | | | | | | | | This patch is similar to the AMP patch (#8004), which offered two functions: 1. Warn when an instance of a class has been given, but the type does not have a certain superclass instance 2. Warn when top-level definitions conflict with future Prelude names These warnings are issued as part of the new `-Wcompat` warning group. Reviewers: hvr, ekmett, austin, bgamari Reviewed By: hvr, ekmett, bgamari Subscribers: ekmett, thomie Differential Revision: https://phabricator.haskell.org/D1539 GHC Trac Issues: #11139
* Implement function-sections for Haskell code, #8405Simon Brenner2015-11-124-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a flag -split-sections that does similar things to -split-objs, but using sections in single object files instead of relying on the Satanic Splitter and other abominations. This is very similar to the GCC flags -ffunction-sections and -fdata-sections. The --gc-sections linker flag, which allows unused sections to actually be removed, is added to all link commands (if the linker supports it) so that space savings from having base compiled with sections can be realized. Supported both in LLVM and the native code-gen, in theory for all architectures, but really tested on x86 only. In the GHC build, a new SplitSections variable enables -split-sections for relevant parts of the build. Test Plan: validate with both settings of SplitSections Reviewers: dterei, Phyx, austin, simonmar, thomie, bgamari Reviewed By: simonmar, thomie, bgamari Subscribers: hsyl20, erikd, kgardas, thomie Differential Revision: https://phabricator.haskell.org/D1242 GHC Trac Issues: #8405
* cmm: Expose machine's stack and return address registerBen Gamari2015-11-011-0/+1
| | | | | | | | | | We will need to use these to setup proper unwinding information for the stg_stop_thread closure. This pokes a hole in the STG abstraction, exposing the machine's stack pointer register so that we can accomplish this. We also expose a dummy return address register, which corresponds to the register used to hold the DWARF return address. Differential Revision: https://phabricator.haskell.org/D1225
* llvmGen: Really fix build with ClangErik de Castro Lopo2015-11-011-5/+6
| | | | | | | | | | Test Plan: Build with Clang and GCC Reviewers: austin, thomie, hvr, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1414
* llvmGen: Fix build with ClangErik de Castro Lopo2015-11-011-2/+2
| | | | | | | | | | | | | Another weird case of Clang not accepting whitespace in CPP that GCC accepts without a problem. Test Plan: Build with Clang and GCC Reviewers: austin, thomie, hvr, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1409
* Add subWordC# on x86ishNikita Karetnikov2015-10-311-2/+11
| | | | | | | | | | | | | | | This adds a subWordC# primop which implements subtraction with overflow reporting. Reviewers: tibbe, goldfire, rwbarton, bgamari, austin, hvr Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1334 GHC Trac Issues: #10962
* Make Monad/Applicative instances MRP-friendlyHerbert Valerio Riedel2015-10-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This patch refactors pure/(*>) and return/(>>) in MRP-friendly way, i.e. such that the explicit definitions for `return` and `(>>)` match the MRP-style default-implementation, i.e. return = pure and (>>) = (*>) This way, e.g. all `return = pure` definitions can easily be grepped and removed in GHC 8.1; Test Plan: Harbormaster Reviewers: goldfire, alanz, bgamari, quchen, austin Reviewed By: quchen, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1312
* Fix GHCi on Arm (#10375).Erik de Castro Lopo2015-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Arm has two instruction sets, Arm and Thumb, and an execution mode for each. Executing Arm code in Thumb mode or vice-versa will likely result in an Illegal instruction exception. Furthermore, Haskell code compiled via LLVM was generating Arm instructions while C code compiled via GCC was generating Thumb code by default. When these two object code types were being linked by the system linker, all was fine, because the system linker knows how to jump and call from one instruction set to the other. The first problem was with GHCi's object code loader which did not know about Thumb vs Arm. When loading an object file `StgCRun` would jump into the loaded object which could change the mode causing a crash after it returned. This was fixed by forcing all C code to generate Arm instructions by passing `-marm` to GCC. The second problem was the `mkJumpToAddr` function which was generating Thumb instructions. Changing that to generate Arm instructions instead results in a working GHCi on Arm. Test Plan: validate on x86_64 and arm Reviewers: bgamari, austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1323 GHC Trac Issues: #10375
* Switch to LLVM version 3.7Erik de Castro Lopo2015-10-144-27/+23
| | | | | | | | | | | | | | | | | | | | | | | | 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-104-23/+29
| | | | | | Pushed by mistacke before it was ready. This reverts commit 5dc3db743ec477978b9727a313951be44dbd170f.
* Switch to LLVM version 3.7Erik de Castro Lopo2015-10-104-32/+26
|
* LLVM: Factor out accumulation of LLVM statements and variablesBen Gamari2015-10-021-197/+189
| | | | | | | | | | | | | | | | | | | | | | The LLVM code generator currently has a rather large amount of boilerplate devoted to piping around and building up various AST elements. This is rather unfortunate for a language which prides itself on ease of abstraction and detracts from readability. Here I continue a refactoring that I originally suggested in D991, using `WriterT` to factor out this pattern. `WriterT` is in general a bit problematic from an evaluation perspective, but the expressions here are small enough that it should be a problem in practice. Test Plan: Validate Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1286
* LLVM: Implement atomic operations in terms of LLVM primitivesBen Gamari2015-10-025-17/+124
| | | | | | | | | | | | | | | | | | | 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
* Annotate CmmBranch with an optional likely targetSimon Marlow2015-09-231-1/+1
| | | | | | | | | | | | | | | | | Summary: This allows the code generator to give hints to later code generation steps about which branch is most likely to be taken. Right now it is only taken into account in one place: a special case in CmmContFlowOpt that swapped branches over to maximise the chance of fallthrough, which is now disabled when there is a likelihood setting. Test Plan: validate Reviewers: austin, simonpj, bgamari, ezyang, tibbe Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1273
* llvmGen: Rework LLVM manglerBen Gamari2015-08-061-102/+81
| | | | | | | | | | | | | | | | | | | | The LLVM mangler does not currently transform AVX instructions on x86-64 platforms, due to a missing #include. Also, it is significantly more complicated than necessary, due to the file into sections (not needed anymore), and is sensitive to the details of the whitespace in the assembly. Author: dobenour Test Plan: Validation on x86-64, x86-32, and ARM Reviewers: austin Subscribers: thomie, bgamari, rwbarton Differential Revision: https://phabricator.haskell.org/D1034 GHC Trac Issues: #10394
* Typos in comments [skip ci]Gabor Greif2015-08-031-1/+1
|
* Support MO_U_QuotRem2 in LLVM backendMichal Terepeta2015-08-031-0/+72
| | | | | | | | | | | | | | | | | | | This adds support for MO_U_QuotRem2 in LLVM backend. Similarly to MO_U_Mul2 we use the standard LLVM instructions (in this case 'udiv' and 'urem') but do the computation on double the word width (e.g., for 64-bit we will do them on 128 registers). Test Plan: validate Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1100 GHC Trac Issues: #9430
* LlvmCodeGen: add support for MO_U_Mul2 CallishMachOpMichal Terepeta2015-07-201-0/+34
| | | | | | | | | | | | | | | | | | | This adds support MO_U_Mul2 to the LLVM backend by simply using 'mul' instruction but operating at twice the bit width (e.g., for 64 bit words we will generate mul that operates on 128 bits and then extract the two 64 bit values for the result of the CallishMachOp). Test Plan: validate Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1068 GHC Trac Issues: #9430
* Support MO_{Add,Sub}IntC and MO_Add2 in the LLVM backendMichal Terepeta2015-07-044-4/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Encode alignment in MO_Memcpy and friendsBen Gamari2015-06-161-23/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Alignment needs to be a compile-time constant. Previously the code generators had to jump through hoops to ensure this was the case as the alignment was passed as a CmmExpr in the arguments list. Now we take care of this up front. This fixes #8131. Authored-by: Reid Barton <rwbarton@gmail.com> Dusted-off-by: Ben Gamari <ben@smart-cactus.org> Tests for T8131 Test Plan: Validate Reviewers: rwbarton, austin Reviewed By: rwbarton, austin Subscribers: bgamari, carter, thomie Differential Revision: https://phabricator.haskell.org/D624 GHC Trac Issues: #8131
* Remove unneeded compatibility with LLVM < 3.6Michal Terepeta2015-05-191-35/+9
| | | | | | | | | | | Since GHC requires at least LLVM 3.6, some of the special cases (for, e.g., LLVM 2.8 or 2.9) in the LLVM CodeGen can be simply removed. Reviewed By: rwbarton, austin Differential Revision: https://phabricator.haskell.org/D884 GHC Trac Issues: #10074