findInstructionPlan
Finds the first instruction plan in the tree that matches the given predicate.
This function performs a depth-first search through the instruction plan tree, returning the first plan that satisfies the predicate. It checks the root plan first, then recursively searches through nested plans.
Parameters
| Parameter | Type | Description |
|---|---|---|
instructionPlan | InstructionPlan | The instruction plan tree to search. |
predicate | (plan) => boolean | A function that returns true for the plan to find. |
Returns
InstructionPlan | undefined
The first matching instruction plan, or undefined if no match is found.
Examples
Finding a non-divisible sequential plan.
Finding a specific single instruction plan.