mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Reverting r199886 (Prevent repetitive warnings for unrecognized processors and features)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c0c6ed683a
commit
85ae0340ba
@ -101,12 +101,6 @@ public:
|
|||||||
|
|
||||||
/// Adds the default features for the specified target triple.
|
/// Adds the default features for the specified target triple.
|
||||||
void getDefaultSubtargetFeatures(const Triple& Triple);
|
void getDefaultSubtargetFeatures(const Triple& Triple);
|
||||||
|
|
||||||
/// Find KV in array using binary search.
|
|
||||||
/// T should be either SubtargetFeatureKV or SubtargetInfoKV
|
|
||||||
template<typename T>
|
|
||||||
static const T *Find(StringRef Key, const T *Array, size_t Length,
|
|
||||||
const char* KeyType);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace llvm
|
} // End namespace llvm
|
||||||
|
@ -96,11 +96,14 @@ MCSubtargetInfo::getSchedModelForCPU(StringRef CPU) const {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Find entry
|
// Find entry
|
||||||
const SubtargetInfoKV *Found = SubtargetFeatures::Find(CPU, ProcSchedModels,
|
const SubtargetInfoKV *Found =
|
||||||
NumProcs, "processor");
|
std::lower_bound(ProcSchedModels, ProcSchedModels+NumProcs, CPU);
|
||||||
if (!Found)
|
if (Found == ProcSchedModels+NumProcs || StringRef(Found->Key) != CPU) {
|
||||||
|
errs() << "'" << CPU
|
||||||
|
<< "' is not a recognized processor for this target"
|
||||||
|
<< " (ignoring processor)\n";
|
||||||
return &MCSchedModel::DefaultSchedModel;
|
return &MCSchedModel::DefaultSchedModel;
|
||||||
|
}
|
||||||
assert(Found->Value && "Missing processor SchedModel value");
|
assert(Found->Value && "Missing processor SchedModel value");
|
||||||
return (const MCSchedModel *)Found->Value;
|
return (const MCSchedModel *)Found->Value;
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,9 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/ADT/SmallSet.h"
|
|
||||||
#include "llvm/MC/SubtargetFeature.h"
|
#include "llvm/MC/SubtargetFeature.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/Format.h"
|
#include "llvm/Support/Format.h"
|
||||||
#include "llvm/Support/SourceMgr.h"
|
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -120,42 +118,19 @@ void SubtargetFeatures::AddFeature(const StringRef String,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This needs to be shared between the instantiations of Find<>
|
|
||||||
typedef std::pair<std::string,std::string> KeyWithType;
|
|
||||||
static SmallSet<KeyWithType,10> reportedAsUnrecognized;
|
|
||||||
|
|
||||||
/// Find KV in array using binary search.
|
/// Find KV in array using binary search.
|
||||||
template<typename T>
|
static const SubtargetFeatureKV *Find(StringRef S, const SubtargetFeatureKV *A,
|
||||||
const T *SubtargetFeatures::Find(StringRef Key, const T *Array, size_t Length,
|
size_t L) {
|
||||||
const char* KeyType) {
|
|
||||||
// Determine the end of the array
|
// Determine the end of the array
|
||||||
const T *Hi = Array + Length;
|
const SubtargetFeatureKV *Hi = A + L;
|
||||||
// Binary search the array
|
// Binary search the array
|
||||||
const T *F = std::lower_bound(Array, Hi, Key);
|
const SubtargetFeatureKV *F = std::lower_bound(A, Hi, S);
|
||||||
// If not found then return NULL
|
// If not found then return NULL
|
||||||
if (F == Hi || StringRef(F->Key) != Key) {
|
if (F == Hi || StringRef(F->Key) != S) return NULL;
|
||||||
// If not yet reported, report now
|
|
||||||
KeyWithType current(KeyType, Key);
|
|
||||||
if(!reportedAsUnrecognized.count(current)) {
|
|
||||||
SmallString<1024> storage;
|
|
||||||
StringRef message = ("'" + Key +
|
|
||||||
"' is not a recognized " + KeyType +
|
|
||||||
" for this target (ignoring " + KeyType +
|
|
||||||
")").toStringRef(storage);
|
|
||||||
SMDiagnostic(StringRef(), SourceMgr::DK_Warning, message)
|
|
||||||
.print(0, errs());
|
|
||||||
reportedAsUnrecognized.insert(current);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
// Return the found array item
|
// Return the found array item
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate with <SubtargetInfoKV> for use in MCSubtargetInfo
|
|
||||||
template const SubtargetInfoKV *SubtargetFeatures::Find<SubtargetInfoKV>
|
|
||||||
(StringRef Key, const SubtargetInfoKV *Array, size_t Length, const char* KeyType);
|
|
||||||
|
|
||||||
/// getLongestEntryLength - Return the length of the longest entry in the table.
|
/// getLongestEntryLength - Return the length of the longest entry in the table.
|
||||||
///
|
///
|
||||||
static size_t getLongestEntryLength(const SubtargetFeatureKV *Table,
|
static size_t getLongestEntryLength(const SubtargetFeatureKV *Table,
|
||||||
@ -253,7 +228,7 @@ SubtargetFeatures::ToggleFeature(uint64_t Bits, const StringRef Feature,
|
|||||||
size_t FeatureTableSize) {
|
size_t FeatureTableSize) {
|
||||||
// Find feature in table.
|
// Find feature in table.
|
||||||
const SubtargetFeatureKV *FeatureEntry =
|
const SubtargetFeatureKV *FeatureEntry =
|
||||||
Find(StripFlag(Feature), FeatureTable, FeatureTableSize, "feature");
|
Find(StripFlag(Feature), FeatureTable, FeatureTableSize);
|
||||||
// If there is a match
|
// If there is a match
|
||||||
if (FeatureEntry) {
|
if (FeatureEntry) {
|
||||||
if ((Bits & FeatureEntry->Value) == FeatureEntry->Value) {
|
if ((Bits & FeatureEntry->Value) == FeatureEntry->Value) {
|
||||||
@ -267,6 +242,10 @@ SubtargetFeatures::ToggleFeature(uint64_t Bits, const StringRef Feature,
|
|||||||
// For each feature that this implies, set it.
|
// For each feature that this implies, set it.
|
||||||
SetImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);
|
SetImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
errs() << "'" << Feature
|
||||||
|
<< "' is not a recognized feature for this target"
|
||||||
|
<< " (ignoring feature)\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Bits;
|
return Bits;
|
||||||
@ -301,8 +280,7 @@ uint64_t SubtargetFeatures::getFeatureBits(const StringRef CPU,
|
|||||||
|
|
||||||
// Find CPU entry if CPU name is specified.
|
// Find CPU entry if CPU name is specified.
|
||||||
if (!CPU.empty()) {
|
if (!CPU.empty()) {
|
||||||
const SubtargetFeatureKV *CPUEntry = Find(CPU, CPUTable, CPUTableSize,
|
const SubtargetFeatureKV *CPUEntry = Find(CPU, CPUTable, CPUTableSize);
|
||||||
"processor");
|
|
||||||
// If there is a match
|
// If there is a match
|
||||||
if (CPUEntry) {
|
if (CPUEntry) {
|
||||||
// Set base feature bits
|
// Set base feature bits
|
||||||
@ -314,6 +292,10 @@ uint64_t SubtargetFeatures::getFeatureBits(const StringRef CPU,
|
|||||||
if (CPUEntry->Value & FE.Value)
|
if (CPUEntry->Value & FE.Value)
|
||||||
SetImpliedBits(Bits, &FE, FeatureTable, FeatureTableSize);
|
SetImpliedBits(Bits, &FE, FeatureTable, FeatureTableSize);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
errs() << "'" << CPU
|
||||||
|
<< "' is not a recognized processor for this target"
|
||||||
|
<< " (ignoring processor)\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +309,7 @@ uint64_t SubtargetFeatures::getFeatureBits(const StringRef CPU,
|
|||||||
|
|
||||||
// Find feature in table.
|
// Find feature in table.
|
||||||
const SubtargetFeatureKV *FeatureEntry =
|
const SubtargetFeatureKV *FeatureEntry =
|
||||||
Find(StripFlag(Feature), FeatureTable, FeatureTableSize, "feature");
|
Find(StripFlag(Feature), FeatureTable, FeatureTableSize);
|
||||||
// If there is a match
|
// If there is a match
|
||||||
if (FeatureEntry) {
|
if (FeatureEntry) {
|
||||||
// Enable/disable feature in bits
|
// Enable/disable feature in bits
|
||||||
@ -342,6 +324,10 @@ uint64_t SubtargetFeatures::getFeatureBits(const StringRef CPU,
|
|||||||
// For each feature that implies this, clear it.
|
// For each feature that implies this, clear it.
|
||||||
ClearImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);
|
ClearImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
errs() << "'" << Feature
|
||||||
|
<< "' is not a recognized feature for this target"
|
||||||
|
<< " (ignoring feature)\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
; RUN: llc -mcpu=invalid -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=CPU
|
|
||||||
; CPU: 'invalid' is not a recognized processor for this target (ignoring processor)
|
|
||||||
; CPU-NOT: 'invalid' is not a recognized processor for this target (ignoring processor)
|
|
||||||
|
|
||||||
; RUN: llc -mattr=+foo,+bar -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=FEATURE
|
|
||||||
; FEATURE: 'foo' is not a recognized feature for this target (ignoring feature)
|
|
||||||
; FEATURE-NEXT: 'bar' is not a recognized feature for this target (ignoring feature)
|
|
||||||
; FEATURE-NOT: 'foo' is not a recognized feature for this target (ignoring feature)
|
|
||||||
; FEATURE-NOT: 'bar' is not a recognized feature for this target (ignoring feature)
|
|
||||||
|
|
||||||
define void @foo() {
|
|
||||||
entry:
|
|
||||||
ret void
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user