transformInstructionPlan
Transforms an instruction plan tree using a bottom-up approach.
This function recursively traverses the instruction plan tree, applying the transformation function to each plan. The transformation is applied bottom-up, meaning nested plans are transformed first, then the parent plans receive the already-transformed children before being transformed themselves.
All transformed plans are frozen using Object.freeze to ensure immutability.
Parameters
| Parameter | Type | Description |
|---|---|---|
instructionPlan | InstructionPlan | The instruction plan tree to transform. |
fn | (plan) => InstructionPlan | A function that transforms each plan and returns a new plan. |
Returns
A new transformed instruction plan tree.
Examples
Making all sequential plans non-divisible to ensure atomicity.
Filtering out debug instructions before production execution.