add Symbol type to operand

This commit is contained in:
Michael McLoughlin
2018-12-06 17:26:33 -08:00
parent e42eb1fb8c
commit 676ec39c51
5 changed files with 61 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ func TestSpecBytes(t *testing.T) {
Spec Spec
Bytes uint
}{
{S0, 0},
{S8L, 1},
{S8H, 1},
{S16, 2},

View File

@@ -140,6 +140,7 @@ func (r register) register() {}
type Spec uint16
const (
S0 Spec = 0x0 // zero value reserved for pseudo registers
S8L Spec = 0x1
S8H Spec = 0x2
S8 = S8L

View File

@@ -2,13 +2,15 @@ package reg
// Register families.
const (
GP Kind = iota
Internal Kind = iota
GP
MMX
SSEAVX
Mask
)
var Families = []*Family{
Pseudo,
GeneralPurpose,
SIMD,
}
@@ -25,6 +27,16 @@ func FamilyOfKind(k Kind) *Family {
return familiesByKind[k]
}
// Pseudo registers.
var (
Pseudo = &Family{Kind: Internal}
FramePointer = Pseudo.define(S0, 0, "FP")
ProgramCounter = Pseudo.define(S0, 0, "PC")
StaticBase = Pseudo.define(S0, 0, "SB")
StackPointer = Pseudo.define(S0, 0, "SP")
)
// General purpose registers.
var (
GeneralPurpose = &Family{Kind: GP}