24.22.8. gem5 code generation

gem5 uses a ton of code generation, which makes the project horrendous:

find build -type f

To find the definition of generated code, do a:

grep -I -r build/ 'code of interest'

where:

The code generation exists partly to support insanely generic cross ISA instructions mapping to one compute model, where it might be reasonable.

But it has been widely overused to insanity. It likely also exists partly because when the project started in 2003 C++ compilers weren’t that good, so you couldn’t rely on features like templates that much.