X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FHscMain.lhs;h=7b1a1025717d014fd3fe0f4598c6db03effde6b3;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=74377185b4345194860a52d7ae1b356cd7ae96a0;hpb=210766f3c06c727d7f23929266ea807bfa7c5703;p=ghc-hetmet.git diff --git a/ghc/compiler/main/HscMain.lhs b/ghc/compiler/main/HscMain.lhs index 7437718..7b1a102 100644 --- a/ghc/compiler/main/HscMain.lhs +++ b/ghc/compiler/main/HscMain.lhs @@ -6,7 +6,7 @@ \begin{code} module HscMain ( - HscResult(..), hscMain, newHscEnv, hscBufferFrontEnd + HscResult(..), hscMain, newHscEnv, hscCmmFile, hscBufferFrontEnd #ifdef GHCI , hscStmt, hscTcExpr, hscKcType, hscThing, , compileExpr @@ -29,7 +29,7 @@ import RdrName ( RdrName ) import Type ( Type ) import PrelNames ( iNTERACTIVE ) import StringBuffer ( stringToStringBuffer ) -import SrcLoc ( noSrcLoc, Located(..) ) +import SrcLoc ( SrcLoc, noSrcLoc, Located(..) ) import Kind ( Kind ) import Var ( Id ) import CoreLint ( lintUnfolding ) @@ -57,6 +57,7 @@ import CoreToStg ( coreToStg ) import Name ( Name, NamedThing(..) ) import SimplStg ( stg2stg ) import CodeGen ( codeGen ) +import CmmParse ( parseCmmFile ) import CodeOutput ( codeOutput ) import CmdLineOpts @@ -449,6 +450,18 @@ hscBackEnd dflags } +hscCmmFile :: DynFlags -> FilePath -> IO Bool +hscCmmFile dflags filename = do + maybe_cmm <- parseCmmFile dflags filename + case maybe_cmm of + Nothing -> return False + Just cmm -> do + codeOutput dflags no_mod NoStubs noDependencies [cmm] + return True + where + no_mod = panic "hscCmmFile: no_mod" + + myParseModule dflags src_filename = do -------------------------- Parser ---------------- showPass dflags "Parser" @@ -631,7 +644,7 @@ hscThing -- like hscStmt, but deals with a single identifier :: HscEnv -> InteractiveContext -- Context for compiling -> String -- The identifier - -> IO [(IfaceDecl, Fixity)] + -> IO [(IfaceDecl, Fixity, SrcLoc)] hscThing hsc_env ic str = do maybe_rdr_name <- hscParseIdentifier (hsc_dflags hsc_env) str