Debian Codegraph @

js/src/jit-test/tests/wasm/README-codegen.md

raw
1 About whitebox code generation tests (*-codegen.js) in this dir and
2 the simd subdir.
3
4 Whitebox codegen tests test a couple of things:
5
6 - that the best instructions are selected under ideal conditions:
7 showing that the instruction selector at least knows about these
8 instructions.
9
10 - that extraneous moves are not inserted by the register allocator or
11 code generator under ideal conditions: when it is in principle
12 possible for the code generator and register allocator to use inputs
13 where they are and generate outputs directly in the target
14 registers.
15
16 These tests are both limited in scope and brittle in the face of
17 changes to the register allocator and instruction selector, but how
18 else would we test that code generation and register allocation work
19 when presented with the easiest case? And if they don't work then,
20 when will they work?
21
22 For a reliable test, the inputs must be known to be in the fixed
23 parameter registers and the result must be known to be desired in the
24 fixed function result register.
25
26 Sometimes, to test optimal codegen, we need the inputs to be in
27 reversed or permuted locations so as to avoid generating moves that
28 are inserted by the regalloc to adapt to the function signature, or
29 there need to be some dummy parameter registers that are not used.
30
31 In the test cases, the expected output is expressed as a multi-line
32 regular expression. The first line of each expected output is the
33 tail end of the prologue; subsequent lines comprise the operation;
34 finally there is the beginning of the epilogue. Sometimes there is
35 only the end of the prologue and the beginning of the operation, as
36 the operation is long and we don't care about its tail.