summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Remove use of -fno-asm-mangling flag; fixes #5134Ian Lynagh2011-04-201-1/+0
| | | | | | | | | | | | | | | | The flag no longer exists, but we always behave as if it had been used.
| * | | LLVM: Fix #5131. Add support for missing stg regsDavid Terei2011-04-191-0/+2
| | | |
* | | | Pretty-print type variables that are operators correctlySimon Peyton Jones2011-04-201-5/+8
|/ / / | | | | | | | | | Fixes Trac #5141. Thanks to Adam Megacz.
* | | Slightly better tracing in the constraint solversimonpj2011-04-193-33/+42
| | |
* | | Fix Trac #5038 (missing free variable in ifThenElse rebindable syntax)simonpj2011-04-192-8/+16
| | |
* | | Simplify treatement of pragmas slightlysimonpj2011-04-191-16/+6
| | |
* | | Fix typo in commentsimonpj2011-04-191-1/+1
| | |
* | | Remove unused function sigForThisGroupsimonpj2011-04-191-6/+2
| | |
* | | Fix Trac #5045: add ticks to HsArrFormssimonpj2011-04-191-1/+15
| | | | | | | | | | | | | | | I don't know why these were left out. I did the obvious thing... I hope it's right!
* | | Fix Trac #5041: parse the trailing '#'simonpj2011-04-191-13/+18
| | | | | | | | | | | | | | | This matters for constructors and field labels that have a trailing hash (MagicHash language extension).
* | | Make ghc less keen to pass -v to gcc and friendsIan Lynagh2011-04-172-35/+36
| | | | | | | | | | | | Also a small refactoring in how the verbosity flag is handled.
* | | Revert "Generalized assignment rewriting pass."Edward Z. Yang2011-04-152-398/+103
| | | | | | | | | | | | This reverts commit 2ec796239b782505cfb305af2789abcfa820baaf.
* | | Generalized assignment rewriting pass.Edward Z. Yang2011-04-152-103/+398
| | | | | | | | | | | | | | | | | | | | | This assignment rewriting pass subsumes the previous reload sinking pass, and also performs basic inlining. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | | Disable check word address lint check, due to inlined pointer tags.Edward Z. Yang2011-04-151-7/+8
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | | Add GenCmmGraph, which is a generic version of CmmGraph.Edward Z. Yang2011-04-152-9/+14
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | | Add a final newline to the link-time C file that we generate,Simon Marlow2011-04-141-1/+4
| |/ |/| | | | | otherwise some versions of gcc complain about a missing final newline.
* | For BC labels, emit empty data section instead of empty proc.Edward Z. Yang2011-04-142-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two bugs: - The new code generator doesn't like procedures with empty graphs, and panicked in labelAGraph. - LLVM optimizes away empty procedures but not empty data sections, so now the backwards-compatibility labels actually work with -fllvm. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | Add adjustUFM, adjustUFM_Directly and joinUFM to UniqFM.Edward Z. Yang2011-04-132-8/+30
| | | | | | | | | | | | | | Renamed adjustUFM in GraphOps to adjustUFM_C, to account for alternate argument order. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | Always support optimization fuel.Edward Z. Yang2011-04-131-14/+0
| | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | Update CmmRegOff shorthand for CmmMachOp.Edward Z. Yang2011-04-131-2/+4
|/ | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Change the way module initialisation is done (#3252, #4417)Simon Marlow2011-04-1218-540/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the code generator generated small code fragments labelled with __stginit_M for each module M, and these performed whatever initialisation was necessary for that module and recursively invoked the initialisation functions for imported modules. This appraoch had drawbacks: - FFI users had to call hs_add_root() to ensure the correct initialisation routines were called. This is a non-standard, and ugly, API. - unless we were using -split-objs, the __stginit dependencies would entail linking the whole transitive closure of modules imported, whether they were actually used or not. In an extreme case (#4387, #4417), a module from GHC might be imported for use in Template Haskell or an annotation, and that would force the whole of GHC to be needlessly linked into the final executable. So now instead we do our initialisation with C functions marked with __attribute__((constructor)), which are automatically invoked at program startup time (or DSO load-time). The C initialisers are emitted into the stub.c file. This means that every time we compile with -prof or -hpc, we now get a stub file, but thanks to #3687 that is now invisible to the user. There are some refactorings in the RTS (particularly for HPC) to handle the fact that initialisers now get run earlier than they did before. The __stginit symbols are still generated, and the hs_add_root() function still exists (but does nothing), for backwards compatibility.
* Cleanup sweep and fix a bug in RTS flag processing.Simon Marlow2011-04-121-3/+3
| | | | | | | | | | | | | This code has accumulated a great deal of cruft over the years, this pass cleans up a lot of the surrounding cruft but leaves the actual argument processing alone - so there's still more that could be done. Bug fixed: - ghc_rts_opts should not be subject to the --rtsopts setting. If the programmer explicitly declares options with ghc_rts_opts, they shouldn't also have to accept command-line RTS options to make them work.
* Remove debugging CmmComment from old code generator.Edward Z. Yang2011-04-111-1/+0
| | | | | | | Warning: This change seems to tickle a bug in ghc-stage1 compiler built with GHC 6.12.1 during validates. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Flag for defaulting the codegen GhcStageXDefaultNewCodegen.Edward Z. Yang2011-04-112-0/+16
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Implement mapUFM_Directly.Edward Z. Yang2011-04-111-1/+3
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Unsafe foreign calls (fat machine instructions) do not kill all registers.Edward Z. Yang2011-04-113-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | The new code generator was doing some interesting spilling across unsafe foreign calls: _c1ao::I32 = Hp - 4; I32[Sp - 20] = _c1ao::I32; foreign "ccall" newCAF((BaseReg, PtrHint), (R1, PtrHint))[_unsafe_call_]; _c1ao::I32 = I32[Sp - 20]; This is fairly unnecessary, and resulted from over-conservative liveness analysis from CmmLive. We can see that the old code generator only saved volatile registers across unsafe foreign calls: spilling variables was done by saveVolatileVarsAndRegs, which was only performed for ordinary calls. This commit removes the excess kill from the liveness analysis, as well as the *redundant* excess kill from spilling-and-reloading, and adds a note to CmmNode to this effect. The only registers we need to kill are the ones that the foreign call assigns to, just like any other machine instruction. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* tweak to cleanTempFilesExceptSimon Marlow2011-04-111-1/+1
|
* add casMutVar#Simon Marlow2011-04-111-0/+6
|
* Whitespace only in main/Finder.lhsIan Lynagh2011-04-091-123/+121
|
* Force re-linking if the options have changed (#4451)Simon Marlow2011-04-085-45/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common sequence of commands (at least for me) is this: $ ghc hello 1 of 1] Compiling Main ( hello.hs, hello.o ) Linking hello ... $ ./hello +RTS -s hello: Most RTS options are disabled. Link with -rtsopts to enable them. $ ghc hello -rtsopts $ grr, nothing happened. I could use -fforce-recomp, but if this was a large program I probably don't want to recompile it all again, so: $ rm hello removed `hello' $ ghc hello -rtsopts Linking hello ... $ ./hello +RTS -s ./hello +RTS -s Hello World! 51,264 bytes allocated in the heap 2,904 bytes copied during GC 43,808 bytes maximum residency (1 sample(s)) 17,632 bytes maximum slop etc. With this patch, GHC notices when the options have changed and forces a relink, so you don't need to rm the binary or use -fforce-recomp. This is done by adding the pertinent stuff to the binary in a special section called ".debug-ghc-link-info": $ readelf -p .debug-ghc-link-info ./hello String dump of section 'ghc-linker-opts': [ 0] (["-lHSbase-4.3.1.0","-lHSinteger-gmp-0.2.0.2","-lgmp","-lHSghc-prim-0.2.0.0","-lHSrts","-lm","-lrt","-ldl","-u","ghczmprim_GHCziTypes_Izh_static_info","-u","ghczmprim_GHCziTypes_Czh_static_info","-u","ghczmprim_GHCziTypes_Fzh_static_info","-u","ghczmprim_GHCziTypes_Dzh_static_info","-u","base_GHCziPtr_Ptr_static_info","-u","base_GHCziWord_Wzh_static_info","-u","base_GHCziInt_I8zh_static_info","-u","base_GHCziInt_I16zh_static_info","-u","base_GHCziInt_I32zh_static_info","-u","base_GHCziInt_I64zh_static_info","-u","base_GHCziWord_W8zh_static_info","-u","base_GHCziWord_W16zh_static_info","-u","base_GHCziWord_W32zh_static_info","-u","base_GHCziWord_W64zh_static_info","-u","base_GHCziStable_StablePtr_static_info","-u","ghczmprim_GHCziTypes_Izh_con_info","-u","ghczmprim_GHCziTypes_Czh_con_info","-u","ghczmprim_GHCziTypes_Fzh_con_info","-u","ghczmprim_GHCziTypes_Dzh_con_info","-u","base_GHCziPtr_Ptr_con_info","-u","base_GHCziPtr_FunPtr_con_info","-u","base_GHCziStable_StablePtr_con_info","-u","ghczmprim_GHCziTypes_False_closure","-u","ghczmprim_GHCziTypes_True_closure","-u","base_GHCziPack_unpackCString_closure","-u","base_GHCziIOziException_stackOverflow_closure","-u","base_GHCziIOziException_heapOverflow_closure","-u","base_ControlziExceptionziBase_nonTermination_closure","-u","base_GHCziIOziException_blockedIndefinitelyOnMVar_closure","-u","base_GHCziIOziException_blockedIndefinitelyOnSTM_closure","-u","base_ControlziExceptionziBase_nestedAtomically_closure","-u","base_GHCziWeak_runFinalizzerBatch_closure","-u","base_GHCziTopHandler_runIO_closure","-u","base_GHCziTopHandler_runNonIO_closure","-u","base_GHCziConcziIO_ensureIOManagerIsRunning_closure","-u","base_GHCziConcziSync_runSparks_closure","-u","base_GHCziConcziSignal_runHandlers_closure","-lHSffi"],Nothing,RtsOptsAll,False,[],[]) And GHC itself uses the readelf command to extract it when deciding whether to relink. The reason for the name ".debug-ghc-link-info" is that sections beginning with ".debug" are removed automatically by strip. This currently only works on Linux; Windows and OS X still have the old behaviour.
* bugfix for stub generation: create the directory for the _stub.h file,Simon Marlow2011-04-081-1/+1
| | | | | not the _stub.c file, because the latter is now created as a temporary file.
* Merge remote branch 'origin/patch-4404'Ian Lynagh2011-04-073-3/+88
|\
| * Ignore names introduced "implicitly" in unused-variable warnings (Fix #4404)wip/T4404Max Bolingbroke2011-04-023-3/+88
| | | | | | | | | | We collect variables introduced by the {...} part of a let-like record wildcard pattern and do not warn if the user then doesn't actually use them.
* | Fix bug in X86 codegen: use GMOV instead of MOV for F64 w/o SSE2.Edward Z. Yang2011-04-061-1/+1
| | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | Merge remote branch 'origin'Simon Marlow2011-04-061-1/+1
|\ \ | | | | | | | | | | | | * origin: Revert "Suppress dumpTcRn when -dno-debug-output is enabled."
| * | Revert "Suppress dumpTcRn when -dno-debug-output is enabled."Edward Z. Yang2011-04-061-1/+1
| | | | | | | | | | | | This reverts commit 12929a219671cd7794b5a533cebdfef11d2f8ff4.
* | | Merge branch 'trac_5025' of https://github.com/thoughtpolice/ghcSimon Marlow2011-04-062-6/+12
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | * 'trac_5025' of https://github.com/thoughtpolice/ghc: Teach GHC to compile objective-c files; trac #5025 Conflicts: compiler/main/DriverPipeline.hs
| * | Teach GHC to compile objective-c files; trac #5025Austin Seipp2011-04-032-6/+12
| | |
* | | Fix -split-objs: there was a bad interaction with the recent changesSimon Marlow2011-04-061-2/+11
| | | | | | | | | | | | to the way stub files were handled.
* | | CmmOpt cannot assume single assignment for hand-written or new codegen Cmm.Edward Z. Yang2011-04-051-6/+14
| | | | | | | | | | | | | | | | | | | | | This change may constitute a substantial performance hit, due to the new creation of a set for every instruction we emit. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | | Suppress dumpTcRn when -dno-debug-output is enabled.Edward Z. Yang2011-04-051-1/+1
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | | Merge branch 'master' of /home/simonmar/ghc-gitSimon Marlow2011-04-052-12/+29
|\ \ \
| * | | Give infinite fuel to required C-- transformations. Fixes #4971.Edward Z. Yang2011-04-052-12/+29
| | | | | | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | | | allocateRegsAndSpill: disable a panic for the time being (see comment)Simon Marlow2011-04-051-1/+8
| | | |
* | | | fix warningSimon Marlow2011-04-051-1/+1
| | | |
* | | | Merge _stub.o files into the main .o file (Fixes #3687 and #706)Simon Marlow2011-04-057-249/+364
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now GHC still generates the _stub.c files, but the object file is automatically merged into the main .o file for a module. This means that build systems (including GHC's own) no longer need to worry about looking for _stub.o files and including them when linking. I had to do lots of refactoring in DriverPipeline to make this work; now there's a monad to carry around all the information, and everything is a lot tidier. The _stub.c is now created as a temporary file and removed after compilation (unless the -keep-tmp-files flag is on).
* | | | remove ^Ms; comment updatesSimon Marlow2011-04-051-1463/+1465
|/ / /
* | | Fix linear register allocator bug involving read/write to same registers.Edward Z. Yang2011-04-051-24/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we read a temporary value from memory, we should update its assignment to be both in memory and in register. This was only occurring when there was a free register, but not if we needed to spill an existing value in a register to the stack. I generalized the code for this case and applied it to the other two cases where this occurs (spilled value is in memory and in a register, and when the spilled value is only in a register.) Furthermore, I tightened the invariants on allocRegsAndSpill_spill with a new data type SpillLoc that captures more precisely than Maybe Loc the possible locations we are spilling from. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | | Remove dead code, now that -fvia-c is a no-opIan Lynagh2011-04-045-176/+33
| | |
* | | Fix typos and add Outputable constraints to aid debugging.Edward Z. Yang2011-04-041-7/+7
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>