Skip to content

Commit c9ed9d9

Browse files
committed
Rename metadata from ref to implicit.ref.
1 parent 84f0277 commit c9ed9d9

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

llvm/docs/LangRef.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8670,10 +8670,11 @@ denoting if the type contains a pointer.
86708670

86718671
!0 = !{!"<type-name>", i1 <contains-pointer>}
86728672

8673-
'``ref``' Metadata
8674-
^^^^^^^^^^^^^^^^^^
8673+
'``implicit.ref``' Metadata
8674+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
8675+
86758676

8676-
The ``ref`` metadata may be attached to a function or global variable
8677+
The ``implicit.ref`` metadata may be attached to a function or global variable
86778678
definition with a single argument that references a global object.
86788679
This is typically used when there is some implicit dependence between the
86798680
symbols that is otherwise opaque to the linker. One such example is metadata
@@ -8695,7 +8696,7 @@ Example:
86958696

86968697
@a = global i32 1
86978698
@b = global i32 2
8698-
@c = global i32 3, section "abc", !ref !0, !ref !1
8699+
@c = global i32 3, section "abc", !implicit.ref !0, !implicit.ref !1
86998700
!0 = !{ptr @a}
87008701
!1 = !{ptr @b}
87018702

llvm/include/llvm/IR/FixedMetadataKinds.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ LLVM_FIXED_MD_KIND(MD_callee_type, "callee_type", 42)
5757
LLVM_FIXED_MD_KIND(MD_nofree, "nofree", 43)
5858
LLVM_FIXED_MD_KIND(MD_captures, "captures", 44)
5959
LLVM_FIXED_MD_KIND(MD_alloc_token, "alloc_token", 45)
60-
LLVM_FIXED_MD_KIND(MD_ref, "ref", 46)
60+
LLVM_FIXED_MD_KIND(MD_implicit_ref, "implicit.ref", 46)

llvm/lib/IR/Verifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,12 +770,12 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
770770
RangeLikeMetadataKind::AbsoluteSymbol);
771771
}
772772

773-
if (GO->hasMetadata(LLVMContext::MD_ref)) {
773+
if (GO->hasMetadata(LLVMContext::MD_implicit_ref)) {
774774
Check(!GO->isDeclaration(),
775775
"ref metadata must not be placed on a declaration", GO);
776776

777777
SmallVector<MDNode *> MDs;
778-
GO->getMetadata(LLVMContext::MD_ref, MDs);
778+
GO->getMetadata(LLVMContext::MD_implicit_ref, MDs);
779779
for (const MDNode *MD : MDs) {
780780
Check(MD->getNumOperands() == 1, "ref metadata must have one operand",
781781
&GV, MD);

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,7 +2803,7 @@ void PPCAIXAsmPrinter::emitGlobalVariableHelper(const GlobalVariable *GV) {
28032803
// Switch to the containing csect.
28042804
OutStreamer->switchSection(Csect);
28052805

2806-
if (GV->hasMetadata(LLVMContext::MD_ref)) {
2806+
if (GV->hasMetadata(LLVMContext::MD_implicit_ref)) {
28072807
emitRefMetadata(GV);
28082808
}
28092809

@@ -2906,7 +2906,7 @@ void PPCAIXAsmPrinter::emitFunctionEntryLabel() {
29062906
OutStreamer->emitLabel(
29072907
getObjFileLowering().getFunctionEntryPointSymbol(Alias, TM));
29082908

2909-
if (F->hasMetadata(LLVMContext::MD_ref)) {
2909+
if (F->hasMetadata(LLVMContext::MD_implicit_ref)) {
29102910
emitRefMetadata(F);
29112911
}
29122912
}
@@ -3350,7 +3350,7 @@ void PPCAIXAsmPrinter::emitTTypeReference(const GlobalValue *GV,
33503350

33513351
void PPCAIXAsmPrinter::emitRefMetadata(const GlobalObject *GO) {
33523352
SmallVector<MDNode *> MDs;
3353-
GO->getMetadata(LLVMContext::MD_ref, MDs);
3353+
GO->getMetadata(LLVMContext::MD_implicit_ref, MDs);
33543354
assert(MDs.size() && "Expected asscoiated metadata nodes");
33553355

33563356
for (const MDNode *MD : MDs) {

llvm/test/CodeGen/PowerPC/aix-func-ref.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
@b = global i32 2
1515
@c = global i32 3
1616

17-
define i32 @foo() !ref !0 {
17+
define i32 @foo() !implicit.ref !0 {
1818
ret i32 0
1919
}
2020

21-
define i32 @bar() !ref !1 !ref !2 {
21+
define i32 @bar() !implicit.ref !1 !implicit.ref !2 {
2222
ret i32 0
2323
}
2424

llvm/test/CodeGen/PowerPC/aix-ref-metadata.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
@a = global i32 1
1111
@b = global i32 2
1212
@c = global i32 3, section "custom_section_c"
13-
@d = global i32 4, !ref !0
14-
@e = constant i32 5, !ref !1, !ref!2
15-
@f = global i32 6, section "custom_section_f", !ref !1
13+
@d = global i32 4, !implicit.ref !0
14+
@e = constant i32 5, !implicit.ref !1, !implicit.ref!2
15+
@f = global i32 6, section "custom_section_f", !implicit.ref !1
1616

1717

1818
!0 = !{ptr @a}

llvm/test/Verifier/ref-func.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
@a = global i32 1
44
@b = global i32 2
5-
@c = global i32 3, !ref !0
5+
@c = global i32 3, !implicit.ref !0
66

7-
define i32 @foo() !ref !1 {
7+
define i32 @foo() !implicit.ref !1 {
88
ret i32 0
99
}
1010

llvm/test/Verifier/ref.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
; RUN: not llvm-as -disable-output < %s -o /dev/null 2>&1 | FileCheck %s
22

3-
@a = global i32 1, !ref !0
4-
@b = global i32 2, !ref !1
5-
@c = global i32 3, !ref !1, !ref !2
6-
@d = global i32 4, !ref !3
7-
@e = external global i32, !ref !1
3+
@a = global i32 1, !implicit.ref !0
4+
@b = global i32 2, !implicit.ref !1
5+
@c = global i32 3, !implicit.ref !1, !implicit.ref !2
6+
@d = global i32 4, !implicit.ref !3
7+
@e = external global i32, !implicit.ref !1
88

99
!0 = !{i32 1}
1010
!1 = !{ptr @b}

0 commit comments

Comments
 (0)