Skip to main content

int_pred

Function int_pred 

Source
pub fn int_pred(head: &str) -> Option<IntPred>
Expand description

The predicate a head names, when the head is a comparison of two integers.

The inverse of icmp_head, which is private, and a search over it rather than a second table, because two tables that are supposed to be inverses are two tables that will stop being inverses. Ten comparisons is a short enough search that the alternative would be arranging for a map to be built once, and this is asked once per rule that fires rather than once per instruction.

What wants this is the peephole. A rule may write a comparison, and the predicate is not part of the opcode: heads gives every predicate the same Opcode::ICmp, so a rewriter that asked only for the opcode would build a comparison with whatever predicate happened to be on the instruction it replaced. That is not an instruction computing something else, it is one computing the opposite.