summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/utils/TableGen/InfoByHwMode.cpp9
-rw-r--r--llvm/utils/TableGen/InfoByHwMode.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/llvm/utils/TableGen/InfoByHwMode.cpp b/llvm/utils/TableGen/InfoByHwMode.cpp
index 882a6a78509..aee0dd6fa6a 100644
--- a/llvm/utils/TableGen/InfoByHwMode.cpp
+++ b/llvm/utils/TableGen/InfoByHwMode.cpp
@@ -70,10 +70,9 @@ MVT &ValueTypeByHwMode::getOrCreateTypeForMode(unsigned Mode, MVT Type) {
return Map.insert(std::make_pair(Mode, Type)).first->second;
}
-std::string ValueTypeByHwMode::getMVTName(MVT T) {
- std::string N = llvm::getEnumName(T.SimpleTy);
- if (N.substr(0,5) == "MVT::")
- N = N.substr(5);
+StringRef ValueTypeByHwMode::getMVTName(MVT T) {
+ StringRef N = llvm::getEnumName(T.SimpleTy);
+ N.consume_front("MVT::");
return N;
}
@@ -91,7 +90,7 @@ std::string ValueTypeByHwMode::getAsString() const {
for (unsigned i = 0, e = Pairs.size(); i != e; ++i) {
const PairType *P = Pairs[i];
str << '(' << getModeName(P->first)
- << ':' << getMVTName(P->second) << ')';
+ << ':' << getMVTName(P->second).str() << ')';
if (i != e-1)
str << ',';
}
diff --git a/llvm/utils/TableGen/InfoByHwMode.h b/llvm/utils/TableGen/InfoByHwMode.h
index 71149e8da19..57640fc3025 100644
--- a/llvm/utils/TableGen/InfoByHwMode.h
+++ b/llvm/utils/TableGen/InfoByHwMode.h
@@ -129,7 +129,7 @@ struct ValueTypeByHwMode : public InfoByHwMode<MVT> {
MVT getType(unsigned Mode) const { return get(Mode); }
MVT &getOrCreateTypeForMode(unsigned Mode, MVT Type);
- static std::string getMVTName(MVT T);
+ static StringRef getMVTName(MVT T);
std::string getAsString() const;
void dump() const;
};
OpenPOWER on IntegriCloud