[llvm] r256703 - [TableGen] Simplify some code slightly. No need to check if the arrays are empty before printing. The loop can be made to print the same thing if the loop is empty. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 3 00:57:42 PST 2016
Author: ctopper
Date: Sun Jan 3 02:57:41 2016
New Revision: 256703
URL: http://llvm.org/viewvc/llvm-project?rev=256703&view=rev
Log:
[TableGen] Simplify some code slightly. No need to check if the arrays are empty before printing. The loop can be made to print the same thing if the loop is empty. NFC
Modified:
llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=256703&r1=256702&r2=256703&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Sun Jan 3 02:57:41 2016
@@ -185,16 +185,12 @@ unsigned SubtargetEmitter::FeatureKeyVal
const std::vector<Record*> &ImpliesList =
Feature->getValueAsListOfDefs("Implies");
- if (ImpliesList.empty()) {
- OS << "{ }";
- } else {
- OS << "{ ";
- for (unsigned j = 0, M = ImpliesList.size(); j < M;) {
- OS << Target << "::" << ImpliesList[j]->getName();
- if (++j < M) OS << ", ";
- }
- OS << " }";
+ OS << "{";
+ for (unsigned j = 0, M = ImpliesList.size(); j < M;) {
+ OS << " " << Target << "::" << ImpliesList[j]->getName();
+ if (++j < M) OS << ",";
}
+ OS << " }";
OS << " }";
++NumFeatures;
@@ -240,16 +236,12 @@ unsigned SubtargetEmitter::CPUKeyValues(
<< "\"" << Name << "\", "
<< "\"Select the " << Name << " processor\", ";
- if (FeatureList.empty()) {
- OS << "{ }";
- } else {
- OS << "{ ";
- for (unsigned j = 0, M = FeatureList.size(); j < M;) {
- OS << Target << "::" << FeatureList[j]->getName();
- if (++j < M) OS << ", ";
- }
- OS << " }";
+ OS << "{";
+ for (unsigned j = 0, M = FeatureList.size(); j < M;) {
+ OS << " " << Target << "::" << FeatureList[j]->getName();
+ if (++j < M) OS << ",";
}
+ OS << " }";
// The { } is for the "implies" section of this data structure.
OS << ", { } }";
More information about the llvm-commits
mailing list