summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-01-07 19:39:36 +0000
committerDevang Patel <dpatel@apple.com>2010-01-07 19:39:36 +0000
commitfcfee0ff35ccc293621412a10426c0e222aaba14 (patch)
tree9cd3773a0c29673632ae1a3d3da4d87b4de81ca4 /llvm/lib/VMCore/Module.cpp
parent64fe23370481d2c18460367ff8b933a7e4884c52 (diff)
downloadbcm5719-llvm-fcfee0ff35ccc293621412a10426c0e222aaba14.tar.gz
bcm5719-llvm-fcfee0ff35ccc293621412a10426c0e222aaba14.zip
Use separate namespace for named metadata.
llvm-svn: 92931
Diffstat (limited to 'llvm/lib/VMCore/Module.cpp')
-rw-r--r--llvm/lib/VMCore/Module.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp
index a7f503bacb9..e25a29517a4 100644
--- a/llvm/lib/VMCore/Module.cpp
+++ b/llvm/lib/VMCore/Module.cpp
@@ -59,6 +59,7 @@ Module::Module(StringRef MID, LLVMContext& C)
: Context(C), ModuleID(MID), DataLayout("") {
ValSymTab = new ValueSymbolTable();
TypeSymTab = new TypeSymbolTable();
+ NamedMDSymTab = new MDSymbolTable();
}
Module::~Module() {
@@ -307,20 +308,25 @@ GlobalAlias *Module::getNamedAlias(StringRef Name) const {
/// specified name. This method returns null if a NamedMDNode with the
//// specified name is not found.
NamedMDNode *Module::getNamedMetadata(StringRef Name) const {
- return dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name));
+ return NamedMDSymTab->lookup(Name);
}
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
/// with the specified name. This method returns a new NamedMDNode if a
/// NamedMDNode with the specified name is not found.
NamedMDNode *Module::getOrInsertNamedMetadata(StringRef Name) {
- NamedMDNode *NMD =
- dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name));
+ NamedMDNode *NMD = NamedMDSymTab->lookup(Name);
if (!NMD)
NMD = NamedMDNode::Create(getContext(), Name, NULL, 0, this);
return NMD;
}
+/// addMDNodeName - Insert an entry in the NamedMDNode symbol table mapping
+/// Name to NMD.
+void Module::addMDNodeName(StringRef Name, NamedMDNode *NMD) {
+ NamedMDSymTab->insert(Name, NMD);
+}
+
//===----------------------------------------------------------------------===//
// Methods for easy access to the types in the module.
//
OpenPOWER on IntegriCloud