Printing Newly Created (Allocated) MIR Node

Hi,

Currently, I am pursuing research in JIT compilers, i.e., V8, JSC, and SpiderMonkey.
One task is to identify all the generated IR nodes and extract (print) information about them.
What I currently do is add print statements in the node generator function, e.g., V8 is Node::New and JSC is multiple Node(...) functions under dfg/DFGNode.h.
For SpiderMonkey, I kind of have an idea that I need to search the function(s) under MIR.h file, but it’s not crystal clear which function I need to target for adding the print statements. There may be multiple functions.

Can someone who’s knowledgeable with the optimizer internal give me some advice on it, please?

Thank you!

Hi,

The simplest way would be to use the MDefinition constructor instead of the allocator. Each node is identified with an Opcode, given as argument of the MDefinition constructor, to implement a downcast.

Otherwise, MIR node are created with New and Clone functions, which are present in each MIR node.

Hi,

Thank you for your help.

As recommended, I will try to add prints under the MDefinition constructor as well as New and Clone functions.

Thank you!