[TableGen] Use ListSeparator (NFC)

This commit is contained in:
Kazu Hirata 2021-02-07 09:49:34 -08:00
parent 7b9f6c2d42
commit 92a6055835
1 changed files with 31 additions and 77 deletions

View File

@ -741,127 +741,81 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
intrinsic.isWillReturn || intrinsic.isCold || intrinsic.isNoDuplicate || intrinsic.isWillReturn || intrinsic.isCold || intrinsic.isNoDuplicate ||
intrinsic.isConvergent || intrinsic.isSpeculatable) { intrinsic.isConvergent || intrinsic.isSpeculatable) {
OS << " const Attribute::AttrKind Atts[] = {"; OS << " const Attribute::AttrKind Atts[] = {";
bool addComma = false; ListSeparator LS(",");
if (!intrinsic.canThrow) { if (!intrinsic.canThrow)
OS << "Attribute::NoUnwind"; OS << LS << "Attribute::NoUnwind";
addComma = true; if (intrinsic.isNoReturn)
} OS << LS << "Attribute::NoReturn";
if (intrinsic.isNoReturn) { if (intrinsic.isNoSync)
if (addComma) OS << LS << "Attribute::NoSync";
OS << ","; if (intrinsic.isNoFree)
OS << "Attribute::NoReturn"; OS << LS << "Attribute::NoFree";
addComma = true; if (intrinsic.isWillReturn)
} OS << LS << "Attribute::WillReturn";
if (intrinsic.isNoSync) { if (intrinsic.isCold)
if (addComma) OS << LS << "Attribute::Cold";
OS << ","; if (intrinsic.isNoDuplicate)
OS << "Attribute::NoSync"; OS << LS << "Attribute::NoDuplicate";
addComma = true; if (intrinsic.isConvergent)
} OS << LS << "Attribute::Convergent";
if (intrinsic.isNoFree) { if (intrinsic.isSpeculatable)
if (addComma) OS << LS << "Attribute::Speculatable";
OS << ",";
OS << "Attribute::NoFree";
addComma = true;
}
if (intrinsic.isWillReturn) {
if (addComma)
OS << ",";
OS << "Attribute::WillReturn";
addComma = true;
}
if (intrinsic.isCold) {
if (addComma)
OS << ",";
OS << "Attribute::Cold";
addComma = true;
}
if (intrinsic.isNoDuplicate) {
if (addComma)
OS << ",";
OS << "Attribute::NoDuplicate";
addComma = true;
}
if (intrinsic.isConvergent) {
if (addComma)
OS << ",";
OS << "Attribute::Convergent";
addComma = true;
}
if (intrinsic.isSpeculatable) {
if (addComma)
OS << ",";
OS << "Attribute::Speculatable";
addComma = true;
}
switch (intrinsic.ModRef) { switch (intrinsic.ModRef) {
case CodeGenIntrinsic::NoMem: case CodeGenIntrinsic::NoMem:
if (intrinsic.hasSideEffects) if (intrinsic.hasSideEffects)
break; break;
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::ReadNone"; OS << "Attribute::ReadNone";
break; break;
case CodeGenIntrinsic::ReadArgMem: case CodeGenIntrinsic::ReadArgMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::ReadOnly,"; OS << "Attribute::ReadOnly,";
OS << "Attribute::ArgMemOnly"; OS << "Attribute::ArgMemOnly";
break; break;
case CodeGenIntrinsic::ReadMem: case CodeGenIntrinsic::ReadMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::ReadOnly"; OS << "Attribute::ReadOnly";
break; break;
case CodeGenIntrinsic::ReadInaccessibleMem: case CodeGenIntrinsic::ReadInaccessibleMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::ReadOnly,"; OS << "Attribute::ReadOnly,";
OS << "Attribute::InaccessibleMemOnly"; OS << "Attribute::InaccessibleMemOnly";
break; break;
case CodeGenIntrinsic::ReadInaccessibleMemOrArgMem: case CodeGenIntrinsic::ReadInaccessibleMemOrArgMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::ReadOnly,"; OS << "Attribute::ReadOnly,";
OS << "Attribute::InaccessibleMemOrArgMemOnly"; OS << "Attribute::InaccessibleMemOrArgMemOnly";
break; break;
case CodeGenIntrinsic::WriteArgMem: case CodeGenIntrinsic::WriteArgMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::WriteOnly,"; OS << "Attribute::WriteOnly,";
OS << "Attribute::ArgMemOnly"; OS << "Attribute::ArgMemOnly";
break; break;
case CodeGenIntrinsic::WriteMem: case CodeGenIntrinsic::WriteMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::WriteOnly"; OS << "Attribute::WriteOnly";
break; break;
case CodeGenIntrinsic::WriteInaccessibleMem: case CodeGenIntrinsic::WriteInaccessibleMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::WriteOnly,"; OS << "Attribute::WriteOnly,";
OS << "Attribute::InaccessibleMemOnly"; OS << "Attribute::InaccessibleMemOnly";
break; break;
case CodeGenIntrinsic::WriteInaccessibleMemOrArgMem: case CodeGenIntrinsic::WriteInaccessibleMemOrArgMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::WriteOnly,"; OS << "Attribute::WriteOnly,";
OS << "Attribute::InaccessibleMemOrArgMemOnly"; OS << "Attribute::InaccessibleMemOrArgMemOnly";
break; break;
case CodeGenIntrinsic::ReadWriteArgMem: case CodeGenIntrinsic::ReadWriteArgMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::ArgMemOnly"; OS << "Attribute::ArgMemOnly";
break; break;
case CodeGenIntrinsic::ReadWriteInaccessibleMem: case CodeGenIntrinsic::ReadWriteInaccessibleMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::InaccessibleMemOnly"; OS << "Attribute::InaccessibleMemOnly";
break; break;
case CodeGenIntrinsic::ReadWriteInaccessibleMemOrArgMem: case CodeGenIntrinsic::ReadWriteInaccessibleMemOrArgMem:
if (addComma) OS << LS;
OS << ",";
OS << "Attribute::InaccessibleMemOrArgMemOnly"; OS << "Attribute::InaccessibleMemOrArgMemOnly";
break; break;
case CodeGenIntrinsic::ReadWriteMem: case CodeGenIntrinsic::ReadWriteMem: