{-# LANGUAGE DeriveGeneric, DefaultSignatures, StrictData #-}
module Data.JumpTarget where
import Base
import Data.Word
import GHC.Generics (Generic)
data ResolvedJumpTarget =
Unresolved
| External String
| ImmediateAddress Word64
deriving (ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
(ResolvedJumpTarget -> ResolvedJumpTarget -> Bool)
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> Bool)
-> Eq ResolvedJumpTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
$c/= :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
== :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
$c== :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
Eq,(forall x. ResolvedJumpTarget -> Rep ResolvedJumpTarget x)
-> (forall x. Rep ResolvedJumpTarget x -> ResolvedJumpTarget)
-> Generic ResolvedJumpTarget
forall x. Rep ResolvedJumpTarget x -> ResolvedJumpTarget
forall x. ResolvedJumpTarget -> Rep ResolvedJumpTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolvedJumpTarget x -> ResolvedJumpTarget
$cfrom :: forall x. ResolvedJumpTarget -> Rep ResolvedJumpTarget x
Generic,Eq ResolvedJumpTarget
Eq ResolvedJumpTarget
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> Ordering)
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> Bool)
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> Bool)
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> Bool)
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> Bool)
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> ResolvedJumpTarget)
-> (ResolvedJumpTarget -> ResolvedJumpTarget -> ResolvedJumpTarget)
-> Ord ResolvedJumpTarget
ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
ResolvedJumpTarget -> ResolvedJumpTarget -> Ordering
ResolvedJumpTarget -> ResolvedJumpTarget -> ResolvedJumpTarget
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ResolvedJumpTarget -> ResolvedJumpTarget -> ResolvedJumpTarget
$cmin :: ResolvedJumpTarget -> ResolvedJumpTarget -> ResolvedJumpTarget
max :: ResolvedJumpTarget -> ResolvedJumpTarget -> ResolvedJumpTarget
$cmax :: ResolvedJumpTarget -> ResolvedJumpTarget -> ResolvedJumpTarget
>= :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
$c>= :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
> :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
$c> :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
<= :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
$c<= :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
< :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
$c< :: ResolvedJumpTarget -> ResolvedJumpTarget -> Bool
compare :: ResolvedJumpTarget -> ResolvedJumpTarget -> Ordering
$ccompare :: ResolvedJumpTarget -> ResolvedJumpTarget -> Ordering
$cp1Ord :: Eq ResolvedJumpTarget
Ord)
instance Show ResolvedJumpTarget
where
show :: ResolvedJumpTarget -> String
show ResolvedJumpTarget
Unresolved = String
"Unresolved"
show (External String
f) = String
f
show (ImmediateAddress Word64
imm) = String
"0x" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word64 -> String
forall a. (Integral a, Show a) => a -> String
showHex Word64
imm