[llvm-commits] [llvm] r115722 - in /llvm/trunk: docs/TableGenFundamentals.html lib/Target/X86/X86InstrSSE.td test/TableGen/nameconcat.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp

Chris Lattner sabre at nondot.org
Tue Oct 5 17:19:21 PDT 2010


Author: lattner
Date: Tue Oct  5 19:19:21 2010
New Revision: 115722

URL: http://llvm.org/viewvc/llvm-project?rev=115722&view=rev
Log:
remove the !nameconcat tblgen feature.  It "shorthand" and only used in 4 places
where !cast is just as short.

Removed:
    llvm/trunk/test/TableGen/nameconcat.td
Modified:
    llvm/trunk/docs/TableGenFundamentals.html
    llvm/trunk/lib/Target/X86/X86InstrSSE.td
    llvm/trunk/utils/TableGen/Record.cpp
    llvm/trunk/utils/TableGen/Record.h
    llvm/trunk/utils/TableGen/TGLexer.cpp
    llvm/trunk/utils/TableGen/TGLexer.h
    llvm/trunk/utils/TableGen/TGParser.cpp

Modified: llvm/trunk/docs/TableGenFundamentals.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=115722&r1=115721&r2=115722&view=diff
==============================================================================
--- llvm/trunk/docs/TableGenFundamentals.html (original)
+++ llvm/trunk/docs/TableGenFundamentals.html Tue Oct  5 19:19:21 2010
@@ -405,8 +405,6 @@
 the symbol table.  If the type of 'a' does not match <em>type</em>, TableGen
 aborts with an error. !cast<string> is a special case in that the argument must
 be an object defined by a 'def' construct.</dd>
-<dt><tt>!nameconcat<type>(a, b)</tt></dt>
-  <dd>Shorthand for !cast<type>(!strconcat(a, b))</dd>
 <dt><tt>!subst(a, b, c)</tt></dt>
   <dd>If 'a' and 'b' are of string type or are symbol references, substitute 
 'b' for 'a' in 'c.'  This operation is analogous to $(subst) in GNU make.</dd>

Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=115722&r1=115721&r2=115722&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Oct  5 19:19:21 2010
@@ -45,15 +45,15 @@
        !if(Is2Addr,
            !strconcat(asm, "\t{$src2, $dst|$dst, $src2}"),
            !strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}")),
-       [(set RC:$dst, (!nameconcat<Intrinsic>("int_x86_sse",
-                       !strconcat(SSEVer, "_", OpcodeStr, FPSizeStr))
+       [(set RC:$dst, (!cast<Intrinsic>(
+                 !strconcat("int_x86_sse", SSEVer, "_", OpcodeStr, FPSizeStr))
              RC:$src1, RC:$src2))]>;
   def rm_Int : SI<opc, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, memopr:$src2),
        !if(Is2Addr,
            !strconcat(asm, "\t{$src2, $dst|$dst, $src2}"),
            !strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}")),
-       [(set RC:$dst, (!nameconcat<Intrinsic>("int_x86_sse",
-                       !strconcat(SSEVer, "_", OpcodeStr, FPSizeStr))
+       [(set RC:$dst, (!cast<Intrinsic>(!strconcat("int_x86_sse",
+                                          SSEVer, "_", OpcodeStr, FPSizeStr))
              RC:$src1, mem_cpat:$src2))]>;
 }
 
@@ -103,15 +103,15 @@
        !if(Is2Addr,
            !strconcat(asm, "\t{$src2, $dst|$dst, $src2}"),
            !strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}")),
-           [(set RC:$dst, (!nameconcat<Intrinsic>("int_x86_",
-                           !strconcat(SSEVer, "_", OpcodeStr, FPSizeStr))
+           [(set RC:$dst, (!cast<Intrinsic>(
+                     !strconcat("int_x86_", SSEVer, "_", OpcodeStr, FPSizeStr))
                  RC:$src1, RC:$src2))], d>;
   def rm_Int : PI<opc, MRMSrcMem, (outs RC:$dst), (ins RC:$src1,x86memop:$src2),
        !if(Is2Addr,
            !strconcat(asm, "\t{$src2, $dst|$dst, $src2}"),
            !strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}")),
-       [(set RC:$dst, (!nameconcat<Intrinsic>("int_x86_",
-                       !strconcat(SSEVer, "_", OpcodeStr, FPSizeStr))
+       [(set RC:$dst, (!cast<Intrinsic>(
+                     !strconcat("int_x86_", SSEVer, "_", OpcodeStr, FPSizeStr))
              RC:$src1, (mem_frag addr:$src2)))], d>;
 }
 

Removed: llvm/trunk/test/TableGen/nameconcat.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/nameconcat.td?rev=115721&view=auto
==============================================================================
--- llvm/trunk/test/TableGen/nameconcat.td (original)
+++ llvm/trunk/test/TableGen/nameconcat.td (removed)
@@ -1,91 +0,0 @@
-// RUN: tblgen %s | grep {add_ps} | count 3
-// XFAIL: vg_leak
-
-class ValueType<int size, int value> {
-  int Size = size;
-  int Value = value;
-}
-
-def v2i64  : ValueType<128, 22>;   //  2 x i64 vector value
-def v2f64  : ValueType<128, 28>;   //  2 x f64 vector value
-
-class Intrinsic<string name> {
-  string Name = name;
-}
-
-class Inst<bits<8> opcode, dag oopnds, dag iopnds, string asmstr, 
-           list<dag> pattern> {
-  bits<8> Opcode = opcode;
-  dag OutOperands = oopnds;
-  dag InOperands = iopnds;
-  string AssemblyString = asmstr;
-  list<dag> Pattern = pattern;
-}
-
-def ops;
-def outs;
-def ins;
-
-def set;
-
-// Define registers
-class Register<string n> {
-  string Name = n;
-}
-
-class RegisterClass<list<ValueType> regTypes, list<Register> regList> {
-  list<ValueType> RegTypes = regTypes;
-  list<Register> MemberList = regList;
-}
-
-def XMM0: Register<"xmm0">;
-def XMM1: Register<"xmm1">;
-def XMM2: Register<"xmm2">;
-def XMM3: Register<"xmm3">;
-def XMM4: Register<"xmm4">;
-def XMM5: Register<"xmm5">;
-def XMM6: Register<"xmm6">;
-def XMM7: Register<"xmm7">;
-def XMM8:  Register<"xmm8">;
-def XMM9:  Register<"xmm9">;
-def XMM10: Register<"xmm10">;
-def XMM11: Register<"xmm11">;
-def XMM12: Register<"xmm12">;
-def XMM13: Register<"xmm13">;
-def XMM14: Register<"xmm14">;
-def XMM15: Register<"xmm15">;
-
-def VR128 : RegisterClass<[v2i64, v2f64],
-                          [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
-                           XMM8, XMM9, XMM10, XMM11,
-                           XMM12, XMM13, XMM14, XMM15]>;
-
-// Define intrinsics
-def int_x86_sse2_add_ps : Intrinsic<"addps">;
-def int_x86_sse2_add_pd : Intrinsic<"addpd">;
-
-multiclass arith<bits<8> opcode, string asmstr, string Intr> {
-  def PS : Inst<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-                 !strconcat(asmstr, "\t$dst, $src1, $src2"),
-                 [(set VR128:$dst, (!nameconcat<Intrinsic>(Intr, "_ps") VR128:$src1, VR128:$src2))]>;
-
-  def PD : Inst<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-                 !strconcat(asmstr, "\t$dst, $src1, $src2"),
-                 [(set VR128:$dst, (!nameconcat<Intrinsic>(Intr, "_pd") VR128:$src1, VR128:$src2))]>;
-}
-
-defm ADD : arith<0x58, "add", "int_x86_sse2_add">;
-
-class IntInst<bits<8> opcode, string asmstr, Intrinsic Intr> :
-  Inst<opcode,(outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-       !strconcat(asmstr, "\t$dst, $src1, $src2"),
-       [(set VR128:$dst, (Intr VR128:$src1, VR128:$src2))]>;
-
-
-multiclass arith_int<bits<8> opcode, string asmstr, string Intr> {
-  def PS_Int : IntInst<opcode, asmstr, !nameconcat<Intrinsic>(Intr, "_ps")>;
-
-  def PD_Int : IntInst<opcode, asmstr, !nameconcat<Intrinsic>(Intr, "_pd")>;
-}
-
-defm ADD : arith_int<0x58, "add", "int_x86_sse2_add">;

Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=115722&r1=115721&r2=115722&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Tue Oct  5 19:19:21 2010
@@ -152,16 +152,6 @@
       return new BinOpInit(BinOpInit::STRCONCAT, L, R, new StringRecTy);
     return BO;
   }
-  if (BO->getOpcode() == BinOpInit::NAMECONCAT) {
-    if (BO->getType()->getAsString() == getAsString()) {
-      Init *L = BO->getLHS()->convertInitializerTo(this);
-      Init *R = BO->getRHS()->convertInitializerTo(this);
-      if (L == 0 || R == 0) return 0;
-      if (L != BO->getLHS() || R != BO->getRHS())
-        return new BinOpInit(BinOpInit::NAMECONCAT, L, R, new StringRecTy);
-      return BO;
-    }
-  }
 
   return convertValue((TypedInit*)BO);
 }
@@ -236,16 +226,6 @@
       return new BinOpInit(BinOpInit::CONCAT, L, R, new DagRecTy);
     return BO;
   }
-  if (BO->getOpcode() == BinOpInit::NAMECONCAT) {
-    if (BO->getType()->getAsString() == getAsString()) {
-      Init *L = BO->getLHS()->convertInitializerTo(this);
-      Init *R = BO->getRHS()->convertInitializerTo(this);
-      if (L == 0 || R == 0) return 0;
-      if (L != BO->getLHS() || R != BO->getRHS())
-        return new BinOpInit(BinOpInit::CONCAT, L, R, new DagRecTy);
-      return BO;
-    }
-  }
   return 0;
 }
 
@@ -518,9 +498,8 @@
         // From TGParser::ParseIDValue
         if (CurRec) {
           if (const RecordVal *RV = CurRec->getValue(Name)) {
-            if (RV->getType() != getType()) {
-              throw "type mismatch in nameconcat";
-            }
+            if (RV->getType() != getType())
+              throw "type mismatch in cast";
             return new VarInit(Name, RV->getType());
           }
 
@@ -529,9 +508,8 @@
             const RecordVal *RV = CurRec->getValue(TemplateArgName);
             assert(RV && "Template arg doesn't exist??");
 
-            if (RV->getType() != getType()) {
-              throw "type mismatch in nameconcat";
-            }
+            if (RV->getType() != getType())
+              throw "type mismatch in cast";
 
             return new VarInit(TemplateArgName, RV->getType());
           }
@@ -543,9 +521,8 @@
             const RecordVal *RV = CurMultiClass->Rec.getValue(MCName);
             assert(RV && "Template arg doesn't exist??");
 
-            if (RV->getType() != getType()) {
-              throw "type mismatch in nameconcat";
-            }
+            if (RV->getType() != getType())
+              throw "type mismatch in cast";
 
             return new VarInit(MCName, RV->getType());
           }
@@ -660,57 +637,6 @@
       return new StringInit(LHSs->getValue() + RHSs->getValue());
     break;
   }
-  case NAMECONCAT: {
-    StringInit *LHSs = dynamic_cast<StringInit*>(LHS);
-    StringInit *RHSs = dynamic_cast<StringInit*>(RHS);
-    if (LHSs && RHSs) {
-      std::string Name(LHSs->getValue() + RHSs->getValue());
-
-      // From TGParser::ParseIDValue
-      if (CurRec) {
-        if (const RecordVal *RV = CurRec->getValue(Name)) {
-          if (RV->getType() != getType()) {
-            throw "type mismatch in nameconcat";
-          }
-          return new VarInit(Name, RV->getType());
-        }
-
-        std::string TemplateArgName = CurRec->getName()+":"+Name;
-        if (CurRec->isTemplateArg(TemplateArgName)) {
-          const RecordVal *RV = CurRec->getValue(TemplateArgName);
-          assert(RV && "Template arg doesn't exist??");
-
-          if (RV->getType() != getType()) {
-            throw "type mismatch in nameconcat";
-          }
-
-          return new VarInit(TemplateArgName, RV->getType());
-        }
-      }
-
-      if (CurMultiClass) {
-        std::string MCName = CurMultiClass->Rec.getName()+"::"+Name;
-        if (CurMultiClass->Rec.isTemplateArg(MCName)) {
-          const RecordVal *RV = CurMultiClass->Rec.getValue(MCName);
-          assert(RV && "Template arg doesn't exist??");
-
-          if (RV->getType() != getType()) {
-            throw "type mismatch in nameconcat";
-          }
-
-          return new VarInit(MCName, RV->getType());
-        }
-      }
-
-      if (Record *D = Records.getDef(Name))
-        return new DefInit(D);
-
-      errs() << "Variable not defined in !nameconcat: '" + Name + "'\n";
-      assert(0 && "Variable not found in !nameconcat");
-      return 0;
-    }
-    break;
-  }
   case EQ: {
     // try to fold eq comparison for 'bit' and 'int', otherwise fallback
     // to string objects.
@@ -771,8 +697,6 @@
   case SRL: Result = "!srl"; break;
   case EQ: Result = "!eq"; break;
   case STRCONCAT: Result = "!strconcat"; break;
-  case NAMECONCAT:
-    Result = "!nameconcat<" + getType()->getAsString() + ">"; break;
   }
   return Result + "(" + LHS->getAsString() + ", " + RHS->getAsString() + ")";
 }

Modified: llvm/trunk/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=115722&r1=115721&r2=115722&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.h (original)
+++ llvm/trunk/utils/TableGen/Record.h Tue Oct  5 19:19:21 2010
@@ -848,7 +848,7 @@
 ///
 class BinOpInit : public OpInit {
 public:
-  enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, NAMECONCAT, EQ };
+  enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, EQ };
 private:
   BinaryOp Opc;
   Init *LHS, *RHS;

Modified: llvm/trunk/utils/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=115722&r1=115721&r2=115722&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.cpp (original)
+++ llvm/trunk/utils/TableGen/TGLexer.cpp Tue Oct  5 19:19:21 2010
@@ -427,7 +427,6 @@
   if (Len == 3  && !memcmp(Start, "shl", 3)) return tgtok::XSHL;
   if (Len == 2  && !memcmp(Start, "eq", 2)) return tgtok::XEq;
   if (Len == 9  && !memcmp(Start, "strconcat", 9))   return tgtok::XStrConcat;
-  if (Len == 10 && !memcmp(Start, "nameconcat", 10)) return tgtok::XNameConcat;
   if (Len == 5 && !memcmp(Start, "subst", 5)) return tgtok::XSubst;
   if (Len == 7 && !memcmp(Start, "foreach", 7)) return tgtok::XForEach;
   if (Len == 4 && !memcmp(Start, "cast", 4)) return tgtok::XCast;

Modified: llvm/trunk/utils/TableGen/TGLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.h?rev=115722&r1=115721&r2=115722&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.h (original)
+++ llvm/trunk/utils/TableGen/TGLexer.h Tue Oct  5 19:19:21 2010
@@ -45,7 +45,7 @@
     MultiClass, String,
     
     // !keywords.
-    XConcat, XSRA, XSRL, XSHL, XStrConcat, XNameConcat, XCast, XSubst,
+    XConcat, XSRA, XSRL, XSHL, XStrConcat, XCast, XSubst,
     XForEach, XCar, XCdr, XNull, XIf, XEq,
 
     // Integer value.

Modified: llvm/trunk/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=115722&r1=115721&r2=115722&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.cpp (original)
+++ llvm/trunk/utils/TableGen/TGParser.cpp Tue Oct  5 19:19:21 2010
@@ -797,8 +797,7 @@
   case tgtok::XSRL:
   case tgtok::XSHL:
   case tgtok::XEq:
-  case tgtok::XStrConcat:
-  case tgtok::XNameConcat: {  // Value ::= !binop '(' Value ',' Value ')'
+  case tgtok::XStrConcat: {  // Value ::= !binop '(' Value ',' Value ')'
     tgtok::TokKind OpTok = Lex.getCode();
     SMLoc OpLoc = Lex.getLoc();
     Lex.Lex();  // eat the operation
@@ -808,39 +807,17 @@
 
     switch (OpTok) {
     default: assert(0 && "Unhandled code!");
-    case tgtok::XConcat:
-      Code = BinOpInit::CONCAT;
-      Type = new DagRecTy();
-      break;
-    case tgtok::XSRA:
-      Code = BinOpInit::SRA;
-      Type = new IntRecTy();
-      break;
-    case tgtok::XSRL:
-      Code = BinOpInit::SRL;
-      Type = new IntRecTy();
-      break;
-    case tgtok::XSHL:
-      Code = BinOpInit::SHL;
-      Type = new IntRecTy();
-      break;
-    case tgtok::XEq:  
-      Code = BinOpInit::EQ;
-      Type = new IntRecTy();
-      break;
+    case tgtok::XConcat: Code = BinOpInit::CONCAT; Type = new DagRecTy(); break;
+    case tgtok::XSRA:    Code = BinOpInit::SRA;    Type = new IntRecTy(); break;
+    case tgtok::XSRL:    Code = BinOpInit::SRL;    Type = new IntRecTy(); break;
+    case tgtok::XSHL:    Code = BinOpInit::SHL;    Type = new IntRecTy(); break;
+    case tgtok::XEq:     Code = BinOpInit::EQ;     Type = new IntRecTy(); break;
     case tgtok::XStrConcat:
       Code = BinOpInit::STRCONCAT;
       Type = new StringRecTy();
       break;
-    case tgtok::XNameConcat:
-      Code = BinOpInit::NAMECONCAT;
-      Type = ParseOperatorType();
-      if (Type == 0) {
-        TokError("did not get type for binary operator");
-        return 0;
-      }
-      break;
     }
+    
     if (Lex.getCode() != tgtok::l_paren) {
       TokError("expected '(' after binary operator");
       return 0;
@@ -1226,9 +1203,7 @@
   }
   case tgtok::l_paren: {         // Value ::= '(' IDValue DagArgList ')'
     Lex.Lex();   // eat the '('
-    if (Lex.getCode() != tgtok::Id
-        && Lex.getCode() != tgtok::XCast
-        && Lex.getCode() != tgtok::XNameConcat) {
+    if (Lex.getCode() != tgtok::Id && Lex.getCode() != tgtok::XCast) {
       TokError("expected identifier in dag init");
       return 0;
     }
@@ -1278,8 +1253,7 @@
   case tgtok::XSRL:
   case tgtok::XSHL:
   case tgtok::XEq:
-  case tgtok::XStrConcat:
-  case tgtok::XNameConcat:  // Value ::= !binop '(' Value ',' Value ')'
+  case tgtok::XStrConcat:   // Value ::= !binop '(' Value ',' Value ')'
   case tgtok::XIf:
   case tgtok::XForEach:
   case tgtok::XSubst: {  // Value ::= !ternop '(' Value ',' Value ',' Value ')'





More information about the llvm-commits mailing list