htcc-0.0.0.1: The full scratch implementation of tiny C compiler (x86_64)
Copyright(c) roki 2019
LicenseMIT
Maintainerfalgon53@yahoo.co.jp
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

Description

The modules of intrinsic (x86_64) assembly

Synopsis

Documentation

data SizeUnit Source #

Unit of size of data to be loaded

Constructors

Byte

8 bits

Word

16 bits

DWord

32 bits

class Show a => UnaryInstruction a where Source #

A class of x86_64 instructions with unary arguments.

Minimal complete definition

Nothing

Methods

push :: a -> Asm TextLabelCtx e () Source #

push instruction

pop :: a -> Asm TextLabelCtx e () Source #

pop instruction

pushl :: a -> Asm TextLabelCtx e () Source #

pushl instruction

popl :: a -> Asm TextLabelCtx e () Source #

popl instruction

idiv :: a -> Asm TextLabelCtx e () Source #

idiv instruction

not :: a -> Asm TextLabelCtx e () Source #

not instruction

Instances

Instances details
UnaryInstruction Int Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

UnaryInstruction Integer Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

UnaryInstruction Natural Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

UnaryInstruction Register Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

UnaryInstruction Offset Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

IsOperand a => UnaryInstruction (Ref a) Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

class Show a => BinaryInstruction a where Source #

A class of x86_64 instructions with binary arguments.

Minimal complete definition

Nothing

Methods

mov :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

mov instruction

movl :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

movl instruction

movsx :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

movsx instruction

movsxd :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

movsxd instruction

movabs :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

movabs instruction

movzb :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

movzb instruction

cmp :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

cmp instruction

add :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

add instruction

sub :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

sub instruction

imul :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

imul instruction

and :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

and instruction

or :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

or instruction

xor :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

xor instruction

shl :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

shl instruction

sar :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

sar instruction

lea :: BinaryInstruction b => a -> b -> Asm TextLabelCtx e () Source #

Instances

Instances details
BinaryInstruction Int Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

BinaryInstruction Integer Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

BinaryInstruction Natural Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

BinaryInstruction Register Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

BinaryInstruction Offset Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

IsOperand a => BinaryInstruction (Ref a) Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

(IsOperand a, BinaryInstruction a) => BinaryInstruction (Ptr a) Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

newtype Offset Source #

offset instruction

Constructors

Offset Text

The constructor of offset instruction

Instances

Instances details
Show Offset Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

BinaryInstruction Offset Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

UnaryInstruction Offset Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

data Ptr a Source #

The ptr instruction

Constructors

Ptr SizeUnit (Ref a)

The constructor of ptr instruction

Instances

Instances details
IsOperand a => Show (Ptr a) Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

Methods

showsPrec :: Int -> Ptr a -> ShowS #

show :: Ptr a -> String #

showList :: [Ptr a] -> ShowS #

(IsOperand a, BinaryInstruction a) => BinaryInstruction (Ptr a) Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Structure.Section.Text.Instruction

sete :: Register -> Asm TextLabelCtx e () Source #

sete instruction

setne :: Register -> Asm TextLabelCtx e () Source #

setne instruction

setl :: Register -> Asm TextLabelCtx e () Source #

setl instruction

setle :: Register -> Asm TextLabelCtx e () Source #

setle instruction

setg :: Register -> Asm TextLabelCtx e () Source #

setg instruction

setge :: Register -> Asm TextLabelCtx e () Source #

setge instruction

byte :: IsOperand a => (SizeUnit -> Ref a -> Ptr a) -> Ref a -> Ptr a Source #

byte is a helper function for intuitively writing byte instructions

word :: IsOperand a => (SizeUnit -> Ref a -> Ptr a) -> Ref a -> Ptr a Source #

word is a helper function for intuitively writing word instructions

dword :: IsOperand a => (SizeUnit -> Ref a -> Ptr a) -> Ref a -> Ptr a Source #

dword is a helper function for intuitively writing dword instructions

cqo :: Asm TextLabelCtx e () Source #

cqo instruction

ret :: Asm TextLabelCtx e () Source #

ret instruction

leave :: Asm TextLabelCtx e () Source #

leave instruction

jmp :: Asm TargetLabelCtx e () -> Asm TextLabelCtx e () Source #

jmp instruction

je :: Asm TargetLabelCtx e () -> Asm TextLabelCtx e () Source #

je instruction

jne :: Asm TargetLabelCtx e () -> Asm TextLabelCtx e () Source #

jne instruction

jnz :: Asm TargetLabelCtx e () -> Asm TextLabelCtx e () Source #

jnz instruction

call :: Text -> Asm TextLabelCtx e () Source #

call instruction