X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FdeSugar%2FDesugar.lhs;h=9b48cceed13f2ae7e293204ec377307b972b431c;hp=2e518236b40a46eddd4490408598162cf3a2d453;hb=7e95df790b34e11d7308e43dab0a7175b69b70fc;hpb=c0687066474aa4ce4912f31a5c09c1bcd673fb06 diff --git a/compiler/deSugar/Desugar.lhs b/compiler/deSugar/Desugar.lhs index 2e51823..9b48cce 100644 --- a/compiler/deSugar/Desugar.lhs +++ b/compiler/deSugar/Desugar.lhs @@ -207,7 +207,7 @@ deSugar hsc_env ; case mb_res of { Nothing -> return (msgs, Nothing) ; - Just (ds_ev_binds, all_prs, all_rules, ds_vects, ds_fords,ds_hpc_info, modBreaks + Just (ds_ev_binds, all_prs, all_rules, vects0, ds_fords, ds_hpc_info, modBreaks , hetmet_brak, hetmet_esc , hetmet_flatten , hetmet_unflatten @@ -237,27 +237,22 @@ deSugar hsc_env , hetmet_pga_loopr ) -> do - { -- Add export flags to bindings - keep_alive <- readIORef keep_var - ; let (rules_for_locals, rules_for_imps) + { -- Add export flags to bindings + keep_alive <- readIORef keep_var + ; let (rules_for_locals, rules_for_imps) = partition isLocalRule all_rules final_prs = addExportFlagsAndRules target - export_set keep_alive rules_for_locals (fromOL all_prs) + export_set keep_alive rules_for_locals (fromOL all_prs) final_pgm = let comb = combineEvBinds ds_ev_binds final_prs in if dopt Opt_F_simpleopt_before_flatten dflags then comb else simplifyBinds comb - -- Notice that we put the whole lot in a big Rec, even the foreign binds - -- When compiling PrelFloat, which defines data Float = F# Float# - -- we want F# to be in scope in the foreign marshalling code! - -- You might think it doesn't matter, but the simplifier brings all top-level - -- things into the in-scope set before simplifying; so we get no unfolding for F#! - - -- Lint result if necessary, and print - ; dumpIfSet_dyn dflags Opt_D_dump_ds "Desugared, before opt" $ - (vcat [ pprCoreBindings final_pgm - , pprRules rules_for_imps ]) + -- Notice that we put the whole lot in a big Rec, even the foreign binds + -- When compiling PrelFloat, which defines data Float = F# Float# + -- we want F# to be in scope in the foreign marshalling code! + -- You might think it doesn't matter, but the simplifier brings all top-level + -- things into the in-scope set before simplifying; so we get no unfolding for F#! ; (final_pgm', rules_for_imps') <- if dopt Opt_F_simpleopt_before_flatten dflags then simpleOptPgm dflags final_pgm rules_for_imps @@ -314,10 +309,15 @@ deSugar hsc_env ; dumpIfSet_dyn dflags Opt_D_coqpass "After Coq Pass" (text $ showSDoc $ pprCoreBindings ds_binds') - ; endPass dflags CoreDesugar ds_binds' ds_rules_for_imps + ; (ds_binds, ds_rules_for_imps, ds_vects) + <- simpleOptPgm dflags final_pgm rules_for_imps vects0 + -- The simpleOptPgm gets rid of type + -- bindings plus any stupid dead code + + ; endPass dflags CoreDesugar ds_binds ds_rules_for_imps ; let used_names = mkUsedNames tcg_env - ; deps <- mkDependencies tcg_env + ; deps <- mkDependencies tcg_env ; let mod_guts = ModGuts { mg_module = mod, @@ -566,18 +566,13 @@ the rule is precisly to optimise them: \begin{code} dsVect :: LVectDecl Id -> DsM CoreVect -dsVect (L loc (HsVect v rhs)) +dsVect (L loc (HsVect (L _ v) rhs)) = putSrcSpanDs loc $ do { rhs' <- fmapMaybeM dsLExpr rhs - ; return $ Vect (unLoc v) rhs' + ; return $ Vect v rhs' } --- dsVect (L loc (HsVect v Nothing)) --- = return $ Vect v Nothing --- dsVect (L loc (HsVect v (Just rhs))) --- = putSrcSpanDs loc $ --- do { rhs' <- dsLExpr rhs --- ; return $ Vect v (Just rhs') --- } +dsVect (L _loc (HsNoVect (L _ v))) + = return $ NoVect v \end{code}