Documentation ¶
Index ¶
- Constants
- Variables
- type Builder
- func (self *Builder) ADD(rx GenericRegister, ry GenericRegister, rz GenericRegister) *Ir
- func (self *Builder) ADDI(rx GenericRegister, im int64, ry GenericRegister) *Ir
- func (self *Builder) ADDP(ps PointerRegister, rx GenericRegister, pd PointerRegister) *Ir
- func (self *Builder) ADDPI(ps PointerRegister, im int64, pd PointerRegister) *Ir
- func (self *Builder) ANDI(rx GenericRegister, im int64, ry GenericRegister) *Ir
- func (self *Builder) Append(p *Ir) (r *Ir)
- func (self *Builder) At(pc int) string
- func (self *Builder) BCOPY(ps PointerRegister, rx GenericRegister, pd PointerRegister) *Ir
- func (self *Builder) BEQ(rx GenericRegister, ry GenericRegister, to string) *Ir
- func (self *Builder) BEQP(ps PointerRegister, pd PointerRegister, to string) *Ir
- func (self *Builder) BGEU(rx GenericRegister, ry GenericRegister, to string) *Ir
- func (self *Builder) BLT(rx GenericRegister, ry GenericRegister, to string) *Ir
- func (self *Builder) BLTU(rx GenericRegister, ry GenericRegister, to string) *Ir
- func (self *Builder) BNE(rx GenericRegister, ry GenericRegister, to string) *Ir
- func (self *Builder) BNEP(ps PointerRegister, pd PointerRegister, to string) *Ir
- func (self *Builder) BREAK() *Ir
- func (self *Builder) BSI(rx GenericRegister, im int64, ry GenericRegister) *Ir
- func (self *Builder) BSW(rx GenericRegister, sw []string) *Ir
- func (self *Builder) BTS(rx GenericRegister, ry GenericRegister, rz GenericRegister) *Ir
- func (self *Builder) BZERO(nb int64, pd PointerRegister) *Ir
- func (self *Builder) Build() (r Program)
- func (self *Builder) CCALL(fn *CallHandle) *Ir
- func (self *Builder) GCALL(fn *CallHandle) *Ir
- func (self *Builder) IB(v int8, rx GenericRegister) *Ir
- func (self *Builder) ICALL(vt PointerRegister, vp PointerRegister, mt *CallHandle) *Ir
- func (self *Builder) IL(v int32, rx GenericRegister) *Ir
- func (self *Builder) IP(v interface{}, pd PointerRegister) *Ir
- func (self *Builder) IQ(v int64, rx GenericRegister) *Ir
- func (self *Builder) IW(v int16, rx GenericRegister) *Ir
- func (self *Builder) JMP(to string) *Ir
- func (self *Builder) LB(ps PointerRegister, disp int64, rx GenericRegister) *Ir
- func (self *Builder) LDAP(id int, pd PointerRegister) *Ir
- func (self *Builder) LDAQ(id int, rx GenericRegister) *Ir
- func (self *Builder) LL(ps PointerRegister, disp int64, rx GenericRegister) *Ir
- func (self *Builder) LP(ps PointerRegister, disp int64, pd PointerRegister) *Ir
- func (self *Builder) LQ(ps PointerRegister, disp int64, rx GenericRegister) *Ir
- func (self *Builder) LW(ps PointerRegister, disp int64, rx GenericRegister) *Ir
- func (self *Builder) Label(to string)
- func (self *Builder) MOV(rx GenericRegister, ry GenericRegister) *Ir
- func (self *Builder) MOVP(ps PointerRegister, pd PointerRegister) *Ir
- func (self *Builder) MULI(rx GenericRegister, im int64, ry GenericRegister) *Ir
- func (self *Builder) Mark(pc int)
- func (self *Builder) NOP() *Ir
- func (self *Builder) RET() *Ir
- func (self *Builder) SB(rx GenericRegister, pd PointerRegister, disp int64) *Ir
- func (self *Builder) SHRI(rx GenericRegister, im int64, ry GenericRegister) *Ir
- func (self *Builder) SL(rx GenericRegister, pd PointerRegister, disp int64) *Ir
- func (self *Builder) SP(ps PointerRegister, pd PointerRegister, disp int64) *Ir
- func (self *Builder) SQ(rx GenericRegister, pd PointerRegister, disp int64) *Ir
- func (self *Builder) SUB(rx GenericRegister, ry GenericRegister, rz GenericRegister) *Ir
- func (self *Builder) SUBI(rx GenericRegister, im int64, ry GenericRegister) *Ir
- func (self *Builder) SUBP(ps PointerRegister, rx GenericRegister, pd PointerRegister) *Ir
- func (self *Builder) SUBPI(ps PointerRegister, im int64, pd PointerRegister) *Ir
- func (self *Builder) SW(rx GenericRegister, pd PointerRegister, disp int64) *Ir
- func (self *Builder) SWAPL(rx GenericRegister, ry GenericRegister) *Ir
- func (self *Builder) SWAPQ(rx GenericRegister, ry GenericRegister) *Ir
- func (self *Builder) SWAPW(rx GenericRegister, ry GenericRegister) *Ir
- func (self *Builder) SXLQ(rx GenericRegister, ry GenericRegister) *Ir
- func (self *Builder) XORI(rx GenericRegister, im int64, ry GenericRegister) *Ir
- type CallContext
- func (self CallContext) Ap(i int) unsafe.Pointer
- func (self CallContext) Au(i int) uint64
- func (self CallContext) Data() unsafe.Pointer
- func (self CallContext) Itab() *rt.GoItab
- func (self CallContext) Rp(i int, v unsafe.Pointer)
- func (self CallContext) Ru(i int, v uint64)
- func (self CallContext) Verify(args string, rets string) bool
- type CallHandle
- type CallState
- type CallType
- type Constness
- type GenericRegister
- type Ir
- func (self *Ir) A0(v Register) *Ir
- func (self *Ir) A1(v Register) *Ir
- func (self *Ir) A2(v Register) *Ir
- func (self *Ir) A3(v Register) *Ir
- func (self *Ir) A4(v Register) *Ir
- func (self *Ir) A5(v Register) *Ir
- func (self *Ir) A6(v Register) *Ir
- func (self *Ir) A7(v Register) *Ir
- func (self *Ir) Const() *Ir
- func (self *Ir) Constness() Constness
- func (self *Ir) Disassemble(refs map[*Ir]string) string
- func (self *Ir) Free()
- func (self *Ir) IsBranch() bool
- func (self *Ir) Likeliness() Likeliness
- func (self *Ir) Likely() *Ir
- func (self *Ir) R0(v Register) *Ir
- func (self *Ir) R1(v Register) *Ir
- func (self *Ir) R2(v Register) *Ir
- func (self *Ir) R3(v Register) *Ir
- func (self *Ir) R4(v Register) *Ir
- func (self *Ir) R5(v Register) *Ir
- func (self *Ir) R6(v Register) *Ir
- func (self *Ir) R7(v Register) *Ir
- func (self *Ir) Switch() (p []*Ir)
- func (self *Ir) Unlikely() *Ir
- func (self *Ir) Volatile() *Ir
- type Likeliness
- type OpCode
- type PointerRegister
- type Program
- type Register
Constants ¶
View Source
const ( ArgMask = 0x7f ArgGeneric = 0x00 ArgPointer = 0x80 )
Variables ¶
View Source
var GenericRegisters = map[GenericRegister]string{ R0: "r0", R1: "r1", R2: "r2", R3: "r3", R4: "r4", Rz: "z", }
View Source
var PointerRegisters = map[PointerRegister]string{ P0: "p0", P1: "p1", P2: "p2", P3: "p3", P4: "p4", P5: "p5", Pn: "nil", }
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func CreateBuilder ¶
func CreateBuilder() *Builder
func (*Builder) ADD ¶
func (self *Builder) ADD(rx GenericRegister, ry GenericRegister, rz GenericRegister) *Ir
func (*Builder) ADDI ¶
func (self *Builder) ADDI(rx GenericRegister, im int64, ry GenericRegister) *Ir
func (*Builder) ADDP ¶
func (self *Builder) ADDP(ps PointerRegister, rx GenericRegister, pd PointerRegister) *Ir
func (*Builder) ADDPI ¶
func (self *Builder) ADDPI(ps PointerRegister, im int64, pd PointerRegister) *Ir
func (*Builder) ANDI ¶
func (self *Builder) ANDI(rx GenericRegister, im int64, ry GenericRegister) *Ir
func (*Builder) BCOPY ¶
func (self *Builder) BCOPY(ps PointerRegister, rx GenericRegister, pd PointerRegister) *Ir
func (*Builder) BEQ ¶
func (self *Builder) BEQ(rx GenericRegister, ry GenericRegister, to string) *Ir
func (*Builder) BEQP ¶
func (self *Builder) BEQP(ps PointerRegister, pd PointerRegister, to string) *Ir
func (*Builder) BGEU ¶
func (self *Builder) BGEU(rx GenericRegister, ry GenericRegister, to string) *Ir
func (*Builder) BLT ¶
func (self *Builder) BLT(rx GenericRegister, ry GenericRegister, to string) *Ir
func (*Builder) BLTU ¶
func (self *Builder) BLTU(rx GenericRegister, ry GenericRegister, to string) *Ir
func (*Builder) BNE ¶
func (self *Builder) BNE(rx GenericRegister, ry GenericRegister, to string) *Ir
func (*Builder) BNEP ¶
func (self *Builder) BNEP(ps PointerRegister, pd PointerRegister, to string) *Ir
func (*Builder) BSI ¶
func (self *Builder) BSI(rx GenericRegister, im int64, ry GenericRegister) *Ir
func (*Builder) BTS ¶
func (self *Builder) BTS(rx GenericRegister, ry GenericRegister, rz GenericRegister) *Ir
func (*Builder) CCALL ¶
func (self *Builder) CCALL(fn *CallHandle) *Ir
func (*Builder) GCALL ¶
func (self *Builder) GCALL(fn *CallHandle) *Ir
func (*Builder) ICALL ¶
func (self *Builder) ICALL(vt PointerRegister, vp PointerRegister, mt *CallHandle) *Ir
func (*Builder) IP ¶
func (self *Builder) IP(v interface{}, pd PointerRegister) *Ir
func (*Builder) LB ¶
func (self *Builder) LB(ps PointerRegister, disp int64, rx GenericRegister) *Ir
func (*Builder) LL ¶
func (self *Builder) LL(ps PointerRegister, disp int64, rx GenericRegister) *Ir
func (*Builder) LP ¶
func (self *Builder) LP(ps PointerRegister, disp int64, pd PointerRegister) *Ir
func (*Builder) LQ ¶
func (self *Builder) LQ(ps PointerRegister, disp int64, rx GenericRegister) *Ir
func (*Builder) LW ¶
func (self *Builder) LW(ps PointerRegister, disp int64, rx GenericRegister) *Ir
func (*Builder) MOV ¶
func (self *Builder) MOV(rx GenericRegister, ry GenericRegister) *Ir
func (*Builder) MOVP ¶
func (self *Builder) MOVP(ps PointerRegister, pd PointerRegister) *Ir
func (*Builder) MULI ¶
func (self *Builder) MULI(rx GenericRegister, im int64, ry GenericRegister) *Ir
func (*Builder) SB ¶
func (self *Builder) SB(rx GenericRegister, pd PointerRegister, disp int64) *Ir
func (*Builder) SHRI ¶
func (self *Builder) SHRI(rx GenericRegister, im int64, ry GenericRegister) *Ir
func (*Builder) SL ¶
func (self *Builder) SL(rx GenericRegister, pd PointerRegister, disp int64) *Ir
func (*Builder) SP ¶
func (self *Builder) SP(ps PointerRegister, pd PointerRegister, disp int64) *Ir
func (*Builder) SQ ¶
func (self *Builder) SQ(rx GenericRegister, pd PointerRegister, disp int64) *Ir
func (*Builder) SUB ¶
func (self *Builder) SUB(rx GenericRegister, ry GenericRegister, rz GenericRegister) *Ir
func (*Builder) SUBI ¶
func (self *Builder) SUBI(rx GenericRegister, im int64, ry GenericRegister) *Ir
func (*Builder) SUBP ¶
func (self *Builder) SUBP(ps PointerRegister, rx GenericRegister, pd PointerRegister) *Ir
func (*Builder) SUBPI ¶
func (self *Builder) SUBPI(ps PointerRegister, im int64, pd PointerRegister) *Ir
func (*Builder) SW ¶
func (self *Builder) SW(rx GenericRegister, pd PointerRegister, disp int64) *Ir
func (*Builder) SWAPL ¶
func (self *Builder) SWAPL(rx GenericRegister, ry GenericRegister) *Ir
func (*Builder) SWAPQ ¶
func (self *Builder) SWAPQ(rx GenericRegister, ry GenericRegister) *Ir
func (*Builder) SWAPW ¶
func (self *Builder) SWAPW(rx GenericRegister, ry GenericRegister) *Ir
func (*Builder) SXLQ ¶
func (self *Builder) SXLQ(rx GenericRegister, ry GenericRegister) *Ir
func (*Builder) XORI ¶
func (self *Builder) XORI(rx GenericRegister, im int64, ry GenericRegister) *Ir
type CallContext ¶
type CallContext struct {
// contains filtered or unexported fields
}
func (CallContext) Au ¶
func (self CallContext) Au(i int) uint64
func (CallContext) Data ¶
func (self CallContext) Data() unsafe.Pointer
func (CallContext) Itab ¶
func (self CallContext) Itab() *rt.GoItab
func (CallContext) Ru ¶
func (self CallContext) Ru(i int, v uint64)
type CallHandle ¶
type CallHandle struct { Id int Slot int Type CallType Func unsafe.Pointer // contains filtered or unexported fields }
func LookupCall ¶
func LookupCall(id int64) *CallHandle
func RegisterCCall ¶
func RegisterCCall(fn unsafe.Pointer, proxy func(CallContext)) (h *CallHandle)
func RegisterGCall ¶
func RegisterGCall(fn interface{}, proxy func(CallContext)) (h *CallHandle)
func RegisterICall ¶
func RegisterICall(mt rt.Method, proxy func(CallContext)) (h *CallHandle)
func (*CallHandle) Call ¶
func (self *CallHandle) Call(r CallState, p *Ir)
func (*CallHandle) Name ¶
func (self *CallHandle) Name() string
func (*CallHandle) String ¶
func (self *CallHandle) String() string
type CallState ¶
type CallState interface { Gr(id GenericRegister) uint64 Pr(id PointerRegister) unsafe.Pointer SetGr(id GenericRegister, val uint64) SetPr(id PointerRegister, val unsafe.Pointer) }
type GenericRegister ¶
type GenericRegister uint8
const ( R0 GenericRegister = iota R1 R2 R3 R4 Rz )
func (GenericRegister) A ¶
func (self GenericRegister) A() uint8
func (GenericRegister) String ¶
func (self GenericRegister) String() string
func (GenericRegister) Z ¶
func (self GenericRegister) Z() bool
type Ir ¶
type Ir struct { Op OpCode Rx GenericRegister Ry GenericRegister Rz GenericRegister Ps PointerRegister Pd PointerRegister An uint8 Rn uint8 Ar [8]uint8 Rr [8]uint8 Iv int64 Pr unsafe.Pointer Br *Ir Ln *Ir }
func (*Ir) Likeliness ¶
func (self *Ir) Likeliness() Likeliness
type OpCode ¶
type OpCode byte
const ( OP_nop OpCode = iota // no operation OP_ip // ptr(Pr) -> Pd OP_lb // u64(*(* u8)(Ps + Iv)) -> Rx OP_lw // u64(*(*u16)(Ps + Iv)) -> Rx OP_ll // u64(*(*u32)(Ps + Iv)) -> Rx OP_lq // *(*u64)(Ps + Iv) -> Rx OP_lp // *(*ptr)(Ps + Iv) -> Pd OP_sb // u8(Rx) -> *(*u8)(Pd + Iv) OP_sw // u16(Rx) -> *(*u16)(Pd + Iv) OP_sl // u32(Rx) -> *(*u32)(Pd + Iv) OP_sq // Rx -> *(*u64)(Pd + Iv) OP_sp // Ps -> *(*ptr)(Pd + Iv) OP_ldaq // arg[Iv] -> Rx OP_ldap // arg[Iv] -> Pd OP_addp // Ps + Rx -> Pd OP_subp // Ps - Rx -> Pd OP_addpi // Ps + Iv -> Pd OP_add // Rx + Ry -> Rz OP_sub // Rx - Ry -> Rz OP_bts // Ry & (1 << (Rx % PTR_BITS)) != 0 -> Rz, Ry |= 1 << (Rx % PTR_BITS) OP_addi // Rx + Iv -> Ry OP_muli // Rx * Iv -> Ry OP_andi // Rx & Iv -> Ry OP_xori // Rx ^ Iv -> Ry OP_shri // Rx >> Iv -> Ry OP_bsi // Rx | (1 << Iv) -> Ry OP_swapw // bswap16(Rx) -> Ry OP_swapl // bswap32(Rx) -> Ry OP_swapq // bswap64(Rx) -> Ry OP_sxlq // sign_extend_32_to_64(Rx) -> Ry OP_beq // if (Rx == Ry) Br.PC -> PC OP_bne // if (Rx != Ry) Br.PC -> PC OP_blt // if (Rx < Ry) Br.PC -> PC OP_bltu // if (u(Rx) < u(Ry)) Br.PC -> PC OP_bgeu // if (u(Rx) >= u(Ry)) Br.PC -> PC OP_beqp // if (Ps == Pd) Br.PC -> PC OP_bnep // if (Ps == Pd) Br.PC -> PC OP_bsw // if (u(Rx) < u(An)) Sw[u(Rx)].PC -> PC OP_jmp // Br.PC -> PC OP_bzero // memset(Pd, 0, Iv) OP_bcopy // memcpy(Pd, Ps, Rx) OP_ccall // call external C functions OP_gcall // call external Go functions OP_icall // call external Go iface methods OP_ret // return from function OP_break // trigger a debugger breakpoint )
type PointerRegister ¶
type PointerRegister uint8
const ( P0 PointerRegister = iota P1 P2 P3 P4 P5 Pn )
func (PointerRegister) A ¶
func (self PointerRegister) A() uint8
func (PointerRegister) String ¶
func (self PointerRegister) String() string
func (PointerRegister) Z ¶
func (self PointerRegister) Z() bool
Click to show internal directories.
Click to hide internal directories.