Commit Graph

50 Commits

Author SHA1 Message Date
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
bb615f61ce all: formatting (#93)
Enforce stricter formatting and import grouping with gofumports.
2019-07-30 18:40:47 -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
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
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
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
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
94033059eb build: Commentf function
Convenience for adding a comment generated with fmt.Sprintf.

Updates #41
2019-01-11 10:51:36 -08:00
Michael McLoughlin
284ee13ada build: support comments in functions (#41) 2019-01-11 10:33:41 -08:00
Michael McLoughlin
775226218c internal/gen: docstrings for instruction builders
Piggybacks off the docstrings for constructors in x64 package.

Closes #36
2019-01-06 21:12:15 -08:00
Michael McLoughlin
400288e4b6 build: use const for attribute values 2019-01-06 21:03:59 -08:00
Michael McLoughlin
304c7425d2 build: add attributes argument to TEXT
Brings the TEXT() function signature closer to how the directive works
in assembly.

Also update almost all examples to use NOSPLIT.

Closes #11
2019-01-06 20:04:51 -08:00
Michael McLoughlin
0f63e0906d ast: move "ast" types from root to ir sub-package
Closes #32
2019-01-06 14:21:10 -08:00
Michael McLoughlin
4a920c22b5 build: add missing doc comment (#34) 2019-01-06 13:53:57 -08:00
Michael McLoughlin
7d20ff4ced build: test LogError
Closes #34
2019-01-06 13:52:37 -08:00
Michael McLoughlin
07901bb91b build: return ErrorList type
Adds a very similar interface to go/scanner package for returning a list
of errors.

Updates #34
2019-01-06 13:32:09 -08:00
Michael McLoughlin
602bb5197c build: unify Label function signatures
The Context.Label method and LABEL global function did not agree. Also
breaks the convention I'd like to set that capitalized functions must
agree with existing Go assembly syntax.

To help avoid a conflict with `avo.Label`, attributes were moved to
their own package.

Fixes #35
2019-01-05 18:18:49 -08:00
Michael McLoughlin
5c67547d67 doc: add package-level doc comments (#9) 2019-01-05 17:23:56 -08:00
Michael McLoughlin
7eb55c9ac5 build: doc external symbols (#9) 2019-01-05 16:49:59 -08:00
Michael McLoughlin
c95744c872 build: some more doc comments (#9) 2019-01-05 00:11:13 -08:00
Michael McLoughlin
672b77a441 reg,build: remove "v" from virtual register ctors
Fixes #30
2019-01-04 18:23:44 -08:00
Michael McLoughlin
05cfa809f2 build: include position information in errors
Updates #5
2019-01-04 15:01:29 -08:00
Michael McLoughlin
75224ed031 build: remove Build stutter from BuildConstraint*
Address golint failure.
2019-01-02 21:55:43 -08:00
Michael McLoughlin
6202c2c9aa ast,build: add build constraints to File
Updates #3
2019-01-02 21:35:17 -08:00
Michael McLoughlin
cf76c56dfc testing: script to measure coverage of a binary
Updates #27
2019-01-02 20:04:45 -08:00
Michael McLoughlin
816fa4c0e6 ast,build: allow setting data attributes
Previously GLOBL/DATA attributes are set to RODATA. This diff removes
that default and allows them to be set through the DataAttributes
context method.

Updates #2
2018-12-31 19:04:14 -08:00
Michael McLoughlin
e364d6398e ast,build: add Attributes fields to Function and Global
Updates #2
2018-12-30 23:35:54 -08:00
Michael McLoughlin
18cdf50d7c reg: support for register casting
Adds methods for referencing sub- or super-registers. For example, for
general purpose registers you can now reference As8(), As16(), ... and
for vector AsX(), AsY(), AsZ().

Closes #1
2018-12-30 18:40:45 -08:00
Michael McLoughlin
9f5277bf8e support docstrings 2018-12-27 23:01:32 -08:00
Michael McLoughlin
6fc67c1fbc examples/geohash: first version
Adds helper for constants as DATA sections.
2018-12-27 15:44:52 -08:00
Michael McLoughlin
9243d299e6 first pass at DATA sections 2018-12-27 11:57:46 -08:00
Michael McLoughlin
d29c6340d7 ast: change file to have a list of sections 2018-12-26 18:58:12 -08:00
Michael McLoughlin
6d1424dc66 build: -cpuprofile flag 2018-12-21 17:38:19 -08:00
Michael McLoughlin
f464082484 examples/sha1: single block 2018-12-21 00:30:59 -08:00
Michael McLoughlin
ca5c7e7454 printer: add generated code warnings 2018-12-18 22:57:26 -08:00
Michael McLoughlin
7f3efa1eb5 fix nil pointer dereference 2018-12-17 21:20:21 -08:00
Michael McLoughlin
34a3ddefcc start example/test for components access 2018-12-17 20:52:26 -08:00
Michael McLoughlin
c882e52510 printing: commit some refactors (probably broken) 2018-12-11 00:18:22 -08:00
Michael McLoughlin
271670c14c avogen: make mov generator deterministic 2018-12-08 22:14:30 -08:00
Michael McLoughlin
20525e1437 get the basic add example working 2018-12-08 22:02:02 -08:00
Michael McLoughlin
5431f2edef support signatures and param load/stores 2018-12-08 21:16:03 -08:00
Michael McLoughlin
69ee0e39cb parameter loading 2018-12-08 20:14:51 -08:00
Michael McLoughlin
faafa00e40 pass: test for liveness 2018-12-03 20:40:43 -08:00
Michael McLoughlin
b52c67f3fb pass: naive implementation of liveness 2018-12-02 23:59:29 -08:00
Michael McLoughlin
43575d8b61 start at some basic passes 2018-12-02 13:51:03 -08:00
Michael McLoughlin
0ba8a60ea5 add label type 2018-11-30 21:37:17 -08:00
Michael McLoughlin
241b5ea673 some command line flags for builders 2018-11-30 20:58:51 -08:00
Michael McLoughlin
9b9f5b7e0c first pass at a "builder" interface 2018-11-30 20:43:31 -08:00