Commit Graph

265 Commits

Author SHA1 Message Date
Klaus Post
3c861c7c0b internal/prnt: trim trailing comment whitespace (#114)
Before printing a comment, remove trailing whitespace. Generation would output `// ` for empty comments. So we trim the whitespace off the end before printing.
2020-01-13 10:09:25 -08:00
Michael McLoughlin
205fc6a3d7 tests: integration tests for third-party packages (#112)
Closes #103
2020-01-06 22:56:38 -05:00
Michael McLoughlin
49adad921f ci: change schedule (#110)
Schedule CI early morning every Saturday. Trigger only on pushes to master.

Updates #106
2020-01-03 22:49:38 -08:00
Michael McLoughlin
9f9d2ca8cf Revert "ci: go version 1.x"
This reverts commit 5c45f0f96c.
2020-01-03 22:40:05 -08:00
Michael McLoughlin
5c45f0f96c ci: go version 1.x 2020-01-03 22:37:11 -08:00
Michael McLoughlin
07e91579e2 meta: remove build link
Removing link since the "Actions" tab returns 404 when not logged in.

Updates #106
2020-01-03 22:29:23 -08:00
Michael McLoughlin
3d189f08a9 ci: separate lint job (#109)
Updates #106
2020-01-03 22:06:24 -08:00
Michael McLoughlin
03ee750ed2 ci: disable travis (#108)
Deletes travis config and updates build badge.

Updates #106
2020-01-03 21:42:19 -08:00
Michael McLoughlin
3426f8bd2d ci: github actions (#107)
Github actions workflow for CI.

Updates #106
2020-01-03 17:32:09 -08:00
Michael McLoughlin
cfc6ecac41 tests/alloc/gp8: allocator test using all 8-bit registers (#102)
Updates #43
2019-12-20 15:31:35 -08:00
Koichi Shiraishi
15d6a9a17e attr,build: add TOPFRAME attribute (#98)
Go added the TOPFRAME attribute in https://golang.org/cl/169726/. This diff adds the new attribute to avo, and also updates handling of the REFLECTMETHOD attribute.
2019-09-26 21:11:50 -07:00
Michael McLoughlin
c8004ba627 ir,build: pragma support (#97)
Adds support for arbitrary compiler directives.

Fixes #15
2019-09-16 11:01:48 -07:00
Michael McLoughlin
0bcbe82731 ci: fix build for go 1.13 (#96)
Updates modules handling so build passes in Go 1.13. Bypasses modules for tools install in bootstrap. Upgrades golangci-lint version to avoid bug with v1.17.1 under Go 1.13.

Fixes #95
2019-09-15 14:43:44 -07:00
Michael McLoughlin
bb615f61ce all: formatting (#93)
Enforce stricter formatting and import grouping with gofumports.
2019-07-30 18:40:47 -07:00
Michael McLoughlin
d43efabdbe inst,ir: cancelling inputs (#92)
Adds support for a `CancellingInputs` instruction flag, to indicate cases like `XORQ R10, R10` where the instruction actually does not depend on the value of `R10` at all.

Closes #89
2019-07-28 17:58:49 -07:00
Michael McLoughlin
8f97788836 build: use packages.NeedImports (#91)
Use packages.NeedImports when loading packages. This fixes avo to account for a bugfix in golang/tools@aac0b97.

Closes #90
2019-07-20 20:34:38 -07:00
Michael McLoughlin
cad456ebde lint: bump golangci-lint to v1.17.1 (#88) 2019-06-13 11:44:24 -07:00
Michael McLoughlin
3355ecfbfd lint: stop using deprecated go/packages api (#87)
The packages.Load* constants have been deprecated in favor of packages.Need*.
2019-06-13 11:20:49 -07:00
Michael McLoughlin
83fbad1a6b doc: add links to dotgo talk and slides 2019-05-14 21:00:33 -07:00
Michael McLoughlin
2e7d06bc7a pass: remove redundant jumps and dangling labels (#81)
In jump-table-like constructs, the natural way of writing the code can sometimes produce redundant jumps or labels. Therefore some basic cleanup steps have been proposed. This diff adds two transforms:

1. Remove unconditional jumps to a label immediately following.
2. Remove labels with no references at all.

Fixes #75
2019-04-15 19:42:11 -07:00
Michael McLoughlin
57c23b967e pass: add PruneSelfMoves cleanup pass (#80)
In some cases natural use of abstraction in avo programs can lead to redundant move instructions, specifically self-moves such as MOVQ AX, AX. This does not produce incorrect code but it is incorrect and inelegant.

This diff introduces a PruneSelfMoves pass that removes such unnecessary instructions.

Closes #76
2019-04-14 14:26:28 -07:00
Michael McLoughlin
5d3176b111 examples/stadtx: re-fork stadx code
The gofumpt changes made some files *technically* not an exact fork of
the original. I'm OCD about these things.
2019-04-13 22:55:27 -05:00
Michael McLoughlin
1735441939 all: apply gofumpt (#79)
Apply @mvdan's opinionated gofumpt formatter across the codebase.
2019-04-13 22:53:13 -05:00
Michael McLoughlin
d0da7e47ad gotypes: add missing Underlying() calls (#78)
Issue #77 pointed out that in the case of named array types, the gotypes Components type fails to recognize the underlying type as an array. In fact this problem was more widespread. This diff fixes the missing calls to Underlying() and adds some test cases.

Fixes #77
2019-04-13 18:50:51 -04:00
Michael McLoughlin
138eaf8dc3 reg: rename Bytes() to Size() (#74)
It was pointed out #73 that Bytes() is a poor name for the size of the register in bytes. In idiomatic Go you would probably expect a Bytes() method to return []byte.

This diff changes the Bytes() to Size(). As a result the Size type also needed to be renamed, and Width seemed a reasonable choice.

Fixes #73
2019-04-01 20:27:44 -07:00
Michael McLoughlin
7a0eb66183 pass: improve unknown label error message 2019-03-17 22:35:54 -07:00
Michael McLoughlin
87539d3a7f examples: remove errant backup tarball 2019-03-17 14:55:44 -07:00
Michael McLoughlin
e4cc632b47 lint: bump golangci-lint to 1.15.0
Updates #64
2019-03-04 21:33:46 -08:00
Michael McLoughlin
3cfe40e76c build: load package in LoadAllSyntax mode (#63)
Fixes #62
2019-02-20 21:17:28 +00:00
Michael McLoughlin
9eb409b935 gotypes,build: pointer dereference (#61)
Provides a method on `gotypes.Component` to allow pointer dereference. This will enable `gotypes` helpers to be used with struct pointer arguments, for example.

Updates #53 
Fixes #54
2019-01-27 19:22:21 -08:00
Michael McLoughlin
eb225e9d2c gotypes,build: add Implement (#58)
By using Implement you can provide a definition of a function, taking the signature from a stub in the package. One major benefit of this approach is it makes it easy to handle external types in the function signature.

Updates #55
2019-01-22 22:35:01 -08:00
Michael McLoughlin
9c913ee847 lint: linter for package docstrings (#59)
Fixes #38
2019-01-22 21:14:59 -08:00
Michael McLoughlin
f1e854a1c0 doc: change travis badge to master branch
Previously it would show failing if there was a failing pull request.
2019-01-21 22:49:52 -08:00
Michael McLoughlin
4bc8de39bb tests/fixedbugs/issue50: fix asmdecl complaint
Updates #50
2019-01-20 23:19:06 -08:00
Michael McLoughlin
02ecaad4e4 internal/load: use alias slice for determinism
Previously aliases were stored in a map which was causing
non-deterministic code generation (see recent build failures). This diff
changes to a slice to avoid this problem.

Updates #50
2019-01-20 23:06:42 -08:00
Michael McLoughlin
2d7a9ddb6c internal/load: rerun code generation
Updates #50
2019-01-20 22:43:14 -08:00
Michael McLoughlin
220969f8c8 internal/load: support additional MOVQ forms
The Go assembler merges MOVD/MOVQ instruction forms. The logic in the
avo instruction loader was discarding the MOVD forms. This diff should
merge them correctly.

Updates #50
2019-01-20 22:34:52 -08:00
Michael McLoughlin
5dc9498dac doc: go report badge 2019-01-13 12:06:47 -08:00
Michael McLoughlin
54ee3a8b77 lint: run asmdecl
Updates #24
2019-01-13 12:02:06 -08:00
Michael McLoughlin
475a241446 operand: include '+0' in named symbol references
Intended to address an asmdecl error.

  [amd64] Butterfly: use of unnamed argument 0(FP); offset 0 is x0+0(FP)

Updates #24
2019-01-13 12:00:57 -08:00
Michael McLoughlin
16c602d345 tests/attrtest: move decl to non-test file
Solves the asmdecl error:

  [amd64] AttrTest: function AttrTest missing Go declaration

Updates #24
2019-01-13 11:53:04 -08:00
Michael McLoughlin
a23fe8ee57 internal/cmd/asmdecl: standalone asmdecl checker
Updates #24
2019-01-13 11:40:47 -08:00
Michael McLoughlin
cdf63e263d lint: spelling mistake 2019-01-13 11:09:54 -08:00
Michael McLoughlin
dba3cf38db lint: link to gocritic issue (#49) 2019-01-13 11:09:37 -08:00
Michael McLoughlin
4aa8656eb0 lint: fix issues in examples (#49) 2019-01-13 10:12:52 -08:00
Michael McLoughlin
943d5f0ced examples/sum: attempt to avoid asmfmt mismatch
Updates #41
Updates #8
2019-01-11 11:06:10 -08:00
Michael McLoughlin
3ca82be16c examples/sum: use Comment (#41) 2019-01-11 10:57:38 -08:00
Michael McLoughlin
85432688f1 examples/sha1: forgot to regenerate README 2019-01-11 10:54:27 -08:00
Michael McLoughlin
d0357fa6f9 examples/sha1: use comments (#41) 2019-01-11 10:52:09 -08:00
Michael McLoughlin
94033059eb build: Commentf function
Convenience for adding a comment generated with fmt.Sprintf.

Updates #41
2019-01-11 10:51:36 -08:00