diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-05-03 17:19:30 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-05-03 17:19:30 +0000 |
commit | 691ef2ba066dda14ae4ac0ad645054fbc967785a (patch) | |
tree | 1c06734df74c2303e4c1481e59c9598cd401b11c /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | c88e681498feb35b78a029d029e3de401c75a8d3 (diff) |
Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop). Generic lowering is implemented, however only promotion
is implemented for SelectionDAG at the moment.
More coming soon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index f9b347d4c9..f4d7adcc4e 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1328,10 +1328,13 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, return SDOperand(N, 0); } -SDOperand SelectionDAG::getSrcValue(const Value* v) { - SDNode *N = new SrcValueSDNode(v); +SDOperand SelectionDAG::getSrcValue(const Value* v, int offset) { + if (v && ValueNodes[std::make_pair(v,offset)]) + return SDOperand(ValueNodes[std::make_pair(v,offset)], 0); + SDNode *N = new SrcValueSDNode(v, offset); N->setValueTypes(MVT::Other); - // FIXME: memoize NODES + if (v) //only track non-null values + ValueNodes[std::make_pair(v,offset)] = N; AllNodes.push_back(N); return SDOperand(N, 0); } |