summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-11 21:30:22 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-11 21:30:22 +0000
commitde36e8040fa72a8242de3fa4a2d663e1c8d0c225 (patch)
treef0f67024e641b7bbfa0282cae2ba097128370b06 /llvm/lib/IR/AsmWriter.cpp
parent6312f4a422ddcb6a262ffc9fd3699cd2ec570425 (diff)
downloadbcm5719-llvm-de36e8040fa72a8242de3fa4a2d663e1c8d0c225.tar.gz
bcm5719-llvm-de36e8040fa72a8242de3fa4a2d663e1c8d0c225.zip
Revert "IR: MDNode => Value"
Instead, we're going to separate metadata from the Value hierarchy. See PR21532. This reverts commit r221375. This reverts commit r221373. This reverts commit r221359. This reverts commit r221167. This reverts commit r221027. This reverts commit r221024. This reverts commit r221023. This reverts commit r220995. This reverts commit r220994. llvm-svn: 221711
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index d9e3131ce3c..1961a20901e 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -545,7 +545,7 @@ public:
/// plane. If something is not in the SlotTracker, return -1.
int getLocalSlot(const Value *V);
int getGlobalSlot(const GlobalValue *V);
- int getMetadataSlot(const Value *MD);
+ int getMetadataSlot(const MDNode *N);
int getAttributeGroupSlot(AttributeSet AS);
/// If you'd like to deal with a function instead of just a module, use
@@ -585,7 +585,7 @@ private:
void CreateModuleSlot(const GlobalValue *V);
/// CreateMetadataSlot - Insert the specified MDNode* into the slot table.
- void CreateMetadataSlot(const Value *MD);
+ void CreateMetadataSlot(const MDNode *N);
/// CreateFunctionSlot - Insert the specified Value* into the slot table.
void CreateFunctionSlot(const Value *V);
@@ -718,7 +718,7 @@ void SlotTracker::processFunction() {
ST_DEBUG("Inserting Instructions:\n");
- SmallVector<std::pair<unsigned, Value *>, 4> MDForInst;
+ SmallVector<std::pair<unsigned, MDNode *>, 4> MDForInst;
// Add all of the basic blocks and instructions with no names.
for (Function::const_iterator BB = TheFunction->begin(),
@@ -755,7 +755,7 @@ void SlotTracker::processFunction() {
// Process metadata attached with this instruction.
I->getAllMetadata(MDForInst);
for (unsigned i = 0, e = MDForInst.size(); i != e; ++i)
- CreateMetadataSlot(cast<MDNode>(MDForInst[i].second));
+ CreateMetadataSlot(MDForInst[i].second);
MDForInst.clear();
}
}
@@ -786,13 +786,13 @@ int SlotTracker::getGlobalSlot(const GlobalValue *V) {
return MI == mMap.end() ? -1 : (int)MI->second;
}
-/// getMetadataSlot - Get the slot number of a metadata node.
-int SlotTracker::getMetadataSlot(const Value *MD) {
+/// getMetadataSlot - Get the slot number of a MDNode.
+int SlotTracker::getMetadataSlot(const MDNode *N) {
// Check for uninitialized state and do lazy initialization.
initialize();
// Find the MDNode in the module map
- mdn_iterator MI = mdnMap.find(cast<MDNode>(MD));
+ mdn_iterator MI = mdnMap.find(N);
return MI == mdnMap.end() ? -1 : (int)MI->second;
}
@@ -846,10 +846,9 @@ void SlotTracker::CreateFunctionSlot(const Value *V) {
DestSlot << " [o]\n");
}
-/// CreateModuleSlot - Insert the specified metadata into the slot table.
-void SlotTracker::CreateMetadataSlot(const Value *MD) {
- assert(MD && "Can't insert a null Value into SlotTracker!");
- const MDNode *N = cast<MDNode>(MD);
+/// CreateModuleSlot - Insert the specified MDNode* into the slot table.
+void SlotTracker::CreateMetadataSlot(const MDNode *N) {
+ assert(N && "Can't insert a null Value into SlotTracker!");
// Don't insert if N is a function-local metadata, these are always printed
// inline.
@@ -2316,7 +2315,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
}
// Print Metadata info.
- SmallVector<std::pair<unsigned, Value *>, 4> InstMD;
+ SmallVector<std::pair<unsigned, MDNode *>, 4> InstMD;
I.getAllMetadata(InstMD);
if (!InstMD.empty()) {
SmallVector<StringRef, 8> MDNames;
@@ -2329,8 +2328,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
Out << ", !<unknown kind #" << Kind << ">";
}
Out << ' ';
- WriteAsOperandInternal(Out, cast<MDNode>(InstMD[i].second), &TypePrinter,
- &Machine, TheModule);
+ WriteAsOperandInternal(Out, InstMD[i].second, &TypePrinter, &Machine,
+ TheModule);
}
}
printInfoComment(I);
OpenPOWER on IntegriCloud