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

Unified Diff: src/IceUtils.h

Issue 1136793002: Handle ARM "ret void" and function alignment with proper padding. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: note moved to cpp Created 5 years, 7 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/IceTargetLoweringX8632.cpp ('k') | src/assembler.h » ('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 1a7a8df6b2e6d2806d003f819fe3ccc1552184d3..bcbba23eeab4bc441d63e616fd5cd7ee54bc528b 100644
--- a/src/IceUtils.h
+++ b/src/IceUtils.h
@@ -51,11 +51,26 @@ public:
return (0 <= value) && (value < limit);
}
+ // Check whether the magnitude of value fits in N bits, i.e., whether an
+ // (N+1)-bit sign-magnitude representation can hold value.
+ template <typename T> static inline bool IsAbsoluteUint(int N, T Value) {
+ assert((0 < N) &&
+ (static_cast<unsigned int>(N) < (CHAR_BIT * sizeof(Value))));
+ if (Value < 0)
+ Value = -Value;
+ return IsUint(N, Value);
+ }
+
template <typename T> static inline bool WouldOverflowAdd(T X, T Y) {
return ((X > 0 && Y > 0 && (X > std::numeric_limits<T>::max() - Y)) ||
(X < 0 && Y < 0 && (X < std::numeric_limits<T>::min() - Y)));
}
+ template <typename T> static inline bool IsAligned(T X, intptr_t N) {
+ assert(llvm::isPowerOf2_64(N));
+ return (X & (N - 1)) == 0;
+ }
+
static inline uint64_t OffsetToAlignment(uint64_t Pos, uint64_t Align) {
assert(llvm::isPowerOf2_64(Align));
uint64_t Mod = Pos & (Align - 1);
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698