Commit Graph

24 Commits

Author SHA1 Message Date
Benjamin Bouvier
b7f2acf0ea [build] Implement registers code generation in the Rust meta crate; 2018-11-06 13:12:17 -08:00
Benjamin Bouvier
17e88ed1c5 [build] Use the Rust-generated types files in place of the Python one; 2018-11-06 13:12:17 -08:00
Dan Gohman
d4f8eb7453 Introduce a TargetFrontendConfig type. (#570)
* Introduce a `TargetFrontendConfig` type.

`TargetFrontendConfig` is information specific to the target which is
provided to frontends to allow them to produce Cranelift IR for the
target. Currently this includes the pointer size and the default calling
convention.

The default calling convention is now inferred from the target, rather
than being a setting. cranelift-native is now just a provider of target
information, rather than also being a provider of settings, which gives
it a clearer role.

And instead of having cranelift-frontend routines require the whole
`TargetIsa`, just require the `TargetFrontendConfig`, and add a way to
get the `TargetFrontendConfig` from a `Module`.

Fixes #529.
Fixes #555.
2018-11-02 13:51:42 -07:00
theJosher
d2b3ff6183 Errors reported by mypy 0.641 #558 2018-10-29 19:53:43 -07:00
Dan Gohman
a2fcb32245 Escape backslashes in Python comments.
The latest version of flake8 diagnoses these as invalid escape
sequences, so properly escape them.
2018-10-24 10:00:42 -07:00
Benjamin Bouvier
9d6821d6d9 Fix #335: Introduce variable size recipes and remove GPR_SAFE reg classes (#552)
* Rename size to base_size and introduce a compute_size function;

* Add infra to inspect in/outs registers when computing the size of an instruction;

* Remove the GPR_SAFE_DEREF and GPR_ZERO_DEREF_SAFE register classes on x86 (fixes #335);
2018-10-15 15:43:38 -07:00
Dan Gohman
bf041e3ae2 Move return_at_end out of Settings and into the wasm FuncEnvironment. (#547)
* Move `return_at_end` out of Settings and into the wasm FuncEnvironment.

The `return_at_end` flag supports users that want to append a custom
epilogue to Cranelift-produced functions. It arranges for functions to
always return via a single return statement at the end, and users are
expected to remove this return to append their code.

This patch makes two changes:
 - First, introduce a `fallthrough_return` instruction and use that
   instead of adding a `return` at the end. That's simpler than having
   users remove the `return` themselves.

 - Second, move this setting out of the Settings and into the wasm
   FuncEnvironment. This flag isn't something the code generator uses,
   it's something that the wasm translator uses. The code generator
   needs to preserve the property, however we can give the
   `fallthrough_return` instruction properties to ensure this as needed,
   such as marking it non-cloneable.
2018-10-05 06:43:22 -07:00
Dan Gohman
2eb9ae45aa Tidy up some comments. 2018-10-04 10:43:11 -07:00
bjorn3
b2a28d69e6 Add encodings for i8 and i16 copy, spill, fill, ireduce.i8.i16 (#534)
* Add encodings for i8 and i16 copy, spill, fill, ireduce.i8.i16

Also adds legalization for srem, irsub_imm, {u,s}extend.i16.i8

Fixes #477 cc #466

* Legalize popcnt, clz and ctz for i8 and i16

* Fix bug in call_memset
2018-10-03 14:43:59 -07:00
Tyler McMullen
79cea5e18b Implement jump tables (#453)
* Add 'jump_table_entry' and 'indirect_jump' instructions.

* Update CodeSink to keep track of code size. Pretty up clif-util's disassembly output.

* Only disassemble the machine portion of output. Pretty print the read-only data after it.

* Update switch frontend code to use new br_table instruction w/ default.
2018-10-03 10:04:21 -07:00
Dan Gohman
aa5ba71c97 Clarify the meaning of the symbol_value instruction. 2018-09-27 11:43:41 -07:00
bjorn3
2eec1469a8 Legalize some more i8/i16 intructions (#524)
* Legalize some more i8/i16 intructions
2018-09-25 16:10:23 -07:00
Dan Gohman
608e74d8cb Document that b8 etc. are intended for use as SIMD elements. 2018-09-05 14:23:03 -07:00
Dan Gohman
d4b8622393 Rename the VOID type to INVALID and clean up obsolete comments.
The VOID type isn't used for anything resembling what "void" means in C,
so rename it to INVALID to avoid confusion.
2018-09-04 21:46:22 -07:00
Dan Gohman
18900df4d5 Clean up obsolete comments. 2018-09-04 21:22:50 -07:00
Dan Gohman
ca9da7702e Reorganize the global value kinds. (#490)
* Reorganize the global value kinds.

This:
 - renames "deref" global values to "load" and gives it a offset that works
   like the "load" instructions' does
 - adds an explicit "iadd_imm" global value kind, which replaces the
   builtin iadd in "vmctx" and "deref" global values.
 - also renames "globalsym" to "symbol"
2018-09-04 21:09:04 -07:00
Aaron Power
17bb62c16c Added bitrev instruction for 32 and 64 bit integers (#486) 2018-09-04 16:23:50 -07:00
Dan Gohman
c23bfdaa91 Minor code simplification. 2018-08-28 16:24:10 -07:00
bjorn3
3f582f7cbd Legalize br_icmp (#449)
* Legalize br_icmp
2018-08-13 18:31:39 -07:00
bjorn3
fa65ee7a68 Legalize bint.i8 2018-08-13 21:23:25 +02:00
Benjamin Bouvier
f7e481d9ac Implement wasm saturating conversions; 2018-08-09 19:50:41 -07:00
Dan Gohman
1b30265c5c Define a "table" concept.
"Table" is to WebAssembly tables as "Heap" is to WebAssembly linear
memories.
2018-08-02 15:21:34 -07:00
bjorn3
01729be8d7 Add comment support (#379)
* Add comment support

* Don't print empty comments

* Add nop instruction

* Add test and note

* Add FuncWriter trait

* Remove comment support

* Add write_preamble to FuncWriter

* Fix test

* Some changes
2018-08-01 11:21:05 -07:00
data-pup
d9d40e1cdf lib/codegen-meta moved into lib/codegen. (#423)
* lib/codegen-meta moved into lib/codegen.

* Renamed codegen-meta and existing meta.
2018-07-31 07:56:26 -07:00