Documentation ¶
Index ¶
- Constants
- Variables
- func AddImm32Reg(ctx context, imm32 uint32, dst *register, spill bool) string
- func AddRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
- func AndNotRegReg(ctx context, src, dst *register, size uint, spill bool) string
- func AndRegReg(ctx context, src, dst *register, size uint, spill bool) string
- func ArithOp(ctx context, datatype OpDataType, op token.Token, x, y, result *register) string
- func AssemblyFilePreamble() string
- func BitwiseOp(ctx context, op token.Token, signed bool, x, y, result *register, size uint) string
- func CMovCCRegReg(ctx context, src, dst *register, size uint, spill bool) string
- func CmpOp(ctx context, data OpDataType, op token.Token, x *register, y *register, ...) string
- func CmpRegImm32(ctx context, r *register, imm32 uint32, size uint) string
- func CmpRegReg(ctx context, odt OpDataType, x, y *register) string
- func ConvertOp(ctx context, from *register, fromtype OpDataType, to *register, ...) string
- func CreateFunction(fn *ssa.Function, outfn string, debug bool, trace bool, optimize bool) (*Function, *Error)
- func DivFloatRegReg(ctx context, datatype OpDataType, dividend, divisor *register, spill bool) string
- func DivRegReg(ctx context, signed bool, datatype InstrOpType, dividend, divisor *register, ...) (asm string, rax *register, rdx *register)
- func FloatToFloat(ctx context, from, to *register, ftype, totype OpDataType) string
- func FloatToInteger(ctx context, from, to *register, ftype, totype OpDataType) string
- func IntegerToFloat(ctx context, from, to *register, ftype, totype OpDataType, tmp *register) string
- func IntegerToInteger(ctx context, from, to *register, ftype, totype OpDataType) string
- func Lea(ctx context, srcName string, srcOffset int, src, dst *register, spill bool) string
- func MovImm32Reg(ctx context, imm32 int32, dst *register, spill bool) string
- func MovImm8Reg(ctx context, imm8 int8, dst *register, spill bool) string
- func MovImmFloatReg(ctx context, f64 float64, isf32 bool, tmp, dst *register, spill bool) string
- func MovImmReg(ctx context, imm int64, size uint, dst *register, spill bool) string
- func MovImmf32Reg(ctx context, f32 float32, tmp, dst *register, spill bool) string
- func MovImmf64Reg(ctx context, f64 float64, tmp, dst *register, spill bool) string
- func MovIntegerSimdMemIndirectMem(ctx context, datatype OpDataType, srcName string, srcOffset int, src *register, ...) string
- func MovMemIndirectMem(ctx context, datatype OpDataType, srcName string, srcOffset int, src *register, ...) string
- func MovMemMem(ctx context, optype InstrOpType, srcName string, srcOffset int, src *register, ...) string
- func MovMemReg(ctx context, datatype OpDataType, srcName string, srcOffset int, ...) string
- func MovRegIndirectMem(ctx context, datatype OpDataType, src *register, dstName string, dstOffset int, ...) string
- func MovRegIndirectMemSmall(ctx context, datatype OpDataType, src *register, dstName string, dstOffset int, ...) string
- func MovRegMem(ctx context, datatype OpDataType, src *register, dstName string, dst *register, ...) string
- func MovRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
- func MovSignExtend(ctx context, src, dst *register, srcSize, dstSize uint, spill bool) string
- func MovZeroExtend(ctx context, src, dst *register, srcSize, dstSize uint, spill bool) string
- func MulImm32RegReg(ctx context, imm32 uint32, src, dst *register, spill bool) string
- func MulRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
- func NotReg(ctx context, reg *register, size uint, spill bool) string
- func OrRegReg(ctx context, src, dst *register, spill bool) string
- func ResetStackPointer(size uint32) string
- func Ret() string
- func ShiftImm8Reg(ctx context, signed bool, direction int, count uint8, reg *register) string
- func ShiftRegReg(ctx context, signed bool, direction int, src, shiftReg, tmp *register, ...) string
- func SubImm32Reg(ctx context, imm32 uint32, dst *register, spill bool) string
- func SubRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
- func XmmInstrDataSize(xmmtype XmmData) uint
- func XorImm32Reg(ctx context, imm32 int32, dst *register, size uint, spill bool) string
- func XorImm64Reg(ctx context, imm64 int64, dst *register, size uint, spill bool) string
- func XorRegReg(ctx context, src, dst *register, spill bool) string
- func ZeroMemory(ctx context, name string, offset int, size uint, reg *register) string
- func ZeroReg(ctx context, reg *register) string
- type DataInstruction
- type Error
- type Function
- func (f *Function) AllocInstr(instr *ssa.Alloc) (string, *Error)
- func (f *Function) AssignRegIdent(loc ssa.Instruction, reg *register, ident *identifier, offset uint, size uint) (string, *Error)
- func (f *Function) BasicBlock(block *ssa.BasicBlock) (string, *Error)
- func (f *Function) BasicBlocks() (string, *Error)
- func (f *Function) BinOp(instr *ssa.BinOp) (string, *Error)
- func (f *Function) BinOpLoadXY(instr *ssa.BinOp) (asm string, x *register, y *register, err *Error)
- func (f *Function) Builtin(call *ssa.Call, builtin *ssa.Builtin) (string, *Error)
- func (f *Function) Call(call *ssa.Call) (string, *Error)
- func (f *Function) Convert(instr *ssa.Convert) (string, *Error)
- func (f *Function) ConvertFromTo(instr *ssa.Convert, fromOpType, toOpType InstrOpType, fromXmm, toXmm XmmData) (string, *Error)
- func (f *Function) ConvertUint64ToFloat(loc ssa.Instruction, tmp, regU64, regFloat *register, floatSize uint) string
- func (f *Function) CopyToRet(ret *ssa.Return, val []ssa.Value) (string, *Error)
- func (f *Function) Func() (string, *Error)
- func (f *Function) GoAssembly() (string, *Error)
- func (f *Function) GoProto() (string, string, string)
- func (f *Function) Ident(v ssa.Value) *identifier
- func (f *Function) If(instr *ssa.If) (string, *Error)
- func (f *Function) Index(instr *ssa.Index) (string, *Error)
- func (f *Function) IndexAddr(instr *ssa.IndexAddr) (string, *Error)
- func (f *Function) Instr(instr ssa.Instruction) (string, *Error)
- func (f *Function) Jump(jmp *ssa.Jump) (string, *Error)
- func (f *Function) JumpPreamble(loc ssa.Instruction, blockIndex, jmpIndex int) (string, *Error)
- func (f *Function) Len(call *ssa.Call) (string, *Error)
- func (f *Function) LoadIdent(loc ssa.Instruction, ident *identifier, offset uint, size uint) (string, *register, *Error)
- func (f *Function) LoadIdentSimple(loc ssa.Instruction, ident *identifier) (string, *register, *Error)
- func (f *Function) LoadSSE2(loc ssa.Instruction, ident *identifier) (string, *register, *Error)
- func (f *Function) LoadSimd(loc ssa.Instruction, ident *identifier) (string, *register, *Error)
- func (f *Function) LoadSimdValue(loc ssa.Instruction, simdvalue ssa.Value) (string, *register, *Error)
- func (f *Function) LoadValue(loc ssa.Instruction, val ssa.Value, offset uint, size uint) (string, *register, *Error)
- func (f *Function) LoadValueSimple(loc ssa.Instruction, val ssa.Value) (string, *register, *Error)
- func (f *Function) Params() (string, *Error)
- func (f *Function) Phi(phi *ssa.Phi) (string, *Error)
- func (f *Function) Position(pos token.Pos) token.Position
- func (f *Function) Return(ret *ssa.Return) (string, *Error)
- func (f *Function) SSE2Intrinsic(call *ssa.Call, sse2intrinsic Intrinsic) (string, *Error)
- func (f *Function) SetStackPointer() string
- func (f *Function) SimdIntrinsic(call *ssa.Call) (string, *Error)
- func (f *Function) Slice(instr *ssa.Slice) (string, *Error)
- func (f *Function) SliceLen(loc ssa.Instruction, slice ssa.Value, ident *identifier) (string, *Error)
- func (f *Function) Store(instr *ssa.Store) (string, *Error)
- func (f *Function) StoreSSE2(loc ssa.Instruction, reg *register, ident *identifier) (string, *Error)
- func (f *Function) StoreSimd(loc ssa.Instruction, reg *register, ident *identifier) (string, *Error)
- func (f *Function) StoreValAddr(loc ssa.Instruction, val ssa.Value, addr *identifier) (string, *Error)
- func (f *Function) StoreValue(loc ssa.Instruction, ident *identifier, reg *register) (string, *Error)
- func (f *Function) UnOp(instr *ssa.UnOp) (string, *Error)
- func (f *Function) UnOpPointer(instr *ssa.UnOp) (string, *Error)
- func (f *Function) UnOpSub(instr *ssa.UnOp) (string, *Error)
- func (f *Function) UnOpXor(instr *ssa.UnOp, xorVal int32) (string, *Error)
- func (f *Function) ZeroRetValue() (string, *Error)
- func (f *Function) ZeroSsaLocals() (string, *Error)
- type InstrData
- type InstrFlags
- type InstrInfo
- type InstrOpType
- type Instruction
- type InstructionType
- type Intrinsic
- type OpDataType
- type OpFlags
- type Operand
- type Reg
- type RegType
- type SimdInstr
- type VarOp
- type Variable
- type WrappedVal
- type XmmData
- type XmmInstruction
Constants ¶
const ( XMM_INVALID XmmData = iota XMM_F32 XMM_F64 XMM_4X_F32 XMM_2X_F64 XMM_F128 = XMM_2X_F64 XMM_M128 = XMM_F128 // [4]float32 XMM_M128i = XMM_F128 // [16]byte XMM_M128d = XMM_F128 // [2]float64 XMM_I8X16 = XMM_F32 XMM_U8X16 = XMM_I8X16 XMM_I16X8 = XMM_F64 XMM_U16X8 = XMM_I16X8 XMM_I32X4 = XMM_4X_F32 XMM_U32X4 = XMM_I32X4 XMM_I64X2 = XMM_2X_F64 XMM_U64X2 = XMM_I64X2 )
const ( SHIFT_LEFT = iota SHIFT_RIGHT )
const ( INVALID_REG = RegType(iota) // integer register DATA_REG // Stack pointer pseudo register SpReg // Frame pointer pseudo register FpReg // xmm register XMM_REG )
const DataRegSize = 8
size in bytes
const NumDataRegs = 14
const NumXMM_REGs = 16
const XmmRegSize = 16
Variables ¶
var Insts = []DataInstruction{ {I_ADD, ADDB, ADDW, ADDL, ADDQ, NONE}, {I_SUB, SUBB, SUBW, SUBL, SUBQ, NONE}, {I_MOV, MOVB, MOVW, MOVL, MOVQ, MOVOU}, {I_MOVBSX, NONE, MOVBWSX, MOVBLSX, MOVBQSX, NONE}, {I_MOVWSX, NONE, NONE, MOVWLSX, MOVWQSX, NONE}, {I_MOVLSX, NONE, NONE, NONE, MOVLQSX, NONE}, {I_MOVBZX, NONE, MOVBWZX, MOVBLZX, MOVBQZX, NONE}, {I_MOVWZX, NONE, NONE, MOVWLZX, MOVWQZX, NONE}, {I_MOVLZX, NONE, NONE, NONE, MOVLQZX, NONE}, {I_XOR, XORB, XORW, XORL, XORQ, NONE}, {I_LEA, NONE, LEAW, LEAL, LEAQ, NONE}, {I_MUL, MULB, MULW, MULL, MULQ, NONE}, {I_IMUL, IMULB, IMULW, IMULL, IMULQ, NONE}, {I_DIV, DIVB, DIVW, DIVL, DIVQ, NONE}, {I_IDIV, IDIVB, IDIVW, IDIVL, IDIVQ, NONE}, {I_AND, ANDB, ANDW, ANDL, ANDQ, NONE}, {I_OR, ORB, ORW, ORL, ORQ, NONE}, {I_SHL, SHLB, SHLW, SHLL, SHLQ, NONE}, {I_SHR, SHRB, SHRW, SHRL, SHRQ, NONE}, {I_SAL, SALB, SHLW, SHLL, SHLQ, NONE}, {I_SAR, SARB, SARW, SARL, SARQ, NONE}, {I_CMP, CMPB, CMPW, CMPL, CMPQ, NONE}, }
var LongSizes = []uint{1, 2, 4}
var QuadSize = []uint{8}
var QuadSizes = []uint{1, 2, 4, 8}
var XmmDataSizes = []uint{1, 2, 4, 8, 16}
var XmmInsts = []XmmInstruction{ {I_ADD, ADDSS, ADDSD, ADDPS, ADDPD}, {I_CMP, UCOMISS, UCOMISD, NONE, NONE}, {I_DIV, DIVSS, DIVSD, DIVPS, DIVPD}, {I_MOV, MOVSS, MOVSD, MOVUPS, MOVUPD}, {I_MUL, MULSS, MULSD, MULPS, MULPD}, {I_SUB, SUBSS, SUBSD, SUBPS, SUBPD}, {I_XOR, NONE, NONE, XORPS, XORPD}, {I_PADD, PADDB, PADDW, PADDL, PADDQ}, {I_PAND, PANDB, PANDW, PANDL, PAND}, {I_PANDN, NONE, NONE, NONE, PANDN}, {I_PCMPEQ, PCMPEQB, PCMPEQW, PCMPEQL, NONE}, {I_PCMPGT, PCMPGTB, PCMPGTW, PCMPGTL, NONE}, {I_PIMUL, NONE, PMULLW, NONE, NONE}, {I_PMOV, MOVOU, MOVOU, MOVOU, MOVOU}, {I_POR, POR, POR, POR, POR}, {I_PSLL, NONE, PSLLW, PSLLL, PSLLQ}, {I_PSRA, NONE, PSRAW, PSRAL, NONE}, {I_PSRL, NONE, PSRLW, PSRLL, PSRLQ}, {I_PMUL, NONE, NONE, PMULULQ, NONE}, {I_PSUB, PSUBB, PSUBW, PSUBL, PSUBQ}, {I_PXOR, NONE, NONE, NONE, PXOR}, }
Functions ¶
func AddImm32Reg ¶
func AddRegReg ¶
func AddRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
func AndNotRegReg ¶
func AndRegReg ¶
AndRegReg AND's the src register by the dst register and stores the result in the dst register.
func ArithOp ¶
func ArithOp(ctx context, datatype OpDataType, op token.Token, x, y, result *register) string
func AssemblyFilePreamble ¶
func AssemblyFilePreamble() string
func CMovCCRegReg ¶
CMovCCRegReg conditionally moves the src reg to the dst reg if the carry flag is clear (ie the previous compare had its src greater than its sub reg).
func CmpOp ¶
func CmpOp(ctx context, data OpDataType, op token.Token, x *register, y *register, result *register) string
CmpOp compares x to y, storing the op comparison flag (EQ, NEQ, ...) in result
func CmpRegImm32 ¶
func CmpRegReg ¶
func CmpRegReg(ctx context, odt OpDataType, x, y *register) string
func ConvertOp ¶
func ConvertOp(ctx context, from *register, fromtype OpDataType, to *register, totype OpDataType, tmp *register) string
func CreateFunction ¶
func DivFloatRegReg ¶
func DivFloatRegReg(ctx context, datatype OpDataType, dividend, divisor *register, spill bool) string
DivFloatRegReg performs floating point division by dividing the dividend register by the divisor register and stores the quotient in the dividend register
func DivRegReg ¶
func DivRegReg(ctx context, signed bool, datatype InstrOpType, dividend, divisor *register, size uint) (asm string, rax *register, rdx *register)
DivRegReg divides the "dividend" register by the "divisor" register and stores the quotient in rax and the remainder in rdx. DivRegReg is only for integer division.
func FloatToFloat ¶
func FloatToFloat(ctx context, from, to *register, ftype, totype OpDataType) string
func FloatToInteger ¶
func FloatToInteger(ctx context, from, to *register, ftype, totype OpDataType) string
func IntegerToFloat ¶
func IntegerToFloat(ctx context, from, to *register, ftype, totype OpDataType, tmp *register) string
func IntegerToInteger ¶
func IntegerToInteger(ctx context, from, to *register, ftype, totype OpDataType) string
func MovImm32Reg ¶
func MovImm8Reg ¶
func MovImmFloatReg ¶
func MovImmf32Reg ¶
func MovImmf64Reg ¶
func MovMemIndirectMem ¶
func MovMemReg ¶
func MovMemReg(ctx context, datatype OpDataType, srcName string, srcOffset int, src, dst *register, spill bool) string
func MovRegIndirectMem ¶
func MovRegIndirectMem(ctx context, datatype OpDataType, src *register, dstName string, dstOffset int, dst *register, size uint, tmpAddr, tmpData *register) string
func MovRegIndirectMemSmall ¶
func MovRegIndirectMemSmall(ctx context, datatype OpDataType, src *register, dstName string, dstOffset int, dst *register, size uint, tmpData *register) string
func MovRegMem ¶
func MovRegMem(ctx context, datatype OpDataType, src *register, dstName string, dst *register, dstOffset int) string
func MovRegReg ¶
func MovRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
func MovSignExtend ¶
func MovZeroExtend ¶
func MulImm32RegReg ¶
func MulRegReg ¶
func MulRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
MulRegReg multiplies the src register by the dst register and stores the result in the dst register. Overflow is discarded
func ResetStackPointer ¶
func ShiftImm8Reg ¶
func ShiftRegReg ¶
func ShiftRegReg(ctx context, signed bool, direction int, src, shiftReg, tmp *register, size uint, spill bool) string
ShiftRegReg shifts src by shiftReg amount and stores the result in src. The tmp reg is used for intermediates (if shifting right 64 times then SHR isn't used directly)
func SubImm32Reg ¶
func SubRegReg ¶
func SubRegReg(ctx context, datatype OpDataType, src, dst *register, spill bool) string
func XmmInstrDataSize ¶
func XorImm32Reg ¶
func XorImm64Reg ¶
func ZeroMemory ¶
ZeroMemory generates "MOVQ $0, name+offset(REG)" instructions, size is in bytes
Types ¶
type DataInstruction ¶
type DataInstruction struct { TInstr InstructionType // integer forms ByteSized Instruction WordSized Instruction LongSized Instruction QuadSized Instruction OctSized Instruction }
func GetInstruction ¶
func GetInstruction(tinst InstructionType) DataInstruction
func (DataInstruction) GetSized ¶
func (inst DataInstruction) GetSized(size uint) Instruction
type Function ¶
type Function struct { // if Debug is set, debug comments are included in assembly output Debug bool PrintSpills bool Trace bool Optimize bool Indent string // contains filtered or unexported fields }
func (*Function) AssignRegIdent ¶
func (*Function) BasicBlock ¶
func (f *Function) BasicBlock(block *ssa.BasicBlock) (string, *Error)
func (*Function) BasicBlocks ¶
func (*Function) BinOpLoadXY ¶
func (*Function) ConvertFromTo ¶
func (*Function) ConvertUint64ToFloat ¶
func (f *Function) ConvertUint64ToFloat(loc ssa.Instruction, tmp, regU64, regFloat *register, floatSize uint) string
func (*Function) GoAssembly ¶
func (*Function) JumpPreamble ¶
func (*Function) LoadIdentSimple ¶
func (f *Function) LoadIdentSimple(loc ssa.Instruction, ident *identifier) (string, *register, *Error)
func (*Function) LoadSSE2 ¶
func (f *Function) LoadSSE2(loc ssa.Instruction, ident *identifier) (string, *register, *Error)
func (*Function) LoadSimd ¶
func (f *Function) LoadSimd(loc ssa.Instruction, ident *identifier) (string, *register, *Error)
func (*Function) LoadSimdValue ¶
func (*Function) LoadValueSimple ¶
func (*Function) SSE2Intrinsic ¶
func (*Function) SetStackPointer ¶
func (*Function) StoreSSE2 ¶
func (f *Function) StoreSSE2(loc ssa.Instruction, reg *register, ident *identifier) (string, *Error)
func (*Function) StoreSimd ¶
func (f *Function) StoreSimd(loc ssa.Instruction, reg *register, ident *identifier) (string, *Error)
func (*Function) StoreValAddr ¶
func (*Function) StoreValue ¶
func (f *Function) StoreValue(loc ssa.Instruction, ident *identifier, reg *register) (string, *Error)
func (*Function) UnOpPointer ¶
pointer indirection, in assignment such as "z = *x"
func (*Function) ZeroRetValue ¶
func (*Function) ZeroSsaLocals ¶
type InstrFlags ¶
type InstrFlags int
const ( FLAGS_NONE InstrFlags = 1 << iota SizeB // byte SizeW // word SizeL // dword SizeQ // quad word SizeO // oct word SizeD // float64 SizeF // float32 UseCarry SetCarry KillCarry ShiftCX ImulAXDX LeftRead LeftRdwr RightRead RightRdwr RightWrite LeftAddr RightAddr Call OK Conv Cjmp Jump Break Move )
type InstrInfo ¶
type InstrInfo struct { Flags InstrFlags Use Reg Set Reg }
type InstrOpType ¶
type InstrOpType int
const ( OP_INVALID InstrOpType = iota OP_DATA // int8/uint8,,..., int64/uint64 OP_XMM // f32/f64, packed f32, packed f64 OP_PACKED // packed int8/uint8,....,int63/uint64 )
func (InstrOpType) String ¶
func (i InstrOpType) String() string
type Instruction ¶
type Instruction int
const ( NONE Instruction = iota AAD AAM AAS ADCB ADCL ADCW ADDB ADDL ADDW ADJSP ANDB ANDL ANDW ARPL BOUNDL BOUNDW BSFL BSFW BSRL BSRW BTL BTW BTCL BTCW BTRL BTRW BTSL BTSW BYTE CLC CLD CLI CLTS CMC CMPB CMPL CMPW CMPSB CMPSL CMPSW DAA DAS DECB DECL DECQ DECW DIVB DIVL DIVW ENTER HLT IDIVB IDIVL IDIVW IMULB IMULL IMULW INB INL INW INCB INCL INCQ INCW INSB INSL INSW INT INTO IRETL IRETW JCC JCS JCXZL JEQ JGE JGT JHI JLE JLS JLT JMI JNE JOC JOS JPC JPL JPS LAHF LARL LARW LEAL LEAW LEAVEL LEAVEW LOCK LODSB LODSL LODSW LONG LOOP LOOPEQ LOOPNE LSLL LSLW MOVB MOVL MOVW MOVBLSX MOVBLZX MOVBQSX MOVBQZX MOVBWSX MOVBWZX MOVWLSX MOVWLZX MOVWQSX MOVWQZX MOVSB MOVSL MOVSW MULB MULL MULW NEGB NEGL NEGW NOTB NOTL NOTW ORB ORL ORW OUTB OUTL OUTW OUTSB OUTSL OUTSW PAUSE POPAL POPAW POPFL POPFW POPL POPW PUSHAL PUSHAW PUSHFL PUSHFW PUSHL PUSHW RCLB RCLL RCLW RCRB RCRL RCRW REP REPN ROLB ROLL ROLW RORB RORL RORW SAHF SALB SALL SALW SARB SARL SARW SBBB SBBL SBBW SCASB SCASL SCASW SETCC SETCS SETEQ SETGE SETGT SETHI SETLE SETLS SETLT SETMI SETNE SETOC SETOS SETPC SETPL SETPS CDQ CWD SHLB SHLL SHLW SHRB SHRL SHRW STC STD STI STOSB STOSL STOSW SUBB SUBL SUBW SYSCALL TESTB TESTL TESTW VERR VERW WAIT WORD XCHGB XCHGL XCHGW XLAT XORB XORL XORW FMOVB FMOVBP FMOVD FMOVDP FMOVF FMOVFP FMOVL FMOVLP FMOVV FMOVVP FMOVW FMOVWP FMOVX FMOVXP FCOMB FCOMBP FCOMD FCOMDP FCOMDPP FCOMF FCOMFP FCOML FCOMLP FCOMW FCOMWP FUCOM FUCOMP FUCOMPP FADDDP FADDW FADDL FADDF FADDD FMULDP FMULW FMULL FMULF FMULD FSUBDP FSUBW FSUBL FSUBF FSUBD FSUBRDP FSUBRW FSUBRL FSUBRF FSUBRD FDIVDP FDIVW FDIVL FDIVF FDIVD FDIVRDP FDIVRW FDIVRL FDIVRF FDIVRD FXCHD FFREE FLDCW FLDENV FRSTOR FSAVE FSTCW FSTENV FSTSW F2XM1 FABS FCHS FCLEX FCOS FDECSTP FINCSTP FINIT FLD1 FLDL2E FLDL2T FLDLG2 FLDLN2 FLDPI FLDZ FNOP FPATAN FPREM FPREM1 FPTAN FRNDINT FSCALE FSIN FSINCOS FSQRT FTST FXAM FXTRACT FYL2X FYL2XP1 CMPXCHGB CMPXCHGL CMPXCHGW CMPXCHG8B CPUID INVD INVLPG LFENCE MFENCE MOVNTIL RDMSR RDPMC RDTSC RSM SFENCE SYSRET WBINVD WRMSR XADDB XADDL XADDW CMOVLCC CMOVLCS CMOVLEQ CMOVLGE CMOVLGT CMOVLHI CMOVLLE CMOVLLS CMOVLLT CMOVLMI CMOVLNE CMOVLOC CMOVLOS CMOVLPC CMOVLPL CMOVLPS CMOVQCC CMOVQCS CMOVQEQ CMOVQGE CMOVQGT CMOVQHI CMOVQLE CMOVQLS CMOVQLT CMOVQMI CMOVQNE CMOVQOC CMOVQOS CMOVQPC CMOVQPL CMOVQPS CMOVWCC CMOVWCS CMOVWEQ CMOVWGE CMOVWGT CMOVWHI CMOVWLE CMOVWLS CMOVWLT CMOVWMI CMOVWNE CMOVWOC CMOVWOS CMOVWPC CMOVWPL CMOVWPS ADCQ ADDQ ANDQ BSFQ BSRQ BTCQ BTQ BTRQ BTSQ CMPQ CMPSQ CMPXCHGQ CQO DIVQ IDIVQ IMULQ IRETQ JCXZQ LEAQ LEAVEQ LODSQ MOVQ MOVLQSX MOVLQZX MOVNTIQ MOVSQ MULQ NEGQ NOTQ ORQ POPFQ POPQ PUSHFQ PUSHQ RCLQ RCRQ ROLQ RORQ QUAD SALQ SARQ SBBQ SCASQ SHLQ SHRQ STOSQ SUBQ TESTQ XADDQ XCHGQ XORQ ADDPD ADDPS ADDSD ADDSS ANDNPD ANDNPS ANDPD ANDPS CMPPD CMPPS CMPSD CMPSS COMISD COMISS CVTPD2PL CVTPD2PS CVTPL2PD CVTPL2PS CVTPS2PD CVTPS2PL CVTSD2SL CVTSD2SQ CVTSD2SS CVTSL2SD CVTSL2SS CVTSQ2SD CVTSQ2SS CVTSS2SD CVTSS2SL CVTSS2SQ CVTTPD2PL CVTTPS2PL CVTTSD2SL CVTTSD2SQ CVTTSS2SL CVTTSS2SQ DIVPD DIVPS DIVSD DIVSS EMMS FXRSTOR FXRSTOR64 FXSAVE FXSAVE64 LDMXCSR MASKMOVOU MASKMOVQ MAXPD MAXPS MAXSD MAXSS MINPD MINPS MINSD MINSS MOVAPD MOVAPS MOVOU MOVHLPS MOVHPD MOVHPS MOVLHPS MOVLPD MOVLPS MOVMSKPD MOVMSKPS MOVNTO MOVNTPD MOVNTPS MOVNTQ MOVO MOVQOZX MOVSD MOVSS MOVUPD MOVUPS MULPD MULPS MULSD MULSS ORPD ORPS PACKSSLW PACKSSWB PACKUSWB PADDB PADDL PADDQ PADDSB PADDSW PADDUSB PADDUSW PADDW PANDB PANDL PANDSB PANDSW PANDUSB PANDUSW PANDW PAND PANDN PAVGB PAVGW PCMPEQB PCMPEQL PCMPEQW PCMPGTB PCMPGTL PCMPGTW PEXTRW // 3DNow! instructions PFACC PFADD PFCMPEQ PFCMPGE PFCMPGT PFMAX PFMIN PFMUL PFNACC PFPNACC PFRCP PFRCPIT1 PFRCPI2T PFRSQIT1 PFRSQRT PFSUB PFSUBR PINSRW PINSRD PINSRQ PMADDWL PMAXSW PMAXUB PMINSW PMINUB PMOVMSKB // 3DNow! instruction PMULHRW // Multiply Packed Unsigned Integers (16bit) and Store High Result // multiplies the packed unsigned word (16bit) integers in xmm1 and xmm2/m128 // and store the high 16 bits of the results in xmm1 // Intel instruction: PMULHUW PMULHUW // Multiply Packed Signed Integers (16bit) and Store High Result // multiplies the packed signed word (16bit) integers in xmm1 and xmm2/m128 // and store the high 16 bits of the results in xmm1 // Intel instruction: PMULHW PMULHW // Multiply Packed Signed Integers (16bit) and Store Low Result // multiplies the packed signed word (16bit) integers in xmm1 and xmm2/m128 // and store the low 16 bits of the results in xmm1 // Intel instruction: PMULLW PMULLW // Multiply Packed Unsigned Dword (32bit) Integers // multiplies two 32bit ints (in dwords 0 and 2 of the xmms registers) // and stores resulting two 64bit ints in result // xmm register/128bits mem // Intel instruction: PMULUDQ PMULULQ POR PSADBW PSHUFHW PSHUFL PSHUFLW PSHUFW PSHUFB PSLLO PSLLL PSLLQ PSLLW PSRAL PSRAW PSRLO PSRLL PSRLQ PSRLW PSUBB PSUBL PSUBQ PSUBSB PSUBSW PSUBUSB PSUBUSW PSUBW PSWAPL PUNPCKHBW PUNPCKHLQ PUNPCKHQDQ PUNPCKHWL PUNPCKLBW PUNPCKLLQ PUNPCKLQDQ PUNPCKLWL PXOR RCPPS RCPSS RSQRTPS RSQRTSS SHUFPD SHUFPS SQRTPD SQRTPS SQRTSD SQRTSS STMXCSR SUBPD SUBPS SUBSD SUBSS UCOMISD UCOMISS UNPCKHPD UNPCKHPS UNPCKLPD UNPCKLPS XORPD XORPS PF2IW PF2IL PI2FW PI2FL RETFW RETFL RETFQ SWAPGS MODE CRC32B CRC32Q IMUL3Q PREFETCHT0 PREFETCHT1 PREFETCHT2 PREFETCHNTA MOVQL BSWAPL BSWAPQ AESENC AESENCLAST AESDEC AESDECLAST AESIMC AESKEYGENASSIST ROUNDPS ROUNDSS ROUNDPD ROUNDSD PSHUFD PCLMULQDQ // packed carryless quadword multiplication (xmm) JCXZW FCMOVCC FCMOVCS FCMOVEQ FCMOVHI FCMOVLS FCMOVNE FCMOVNU FCMOVUN FCOMI FCOMIP FUCOMI FUCOMIP LAST )
https://github.com/golang/go/blob/master/src/cmd/internal/obj/x86/a.out.go
func GetConvertInstruction ¶
func GetConvertInstruction(tinst InstructionType, fromsize, tosize uint) Instruction
func GetInstr ¶
func GetInstr(tinst InstructionType, datatype OpDataType) Instruction
GetInstr, the size is in bytes
func (Instruction) String ¶
func (i Instruction) String() string
type InstructionType ¶
type InstructionType int
const ( I_INVALID InstructionType = iota I_ADD I_AND I_CMP // convert f32/64 to a uint8/int8, ..., uint64/int64 I_CVT_FLOAT2INT // convert f32/f64 to a uint8/int8, ..., uint64/int64 I_CVT_INT2FLOAT // convert f32/f64 to f64/f32 I_CVT_FLOAT2FLOAT I_DIV I_IMUL I_IDIV I_LEA I_MOV // mov byte, sign extend I_MOVBSX // mov word, sign extend I_MOVWSX // mov long, sign extend I_MOVLSX // mov byte, zero extend I_MOVBZX // mov word, zero extend I_MOVWZX // mov long, zero extend I_MOVLZX I_MUL I_OR // instructions for packed integers I_PADD I_PAND I_PANDN I_PCMPEQ I_PCMPGT I_PIMUL I_PMUL I_POR I_PSLL //packed shift left logical I_PSRA // packed shift right arithmetic I_PSRL //packed shift right logical I_PSUB I_PXOR I_PMOV I_SAL I_SAR I_SHL I_SHR I_SUB I_XOR )
func (InstructionType) String ¶
func (i InstructionType) String() string
type OpDataType ¶
type OpDataType struct { InstrData // contains filtered or unexported fields }
func GetIntegerOpDataType ¶
func GetIntegerOpDataType(signed bool, size uint) OpDataType
func GetOpDataType ¶
func GetOpDataType(t types.Type) OpDataType
func (OpDataType) String ¶
func (optype OpDataType) String() string
type Reg ¶
type Reg int
const ( REG_INVALID Reg = 1 << iota REG_AL REG_CL REG_DL REG_BL REG_AX REG_CX REG_DX REG_SI REG_DI REG_BX REG_BP REG_SP // SP (stack pointer) is a pseudo register REG_FP // FP (frame pointer) is a pseudo register REG_R8 REG_R9 REG_R10 REG_R11 REG_R12 REG_R13 REG_R14 REG_R15 REG_X0 REG_X1 REG_X2 REG_X3 REG_X4 REG_X5 REG_X6 REG_X7 REG_X8 REG_X9 REG_X10 REG_X11 REG_X12 REG_X13 REG_X14 REG_X15 )
type SimdInstr ¶
type SimdInstr int
const ( SIMD_INVALID SimdInstr = iota // Integer AddI8x16 SubI8x16 AddI16x8 SubI16x8 MulI16x8 ShlI16x8 ShrI16x8 AddI32x4 SubI32x4 MulI32x4 ShlI32x4 ShrI32x4 ShuffleI32x4 AddI64x2 SubI64x2 AddU8x16 SubU8x16 AddU16x8 SubU16x8 MulU16x8 ShlU16x8 ShrU16x8 AddU32x4 SubU32x4 MulU32x4 ShlU32x4 ShrU32x4 ShuffleU32x4 AddU64x2 SubU64x2 AddF32x4 SubF32x4 MulF32x4 DivF32x4 AddF64x2 SubF64x2 MulF64x2 DivF64x2 LoadSi128 )
type WrappedVal ¶
type XmmInstruction ¶
type XmmInstruction struct { XmmInstr InstructionType F32 Instruction // operates on single f32 F64 Instruction // operates on single f64 F32x4 Instruction // operates on four packed f32 F64x2 Instruction // operate on two packed f64 }
func GetXmmInstruction ¶
func GetXmmInstruction(tinst InstructionType) XmmInstruction
func (XmmInstruction) Select ¶
func (xinstr XmmInstruction) Select(variant XmmData) Instruction