[llvm-commits] [llvm] r159217 - /llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp

Tim Northover Tim.Northover at arm.com
Tue Jun 26 11:46:29 PDT 2012


Author: tnorthover
Date: Tue Jun 26 13:46:28 2012
New Revision: 159217

URL: http://llvm.org/viewvc/llvm-project?rev=159217&view=rev
Log:
Teach TableGen to put chains on more instructions

When generating selection tables for Pat instances, TableGen relied on
an output Instruction's Pattern field being set to infer whether a
chain should be added.

This patch adds additional logic to check various flag fields so that
correct code can be generated even if Pattern is unset.

Modified:
    llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=159217&r1=159216&r2=159217&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Tue Jun 26 13:46:28 2012
@@ -690,6 +690,13 @@
   bool NodeHasChain = InstPatNode &&
                       InstPatNode->TreeHasProperty(SDNPHasChain, CGP);
 
+  // Instructions which load and store from memory should have a chain,
+  // regardless of whether they happen to have an internal pattern saying so.
+  if (Pattern.getSrcPattern()->TreeHasProperty(SDNPHasChain, CGP)
+      && (II.hasCtrlDep || II.mayLoad || II.mayStore || II.canFoldAsLoad ||
+          II.hasSideEffects))
+      NodeHasChain = true;
+
   bool isRoot = N == Pattern.getDstPattern();
 
   // TreeHasOutGlue - True if this tree has glue.





More information about the llvm-commits mailing list