Commit Graph

162 Commits

Author SHA1 Message Date
Dan Gohman
f48c1d4f89 Update to target-lexicon 0.0.1 and faerie 0.4.1.
This fixes handling of custom targets.
2018-05-30 17:25:48 -07:00
Dan Gohman
4e67e08efd Use the target-lexicon crate.
This switches from a custom list of architectures to use the
target-lexicon crate.

 - "set is_64bit=1; isa x86" is replaced with "target x86_64", and
   similar for other architectures, and the `is_64bit` flag is removed
   entirely.

 - The `is_compressed` flag is removed too; it's no longer being used to
   control REX prefixes on x86-64, ARM and Thumb are separate
   architectures in target-lexicon, and we can figure out how to
   select RISC-V compressed encodings when we're ready.
2018-05-30 06:13:35 -07:00
Dan Gohman
a1fe0f82e1 Update to the latest stable rustfmt, 0.4.2-stable (febbb36 2018-04-12). 2018-05-29 10:37:38 -07:00
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
Tyler McMullen
f636d795c5 load_complex and store_complex instructions (#309)
* Start adding the load_complex and store_complex instructions.

N.b.:
The text format is not correct yet. Requires changes to the lexer and parser.
I'm not sure why I needed to change the RuntimeError to Exception yet. Will fix.

* Get first few encodings of load_complex working. Still needs var args type checking.

* Clean up ModRM helper functions in binemit.

* Implement 32-bit displace for load_complex

* Use encoding helpers instead of doing them all by hand

* Initial implementation of store_complex

* Parse value list for load/store_complex with + as delimiter. Looks nice.

* Add sign/zero-extension and size variants for load_complex.

* Add size variants of store_complex.

* Add asm helper lines to load/store complex bin tests.

* Example of length-checking the instruction ValueList for an encoding. Extremely questionable implementation.

* Fix Python linting issues

* First draft of postopt pass to fold adds and loads into load_complex. Just simple loads for now.

* Optimization pass now works with all types of loads.

* Add store+add -> store_complex to postopt pass

* Put complex address optimization behind ISA flag.

* Add load/store complex for f32 and f64

* Fixes changes to lexer that broke NaN parsing.

Abstracts away the repeated checks for whether or not the characters
following a + or - are going to be parsed as a number or not.

* Fix formatting issues

* Fix register restrictions for complex addresses.

* Encoding tests for x86-32.

* Add documentation for newly added instructions, recipes, and cdsl changes.

* Fix python formatting again

* Apply value-list length predicates to all LoadComplex and StoreComplex instructions.

* Add predicate types to new encoding helpers for mypy.

* Import FieldPredicate to satisfy mypy.

* Add and fix some "asm" strings in the encoding tests.

* Line-up 'bin' comments in x86/binary64 test

* Test parsing of offset-less store_complex instruction.

* 'sNaN' not 'sNan'

* Bounds check the lookup for polymorphic typevar operand.

* Fix encodings for istore16_complex.
2018-05-09 14:07:00 -05:00
Dan Gohman
b4f9eb5e55 Bump versino to 0.8.0 2018-05-01 19:54:21 -07:00
Dan Gohman
94a883abae Make settings::Flags::new consume the Builder.
This makes it more clear what the relationship is between the Builder
and the resulting Flags.
2018-04-30 13:53:36 -07:00
Dan Gohman
f4fe438bae Suppress a warning about AsciiExt being deprecated.
We currently support versions of Rust which need this import, so
suppress the warning on versions of Rust which deprecated it.
2018-04-30 13:53:29 -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
c5b15c2396 Refactor calling convention settings. (#304)
Add a calling-convention setting to the `Flags` used as part of the
`TargetIsa`. This allows Cretonne code that generates calls to use the
correct convention, such as when emitting libcalls during legalization
or when the wasm frontend is decoding functions. This setting can be
overridden per-function.

This also adds "fast", "cold", and "fastcall" conventions, with "fast"
as the new default. Note that "fast" and "cold" are not intended to be
ABI-compatible across Cretonne versions.

This will also ensure Windows users will get an `unimplemented!` rather
than silent calling-convention mismatches, which reflects the fact that
Windows calling conventions are not yet implemented.

This also renames SpiderWASM, which isn't camel-case, to Baldrdash,
which is, and which is also a more relevant name.
2018-04-22 21:35:18 -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
a9edb28414 Rename InstructionFormat::IndirectCall for consistency with Opcode::CallIndirect. 2018-04-17 09:47:27 -07:00
Dan Gohman
635d14c251 Rename GlobalVarData::VmCtx for consistency with ArgumentPurpose::VMContext. 2018-04-17 09:47:27 -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
9e4ab7dc86 Rename CallConv::Native to CallConv::SystemV. (#291)
To keep cross-compiling straightforward, Cretonne shouldn't have any
behavior that depends on the host. This renames the "Native" calling
convention to "SystemV", which has a defined meaning for each target,
so that it's clear that the calling convention doesn't change
depending on what host Cretonne is running on.
2018-03-30 12:32:14 -07:00
Dan Gohman
4af95e37a6 Convert regular comments to documentation comments. 2018-03-28 22:48:30 -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
Dan Gohman
592db1de7a Tighten up the parser's verification of value aliases.
This prevents uses of undefined values from passsing through
unnoticed, and ensures that all aliases are ultimately resolved,
regardless of where they are defined.
2018-03-28 22:07:08 -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
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
e776d987fd Add Cargo.toml badges for published packages.
This adds a basic travis badge, as well as a badge indicating
"experimental" status, since the APIs are still evolving.
2018-03-13 09:34:11 -07:00
Dan Gohman
e441337e4b Bump version to 0.3.4 2018-03-09 16:32:13 -08:00
Dan Gohman
b5f428b6f2 Bump version to 0.3.3 2018-03-08 02:50:09 -08:00
Dan Gohman
ee0bce4106 Bump version to 0.3.2 2018-03-05 16:17:00 -08:00
Dan Gohman
d119524c90 Bump version to 0.3.1 2018-03-05 07:11:23 -08:00
Dan Gohman
13b167770c Include emergency stack slots when laying out the stack.
Emergency stack slots are a new kind of stack slot added relatively
recently. They need to be allocated a stack offset just like explicit
and spill slots.

Also, make StackSlotData's offset field an Option, to catch problems
like this in the future. Previously the value 0 was used when offsets
weren't assigned yet, however that made it non-obvious when the field
meant "not assigned yet" and when it meant "assigned the value 0".
2018-03-04 21:34:49 -08:00
Bruce Mitchener
125270e2b0 Fix some typos. 2018-03-04 21:33:04 -08:00
Dan Gohman
5dc449ec9e Rename "local variables" to "explicit stack slots".
The term "local variables" predated the SSA builder in the front-end
crate, which also provides a way to implement source-language local
variables. The name "explicit stack slot" makes it clear what this
construct is.
2018-02-28 14:04:28 -08:00
Dan Gohman
c93f29ad1e Remove more obsolete comments about entity number remapping. 2018-02-28 13:30:37 -08:00
Dan Gohman
b9f51d7850 Enable more compliler lints. 2018-02-28 13:18:07 -08:00
Dan Gohman
6fcbb20e10 Bump version to 0.3.0 2018-02-28 10:31:00 -08:00
Dan Gohman
9010e576dd Simply instruction result value handling in the parser.
Also, move the handling earlier so that they're checked before the rest
of the instruction is checked.
2018-02-28 10:10:42 -08:00
Dan Gohman
dabfc55c6e Bump version to 0.2.0 2018-02-27 15:58:25 -08:00
Dan Gohman
2a26b70854 Update URLs. 2018-02-23 16:16:44 -08:00
Jakob Stoklund Olesen
ec746c3359 Add a publish-all.sh script.
Set identical version numbers on all cretonne-* crates and print "cargo
publish" commands.

Update all crates to version 0.1.0.
2018-02-23 12:51:14 -08:00
Dan Gohman
c7655c4928 Add minimal README.md files to published crates.
This will put descriptions on the packages' crates.io pages.
2018-02-21 20:50:03 -08:00
Dan Gohman
69cc6c8af3 Clean up more comments referring to "source numbers". 2018-02-20 17:27:46 -08:00
Dan Gohman
a5b00b173e Don't renumber entities in the parser.
This makes it easier to debug testcases:
 - the entity numbers in a .cton file match the entity numbers used
   within Cretonne.
 - serializing and deserializing doesn't cause indices to change.

One disadvantage is that if a .cton file uses sparse entity numbers,
deserializing to the in-memory form doesn't compact it. However, the
text format is not intended to be performance-critical, so this isn't
expected to be a big burden.
2018-02-20 17:27:46 -08:00