[llvm-commits] [llvm] r117862 - in /llvm/trunk: docs/TableGenFundamentals.html lib/Target/ARM/ARMInstrFormats.td lib/Target/X86/X86InstrFormats.td utils/TableGen/AsmMatcherEmitter.cpp utils/TableGen/TGParser.cpp
Chris Lattner
sabre at nondot.org
Sun Oct 31 12:22:57 PDT 2010
Author: lattner
Date: Sun Oct 31 14:22:57 2010
New Revision: 117862
URL: http://llvm.org/viewvc/llvm-project?rev=117862&view=rev
Log:
fix the !eq operator in tblgen to return a bit instead of an int.
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.
Modified:
llvm/trunk/docs/TableGenFundamentals.html
llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
llvm/trunk/lib/Target/X86/X86InstrFormats.td
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
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=117862&r1=117861&r2=117862&view=diff
==============================================================================
--- llvm/trunk/docs/TableGenFundamentals.html (original)
+++ llvm/trunk/docs/TableGenFundamentals.html Sun Oct 31 14:22:57 2010
@@ -422,7 +422,7 @@
<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<string> to
compare other types of objects.</dd>
</dl>
Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=117862&r1=117861&r2=117862&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Sun Oct 31 14:22:57 2010
@@ -203,6 +203,9 @@
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;
Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=117862&r1=117861&r2=117862&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Sun Oct 31 14:22:57 2010
@@ -125,6 +125,9 @@
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...
//
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=117862&r1=117861&r2=117862&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Sun Oct 31 14:22:57 2010
@@ -223,21 +223,6 @@
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.
Modified: llvm/trunk/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=117862&r1=117861&r2=117862&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.cpp (original)
+++ llvm/trunk/utils/TableGen/TGParser.cpp Sun Oct 31 14:22:57 2010
@@ -812,7 +812,7 @@
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();
More information about the llvm-commits
mailing list