[project @ 2001-10-11 16:44:10 by simonpj]
authorsimonpj <unknown>
Thu, 11 Oct 2001 16:44:10 +0000 (16:44 +0000)
committersimonpj <unknown>
Thu, 11 Oct 2001 16:44:10 +0000 (16:44 +0000)
Add special ILX case for Coerce

ghc/compiler/stgSyn/CoreToStg.lhs

index 659e15d..da043d0 100644 (file)
@@ -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