1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Don't create a new ParamAttrsList (which copies the vector) just to

get a profile.

llvm-svn: 45524
This commit is contained in:
Chris Lattner 2008-01-03 00:29:27 +00:00
parent cc3a49623f
commit e54252e6e1
2 changed files with 10 additions and 7 deletions

View File

@ -266,7 +266,10 @@ class ParamAttrsList : public FoldingSetNode {
/// @name Implementation Details
/// @{
public:
void Profile(FoldingSetNodeID &ID) const;
void Profile(FoldingSetNodeID &ID) const {
Profile(ID, attrs);
}
static void Profile(FoldingSetNodeID &ID, const ParamAttrsVector &Attrs);
void dump() const;
/// @}

View File

@ -106,9 +106,10 @@ ParamAttrsList::areCompatible(const ParamAttrsList *A, const ParamAttrsList *B){
return true;
}
void ParamAttrsList::Profile(FoldingSetNodeID &ID) const {
for (unsigned i = 0; i < attrs.size(); ++i)
ID.AddInteger(unsigned(attrs[i].attrs) << 16 | unsigned(attrs[i].index));
void ParamAttrsList::Profile(FoldingSetNodeID &ID,
const ParamAttrsVector &Attrs) {
for (unsigned i = 0; i < Attrs.size(); ++i)
ID.AddInteger(unsigned(Attrs[i].attrs) << 16 | unsigned(Attrs[i].index));
}
const ParamAttrsList *
@ -127,11 +128,10 @@ ParamAttrsList::get(const ParamAttrsVector &attrVec) {
#endif
// Otherwise, build a key to look up the existing attributes.
ParamAttrsList key(attrVec);
FoldingSetNodeID ID;
key.Profile(ID);
ParamAttrsList::Profile(ID, attrVec);
void *InsertPos;
ParamAttrsList* PAL = ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos);
ParamAttrsList *PAL = ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos);
// If we didn't find any existing attributes of the same shape then
// create a new one and insert it.