Hash Metadata using pointer for MDString argument instead of value (NFC)

MDString are uniqued in the Context on creation, hashing the
pointer is less expensive than hashing the String itself.

Reviewers: dexonsmith
Differential Revision: http://reviews.llvm.org/D16560

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263867
This commit is contained in:
Mehdi Amini 2016-03-19 01:02:34 +00:00
parent 53fc3895e0
commit 5d99c4efaa
3 changed files with 128 additions and 140 deletions

View File

@ -291,6 +291,7 @@ public:
unsigned getTag() const { return SubclassData16; }
StringRef getHeader() const { return getStringOperand(0); }
MDString *getRawHeader() const { return getOperandAs<MDString>(0); }
op_iterator dwarf_op_begin() const { return op_begin() + 1; }
op_iterator dwarf_op_end() const { return op_end(); }

View File

@ -144,12 +144,6 @@ StringRef DIScope::getName() const {
return "";
}
static StringRef getString(const MDString *S) {
if (S)
return S->getString();
return StringRef();
}
#ifndef NDEBUG
static bool isCanonical(const MDString *S) {
return !S || !S->getString().empty();
@ -162,7 +156,7 @@ GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
StorageType Storage, bool ShouldCreate) {
unsigned Hash = 0;
if (Storage == Uniqued) {
GenericDINodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
GenericDINodeInfo::KeyTy Key(Tag, Header, DwarfOps);
if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
return N;
if (!ShouldCreate)
@ -221,7 +215,7 @@ DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value,
MDString *Name, StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIEnumerator, (Value, getString(Name)));
DEFINE_GETIMPL_LOOKUP(DIEnumerator, (Value, Name));
Metadata *Ops[] = {Name};
DEFINE_GETIMPL_STORE(DIEnumerator, (Value), Ops);
}
@ -231,8 +225,8 @@ DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
uint64_t AlignInBits, unsigned Encoding,
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(
DIBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
DEFINE_GETIMPL_LOOKUP(DIBasicType,
(Tag, Name, SizeInBits, AlignInBits, Encoding));
Metadata *Ops[] = {nullptr, nullptr, Name};
DEFINE_GETIMPL_STORE(DIBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
Ops);
@ -244,9 +238,9 @@ DIDerivedType *DIDerivedType::getImpl(
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIDerivedType, (Tag, getString(Name), File, Line, Scope,
BaseType, SizeInBits, AlignInBits,
OffsetInBits, Flags, ExtraData));
DEFINE_GETIMPL_LOOKUP(DIDerivedType,
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
AlignInBits, OffsetInBits, Flags, ExtraData));
Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
DEFINE_GETIMPL_STORE(
DIDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
@ -261,11 +255,10 @@ DICompositeType *DICompositeType::getImpl(
Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DICompositeType,
(Tag, getString(Name), File, Line, Scope, BaseType,
SizeInBits, AlignInBits, OffsetInBits, Flags, Elements,
RuntimeLang, VTableHolder, TemplateParams,
getString(Identifier)));
DEFINE_GETIMPL_LOOKUP(
DICompositeType, (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
VTableHolder, TemplateParams, Identifier));
Metadata *Ops[] = {File, Scope, Name, BaseType,
Elements, VTableHolder, TemplateParams, Identifier};
DEFINE_GETIMPL_STORE(DICompositeType, (Tag, Line, RuntimeLang, SizeInBits,
@ -287,7 +280,7 @@ DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
bool ShouldCreate) {
assert(isCanonical(Filename) && "Expected canonical MDString");
assert(isCanonical(Directory) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIFile, (getString(Filename), getString(Directory)));
DEFINE_GETIMPL_LOOKUP(DIFile, (Filename, Directory));
Metadata *Ops[] = {Filename, Directory};
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIFile, Ops);
}
@ -331,10 +324,10 @@ DISubprogram *DISubprogram::getImpl(
assert(isCanonical(Name) && "Expected canonical MDString");
assert(isCanonical(LinkageName) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DISubprogram,
(Scope, getString(Name), getString(LinkageName), File,
Line, Type, IsLocalToUnit, IsDefinition, ScopeLine,
ContainingType, Virtuality, VirtualIndex, Flags,
IsOptimized, TemplateParams, Declaration, Variables));
(Scope, Name, LinkageName, File, Line, Type,
IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
Virtuality, VirtualIndex, Flags, IsOptimized,
TemplateParams, Declaration, Variables));
Metadata *Ops[] = {File, Scope, Name, Name,
LinkageName, Type, ContainingType, TemplateParams,
Declaration, Variables};
@ -382,7 +375,7 @@ DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
Metadata *File, MDString *Name, unsigned Line,
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, File, getString(Name), Line));
DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, File, Name, Line));
Metadata *Ops[] = {File, Scope, Name};
DEFINE_GETIMPL_STORE(DINamespace, (Line), Ops);
}
@ -392,9 +385,8 @@ DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *Scope,
MDString *IncludePath, MDString *ISysRoot,
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIModule,
(Scope, getString(Name), getString(ConfigurationMacros),
getString(IncludePath), getString(ISysRoot)));
DEFINE_GETIMPL_LOOKUP(
DIModule, (Scope, Name, ConfigurationMacros, IncludePath, ISysRoot));
Metadata *Ops[] = {Scope, Name, ConfigurationMacros, IncludePath, ISysRoot};
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIModule, Ops);
}
@ -405,7 +397,7 @@ DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (getString(Name), Type));
DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (Name, Type));
Metadata *Ops[] = {Name, Type};
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DITemplateTypeParameter, Ops);
}
@ -414,8 +406,7 @@ DITemplateValueParameter *DITemplateValueParameter::getImpl(
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
Metadata *Value, StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter,
(Tag, getString(Name), Type, Value));
DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter, (Tag, Name, Type, Value));
Metadata *Ops[] = {Name, Type, Value};
DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag), Ops);
}
@ -430,8 +421,8 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
assert(isCanonical(Name) && "Expected canonical MDString");
assert(isCanonical(LinkageName) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIGlobalVariable,
(Scope, getString(Name), getString(LinkageName), File,
Line, Type, IsLocalToUnit, IsDefinition, Variable,
(Scope, Name, LinkageName, File, Line, Type,
IsLocalToUnit, IsDefinition, Variable,
StaticDataMemberDeclaration));
Metadata *Ops[] = {Scope, Name, File, Type,
Name, LinkageName, Variable, StaticDataMemberDeclaration};
@ -451,7 +442,7 @@ DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
assert(Scope && "Expected scope");
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DILocalVariable,
(Scope, getString(Name), File, Line, Type, Arg, Flags));
(Scope, Name, File, Line, Type, Arg, Flags));
Metadata *Ops[] = {Scope, Name, File, Type};
DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags), Ops);
}
@ -522,9 +513,8 @@ DIObjCProperty *DIObjCProperty::getImpl(
assert(isCanonical(Name) && "Expected canonical MDString");
assert(isCanonical(GetterName) && "Expected canonical MDString");
assert(isCanonical(SetterName) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIObjCProperty,
(getString(Name), File, Line, getString(GetterName),
getString(SetterName), Attributes, Type));
DEFINE_GETIMPL_LOOKUP(DIObjCProperty, (Name, File, Line, GetterName,
SetterName, Attributes, Type));
Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
}
@ -535,8 +525,7 @@ DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
StorageType Storage,
bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIImportedEntity,
(Tag, Scope, Entity, Line, getString(Name)));
DEFINE_GETIMPL_LOOKUP(DIImportedEntity, (Tag, Scope, Entity, Line, Name));
Metadata *Ops[] = {Scope, Entity, Name};
DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
}
@ -545,8 +534,7 @@ DIMacro *DIMacro::getImpl(LLVMContext &Context, unsigned MIType,
unsigned Line, MDString *Name, MDString *Value,
StorageType Storage, bool ShouldCreate) {
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DIMacro,
(MIType, Line, getString(Name), getString(Value)));
DEFINE_GETIMPL_LOOKUP(DIMacro, (MIType, Line, Name, Value));
Metadata *Ops[] = { Name, Value };
DEFINE_GETIMPL_STORE(DIMacro, (MIType, Line), Ops);
}

View File

@ -255,14 +255,14 @@ template <> struct MDNodeKeyImpl<DILocation> {
/// \brief DenseMapInfo for GenericDINode.
template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey {
unsigned Tag;
StringRef Header;
MDNodeKeyImpl(unsigned Tag, StringRef Header, ArrayRef<Metadata *> DwarfOps)
MDString *Header;
MDNodeKeyImpl(unsigned Tag, MDString *Header, ArrayRef<Metadata *> DwarfOps)
: MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
MDNodeKeyImpl(const GenericDINode *N)
: MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getHeader()) {}
: MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getRawHeader()) {}
bool isKeyOf(const GenericDINode *RHS) const {
return Tag == RHS->getTag() && Header == RHS->getHeader() &&
return Tag == RHS->getTag() && Header == RHS->getRawHeader() &&
compareOps(RHS, 1);
}
@ -290,35 +290,35 @@ template <> struct MDNodeKeyImpl<DISubrange> {
template <> struct MDNodeKeyImpl<DIEnumerator> {
int64_t Value;
StringRef Name;
MDString *Name;
MDNodeKeyImpl(int64_t Value, StringRef Name) : Value(Value), Name(Name) {}
MDNodeKeyImpl(int64_t Value, MDString *Name) : Value(Value), Name(Name) {}
MDNodeKeyImpl(const DIEnumerator *N)
: Value(N->getValue()), Name(N->getName()) {}
: Value(N->getValue()), Name(N->getRawName()) {}
bool isKeyOf(const DIEnumerator *RHS) const {
return Value == RHS->getValue() && Name == RHS->getName();
return Value == RHS->getValue() && Name == RHS->getRawName();
}
unsigned getHashValue() const { return hash_combine(Value, Name); }
};
template <> struct MDNodeKeyImpl<DIBasicType> {
unsigned Tag;
StringRef Name;
MDString *Name;
uint64_t SizeInBits;
uint64_t AlignInBits;
unsigned Encoding;
MDNodeKeyImpl(unsigned Tag, StringRef Name, uint64_t SizeInBits,
MDNodeKeyImpl(unsigned Tag, MDString *Name, uint64_t SizeInBits,
uint64_t AlignInBits, unsigned Encoding)
: Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
Encoding(Encoding) {}
MDNodeKeyImpl(const DIBasicType *N)
: Tag(N->getTag()), Name(N->getName()), SizeInBits(N->getSizeInBits()),
: Tag(N->getTag()), Name(N->getRawName()), SizeInBits(N->getSizeInBits()),
AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()) {}
bool isKeyOf(const DIBasicType *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
return Tag == RHS->getTag() && Name == RHS->getRawName() &&
SizeInBits == RHS->getSizeInBits() &&
AlignInBits == RHS->getAlignInBits() &&
Encoding == RHS->getEncoding();
@ -330,7 +330,7 @@ template <> struct MDNodeKeyImpl<DIBasicType> {
template <> struct MDNodeKeyImpl<DIDerivedType> {
unsigned Tag;
StringRef Name;
MDString *Name;
Metadata *File;
unsigned Line;
Metadata *Scope;
@ -341,7 +341,7 @@ template <> struct MDNodeKeyImpl<DIDerivedType> {
unsigned Flags;
Metadata *ExtraData;
MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *File, unsigned Line,
MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Metadata *ExtraData)
@ -349,14 +349,14 @@ template <> struct MDNodeKeyImpl<DIDerivedType> {
BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
OffsetInBits(OffsetInBits), Flags(Flags), ExtraData(ExtraData) {}
MDNodeKeyImpl(const DIDerivedType *N)
: Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
: Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
Line(N->getLine()), Scope(N->getRawScope()),
BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
AlignInBits(N->getAlignInBits()), OffsetInBits(N->getOffsetInBits()),
Flags(N->getFlags()), ExtraData(N->getRawExtraData()) {}
bool isKeyOf(const DIDerivedType *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
return Tag == RHS->getTag() && Name == RHS->getRawName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
SizeInBits == RHS->getSizeInBits() &&
@ -371,7 +371,7 @@ template <> struct MDNodeKeyImpl<DIDerivedType> {
template <> struct MDNodeKeyImpl<DICompositeType> {
unsigned Tag;
StringRef Name;
MDString *Name;
Metadata *File;
unsigned Line;
Metadata *Scope;
@ -384,31 +384,31 @@ template <> struct MDNodeKeyImpl<DICompositeType> {
unsigned RuntimeLang;
Metadata *VTableHolder;
Metadata *TemplateParams;
StringRef Identifier;
MDString *Identifier;
MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *File, unsigned Line,
MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Metadata *Elements, unsigned RuntimeLang,
Metadata *VTableHolder, Metadata *TemplateParams,
StringRef Identifier)
MDString *Identifier)
: Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
OffsetInBits(OffsetInBits), Flags(Flags), Elements(Elements),
RuntimeLang(RuntimeLang), VTableHolder(VTableHolder),
TemplateParams(TemplateParams), Identifier(Identifier) {}
MDNodeKeyImpl(const DICompositeType *N)
: Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
: Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
Line(N->getLine()), Scope(N->getRawScope()),
BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
AlignInBits(N->getAlignInBits()), OffsetInBits(N->getOffsetInBits()),
Flags(N->getFlags()), Elements(N->getRawElements()),
RuntimeLang(N->getRuntimeLang()), VTableHolder(N->getRawVTableHolder()),
TemplateParams(N->getRawTemplateParams()),
Identifier(N->getIdentifier()) {}
Identifier(N->getRawIdentifier()) {}
bool isKeyOf(const DICompositeType *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
return Tag == RHS->getTag() && Name == RHS->getRawName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
SizeInBits == RHS->getSizeInBits() &&
@ -418,7 +418,7 @@ template <> struct MDNodeKeyImpl<DICompositeType> {
RuntimeLang == RHS->getRuntimeLang() &&
VTableHolder == RHS->getRawVTableHolder() &&
TemplateParams == RHS->getRawTemplateParams() &&
Identifier == RHS->getIdentifier();
Identifier == RHS->getRawIdentifier();
}
unsigned getHashValue() const {
return hash_combine(Name, File, Line, BaseType, Scope, Elements,
@ -442,24 +442,25 @@ template <> struct MDNodeKeyImpl<DISubroutineType> {
};
template <> struct MDNodeKeyImpl<DIFile> {
StringRef Filename;
StringRef Directory;
MDString *Filename;
MDString *Directory;
MDNodeKeyImpl(StringRef Filename, StringRef Directory)
MDNodeKeyImpl(MDString *Filename, MDString *Directory)
: Filename(Filename), Directory(Directory) {}
MDNodeKeyImpl(const DIFile *N)
: Filename(N->getFilename()), Directory(N->getDirectory()) {}
: Filename(N->getRawFilename()), Directory(N->getRawDirectory()) {}
bool isKeyOf(const DIFile *RHS) const {
return Filename == RHS->getFilename() && Directory == RHS->getDirectory();
return Filename == RHS->getRawFilename() &&
Directory == RHS->getRawDirectory();
}
unsigned getHashValue() const { return hash_combine(Filename, Directory); }
};
template <> struct MDNodeKeyImpl<DISubprogram> {
Metadata *Scope;
StringRef Name;
StringRef LinkageName;
MDString *Name;
MDString *LinkageName;
Metadata *File;
unsigned Line;
Metadata *Type;
@ -475,7 +476,7 @@ template <> struct MDNodeKeyImpl<DISubprogram> {
Metadata *Declaration;
Metadata *Variables;
MDNodeKeyImpl(Metadata *Scope, StringRef Name, StringRef LinkageName,
MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
Metadata *File, unsigned Line, Metadata *Type,
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
Metadata *ContainingType, unsigned Virtuality,
@ -490,8 +491,8 @@ template <> struct MDNodeKeyImpl<DISubprogram> {
TemplateParams(TemplateParams), Declaration(Declaration),
Variables(Variables) {}
MDNodeKeyImpl(const DISubprogram *N)
: Scope(N->getRawScope()), Name(N->getName()),
LinkageName(N->getLinkageName()), File(N->getRawFile()),
: Scope(N->getRawScope()), Name(N->getRawName()),
LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
Line(N->getLine()), Type(N->getRawType()),
IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
ScopeLine(N->getScopeLine()), ContainingType(N->getRawContainingType()),
@ -501,10 +502,10 @@ template <> struct MDNodeKeyImpl<DISubprogram> {
Declaration(N->getRawDeclaration()), Variables(N->getRawVariables()) {}
bool isKeyOf(const DISubprogram *RHS) const {
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && Type == RHS->getRawType() &&
IsLocalToUnit == RHS->isLocalToUnit() &&
return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
LinkageName == RHS->getRawLinkageName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
IsDefinition == RHS->isDefinition() &&
ScopeLine == RHS->getScopeLine() &&
ContainingType == RHS->getRawContainingType() &&
@ -564,18 +565,18 @@ template <> struct MDNodeKeyImpl<DILexicalBlockFile> {
template <> struct MDNodeKeyImpl<DINamespace> {
Metadata *Scope;
Metadata *File;
StringRef Name;
MDString *Name;
unsigned Line;
MDNodeKeyImpl(Metadata *Scope, Metadata *File, StringRef Name, unsigned Line)
MDNodeKeyImpl(Metadata *Scope, Metadata *File, MDString *Name, unsigned Line)
: Scope(Scope), File(File), Name(Name), Line(Line) {}
MDNodeKeyImpl(const DINamespace *N)
: Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getName()),
: Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getRawName()),
Line(N->getLine()) {}
bool isKeyOf(const DINamespace *RHS) const {
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
Name == RHS->getName() && Line == RHS->getLine();
Name == RHS->getRawName() && Line == RHS->getLine();
}
unsigned getHashValue() const {
return hash_combine(Scope, File, Name, Line);
@ -584,26 +585,24 @@ template <> struct MDNodeKeyImpl<DINamespace> {
template <> struct MDNodeKeyImpl<DIModule> {
Metadata *Scope;
StringRef Name;
StringRef ConfigurationMacros;
StringRef IncludePath;
StringRef ISysRoot;
MDNodeKeyImpl(Metadata *Scope, StringRef Name,
StringRef ConfigurationMacros,
StringRef IncludePath,
StringRef ISysRoot)
: Scope(Scope), Name(Name), ConfigurationMacros(ConfigurationMacros),
IncludePath(IncludePath), ISysRoot(ISysRoot) {}
MDString *Name;
MDString *ConfigurationMacros;
MDString *IncludePath;
MDString *ISysRoot;
MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *ConfigurationMacros,
MDString *IncludePath, MDString *ISysRoot)
: Scope(Scope), Name(Name), ConfigurationMacros(ConfigurationMacros),
IncludePath(IncludePath), ISysRoot(ISysRoot) {}
MDNodeKeyImpl(const DIModule *N)
: Scope(N->getRawScope()), Name(N->getName()),
ConfigurationMacros(N->getConfigurationMacros()),
IncludePath(N->getIncludePath()), ISysRoot(N->getISysRoot()) {}
: Scope(N->getRawScope()), Name(N->getRawName()),
ConfigurationMacros(N->getRawConfigurationMacros()),
IncludePath(N->getRawIncludePath()), ISysRoot(N->getRawISysRoot()) {}
bool isKeyOf(const DIModule *RHS) const {
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
ConfigurationMacros == RHS->getConfigurationMacros() &&
IncludePath == RHS->getIncludePath() &&
ISysRoot == RHS->getISysRoot();
return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
ConfigurationMacros == RHS->getRawConfigurationMacros() &&
IncludePath == RHS->getRawIncludePath() &&
ISysRoot == RHS->getRawISysRoot();
}
unsigned getHashValue() const {
return hash_combine(Scope, Name,
@ -612,33 +611,33 @@ template <> struct MDNodeKeyImpl<DIModule> {
};
template <> struct MDNodeKeyImpl<DITemplateTypeParameter> {
StringRef Name;
MDString *Name;
Metadata *Type;
MDNodeKeyImpl(StringRef Name, Metadata *Type) : Name(Name), Type(Type) {}
MDNodeKeyImpl(MDString *Name, Metadata *Type) : Name(Name), Type(Type) {}
MDNodeKeyImpl(const DITemplateTypeParameter *N)
: Name(N->getName()), Type(N->getRawType()) {}
: Name(N->getRawName()), Type(N->getRawType()) {}
bool isKeyOf(const DITemplateTypeParameter *RHS) const {
return Name == RHS->getName() && Type == RHS->getRawType();
return Name == RHS->getRawName() && Type == RHS->getRawType();
}
unsigned getHashValue() const { return hash_combine(Name, Type); }
};
template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
unsigned Tag;
StringRef Name;
MDString *Name;
Metadata *Type;
Metadata *Value;
MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *Type, Metadata *Value)
MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *Type, Metadata *Value)
: Tag(Tag), Name(Name), Type(Type), Value(Value) {}
MDNodeKeyImpl(const DITemplateValueParameter *N)
: Tag(N->getTag()), Name(N->getName()), Type(N->getRawType()),
: Tag(N->getTag()), Name(N->getRawName()), Type(N->getRawType()),
Value(N->getValue()) {}
bool isKeyOf(const DITemplateValueParameter *RHS) const {
return Tag == RHS->getTag() && Name == RHS->getName() &&
return Tag == RHS->getTag() && Name == RHS->getRawName() &&
Type == RHS->getRawType() && Value == RHS->getValue();
}
unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
@ -646,8 +645,8 @@ template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
template <> struct MDNodeKeyImpl<DIGlobalVariable> {
Metadata *Scope;
StringRef Name;
StringRef LinkageName;
MDString *Name;
MDString *LinkageName;
Metadata *File;
unsigned Line;
Metadata *Type;
@ -656,7 +655,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
Metadata *Variable;
Metadata *StaticDataMemberDeclaration;
MDNodeKeyImpl(Metadata *Scope, StringRef Name, StringRef LinkageName,
MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
Metadata *File, unsigned Line, Metadata *Type,
bool IsLocalToUnit, bool IsDefinition, Metadata *Variable,
Metadata *StaticDataMemberDeclaration)
@ -665,18 +664,18 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
IsDefinition(IsDefinition), Variable(Variable),
StaticDataMemberDeclaration(StaticDataMemberDeclaration) {}
MDNodeKeyImpl(const DIGlobalVariable *N)
: Scope(N->getRawScope()), Name(N->getName()),
LinkageName(N->getLinkageName()), File(N->getRawFile()),
: Scope(N->getRawScope()), Name(N->getRawName()),
LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
Line(N->getLine()), Type(N->getRawType()),
IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
Variable(N->getRawVariable()),
StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()) {}
bool isKeyOf(const DIGlobalVariable *RHS) const {
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && Type == RHS->getRawType() &&
IsLocalToUnit == RHS->isLocalToUnit() &&
return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
LinkageName == RHS->getRawLinkageName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
IsDefinition == RHS->isDefinition() &&
Variable == RHS->getRawVariable() &&
StaticDataMemberDeclaration ==
@ -691,24 +690,24 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
template <> struct MDNodeKeyImpl<DILocalVariable> {
Metadata *Scope;
StringRef Name;
MDString *Name;
Metadata *File;
unsigned Line;
Metadata *Type;
unsigned Arg;
unsigned Flags;
MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *File, unsigned Line,
MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line,
Metadata *Type, unsigned Arg, unsigned Flags)
: Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg),
Flags(Flags) {}
MDNodeKeyImpl(const DILocalVariable *N)
: Scope(N->getRawScope()), Name(N->getName()), File(N->getRawFile()),
: Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()),
Flags(N->getFlags()) {}
bool isKeyOf(const DILocalVariable *RHS) const {
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Type == RHS->getRawType() && Arg == RHS->getArg() &&
Flags == RHS->getFlags();
@ -733,28 +732,28 @@ template <> struct MDNodeKeyImpl<DIExpression> {
};
template <> struct MDNodeKeyImpl<DIObjCProperty> {
StringRef Name;
MDString *Name;
Metadata *File;
unsigned Line;
StringRef GetterName;
StringRef SetterName;
MDString *GetterName;
MDString *SetterName;
unsigned Attributes;
Metadata *Type;
MDNodeKeyImpl(StringRef Name, Metadata *File, unsigned Line,
StringRef GetterName, StringRef SetterName, unsigned Attributes,
MDNodeKeyImpl(MDString *Name, Metadata *File, unsigned Line,
MDString *GetterName, MDString *SetterName, unsigned Attributes,
Metadata *Type)
: Name(Name), File(File), Line(Line), GetterName(GetterName),
SetterName(SetterName), Attributes(Attributes), Type(Type) {}
MDNodeKeyImpl(const DIObjCProperty *N)
: Name(N->getName()), File(N->getRawFile()), Line(N->getLine()),
GetterName(N->getGetterName()), SetterName(N->getSetterName()),
: Name(N->getRawName()), File(N->getRawFile()), Line(N->getLine()),
GetterName(N->getRawGetterName()), SetterName(N->getRawSetterName()),
Attributes(N->getAttributes()), Type(N->getRawType()) {}
bool isKeyOf(const DIObjCProperty *RHS) const {
return Name == RHS->getName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && GetterName == RHS->getGetterName() &&
SetterName == RHS->getSetterName() &&
return Name == RHS->getRawName() && File == RHS->getRawFile() &&
Line == RHS->getLine() && GetterName == RHS->getRawGetterName() &&
SetterName == RHS->getRawSetterName() &&
Attributes == RHS->getAttributes() && Type == RHS->getRawType();
}
unsigned getHashValue() const {
@ -768,19 +767,19 @@ template <> struct MDNodeKeyImpl<DIImportedEntity> {
Metadata *Scope;
Metadata *Entity;
unsigned Line;
StringRef Name;
MDString *Name;
MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line,
StringRef Name)
MDString *Name)
: Tag(Tag), Scope(Scope), Entity(Entity), Line(Line), Name(Name) {}
MDNodeKeyImpl(const DIImportedEntity *N)
: Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
Line(N->getLine()), Name(N->getName()) {}
Line(N->getLine()), Name(N->getRawName()) {}
bool isKeyOf(const DIImportedEntity *RHS) const {
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
Entity == RHS->getRawEntity() && Line == RHS->getLine() &&
Name == RHS->getName();
Name == RHS->getRawName();
}
unsigned getHashValue() const {
return hash_combine(Tag, Scope, Entity, Line, Name);
@ -790,18 +789,18 @@ template <> struct MDNodeKeyImpl<DIImportedEntity> {
template <> struct MDNodeKeyImpl<DIMacro> {
unsigned MIType;
unsigned Line;
StringRef Name;
StringRef Value;
MDString *Name;
MDString *Value;
MDNodeKeyImpl(unsigned MIType, unsigned Line, StringRef Name, StringRef Value)
MDNodeKeyImpl(unsigned MIType, unsigned Line, MDString *Name, MDString *Value)
: MIType(MIType), Line(Line), Name(Name), Value(Value) {}
MDNodeKeyImpl(const DIMacro *N)
: MIType(N->getMacinfoType()), Line(N->getLine()), Name(N->getName()),
Value(N->getValue()) {}
: MIType(N->getMacinfoType()), Line(N->getLine()), Name(N->getRawName()),
Value(N->getRawValue()) {}
bool isKeyOf(const DIMacro *RHS) const {
return MIType == RHS->getMacinfoType() && Line == RHS->getLine() &&
Name == RHS->getName() && Value == RHS->getValue();
Name == RHS->getRawName() && Value == RHS->getRawValue();
}
unsigned getHashValue() const {
return hash_combine(MIType, Line, Name, Value);