Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Metadata] Add 'exclude' metadata to add the exclude flags on globals
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 Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D129151
- Loading branch information
Showing
10 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
; RUN: llc -mtriple x86_64-win32-gnu < %s | FileCheck %s | ||
|
||
@a = global i32 1 | ||
@b = global i32 1, !exclude !0 | ||
@c = global i32 1, section "aaa" | ||
; CHECK-DAG: c | ||
; CHECK-DAG: .section aaa,"dw" | ||
@d = global i32 1, section "bbb", !exclude !0 | ||
; CHECK-DAG: d | ||
; CHECK-DAG: .section bbb,"ynD" | ||
@e = global i32 1, section "bbb", !exclude !0 | ||
; CHECK-DAG: e | ||
@f = global i32 1, section "ccc", !exclude !0 | ||
@g = global i32 1, section "ccc" | ||
; CHECK-DAG: f | ||
; CHECK-DAG: .section ccc,"ynD" | ||
|
||
!0 = !{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
; RUN: llc -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s | ||
|
||
@a = global i32 1 | ||
@b = global i32 1, !exclude !0 | ||
@c = global i32 1, section "aaa" | ||
; CHECK-DAG: .type c,@object | ||
; CHECK-DAG: .section aaa,"aw",@progbits | ||
@d = global i32 1, section "bbb", !exclude !0 | ||
; CHECK-DAG: .type d,@object | ||
; CHECK-DAG: .section bbb,"e",@progbits | ||
@e = global i32 1, section "bbb", !exclude !0 | ||
; CHECK-DAG: .type e,@object | ||
@f = global i32 1, section "ccc", !exclude !0 | ||
@g = global i32 1, section "ccc" | ||
; CHECK-DAG: .type f,@object | ||
; CHECK-DAG: .section ccc,"e",@progbits | ||
|
||
!0 = !{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=CHECK-ELF | ||
; RUN: llc < %s -mtriple=x86_64-win32-gnu | FileCheck %s --check-prefix=CHECK-COFF | ||
|
||
@llvm.embedded.object = private constant [1 x i8] c"\00", section ".llvm.offloading" | ||
@llvm.embedded.object = private constant [1 x i8] c"\00", section ".llvm.offloading", align 8, !exclude !0 | ||
@llvm.compiler.used = appending global [1 x ptr] [ptr @llvm.embedded.object], section "llvm.metadata" | ||
|
||
!0 = !{} | ||
|
||
; CHECK-ELF: .section .llvm.offloading,"e",@llvm_offloading | ||
; CHECK-COFF: .section .llvm.offloading,"dr" | ||
; CHECK-COFF: .section .llvm.offloading,"ynD" |