summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/Instruction.hs
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-13 00:26:28 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-13 00:26:28 +0000
commit37710de28d4e080241c48c1b54d20d9b8fd3a529 (patch)
tree5361f3c0b8fb9b2896b2e8d3d8f2593c1f072898 /compiler/nativeGen/Instruction.hs
parent0564a6353811437659364db202c8d36b44b7f175 (diff)
parenta1ebe37d8394e35d0a29f21511626d0895db634a (diff)
downloadhaskell-37710de28d4e080241c48c1b54d20d9b8fd3a529.tar.gz
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Diffstat (limited to 'compiler/nativeGen/Instruction.hs')
-rw-r--r--compiler/nativeGen/Instruction.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/nativeGen/Instruction.hs b/compiler/nativeGen/Instruction.hs
index 86f5ae435d..076129f7fa 100644
--- a/compiler/nativeGen/Instruction.hs
+++ b/compiler/nativeGen/Instruction.hs
@@ -2,9 +2,12 @@
module Instruction (
RegUsage(..),
noUsage,
+ GenBasicBlock(..), blockId,
+ ListGraph(..),
NatCmm,
NatCmmDecl,
NatBasicBlock,
+ topInfoTable,
Instruction(..)
)
@@ -14,7 +17,7 @@ import Reg
import BlockId
import DynFlags
-import OldCmm
+import Cmm hiding (topInfoTable)
import Platform
-- | Holds a list of source and destination registers used by a
@@ -34,7 +37,6 @@ data RegUsage
noUsage :: RegUsage
noUsage = RU [] []
-
-- Our flavours of the Cmm types
-- Type synonyms for Cmm populated with native code
type NatCmm instr
@@ -54,6 +56,13 @@ type NatBasicBlock instr
= GenBasicBlock instr
+-- | Returns the info table associated with the CmmDecl's entry point,
+-- if any.
+topInfoTable :: GenCmmDecl a (BlockEnv i) (ListGraph b) -> Maybe i
+topInfoTable (CmmProc infos _ _ (ListGraph (b:_)))
+ = mapLookup (blockId b) infos
+topInfoTable _
+ = Nothing
-- | Common things that we can do with instructions, on all architectures.