Ebb parameters are appended explicitly by whoever calls create_block,
so they don't need to also be inferred from branches. This makes the
frontend code more flexible for producers that want to create things
in a different order, and it eliminates more temporary allocations.
FunctionBuilder no longer maintains its own list of the function
parameter values; these can be obtained from the ebb parameter list
on the entry block.
switch_to_block doesn't need its jump_args argument, since jump
arguments are handled by the `jump` instruction and others, rather
than on the switch to a new ebb itself.
Rename the ArgumentType type to AbiParam since it describes the ABI
characteristics of a parameter or return value, not just the value type.
In Signature, rename members argument_types and return_types to "params"
and "returns". Again, they are not just types.
Fix a couple lingering references to "EBB arguments".
Add EBB parameter and EBB argument to the langref glossary to clarify
the distinction between formal EBB parameter values and arguments passed
to branches.
- Replace "ebb_arg" with "ebb_param" in function names that deal with
EBB parameters.
- Rename the ValueDef variants to Result and Param.
- A bunch of other small langref fixes.
No functional changes intended.
This allows append_jump_argument to call just the part that it needs
instead of the whole of seal_ebb_header_block, which is a nice cleanup
on its own, and it also eliminates a cycle from the static call graph.
The FuncEnvironment callbacks (make_global in particular) may need to
insert code in the entry EBB. We need to make sure the entry EBB has
been inserted in the layout before making those callbacks.
Add a settings::FlagsOrIsa struct which represents a flags reference and
optionally the ISA it belongs to. Use this for passing flags/isa
information to the verifier.
The verify_function() and verify_context() functions are now generic so
they accept either a &Flags or a &TargetISa argument.
Fix the return_at_end verifier tests which no longer require an ISA
specified. The signle "set return_at_end" flag setting now makes it to
the verifier even when no ISA is present to carry it.
With FuncEnvironment using FuncCursors in place of full
FunctionBuilders, it's useful to move several of these convenience
functions from FunctionBuilder to Function.
Add two new arguments:
- table_index is the WebAssembly table referenced in the indirect call.
- sig_index is the WebAssembly signature index. We still have the SigRef
that was created by make_indirect_sig(), but the WebAssembly signature
index may be needed for detecting type mismatches at runtime.
Change the insertion location to a plain FuncCursor rather than a
FunctionBuilder<Local>. The fact that cretonne-wasm uses FunctionBuilder
should be an implementation detail, and the callbacks don't need to
access WebAssembly locals, so they don't need the extended interface.
Add a FunctionBuilder::cursor() method which creates a FuncCursor for
inserting instructions in the current EBB.
Also add a FuncEnvironment::translate_call() method which allows the
environment to override direct calls the same way as indirect calls.
This trait is used to provide the environment necessary to translate a
single WebAssembly function without having other global data structures
for the WebAssembly module.
The WasmRuntime trait extends the FuncEnvironment trait for those uses
that want to parse a whole WebAssembly module.
- Change the handling of WebAssembly globals to use the FuncEnvironment
trait as well as the new GlobalVar infrastructure in Cretonne. The
runtime is not consulted on the translation of each
get_global/get_global instruction. Instead it gets to create the
GlobalVar declaration in the function preamble the first time the
global is used.
- Change the handling of heap load/store instructions to use the new
Heap infrastructure in Cretonne. The runtime is called to create the
Heap declaration in the preamble. It is not involved in individual
load/store instructions.
* Replace SSABuilder's variables HashMaps with EntityMaps.
Current measurements show that memory usage is approximately the same,
and it's about 20% faster.
* Add EntityMap::with_default and use it.
* rustfmt
* Use var_defs[block].expand().