[PATCH] D38174: [TableGen] Return StringRef from ValueTypeByHwMode::getMVTName
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 07:32:43 PDT 2017
Did you see my comments about raw_ostream?
On Fri, Sep 22, 2017 at 6:34 AM Simon Pilgrim via Phabricator <
reviews at reviews.llvm.org> wrote:
> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL313983: [TableGen] Return StringRef from
> ValueTypeByHwMode::getMVTName (authored by RKSimon).
>
> Changed prior to commit:
> https://reviews.llvm.org/D38174?vs=116333&id=116343#toc
>
> Repository:
> rL LLVM
>
> https://reviews.llvm.org/D38174
>
> Files:
> llvm/trunk/utils/TableGen/InfoByHwMode.cpp
> llvm/trunk/utils/TableGen/InfoByHwMode.h
>
>
> Index: llvm/trunk/utils/TableGen/InfoByHwMode.cpp
> ===================================================================
> --- llvm/trunk/utils/TableGen/InfoByHwMode.cpp
> +++ llvm/trunk/utils/TableGen/InfoByHwMode.cpp
> @@ -70,10 +70,9 @@
> 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 @@
> 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 << ',';
> }
> Index: llvm/trunk/utils/TableGen/InfoByHwMode.h
> ===================================================================
> --- llvm/trunk/utils/TableGen/InfoByHwMode.h
> +++ llvm/trunk/utils/TableGen/InfoByHwMode.h
> @@ -129,7 +129,7 @@
> 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;
> };
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170922/9c3f87e8/attachment.html>
More information about the llvm-commits
mailing list