#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/Operator.h"
#include "llvm/ValueSymbolTable.h"
MetadataBase *Node;
if (ParseMDNode(Node)) return true;
- MetadataContext &TheMetadata = M->getContext().getMetadata();
- unsigned MDK = TheMetadata.getMDKind(Name.c_str());
- if (!MDK)
- MDK = TheMetadata.registerMDKind(Name.c_str());
+ unsigned MDK = M->getMDKindID(Name.c_str());
MDsOnInst.push_back(std::make_pair(MDK, cast<MDNode>(Node)));
-
return false;
}
ParseOptionalCustomMetadata();
// Set metadata attached with this instruction.
- MetadataContext &TheMetadata = M->getContext().getMetadata();
for (SmallVector<std::pair<unsigned, MDNode *>, 2>::iterator
MDI = MDsOnInst.begin(), MDE = MDsOnInst.end(); MDI != MDE; ++MDI)
- TheMetadata.addMD(MDI->first, MDI->second, Inst);
+ Inst->setMetadata(MDI->first, MDI->second);
MDsOnInst.clear();
BB->getInstList().push_back(Inst);