[PATCH] D47432: TableGen/DAGPatterns: Allow bit constants in addition to int constants

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 4 07:49:29 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333904: TableGen/DAGPatterns: Allow bit constants in addition to int constants (authored by nha, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47432?vs=148768&id=149768#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47432

Files:
  llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp


Index: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
===================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -2566,10 +2566,12 @@
     return Res;
   }
 
-  if (IntInit *II = dyn_cast<IntInit>(TheInit)) {
+  if (isa<IntInit>(TheInit) || isa<BitInit>(TheInit)) {
     if (!OpName.empty())
-      error("Constant int argument should not have a name!");
-    return std::make_shared<TreePatternNode>(II, 1);
+      error("Constant int or bit argument should not have a name!");
+    if (isa<BitInit>(TheInit))
+      TheInit = TheInit->convertInitializerTo(IntRecTy::get());
+    return std::make_shared<TreePatternNode>(TheInit, 1);
   }
 
   if (BitsInit *BI = dyn_cast<BitsInit>(TheInit)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47432.149768.patch
Type: text/x-patch
Size: 815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180604/6ccf4828/attachment.bin>


More information about the llvm-commits mailing list