summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-06 05:36:50 +0000
committerChris Lattner <sabre@nondot.org>2008-01-06 05:36:50 +0000
commit89c656657753beb33be734219429b80d02c7fff0 (patch)
tree33ca87147cb000098e20ca9d10d621f824065b3b /llvm/utils/TableGen/CodeGenDAGPatterns.cpp
parent0e519bb555b64dcd6ca9a43727854a6124112869 (diff)
downloadbcm5719-llvm-89c656657753beb33be734219429b80d02c7fff0.tar.gz
bcm5719-llvm-89c656657753beb33be734219429b80d02c7fff0.zip
set the 'isstore' flag for instructions whose pattern is an
intrinsic that writes to memory. llvm-svn: 45650
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenDAGPatterns.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 7e2830782f1..52610cfaa4c 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -633,6 +633,22 @@ static std::vector<unsigned char> getImplicitType(Record *R, bool NotRegisters,
return Other;
}
+
+/// getIntrinsicInfo - If this node corresponds to an intrinsic, return the
+/// CodeGenIntrinsic information for it, otherwise return a null pointer.
+const CodeGenIntrinsic *TreePatternNode::
+getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const {
+ if (getOperator() != CDP.get_intrinsic_void_sdnode() &&
+ getOperator() != CDP.get_intrinsic_w_chain_sdnode() &&
+ getOperator() != CDP.get_intrinsic_wo_chain_sdnode())
+ return 0;
+
+ unsigned IID =
+ dynamic_cast<IntInit*>(getChild(0)->getLeafValue())->getValue();
+ return &CDP.getIntrinsicInfo(IID);
+}
+
+
/// ApplyTypeConstraints - Apply all of the type constraints relevent to
/// this node and its children in the tree. This returns true if it makes a
/// change, false otherwise. If a type contradiction is found, throw an
@@ -699,27 +715,22 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
MadeChange = getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
MadeChange |= UpdateNodeType(MVT::isVoid, TP);
return MadeChange;
- } else if (getOperator() == CDP.get_intrinsic_void_sdnode() ||
- getOperator() == CDP.get_intrinsic_w_chain_sdnode() ||
- getOperator() == CDP.get_intrinsic_wo_chain_sdnode()) {
- unsigned IID =
- dynamic_cast<IntInit*>(getChild(0)->getLeafValue())->getValue();
- const CodeGenIntrinsic &Int = CDP.getIntrinsicInfo(IID);
+ } else if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) {
bool MadeChange = false;
// Apply the result type to the node.
- MadeChange = UpdateNodeType(Int.ArgVTs[0], TP);
+ MadeChange = UpdateNodeType(Int->ArgVTs[0], TP);
- if (getNumChildren() != Int.ArgVTs.size())
- TP.error("Intrinsic '" + Int.Name + "' expects " +
- utostr(Int.ArgVTs.size()-1) + " operands, not " +
+ if (getNumChildren() != Int->ArgVTs.size())
+ TP.error("Intrinsic '" + Int->Name + "' expects " +
+ utostr(Int->ArgVTs.size()-1) + " operands, not " +
utostr(getNumChildren()-1) + " operands!");
// Apply type info to the intrinsic ID.
MadeChange |= getChild(0)->UpdateNodeType(MVT::iPTR, TP);
for (unsigned i = 1, e = getNumChildren(); i != e; ++i) {
- MVT::ValueType OpVT = Int.ArgVTs[i];
+ MVT::ValueType OpVT = Int->ArgVTs[i];
MadeChange |= getChild(i)->UpdateNodeType(OpVT, TP);
MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
}
OpenPOWER on IntegriCloud