diff options
Diffstat (limited to 'compiler/GHC/StgToCmm/Env.hs')
-rw-r--r-- | compiler/GHC/StgToCmm/Env.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/GHC/StgToCmm/Env.hs b/compiler/GHC/StgToCmm/Env.hs index ebfff0185f..6f383c34c6 100644 --- a/compiler/GHC/StgToCmm/Env.hs +++ b/compiler/GHC/StgToCmm/Env.hs @@ -18,7 +18,7 @@ module GHC.StgToCmm.Env ( bindArgsToRegs, bindToReg, rebindToReg, bindArgToReg, idToReg, getArgAmode, getNonVoidArgAmodes, - getCgIdInfo, + getCgIdInfo, getCgInfo_maybe, maybeLetNoEscape, ) where @@ -51,6 +51,7 @@ import GHC.Utils.Outputable import GHC.Utils.Panic import GHC.Driver.Session +import GHC.Builtin.Names (getUnique) ------------------------------------- @@ -151,6 +152,13 @@ getCgIdInfo id cgLookupPanic id -- Bug }}} +-- | Retrieve cg info for a name if it already exists. +getCgInfo_maybe :: Name -> FCode (Maybe CgIdInfo) +getCgInfo_maybe name + = do { platform <- targetPlatform <$> getDynFlags + ; local_binds <- getBinds -- Try local bindings first + ; return $ lookupVarEnv_Directly local_binds (getUnique name) } + cgLookupPanic :: Id -> FCode a cgLookupPanic id = do local_binds <- getBinds |