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.
|
||||
type Function struct {
|
||||
name string
|
||||
params []Parameter
|
||||
Nodes []Node
|
||||
name string
|
||||
Nodes []Node
|
||||
|
||||
// LabelTarget maps from label name to the following instruction.
|
||||
LabelTarget map[Label]*Instruction
|
||||
|
||||
@@ -53,7 +53,9 @@ func (a *Allocator) AddInterference(x, y reg.Register) {
|
||||
|
||||
func (a *Allocator) Allocate() (reg.Allocation, error) {
|
||||
for a.remaining() > 0 {
|
||||
a.update()
|
||||
if err := a.update(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
v := a.mostrestricted()
|
||||
if err := a.alloc(v); err != nil {
|
||||
|
||||
@@ -16,10 +16,9 @@ type Printer interface {
|
||||
}
|
||||
|
||||
type GoPrinter struct {
|
||||
w io.Writer
|
||||
by string // generated by
|
||||
copyright []string
|
||||
err error
|
||||
w io.Writer
|
||||
by string // generated by
|
||||
err error
|
||||
}
|
||||
|
||||
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.
|
||||
func (f *Family) Registers() []Physical {
|
||||
rs := make([]Physical, 0, len(f.registers))
|
||||
for _, r := range f.registers {
|
||||
rs = append(rs, r)
|
||||
}
|
||||
return rs
|
||||
return append([]Physical(nil), f.registers...)
|
||||
}
|
||||
|
||||
// Set returns the set of registers in the family.
|
||||
@@ -59,10 +55,6 @@ func (f *Family) Set() Set {
|
||||
return s
|
||||
}
|
||||
|
||||
type private interface {
|
||||
private()
|
||||
}
|
||||
|
||||
type (
|
||||
ID uint64
|
||||
VID uint16
|
||||
@@ -74,7 +66,7 @@ type Register interface {
|
||||
Kind() Kind
|
||||
Bytes() uint
|
||||
Asm() string
|
||||
private
|
||||
register()
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
func (v virtual) private() {}
|
||||
func (v virtual) register() {}
|
||||
|
||||
type Physical interface {
|
||||
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) Kind() Kind { return r.kind }
|
||||
func (r register) Asm() string { return r.name }
|
||||
func (r register) private() {}
|
||||
func (r register) register() {}
|
||||
|
||||
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