This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix tablegen when using a runtimes build
ClosedPublic

Authored by jhuber6 on Nov 15 2022, 8:29 AM.

Details

Summary

When using LLVM_ENABLE_RUNTIMES=libc we need to perform a few extra
steps to include LLVM utilities similar to if we were performing a
standalone build. Libc depends on the tablegen utilities and the LLVM
libraries when performing a full build. When using an
LLVM_ENABLE_PROJECTS=libc build these are included as a part of the
greater LLVM build, but here we need to perform it maunally. This patch
should allow using LLVM_LIBC_FULL_BUILD=ON when building with
runtimes.

Diff Detail

Event Timeline

jhuber6 created this revision.Nov 15 2022, 8:29 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 15 2022, 8:29 AM
jhuber6 requested review of this revision.Nov 15 2022, 8:29 AM
lntue accepted this revision.Nov 15 2022, 9:53 AM
This revision is now accepted and ready to land.Nov 15 2022, 9:53 AM
This revision was automatically updated to reflect the committed changes.
sivachandra added inline comments.Nov 15 2022, 10:16 AM
libc/CMakeLists.txt
17

IIRC, the only dependency we have outside of the libc directory is for tablegen. So, could we perhaps move this logic over to something more local to the places where tablegen is used? Also, we want to move away from using the LLVM_ prefix to libc's CMake variables - just use LIBC_ for the prefix. In this case, it can be more specific like LIBC_TABLEGEN_INCLUDE_DIRS.

jhuber6 added inline comments.Nov 15 2022, 10:17 AM
libc/CMakeLists.txt
17

In the future we may need to have some more runtimes specific glue so I figured it was fine to put it up front similar to what most projects do for standalone builds. If you'd prefer it to be right next to where it's used that's fine. I can also change the name.

sivachandra added inline comments.Nov 15 2022, 10:24 AM
libc/CMakeLists.txt
17

Tablegen has been a nagging dependency which we want to stop using because it is not the most appropriate for our use case. So, at the least, having tablegen pieces confined to a smaller scope will help with future cleanups.