summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/AsmCodeGen.lhs
Commit message (Collapse)AuthorAgeFilesLines
* Unlit AsmCodeGen.lhsHerbert Valerio Riedel2014-11-301-1044/+0
| | | | Fwiw, this wasn't really a proper .lhs to begin with...
* Some refactoring around endPass and debug dumpingSimon Peyton Jones2014-11-041-4/+4
| | | | | I forget all the details, but I spent some time trying to understand the current setup, and tried to simplify it a bit
* Stop exporting, and stop using, functions marked as deprecatedThomas Miedema2014-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Don't export `getUs` and `getUniqueUs`. `UniqSM` has a `MonadUnique` instance: instance MonadUnique UniqSM where getUniqueSupplyM = getUs getUniqueM = getUniqueUs getUniquesM = getUniquesUs Commandline-fu used: git grep -l 'getUs\>' | grep -v compiler/basicTypes/UniqSupply.lhs | xargs sed -i 's/getUs/getUniqueSupplyM/g git grep -l 'getUniqueUs\>' | grep -v combiler/basicTypes/UniqSupply.lhs | xargs sed -i 's/getUniqueUs/getUniqueM/g' Follow up on b522d3a3f970a043397a0d6556ca555648e7a9c3 Reviewed By: austin, hvr Differential Revision: https://phabricator.haskell.org/D220
* Make Applicative a superclass of MonadAustin Seipp2014-09-091-4/+6
| | | | | | | | | | | | | | | | | | | | | Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
* Rename PackageId to PackageKey, distinguishing it from Cabal's PackageId.Edward Z. Yang2014-07-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, both Cabal and GHC defined the type PackageId, and we expected them to be roughly equivalent (but represented differently). This refactoring separates these two notions. A package ID is a user-visible identifier; it's the thing you write in a Cabal file, e.g. containers-0.9. The components of this ID are semantically meaningful, and decompose into a package name and a package vrsion. A package key is an opaque identifier used by GHC to generate linking symbols. Presently, it just consists of a package name and a package version, but pursuant to #9265 we are planning to extend it to record other information. Within a single executable, it uniquely identifies a package. It is *not* an InstalledPackageId, as the choice of a package key affects the ABI of a package (whereas an InstalledPackageId is computed after compilation.) Cabal computes a package key for the package and passes it to GHC using -package-name (now *extremely* misnamed). As an added bonus, we don't have to worry about shadowing anymore. As a follow on, we should introduce -current-package-key having the same role as -package-name, and deprecate the old flag. This commit is just renaming. The haddock submodule needed to be updated. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D79 Conflicts: compiler/main/HscTypes.lhs compiler/main/Packages.lhs utils/haddock
* Some typos in commentsGabor Greif2014-06-111-1/+1
|
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-1/+2
| | | | | | | | | | | | | | | | | | 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.
* ghc: initial AArch64 patchesColin Watson2014-04-211-0/+1
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Disable -fregs-graph (#7679, #8657)Simon Marlow2014-01-161-2/+4
|
* Fix AMP warnings.Austin Seipp2013-09-111-0/+8
| | | | | Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add basic support for GHCJSAustin Seipp2013-09-061-0/+1
| | | | | | | | | | | | | | | | | | | 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 <stegeman@gmail.com> Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Make the current module available to labelDynamicIan Lynagh2013-05-131-31/+38
| | | | It doesn't actually use it yet
* Refactor cmmMakeDynamicReferenceIan Lynagh2013-05-131-2/+5
| | | | | It now has its own class, and the addImport function is defined in that class, rather than needing to be passed as an argument.
* Simplify away some old -dynamic-too stuff from the previous approachIan Lynagh2013-03-091-48/+33
|
* AsmCodeGen.NcgImpl.ncgMakeFarBranches should take account of info tables (#709)PHO2013-02-021-4/+4
| | | | We have to reduce the maximum number of instructions to jump over depending on the number of info tables in a proc.
* Move AsmCodeGen.makeFarBranches to PPC.Instr (#709)PHO2013-02-021-38/+1
| | | | Its implementation is totally specific to PPC.
* Fix bugs in allocMoreStack (#7498, #7510)Simon Marlow2013-01-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | There were four bugs here. Clearly I didn't test this enough to expose the bugs - it appeared to work on x86/Linux, but completely by accident it seems. 1. the delta was wrong by a factor of the slot size (as noted on #7498) 2. we weren't correctly aligning the stack pointer (sp needs to be 16-byte aligned on x86/x86_64) 3. we were doing the adjustment multiple times in the case of a block that was both a return point and a local branch target. To fix this I had to add new shim blocks to adjust the stack pointer, and retarget the original branches. See comment for details. 4. we were doing the adjustment for CALL instructions, which is unnecessary and wrong; only JMPs should be preceded by a stack adjustment. (Someone with a PPC box will need to update the PPC version of allocMoreStack to fix the above bugs, using the x86 version as a guide.)
* Small refactoring: makes it easier to see what nativeCodeGen actually doesIan Lynagh2012-12-161-64/+74
|
* PPC: Implement stack resizing for the linear register allocator.Erik de Castro Lopo2012-12-161-1/+1
| | | | Fixes #7498.
* Small code tidy-upIan Lynagh2012-12-121-8/+7
|
* typoGabor Greif2012-12-121-1/+1
|
* Implement the -dynamic-too optimised path for the NCGIan Lynagh2012-12-111-32/+32
| | | | | | | | We don't yet have the slow path, for when we have to fall back to separate compilation. We also only currently handle the case qhere we're compiling Haskell code with the NCG.
* Add more plumbing to the nativeCodeGenIan Lynagh2012-12-111-30/+56
| | | | | This patch adds more of the plumbing necessary to allow the nativeGen to build multiple ways in a single compilation.
* Tweak how 'count' is handled in the nativeCodeGenIan Lynagh2012-12-111-5/+4
| | | | | We were always passing 0 to cmmNativeGenStream, so now the 0 is just hardcoded there.
* Package the NativeGen state up into a named typeIan Lynagh2012-12-111-35/+26
| | | | | This will make it a little more pleasant to have the nativegen build for multiple ways at once.
* Small refactoring: Use more idiomatic strictness forcing in AsmCodeGenIan Lynagh2012-12-111-7/+5
|
* Make nativeCodeGen return the rest of its UniqSupplyIan Lynagh2012-12-061-7/+9
|
* Tell the compiler about alpha, mipseb and mipsel again; fixes #7339Ian Lynagh2012-11-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts the compiler parts of commit 7b594a5d7ac29972db39228e9c8b7f384313f39b Author: David Terei <davidterei@gmail.com> Date: Mon Nov 21 12:05:18 2011 -0800 Remove registerised code for dead architectures: mips, ia64, alpha, hppa1, m68k In particular, we want to know whether bewareLoadStoreAlignment should return True or False for them. It also reverts commit 3fc68b5c356b39b2b52a86d953367d0021c13262 Author: Simon Marlow <marlowsd@gmail.com> Date: Wed Jan 4 11:44:02 2012 +0000 Remove missing archs (mipseb, mipsel, alpha) (#5734) It doesn't hurt to map these to ArchUnknown since we don't need to know anything specific about them, and adding them would be a pain (there are a bunch of places where we have to case-match on all the arches to avoid warnings).
* Fix warningsSimon Marlow2012-11-121-1/+0
|
* Remove OldCmm, convert backends to consume new CmmSimon Marlow2012-11-121-34/+32
| | | | | | | | | | | | | | | | | | 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.
* Attach global register liveness info to Cmm procedures.Geoffrey Mainland2012-10-301-14/+14
| | | | | | | 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.
* Refactor the way dump flags are handledIan Lynagh2012-10-181-4/+4
| | | | | | | | | | | | | We were being inconsistent about how we tested whether dump flags were enabled; in particular, sometimes we also checked the verbosity, and sometimes we didn't. This lead to oddities such as "ghc -v4" printing an "Asm code" section which didn't contain any code, and "-v4" enabled some parts of "-ddump-deriv" but not others. Now all the tests use dopt, which also takes the verbosity into account as appropriate.
* Some alpha renamingIan Lynagh2012-10-161-10/+10
| | | | | Mostly d -> g (matching DynFlag -> GeneralFlag). Also renamed if* to when*, matching the Haskell if/when names
* Produce new-style Cmm from the Cmm parserSimon Marlow2012-10-081-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove some old-codegen cruftSimon Marlow2012-09-251-12/+3
|
* Teach the linear register allocator how to allocate more stack if necessarySimon Marlow2012-09-201-20/+50
| | | | | | | | | This squashes the "out of spill slots" panic that occasionally happens on x86, by adding instructions to bump and retreat the C stack pointer as necessary. The panic has become more common since the new codegen, because we lump code into larger blocks, and the register allocator isn't very good at reusing stack slots for spilling (see Note [extra spill slots]).
* Move some more constants into platformConstantsIan Lynagh2012-09-141-3/+3
|
* Pass DynFlags down to wordWidthIan Lynagh2012-09-121-7/+7
|
* Pass DynFlags down to bWordIan Lynagh2012-09-121-1/+1
| | | | | | I've switched to passing DynFlags rather than Platform, as (a) it's simpler to not have to extract targetPlatform in so many places, and (b) it may be useful to have DynFlags around in future.
* Move more code into codeGen/CodeGen/Platform.hsIan Lynagh2012-08-281-1/+1
| | | | | | | | HaskellMachRegs.h is no longer included in anything under compiler/ Also, includes/CodeGen.Platform.hs now includes "stg/MachRegs.h" rather than <stg/MachRegs.h> which means that we always get the file from the tree, rather than from the bootstrapping compiler.
* Fix -fPIC with the new code generatorSimon Marlow2012-08-281-0/+6
| | | | The CmmBlocks inside CmmExprs were not getting the PIC treatment
* Pass platform down to lastxmmIan Lynagh2012-08-211-5/+5
|
* Move activeStgRegs into CodeGen.PlatformIan Lynagh2012-08-211-1/+1
|
* Disable the mini-inliner when using the new codegenSimon Marlow2012-08-021-1/+4
| | | | | The new sinker is at least as powerful, and the mini-inliner sometimes even makes things worse.
* New codegen: do not split proc-points when using the NCGSimon Marlow2012-07-301-26/+32
| | | | | | | | | 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.
* Remove pprNatCmmDecl's Platform argumentIan Lynagh2012-07-241-9/+7
|
* Make -fPIC a dynamic flagIan Lynagh2012-07-161-13/+12
| | | | | | Hopefully I've kept the logic the same, and we now generate warnings if the user does -fno-PIC but we ignore them (e.g. because they're on OS X amd64).
* Fix merge-related problemsSimon Marlow2012-07-041-1/+1
|
* Merge remote-tracking branch 'origin/master' into newcgSimon Marlow2012-07-041-327/+320
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/master: (756 commits) don't crash if argv[0] == NULL (#7037) -package P was loading all versions of P in GHCi (#7030) Add a Note, copying text from #2437 improve the --help docs a bit (#7008) Copy Data.HashTable's hashString into our Util module Build fix Build fixes Parse error: suggest brackets and indentation. Don't build the ghc DLL on Windows; works around trac #5987 On Windows, detect if DLLs have too many symbols; trac #5987 Add some more Integer rules; fixes #6111 Fix PA dfun construction with silent superclass args Add silent superclass parameters to the vectoriser Add silent superclass parameters (again) Mention Generic1 in the user's guide Make the GHC API a little more powerful. tweak llvm version warning message New version of the patch for #5461. Fix Word64ToInteger conversion rule. Implemented feature request on reconfigurable pretty-printing in GHCi (#5461) ... Conflicts: compiler/basicTypes/UniqSupply.lhs compiler/cmm/CmmBuildInfoTables.hs compiler/cmm/CmmLint.hs compiler/cmm/CmmOpt.hs compiler/cmm/CmmPipeline.hs compiler/cmm/CmmStackLayout.hs compiler/cmm/MkGraph.hs compiler/cmm/OldPprCmm.hs compiler/codeGen/CodeGen.lhs compiler/codeGen/StgCmm.hs compiler/codeGen/StgCmmBind.hs compiler/codeGen/StgCmmLayout.hs compiler/codeGen/StgCmmUtils.hs compiler/main/CodeOutput.lhs compiler/main/HscMain.hs compiler/nativeGen/AsmCodeGen.lhs compiler/simplStg/SimplStg.lhs
| * Remove some more redundant Platform argumentsIan Lynagh2012-06-201-1/+1
| |