Support multiple LLVM versions
What
Refactored to choose appropriate LLVM API based on the LLVM version being used to build Parabix.
Why
To support building Parabix with LLVM version 5 through 12
How
Mostly #ifdef
s help determine the appropriate LLVM API to be used.
Another approach uses a facade library (LLVMVersion) that has a pair of header and .cpp files. These files contain the appropriate API call needed for the LLVM version in use.
To simplify the facade design further and avoid duplicate code, we can consolidate the LLVMVersion libraries post LLVM 9 into a single LLVMVersion.h/.cpp
file. It can use FixedVectorType
by default. This is a possibility considering LLVM maintains any (to be) deprecated APIs at least for 1-2 major releases before removing it completely.
Changes details
- Use LLVMVersion layer -
llvm_version::API_NAME
to resolve to any version-specific API - Added
LLVMVersion
library that has pairs ofLLVMVersion.h/.cpp
for different LLVM versions. - CMake has been modified to decide the version to use and include the correct LLVMVersion directory to the build process.
- Added CI config for LLVM 10, LLVM 11
- Refactored deprecated wrapper functions by their actual implementations.
- Added header files required for
LLVM_VERSION_MAJOR >= 10
- Added wrapper function
createCall
to invokellvm::CreateCall
with appropriate arg types/list for given LLVM version.
Missed anything?
- Explained the purpose of this PR.
- Self reviewed the PR.
- Added or updated test cases.
- Informed of breaking changes, testing and migrations (if applicable).
- Updated documentation (if applicable).
- Attached screenshots (if applicable).