[llvm-commits] CVS: llvm/utils/TableGen/InstrSelectorEmitter.cpp InstrSelectorEmitter.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 11 15:33:02 PDT 2003
Changes in directory llvm/utils/TableGen:
InstrSelectorEmitter.cpp updated: 1.24 -> 1.25
InstrSelectorEmitter.h updated: 1.15 -> 1.16
---
Log message:
Add support for naming the destination of a "set" in a pattern
---
Diffs of the changes:
Index: llvm/utils/TableGen/InstrSelectorEmitter.cpp
diff -u llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.24 llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.25
--- llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.24 Mon Aug 11 15:25:52 2003
+++ llvm/utils/TableGen/InstrSelectorEmitter.cpp Mon Aug 11 15:32:02 2003
@@ -138,6 +138,7 @@
if (!Tree->getChild(0)->isLeaf())
error("Arg #0 of set should be a register or register class!");
Result = Tree->getChild(0)->getValueRecord();
+ ResultName = Tree->getChildName(0);
Tree = Tree->getChild(1);
}
}
@@ -895,6 +896,9 @@
for (unsigned i = 0, e = P->getNumArgs(); i != e; ++i)
if (P->getArgName(i) == ArgName)
return Operands[i].second + "->Val";
+
+ if (ArgName == P->getResultName())
+ return "NewReg";
P->error("Pattern does not define a value named $" + ArgName + "!");
return "";
}
Index: llvm/utils/TableGen/InstrSelectorEmitter.h
diff -u llvm/utils/TableGen/InstrSelectorEmitter.h:1.15 llvm/utils/TableGen/InstrSelectorEmitter.h:1.16
--- llvm/utils/TableGen/InstrSelectorEmitter.h:1.15 Mon Aug 11 15:25:52 2003
+++ llvm/utils/TableGen/InstrSelectorEmitter.h Mon Aug 11 15:32:02 2003
@@ -142,6 +142,7 @@
/// register result, specified with a (set) in the pattern.
///
Record *Result;
+ std::string ResultName; // The name of the result value...
/// TheRecord - The actual TableGen record corresponding to this pattern.
///
@@ -185,6 +186,7 @@
TreePatternNode *getTree() const { return Tree; }
Record *getResult() const { return Result; }
+ const std::string &getResultName() const { return ResultName; }
/// getRecord - Return the actual TableGen record corresponding to this
/// pattern.
More information about the llvm-commits
mailing list