Preliminary LLVM 20 support#4843
Conversation
|
Nice, thanks! How about becoming a member of ldc-developers, any interest? :) |
the-horo
left a comment
There was a problem hiding this comment.
In gen_gccbuiltins.cpp you can get away with retroactively applying const instead of the LLVM_20_CONST conditional.
One more change that github doesn't let me submit:
- return TableGenMain(argv[0], emit);
+ // Since LLVM-20 `records` needs to be const&
+ return TableGenMain(argv[0], [](raw_ostream &os, auto &records){
+ return emit(os, records);
+ });| #if LDC_LLVM_VER >= 2000 | ||
| #define LLVM_20_CONST const | ||
| #else | ||
| #define LLVM_20_CONST | ||
| #endif | ||
|
|
||
| string dtype(LLVM_20_CONST Record* rec, bool readOnlyMem) |
There was a problem hiding this comment.
| #if LDC_LLVM_VER >= 2000 | |
| #define LLVM_20_CONST const | |
| #else | |
| #define LLVM_20_CONST | |
| #endif | |
| string dtype(LLVM_20_CONST Record* rec, bool readOnlyMem) | |
| string dtype(const Record* rec, bool readOnlyMem) |
| string dtype(LLVM_20_CONST Record* rec, bool readOnlyMem) | ||
| { | ||
| Init* typeInit = rec->getValueInit("VT"); | ||
| LLVM_20_CONST Init* typeInit = rec->getValueInit("VT"); |
There was a problem hiding this comment.
| LLVM_20_CONST Init* typeInit = rec->getValueInit("VT"); | |
| auto typeInit = rec->getValueInit("VT"); |
| } | ||
|
|
||
| StringRef attributes(ListInit* propertyList) | ||
| StringRef attributes(LLVM_20_CONST ListInit* propertyList) |
There was a problem hiding this comment.
| StringRef attributes(LLVM_20_CONST ListInit* propertyList) | |
| StringRef attributes(const ListInit* propertyList) |
| name = string("llvm.") + name; | ||
|
|
||
| ListInit* propsList = rec.getValueAsListInit("IntrProperties"); | ||
| LLVM_20_CONST ListInit* propsList = rec.getValueAsListInit("IntrProperties"); |
There was a problem hiding this comment.
| LLVM_20_CONST ListInit* propsList = rec.getValueAsListInit("IntrProperties"); | |
| auto propsList = rec.getValueAsListInit("IntrProperties"); |
| bool readOnlyMem = prop == "IntrReadArgMem" || prop == "IntrReadMem"; | ||
|
|
||
| ListInit* paramsList = rec.getValueAsListInit("ParamTypes"); | ||
| LLVM_20_CONST ListInit* paramsList = rec.getValueAsListInit("ParamTypes"); |
There was a problem hiding this comment.
| LLVM_20_CONST ListInit* paramsList = rec.getValueAsListInit("ParamTypes"); | |
| auto paramsList = rec.getValueAsListInit("ParamTypes"); |
| } | ||
|
|
||
| ListInit* retList = rec.getValueAsListInit("RetTypes"); | ||
| LLVM_20_CONST ListInit* retList = rec.getValueAsListInit("RetTypes"); |
There was a problem hiding this comment.
| LLVM_20_CONST ListInit* retList = rec.getValueAsListInit("RetTypes"); | |
| auto retList = rec.getValueAsListInit("RetTypes"); |
| std::string arch; | ||
|
|
||
| bool emit(raw_ostream& os, RecordKeeper& records) | ||
| bool emit(raw_ostream& os, LLVM_20_CONST RecordKeeper& records) |
There was a problem hiding this comment.
| bool emit(raw_ostream& os, LLVM_20_CONST RecordKeeper& records) | |
| bool emit(raw_ostream& os, const RecordKeeper& records) |
This is now required by LLVM API starting from LLVM 20
|
First LDC-LLVM 20 release-candidate binaries are available: https://github.com/ldc-developers/llvm-project/releases/tag/CI @rainers: FYI, incl. natively-built Windows-on-ARM64 packages, as GitHub Actions now has such runners: https://github.blog/changelog/2025-04-14-windows-arm64-hosted-runners-now-available-in-public-preview/. [And they seem significantly faster than the x86_64 runners.] |
This pull request adds basic LLVM 20 support for LDC.
LLVM 20 changed a lot of APIs again, especially how passes are structured.