Beispiel #1
0
func emitDot(asm *amd64.Assembler, cc *compiled) {
	asm.Push(amd64.Rax)
	asm.Sub(amd64.Imm{48}, amd64.Rsp)
	asm.Mov(amd64.Imm{1}, amd64.Indirect{amd64.Rsp, 16, 64})
	asm.Mov(amd64.Imm{1}, amd64.Indirect{amd64.Rsp, 8, 64})
	asm.Mov(amd64.Rax, amd64.Indirect{amd64.Rsp, 0, 64})
	asm.CallFunc(cc.w)
	asm.Add(amd64.Imm{48}, amd64.Rsp)
	asm.Pop(amd64.Rax)
}
Beispiel #2
0
func emitComma(asm *amd64.Assembler, cc *compiled) {
	asm.Push(amd64.Rax)
	asm.Sub(amd64.Imm{48}, amd64.Rsp)
	asm.Mov(amd64.Imm{1}, amd64.Indirect{amd64.Rsp, 16, 64})
	asm.Mov(amd64.Imm{1}, amd64.Indirect{amd64.Rsp, 8, 64})
	asm.Mov(amd64.Rax, amd64.Indirect{amd64.Rsp, 0, 64})
	asm.CallFunc(cc.r)
	asm.Add(amd64.Imm{48}, amd64.Rsp)
	asm.Pop(amd64.Rax)
	asm.Test(amd64.Imm{-1}, amd64.Indirect{amd64.Rsp, -24, 64})
	jcc(asm, amd64.CC_Z, func(asm *amd64.Assembler) {
		asm.Movb(amd64.Imm{0}, amd64.Indirect{amd64.Rax, 0, 8})
	})
}