Commit Graph

81 Commits

Author SHA1 Message Date
Dan Gohman
6b88cd44a8 Update to rustfmt-preview (#348)
* Update to rustfmt-preview.

* Run "cargo fmt --all" with rustfmt 0.4.1.

rustfmt 0.4.1 is the latest release of rustfmt-preview available on the
stable channel.

* Fix a long line that rustfmt 0.4.1 can't handle.

* Remove unneeded commas left behind by rustfmt.
2018-05-25 11:38:38 -07:00
Dan Gohman
d46ceedc98 Tidy up unneeded commmas. 2018-05-24 14:52:51 -07:00
Dan Gohman
b4f9eb5e55 Bump versino to 0.8.0 2018-05-01 19:54:21 -07:00
Dan Gohman
525f01713b Bump version to 0.7.0 2018-04-27 06:10:15 -07:00
Dan Gohman
e356c742aa Bump version to 0.6.0 2018-04-23 14:35:23 -07:00
Dan Gohman
583ae56fd2 Use opt_level instead of is_compressed for encoding optimizations.
Choosing smaller instruction encodings on eg. x86 is an optimization,
rather than a useful discrete setting.

Use "is_compressed" only for ISAs that have an explicit compression feature
that users of the output may to be aware of, such as RISC-V's RVC or
ARM's Thumb-2.
2018-04-19 16:33:38 -07:00
Dan Gohman
fd8df67cfd Convert an http link to https. 2018-04-19 13:52:27 -07:00
Dan Gohman
1ba468b230 Bump version to 0.5.1 2018-04-17 22:18:30 -07:00
Dan Gohman
bf597b7abf Enable and fix several more clippy lints. 2018-04-17 17:05:03 -07:00
Dan Gohman
1f43ec09f3 Bump version to 0.5.0 2018-04-17 10:58:33 -07:00
Dan Gohman
f43b6aca1a Use lower-case letters for github URLs.
This makes it a little more consistent; now, "cretonne" is never capitalized
in identifier, path, or URL contexts. It is capitalized in natural
language contexts when referring to the project.
2018-04-17 09:47:11 -07:00
Dan Gohman
24fa169e1f Rename the 'cretonne' crate to 'cretonne-codegen'.
This fixes the next part of #287.
2018-04-17 09:46:56 -07:00
Dan Gohman
7767186dd0 Rename 'cton_*' library names to match the 'cretonne_*' crate names.
This renames `cton_frontend` to `cretonne_frontend` and so on.

This fixes the first part of #287.
2018-04-17 07:55:59 -07:00
Dan Gohman
f552c8768e Bump version to 0.4.4 2018-04-16 16:37:00 -07:00
Dan Gohman
a4523cf0b8 Bump version to 0.4.3 2018-04-16 14:48:11 -07:00
Dan Gohman
0e57f3d0ea Add a "colocated" flag to symbol references. (#298)
This adds a "colocated" flag to function and symbolic global variables which
indicates that they are defined along with the current function, so they can
use PC-relative addressing.

This also changes the function decl syntax; the name now always precedes the
signature, and the "function" keyword is no longer included.
2018-04-13 15:00:09 -07:00
Dan Gohman
781d3ee3ff Bump version to 0.4.2 2018-04-03 16:04:54 -07:00
Dan Gohman
c50675deb8 Format with nightly rustfmt-preview, then with rustfmt-0.9 again. 2018-03-30 13:23:47 -07:00
Dan Gohman
8d5fecd324 Format with stable rustfmt-preview, then with rustfmt-0.9 again. 2018-03-30 13:17:15 -07:00
Dan Gohman
72b7a4b3ef Add iter() and values() functions to PrimaryMap and EntityMap.
`iter()` iterates over both keys and values, while `values()` iterates over
just values. Also add `_mut()` versions.

These replace the otherwise common idiom of iterating with `keys()` and using
indexing to get the values, allowing for simpler code.
2018-03-30 12:45:52 -07:00
Dan Gohman
6606b88136 Optimize immediates and compare and branch sequences (#286)
* Add a pre-opt optimization to change constants into immediates.

This converts 'iadd' + 'iconst' into 'iadd_imm', and so on.

* Optimize away redundant `bint` instructions.

Cretonne has a concept of "Testable" values, which can be either boolean
or integer. When the an instruction needing a "Testable" value receives
the result of a `bint`, converting boolean to integer, eliminate the
`bint`, as it's redundant.

* Postopt: Optimize using CPU flags.

This introduces a post-legalization optimization pass which converts
compare+branch sequences to use flags values on CPUs which support it.

* Define a form of x86's `urm` that doesn't clobber FLAGS.

movzbl/movsbl/etc. don't clobber FLAGS; define a form of the `urm`
recipe that represents this.

* Implement a DCE pass.

This pass deletes instructions with no side effects and no results that
are used.

* Clarify ambiguity about "32-bit" and "64-bit" in comments.

* Add x86 encodings for icmp_imm.

* Add a testcase for postopt CPU flags optimization.

This covers the basic functionality of transforming compare+branch
sequences to use CPU flags.

* Pattern-match irsub_imm in preopt.
2018-03-30 12:30:07 -07:00
Dan Gohman
4af95e37a6 Convert regular comments to documentation comments. 2018-03-28 22:48:30 -07:00
Tyler McMullen
951ff11f85 [WIP] Add a Trap sink to code generation (#279)
* First draft of TrapSink implementation.

* Add trap sink calls to 'trapif' and 'trapff' recipes.

* Add SourceLoc to trap sink calls, and add trap sink calls to all loads and stores.

* Add IntegerDivisionByZero trap to div recipe.

* Only emit load/store traps if 'notrap' flag is not set on the instruction.

* Update filetest machinery to add new trap sink functionality.

* Update filetests to include traps in output.

* Add a few more trap outputs to filetests.

* Add trap output to CLI tool.
2018-03-28 22:48:03 -07:00
Dan Gohman
57cd69d8b4 Say "IR" instead of "IL".
While the specifics of these terms are debatable, "IR" generally
isn't incorrect in this context, and is the more widely recognized
term at this time.

See also the discussion in #267.

Fixes #267.
2018-03-28 22:07:26 -07:00
Pat Hickey
03ee007624 Use clippy (#276)
* cton-util: fix some clippy unnecessary pass-by-value warnings

* clippy: ignore too many arguments / cyclomatic complexity in module

since these functions are taking args coming from the command line, i
dont think this is actually a valid lint, morally the arguments are all
from one structure

* cton-util: take care of remaining clippy warnings

* cton-reader: fix all non-suspicious clippy warnings

* cton-reader: disable clippy at site of suspicious lint

* cton-frontend: disable clippy at the site of an invalid lint

* cton-frontend: fix clippy warnings, or ignore benign ones

* clippy: ignore the camelcase word WebAssembly in docs

* cton-wasm: fix clippy complaints or ignore benign ones

* cton-wasm tests: fix clippy complaints

* cretonne: starting point turns off all clippy warnings

* cretonne: clippy fixes, or lower allow() to source of problem

* cretonne: more clippy fixes

* cretonne: fix or disable needless_lifetimes lint

this linter is buggy when the declared lifetime is used for another type
constraint.

* cretonne: fix clippy complaint about Pass::NoPass

* rustfmt

* fix prev minor api changes clippy suggested

* add clippy to test-all

* cton-filetests: clippy fixes

* simplify clippy reporting in test-all

* cretonne: document clippy allows better

* cretonne: fix some more clippy lints

* cretonne: fix clippy lints (mostly doc comments)

* cretonne: allow all needless_lifetimes clippy warnings

remove overrides at the false positives

* rustfmt
2018-03-22 13:10:41 -07:00
Dan Gohman
da4cf27780 Update to filecheck 0.3.0. 2018-03-20 13:28:35 -07:00
Dan Gohman
2d1f9f874c Bump version to 0.4.1 2018-03-18 14:56:30 -07:00
Dan Gohman
921cea2845 Bump version to 0.4.0 2018-03-16 16:12:56 -07:00
Dan Gohman
4dbafb45c7 Update to num_cpus 1.8, and other updates. 2018-03-15 21:09:59 -07:00
Dan Gohman
e889b88d04 Split filecheck out into its own repo. 2018-03-15 15:35:48 -07:00
Dan Gohman
965b93bd2a Move the filetest harness into its own crate.
This allows us to run the tests via a library call rather than just
as a command execution. And, it's a step toward a broader goal, which
is to keep the code in the top-level src directory minimal, with
important functionality exposed as crates.
2018-03-15 15:35:48 -07:00