Page MenuHomePhabricator

[flang] Enable export of FIR includes into the install tree
AcceptedPublic

Authored by Renaud-K on May 6 2021, 7:12 PM.

Details

Summary

This makes it possible to build out-of-tree just pointing to an install tree.
It is consistent with MLIR.

Essentially it installs
./include/flang/Optimizer/CodeGen/CGOps.h.inc
./include/flang/Optimizer/CodeGen/CGPasses.h.inc
./include/flang/Optimizer/Dialect/FIROps.h.inc
./include/flang/Optimizer/Dialect/FIROpsTypes.h.inc
./include/flang/Optimizer/Transforms/Passes.h.inc

side-by-side with their .h counterparts which have a dependency with them.

Diff Detail

Unit TestsFailed

TimeTest
60 msx64 debian > Clang.Driver::baremetal.cpp
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/clang -no-canonical-prefixes /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/baremetal.cpp -### -o /mnt/disks/ssd0/agent/llvm-project/build/tools/clang/test/Driver/Output/baremetal.cpp.tmp.o 2>&1 -target armv6m-none-eabi -T semihosted.lds -L some/directory/user/asked/for --sysroot=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/Inputs/baremetal_arm | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck --check-prefix=CHECK-V6M-C /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/baremetal.cpp
210 msx64 windows > Clang.Driver::baremetal.cpp
Script: -- : 'RUN: at line 1'; c:\ws\w16n2-1\llvm-project\premerge-checks\build\bin\clang.exe -no-canonical-prefixes C:\ws\w16n2-1\llvm-project\premerge-checks\clang\test\Driver\baremetal.cpp -### -o C:\ws\w16n2-1\llvm-project\premerge-checks\build\tools\clang\test\Driver\Output\baremetal.cpp.tmp.o 2>&1 -target armv6m-none-eabi -T semihosted.lds -L some/directory/user/asked/for --sysroot=C:\ws\w16n2-1\llvm-project\premerge-checks\clang\test\Driver/Inputs/baremetal_arm | c:\ws\w16n2-1\llvm-project\premerge-checks\build\bin\filecheck.exe --check-prefix=CHECK-V6M-C C:\ws\w16n2-1\llvm-project\premerge-checks\clang\test\Driver\baremetal.cpp

Event Timeline

Renaud-K created this revision.May 6 2021, 7:12 PM
Renaud-K requested review of this revision.May 6 2021, 7:12 PM

@Renaud-K, I'm not sure what the use-case is that this fixes. Can you please describe it in more detail, and I'll try a build with that exact use case to verify that this fixes it.

I have tested full shared and non-shared builds with this change, and both look good.

A use-case would be an out-of-tree build with a Jenkins build for instance, which only keep the install tree around. MLIR enables this already.

@Renaud-K I'm guessing that this change is required to make sure that Flang header files are installed alongside other install components, right?

  • Are these any specific headers?
  • In what way is this change FIR specific?
PeteSteinfeld accepted this revision.May 7 2021, 10:46 AM
This revision is now accepted and ready to land.May 7 2021, 10:46 AM
Renaud-K edited the summary of this revision. (Show Details)May 7 2021, 1:15 PM
Renaud-K updated this revision to Diff 343749.May 7 2021, 1:22 PM

My apologies. I should have blown away my build tree prior to testing this, otherwise cmake still somehow finds its way to the *.h.inc files

This change is more straightforward. It simply installs:
./include/flang/Optimizer/CodeGen/CGOps.h.inc
./include/flang/Optimizer/CodeGen/CGPasses.h.inc
./include/flang/Optimizer/Dialect/FIROps.h.inc
./include/flang/Optimizer/Dialect/FIROpsTypes.h.inc
./include/flang/Optimizer/Transforms/Passes.h.inc

side-by-side with their .h counterparts which have a dependency with them.

This makes it possible to build out-of-tree

Do you mean out-of-tree as in here: https://github.com/llvm/llvm-project/tree/main/flang#building-flang-out-of-tree ? I'm not familiar with this part of CMake, so I'm just trying to better understand the rationale. I see that this is similar to what is happening in MLIR, so in this sense it makes sense.

The link is about building flang with an external build/install of LLVM/MLIR.

This change is about building code with an external build/install of flang. This is helpful for small projects, out of the fir-dev tree, to quickly build and test against different versions of fir-dev.
The difference is building 10 files versus 3000.
I shall confess that this is more of an internal need because our Jenkins builds only leave install trees around. But thought this would be a change worth and acceptable to upstream because MLIR does something similar.

The link is about building flang with an external build/install of LLVM/MLIR.

This change is about building code with an external build/install of flang. This is helpful for small projects, out of the fir-dev tree, to quickly build and test against different versions of fir-dev.
The difference is building 10 files versus 3000.
I shall confess that this is more of an internal need because our Jenkins builds only leave install trees around. But thought this would be a change worth and acceptable to upstream because MLIR does something similar.

Thank you for clarifying. You may want to be a bit more specific in the summary/commit message. Clearly out-of-tree is a bit ambiguous in the context of Flang :)

@PeteSteinfeld has already approved and to me this also makes sense (though I'm rather unfamiliar with this area). Please go ahead and merge.