[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp DAGISelEmitter.h
Evan Cheng
evan.cheng at apple.com
Thu Dec 8 22:06:20 PST 2005
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.88 -> 1.89
DAGISelEmitter.h updated: 1.41 -> 1.42
---
Log message:
Prevent folding of instructions which produce chains that have more than 1 real use
---
Diffs of the changes: (+9 -4)
DAGISelEmitter.cpp | 11 ++++++++---
DAGISelEmitter.h | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.88 llvm/utils/TableGen/DAGISelEmitter.cpp:1.89
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.88 Thu Dec 8 18:48:42 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Fri Dec 9 00:06:08 2005
@@ -1691,11 +1691,12 @@
/// matches, and the SDNode for the result has the RootName specified name.
void DAGISelEmitter::EmitMatchForPattern(TreePatternNode *N,
const std::string &RootName,
- std::map<std::string,std::string> &VarMap,
+ std::map<std::string,std::string> &VarMap,
unsigned PatternNo,
std::ostream &OS,
std::string &ChainName,
- bool &HasChain, bool &InFlag) {
+ bool &HasChain, bool &InFlag,
+ bool isRoot) {
if (N->isLeaf()) {
if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
OS << " if (cast<ConstantSDNode>(" << RootName
@@ -1731,6 +1732,10 @@
if (NodeHasChain(N, *this)) {
OpNo = 1;
+ if (!isRoot) {
+ OS << " if (" << RootName << ".hasOneUse()) goto P"
+ << PatternNo << "Fail;\n";
+ }
if (!HasChain) {
HasChain = true;
OS << " SDOperand " << RootName << "0 = " << RootName
@@ -2143,7 +2148,7 @@
std::map<std::string,std::string> VariableMap;
std::string ChainName;
EmitMatchForPattern(Pattern.first, "N", VariableMap, PatternNo, OS,
- ChainName, HasChain, InFlag);
+ ChainName, HasChain, InFlag, true /*the root*/);
// TP - Get *SOME* tree pattern, we don't care which.
TreePattern &TP = *PatternFragments.begin()->second;
Index: llvm/utils/TableGen/DAGISelEmitter.h
diff -u llvm/utils/TableGen/DAGISelEmitter.h:1.41 llvm/utils/TableGen/DAGISelEmitter.h:1.42
--- llvm/utils/TableGen/DAGISelEmitter.h:1.41 Thu Dec 8 18:48:42 2005
+++ llvm/utils/TableGen/DAGISelEmitter.h Fri Dec 9 00:06:08 2005
@@ -425,7 +425,7 @@
std::map<std::string,std::string> &VarMap,
unsigned PatternNo, std::ostream &OS,
std::string &ChainName,
- bool &HasChain, bool &InFlag);
+ bool &HasChain, bool &InFlag, bool isRoot = false);
void EmitCopyToRegsForPattern(TreePatternNode *N, const std::string &RootName,
std::ostream &OS, bool HasChain);
std::pair<unsigned, unsigned>
More information about the llvm-commits
mailing list