Use the AttributeSet instead of AttributeWithIndex.

In the future, AttributeWithIndex won't be used anymore. Besides, it exposes the
internals of the AttributeSet to outside users, which isn't goodness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173606 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2013-01-27 03:25:05 +00:00
parent a1683d6c48
commit e3617247a0

View File

@@ -534,9 +534,8 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
N = ++AttrNum; N = ++AttrNum;
} }
// Emit an array of AttributeWithIndex. Most intrinsics will have // Emit an array of AttributeSet. Most intrinsics will have at least one
// at least one entry, for the function itself (index ~1), which is // entry, for the function itself (index ~1), which is usually nounwind.
// usually nounwind.
OS << " static const uint8_t IntrinsicsToAttributesMap[] = {\n"; OS << " static const uint8_t IntrinsicsToAttributesMap[] = {\n";
for (unsigned i = 0, e = Ints.size(); i != e; ++i) { for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
@@ -547,7 +546,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
} }
OS << " };\n\n"; OS << " };\n\n";
OS << " AttributeWithIndex AWI[" << maxArgAttrs+1 << "];\n"; OS << " AttributeSet AS[" << maxArgAttrs+1 << "];\n";
OS << " unsigned NumAttrs = 0;\n"; OS << " unsigned NumAttrs = 0;\n";
OS << " if (id != 0) {\n"; OS << " if (id != 0) {\n";
OS << " SmallVector<Attribute::AttrKind, 8> AttrVec;\n"; OS << " SmallVector<Attribute::AttrKind, 8> AttrVec;\n";
@@ -585,7 +584,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
++ai; ++ai;
} while (ai != ae && intrinsic.ArgumentAttributes[ai].first == argNo); } while (ai != ae && intrinsic.ArgumentAttributes[ai].first == argNo);
OS << " AWI[" << numAttrs++ << "] = AttributeWithIndex::get(C, " OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, "
<< argNo+1 << ", AttrVec);\n"; << argNo+1 << ", AttrVec);\n";
} }
} }
@@ -609,7 +608,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
OS << " AttrVec.push_back(Attribute::ReadNone);\n"; OS << " AttrVec.push_back(Attribute::ReadNone);\n";
break; break;
} }
OS << " AWI[" << numAttrs++ << "] = AttributeWithIndex::get(C, " OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, "
<< "AttributeSet::FunctionIndex, AttrVec);\n"; << "AttributeSet::FunctionIndex, AttrVec);\n";
} }
@@ -623,7 +622,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
OS << " }\n"; OS << " }\n";
OS << " }\n"; OS << " }\n";
OS << " return AttributeSet::get(C, ArrayRef<AttributeWithIndex>(AWI, " OS << " return AttributeSet::get(C, ArrayRef<AttributeSet>(AS, "
"NumAttrs));\n"; "NumAttrs));\n";
OS << "}\n"; OS << "}\n";
OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n";