aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.001@gmail.com>2026-09-15 08:16:43 +0800
committerRichard Qin <richard.qin.001@gmail.com>2026-09-15 08:16:43 +0800
commit4022e5c95210631e4aceb08eaf9d9071aa5aefc4 (patch)
treea5922559836e45fb3459a3d070367912e1035b1a /README.md
downloadrcc-master.tar.gz
rcc-master.tar.xz
Set up a git repoHEADmaster
Diffstat (limited to 'README.md')
-rw-r--r--README.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..41e5aaf
--- /dev/null
+++ b/README.md
@@ -0,0 +1,75 @@
+# RCC-Legacy
+
+An optimizing compiler for **SysY** (a C subset) targeting **RISC-V 64GC**.
+
+This is the first generation of `rcc`, built as a C++ compiler project inspired
+by [QBE](https://c9x.me/compile/)'s SSA-based architecture. It is kept here as a
+frozen reference; note that active development has moved to a new implementation
+in a separate directory, and this directory will no longer be maintained.
+
+## Pipeline
+
+```
+SysY source
+ → frontend lexer / parser / AST
+ → IRGen SSA construction (Braun et al.), QBE-style IR
+ → mid-end SSA optimization passes
+ → rv64 backend instruction selection → register allocation → emit
+ → RISC-V assembly
+```
+
+Per-function processing is decoupled from global mutable state via an explicit
+`Ctx` / `SubPool` model, allowing functions to be compiled independently.
+
+### Mid-end passes
+
+mem2reg / promote, load forwarding, constant folding, copy propagation, GVN,
+GCM, LICM, SCCP, reassociation, strength reduction (div / mul), loop strength
+reduction, loop idiom recognition (memset / memcpy), inlining, and DCE.
+
+### Backend (RISC-V 64)
+
+ABI lowering, instruction selection (with cmp+branch fusion and address-offset
+folding), liveness, spilling, register allocation, peephole, and ELF assembly
+emission.
+
+## Build
+
+```sh
+cmake -B build -DCMAKE_BUILD_TYPE=Release
+cmake --build build -j
+```
+
+The compiler binary is `build/rcc`. Use `--emit-il` to dump the
+intermediate representation and `-d <flags>` for per-pass debug output.
+
+## Test
+
+Test cases are stored in `tests/`.
+
+```sh
+./tests/run_rv64_e2e.sh
+./tests/run_perf.sh
+```
+
+You may need to edit the shell scripts in `tests/` to adapt
+to your local environment.
+
+## Competition
+
+This compiler was built for the 2026 compiler design competition @ RUC.
+
+## Thanks
+
+- [QBE](https://c9x.me/compile/)
+- [TrivialCompiler](https://github.com/TrivialCompiler/TrivialCompiler)
+- [indigo](https://github.com/segviol/indigo)
+- [sysy-testsuit-collection](https://github.com/jokerwyt/sysy-testsuit-collection)
+- [lava-test](https://github.com/ustb-owl/lava-test)
+
+## License
+
+rcc-legacy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version. \ No newline at end of file