This is an archive of the discontinued LLVM Phabricator instance.

[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

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.