fix a bug in post-order iterators with external storage, patch by
[oota-llvm.git] / include / llvm / ADT / APInt.h
index 8c7c2605c51f630ac3e6b559b3e7a25d1eb296f5..56cd3ccf84e3ebd3b8d0058f6f5f13bf83ff4fdf 100644 (file)
@@ -1257,6 +1257,18 @@ public:
   /// @returns the multiplicative inverse for a given modulo.
   APInt multiplicativeInverse(const APInt& modulo) const;
 
+  /// @}
+  /// @name Support for division by constant
+  /// @{
+
+  /// Calculate the magic number for signed division by a constant.
+  struct ms;
+  ms magic() const;
+
+  /// Calculate the magic number for unsigned division by a constant.
+  struct mu;
+  mu magicu() const;
+
   /// @}
   /// @name Building-block Operations for APInt and APFloat
   /// @{
@@ -1388,6 +1400,19 @@ public:
   /// @}
 };
 
+/// Magic data for optimising signed division by a constant.
+struct APInt::ms {
+  APInt m;  ///< magic number
+  unsigned s;  ///< shift amount
+};
+
+/// Magic data for optimising unsigned division by a constant.
+struct APInt::mu {
+  APInt m;     ///< magic number
+  bool a;      ///< add indicator
+  unsigned s;  ///< shift amount
+};
+
 inline bool operator==(uint64_t V1, const APInt& V2) {
   return V2 == V1;
 }
@@ -1401,6 +1426,8 @@ inline raw_ostream &operator<<(raw_ostream &OS, const APInt &I) {
   return OS;
 }
 
+std::ostream &operator<<(std::ostream &o, const APInt &I);
+
 namespace APIntOps {
 
 /// @brief Determine the smaller of two APInts considered to be signed.