[SAoC] MLIR Support for LDC

Roberto Rosmaninho Robertogrosmaninho at gmail.com
Fri Oct 4 13:07:56 UTC 2019


On Thursday, 3 October 2019 at 18:38:35 UTC, Johan wrote:

> I know how MLIR is to be included into the LLVM source 
> directory. This is the same method that compiler-rt and clang 
> used to be before the single big LLVM repo happened recently.
> But I think that also means that mlir will be installed in the 
> LLVM installation dir. So instead of searching in 
> "${LLVM_ROOT_DIR}/../projects/mlir" (which I think will only 
> work with your directory layout), you should be able to find 
> the include files in "${LLVM_ROOT_DIR}/include/mlir" no?
> The benefit of that is that your MLIR branch will work for 
> others that have mlir too (even if a distribution carries MLIR, 
> without a user having to compiler it).

I see, but neither clang nor compiler-rt has any code in 
"${LLVM_ROOT_DIR}/include/".  I think the problem here is that 
${LLVM_ROOT_DIR} has the following path 
"~/llvm-project/llvm/build" (at least this is the path that I got 
here - this llvm-project is the new pattern), so to get separate 
projects like clang, compiler-rt , and mlir, we need to go back 
to llvm directory, enter the project directory and select the 
project we want. As far as I know, this is the build pattern for 
llvm, so anyone who has already installed mlir will benefit from 
it.

> Separate issue, but indeed. Simply do something like this in 
> CMake and #ifdef code that cannot be compiled without MLIR:
> if(LLVM_MLIR_FOUND)
>     message(STATUS "Building with MLIR support")
>     add_definitions("-DLDC_LLVM_MLIR_ENABLED")
> endif()

Done! Thanks again!

Regards,
Roberto Rosmaninho


More information about the Digitalmars-d mailing list