address some lint
This commit is contained in:
5
ast.go
5
ast.go
@@ -109,9 +109,8 @@ func NewFile() *File {
|
|||||||
|
|
||||||
// Function represents an assembly function.
|
// Function represents an assembly function.
|
||||||
type Function struct {
|
type Function struct {
|
||||||
name string
|
name string
|
||||||
params []Parameter
|
Nodes []Node
|
||||||
Nodes []Node
|
|
||||||
|
|
||||||
// LabelTarget maps from label name to the following instruction.
|
// LabelTarget maps from label name to the following instruction.
|
||||||
LabelTarget map[Label]*Instruction
|
LabelTarget map[Label]*Instruction
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ func (a *Allocator) AddInterference(x, y reg.Register) {
|
|||||||
|
|
||||||
func (a *Allocator) Allocate() (reg.Allocation, error) {
|
func (a *Allocator) Allocate() (reg.Allocation, error) {
|
||||||
for a.remaining() > 0 {
|
for a.remaining() > 0 {
|
||||||
a.update()
|
if err := a.update(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
v := a.mostrestricted()
|
v := a.mostrestricted()
|
||||||
if err := a.alloc(v); err != nil {
|
if err := a.alloc(v); err != nil {
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ type Printer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GoPrinter struct {
|
type GoPrinter struct {
|
||||||
w io.Writer
|
w io.Writer
|
||||||
by string // generated by
|
by string // generated by
|
||||||
copyright []string
|
err error
|
||||||
err error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGoPrinter(w io.Writer) *GoPrinter {
|
func NewGoPrinter(w io.Writer) *GoPrinter {
|
||||||
|
|||||||
16
reg/types.go
16
reg/types.go
@@ -43,11 +43,7 @@ func (f *Family) Virtual(id VID, s Size) Virtual {
|
|||||||
|
|
||||||
// Registers returns the registers in this family.
|
// Registers returns the registers in this family.
|
||||||
func (f *Family) Registers() []Physical {
|
func (f *Family) Registers() []Physical {
|
||||||
rs := make([]Physical, 0, len(f.registers))
|
return append([]Physical(nil), f.registers...)
|
||||||
for _, r := range f.registers {
|
|
||||||
rs = append(rs, r)
|
|
||||||
}
|
|
||||||
return rs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set returns the set of registers in the family.
|
// Set returns the set of registers in the family.
|
||||||
@@ -59,10 +55,6 @@ func (f *Family) Set() Set {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
type private interface {
|
|
||||||
private()
|
|
||||||
}
|
|
||||||
|
|
||||||
type (
|
type (
|
||||||
ID uint64
|
ID uint64
|
||||||
VID uint16
|
VID uint16
|
||||||
@@ -74,7 +66,7 @@ type Register interface {
|
|||||||
Kind() Kind
|
Kind() Kind
|
||||||
Bytes() uint
|
Bytes() uint
|
||||||
Asm() string
|
Asm() string
|
||||||
private
|
register()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Virtual interface {
|
type Virtual interface {
|
||||||
@@ -116,7 +108,7 @@ func (v virtual) Asm() string {
|
|||||||
return fmt.Sprintf("<virtual:%v:%v:%v>", v.id, v.Kind(), v.Bytes())
|
return fmt.Sprintf("<virtual:%v:%v:%v>", v.id, v.Kind(), v.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v virtual) private() {}
|
func (v virtual) register() {}
|
||||||
|
|
||||||
type Physical interface {
|
type Physical interface {
|
||||||
PhysicalID() PID
|
PhysicalID() PID
|
||||||
@@ -143,7 +135,7 @@ func (r register) PhysicalID() PID { return r.id }
|
|||||||
func (r register) ID() ID { return (ID(r.Mask()) << 16) | ID(r.id) }
|
func (r register) ID() ID { return (ID(r.Mask()) << 16) | ID(r.id) }
|
||||||
func (r register) Kind() Kind { return r.kind }
|
func (r register) Kind() Kind { return r.kind }
|
||||||
func (r register) Asm() string { return r.name }
|
func (r register) Asm() string { return r.name }
|
||||||
func (r register) private() {}
|
func (r register) register() {}
|
||||||
|
|
||||||
type Spec uint16
|
type Spec uint16
|
||||||
|
|
||||||
|
|||||||
5
script/bootstrap
Executable file
5
script/bootstrap
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
# Install golangci-lint
|
||||||
|
golangci_lint_version='v1.12.3'
|
||||||
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin ${golangci_lint_version}
|
||||||
Reference in New Issue
Block a user