[llvm-commits] [llvm] r97214 - /llvm/trunk/utils/TableGen/DAGISelMatcher.h
Chris Lattner
sabre at nondot.org
Thu Feb 25 23:35:27 PST 2010
Author: lattner
Date: Fri Feb 26 01:35:27 2010
New Revision: 97214
URL: http://llvm.org/viewvc/llvm-project?rev=97214&view=rev
Log:
add a new setNumChildren method for resizing scopes. Tweak getHash() so
that we never return a tombstone value, which (thankfully) triggers an
assert in densemap.
Modified:
llvm/trunk/utils/TableGen/DAGISelMatcher.h
Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.h?rev=97214&r1=97213&r2=97214&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.h Fri Feb 26 01:35:27 2010
@@ -100,7 +100,8 @@
}
unsigned getHash() const {
- return (getHashImpl() << 4) ^ getKind();
+ // Clear the high bit so we don't conflict with tombstones etc.
+ return ((getHashImpl() << 4) ^ getKind()) & (~0U>>1);
}
void print(raw_ostream &OS, unsigned indent = 0) const;
@@ -137,6 +138,15 @@
Children[i] = 0;
return Res;
}
+
+ void setNumChildren(unsigned NC) {
+ if (NC < Children.size()) {
+ // delete any children we're about to lose pointers to.
+ for (unsigned i = NC, e = Children.size(); i != e; ++i)
+ delete Children[i];
+ }
+ Children.resize(NC);
+ }
static inline bool classof(const Matcher *N) {
return N->getKind() == Scope;
More information about the llvm-commits
mailing list