Example #1
0
File: reg.go Project: rsc/tmp
func BtoF(b uint64) int {
	b &= 0xFFFF0000
	if b == 0 {
		return 0
	}
	return gc.Bitno(b) - 16 + x86.REG_X0
}
Example #2
0
File: reg.go Project: rsc/tmp
func BtoR(b uint64) int {
	b &= 0xffff
	if gc.Nacl {
		b &^= (1<<(x86.REG_BP-x86.REG_AX) | 1<<(x86.REG_R15-x86.REG_AX))
	} else if obj.Framepointer_enabled != 0 {
		// BP is part of the calling convention if framepointer_enabled.
		b &^= (1 << (x86.REG_BP - x86.REG_AX))
	}
	if b == 0 {
		return 0
	}
	return gc.Bitno(b) + x86.REG_AX
}