x86-64bit-0.1.1.1: Runtime code generation for x86 64 bit machine code

Safe HaskellNone
LanguageHaskell2010

CodeGen.X86

Contents

Synopsis

Byte sequences

newtype Bytes Source #

Constructors

Bytes 

Fields

Instances

Sizes (in bits)

data Size Source #

Constructors

S8 
S16 
S32 
S64 

Instances

Eq Size Source # 

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Ord Size Source # 

Methods

compare :: Size -> Size -> Ordering #

(<) :: Size -> Size -> Bool #

(<=) :: Size -> Size -> Bool #

(>) :: Size -> Size -> Bool #

(>=) :: Size -> Size -> Bool #

max :: Size -> Size -> Size #

min :: Size -> Size -> Size #

Show Size Source # 

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

class HasSize a where Source #

Minimal complete definition

size

Methods

size :: a -> Size Source #

class IsSize s Source #

Minimal complete definition

ssize

Instances

IsSize S8 Source # 

Methods

ssize :: SSize S8

IsSize S16 Source # 

Methods

ssize :: SSize S16

IsSize S32 Source # 

Methods

ssize :: SSize S32

IsSize S64 Source # 

Methods

ssize :: SSize S64

Addresses

base :: Operand s RW -> Addr s Source #

disp :: Int32 -> Addr s Source #

index1 :: Operand s RW -> Addr s Source #

index2 :: Operand s RW -> Addr s Source #

index4 :: Operand s RW -> Addr s Source #

index8 :: Operand s RW -> Addr s Source #

Operands

data Access Source #

Operand access modes

Constructors

R

readable operand

RW

readable and writeable operand

data Operand :: Size -> Access -> * Source #

Instances

IsSize s => Show (Operand s a) Source # 

Methods

showsPrec :: Int -> Operand s a -> ShowS #

show :: Operand s a -> String #

showList :: [Operand s a] -> ShowS #

IsSize s => HasSize (Operand s a) Source # 

Methods

size :: Operand s a -> Size Source #

Immediate values

imm :: Integral a => a -> Operand s R Source #

Memory references

addr :: IsSize s' => Addr s' -> Operand s rw Source #

Registers

64 bit registers

32 bit registers

16 bit registers

8 bit low registers

8 bit high registers

Conditions

pattern O :: Condition Source #

pattern NO :: Condition Source #

pattern C :: Condition Source #

pattern NC :: Condition Source #

pattern Z :: Condition Source #

pattern NZ :: Condition Source #

pattern BE :: Condition Source #

pattern NBE :: Condition Source #

pattern S :: Condition Source #

pattern NS :: Condition Source #

pattern P :: Condition Source #

pattern NP :: Condition Source #

pattern L :: Condition Source #

pattern NL :: Condition Source #

pattern LE :: Condition Source #

pattern NLE :: Condition Source #

Assembly codes

data Code where Source #

Constructors

Ret, Nop, PushF, PopF, Cmc, Clc, Stc, Cli, Sti, Cld, Std :: Code 
Inc, Dec, Not, Neg :: IsSize s => Operand s RW -> Code 
Add, Or, Adc, Sbb, And, Sub, Xor, Cmp, Test, Mov :: IsSize s => Operand s RW -> Operand s r -> Code 
Rol, Ror, Rcl, Rcr, Shl, Shr, Sar :: IsSize s => Operand s RW -> Operand S8 r -> Code 
Xchg :: IsSize s => Operand s RW -> Operand s RW -> Code 
Lea :: (IsSize s, IsSize s') => Operand s RW -> Operand s' RW -> Code 
Pop :: Operand S64 RW -> Code 
Push :: Operand S64 r -> Code 
Call :: Operand S64 RW -> Code 
J :: Condition -> Code 
Jmp :: Code 
Label :: Code 
Scope :: Code -> Code 
Up :: Code -> Code 
Data :: Bytes -> Code 
Align :: Size -> Code 
EmptyCode :: Code 
AppendCode :: Code -> Code -> Code 

Instances

Compound assembly codes

(<>) :: Monoid m => m -> m -> m infixr 6 #

An infix synonym for mappend.

Since: 4.5.0.0

(<.>) :: Code -> Code -> Code infixr 5 Source #

(<:>) :: Code -> Code -> Code infixr 5 Source #

leaData :: (HasBytes a, IsSize s) => Operand s RW -> a -> Code Source #

Compilation

Calling C and Haskell from Assembly

class CallableHs a Source #

Minimal complete definition

createHsPtr

Instances

hsPtr :: CallableHs a => a -> FunPtr a Source #

Misc

runTests :: IO () Source #

Run all tests

newtype CString Source #

Constructors

CString String 

Instances