Subzero: Implement InstList in terms of llvm::ilist<> .
Use LLVM's intrusive list ADT template to implement instruction lists. This embeds prev/next pointers into the instruction, and as such, iterators essentially double as instruction pointers. This means stripping off one level of indirection when dereferencing, and also the range-based for loop can't be used.
The performance difference in translation time seems to be 1-2%.
I tried to also do this for the much less used PhiList and AssignList, but ran into SFINAE problems.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/709533002
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h
index 4bfe4b4..a8b0fcc 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -45,13 +45,13 @@
Inst *getNextInst() const {
if (Next == End)
return NULL;
- return *Next;
+ return Next;
}
Inst *getNextInst(InstList::iterator &Iter) const {
advanceForward(Iter);
if (Iter == End)
return NULL;
- return *Iter;
+ return Iter;
}
CfgNode *getNode() const { return Node; }
bool atEnd() const { return Cur == End; }