# jonathan03ant/llvmviz architecture

> Architecture diagram of the GitHub repository jonathan03ant/llvmviz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jonathan03ant/llvmviz
- Repository: https://github.com/jonathan03ant/llvmviz

## Overview

LLVMViz is a web platform for inspecting LLVM’s SelectionDAG and Machine IR. Users provide LLVM IR, choose a target and compilation stage, then view or compare DAG graphs; the MIR workflow discovers passes and fetches selected pass output for browsing and comparison. The frontend coordinates API requests, while the Flask backend delegates compilation and pipeline analysis to library modules. The README documents capabilities beyond the sampled implementation; arrows are limited to relationships visible in excerpts, the SOURCE INDEX, or README statements.

Main entry points: [`frontend/src/App.tsx`](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/App.tsx) (App coordinator), [`backend/server.py`](https://github.com/jonathan03ant/llvmviz/blob/main/backend/server.py) (Flask API), [`frontend/src/components/tools/SelectionDAGViewer.tsx`](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/SelectionDAGViewer.tsx) (DAG viewer), [`frontend/src/components/tools/MIRViewer/MIRViewer.tsx`](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/MIRViewer/MIRViewer.tsx) (MIR viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["App coordinator<br/>[App.tsx]"]
  node_header["Header<br/>[Header.tsx]"]
  node_input["IR input<br/>[InputPanel.tsx]"]
  node_code["Code editor<br/>[CodeEditor.tsx]"]
  node_footer["Compiler controls<br/>[Footer.tsx]"]
  node_select["Option selector<br/>[CustomSelect.tsx]"]
  node_terminal["Terminal output<br/>[TerminalOutput.tsx]"]
end

subgraph group_dag["SelectionDAG"]
  node_dagviewer["DAG viewer"]
  node_graphcanvas["Graph canvas<br/>[GraphCanvas.tsx]"]
  node_daglayout["DAG layout<br/>[DagLayout.ts]"]
  node_nodedetails["Node inspection"]
  node_infotabs["Graph information<br/>[InfoTabs.tsx]"]
  node_nodestyles["Graph styles<br/>[nodeStyles.ts]"]
end

subgraph group_mir["MIR pipeline"]
  node_mirviewer["MIR viewer<br/>[MIRViewer.tsx]"]
  node_passsidebar["Pass browser<br/>[MIRPassSidebar.tsx]"]
  node_mircontent["MIR content and diff<br/>[MIRContentView.tsx]"]
  node_highlight["MIR highlighting"]
  node_mirmodal["MIR modal<br/>[MIRModal.tsx]"]
end

subgraph group_backend["API and compilation"]
  node_api["Flask API<br/>[server.py]"]
  node_compiler["LLVM compilation<br/>[compiler.py]"]
  node_parser["DAG parser<br/>[parser.py]"]
  node_pipeline["Pass discovery and analysis<br/>[mir_pipeline.py]"]
  node_targets["Target discovery<br/>[targets.py]"]
  node_utilities["Compiler utilities<br/>[utils.py]"]
end

node_user(("LLVM developer"))
node_llvm["LLVM llc"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_input
node_app -->|"renders"| node_footer
node_app -->|"renders"| node_dagviewer
node_app -->|"renders"| node_mirviewer
node_app -->|"renders"| node_mirmodal
node_input -->|"uses"| node_code
node_input -->|"uses"| node_terminal
node_footer -->|"uses"| node_select
node_app -->|"requests compilation and target data"| node_api
node_dagviewer -->|"renders"| node_graphcanvas
node_dagviewer -->|"lays out graphs"| node_daglayout
node_dagviewer -->|"renders"| node_nodedetails
node_dagviewer -->|"renders"| node_infotabs
node_daglayout -->|"uses"| node_nodestyles
node_nodedetails -->|"uses"| node_nodestyles
node_mirviewer -->|"renders"| node_passsidebar
node_mirviewer -->|"renders"| node_mircontent
node_mirviewer -->|"requests pass data"| node_api
node_mircontent -->|"highlights syntax"| node_highlight
node_api -->|"compiles DAG and MIR"| node_compiler
node_api -->|"discovers passes"| node_pipeline
node_api -->|"gets target options"| node_targets
node_api -->|"uses utilities"| node_utilities
node_compiler -->|"parses DAG output"| node_parser
node_compiler -->|"runs llc"| node_llvm

click node_app "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/App.tsx"
click node_header "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/Header.tsx"
click node_input "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/InputPanel.tsx"
click node_code "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/CodeEditor.tsx"
click node_footer "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/Footer.tsx"
click node_select "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/CustomSelect.tsx"
click node_terminal "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/TerminalOutput.tsx"
click node_dagviewer "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/SelectionDAGViewer.tsx"
click node_graphcanvas "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/GraphCanvas.tsx"
click node_daglayout "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/DagLayout.ts"
click node_nodedetails "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/NodeDetailsPanel.tsx"
click node_infotabs "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/InfoTabs.tsx"
click node_nodestyles "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/nodeStyles.ts"
click node_mirviewer "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/MIRViewer/MIRViewer.tsx"
click node_passsidebar "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/MIRViewer/MIRPassSidebar.tsx"
click node_mircontent "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/MIRViewer/MIRContentView.tsx"
click node_highlight "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/utils/mirSyntaxHighlight.tsx"
click node_mirmodal "https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/MIRModal.tsx"
click node_api "https://github.com/jonathan03ant/llvmviz/blob/main/backend/server.py"
click node_compiler "https://github.com/jonathan03ant/llvmviz/blob/main/lib/compiler.py"
click node_parser "https://github.com/jonathan03ant/llvmviz/blob/main/lib/parser.py"
click node_pipeline "https://github.com/jonathan03ant/llvmviz/blob/main/lib/mir_pipeline.py"
click node_targets "https://github.com/jonathan03ant/llvmviz/blob/main/lib/targets.py"
click node_utilities "https://github.com/jonathan03ant/llvmviz/blob/main/lib/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_header,node_input,node_code,node_footer,node_select,node_terminal toneBlue
class node_dagviewer,node_graphcanvas,node_daglayout,node_nodedetails,node_infotabs,node_nodestyles toneAmber
class node_mirviewer,node_passsidebar,node_mircontent,node_highlight,node_mirmodal toneMint
class node_api,node_compiler,node_parser,node_pipeline,node_targets,node_utilities toneRose
class node_user,node_llvm toneIndigo
```

## Components

### Web interface

- [App coordinator](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Header](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/Header.tsx): `frontend/src/components/common/Header.tsx`
- [IR input](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/InputPanel.tsx): `frontend/src/components/common/InputPanel.tsx`
- [Code editor](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/CodeEditor.tsx): `frontend/src/components/common/CodeEditor.tsx`
- [Compiler controls](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/Footer.tsx): `frontend/src/components/common/Footer.tsx`
- [Option selector](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/CustomSelect.tsx): `frontend/src/components/common/CustomSelect.tsx`
- [Terminal output](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/TerminalOutput.tsx): `frontend/src/components/common/TerminalOutput.tsx`

### SelectionDAG

- [DAG viewer](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/SelectionDAGViewer.tsx): `frontend/src/components/tools/SelectionDAGViewer.tsx`
- [Graph canvas](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/GraphCanvas.tsx): `frontend/src/components/graph/GraphCanvas.tsx`
- [DAG layout](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/DagLayout.ts): `frontend/src/components/graph/DagLayout.ts`
- [Node inspection](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/NodeDetailsPanel.tsx): `frontend/src/components/graph/NodeDetailsPanel.tsx`
- [Graph information](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/InfoTabs.tsx): `frontend/src/components/graph/InfoTabs.tsx`
- [Graph styles](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/graph/nodeStyles.ts): `frontend/src/components/graph/nodeStyles.ts`

### MIR pipeline

- [MIR viewer](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/MIRViewer/MIRViewer.tsx): `frontend/src/components/tools/MIRViewer/MIRViewer.tsx`
- [Pass browser](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/MIRViewer/MIRPassSidebar.tsx): `frontend/src/components/tools/MIRViewer/MIRPassSidebar.tsx`
- [MIR content and diff](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/tools/MIRViewer/MIRContentView.tsx): `frontend/src/components/tools/MIRViewer/MIRContentView.tsx`
- [MIR highlighting](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/utils/mirSyntaxHighlight.tsx): `frontend/src/utils/mirSyntaxHighlight.tsx`
- [MIR modal](https://github.com/jonathan03ant/llvmviz/blob/main/frontend/src/components/common/MIRModal.tsx): `frontend/src/components/common/MIRModal.tsx`

### API and compilation

- [Flask API](https://github.com/jonathan03ant/llvmviz/blob/main/backend/server.py): `backend/server.py`
- [LLVM compilation](https://github.com/jonathan03ant/llvmviz/blob/main/lib/compiler.py): `lib/compiler.py`
- [DAG parser](https://github.com/jonathan03ant/llvmviz/blob/main/lib/parser.py): `lib/parser.py`
- [Pass discovery and analysis](https://github.com/jonathan03ant/llvmviz/blob/main/lib/mir_pipeline.py): `lib/mir_pipeline.py`
- [Target discovery](https://github.com/jonathan03ant/llvmviz/blob/main/lib/targets.py): `lib/targets.py`
- [Compiler utilities](https://github.com/jonathan03ant/llvmviz/blob/main/lib/utils.py): `lib/utils.py`

### Other components

- **LLVM developer**
- **LLVM llc**

## Connections

- LLVM developer → App coordinator: uses (evidence: `README.md`)
- App coordinator → Header: renders (evidence: `frontend/src/App.tsx`)
- App coordinator → IR input: renders (evidence: `frontend/src/App.tsx`)
- App coordinator → Compiler controls: renders (evidence: `frontend/src/App.tsx`)
- App coordinator → DAG viewer: renders (evidence: `frontend/src/App.tsx`)
- App coordinator → MIR viewer: renders (evidence: `frontend/src/App.tsx`)
- App coordinator → MIR modal: renders (evidence: `frontend/src/App.tsx`)
- IR input → Code editor: uses (evidence: `frontend/src/components/common/InputPanel.tsx`)
- IR input → Terminal output: uses (evidence: `frontend/src/components/common/InputPanel.tsx`)
- Compiler controls → Option selector: uses (evidence: `frontend/src/components/common/Footer.tsx`)
- App coordinator → Flask API: requests compilation and target data (evidence: `frontend/src/App.tsx`)
- DAG viewer → Graph canvas: renders (evidence: `frontend/src/components/tools/SelectionDAGViewer.tsx`)
- DAG viewer → DAG layout: lays out graphs (evidence: `frontend/src/components/tools/SelectionDAGViewer.tsx`)
- DAG viewer → Node inspection: renders (evidence: `frontend/src/components/tools/SelectionDAGViewer.tsx`)
- DAG viewer → Graph information: renders (evidence: `frontend/src/components/tools/SelectionDAGViewer.tsx`)
- DAG layout → Graph styles: uses (evidence: `frontend/src/components/graph/DagLayout.ts`)
- Node inspection → Graph styles: uses (evidence: `frontend/src/components/graph/NodeDetailsPanel.tsx`)
- MIR viewer → Pass browser: renders (evidence: `frontend/src/components/tools/MIRViewer/MIRViewer.tsx`)
- MIR viewer → MIR content and diff: renders (evidence: `frontend/src/components/tools/MIRViewer/MIRViewer.tsx`)
- MIR viewer → Flask API: requests pass data (evidence: `frontend/src/components/tools/MIRViewer/MIRViewer.tsx`)
- MIR content and diff → MIR highlighting: highlights syntax (evidence: `frontend/src/components/tools/MIRViewer/MIRContentView.tsx`)
- Flask API → LLVM compilation: compiles DAG and MIR (evidence: `backend/server.py`)
- Flask API → Pass discovery and analysis: discovers passes (evidence: `backend/server.py`)
- Flask API → Target discovery: gets target options (evidence: `backend/server.py`)
- Flask API → Compiler utilities: uses utilities (evidence: `backend/server.py`)
- LLVM compilation → DAG parser: parses DAG output (evidence: `lib/compiler.py`)
- LLVM compilation → LLVM llc: runs llc (evidence: `lib/compiler.py`)
