summaryrefslogtreecommitdiffstats
path: root/lib/Target/SubtargetFeature.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-23 05:33:39 +0000
committerChris Lattner <sabre@nondot.org>2005-10-23 05:33:39 +0000
commitba76c21858bac5fd953d4dbe2f0624d8e884c7b5 (patch)
treee67c219f554ce98406317ba9983dfada1f27c8fd /lib/Target/SubtargetFeature.cpp
parent2e1f823aed93249afba72e46ce8a2997bd2b97cf (diff)
downloadexternal_llvm-ba76c21858bac5fd953d4dbe2f0624d8e884c7b5.zip
external_llvm-ba76c21858bac5fd953d4dbe2f0624d8e884c7b5.tar.gz
external_llvm-ba76c21858bac5fd953d4dbe2f0624d8e884c7b5.tar.bz2
Improve help output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23893 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SubtargetFeature.cpp')
-rw-r--r--lib/Target/SubtargetFeature.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/Target/SubtargetFeature.cpp b/lib/Target/SubtargetFeature.cpp
index a9ed84f..54a89bd 100644
--- a/lib/Target/SubtargetFeature.cpp
+++ b/lib/Target/SubtargetFeature.cpp
@@ -125,25 +125,29 @@ static const SubtargetFeatureKV *Find(const std::string &S,
/// Display help for feature choices.
///
-static void Help(const char *Heading, const SubtargetFeatureKV *Table,
+static void Help(bool isFeature, const SubtargetFeatureKV *Table,
size_t TableSize) {
- // Determine the length of the longest key
+ // Determine the length of the longest key.
size_t MaxLen = 0;
for (size_t i = 0; i < TableSize; i++)
MaxLen = std::max(MaxLen, std::strlen(Table[i].Key));
- // Print heading
- std::cerr << "Help for " << Heading << " choices:\n\n";
- // For each feature
+
+ std::cerr << "Available " << (isFeature ? "features" : "CPUs")
+ << " for this target:\n\n";
+
for (size_t i = 0; i < TableSize; i++) {
// Compute required padding
size_t Pad = MaxLen - std::strlen(Table[i].Key);
- // Print details
std::cerr << Table[i].Key << std::string(Pad, ' ') << " - "
- << Table[i].Desc << "\n";
+ << Table[i].Desc << ".\n";
+ }
+
+ std::cerr << "\n";
+ if (isFeature) {
+ std::cerr
+ << "Use +feature to enable a feature, or -feature to disable it.\n"
+ << "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
}
- // Wrap it up
- std::cerr << "\n\n";
- // Leave tool
exit(1);
}
@@ -202,7 +206,7 @@ uint32_t SubtargetFeatures::Parse(const std::string &String,
// Check if default is needed
if (Features[0].empty()) Features[0] = DefaultCPU;
// Check for help
- if (Features[0] == "help") Help("CPU", CPUTable, CPUTableSize);
+ if (Features[0] == "help") Help(false, CPUTable, CPUTableSize);
// Find CPU entry
const SubtargetFeatureKV *CPUEntry =
Find(Features[0], CPUTable, CPUTableSize);
@@ -221,7 +225,7 @@ uint32_t SubtargetFeatures::Parse(const std::string &String,
// Get next feature
const std::string &Feature = Features[i];
// Check for help
- if (Feature == "+help") Help("feature", FeatureTable, FeatureTableSize);
+ if (Feature == "+help") Help(true, FeatureTable, FeatureTableSize);
// Find feature in table.
const SubtargetFeatureKV *FeatureEntry =
Find(StripFlag(Feature), FeatureTable, FeatureTableSize);