Home / Function/ instructionReordering() — react Function Reference

instructionReordering() — react Function Reference

Architecture documentation for the instructionReordering() function in InstructionReordering.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  06363a0e_405c_bfba_71c1_808efa86a089["instructionReordering()"]
  dc3f5251_a95c_3c77_5550_3882c13a37c9["InstructionReordering.ts"]
  06363a0e_405c_bfba_71c1_808efa86a089 -->|defined in| dc3f5251_a95c_3c77_5550_3882c13a37c9
  c3bc3875_256f_8f5e_7800_2f9c5bae65eb["runWithEnvironment()"]
  c3bc3875_256f_8f5e_7800_2f9c5bae65eb -->|calls| 06363a0e_405c_bfba_71c1_808efa86a089
  8b5121a5_55ad_8904_6f4c_ab19201c32ee["findReferencedRangeOfTemporaries()"]
  06363a0e_405c_bfba_71c1_808efa86a089 -->|calls| 8b5121a5_55ad_8904_6f4c_ab19201c32ee
  c4483c48_7e67_41a0_1a7a_c6ca92a55123["reorderBlock()"]
  06363a0e_405c_bfba_71c1_808efa86a089 -->|calls| c4483c48_7e67_41a0_1a7a_c6ca92a55123
  style 06363a0e_405c_bfba_71c1_808efa86a089 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts lines 72–87

export function instructionReordering(fn: HIRFunction): void {
  // Shared nodes are emitted when they are first used
  const shared: Nodes = new Map();
  const references = findReferencedRangeOfTemporaries(fn);
  for (const [, block] of fn.body.blocks) {
    reorderBlock(fn.env, block, shared, references);
  }
  CompilerError.invariant(shared.size === 0, {
    reason: `InstructionReordering: expected all reorderable nodes to have been emitted`,
    loc:
      [...shared.values()]
        .map(node => node.instruction?.loc)
        .filter(loc => loc != null)[0] ?? GeneratedSource,
  });
  markInstructionIds(fn.body);
}

Domain

Subdomains

Frequently Asked Questions

What does instructionReordering() do?
instructionReordering() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts.
Where is instructionReordering() defined?
instructionReordering() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts at line 72.
What does instructionReordering() call?
instructionReordering() calls 2 function(s): findReferencedRangeOfTemporaries, reorderBlock.
What calls instructionReordering()?
instructionReordering() is called by 1 function(s): runWithEnvironment.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free