summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2016-01-03 08:57:41 +0000
committerCraig Topper <craig.topper@gmail.com>2016-01-03 08:57:41 +0000
commit4ceea0a5055977d43b8277b4767ecaefb90a8e6c (patch)
treee70c66c3ff634dedc065846a3d027a449f94a594 /llvm
parent90b18c40142f87d193766d459350ab0b99fc753b (diff)
downloadbcm5719-llvm-4ceea0a5055977d43b8277b4767ecaefb90a8e6c.tar.gz
bcm5719-llvm-4ceea0a5055977d43b8277b4767ecaefb90a8e6c.zip
[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
llvm-svn: 256703
Diffstat (limited to 'llvm')
-rw-r--r--llvm/utils/TableGen/SubtargetEmitter.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp
index 6246d811123..d056de003e1 100644
--- a/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -185,16 +185,12 @@ unsigned SubtargetEmitter::FeatureKeyValues(raw_ostream &OS) {
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(raw_ostream &OS) {
<< "\"" << 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 << ", { } }";
OpenPOWER on IntegriCloud