本文整理汇总了Golang中github.com/tsavola/wag/internal/gen.OpCoder.Write方法的典型用法代码示例。如果您正苦于以下问题:Golang OpCoder.Write方法的具体用法?Golang OpCoder.Write怎么用?Golang OpCoder.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsavola/wag/internal/gen.OpCoder
的用法示例。
在下文中一共展示了OpCoder.Write方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: writePrefixRegInsnTo
func writePrefixRegInsnTo(code gen.OpCoder, p prefix, t types.T, opcode []byte, ro, rm byte) {
if opcode == nil {
panic("instruction not supported")
}
p.writeTo(code, t, ro, 0, rm)
code.Write(opcode)
writeModTo(code, ModReg, ro, rm)
}
示例2: writePrefixStackInsnTo
func writePrefixStackInsnTo(code gen.OpCoder, p prefix, t types.T, opcode []byte, reg regs.R, disp int32) {
mod, imm := dispMod(t, regStackPtr, disp)
p.writeTo(code, t, byte(reg), 0, 0)
code.Write(opcode)
writeModTo(code, mod, byte(reg), MemSIB)
writeSibTo(code, 0, regStackPtr, regStackPtr)
imm.writeTo(code)
}
示例3: opStack
func (i insnRexM) opStack(code gen.OpCoder, t types.T, disp int32) {
mod, imm := dispMod(t, regStackPtr, disp)
writeRexSizeTo(code, t, 0, 0, 0)
code.Write(i.opcode)
writeModTo(code, mod, i.ro, MemSIB)
writeSibTo(code, 0, regStackPtr, regStackPtr)
imm.writeTo(code)
}
示例4: writePrefixAddrInsnTo
func writePrefixAddrInsnTo(code gen.OpCoder, p prefix, t types.T, opcode []byte, reg regs.R, scale uint8, index regs.R, addr int32) {
if opcode == nil {
panic("instruction not supported")
}
p.writeTo(code, t, byte(reg), 0, 0)
code.Write(opcode)
writeModTo(code, ModMem, byte(reg), MemSIB)
writeSibTo(code, scale, index, NoBase)
writeInt32To(code, addr)
}
示例5: op
func (opcode insnAddr8) op(code gen.OpCoder, addr int32) (ok bool) {
insnSize := int32(len(opcode)) + 1
siteAddr := code.Len() + insnSize
offset := addr - siteAddr
if offset >= -0x80 && offset < 0x80 {
code.Write(opcode)
code.WriteByte(uint8(offset))
ok = true
}
return
}
示例6: writeTo
func (p *floatSizePrefix) writeTo(code gen.OpCoder, t types.T, ro, index, rmOrBase byte) {
switch t.Size() {
case types.Size32:
code.Write(p.size32)
case types.Size64:
code.Write(p.size64)
default:
panic(t)
}
writeRexTo(code, 0, ro, index, rmOrBase)
}
示例7: opIndirect
func (i insnRexM) opIndirect(code gen.OpCoder, t types.T, reg regs.R, disp int32) {
mod, imm := dispMod(t, reg, disp)
writeRexSizeTo(code, t, 0, 0, byte(reg))
code.Write(i.opcode)
if reg != 12 {
writeModTo(code, mod, i.ro, byte(reg))
} else {
writeModTo(code, mod, i.ro, MemSIB)
writeSibTo(code, 0, NoIndex, reg)
}
imm.writeTo(code)
}
示例8: writePrefixIndirectInsnTo
func writePrefixIndirectInsnTo(code gen.OpCoder, p prefix, t types.T, opcode []byte, reg regs.R, scale uint8, index, base regs.R, disp int32) {
if opcode == nil {
panic("instruction not supported")
}
mod, imm := dispMod(t, base, disp)
p.writeTo(code, t, byte(reg), byte(index), byte(base))
code.Write(opcode)
if scale == 0 && index == NoIndex && base != 12 {
writeModTo(code, mod, byte(reg), byte(base))
} else {
writeModTo(code, mod, byte(reg), MemSIB)
writeSibTo(code, scale, index, base)
}
imm.writeTo(code)
}
示例9: opReg
func (i insnSuffixRMI) opReg(code gen.OpCoder, t types.T, target, source regs.R, value int8) {
code.Write(i.opcode)
i.suffix.writeTo(code, t, byte(target), 0, byte(source))
writeModTo(code, ModReg, byte(target), byte(source))
code.WriteByte(uint8(value))
}
示例10: writeTo
func (bytes constPrefix) writeTo(code gen.OpCoder, t types.T, ro, index, rmOrBase byte) {
code.Write(bytes)
}