Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: src/IceUtils.h

Issue 1683243003: ARM32 Vector lowering - scalarize select (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Typo fix Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | tests_lit/assembler/arm32/select-vec.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceUtils.h
diff --git a/src/IceUtils.h b/src/IceUtils.h
index f9b03bc75b1f65da97b6f1dc5494750b36af500f..83b3fe9116e4638fe57292d0d600249f66d0ac00 100644
--- a/src/IceUtils.h
+++ b/src/IceUtils.h
@@ -123,6 +123,25 @@ template <typename T> static bool isPositiveZero(T Val) {
return Val == 0 && !std::signbit(Val);
}
+/// An RAII class to ensure that a boolean flag is restored to its previous
+/// value upon function exit.
+///
+/// Used in places like RandomizationPoolingPause and generating target helper
+/// calls.
+class BoolFlagSaver {
+ BoolFlagSaver() = delete;
+ BoolFlagSaver(const BoolFlagSaver &) = delete;
+ BoolFlagSaver &operator=(const BoolFlagSaver &) = delete;
+
+public:
+ BoolFlagSaver(bool &F, bool NewValue) : OldValue(F), Flag(F) { F = NewValue; }
+ ~BoolFlagSaver() { Flag = OldValue; }
+
+private:
+ const bool OldValue;
+ bool &Flag;
+};
+
} // end of namespace Utils
} // end of namespace Ice
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | tests_lit/assembler/arm32/select-vec.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698