From b5bab055aeadc91b6a497551a1aff95bdaa9beb9 Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 11 Oct 2001 16:44:10 +0000 Subject: [PATCH] [project @ 2001-10-11 16:44:10 by simonpj] Add special ILX case for Coerce --- ghc/compiler/stgSyn/CoreToStg.lhs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ghc/compiler/stgSyn/CoreToStg.lhs b/ghc/compiler/stgSyn/CoreToStg.lhs index 659e15d..da043d0 100644 --- a/ghc/compiler/stgSyn/CoreToStg.lhs +++ b/ghc/compiler/stgSyn/CoreToStg.lhs @@ -20,13 +20,15 @@ import TyCon ( isAlgTyCon ) import Literal import Id import Var ( Var, globalIdDetails, varType ) +#ifdef ILX +import MkId ( unsafeCoerceId ) +#endif import IdInfo import DataCon import CostCentre ( noCCS ) import VarSet import VarEnv import DataCon ( dataConWrapId ) -import IdInfo ( OccInfo(..) ) import Maybes ( maybeToBool ) import Name ( getOccName, isExternallyVisibleName, isDllName ) import OccName ( occNameUserString ) @@ -356,6 +358,15 @@ coreToStgExpr (Note (SCC cc) expr) = coreToStgExpr expr `thenLne` ( \ (expr2, fvs, escs) -> returnLne (StgSCC cc expr2, fvs, escs) ) +#ifdef ILX +-- For ILX, convert (__coerce__ to_ty from_ty e) +-- into (coerce to_ty from_ty e) +-- where coerce is real function +coreToStgExpr (Note (Coerce to_ty from_ty) expr) + = coreToStgExpr (mkApps (Var unsafeCoerceId) + [Type from_ty, Type to_ty, expr]) +#endif + coreToStgExpr (Note other_note expr) = coreToStgExpr expr -- 1.7.10.4