From 7c9728faead1368150bcaa8313bc460df29ea1b7 Mon Sep 17 00:00:00 2001 From: Jim Stichnoth Date: Wed, 31 Aug 2016 13:42:00 -0700 Subject: [PATCH] Subzero: Fix a build error against LLVM trunk. LLVM commit 1d79fff9e65e77f84bf80c2cf4f0155bd167c90d changed the way ilist::reverse_iterator is converted to ilist::iterator. See https://github.com/llvm-mirror/llvm/commit/1d79fff9e65e77f84bf80c2cf4f0155bd167c90d BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/2297363002 . --- src/IceInst.h | 9 +++++++++ src/IceTargetLoweringARM32.cpp | 2 +- src/IceTargetLoweringMIPS32.cpp | 2 +- src/IceTargetLoweringX86BaseImpl.h | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/IceInst.h b/src/IceInst.h index c98f69d07..68bd1a2fe 100644 --- a/src/IceInst.h +++ b/src/IceInst.h @@ -1161,6 +1161,15 @@ inline const Inst *iteratorToInst(InstList::const_iterator Iter) { return &*Iter; } +inline InstList::iterator +reverseToForwardIterator(InstList::reverse_iterator RI) { +#ifdef PNACL_LLVM + return RI.base(); +#else // !PNACL_LLVM + return ++RI.getReverse(); +#endif // !PNACL_LLVM +} + } // end of namespace Ice #endif // SUBZERO_SRC_ICEINST_H diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp index 0add99a71..7564652df 100644 --- a/src/IceTargetLoweringARM32.cpp +++ b/src/IceTargetLoweringARM32.cpp @@ -1703,7 +1703,7 @@ void TargetARM32::addEpilog(CfgNode *Node) { // Convert the reverse_iterator position into its corresponding (forward) // iterator position. - InstList::iterator InsertPoint = RI.base(); + InstList::iterator InsertPoint = reverseToForwardIterator(RI); --InsertPoint; Context.init(Node); Context.setInsertPoint(InsertPoint); diff --git a/src/IceTargetLoweringMIPS32.cpp b/src/IceTargetLoweringMIPS32.cpp index 47b1fcbcc..3a41373aa 100644 --- a/src/IceTargetLoweringMIPS32.cpp +++ b/src/IceTargetLoweringMIPS32.cpp @@ -996,7 +996,7 @@ void TargetMIPS32::addEpilog(CfgNode *Node) { // Convert the reverse_iterator position into its corresponding (forward) // iterator position. - InstList::iterator InsertPoint = RI.base(); + InstList::iterator InsertPoint = reverseToForwardIterator(RI); --InsertPoint; Context.init(Node); Context.setInsertPoint(InsertPoint); diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h index d5a9debfb..c193e76b7 100644 --- a/src/IceTargetLoweringX86BaseImpl.h +++ b/src/IceTargetLoweringX86BaseImpl.h @@ -1309,7 +1309,7 @@ void TargetX86Base::addEpilog(CfgNode *Node) { // Convert the reverse_iterator position into its corresponding (forward) // iterator position. - InstList::iterator InsertPoint = RI.base(); + InstList::iterator InsertPoint = reverseToForwardIterator(RI); --InsertPoint; Context.init(Node); Context.setInsertPoint(InsertPoint); -- 2.11.0