SPARC NCG: Split out sanity checking into its own module
[ghc-hetmet.git] / compiler / nativeGen / SPARC / Instr.hs
index 6c7af5b..b21f947 100644 (file)
@@ -16,6 +16,8 @@ module SPARC.Instr (
        fpRelEA,
        moveSp,
        
+       isUnconditionalJump,
+       
        Instr(..),
        maxSpillSlots
 )
@@ -69,6 +71,17 @@ moveSp :: Int -> Instr
 moveSp n
    = ADD False False sp (RIImm (ImmInt (n * wordLength))) sp
 
+-- | An instruction that will cause the one after it never to be exectuted
+isUnconditionalJump :: Instr -> Bool
+isUnconditionalJump ii
+ = case ii of
+       CALL{}          -> True
+       JMP{}           -> True
+       JMP_TBL{}       -> True
+       BI ALWAYS _ _   -> True
+       BF ALWAYS _ _   -> True
+       _               -> False
+
 
 -- | instance for sparc instruction set
 instance Instruction Instr where