diff options
author | Eric Christopher <echristo@gmail.com> | 2014-05-06 16:29:50 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2014-05-06 16:29:50 +0000 |
commit | bfc3f301b6a5390b990c4abb05d134ffe8bb59bb (patch) | |
tree | b46d4349e51703bc2bbb7cbe6565be1c21af9dfb | |
parent | 534ec26d07646092bc869e76e61e95dca3915e1b (diff) | |
download | llvm-bfc3f301b6a5390b990c4abb05d134ffe8bb59bb.tar.gz llvm-bfc3f301b6a5390b990c4abb05d134ffe8bb59bb.tar.bz2 llvm-bfc3f301b6a5390b990c4abb05d134ffe8bb59bb.tar.xz |
Have the SubtargetFeature help routine just not return a number and
fall back to the normal path without a cpu. While doing this fix
llc to just exit when we don't have a module to process instead of
asserting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208102 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/MC/SubtargetFeature.cpp | 10 | ||||
-rw-r--r-- | tools/llc/llc.cpp | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/MC/SubtargetFeature.cpp b/lib/MC/SubtargetFeature.cpp index dd69b0fe8c..8383a181a9 100644 --- a/lib/MC/SubtargetFeature.cpp +++ b/lib/MC/SubtargetFeature.cpp @@ -129,7 +129,7 @@ static size_t getLongestEntryLength(const SubtargetFeatureKV *Table, /// Display help for feature choices. /// -static uint64_t Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize, +static void Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize, const SubtargetFeatureKV *FeatTable, size_t FeatTableSize) { // Determine the length of the longest CPU and Feature entries. @@ -152,8 +152,6 @@ static uint64_t Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize, errs() << "Use +feature to enable a feature, or -feature to disable it.\n" "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n"; - - return 0; } //===----------------------------------------------------------------------===// @@ -264,10 +262,10 @@ uint64_t SubtargetFeatures::getFeatureBits(const StringRef CPU, // Check if help is needed if (CPU == "help") - return Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize); + Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize); // Find CPU entry if CPU name is specified. - if (!CPU.empty()) { + else if (!CPU.empty()) { const SubtargetFeatureKV *CPUEntry = Find(CPU, CPUTable, CPUTableSize); // If there is a match if (CPUEntry) { @@ -293,7 +291,7 @@ uint64_t SubtargetFeatures::getFeatureBits(const StringRef CPU, // Check for help if (Feature == "+help") - return Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize); + Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize); // Find feature in table. const SubtargetFeatureKV *FeatureEntry = diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 654a9c3eee..712817d934 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -277,7 +277,14 @@ static int compileModule(char **argv, LLVMContext &Context) { TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr, Options, RelocModel, CMModel, OLvl)); assert(target.get() && "Could not allocate target machine!"); - assert(mod && "Should have exited after outputting help!"); + + // If we don't have a module then just exit now. We do this down + // here since the CPU/Feature help is underneath the target machine + // creation. + if (SkipModule) + return 0; + + assert(mod && "Should have exited if we didn't have a module!"); TargetMachine &Target = *target.get(); if (EnableDwarfDirectory) |