* Put TargetIsa's emit_inst under a "testing_hooks" feature.
In practice, TargetIsa's emit_inst pulls in its own instantiation
of the target-specifi `emit_inst` functions, which can be quite
large, and LTO doesn't eliminate them because they're held live
by TargetIsa's vtable.
Fortunately, this function is only used by tests, so we can put
it behind a feature flag.
Fixes#530.
* Add comments for `emit_inst` to clarify its purpose.
* 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.
WebAssembly doesn't have non-dense jump tables, and higher-level users
are better served by the facilities in lib/frontend/src/switch.rs for
working with non-dense switches.
This eliminates the concept of "absent" jump table entries, which
were represented as "0" in the text format.
Also, jump table contents are now enclosed in `[` and `]`, so that
we can unambiguously display empty jump tables. Previously, empty jump
tables were displayed as if they had a single absent entry.
* 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
* 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.
The majority of the test modules were already named "tests", and that's
what the example in the Rust book uses, so switch to that for all test
modules, for consistency.
* 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"
This makes several changes:
- It adds an index_type to heap declarations, allowing heaps to specify the
type for indexing. This also anticipates 64-bit heap support.
- It adds a memory_type to deref global values, allowing deref globals to
have types other than pointers. This is used to allow the bound variable
in dynamic heaps to have type i32, to match the index type in heaps
with i32 index type.
- And, it fixes heap legalization to do the bounds check in the heap's
index type.
* fix error not reported if at least one other error expected.
* Fixed unused extern crate error if wasm feature is not enabled.
* No longer reporting deref cycles multiple times.
* Fix filetest type_check.clif.
* Switched comparison order for perf.
* Fixed isa/riscv/verify-encoding.clif filetest.
* Fixed error reporting.
* Fixed compile time error when wasm feature is disabled.
* Fixed valid instructions not being printed in print_function_error.
* Fixed errors print_function_error not writing valid instructions after end.
* Made multiple checks non-fatal.
* verify_global_values is no longer fatal.
* Slightly better formatting of errors in pretty_verifier_error.