How grqz/llvm-project works
LLVM is a compiler infrastructure project spanning language frontends, optimization/code generation, binary rewriting, and runtime libraries. A documented Clang workflow takes C-family source through LLVM to object files. The sampled code also shows Clang’s path-sensitive analyzer dispatching checker callbacks and maintaining analysis state, plus BOLT’s profile/pass/rewrite subsystems and Flang’s FIR pipeline capabilities. BOLT and Flang relationships are kept conservative: the tree and sampled files establish these subsystems, but not a complete end-to-end runtime call graph.
Main entry points: llvm-bolt.cpp BOLT driver · ExprEngine.cpp Path-sensitive engine · ClangQuery.cpp Clang frontend · BinaryPassManager.cpp Pass orchestration
Components 21
Language frontends
- Clang frontend
clang-tools-extra/clang-query/tool/ClangQuery.cpp - Preprocessor
clang/include/clang/Lex/Preprocessor.h - AST model
clang/include/clang/AST/Decl.h - Query parsing
clang-tools-extra/clang-query/QueryParser.cpp - AST query
clang-tools-extra/clang-query/Query.h
Static analysis
- Path-sensitive engine
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp - Checker dispatch
clang/include/clang/StaticAnalyzer/Core/CheckerManager.h - Abstract values
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h - Bug reporting
clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
Binary optimization
- BOLT driver
bolt/tools/driver/llvm-bolt.cpp - Profile input
bolt/lib/Profile/DataReader.cpp - Profile aggregation
bolt/lib/Profile/DataAggregator.cpp - Binary model
bolt/lib/Core/BinaryContext.cpp - Pass orchestration
bolt/lib/Rewrite/BinaryPassManager.cpp - Optimization passes
bolt/lib/Passes/ReorderFunctions.cpp - Binary rewriting
bolt/lib/Rewrite/RewriteInstance.cpp
Fortran lowering
- FIR pass pipelines
flang/lib/Optimizer/Passes/Pipelines.cpp - Temporary storage
flang/lib/Optimizer/Builder/TemporaryStorage.cpp
Other components
- Compiler user
- LLVM backend
- Object file
Connections 13
- Compiler user → Clang frontend: provides source
README.md - Clang frontend → LLVM backend: lowers to
README.md - LLVM backend → Object file: emits
README.md - Path-sensitive engine → Checker dispatch: dispatches callbacks
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp - Path-sensitive engine → Abstract values: models values
- Path-sensitive engine → Bug reporting: generates diagnostics
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp - Query parsing → AST query: produces queries
- BOLT driver → Profile input: reads profiles
- BOLT driver → Binary model: loads binary
- Pass orchestration → Optimization passes: runs passes
bolt/lib/Rewrite/BinaryPassManager.cpp - BOLT driver → Pass orchestration: configures passes
- BOLT driver → Binary rewriting: rewrites binary
- FIR pass pipelines → Temporary storage: uses lowering