# anhtuyenibm/llvm-project architecture

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

- Interactive diagram: https://gitdiagram.com/anhtuyenibm/llvm-project
- Repository: https://github.com/anhtuyenibm/llvm-project

## Overview

LLVM is a compiler infrastructure monorepo, not one application with a single user workflow. The sampled material supports a Clang path from source processing into path-sensitive analysis, alongside BOLT’s binary-optimization pass infrastructure and Flang’s temporary-storage lowering support. The README describes broader compiler, optimizer, linker, and runtime capabilities, but those flows are not evidenced by the sampled files. Dashed links indicate plausible dispatch that the available excerpts do not verify.

Main entry points: [`bolt/lib/Rewrite/BinaryPassManager.cpp`](https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Rewrite/BinaryPassManager.cpp) (Pass manager), [`clang/lib/StaticAnalyzer/Core/ExprEngine.cpp`](https://github.com/anhtuyenibm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp) (Path analysis), [`clang/include/clang/AST/Decl.h`](https://github.com/anhtuyenibm/llvm-project/blob/main/clang/include/clang/AST/Decl.h) (AST model), [`bolt/tools/driver/llvm-bolt.cpp`](https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/tools/driver/llvm-bolt.cpp) (BOLT driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clang["Clang analysis"]
  node_preprocessor["Preprocessing<br/>[Preprocessor.h]"]
  node_source_manager["Source tracking<br/>[SourceManager.cpp]"]
  node_ast["AST model<br/>[Decl.h]"]
  node_expr_engine["Path analysis<br/>[ExprEngine.cpp]"]
  node_engine_api["Analysis interface<br/>[ExprEngine.h]"]
  node_query_parser["Query parser<br/>[QueryParser.cpp]"]
end

subgraph group_bolt["BOLT optimizer"]
  node_bolt_driver["BOLT driver<br/>[llvm-bolt.cpp]"]
  node_binary_context["Binary model<br/>[BinaryContext.cpp]"]
  node_pass_manager["Pass manager"]
  node_optimization_passes["Optimization passes"]
  node_profile_reader["Profile input<br/>[DataReader.cpp]"]
  node_rewriter["Binary rewriting"]
end

subgraph group_flang["Flang lowering"]
  node_temporary_storage["Temporary storage"]
end

node_user(("Compiler user"))
node_source["Source files"]

node_user -->|"provides"| node_source
node_source -.->|"preprocesses"| node_preprocessor
node_preprocessor -.->|"tracks locations"| node_source_manager
node_source_manager -.->|"supplies locations"| node_ast
node_engine_api -->|"exposes analysis"| node_expr_engine
node_expr_engine -.->|"analyzes expressions"| node_ast
node_expr_engine -->|"runs checker callbacks"| node_engine_api
node_query_parser -.->|"parses matcher queries"| node_ast
node_bolt_driver -.->|"loads binary"| node_binary_context
node_bolt_driver -.->|"starts passes"| node_pass_manager
node_pass_manager -.->|"dispatches passes"| node_optimization_passes
node_profile_reader -.->|"supplies profile"| node_pass_manager
node_pass_manager -.->|"rewrites binary"| node_rewriter
node_temporary_storage -.->|"supports lowering"| node_user

click node_preprocessor "https://github.com/anhtuyenibm/llvm-project/blob/main/clang/include/clang/Lex/Preprocessor.h"
click node_source_manager "https://github.com/anhtuyenibm/llvm-project/blob/main/clang/lib/Basic/SourceManager.cpp"
click node_ast "https://github.com/anhtuyenibm/llvm-project/blob/main/clang/include/clang/AST/Decl.h"
click node_expr_engine "https://github.com/anhtuyenibm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp"
click node_engine_api "https://github.com/anhtuyenibm/llvm-project/blob/main/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
click node_query_parser "https://github.com/anhtuyenibm/llvm-project/blob/main/clang-tools-extra/clang-query/QueryParser.cpp"
click node_bolt_driver "https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/tools/driver/llvm-bolt.cpp"
click node_binary_context "https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Core/BinaryContext.cpp"
click node_pass_manager "https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Rewrite/BinaryPassManager.cpp"
click node_optimization_passes "https://github.com/anhtuyenibm/llvm-project/tree/main/bolt/lib/Passes"
click node_profile_reader "https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Profile/DataReader.cpp"
click node_rewriter "https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Rewrite/RewriteInstance.cpp"
click node_temporary_storage "https://github.com/anhtuyenibm/llvm-project/blob/main/flang/lib/Optimizer/Builder/TemporaryStorage.cpp"

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_preprocessor,node_source_manager,node_ast,node_expr_engine,node_engine_api,node_query_parser,node_user toneBlue
class node_bolt_driver,node_binary_context,node_pass_manager,node_optimization_passes,node_profile_reader,node_rewriter toneAmber
class node_temporary_storage toneMint
class node_source toneIndigo
```

## Components

### Clang analysis

- [Preprocessing](https://github.com/anhtuyenibm/llvm-project/blob/main/clang/include/clang/Lex/Preprocessor.h): `clang/include/clang/Lex/Preprocessor.h`
- [Source tracking](https://github.com/anhtuyenibm/llvm-project/blob/main/clang/lib/Basic/SourceManager.cpp): `clang/lib/Basic/SourceManager.cpp`
- [AST model](https://github.com/anhtuyenibm/llvm-project/blob/main/clang/include/clang/AST/Decl.h): `clang/include/clang/AST/Decl.h`
- [Path analysis](https://github.com/anhtuyenibm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp): `clang/lib/StaticAnalyzer/Core/ExprEngine.cpp`
- [Analysis interface](https://github.com/anhtuyenibm/llvm-project/blob/main/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h): `clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h`
- [Query parser](https://github.com/anhtuyenibm/llvm-project/blob/main/clang-tools-extra/clang-query/QueryParser.cpp): `clang-tools-extra/clang-query/QueryParser.cpp`

### BOLT optimizer

- [BOLT driver](https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/tools/driver/llvm-bolt.cpp): `bolt/tools/driver/llvm-bolt.cpp`
- [Binary model](https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Core/BinaryContext.cpp): `bolt/lib/Core/BinaryContext.cpp`
- [Pass manager](https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Rewrite/BinaryPassManager.cpp): `bolt/lib/Rewrite/BinaryPassManager.cpp`
- [Optimization passes](https://github.com/anhtuyenibm/llvm-project/tree/main/bolt/lib/Passes): `bolt/lib/Passes`
- [Profile input](https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Profile/DataReader.cpp): `bolt/lib/Profile/DataReader.cpp`
- [Binary rewriting](https://github.com/anhtuyenibm/llvm-project/blob/main/bolt/lib/Rewrite/RewriteInstance.cpp): `bolt/lib/Rewrite/RewriteInstance.cpp`

### Flang lowering

- [Temporary storage](https://github.com/anhtuyenibm/llvm-project/blob/main/flang/lib/Optimizer/Builder/TemporaryStorage.cpp): `flang/lib/Optimizer/Builder/TemporaryStorage.cpp`

### Other components

- **Compiler user**
- **Source files**

## Connections

- Compiler user → Source files: provides (evidence: `README.md`)
- Source files → Preprocessing: preprocesses
- Preprocessing → Source tracking: tracks locations
- Source tracking → AST model: supplies locations
- Analysis interface → Path analysis: exposes analysis (evidence: `clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h`)
- Path analysis → AST model: analyzes expressions (evidence: `clang/lib/StaticAnalyzer/Core/ExprEngine.cpp`)
- Path analysis → Analysis interface: runs checker callbacks (evidence: `clang/lib/StaticAnalyzer/Core/ExprEngine.cpp`)
- Query parser → AST model: parses matcher queries
- BOLT driver → Binary model: loads binary
- BOLT driver → Pass manager: starts passes
- Pass manager → Optimization passes: dispatches passes
- Profile input → Pass manager: supplies profile
- Pass manager → Binary rewriting: rewrites binary
- Temporary storage → Compiler user: supports lowering
