summaryrefslogtreecommitdiff
path: root/ghc/compiler/nativeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [project @ 2002-10-27 21:47:36 by wolfgang]wolfgang2002-10-271-3/+2
| | | | Fix a type and a bug for PowerPC.
* [project @ 2002-10-14 15:50:14 by sof]sof2002-10-141-0/+3
| | | | make it compile again (x86)
* [project @ 2002-10-12 23:28:48 by wolfgang]wolfgang2002-10-126-45/+1445
| | | | | | | | | | | The Native Code Generator for PowerPC. Still to be done: *) Proper support of Floats and Doubles currently it seems to work, but it's just guesswork. *) Some missing operations, only needed for -O, AFAICT. *) Mach-O dynamic linker stub generation. (can't import foreign functions from dynamic libraries, and it might fail for big programs)
* [project @ 2002-09-13 16:09:26 by simonpj]simonpj2002-09-131-1/+3
| | | | Native code gen primpops (courtesy Julian)
* [project @ 2002-09-13 15:02:25 by simonpj]simonpj2002-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------------------------- Make Template Haskell into the HEAD -------------------------------------- This massive commit transfers to the HEAD all the stuff that Simon and Tim have been doing on Template Haskell. The meta-haskell-branch is no more! WARNING: make sure that you * Update your links if you are using link trees. Some modules have been added, some have gone away. * Do 'make clean' in all library trees. The interface file format has changed, and you can get strange panics (sadly) if GHC tries to read old interface files: e.g. ghc-5.05: panic! (the `impossible' happened, GHC version 5.05): Binary.get(TyClDecl): ForeignType * You need to recompile the rts too; Linker.c has changed However the libraries are almost unaltered; just a tiny change in Base, and to the exports in Prelude. NOTE: so far as TH itself is concerned, expression splices work fine, but declaration splices are not complete. --------------- The main change --------------- The main structural change: renaming and typechecking have to be interleaved, because we can't rename stuff after a declaration splice until after we've typechecked the stuff before (and the splice itself). * Combine the renamer and typecheker monads into one (TcRnMonad, TcRnTypes) These two replace TcMonad and RnMonad * Give them a single 'driver' (TcRnDriver). This driver replaces TcModule.lhs and Rename.lhs * The haskell-src library package has a module Language/Haskell/THSyntax which defines the Haskell data type seen by the TH programmer. * New modules: hsSyn/Convert.hs converts THSyntax -> HsSyn deSugar/DsMeta.hs converts HsSyn -> THSyntax * New module typecheck/TcSplice type-checks Template Haskell splices. ------------- Linking stuff ------------- * ByteCodeLink has been split into ByteCodeLink (which links) ByteCodeAsm (which assembles) * New module ghci/ObjLink is the object-code linker. * compMan/CmLink is removed entirely (was out of place) Ditto CmTypes (which was tiny) * Linker.c initialises the linker when it is first used (no need to call initLinker any more). Template Haskell makes it harder to know when and whether to initialise the linker. ------------------------------------- Gathering the LIE in the type checker ------------------------------------- * Instead of explicitly gathering constraints in the LIE tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE) we now dump the constraints into a mutable varabiable carried by the monad, so we get tcExpr :: RenamedExpr -> TcM TypecheckedExpr Much less clutter in the code, and more efficient too. (Originally suggested by Mark Shields.) ----------------- Remove "SysNames" ----------------- Because the renamer and the type checker were entirely separate, we had to carry some rather tiresome implicit binders (or "SysNames") along inside some of the HsDecl data structures. They were both tiresome and fragile. Now that the typechecker and renamer are more intimately coupled, we can eliminate SysNames (well, mostly... default methods still carry something similar). ------------- Clean up HsPat ------------- One big clean up is this: instead of having two HsPat types (InPat and OutPat), they are now combined into one. This is more consistent with the way that HsExpr etc is handled; there are some 'Out' constructors for the type checker output. So: HsPat.InPat --> HsPat.Pat HsPat.OutPat --> HsPat.Pat No 'pat' type parameter in HsExpr, HsBinds, etc Constructor patterns are nicer now: they use HsPat.HsConDetails for the three cases of constructor patterns: prefix, infix, and record-bindings The *same* data type HsConDetails is used in the type declaration of the data type (HsDecls.TyData) Lots of associated clean-up operations here and there. Less code. Everything is wonderful.
* [project @ 2002-09-06 14:35:42 by simonmar]simonmar2002-09-061-1/+1
| | | | | | | Finally separate the compiler from hslibs. Mainly import wibbles, and use the new POSIX library when bootstrapping.
* [project @ 2002-08-29 15:44:11 by simonmar]simonmar2002-08-297-46/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Housekeeping: - The main goal is to remove dependencies on hslibs for a bootstrapped compiler, leaving only a requirement that the packages base, haskell98 and readline are built in stage 1 in order to bootstrap. We're almost there: Posix is still required for signal handling, but all other dependencies on hslibs are now gone. Uses of Addr and ByteArray/MutableByteArray array are all gone from the compiler. PrimPacked defines the Ptr type for GHC 4.08 (which didn't have it), and it defines simple BA and MBA types to replace uses of ByteArray and MutableByteArray respectively. - Clean up import lists. HsVersions.h now defines macros for some modules which have moved between GHC versions. eg. one now imports 'GLAEXTS' to get at unboxed types and primops in the compiler. Many import lists have been sorted as per the recommendations in the new style guidelines in the commentary. I've built the compiler with GHC 4.08.2, 5.00.2, 5.02.3, 5.04 and itself, and everything still works here. Doubtless I've got something wrong, though.
* [project @ 2002-08-02 13:08:33 by simonmar]simonmar2002-08-025-41/+31
| | | | | | | | | | | | | | | | | | | | | PrimRep Cleanup - Remove all PrimReps which were just different flavours of PtrRep. Now, everything which is a pointer to a closure of some kind is always a PtrRep. - Three of the deleted PrimReps, namely ArrayRep, ByteArrayRep, and ForeignObj rep, had a subtle reason for their existence: the abstract C pretty-printer(!) used them to decide whether to apply a shim to an outgoing C-call argument: a ByteArrayRep argument would be adjusted to point past the object header, for example. I've changed this to happen in a much more reasonable and obvious way: there are now explict macros in AbsCSyn to do the adjustment, and the code generator makes calls to these as necessary. Slightly less hackery is necessary in the NCG as a result.
* [project @ 2002-07-19 11:46:31 by simonmar]simonmar2002-07-191-2/+2
| | | | Sparc NCG fix from Sven Panne: 8-byte align the stack ptr when doing a ccall.
* [project @ 2002-07-16 14:56:08 by simonmar]simonmar2002-07-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Implement a primitive failsafe mechanism for protecting against linking inconsistent object files. The idea is that if object files which were compiled in the wrong order (non-dependency order) or compiled in different ways (eg. profiled vs. non-profiled) are linked together, a link error will result. This is achieved by adding the module version and the way to the module init label. For example, previously the init label for a module Foo was named __stginit_Foo now it is named __stginit_Foo_<version>_<way> where <version> is the module version of Foo (same as the version in the interface file), and <way> is the current way (or empty). We also have to have a way to refer to the old plain init label, for using as the argument to shutdownHaskell() in a program using foreign exports. So the old label now points to a jump instruction which transfers control to the new init code.
* [project @ 2002-06-20 08:31:48 by simonpj]simonpj2002-06-201-0/+2
| | | | Teach code gen about some extra no-ops
* [project @ 2002-05-02 09:09:18 by simonmar]simonmar2002-05-021-2/+2
| | | | ptext => ftext
* [project @ 2002-04-29 14:03:38 by simonmar]simonmar2002-04-297-124/+128
| | | | | | | | | | | | | | | | | | | | | | | | | FastString cleanup, stage 1. The FastString type is no longer a mixture of hashed strings and literal strings, it contains hashed strings only with O(1) comparison (except for UnicodeStr, but that will also go away in due course). To create a literal instance of FastString, use FSLIT(".."). By far the most common use of the old literal version of FastString was in the pattern ptext SLIT("...") this combination still works, although it doesn't go via FastString any more. The next stage will be to remove the need to use this special combination at all, using a RULE. To convert a FastString into an SDoc, now use 'ftext' instead of 'ptext'. I've also removed all the FAST_STRING related macros from HsVersions.h except for SLIT and FSLIT, just use the relevant functions from FastString instead.
* [project @ 2002-04-05 23:24:25 by sof]sof2002-04-051-1/+2
| | | | Friday afternoon pet peeve removal: define (Util.notNull :: [a] -> Bool) and use it
* [project @ 2002-04-01 08:16:49 by simonpj]simonpj2002-04-012-3/+3
| | | | Import wibbles
* [project @ 2002-03-14 17:05:13 by simonmar]simonmar2002-03-141-10/+3
| | | | Back out previous fix, it was wrong.
* [project @ 2002-03-14 15:47:52 by simonmar]simonmar2002-03-142-9/+10
| | | | | | | | | | | | | | | | | | | | | Remove the interface file parser, and move .hi-boot parsing into the main parser. The syntax of .hi-boot files is now greatly improved in terms of readability; here's an example: module M where data T f :: T -> GHC.Base.Int note that (a) layout can be used (b) there's no explcit export list; everything declared is implicitly exported (c) Z-encoding of names is no longer required (d) Any identifier not declared in the current module must still be quailified with the module which originally defined it (eg. GHC.Base.Int above). We'd like to relax (d), but that will come later.
* [project @ 2002-03-13 13:48:32 by simonmar]simonmar2002-03-131-3/+6
| | | | Cope with VoidRep fields in a static constructor.
* [project @ 2002-03-12 16:48:52 by simonmar]simonmar2002-03-121-3/+10
| | | | | | | | Fix a bug in the native code generator's handling of floating-point arguments to ccalls: it wasn't correctly promoting float arguments to doubles. Amazingly this has gone undetected for quite a while. Fixes bug #523996.
* [project @ 2002-02-15 22:13:32 by sof]sof2002-02-151-6/+10
| | | | | | | | | | | | New call attribute on foreign imports, threadsafe. It indicates that a foreign import can(*) safely be called concurrently with the continued evaluation of other Haskell threads, i.e., when the foreign call is made by a Haskell thread, it won't hinder the progress of other threads. (*) - if the platform and RTS supports it, it _will be_ invoked concurrently.
* [project @ 2002-02-13 14:05:50 by simonpj]simonpj2002-02-131-1/+0
| | | | Import wibbles
* [project @ 2002-02-12 15:17:13 by simonmar]simonmar2002-02-123-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch over to the new hierarchical libraries --------------------------------------------- This commit reorganises our libraries to use the new hierarchical module namespace extension. The basic story is this: - fptools/libraries contains the new hierarchical libraries. Everything in here is "clean", i.e. most deprecated stuff has been removed. - fptools/libraries/base is the new base package (replacing "std") and contains roughly what was previously in std, lang, and concurrent, minus deprecated stuff. Things that are *not allowed* in libraries/base include: Addr, ForeignObj, ByteArray, MutableByteArray, _casm_, _ccall_, ``'', PrimIO For ByteArrays and MutableByteArrays we use UArray and STUArray/IOUArray respectively now. Modules previously called PrelFoo are now under fptools/libraries/GHC. eg. PrelBase is now GHC.Base. - fptools/libraries/haskell98 provides the Haskell 98 std. libraries (Char, IO, Numeric etc.) as a package. This package is enabled by default. - fptools/libraries/network is a rearranged version of the existing net package (the old package net is still available; see below). - Other packages will migrate to fptools/libraries in due course. NB. you need to checkout fptools/libraries as well as fptools/hslibs now. The nightly build scripts will need to be tweaked. - fptools/hslibs still contains (almost) the same stuff as before. Where libraries have moved into the new hierarchy, the hslibs version contains a "stub" that just re-exports the new version. The idea is that code will gradually migrate from fptools/hslibs into fptools/libraries as it gets cleaned up, and in a version or two we can remove the old packages altogether. - I've taken the opportunity to make some changes to the build system, ripping out the old hslibs Makefile stuff from mk/target.mk; the new package building Makefile code is in mk/package.mk (auto-included from mk/target.mk). The main improvement is that packages now register themselves at make boot time using ghc-pkg, and the monolithic package.conf in ghc/driver is gone. I've updated the standard packages but haven't tested win32, graphics, xlib, object-io, or OpenGL yet. The Makefiles in these packages may need some further tweaks, and they'll need pkg.conf.in files added. - Unfortunately all this rearrangement meant I had to bump the interface-file version and create a bunch of .hi-boot-6 files :-(
* [project @ 2002-02-06 11:13:47 by sewardj]sewardj2002-02-063-41/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Clean up the AbsC -> AbsC translation of array operations. * MachOps MO_ReadOSBI and MO_WriteOSBI, which previously did array indexing, are gone. We translate now just to plain memory references and explicit address computations. This has the happy side effect that all MachOps now return exactly one result (previously it was 0 or 1), cleaning up various bits of code. As a result the Abstract C structure now contains an unneccessary restriction, which is that the result of a MachOp can only be assigned to a temporary. This made sense when MachOps had variable numbers of results (0, 1 or 2, originally), but is no longer needed. MachOps applied to args could now be allowed to appear as arbitrary nodes in expression trees, but so far they are not. * Get rid of CAddrMode constructor CMem, since it is a special case of CVal with a RegRelative of CIndex. AbstractC is inconsistent and non-orthogonal. The StixStmt + StixExpr combination expresses a large part of what AbstractC does in a cleaner and simpler way, IMO.
* [project @ 2002-02-04 17:09:02 by sewardj]sewardj2002-02-041-0/+1
| | | | Also implement MO_32U_to_8U for sparc. sigh.
* [project @ 2002-02-04 16:47:47 by sewardj]sewardj2002-02-041-0/+1
| | | | Implement missing MachOp, MO_8U_to_32U, for sparc. (duh!)
* [project @ 2002-01-30 13:23:25 by sewardj]sewardj2002-01-301-1/+1
| | | | Fix debug build.
* [project @ 2002-01-30 10:52:38 by sewardj]sewardj2002-01-301-1/+1
| | | | Fix syntax error in printing indirect calls in sparc assembly.
* [project @ 2002-01-29 16:54:41 by sewardj]sewardj2002-01-291-12/+0
| | | | | | x86 only: remove special ccall support for calling PerformGC_wrapper using dodgy-looking calling convention. PerformGC_wrapper was last seen alive in GHC 3.X, AFAIK.
* [project @ 2002-01-29 16:52:25 by sewardj]sewardj2002-01-294-20/+37
| | | | sparc NCG fixes for f-i-dynamic.
* [project @ 2002-01-29 13:22:28 by sewardj]sewardj2002-01-297-45/+78
| | | | | Teach the NCG how to do f-i-dynamic. Nothing unexpected. sparc-side now needs fixing.
* [project @ 2002-01-08 10:59:42 by sewardj]sewardj2002-01-082-10/+21
| | | | | | | | | | merge from stable branch: 1.46.4.3 +14 -7 fptools/ghc/compiler/nativeGen/AsmCodeGen.lhs 1.47.4.3 +2 -0 fptools/ghc/compiler/nativeGen/MachMisc.lhs Treat literal appearances of BaseReg in Stix trees uniformly. This is now taken to mean the &MainCapability.r, regardless of whether BaseReg is in a register (x86) or synthesised (sparc).
* [project @ 2002-01-08 10:36:24 by sewardj]sewardj2002-01-081-7/+19
| | | | | | | | | merge from the stable branch: 1.70.4.2 fptools/ghc/compiler/nativeGen/StixPrim.lhs 1.5.10.3 fptools/ghc/includes/mkNativeHdr.c Track recent changes to HpLim assignment in load_thread_state.
* [project @ 2002-01-02 12:32:18 by simonmar]simonmar2002-01-021-27/+8
| | | | | | | | | | | | | | | | - Implement a small GC optimisation: when a static constructor has been determined to have no (indirect) CAF references, we set its static link field to a non-zero value (currently 1). This prevents the garbage collector from traversing this closure and transitively everything it points to, and thus should speed up GC a little. - Omit the static link field from static constructors which have no pointer fields (i.e. they are CONSTR_NOCAF_STATIC). - Add the padding words and the static link field for a static constructor at (AbsC) code generation time, rather than in the back ends. This eliminates some duplication between PprAbsC and AbsCStixGen.
* [project @ 2002-01-02 12:27:43 by simonmar]simonmar2002-01-021-7/+1
| | | | No need for #ifdef around shift primop now.
* [project @ 2001-12-21 17:03:18 by sewardj]sewardj2001-12-211-0/+1
| | | | derive Eq Cond so that an assertion in MachCode works.
* [project @ 2001-12-21 16:39:09 by simonpj]simonpj2001-12-211-0/+1
| | | | wibble
* [project @ 2001-12-20 15:20:37 by sewardj]sewardj2001-12-203-25/+95
| | | | | | | | | | | | | | Generate floating-point comparisons on x86 which deal with NaNs in what I assume is an IEEE854 compliant fashion. For == >= > <= < if either arg is a NaN, produce False, and for /= if either arg is a NaN, produce True. This is the behaviour that gcc has, by default. Requires some ultramagical x86 code frags to be emitted. A big comment in PprMach explains how it works.
* [project @ 2001-12-20 15:16:13 by sewardj]sewardj2001-12-201-1/+1
| | | | nano-comment-wibble
* [project @ 2001-12-19 17:07:49 by sewardj]sewardj2001-12-191-1/+3
| | | | Correctly handle signed vs unsigned integer division on x86.
* [project @ 2001-12-18 15:23:15 by sewardj]sewardj2001-12-181-2/+4
| | | | Fix various bugs in the implementation of subIntC and mulMayOflo.
* [project @ 2001-12-17 18:03:08 by sewardj]sewardj2001-12-171-2/+4
| | | | | | | | | Redo translation of array indexing primops in order to insert 8 <-> 32 bit casts when dealing with Char arrays. Also facilitate future removal of CMem and MO_{Read,Write}OSBI. In the process, notice and fix a large bogon in x86/sparc implementation of signed and unsigned integer widening.
* [project @ 2001-12-14 16:57:36 by sewardj]sewardj2001-12-144-8/+44
| | | | | | | | | Sparc NCG changes to track recent mulIntC# changes. The Prelude can now finally be compiled with the sparc NCG. Also (incidentally) emit sparc integer multiply insns directly rather than calling a helper routine. Most sparcs should implement them by now :)
* [project @ 2001-12-14 15:26:14 by sewardj]sewardj2001-12-147-144/+67
| | | | | | | | | | | | | | | | | | | | | | Get rid of multiple-result MachOps (MO_NatS_AddC, MO_NatS_SubC, MO_NatS_MulC) which implement {add,sub,mul}IntC#. Supporting gunk in the NCG disappears as a result. Instead: * {add,sub}IntC# are translated out during abstract C simplification, turning into the xor-xor-invert-and-shift sequence previously defined in PrimOps.h. * mulIntC# is more difficult to get rid of portably. Instead we have a new single-result PrimOp, mulIntMayOflo, with corresponding MachOp MO_NatS_MulMayOflo. This tells you whether a W x W -> W signed multiply might overflow, where W is the word size. When W=32, is implemented by computing a 2W-long result. When W=64, we use the previous approximation. PrelNum.lhs' implementation of timesInteger changes slightly, to use the new PrimOp.
* [project @ 2001-12-13 23:32:21 by sof]sof2001-12-131-1/+7
| | | | shift wibble
* [project @ 2001-12-13 12:33:49 by sewardj]sewardj2001-12-132-9/+9
| | | | Sparc NCG fixes for 16 bit loads/stores.
* [project @ 2001-12-12 18:12:45 by sewardj]sewardj2001-12-124-263/+451
| | | | | | | | | | | | | | | | | | Make the sparc native code generator work again after recent primop hackery. * Track the change from PrimOp to MachOp at the Stix level. * Teach the sparc insn selector how to generate 64-bit code. * Fix various bogons in sparc {Int,Double,Float} <-> {Int,Double,Float} conversions which only happened to generate correct code by accident, so far. * Synthesise BaseReg from &MainCapability.r on archs which do not have BaseReg in a regiser (eg sparc :) At the moment {add,sub,mul}Int# are not implemented. To be fixed.
* [project @ 2001-12-12 12:19:11 by simonmar]simonmar2001-12-121-1/+5
| | | | shiftery #ifdefs
* [project @ 2001-12-10 18:04:51 by sewardj]sewardj2001-12-1011-82/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add just enough infrastructure to the NCG that it can deal with simple 64-bit code on 32-bit platforms. Main changes are: * Addition of a simple 64-bit instruction selection fn iselExpr64 to MachCode. This generates code for a 64-bit value and places the results into two virtual registers, related thusly: * Add a new type VRegUnique, which is used to label Stix virtual registers. This type used to be a plain Unique, but that forces the assumption that each Abstract-C level C temporary corresponds to exactly one Stix virtual register, which is untrue when the C temporary is 64-bit sized on a 32-bit machine. In the new scheme, the Unique for the C temporary can turn into two related VRegUniques, related by having the same embedded unique. * Made a start on 'target metrics' by adding ncg_target_is_32bits to the end of Stix.lhs. * Cleaned up numerous other gruesomenesses in the NCG which never came to light before now. Got rid of MachMisc.sizeOf, which doesn't make sense in a 64-bit setting, and replaced it by calls to PrimRep.getPrimRepArrayElemSize, which, as far as I'm concerned, is the definitive answer to the questio `How Big Is This PrimRep Really?' Result: on x86-linux, at least, you can now compile the Entire Prelude with -fasm! At this stage I cannot claim that the resulting code is correct, but it's a start.
* [project @ 2001-12-06 13:09:19 by sewardj]sewardj2001-12-061-1/+1
| | | | Make it compile -DDEBUG.
* [project @ 2001-12-06 11:50:07 by sewardj]sewardj2001-12-062-1/+10
| | | | | | | Add constructor CBytesPerWord to (the wildly-misnamed) CAddrMode, and use this in various places to remove word size dependencies in the C -> C simplification pass. Tart up the Stix constant folder a bit so as to be able to fold out the shift/mask literal expressions.