How jbezoz/slva works
Purpose and Entry Points
SLVA implements Strong Live Variable Analysis over a custom intermediate representation, with LLVM-like .ll inputs and a sample consumer. The top-level execution entry is run.sh; the analysis/library build is centered on slim-ir/CMakeLists.txt, while the executable driver is in slim-use/main.cpp.
Analysis IR Layer
The custom SLIM IR defines the program model used by the analysis:
• IR/container structures: slim-ir/include/IR.h, slim-ir/IR.cpp
• Instruction hierarchy: slim-ir/include/Instructions.h, slim-ir/Instructions.cpp
• Operand/value representation: slim-ir/include/Operand.h, slim-ir/Operand.cpp
This separation establishes the key boundary between parsed/source-level input and analysis-ready control-flow/instruction data.
Instruction and Operand Semantics
Instructions and Operand encode use/definition behavior needed for live-variable propagation. Instruction-specific handling belongs in slim-ir/Instructions.cpp; operand identity and categorization belong in slim-ir/Operand.cpp. The analysis should consume these abstractions rather than depend directly on textual LLVM IR.
Driver and Integration Layer
slim-use/main.cpp is the primary application-level entry point that exercises the IR library and runs the analysis workflow. slim-use/CMakeLists.txt links/builds this consumer separately from the IR library, making slim-ir a reusable analysis substrate and slim-use the executable integration boundary.
Input Pipeline and Artifacts
The repository includes C source, LLVM IR, and SLIM-oriented IR examples:
• Source input: slim-use/testcases/test.c
• LLVM-style input: slim-use/testcases/test.ll
• SLIM IR artifact: slim-use/testcases/test.slim.ll
The expected flow is source/LLVM-like input → SLIM IR representation → instruction/operand use-def interpretation → strong live-variable results. The exact parsing or translation mechanism is not explicit in the visible tree.
Build and Runtime Environment
The core runtime is native C++ built with CMake:
• Library build definition: slim-ir/CMakeLists.txt
• Consumer build definition: slim-use/CMakeLists.txt
• Library runner: slim-ir/run_ir_lib.sh
• Consumer runners: slim-use/run.sh, slim-use/run2.sh
Ruby appears to support experimentation or reference logic rather than the main runtime: pseudo_code.rb, slim-use/temp.rb, and slim-use/temp2.rb. No network services, databases, web framework, or deployed infrastructure are indicated.
Key Architectural Boundaries
1. Build orchestration vs. analysis code: run.sh and CMake files invoke/build components; they should not contain analysis semantics.
2. Reusable IR library vs. executable use case: slim-ir/ owns IR abstractions; slim-use/ owns demonstration/input execution.
3. Textual test fixtures vs. internal model: .c/.ll files are external artifacts, while IR, Instructions, and Operand are the stable in-memory analysis contract.
Main entry points: CMakeLists.txt IR library build · main.cpp SLVA driver · Instructions.cpp Instruction semantics · IR.cpp IR containers
Components 16
Build & runners
- Top-level runner
run.sh - IR library build
slim-ir/CMakeLists.txt - IR library runner
slim-ir/run_ir_lib.sh - Consumer build
slim-use/CMakeLists.txt - Consumer runners
slim-use/run.sh
SLIM IR library
Reusable in-memory program model and use-def semantics.
- IR containers · Owns analysis-ready program and control-flow structures.
slim-ir/IR.cpp - IR API
slim-ir/include/IR.h - Instruction semantics · Instruction-specific use and definition behavior.
slim-ir/Instructions.cpp - Instruction API
slim-ir/include/Instructions.h - Operand semantics · Defines operand identity and categorization.
slim-ir/Operand.cpp - Operand API
slim-ir/include/Operand.h
Analysis consumer
- SLVA driver · Exercises the IR library and runs strong live-variable analysis.
slim-use/main.cpp - Strong live variables
Input fixtures
- C source fixture
slim-use/testcases/test.c - LLVM-style fixture
slim-use/testcases/test.ll - SLIM IR fixture
slim-use/testcases/test.slim.ll
Connections 20
- Top-level runner → IR library runner: invokes
- Top-level runner → Consumer runners: invokes
- IR library runner → IR library build: builds
- Consumer runners → Consumer build: builds
- IR library build → IR containers: compiles
- IR library build → Instruction semantics: compiles
- IR library build → Operand semantics: compiles
- Consumer build → SLVA driver: builds
- Consumer build → IR library build: links library
- IR API → IR containers: declares
- Instruction API → Instruction semantics: declares
- Operand API → Operand semantics: declares
- IR containers → Instruction semantics: contains
- Instruction semantics → Operand semantics: interprets use-def
- C source fixture → LLVM-style fixture: source counterpart
- LLVM-style fixture → SLIM IR fixture: represented as · Translation mechanism is not explicit.
- SLIM IR fixture → SLVA driver: analysis input
- SLVA driver → IR containers: uses
- SLVA driver → Instruction semantics: propagates liveness through
- SLVA driver → Strong live variables: produces