From fba82861c8ba2aa62c47d718abe9b1ccfd502de9 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 3 Jul 2009 11:33:03 +0200 Subject: [PATCH] Stop extracting dataconstructor arguments. Previously, dataconstructor arguments that had no arguments themselves (eg. False, or High), would be extracted from an argument list, even though they were just simple variable references. Since such a datacon can be translated to a VHDL literal and VHDL supports mapping expressions (at least constant expressions) to a port, there is no need for extraction anymore. --- Normalize.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Normalize.hs b/Normalize.hs index 0004ee3..9336921 100644 --- a/Normalize.hs +++ b/Normalize.hs @@ -285,13 +285,12 @@ caseremove expr = return expr caseremovetop = everywhere ("caseremove", caseremove) -------------------------------- --- Application simplification +-- Argument extraction -------------------------------- --- Make sure that all arguments in an application are simple variables. +-- Make sure that all arguments of a representable type are simple variables. appsimpl, appsimpltop :: Transform --- Don't simplify arguments that are already simple. Do simplify datacons, --- however, since we can't portmap literals. -appsimpl expr@(App f (Var v)) | not $ Id.isDataConWorkId v = return expr +-- Don't simplify arguments that are already simple. +appsimpl expr@(App f (Var v)) = return expr -- Simplify all non-applicable (to prevent loops with inlinefun) arguments, -- except for type arguments (since a let can't bind type vars, only a lambda -- can). Do this by introducing a new Let that binds the argument and passing -- 2.30.2