Skip to main content

Module gate

Module gate 

Source
Expand description

Which functions a pass is allowed to run on.

Section 41.6 of spec/optimizer/41-correctness.md asks for -fdisable-<pass>[=<range>] and -fenable-<pass>[=<range>] from the point at which there is more than one pass, and gives the reason. A wrong-code bug is two questions, which pass did it and which function did it happen in, and with these two flags they are two independent bisections a script can run without a debugger and without reading a diff of two assembly listings. -fpass-fuel narrows the first answer further, to one rewrite inside the guilty pass, so the three of them together take a report of the form “this program is wrong at -O2” down to a line of the optimizer.

A rule applies only to the functions it names, and the last rule that names a function is the one that decides for it. Everything the rules do not name keeps the answer the optimization level already gave, which is what makes -fenable-<pass>=3 mean “also run it there” rather than “run it only there”. GCC’s override_gate_status works the same way and the flags are useless if they do not, because a bisection that changes two things at once has bisected nothing.

Structs§

Gates
The rules -fdisable-<pass> and -fenable-<pass> left behind, in the order they were given.