Matthijs Kooijman [Tue, 8 Jun 2010 13:48:06 +0000 (15:48 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash
* 'master' of git://github.com/christiaanb/clash:
Do not be overzealous with inlining results of polymorphic functions
Do not function extract functions that still have free type variables
Add setup file
Fix cabal file to reflect temp bug fixes
Temporarily disable "inlinenonrepresult" transformation, and apply eta-expansion transformation to all expressions
Rename cλash dir to clash so it behaves well within the ghc build tree
update cabal file to upload to hackage
Remove defunct makeVHDLStrings function, messes with haddock
Update reducer to use new integer types
Reflect moving TFVec and TFP Integers into clash in sourcefiles related to builtin types
Update package dependencies
Move TFVec and TFP integers (Signed, Unsiged and Index) into clash
christiaanb [Tue, 8 Jun 2010 13:45:14 +0000 (15:45 +0200)]
Do not be overzealous with inlining results of polymorphic functions
christiaanb [Tue, 8 Jun 2010 13:43:39 +0000 (15:43 +0200)]
Do not function extract functions that still have free type variables
christiaanb [Mon, 7 Jun 2010 20:41:14 +0000 (22:41 +0200)]
Add setup file
christiaanb [Mon, 7 Jun 2010 20:37:42 +0000 (22:37 +0200)]
Fix cabal file to reflect temp bug fixes
christiaanb [Mon, 7 Jun 2010 20:36:13 +0000 (22:36 +0200)]
Temporarily disable "inlinenonrepresult" transformation, and apply eta-expansion transformation to all expressions
christiaanb [Wed, 2 Jun 2010 08:03:58 +0000 (10:03 +0200)]
Rename cλash dir to clash so it behaves well within the ghc build tree
christiaanb [Tue, 1 Jun 2010 15:02:51 +0000 (17:02 +0200)]
update cabal file to upload to hackage
christiaanb [Tue, 1 Jun 2010 15:01:49 +0000 (17:01 +0200)]
Remove defunct makeVHDLStrings function, messes with haddock
christiaanb [Tue, 1 Jun 2010 14:21:30 +0000 (16:21 +0200)]
Update reducer to use new integer types
christiaanb [Tue, 1 Jun 2010 14:20:33 +0000 (16:20 +0200)]
Reflect moving TFVec and TFP Integers into clash in sourcefiles related to builtin types
christiaanb [Tue, 1 Jun 2010 14:19:04 +0000 (16:19 +0200)]
Update package dependencies
christiaanb [Tue, 1 Jun 2010 14:16:00 +0000 (16:16 +0200)]
Move TFVec and TFP integers (Signed, Unsiged and Index) into clash
Matthijs Kooijman [Wed, 26 May 2010 18:05:20 +0000 (20:05 +0200)]
Also simplify top level binder scrutinees.
Previously, if the scrutinee was a variable reference, it would not be
simplified, skipping top level binders as scrutinees. Now only local
variable references are skipped.
Matthijs Kooijman [Wed, 26 May 2010 15:27:06 +0000 (17:27 +0200)]
Add a new "section" for type-class transformations.
Matthijs Kooijman [Tue, 25 May 2010 19:30:50 +0000 (21:30 +0200)]
Improve listBindings output.
Matthijs Kooijman [Tue, 18 May 2010 09:59:33 +0000 (11:59 +0200)]
Reorder transformations to match my thesis.
Also add or correct some comments.
Matthijs Kooijman [Tue, 18 May 2010 08:16:07 +0000 (10:16 +0200)]
Move a part of β-reduction to application propagation.
Matthijs Kooijman [Wed, 14 Apr 2010 13:19:02 +0000 (15:19 +0200)]
Make debug output controllable with a top-level "constant".
Matthijs Kooijman [Wed, 14 Apr 2010 13:16:42 +0000 (15:16 +0200)]
Add traceIf function for conditional tracing.
Matthijs Kooijman [Tue, 13 Apr 2010 15:26:58 +0000 (17:26 +0200)]
Move the application of "everywhere" to dotransforms.
Since every transformation is now applied "everywhere", we don't need to
specify this for every transform. This allows us to change the
application order in the future.
Matthijs Kooijman [Tue, 13 Apr 2010 15:10:41 +0000 (17:10 +0200)]
Remove some commented out code.
Matthijs Kooijman [Tue, 13 Apr 2010 14:56:19 +0000 (16:56 +0200)]
s/normalise/normalize/
Matthijs Kooijman [Tue, 13 Apr 2010 14:48:35 +0000 (16:48 +0200)]
Don't inline non representable results with free type variables.
argprop should ensure that these variables get removed eventually
anyway.
Matthijs Kooijman [Tue, 13 Apr 2010 14:48:24 +0000 (16:48 +0200)]
Improve error message in mkSelCase.
Matthijs Kooijman [Tue, 13 Apr 2010 14:47:36 +0000 (16:47 +0200)]
Replace fst with a lambda in a map.
Cλash doesn't like mapping the fst builtin yet, so avoid that for now.
Matthijs Kooijman [Tue, 13 Apr 2010 14:09:47 +0000 (16:09 +0200)]
Forbid inlinenonrepresult to inline dictionaries.
Matthijs Kooijman [Tue, 13 Apr 2010 14:09:36 +0000 (16:09 +0200)]
Remove two debug traces.
Matthijs Kooijman [Tue, 13 Apr 2010 12:40:17 +0000 (14:40 +0200)]
Rewrite fromInteger and literal generation.
Literals are less of a hack now and should work more reliably.
Matthijs Kooijman [Tue, 13 Apr 2010 12:39:17 +0000 (14:39 +0200)]
No longer treat tfp ints as builtin types.
This makes tfp ints non-representable, breaking their use as literal
arguments to fromIntegerT for now.
Matthijs Kooijman [Tue, 13 Apr 2010 12:38:23 +0000 (14:38 +0200)]
Add genCoreArgs wrapper to VHDL.Generate.
Matthijs Kooijman [Tue, 13 Apr 2010 12:33:28 +0000 (14:33 +0200)]
Move tfp_to_int from VHDLTools to CoreTools.
Matthijs Kooijman [Tue, 13 Apr 2010 11:41:40 +0000 (13:41 +0200)]
Add getFullString function to get a qualified name.
Matthijs Kooijman [Wed, 7 Apr 2010 13:12:03 +0000 (15:12 +0200)]
Add non-representable result inlining transformation.
Matthijs Kooijman [Wed, 7 Apr 2010 13:08:35 +0000 (15:08 +0200)]
Add case of known constructor simplification.
Matthijs Kooijman [Wed, 7 Apr 2010 12:45:11 +0000 (14:45 +0200)]
Allow normalized functions to have a non-representable result.
An extra boolean argument to getNormalized / isNormalizeable switches
this behaviour when needed (which is never currently).
This commit also removes the unused isNormalizeable'.
Matthijs Kooijman [Wed, 7 Apr 2010 12:15:22 +0000 (14:15 +0200)]
Add allM and anyM functions.
Matthijs Kooijman [Tue, 6 Apr 2010 17:47:01 +0000 (19:47 +0200)]
Split off selector case creation code into CoreTools.
Matthijs Kooijman [Tue, 6 Apr 2010 17:44:57 +0000 (19:44 +0200)]
Make top level inlining handle non-representable results gracefully.
Since it does not know (nor care) if the function result is
representable, it now uses splitNormalizedNonRep and checks if the
result is a Var afterwards.
Matthijs Kooijman [Tue, 6 Apr 2010 17:17:49 +0000 (19:17 +0200)]
Fix typo in error message.
Matthijs Kooijman [Tue, 6 Apr 2010 15:11:45 +0000 (17:11 +0200)]
Add variant of splitNormalized for non-representable expressions.
Matthijs Kooijman [Tue, 6 Apr 2010 14:50:39 +0000 (16:50 +0200)]
Switch order of clauses in retvalsimpl to match thesis.
Matthijs Kooijman [Tue, 6 Apr 2010 14:45:17 +0000 (16:45 +0200)]
Update comment for return value simplification.
Matthijs Kooijman [Tue, 6 Apr 2010 14:22:04 +0000 (16:22 +0200)]
Fix let binding inlining in some cases.
Let binding inlining was not working properly when an to-be-inlined
binding used another to-be-inlined binding and they were inlined in the
wrong order (the result would be a reference to a no longer existing
binding).
Matthijs Kooijman [Wed, 31 Mar 2010 15:21:27 +0000 (17:21 +0200)]
Turn letderecursification into let recursification again.
Since we can't completely derecursify everything, just make our lives
easy by making everything recursive.
Matthijs Kooijman [Wed, 31 Mar 2010 15:20:20 +0000 (17:20 +0200)]
Revert "Make inlinebind work for non-recursive lets."
This reverts commit
077fe523188b85aff82569232acecfc9dbb082cb.
Conflicts:
cλash/CLasH/Normalize/NormalizeTools.hs
Matthijs Kooijman [Wed, 31 Mar 2010 14:44:47 +0000 (16:44 +0200)]
Slightly move the "after normalization" debug output.
This should ensure it is always printed. Previously, it seems it was printed
only when the final state from the monad was accessed, not when the
value was used (which caused problems if the value caused an error
further on).
Matthijs Kooijman [Wed, 31 Mar 2010 14:33:28 +0000 (16:33 +0200)]
Compilefix debug output.
christiaanb [Wed, 31 Mar 2010 13:07:28 +0000 (15:07 +0200)]
Update reducer to latest design (that runs at 159 MHz)
christiaanb [Wed, 31 Mar 2010 13:02:51 +0000 (15:02 +0200)]
Add time dependency to cabal package
Matthijs Kooijman [Wed, 31 Mar 2010 12:22:29 +0000 (14:22 +0200)]
Show number of transformations per function.
Matthijs Kooijman [Wed, 31 Mar 2010 12:17:37 +0000 (14:17 +0200)]
Keep (and show) a count of applied transformations.
Matthijs Kooijman [Wed, 31 Mar 2010 12:15:50 +0000 (14:15 +0200)]
Merge lambdasimpl, letsimpl and simplres into retvalsimpl transformation.
This makes these transformations like described in my thesis.
Matthijs Kooijman [Wed, 31 Mar 2010 11:57:07 +0000 (13:57 +0200)]
Show the current transformation context in the debug output.
Matthijs Kooijman [Wed, 31 Mar 2010 11:56:34 +0000 (13:56 +0200)]
Derive Show for CoreContext.
Matthijs Kooijman [Wed, 31 Mar 2010 11:55:44 +0000 (13:55 +0200)]
Add is_let predicate.
Matthijs Kooijman [Wed, 31 Mar 2010 11:01:47 +0000 (13:01 +0200)]
Log the time needed for compilation.
Matthijs Kooijman [Wed, 31 Mar 2010 10:39:44 +0000 (12:39 +0200)]
Only apply eta expansion to expressions at the top level.
Matthijs Kooijman [Wed, 31 Mar 2010 10:38:39 +0000 (12:38 +0200)]
Derive Eq for CoreContext.
Matthijs Kooijman [Wed, 31 Mar 2010 10:38:27 +0000 (12:38 +0200)]
Add LambdaBody to CoreContext.
Matthijs Kooijman [Wed, 31 Mar 2010 09:35:05 +0000 (11:35 +0200)]
Only inline top level functions that are completely applied.
Partial function applications will be inlined in their entirety to make
them fully applied first.
Matthijs Kooijman [Wed, 31 Mar 2010 09:28:51 +0000 (11:28 +0200)]
Inline all simple top level functions, not just compiler-generated ones.
The checking for compiler generated functions wasn't watertight, so
let's just don't check at all. There is no risk for loops with
funextract anymore, since we only inline functions applied in let
bindings now.
Matthijs Kooijman [Wed, 31 Mar 2010 09:03:38 +0000 (11:03 +0200)]
Only inline dictionaries that are likely to be resolvable.
Matthijs Kooijman [Tue, 30 Mar 2010 14:52:13 +0000 (16:52 +0200)]
Only inline top level functions that are applied in a let binding.
This should limit the amount of inlinings that happen a bit, make sure
inlining is only done in later stages of inlining and only when it
actually helps to prevent useless components. This should help to
prevent loops with inlinedict, since dictionary arguments should never
be inlined anymore.
Matthijs Kooijman [Tue, 30 Mar 2010 14:49:51 +0000 (16:49 +0200)]
Add LetBody and LetBinding to the CoreContext.
Matthijs Kooijman [Tue, 30 Mar 2010 13:00:16 +0000 (15:00 +0200)]
Remove notappargs, which is unused now.
Matthijs Kooijman [Tue, 30 Mar 2010 12:59:43 +0000 (14:59 +0200)]
Let eta expansion use the passed context instead of using notappargs.
Matthijs Kooijman [Tue, 30 Mar 2010 12:56:43 +0000 (14:56 +0200)]
Add AppFirst and AddSecond to CoreContext.
Also let subeverywhere set those contexts when appropriate.
Matthijs Kooijman [Tue, 30 Mar 2010 12:25:54 +0000 (14:25 +0200)]
Pass the context in which an expression occurs to each transformation.
Currently, the only context supported is "Other" and contexts are only
passed around and not yet used anywhere.
christiaanb [Tue, 30 Mar 2010 09:50:10 +0000 (11:50 +0200)]
add fromRangedWord function, and add error message to genVarArgs
Christiaan Baaij [Thu, 25 Mar 2010 08:52:36 +0000 (09:52 +0100)]
Merge branch 'master' of git.stderr.nl/matthijs/master-project/cλash
Conflicts:
cλash/CLasH/Normalize.hs
cλash/CLasH/Normalize/NormalizeTools.hs
Christiaan Baaij [Sun, 21 Mar 2010 21:41:38 +0000 (22:41 +0100)]
Fix gencopy' to use proper vhdl names
Christiaan Baaij [Sat, 20 Mar 2010 21:23:45 +0000 (22:23 +0100)]
Add "init" to list of builtin function within NormalizeTools
Christiaan Baaij [Sat, 20 Mar 2010 21:18:43 +0000 (22:18 +0100)]
Move built_in names to different list within NormalizeTools
Christiaan Baaij [Sat, 20 Mar 2010 15:42:05 +0000 (16:42 +0100)]
Fix zipWith template to work with partially applied functions, add support for boolean negation, and update error message of classopresolution transformation
Matthijs Kooijman [Wed, 10 Mar 2010 15:23:34 +0000 (16:23 +0100)]
Don't inline == and /=.
This is a hack to prevent problems caused by the derived Eq instances.
This is not a real solution, though.
Matthijs Kooijman [Wed, 10 Mar 2010 15:05:56 +0000 (16:05 +0100)]
Restructure the top level inlining transformation.
It now checks to see if the original (non-normalized) body is already
simple and only resorts to normalizing if the original body isn't simple
already. This should speed things up a bit, also because inlining the
normalized body probably needs some extra cleanups.
Matthijs Kooijman [Wed, 10 Mar 2010 15:03:51 +0000 (16:03 +0100)]
Don't resolve class operations that are builtin functions.
We already have a fixed VHDL translation for these, and usually the
actual implementation is not translateable (for example, the derived Eq
instances translate dataconstructors to Int#'s and use GHC.Prim.==# to
compare them).
Matthijs Kooijman [Wed, 10 Mar 2010 14:34:52 +0000 (15:34 +0100)]
Use the list of builtin functions for inlining.
Previously a small, fixed list of functions was used for inlining. Now
we use the full list of builtin functions instead.
Matthijs Kooijman [Wed, 10 Mar 2010 14:33:50 +0000 (15:33 +0100)]
Slightly improve normalization debug output.
When tracing individual transformations, their before and after outputs
are now always directly after each other.
Matthijs Kooijman [Wed, 10 Mar 2010 13:54:04 +0000 (14:54 +0100)]
Fix casesimpl and caseremove wrt scrutinee binders.
Previously, they would not check if the scrutinee binder was used,
resulting in it being removed or incorrectly used in some cases.
Matthijs Kooijman [Wed, 10 Mar 2010 12:32:07 +0000 (13:32 +0100)]
Put a list of builtin functions in VHDL.Constants
This will allow normalization to use this list, without creating
circular dependencies by using VHDL.Generate.globalNameTable.
Matthijs Kooijman [Wed, 10 Mar 2010 11:36:55 +0000 (12:36 +0100)]
Let classoperationresolution handle partially inlined dictionaries.
Previously, if a dictionary argument was not yet an application of a
dataconstructor (e.g., completely inlined) but an application of a
polymorphic top level binder (e.g., $fsomething), then it would complain
about mismatching types.
Matthijs Kooijman [Mon, 8 Mar 2010 11:07:27 +0000 (12:07 +0100)]
Make listBindings return IO () instead of IO [()].
The previous type caused ghci to print an extra list of units after the
regular output, while it simple ignores the single tuple now.
Matthijs Kooijman [Mon, 8 Mar 2010 10:54:45 +0000 (11:54 +0100)]
Show classes in listBindings output.
Matthijs Kooijman [Mon, 8 Mar 2010 10:54:26 +0000 (11:54 +0100)]
Show uniques in listBindings output.
Matthijs Kooijman [Mon, 8 Mar 2010 10:35:52 +0000 (11:35 +0100)]
Add class operation resolution transformation.
This transformation enables user-defined type classes.
Matthijs Kooijman [Mon, 8 Mar 2010 09:49:51 +0000 (10:49 +0100)]
Add dictionary inlining transformation.
Matthijs Kooijman [Fri, 5 Mar 2010 17:20:51 +0000 (18:20 +0100)]
Let inlinetoplevel use getNormalized_maybe.
This makes the transformation slightly simpler and prepares it for
inlining dictionaries next.
Matthijs Kooijman [Fri, 5 Mar 2010 17:15:49 +0000 (18:15 +0100)]
Let getNormalized return Nothing on non-normalizeable functions.
Matthijs Kooijman [Fri, 5 Mar 2010 17:14:45 +0000 (18:14 +0100)]
Add variant of isNormalizeable that operates in the TranslatorSession.
Matthijs Kooijman [Fri, 5 Mar 2010 17:12:51 +0000 (18:12 +0100)]
Add variant of isRepr that operates in the TranslatorSession.
Matthijs Kooijman [Fri, 5 Mar 2010 16:54:45 +0000 (17:54 +0100)]
Add getNormalized_maybe that does not fail if a binder was not found.
Matthijs Kooijman [Fri, 5 Mar 2010 16:29:02 +0000 (17:29 +0100)]
Remove getBinding and use getGlobalBind instead.
Matthijs Kooijman [Wed, 3 Mar 2010 13:05:33 +0000 (14:05 +0100)]
Support stateful functions with no own state (only substate).
Matthijs Kooijman [Wed, 3 Mar 2010 13:05:19 +0000 (14:05 +0100)]
Allow inlining of head and friends.
Matthijs Kooijman [Wed, 3 Mar 2010 12:30:44 +0000 (13:30 +0100)]
Use fromMaybe with an error message instead of fromJust.
Matthijs Kooijman [Wed, 3 Mar 2010 12:20:43 +0000 (13:20 +0100)]
Ignore all applications that have an empty result type.
Matthijs Kooijman [Wed, 3 Mar 2010 12:20:22 +0000 (13:20 +0100)]
Copy initial state when specializing functions.
Matthijs Kooijman [Wed, 3 Mar 2010 11:54:52 +0000 (12:54 +0100)]
Ignore selector cases selecting empty typed values.
This occurse when you use unzip in combination with a vector of
substates.