summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/Instruction.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/nativeGen/Instruction.hs')
-rw-r--r--compiler/nativeGen/Instruction.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/nativeGen/Instruction.hs b/compiler/nativeGen/Instruction.hs
index 86f5ae435d..48d6a33d79 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,8 +17,9 @@ import Reg
import BlockId
import DynFlags
-import OldCmm
+import Cmm hiding (topInfoTable)
import Platform
+import Outputable
-- | Holds a list of source and destination registers used by a
-- particular instruction.
@@ -34,7 +38,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 +57,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.