Add a clang compiler variant for clangir project
bcardosolopes opened this issue · comments
Goal
Provide compiler-explorer functionality to allow sharing and experiments with ClangIR.
Presumed info needed to move forward
ClangIR is a new IR for clang (clangir.org) hosted in LLVM's umbrella of projects (https://github.com/llvm/clangir). ClangIR is a C/C++ dialect for MLIR built into Clang and has a textual form that can be printed and parsed. By using compiler-explorer we could inspect into .cir
files and play with current supported C/C++.
Furthermore, we're currently developing a lifetime checker based on ClangIR that runs directly from the clang driver and the compiler explorer would be a great way to look into generated diagnostics and share developments with the community. Given recent support for MLIR, I thought it'd be great if we can be part of the game as well.
I'm a big fan of the compiler-explorer and would be great if we can incorporate support for our project, thanks! :)
Pull Requests
I went ahead and speculatively created 3 PRs based on previous examples I've found on pattern matching:
infra: #1069
clang-builder: compiler-explorer/clang-builder#51
compiler-explorer: compiler-explorer/compiler-explorer#5377
Thank you for the comprehensive write up!
If we want this to build nightly there's another change to make, which I'll make and link here for your edification :)
Failed to build:
+ BUILD_DIR=/root/build
+ STAGING_DIR=/root/staging
+ rm -rf /root/staging
+ mkdir -p /root/staging
+ git clone --depth 1 --single-branch -b llvmorg-master-pattern-matching https://github.com/llvm/clangir.git /root/llvm-project
Cloning into '/root/llvm-project'...
warning: Could not find remote branch llvmorg-master-pattern-matching to clone.
fatal: Remote branch llvmorg-master-pattern-matching not found in upstream origin
Error: Process completed with exit code 128.
Run ./post-run.sh "clang_ir" "" "" "1692154148"
These docker files are designed to somewhat straightforward to test locally. I do this with something like:
$ docker build --build-arg image=20.04 -t builder . && docker run --rm -it builder bash build.sh clangir-trunk
or similar. That makes for a fairly quick turnaround,
To me it seems the:
BRANCH=llvmorg-master-pattern-matching
is wrong, but I'm not sure what it should be in your case. Send another PR to clang-builder and let me know: we can get this fixed pretty quickly.
Thanks for the fast turnaround, yeah I messed up in the copy-n-paste, just posted compiler-explorer/clang-builder#52
All the pieces have landed, thanks again @mattgodbolt!!