[project @ 2005-10-21 14:02:17 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / HscMain.lhs
index 4e826e1..187f644 100644 (file)
@@ -12,7 +12,6 @@ module HscMain (
        hscParseIdentifier,
 #ifdef GHCI
        hscStmt, hscTcExpr, hscKcType,
-       hscGetInfo, GetInfoResult,
        compileExpr,
 #endif
        ) where
@@ -21,7 +20,6 @@ module HscMain (
 
 #ifdef GHCI
 import HsSyn           ( Stmt(..), LHsExpr, LStmt, LHsType )
-import IfaceSyn                ( IfaceDecl, IfaceInst )
 import Module          ( Module )
 import CodeOutput      ( outputForeignStubs )
 import ByteCodeGen     ( byteCodeGen, coreExprToBCOs )
@@ -29,16 +27,13 @@ import Linker               ( HValue, linkExpr )
 import CoreTidy                ( tidyExpr )
 import CorePrep                ( corePrepExpr )
 import Flattening      ( flattenExpr )
-import TcRnDriver      ( tcRnStmt, tcRnExpr, tcRnGetInfo, GetInfoResult, tcRnType ) 
-import RdrName         ( rdrNameOcc )
-import OccName         ( occNameUserString )
+import TcRnDriver      ( tcRnStmt, tcRnExpr, tcRnType ) 
 import Type            ( Type )
 import PrelNames       ( iNTERACTIVE )
 import Kind            ( Kind )
 import CoreLint                ( lintUnfolding )
 import DsMeta          ( templateHaskellNames )
-import BasicTypes      ( Fixity )
-import SrcLoc          ( SrcLoc, noSrcLoc )
+import SrcLoc          ( noSrcLoc )
 import VarEnv          ( emptyTidyEnv )
 #endif
 
@@ -65,6 +60,7 @@ import TidyPgm                ( tidyProgram, mkBootModDetails )
 import CorePrep                ( corePrepPgm )
 import CoreToStg       ( coreToStg )
 import TyCon           ( isDataTyCon )
+import Packages                ( mkHomeModules )
 import Name            ( Name, NamedThing(..) )
 import SimplStg                ( stg2stg )
 import CodeGen         ( codeGen )
@@ -72,7 +68,6 @@ import CmmParse               ( parseCmmFile )
 import CodeOutput      ( codeOutput )
 
 import DynFlags
-import DriverPhases     ( HscSource(..) )
 import ErrUtils
 import UniqSupply      ( mkSplitUniqSupply )
 
@@ -480,6 +475,7 @@ hscCodeGen dflags
        cg_tycons   = tycons,
        cg_dir_imps = dir_imps,
        cg_foreign  = foreign_stubs,
+       cg_home_mods = home_mods,
        cg_dep_pkgs = dependencies     }  = do {
 
   let { data_tycons = filter isDataTyCon tycons } ;
@@ -513,12 +509,13 @@ hscCodeGen dflags
        do
            -----------------  Convert to STG ------------------
            (stg_binds, cost_centre_info) <- {-# SCC "CoreToStg" #-}
-                        myCoreToStg dflags this_mod prepd_binds        
+                        myCoreToStg dflags home_mods this_mod prepd_binds      
 
             ------------------  Code generation ------------------
            abstractC <- {-# SCC "CodeGen" #-}
-                        codeGen dflags this_mod data_tycons foreign_stubs
-                                dir_imps cost_centre_info stg_binds
+                        codeGen dflags home_mods this_mod data_tycons
+                                foreign_stubs dir_imps cost_centre_info
+                                stg_binds
 
            ------------------  Code output -----------------------
            (stub_h_exists, stub_c_exists)
@@ -531,7 +528,7 @@ hscCodeGen dflags
 
 hscCmmFile :: DynFlags -> FilePath -> IO Bool
 hscCmmFile dflags filename = do
-  maybe_cmm <- parseCmmFile dflags filename
+  maybe_cmm <- parseCmmFile dflags (mkHomeModules []) filename
   case maybe_cmm of
     Nothing -> return False
     Just cmm -> do
@@ -571,13 +568,13 @@ myParseModule dflags src_filename maybe_src_buf
       }}
 
 
-myCoreToStg dflags this_mod prepd_binds
+myCoreToStg dflags home_mods this_mod prepd_binds
  = do 
       stg_binds <- {-# SCC "Core2Stg" #-}
-            coreToStg dflags prepd_binds
+            coreToStg home_mods prepd_binds
 
-      (stg_binds2, cost_centre_info) <- {-# SCC "Core2Stg" #-}
-            stg2stg dflags this_mod stg_binds
+      (stg_binds2, cost_centre_info) <- {-# SCC "Stg2Stg" #-}
+            stg2stg dflags home_mods this_mod stg_binds
 
       return (stg_binds2, cost_centre_info)
 \end{code}
@@ -720,34 +717,6 @@ hscParseThing parser dflags str
 
 %************************************************************************
 %*                                                                     *
-\subsection{Getting information about an identifer}
-%*                                                                     *
-%************************************************************************
-
-\begin{code}
-#ifdef GHCI
-hscGetInfo -- like hscStmt, but deals with a single identifier
-  :: HscEnv
-  -> String                    -- The identifier
-  -> IO [GetInfoResult]
-
-hscGetInfo hsc_env str
-   = do maybe_rdr_name <- hscParseIdentifier (hsc_dflags hsc_env) str
-       case maybe_rdr_name of {
-         Nothing -> return [];
-         Just (L _ rdr_name) -> do
-
-       maybe_tc_result <- tcRnGetInfo hsc_env (hsc_IC hsc_env) rdr_name
-
-       case maybe_tc_result of
-            Nothing     -> return []
-            Just things -> return things
-       }
-#endif
-\end{code}
-
-%************************************************************************
-%*                                                                     *
        Desugar, simplify, convert to bytecode, and link an expression
 %*                                                                     *
 %************************************************************************