fix the !eq operator in tblgen to return a bit instead of an int.
authorChris Lattner <sabre@nondot.org>
Sun, 31 Oct 2010 19:22:57 +0000 (19:22 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 31 Oct 2010 19:22:57 +0000 (19:22 +0000)
Use this to make the X86 and ARM targets set isCodeGenOnly=1
automatically for their instructions that have Format=Pseudo,
resolving a hack in tblgen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117862 91177308-0d34-0410-b5e6-96231b3b80d8

docs/TableGenFundamentals.html
lib/Target/ARM/ARMInstrFormats.td
lib/Target/X86/X86InstrFormats.td
utils/TableGen/AsmMatcherEmitter.cpp
utils/TableGen/TGParser.cpp

index 2f0c4ae6ec299397ebb338681f3d1f8580352717..e9067b0e1ee69f0591d5bd05b98d89236c442646 100644 (file)
@@ -422,7 +422,7 @@ class.  This operation is analogous to $(foreach) in GNU make.</dd>
   <dd>'b' if the result of 'int' or 'bit' operator 'a' is nonzero,
       'c' otherwise.</dd>
 <dt><tt>!eq(a,b)</tt></dt>
-  <dd>Integer one if string a is equal to string b, zero otherwise.  This
+  <dd>'bit 1' if string a is equal to string b, 0 otherwise.  This
       only operates on string, int and bit objects.  Use !cast&lt;string&gt; to
       compare other types of objects.</dd>
 </dl>
index 91789dae608a48249f7e258b33d66020d027ab0b..aa5a45da75e3ed48cc0e583de93932b17ac703ce 100644 (file)
@@ -203,6 +203,9 @@ class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
   Domain D = d;
   bit isUnaryDataProc = 0;
   bit canXformTo16Bit = 0;
+  
+  // If this is a pseudo instruction, mark it isCodeGenOnly.
+  let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
 
   // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
   let TSFlags{4-0}   = AM.Value;
index ce85e3a49dc2c274546f5497eaf8668d7583a785..a4403591084ee5c323d399c501416f08233ac619 100644 (file)
@@ -125,6 +125,9 @@ class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
   dag InOperandList = ins;
   string AsmString = AsmStr;
 
+  // If this is a pseudo instruction, mark it isCodeGenOnly.
+  let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
+
   //
   // Attributes specific to X86 instructions...
   //
index 0fad96edde3786cff3821c0999fd6e1703e404d6..6ddccc21b7e2711776908ae143767fd3ded0ed6b 100644 (file)
@@ -223,21 +223,6 @@ static bool IsAssemblerInstruction(StringRef Name,
   if (CGI.TheDef->getValueAsBit("isCodeGenOnly"))
     return false;
 
-  // Ignore pseudo ops.
-  //
-  // FIXME: This is a hack [for X86]; can we convert these instructions to set
-  // the "codegen only" bit instead?
-  if (const RecordVal *Form = CGI.TheDef->getValue("Form"))
-    if (Form->getValue()->getAsString() == "Pseudo")
-      return false;
-  
-  // FIXME: This is a hack [for ARM]; can we convert these instructions to set
-  // the "codegen only" bit instead?
-  if (const RecordVal *Form = CGI.TheDef->getValue("F"))
-    if (Form->getValue()->getAsString() == "Pseudo")
-      return false;
-  
-
   // Ignore "Int_*" and "*_Int" instructions, which are internal aliases.
   //
   // FIXME: This is a total hack.
index 1f4b07b4bdace61d1d0c9e3b8733e57bc850399e..7bd2fbcd9305961a92b646056013884daf6110da 100644 (file)
@@ -812,7 +812,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
     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::XEq:     Code = BinOpInit::EQ;     Type = new BitRecTy(); break;
     case tgtok::XStrConcat:
       Code = BinOpInit::STRCONCAT;
       Type = new StringRecTy();