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 HaskellSafe
LanguageHaskell2010

Htcc.Asm.Intrinsic.Register

Description

Types and classes of the x86_64 registers

Synopsis

Register class

class Show a => IsRegister a where Source #

The register type class

Methods

byteWidth :: a -> Natural Source #

The byte width of the register.

Registers data types

data AccumulatorReg Source #

The accumulator register.

Constructors

RAX

Full 64 bits of register

EAX

Lower 32 bits of register

AX

Lower 16 bits of register

AH

Lower 8 bits of register

AL

Upper 8 bits of AX register

data BaseReg Source #

The Base register.

Constructors

RBX

Full 64 bits of register

EBX

Lower 32 bits of register

BX

Lower 16 bits of register

BH

Lower 8 bit register

BL

Upper 8 bit register of BX register

Instances

Instances details
Eq BaseReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

Methods

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

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

Ord BaseReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

Show BaseReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

IsRegister BaseReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

data CounterReg Source #

The Counter register.

Constructors

RCX

Full 64 bits of register

ECX

Lower 32 bits of register

CX

Lower 16 bits of register

CH

Lower 8 bit register

CL

Upper 8 bit register of CX register

data DataReg Source #

The Data register.

Constructors

RDX

Full 64 bits of register

EDX

Lower 32 bits of register

DX

Lower 16 bits of register

DH

Lower 8 bit register

DL

Upper 8 bit register of DX register

Instances

Instances details
Eq DataReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

Methods

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

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

Ord DataReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

Show DataReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

IsRegister DataReg Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

data SrcIndexReg Source #

The Source Index register.

Constructors

RSI

Full 64 bits of register

ESI

Lower 32 bits of register

SI

Lower 16 bits of register

SIL

Lower 8 bits of register

data DstIndexReg Source #

The Destination Index register.

Constructors

RDI

Full 64 bits of register

EDI

Lower 32 bits of register

DI

Lower 16 bits of register

DIL

Lower 8 bits of register

data BasePtrReg Source #

The Base Pointer register.

Constructors

RBP

Full 64 bits of register

EBP

Lower 32 bits of register

BP

Lower 16 bits of register

BPL

Lower 8 bits of register

data StackPtrReg Source #

The Stack Pointer register.

Constructors

RSP

Full 64 bits of register

ESP

Lower 32 bits of register

SP

Lower 16 bits of register

SPL

Lower 8 bits of register

data ExtendedReg Source #

The extended general-purpose register (r8-r15).

Constructors

Rn Int

Full 64 bits of register

RnD Int

Lower 32 bits of register

RnW Int

Lower 16 bits of register

RnB Int

Lower 8 bits of register

data Register Source #

The registers.

Constructors

Accumulator AccumulatorReg

The accumulator

Base BaseReg

The base

Counter CounterReg

The conuter

Data DataReg

The data

SrcIndex SrcIndexReg

The source index

DstIndex DstIndexReg

The destination index

BasePtr BasePtrReg

The base pointer index

StackPtr StackPtrReg

The stack pointer index

Extended ExtendedReg

The extended general-purpose

Instances

Instances details
Eq Register Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

Ord Register Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

Show Register Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

IsRegister Register Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Register

IsOperand Register Source # 
Instance details

Defined in Htcc.Asm.Intrinsic.Operand

Methods

oadd :: IsOperand b => Register -> b -> Operand Source #

osub :: IsOperand b => Register -> b -> Operand Source #

omul :: IsOperand b => Register -> b -> Operand Source #

BinaryInstruction Register 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

Registers

rax :: Register Source #

The rax register.

eax :: Register Source #

The eax register. Lower 32 bits of rax.

ax :: Register Source #

The ax register. Lower 16 bits of rax.

ah :: Register Source #

The ah register. Lower 8 bits of rax.

al :: Register Source #

The al register. Upper 8 bits of ax.

rbx :: Register Source #

The rbx register.

ebx :: Register Source #

The ebx register. Lower 32 bits of rbx.

bx :: Register Source #

The bx register. Lower 16 bits of rbx.

bh :: Register Source #

The bh register. Lower 8 bits of rbx.

bl :: Register Source #

The bl register. Upper 8 bits of bx.

rcx :: Register Source #

The rcx register.

ecx :: Register Source #

The ecx register. Lower 32 bis of rcx.

cx :: Register Source #

The cx register. Lower 16 bits of rcx.

ch :: Register Source #

The ch register. Lower 8 bits of rcx.

cl :: Register Source #

The cl register. Upper 8 bits of cx.

rdx :: Register Source #

The rdx register.

edx :: Register Source #

The edx register. Lower 32 bits of rdx.

dx :: Register Source #

The dx register. Lower 16 bits of rdx.

dh :: Register Source #

The dh register. Lower 8 bits of rbx.

dl :: Register Source #

The dl register. Upper 8 bits of dx.

rsi :: Register Source #

The rsi register.

esi :: Register Source #

The esi register. Lower 32 bits of rsi.

si :: Register Source #

The si register. Lower 16 bits of rsi.

sil :: Register Source #

The sil register. Lower 8 bits of rsi.

rdi :: Register Source #

The rdi register.

edi :: Register Source #

The edi register. Lower 32 bits of rdi.

di :: Register Source #

The di register. Lower 16 bits of rdi.

dil :: Register Source #

The dil register. Lower 8 bits of rdi.

rbp :: Register Source #

The rbp register.

ebp :: Register Source #

The ebp register. Lower 32 bits of rbp.

bp :: Register Source #

The bp register. Lower 16 bits of rbp.

bpl :: Register Source #

The bpl register. Lower 8 bits of rbp.

rsp :: Register Source #

The rsp register.

esp :: Register Source #

The esp register. Lower 32 bits of rsp.

sp :: Register Source #

The sp register. Lower 16 bits of rsp.

spl :: Register Source #

The spl register. Lower 8 bits of rsp.

rn :: Int -> Register Source #

The rn register (r8-r15).

rnd :: Int -> Register Source #

The rnd register (r8d-r15d). Lower 32 bits of rn.

rnw :: Int -> Register Source #

The rnw register (r8w-r15w). Lower 16 bits of rn.

rnb :: Int -> Register Source #

The rnb register (r8b-r15b). Lower 8 bits of rn.

List of defined registers

argRegs :: [[Register]] Source #

argRegs is a list of each Register used in the function call. In the list, the registers used for the first to sixth arguments are arranged in ascending order.

popRegs :: Int -> [Register] Source #

popRegs is a list of registers used to pop arguments from the stack in function calls. This is equivalent to the following, but is defined explicitly for reducing time completity.

>>> popRegs 3 == map maximum (reverse (take 3 argRegs))