|
13 | 13 |
|
14 | 14 | #include "llvm/MC/SubtargetFeature.h"
|
15 | 15 | #include "llvm/Support/Debug.h"
|
| 16 | +#include "llvm/Support/Format.h" |
16 | 17 | #include "llvm/Support/raw_ostream.h"
|
17 | 18 | #include "llvm/ADT/StringExtras.h"
|
18 | 19 | #include <algorithm>
|
@@ -154,21 +155,19 @@ static void Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
|
154 | 155 | // Print the CPU table.
|
155 | 156 | errs() << "Available CPUs for this target:\n\n";
|
156 | 157 | for (size_t i = 0; i != CPUTableSize; i++)
|
157 |
| - errs() << " " << CPUTable[i].Key |
158 |
| - << std::string(MaxCPULen - std::strlen(CPUTable[i].Key), ' ') |
159 |
| - << " - " << CPUTable[i].Desc << ".\n"; |
160 |
| - errs() << "\n"; |
161 |
| - |
| 158 | + errs() << format(" %-*s - %s.\n", |
| 159 | + MaxCPULen, CPUTable[i].Key, CPUTable[i].Desc); |
| 160 | + errs() << '\n'; |
| 161 | + |
162 | 162 | // Print the Feature table.
|
163 | 163 | errs() << "Available features for this target:\n\n";
|
164 | 164 | for (size_t i = 0; i != FeatTableSize; i++)
|
165 |
| - errs() << " " << FeatTable[i].Key |
166 |
| - << std::string(MaxFeatLen - std::strlen(FeatTable[i].Key), ' ') |
167 |
| - << " - " << FeatTable[i].Desc << ".\n"; |
168 |
| - errs() << "\n"; |
169 |
| - |
| 165 | + errs() << format(" %-*s - %s.\n", |
| 166 | + MaxFeatLen, FeatTable[i].Key, FeatTable[i].Desc); |
| 167 | + errs() << '\n'; |
| 168 | + |
170 | 169 | errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
|
171 |
| - << "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n"; |
| 170 | + "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n"; |
172 | 171 | std::exit(1);
|
173 | 172 | }
|
174 | 173 |
|
|
0 commit comments