• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..09-Jan-2021-

.gitignoreH A D09-Jan-202110 32

.gitrepoH A D09-Jan-2021420 1312

COPYINGH A D09-Jan-202124.7 KiB483400

README.mdH A D09-Jan-20212.1 KiB5340

blockcache.cH A D09-Jan-20213.9 KiB173113

blockcache.hH A D09-Jan-20211.2 KiB3312

config.hH A D09-Jan-2021743 235

config.h.cmakeinH A D09-Jan-2021822 2520

debug.hH A D09-Jan-20212.4 KiB10982

disassembler.cH A D09-Jan-20213.5 KiB144108

disassembler.hH A D09-Jan-20214.2 KiB213172

emitter.cH A D09-Jan-202141.6 KiB1,5791,252

emitter.hH A D09-Jan-2021901 2910

interpreter.cH A D09-Jan-202127 KiB1,136839

interpreter.hH A D09-Jan-2021799 256

lightrec-private.hH A D09-Jan-20214.2 KiB166126

lightrec.cH A D09-Jan-202135.4 KiB1,4311,071

lightrec.hH A D09-Jan-20214.2 KiB151112

memmanager.cH A D09-Jan-20212.8 KiB13191

memmanager.hH A D09-Jan-20211.1 KiB3112

optimizer.cH A D09-Jan-202121.5 KiB1,023903

optimizer.hH A D09-Jan-2021941 3010

reaper.cH A D09-Jan-20212.9 KiB12485

reaper.hH A D09-Jan-20211,007 3010

recompiler.cH A D09-Jan-20217.2 KiB298201

recompiler.hH A D09-Jan-20211.1 KiB3011

regcache.cH A D09-Jan-202112.5 KiB499369

regcache.hH A D09-Jan-20212.7 KiB7544

slist.hH A D09-Jan-20211.6 KiB6742

README.md

1
2# Lightrec
3
4Lightrec is a MIPS-to-everything dynamic recompiler for
5PlayStation emulators, using
6[GNU Lightning](https://www.gnu.org/software/lightning/)
7as the code emitter.
8
9As such, in theory it should be able to run on every CPU that Lightning
10can generate code for; including, but not limited to, __x86__, __x86_64__,
11__ARM__, __Aarch64__, __MIPS__, __PowerPC__ and __Risc-V__.
12
13## Features
14
15* __High-level optimizations__.  The MIPS code is first pre-compiled into
16a form of Intermediate Representation (IR).
17Basically, just a single-linked list of structures representing the
18instructions. On that list, several optimization steps are performed:
19instructions are modified, reordered, tagged; new meta-instructions
20can be added, for instance to tell the code generator that a certain
21register won't be used anymore.
22
23* __Lazy compilation__.
24If Lightrec detects a block of code that would be very hard to
25compile properly (e.g. a branch with a branch in its delay slot),
26the block is marked as not compilable, and will always be emulated
27with the built-in interpreter. This allows to keep the code emitter
28simple and easy to understand.
29
30* __Run-time profiling__.
31The generated code will gather run-time information about the I/O access
32(whether they hit RAM, or hardware registers).
33The code generator will then use this information to generate direct
34read/writes to the emulated memories, instead of jumping to C for
35every call.
36
37* __Threaded compilation__.
38When entering a loading zone, where a lot of code has to be compiled,
39we don't want the compilation process to slow down the pace of emulation.
40To avoid that, the code compiler optionally runs on a thread, and the
41main loop will emulate the blocks that have not been compiled yet with
42the interpreter. This helps to drastically reduce the stutter that
43typically happens when a lot of new code is run.
44
45## Emulators
46
47Lightrec has been ported to the following emulators:
48
49* [__PCSX-ReArmed__ (my own fork)](https://github.com/pcercuei/pcsx_rearmed)
50
51* [__pcsx4all__ (my own fork)](https://github.com/pcercuei/pcsx4all)
52
53* [__Beetle__ (libretro)](https://github.com/libretro/beetle-psx-libretro/)