[llvm-commits] [llvm] r106185 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/ifbit.td utils/TableGen/Record.cpp
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Wed Jun 16 17:31:36 PDT 2010
Author: bruno
Date: Wed Jun 16 19:31:36 2010
New Revision: 106185
URL: http://llvm.org/viewvc/llvm-project?rev=106185&view=rev
Log:
For a tablegen expression such as !if(a,b,c), let 'a'
be evaluated for 'bit' operators
Added:
llvm/trunk/test/TableGen/ifbit.td
Modified:
llvm/trunk/docs/TableGenFundamentals.html
llvm/trunk/utils/TableGen/Record.cpp
Modified: llvm/trunk/docs/TableGenFundamentals.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=106185&r1=106184&r2=106185&view=diff
==============================================================================
--- llvm/trunk/docs/TableGenFundamentals.html (original)
+++ llvm/trunk/docs/TableGenFundamentals.html Wed Jun 16 19:31:36 2010
@@ -422,7 +422,8 @@
<dt><tt>!null(a)</tt></dt>
<dd>An integer {0,1} indicating whether list 'a' is empty.</dd>
<dt><tt>!if(a,b,c)</tt></dt>
- <dd>'b' if the result of integer operator 'a' is nonzero, 'c' otherwise.</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
only operates on string, int and bit objects. Use !cast<string> to
Added: llvm/trunk/test/TableGen/ifbit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/ifbit.td?rev=106185&view=auto
==============================================================================
--- llvm/trunk/test/TableGen/ifbit.td (added)
+++ llvm/trunk/test/TableGen/ifbit.td Wed Jun 16 19:31:36 2010
@@ -0,0 +1,11 @@
+// RUN: tblgen %s | FileCheck %s
+// XFAIL: vg_leak
+// CHECK: a = 6
+// CHECK: a = 5
+
+class A<bit b = 1> {
+ int a = !if(b, 5, 6);
+}
+
+def X : A<0>;
+def Y : A;
Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=106185&r1=106184&r2=106185&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Wed Jun 16 19:31:36 2010
@@ -981,7 +981,8 @@
}
case IF: {
- IntInit *LHSi = dynamic_cast<IntInit*>(LHS);
+ IntInit *LHSi =
+ dynamic_cast<IntInit*>(LHS->convertInitializerTo(new IntRecTy()));
if (LHSi) {
if (LHSi->getValue()) {
return MHS;
@@ -1000,7 +1001,8 @@
Init *lhs = LHS->resolveReferences(R, RV);
if (Opc == IF && lhs != LHS) {
- IntInit *Value = dynamic_cast<IntInit*>(lhs);
+ IntInit *Value =
+ dynamic_cast<IntInit*>(LHS->convertInitializerTo(new IntRecTy()));
if (Value != 0) {
// Short-circuit
if (Value->getValue()) {
More information about the llvm-commits
mailing list