-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LLVM IR code generator refactoring and updates (#8140)
Context: https://llvm.org/docs/OpaquePointers.html Context: 903ba37 903ba37 added a new native code generator using the LLVM IR language, to let LLVM code generator handle all the CPU and platform specific details. This commit improves the original generator by simplifying the code generator model so that tasks generating native code need to know **less** about LLVM IR structure. The most important changes: * Migrate to opaque pointers (LLVM 15+) which will be the only ones supported from LLVM 16 onwards. This will allow us to update our toolchain to LLVM 16 or newer at some point. It also simplifies both the code generator **and** the generated code. * Change code generation model. Now the "client" classes don't need to concern themselves with **how** the LLVM IR code looks and how it is formatted. Instead, they build a model of the code they want to output and let the generator do the rest. * Handle many more tasks automatically: * LLVM IR string management and registration * Buffer management for structures which have pointers to buffers * References to local variables and strings * Local temporary counting (unnamed labels and function parameters). LLVM requires that all unnamed local temporaries (that is labels and function parameters) are named using a shared counter, with all of thus generated names being numbers in sequence. In the previous version of the generator it was problematic, in this version it's easy and seamless.
- Loading branch information
Showing
59 changed files
with
6,150 additions
and
3,229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.