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

Unified Diff: src/IceDefs.h

Issue 1318553003: Compute the loop nest depth of each CfgNode and weight Variables by it. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Formatting Created 5 years, 3 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
Index: src/IceDefs.h
diff --git a/src/IceDefs.h b/src/IceDefs.h
index 7ea34be88f1f40415bdd02346193629adfd3b3a0..353f22f1d4c26419e8fe45729d1e045c16860756 100644
--- a/src/IceDefs.h
+++ b/src/IceDefs.h
@@ -225,6 +225,7 @@ enum VerboseItem {
IceV_Random = 1 << 10,
IceV_Folding = 1 << 11,
IceV_RMW = 1 << 12,
+ IceV_Loop = 1 << 13,
IceV_All = ~IceV_None,
IceV_Most = IceV_All & ~IceV_LinearScan
};
@@ -291,6 +292,17 @@ enum RandomizationPassesEnum {
RPE_num
};
+inline bool add_overflow(uint32_t x, uint32_t y, uint32_t *sum) {
Jim Stichnoth 2015/09/03 21:35:09 Maybe this should go in IceUtils.h? Also, documen
ascull 2015/09/03 22:47:12 Done.
+ static_assert(std::is_same<uint32_t, unsigned>::value, "Need to match type");
+#if __has_builtin(__builtin_uadd_overflow)
+ return __builtin_uadd_overflow(x, y, sum);
+#else
+ uint64_t res = static_cast<uint64_t>(x) + y;
+ *sum = static_cast<uint32_t>(res);
+ return res > std::numeric_limits<uint32_t>;
+#endif
+}
+
} // end of namespace Ice
#endif // SUBZERO_SRC_ICEDEFS_H

Powered by Google App Engine
This is Rietveld 408576698