[llvm] r238398 - [TableGen] Don't convert types to strings to query what they are. Just use 'isa'

Craig Topper craig.topper at gmail.com
Wed May 27 23:38:29 PDT 2015


Author: ctopper
Date: Thu May 28 01:38:28 2015
New Revision: 238398

URL: http://llvm.org/viewvc/llvm-project?rev=238398&view=rev
Log:
[TableGen] Don't convert types to strings to query what they are. Just use 'isa'

Modified:
    llvm/trunk/lib/TableGen/Record.cpp

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=238398&r1=238397&r2=238398&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Thu May 28 01:38:28 2015
@@ -717,7 +717,7 @@ UnOpInit *UnOpInit::get(UnaryOp opc, Ini
 Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
   switch (getOpcode()) {
   case CAST: {
-    if (getType()->getAsString() == "string") {
+    if (isa<StringRecTy>(getType())) {
       if (StringInit *LHSs = dyn_cast<StringInit>(LHS))
         return LHSs;
 
@@ -987,7 +987,7 @@ static Init *EvaluateOperation(OpInit *R
                                MultiClass *CurMultiClass) {
   // If this is a dag, recurse
   if (auto *TArg = dyn_cast<TypedInit>(Arg))
-    if (TArg->getType()->getAsString() == "dag")
+    if (isa<DagRecTy>(TArg->getType()))
       return ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass);
 
   std::vector<Init *> NewOperands;





More information about the llvm-commits mailing list