# Bachmann visit 24 Mar 2023 ## Goals of the project ### Reduce time spent in the LLVM backend The Bachmann team finds that their compiler is quite quick in the frontend, but spends a huge amount of time in the backend - this isn't just an impression, they have metrics to support this. They would like us to investigate the time spent there, and how they could help the backend (both in terms of improving the quality of generated code, and reducing compilation time) by generating different LLVM IR from their frontend. The compilation time is the most important piece of the project that we can help them with, and the most pressing. They are competing against their old in-house ST compiler, which is not an optimizing compiler and is extremely fast. They would also like to understand why the time spent in the backend is different when compiling for x86 vs compiling for Arm. - Look into LLVM metadata nodes and if they could help - Profile the compiler to figure out the various slowdowns - Research how to improve the generated IR for this - Look into how much time is spent in the linker, backend, and optimiser - Research whether properly processing independent compilation units can reduce compilation time by parallelising the backend ### Code hotswapping The existing compiler is able to hotswap code on a running binary. This is an extremely important feature as their clients rely on it. They would like to implement the same behavior, but are not really sure on how to proceed. We gave multiple pointers which interested them greatly, and they would love to work with us on this. This is an extremely important topic for the Bachmann team and one they are really concerned with. We think this will require changes to their compiler for nice incremental compilation and "binary-layout-aware" code generation. - Need to be able to add, delete or replace global variables on a running binary (which will have been compiled as a shared object and loaded using a `dlopen`-like function) - Use these moved global variables in multiple functions without stopping the application ### Overall They are looking for engineering conversations with us, to discuss ideas and how to improve things. They would like help with the code hotswapping as they feel that is out of their depth, but are overall not looking for us to do things - only advise. ### Other subgoals There are other goals which Bachmann would like to discuss, but they are not as pressing as the above two, are as follow: - Figure out if there are missed optimizations in their usage of LLVM - How to improve testing on the compiler? - Add regression testing - Improve their correctness testing - Improving their frontend's internal representation - Work on refactoring their visitors - Adding another intermediate internal representation to their compiler - Look into structure fields reordering - Split project in packages using Rust workspaces - Help improve their dashboard benchmark