Home / Function/ printHIR() — react Function Reference

printHIR() — react Function Reference

Architecture documentation for the printHIR() function in PrintHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  3f9f0373_2e57_1356_bd68_e2eec897e2f5["printHIR()"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"]
  3f9f0373_2e57_1356_bd68_e2eec897e2f5 -->|defined in| 6976a9ee_9d8e_4f16_3016_495f39aff2fd
  eea2957a_a99b_9cf2_58bf_d591ab804347["printFunctionWithOutlined()"]
  eea2957a_a99b_9cf2_58bf_d591ab804347 -->|calls| 3f9f0373_2e57_1356_bd68_e2eec897e2f5
  75108b98_1828_cb14_243d_e48c6613b748["printFunction()"]
  75108b98_1828_cb14_243d_e48c6613b748 -->|calls| 3f9f0373_2e57_1356_bd68_e2eec897e2f5
  073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"]
  3f9f0373_2e57_1356_bd68_e2eec897e2f5 -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83
  8faf797b_f577_1d83_65a6_29b8dcb97348["printPhi()"]
  3f9f0373_2e57_1356_bd68_e2eec897e2f5 -->|calls| 8faf797b_f577_1d83_65a6_29b8dcb97348
  1bdf9e01_ffb0_1422_a451_e62965a1969b["printInstruction()"]
  3f9f0373_2e57_1356_bd68_e2eec897e2f5 -->|calls| 1bdf9e01_ffb0_1422_a451_e62965a1969b
  809a0fbd_e458_a174_789b_dc2fd017231a["printTerminal()"]
  3f9f0373_2e57_1356_bd68_e2eec897e2f5 -->|calls| 809a0fbd_e458_a174_789b_dc2fd017231a
  4c434fb2_75ab_6c2c_c237_b1d38a1b0141["forEach()"]
  3f9f0373_2e57_1356_bd68_e2eec897e2f5 -->|calls| 4c434fb2_75ab_6c2c_c237_b1d38a1b0141
  style 3f9f0373_2e57_1356_bd68_e2eec897e2f5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts lines 85–114

export function printHIR(ir: HIR, options: Options | null = null): string {
  let output = [];
  let indent = ' '.repeat(options?.indent ?? 0);
  const push = (text: string, indent: string = '  '): void => {
    output.push(`${indent}${text}`);
  };
  for (const [blockId, block] of ir.blocks) {
    output.push(`bb${blockId} (${block.kind}):`);
    if (block.preds.size > 0) {
      const preds = ['predecessor blocks:'];
      for (const pred of block.preds) {
        preds.push(`bb${pred}`);
      }
      push(preds.join(' '));
    }
    for (const phi of block.phis) {
      push(printPhi(phi));
    }
    for (const instr of block.instructions) {
      push(printInstruction(instr));
    }
    const terminal = printTerminal(block.terminal);
    if (Array.isArray(terminal)) {
      terminal.forEach(line => push(line));
    } else {
      push(terminal);
    }
  }
  return output.map(line => indent + line).join('\n');
}

Subdomains

Frequently Asked Questions

What does printHIR() do?
printHIR() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts.
Where is printHIR() defined?
printHIR() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts at line 85.
What does printHIR() call?
printHIR() calls 5 function(s): forEach, printInstruction, printPhi, printTerminal, push.
What calls printHIR()?
printHIR() is called by 2 function(s): printFunction, printFunctionWithOutlined.

Analyze Your Own Codebase

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

Try Supermodel Free