mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Use separate namespace for named metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92931 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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.
|
||||
//
|
||||
|
Reference in New Issue
Block a user