continue dancing around the obvious algorithm issues in PR3810:

This speeds up getAsIdentifierInfo from being a call to a function
with a big switch to a single testl instruction.  This speeds up
the example in PR3810 by 6.2%

llvm-svn: 67433
This commit is contained in:
Chris Lattner 2009-03-21 06:49:19 +00:00
parent 7d5608dd72
commit 316e1c19df
1 changed files with 11 additions and 1 deletions

View File

@ -163,8 +163,18 @@ public:
(reinterpret_cast<IdentifierInfo *>(Ptr & ~PtrMask));
}
/// Predicate functions for querying what type of name this is.
bool isIdentifier() const { return getStoredNameKind() == StoredIdentifier; }
bool isObjCZeroArgSelector() const {
return getStoredNameKind() == StoredObjCZeroArgSelector;
}
bool isObjCOneArgSelector() const {
return getStoredNameKind() == StoredObjCOneArgSelector;
}
/// getNameKind - Determine what kind of name this is.
NameKind getNameKind() const;
/// getName - Retrieve the human-readable string for this name.
std::string getAsString() const;
@ -173,7 +183,7 @@ public:
/// this declaration name, or NULL if this declaration name isn't a
/// simple identifier.
IdentifierInfo *getAsIdentifierInfo() const {
if (getNameKind() == Identifier)
if (isIdentifier())
return reinterpret_cast<IdentifierInfo *>(Ptr);
return 0;
}