Skip to content

Commit

Permalink
Separate AsX() in printing.
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Jan 2, 2020
1 parent 9aaa9a2 commit fe08d14
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions reg/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ func (v virtual) SatisfiedBy(p Physical) bool {

func (v virtual) as(s Spec) Register {
return virtual{
id: v.id,
kind: v.kind,
Width: Width(s.Size()),
mask: s.Mask(),
allocAt: v.allocAt,
id: v.id,
kind: v.kind,
Width: Width(s.Size()),
mask: s.Mask(),
// Non-breaking space for sorting.
allocAt: fmt.Sprintf("\u00A0- As%v() %s", s.String(), getFnNameFile(2)),
}
}

Expand Down Expand Up @@ -248,6 +249,16 @@ func (s Spec) Size() uint {
return (x >> 1) + (x & 1)
}

// Size returns the register width in bytes.
func (s Spec) String() string {
switch s {
case S8H:
return "8H"
default:
return fmt.Sprint(s.Size() * 8)
}
}

// AreConflicting returns whether registers conflict with each other.
func AreConflicting(x, y Physical) bool {
return x.Kind() == y.Kind() && x.PhysicalID() == y.PhysicalID() && (x.Mask()&y.Mask()) != 0
Expand Down

0 comments on commit fe08d14

Please sign in to comment.