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 .
diff --git a/src/IceInst.h b/src/IceInst.h
index c98f69d..68bd1a2 100644
--- a/src/IceInst.h
+++ b/src/IceInst.h
@@ -1161,6 +1161,15 @@
   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 0add99a..7564652 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -1703,7 +1703,7 @@
 
   // 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 47b1fcb..3a41373 100644
--- a/src/IceTargetLoweringMIPS32.cpp
+++ b/src/IceTargetLoweringMIPS32.cpp
@@ -996,7 +996,7 @@
 
   // 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 d5a9deb..c193e76 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -1309,7 +1309,7 @@
 
   // 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);