Commit Graph

95 Commits

Author SHA1 Message Date
Lachlan Sneff
f97ad59991 Fix breaking change 2018-06-15 18:33:30 -07:00
Lachlan Sneff
38ab82bcc0 Made changes for review 2018-06-15 18:33:30 -07:00
Lachlan Sneff
3686fc2fc7 Fix typos caused by find-and-replace 2018-06-15 18:33:30 -07:00
Lachlan Sneff
5c320a0d30 Change GlobalVar to GlobalValue 2018-06-15 18:33:30 -07:00
Dan Gohman
49cc693d64 Update to hashmap_core 0.1.7. 2018-06-15 10:35:13 -07:00
Dan Gohman
dfc7065252 Bump version to 0.11.0 2018-06-15 08:46:25 -07:00
Dan Gohman
1cab2f2d73 Remove an unneeded comment. 2018-06-13 07:41:39 -07:00
Dan Gohman
9542cab5ed Bump version to 0.10.0 2018-06-12 12:29:59 -07:00
Sergey Pepyakin
399860e2aa Encode bnot on x86. 2018-06-12 11:54:23 -07:00
Dan Gohman
a7813c4448 Update to target-lexicon 0.0.2.
This fixes compilation on rust 1.22.1.
2018-06-12 06:36:07 -07:00
Dan Gohman
1b55a2d005 Rename more Error and Result types. 2018-06-12 05:02:25 -07:00
Dan Gohman
6971ae1c26 Export CodegenError and CodegenResult at the top level.
Make cretonne-codegen's `result` module private, and instead just export
`CodegenError` and `CodegenResult` at the top level of the
cretonne-codegen crate. This makes them more consistent with Result and
Error types in other cretonne crates.
2018-06-12 05:02:25 -07:00
Dan Gohman
8a26a50475 Rename CtonError and CtonResult to CodegenError and CodegenResult. 2018-06-12 05:02:25 -07:00
Dan Gohman
02e34d1bf7 Make CtonError parameterized on the result type.
This makes it more consistent with other custom `Result` types.
2018-06-12 05:02:25 -07:00
Dan Gohman
13f22065a2 Rename verifier's Result and Error.
This provides consistency with similar types in other parts of
Cretonne, and avoids shadowing `Result` from the standard prelude.
2018-06-12 05:02:25 -07:00
Dan Gohman
ffe57d9051 Fix a typo in a comment. 2018-06-12 05:02:25 -07:00
Dan Gohman
de2a2fe418 Minor code cleanup. 2018-06-12 05:02:25 -07:00
Dan Gohman
967da59181 Fix shellcheck warnings in shell scripts. 2018-06-12 05:02:25 -07:00
Dan Gohman
0daa560368 Accept redundant alias definitions.
In the text format, allow aliases to be defined multiple times, as long
as they're always aliasing the same value.

write.rs is already emitting redundant aliases, because it emits them at
their uses, so this change allows the parser to be able to parse such
code.
2018-06-12 05:02:25 -07:00
Dan Gohman
00d7d3a774 Implement IntoIterator for PrimaryMap.
This makes iterating through a `PrimaryMap` more consistent with
iterating through a `Vec`.
2018-06-12 05:02:17 -07:00
Dan Gohman
fdf89edbfe Fail loudly if a build.rs dependency path can't be printed. 2018-06-09 13:22:44 -07:00
Sergey Pepyakin
e4fe1db3b8 Assert that stack_limit is none. 2018-06-09 13:18:12 -07:00
Sergey Pepyakin
ddc8c91419 Displaying stack_limit 2018-06-09 13:18:12 -07:00
Sergey Pepyakin
73b6468d25 Parsing stack_limit 2018-06-09 13:18:12 -07:00
Sergey Pepyakin
effe770c5f Add stack_limit global_var in Function 2018-06-09 13:18:12 -07:00
Sergey Pepyakin
e9111d1de2 Ditch stack_check instruction 2018-06-09 13:18:12 -07:00
Dan Gohman
944251260b Bump version to 0.9.0 2018-06-07 11:46:36 -07:00
Dan Gohman
f5c1273fcf Use cfg_attr to tidy up an extern crate declaration. 2018-06-07 11:34:55 -07:00
Dan Gohman
b2b20a95a1 Fix missing no_std support in cretonne-module.
And, tidy up the extern crate declarations in the std replacement modules.
2018-06-07 11:34:55 -07:00
Dan Gohman
750483b9ac Update to hashmap_core 0.1.6. 2018-06-07 10:45:30 -07:00
Dan Gohman
6ec3a3f7a1 Pass the "std" feature through to target-lexicon. 2018-06-07 09:56:45 -07:00
Dan Gohman
970045c309 Set clobbers_flags to False for urm_noflags_abcd.
`urm_noflags` is a variant of `urm` which doesn't clobber the flags, and
`urm_noflags_abcd` is a further variant for ABCD registers, so it also
doesn't clobber the flags.
2018-06-05 11:30:35 -07:00
Dan Gohman
6c003d68cd Factor out pointer_bits() and pointer_bytes() helper functions. 2018-05-31 11:21:26 -07:00
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
c21af29c79 Legalize libcall signatures.
Explicitly legalize signatures created for libcalls.
2018-05-29 10:21:52 -07:00
Dan Gohman
d8eaa19dda Make an assert message more verbose. 2018-05-29 10:21:52 -07:00
Dan Gohman
09fb914823 Make an assert message more verbose. 2018-05-25 11:41:55 -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
Dan Gohman
99f6055c55 Fix warnings reported by bashate.
See https://pypi.org/project/bashate/ for more info.
2018-05-24 16:53:34 -07:00
data-pup
191bab162b Optimize 0.0 floating point constants. (#344)
* Optimize 0.0 floating point constants. Rather than using the existing
process of emitting bit patterns and moving them into floating point
registers, use the `xorps` instruction to zero out the register.

* is_zero predicate function will not accept negative zero. Fixed formatting for encoding recipe and filetests.
2018-05-24 14:16:25 -07:00
Dan Gohman
89e7d56120 Allow wasm embedders to reject wasm modules with unsupported features. (#345)
Define `WasmError` (and an accompanying `WasmResult`) to represent
errors translating WebAssembly functions. Make `translate_call` and
related functions return `WasmResult`s so that embedders have the
flexibility to reject features they don't support.

Move `InvalidInput` out of `CtonError` and into `WasmError`, where it's
now named `InvalidWebAssembly`, as it's a WebAssembly-specific error
condition. Also extend it to preserve the original error message and
bytecode offset.
2018-05-21 20:49:19 -07:00
Dan Gohman
923ea8ada9 Add assertions to check that postopt encoding succeeds. 2018-05-18 15:40:45 -07:00
Amanieu d'Antras
e9d362d902 Improve coalescing performance by using a FxHashMap (#340)
* Use FxHashMap instead of HashMap for better performance

* Replace the binary search in the coalescing pass with a FxHashMap

This speeds up coalescing by up to 16% and overall compilation by 9%
2018-05-18 15:40:08 -07:00
Amanieu d'Antras
80fdfb2376 Optimize partition_slice (#341)
* Generate debug symbols in optimized builds.

This allows profiling tools to provide more accurate information,
especially details about inlined functions.

* Rewrite and optimize partition_slice

This improves the performance of the register allocation passes
which use LiveValueTracker.
2018-05-18 12:54:00 -07:00
Dan Gohman
842cd13bd1 Improve the error message when python isn't installed. 2018-05-14 20:11:51 -10:00
pup
34b8c00d61 Minor typo fix in constant_hash comment. (#329) 2018-05-12 07:30:15 -10:00
pup
b36fc6b75f Issue 311 - Add a pass to make NaN bits deterministic. (#322) 2018-05-09 15:11:58 -05: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