> On Apr 28, 2016, at 05:35, Nicolas B. Pierron <[email protected]> 
> wrote:
> 
> and we would have to detail all the hidden assumptions which are currently 
> present in all the phases

As a newcomer to IonMonkey: Yes, please! ;-)

I wrote the initial version of LLVM’s machine code verifier which can be run 
between the individual phases of the low-level code generator (not the 
higher-level LLVM IR verifier). We had similar problems that the required 
invariants would vary through the pipeline, and just verifying the intersection 
set of invariants that must hold everywhere was not good enough.

We used flags on the IR data structure to indicate which invariants were 
required. For example, the flag MRI->isSSA() indicates that the virtual 
registers must be in SSA form. When the code is taken out of SSA form, the 
responsible pass would call MRI->leaveSSA(), and from that point on the machine 
code verifier no longer requires virtual registers to have a single definition.

There’s a number of flags like that, see the “Function state” section of 
http://www.llvm.org/docs/doxygen/html/MachineRegisterInfo_8h_source.html 
<http://www.llvm.org/docs/doxygen/html/MachineRegisterInfo_8h_source.html>

Unfortunately, running the machine code verifier after every pass is quite 
slow, so it is enabled with a command-line switch. It is useful for debugging 
crashes and miscompilations, but it is important to have test cases in CI that 
enable it, otherwise the checks quickly bit rot.

Thanks,
/jakob

_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to