summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-03-05 18:54:34 +0000
committerCraig Topper <craig.topper@intel.com>2019-03-05 18:54:34 +0000
commitca26808da95ca9811550f2af51758612a515e5ef (patch)
treee5d53382a39c1ab8732cd8d30e77498c627259b0 /llvm/lib
parent16fc15ab15f018e5f683ca1935154a4e8ff5e3de (diff)
downloadbcm5719-llvm-ca26808da95ca9811550f2af51758612a515e5ef.tar.gz
bcm5719-llvm-ca26808da95ca9811550f2af51758612a515e5ef.zip
[Subtarget] Create a separate SubtargetSubtargetKV struct for ProcDesc to remove fields from the stack tables that aren't needed for CPUs
The description for CPUs was just the CPU name wrapped with "Select the " and " processor". We can just do that directly in the help printer instead of making a separate version in the binary for each CPU. Also remove the Value field that isn't needed and was always 0. Differential Revision: https://reviews.llvm.org/D58938 llvm-svn: 355429
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/TargetSubtargetInfo.cpp2
-rw-r--r--llvm/lib/MC/MCSubtargetInfo.cpp18
2 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/TargetSubtargetInfo.cpp b/llvm/lib/CodeGen/TargetSubtargetInfo.cpp
index 7b29b68597c..c0520a9b2ba 100644
--- a/llvm/lib/CodeGen/TargetSubtargetInfo.cpp
+++ b/llvm/lib/CodeGen/TargetSubtargetInfo.cpp
@@ -16,7 +16,7 @@ using namespace llvm;
TargetSubtargetInfo::TargetSubtargetInfo(
const Triple &TT, StringRef CPU, StringRef FS,
- ArrayRef<SubtargetFeatureKV> PF, ArrayRef<SubtargetFeatureKV> PD,
+ ArrayRef<SubtargetFeatureKV> PF, ArrayRef<SubtargetSubTypeKV> PD,
const SubtargetInfoKV *ProcSched, const MCWriteProcResEntry *WPR,
const MCWriteLatencyEntry *WL, const MCReadAdvanceEntry *RA,
const InstrStage *IS, const unsigned *OC, const unsigned *FP)
diff --git a/llvm/lib/MC/MCSubtargetInfo.cpp b/llvm/lib/MC/MCSubtargetInfo.cpp
index 5cb51ede822..ca174c735d2 100644
--- a/llvm/lib/MC/MCSubtargetInfo.cpp
+++ b/llvm/lib/MC/MCSubtargetInfo.cpp
@@ -21,8 +21,8 @@
using namespace llvm;
/// Find KV in array using binary search.
-static const SubtargetFeatureKV *Find(StringRef S,
- ArrayRef<SubtargetFeatureKV> A) {
+template <typename T>
+static const T *Find(StringRef S, ArrayRef<T> A) {
// Binary search the array
auto F = std::lower_bound(A.begin(), A.end(), S);
// If not found then return NULL
@@ -84,7 +84,8 @@ static void ApplyFeatureFlag(FeatureBitset &Bits, StringRef Feature,
}
/// Return the length of the longest entry in the table.
-static size_t getLongestEntryLength(ArrayRef<SubtargetFeatureKV> Table) {
+template <typename T>
+static size_t getLongestEntryLength(ArrayRef<T> Table) {
size_t MaxLen = 0;
for (auto &I : Table)
MaxLen = std::max(MaxLen, std::strlen(I.Key));
@@ -92,7 +93,7 @@ static size_t getLongestEntryLength(ArrayRef<SubtargetFeatureKV> Table) {
}
/// Display help for feature choices.
-static void Help(ArrayRef<SubtargetFeatureKV> CPUTable,
+static void Help(ArrayRef<SubtargetSubTypeKV> CPUTable,
ArrayRef<SubtargetFeatureKV> FeatTable) {
// Determine the length of the longest CPU and Feature entries.
unsigned MaxCPULen = getLongestEntryLength(CPUTable);
@@ -101,7 +102,8 @@ static void Help(ArrayRef<SubtargetFeatureKV> CPUTable,
// Print the CPU table.
errs() << "Available CPUs for this target:\n\n";
for (auto &CPU : CPUTable)
- errs() << format(" %-*s - %s.\n", MaxCPULen, CPU.Key, CPU.Desc);
+ errs() << format(" %-*s - Select the %s processor.\n", MaxCPULen, CPU.Key,
+ CPU.Key);
errs() << '\n';
// Print the Feature table.
@@ -115,7 +117,7 @@ static void Help(ArrayRef<SubtargetFeatureKV> CPUTable,
}
static FeatureBitset getFeatures(StringRef CPU, StringRef FS,
- ArrayRef<SubtargetFeatureKV> ProcDesc,
+ ArrayRef<SubtargetSubTypeKV> ProcDesc,
ArrayRef<SubtargetFeatureKV> ProcFeatures) {
SubtargetFeatures Features(FS);
@@ -135,7 +137,7 @@ static FeatureBitset getFeatures(StringRef CPU, StringRef FS,
// Find CPU entry if CPU name is specified.
else if (!CPU.empty()) {
- const SubtargetFeatureKV *CPUEntry = Find(CPU, ProcDesc);
+ const SubtargetSubTypeKV *CPUEntry = Find(CPU, ProcDesc);
// If there is a match
if (CPUEntry) {
@@ -173,7 +175,7 @@ void MCSubtargetInfo::setDefaultFeatures(StringRef CPU, StringRef FS) {
MCSubtargetInfo::MCSubtargetInfo(
const Triple &TT, StringRef C, StringRef FS,
- ArrayRef<SubtargetFeatureKV> PF, ArrayRef<SubtargetFeatureKV> PD,
+ ArrayRef<SubtargetFeatureKV> PF, ArrayRef<SubtargetSubTypeKV> PD,
const SubtargetInfoKV *ProcSched, const MCWriteProcResEntry *WPR,
const MCWriteLatencyEntry *WL, const MCReadAdvanceEntry *RA,
const InstrStage *IS, const unsigned *OC, const unsigned *FP)
OpenPOWER on IntegriCloud