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
/// Display help for feature choices.
///
/// 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.
const SubtargetFeatureKV *FeatTable,
size_t FeatTableSize) {
// Determine the length of the longest CPU and Feature entries.
errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
"For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
"For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
}
//===----------------------------------------------------------------------===//
}
//===----------------------------------------------------------------------===//
// Check if help is needed
if (CPU == "help")
// 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.
// Find CPU entry if CPU name is specified.
+ else if (!CPU.empty()) {
const SubtargetFeatureKV *CPUEntry = Find(CPU, CPUTable, CPUTableSize);
// If there is a match
if (CPUEntry) {
const SubtargetFeatureKV *CPUEntry = Find(CPU, CPUTable, CPUTableSize);
// If there is a match
if (CPUEntry) {
// Check for help
if (Feature == "+help")
// Check for help
if (Feature == "+help")
- return Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
+ Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
// Find feature in table.
const SubtargetFeatureKV *FeatureEntry =
// Find feature in table.
const SubtargetFeatureKV *FeatureEntry =
TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
Options, RelocModel, CMModel, OLvl));
assert(target.get() && "Could not allocate target machine!");
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)
TargetMachine &Target = *target.get();
if (EnableDwarfDirectory)