mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
Link metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78652 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9d3627ea27
commit
ae709eaeb1
@ -395,6 +395,14 @@ static Value *RemapOperand(const Value *In,
|
||||
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
|
||||
llvm_unreachable("Unknown type of derived type constant value!");
|
||||
}
|
||||
} else if (const MDNode *N = dyn_cast<MDNode>(In)) {
|
||||
std::vector<Value*> Elems;
|
||||
for (unsigned i = 0, e = N->getNumElements(); i !=e; ++i)
|
||||
Elems.push_back(RemapOperand(N->getElement(i), ValueMap, Context));
|
||||
if (!Elems.empty())
|
||||
Result = MDNode::get(Context, &Elems[0], Elems.size());
|
||||
} else if (const MDString *MDS = dyn_cast<MDString>(In)) {
|
||||
Result = MDString::get(Context, MDS->getString());
|
||||
} else if (isa<InlineAsm>(In)) {
|
||||
Result = const_cast<Value*>(In);
|
||||
}
|
||||
|
12
test/Linker/linkmdnode.ll
Normal file
12
test/Linker/linkmdnode.ll
Normal file
@ -0,0 +1,12 @@
|
||||
; RUN: llvm-as < %s > %t.bc
|
||||
; RUN: llvm-as < %p/linkmdnode2.ll > %t2.bc
|
||||
; RUN: llvm-link %t.bc %t2.bc
|
||||
|
||||
|
||||
!21 = metadata !{i32 42, metadata !"foobar"}
|
||||
|
||||
declare i8 @llvm.something(metadata %a)
|
||||
define void @foo() {
|
||||
%x = call i8 @llvm.something(metadata !21)
|
||||
ret void
|
||||
}
|
12
test/Linker/linkmdnode2.ll
Normal file
12
test/Linker/linkmdnode2.ll
Normal file
@ -0,0 +1,12 @@
|
||||
; This file is used by linkmdnode.ll, so it doesn't actually do anything itself
|
||||
;
|
||||
; RUN: true
|
||||
|
||||
!22 = metadata !{i32 42, metadata !"foobar"}
|
||||
|
||||
declare i8 @llvm.something(metadata %a)
|
||||
define void @foo1() {
|
||||
;; Intrinsic using MDNode and MDString
|
||||
%x = call i8 @llvm.something(metadata !22)
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user