A software analysis framework built around the QBE intermediate language
git clone https://git.8pit.net/quebex.git
1<!-- 2SPDX-FileCopyrightText: 2025 Sören Tempel <soeren+git@soeren-tempel.net> 3 4SPDX-License-Identifier: GPL-3.0-only 5--> 6 7## README 8 9A work-in-progress software analysis framework built around the [QBE] intermediate language.1011### Motivation1213Existing analysis frameworks are predominantly built around [LLVM].14Unfortunately, LLVM is a fast moving target with constant changes and updates to its intermediate language.15Therefore, tooling built around LLVM (e.g., [KLEE]) often requires dated LLVM versions.[^1]16Obtaining such ancient LLVM versions can be cumbersome and often hinders employment of these tools.17To overcome these issues, maintainers of analysis tooling need to constantly invest time to catch-up with LLVM releases, instead of focusing on improving their analysis framework.1819In order to reduce maintenance burden, this project attempts to investigate utilization of another intermediate language for software analysis: [QBE].20QBE is a much [smaller scale project][QBE vs LLVM] than LLVM and thereby offers a higher degree of stability.21Further, QBE is much simpler than LLVM (e.g., providing fewer operations) and thereby also eases the implementation of certain analysis techniques.22Nonetheless, there are sophisticated compiler frontends that can emit a representation in the QBE intermediate language (which can then be analyzed using quebex!).23For example, [SCC], [cproc] or the [Hare compiler][Hare].2425### Status2627Proof of concept, not much to see here yet.28Come back later!2930### Design Goals3132This project is intentionally written in a simple subset of the [Haskell] programming language.33It should be usable by anyone with a basic Haskell background (e.g., as obtained by reading [Learn You a Haskell for Great Good!][learnyouahaskell]).34Further, the project should require minimal long-term maintenance and should also support older GHC versions.35Therefore, it uses the [GHC2021] language standard and avoids usage of additional language extensions.36Further, whenever possible, dependencies on external libraries that are [not bundled by GHC][GHC libraries] must be avoided.3738### Planned Components3940* `quebex`: Basic analysis library, which should provide41 * A modular interpreter for dynamic analysis based on monad transformers *[in progress]*42 * Basic framework for static analysis (CFG, call graphs, …) *[planned]*43* `quebex-syntax`: Parser for the QBE IL written in literate Haskell *[in progress]*44* `quebex-symex`: Symbolic execution based on the provided modular interpreter *[planned]*4546Long term, it is also of interest to build lifters which generate QBE from binaries (e.g. with [libriscv]).4748### Development4950Code should be formatted using [ormolu][ormolu github].51A githook for this purpose is available which can be enabled using:5253 $ git config --local core.hooksPath .githooks5455### License5657This project uses the [REUSE Specification] to indicated used software license.5859[^1]: At the time of writing, KLEE recommends LLVM 13 and the current version is LLVM 20.60[QBE]: https://c9x.me/compile/61[QBE vs LLVM]: https://c9x.me/compile/doc/llvm.html62[LLVM]: https://llvm.org/63[KLEE]: https://klee-se.org64[SCC]: https://www.simple-cc.org/65[cproc]: https://sr.ht/~mcf/cproc/66[Hare]: https://harelang.org/67[Haskell]: https://haskell.org/68[GHC2021]: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html#extension-GHC202169[GHC libraries]: https://ghc.gitlab.haskell.org/ghc/doc/libraries/index.html70[learnyouahaskell]: https://learnyouahaskell.github.io/chapters.html71[libriscv]: https://github.com/agra-uni-bremen/libriscv72[ormolu github]: https://github.com/tweag/ormolu73[REUSE Specification]: https://reuse.software/spec-3.3/