[llvm] XCOFF associated metadata (PR #159096)
Wael Yehia via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 26 11:13:29 PDT 2025
================
@@ -766,6 +766,30 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
DL.getIntPtrType(GO->getType()),
RangeLikeMetadataKind::AbsoluteSymbol);
}
+
+ if (GO->hasMetadata(LLVMContext::MD_ref)) {
+ SmallVector<MDNode *> MDs;
+ GO->getMetadata(LLVMContext::MD_ref, MDs);
+ for (const MDNode *MD : MDs) {
+ Check(MD->getNumOperands() == 1, "ref metadata must have one operand",
----------------
w2yehia wrote:
since we're allowed to have multiple `!ref`, it's more compact to allow one `!ref` that references multiple globals?
```
@a = global i32 3, !ref !1
!1 = !{ptr @b, ptr @c}
```
rather than
```
@a = global i32 3, !ref !1, !ref !2
!1 = !{ptr @b}
!2 = !{ptr @c}
```
https://llvm.org/docs/LangRef.html#callees-metadata does that.
https://github.com/llvm/llvm-project/pull/159096
More information about the llvm-commits
mailing list