This is an archive of the discontinued LLVM Phabricator instance.

[Metadata] Add 'exclude' metadata to add the exclude flags on globals
ClosedPublic

Authored by jhuber6 on Jul 5 2022, 10:16 AM.

Details

Summary

This patchs adds a new metadata kind exclude which implies that the
global variable should be given the necessary flags during code
generation to not be included in the final executable. This is done
using the `SHF_EXCLUDE` flag on ELF for example. This should make it
easier to specify this flag on a variable without needing to explicitly
check the section name in the target backend.

Depends on D129053 D129052

Diff Detail

Event Timeline

jhuber6 created this revision.Jul 5 2022, 10:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 10:16 AM
jhuber6 requested review of this revision.Jul 5 2022, 10:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 10:16 AM
MaskRay added inline comments.Jul 5 2022, 12:16 PM
llvm/test/CodeGen/X86/offload_sections.ll
1

!associated tests may give insight how to add more cases.

jhuber6 updated this revision to Diff 442380.Jul 5 2022, 1:05 PM

Adding more tests

jhenderson resigned from this revision.Jul 5 2022, 11:52 PM

Spotted a couple of minor issues in the docs, but otherwise, I don't have the knowledge to review this.

llvm/docs/LangRef.rst
6400

Nit: the underline is too long here, and will probably cause a doc build warning.

6405
jdoerfert added inline comments.Jul 7 2022, 8:05 AM
llvm/docs/LangRef.rst
6411

The argument (!0) is not described.

llvm/lib/Transforms/Utils/ModuleUtils.cpp
284

Test this in the files that should be affected.

llvm/test/CodeGen/X86/offload_sections.ll
7

Unclear why exclude references the embedded object metadata here. What does that mean?

jhuber6 updated this revision to Diff 442941.Jul 7 2022, 9:01 AM

Addressing comments. Metadata is now empty and must be empty for the flag to be emitted.

Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 9:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Jul 7 2022, 9:06 AM
This revision was landed with ongoing or failed builds.Jul 7 2022, 9:21 AM
This revision was automatically updated to reflect the committed changes.