[PATCH] D144423: [APInt] Deprecate several functions

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 12:08:46 PST 2023


kazu created this revision.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch deprecates:

- those functions that have been soft-deprecated
- count{Leading,Trailing}{Zero,Ones}
- countPopulation

Note that I've already migrated away from all known uses of these
functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144423

Files:
  llvm/include/llvm/ADT/APInt.h


Index: llvm/include/llvm/ADT/APInt.h
===================================================================
--- llvm/include/llvm/ADT/APInt.h
+++ llvm/include/llvm/ADT/APInt.h
@@ -176,7 +176,7 @@
   /// Get the '0' value for the specified bit-width.
   static APInt getZero(unsigned numBits) { return APInt(numBits, 0); }
 
-  /// NOTE: This is soft-deprecated.  Please use `getZero()` instead.
+  LLVM_DEPRECATED("use getZero instead", "getZero")
   static APInt getNullValue(unsigned numBits) { return getZero(numBits); }
 
   /// Return an APInt zero bits wide.
@@ -215,7 +215,7 @@
     return APInt(numBits, WORDTYPE_MAX, true);
   }
 
-  /// NOTE: This is soft-deprecated.  Please use `getAllOnes()` instead.
+  LLVM_DEPRECATED("use getAllOnes instead", "getAllOnes")
   static APInt getAllOnesValue(unsigned numBits) { return getAllOnes(numBits); }
 
   /// Return an APInt with exactly one bit set in the result.
@@ -359,7 +359,7 @@
     return countTrailingOnesSlowCase() == BitWidth;
   }
 
-  /// NOTE: This is soft-deprecated.  Please use `isAllOnes()` instead.
+  LLVM_DEPRECATED("use isAllOnes instead", "isAllOnes")
   bool isAllOnesValue() const { return isAllOnes(); }
 
   /// Determine if this value is zero, i.e. all bits are clear.
@@ -369,7 +369,7 @@
     return countLeadingZerosSlowCase() == BitWidth;
   }
 
-  /// NOTE: This is soft-deprecated.  Please use `isZero()` instead.
+  LLVM_DEPRECATED("use isZero instead", "isZero")
   bool isNullValue() const { return isZero(); }
 
   /// Determine if this is a value of 1.
@@ -381,7 +381,7 @@
     return countLeadingZerosSlowCase() == BitWidth - 1;
   }
 
-  /// NOTE: This is soft-deprecated.  Please use `isOne()` instead.
+  LLVM_DEPRECATED("use isOne instead", "isOne")
   bool isOneValue() const { return isOne(); }
 
   /// Determine if this is the largest unsigned value.
@@ -1483,7 +1483,7 @@
     return BitWidth - getNumSignBits() + 1;
   }
 
-  /// NOTE: This is soft-deprecated.  Please use `getSignificantBits()` instead.
+  LLVM_DEPRECATED("use getSignificantBits instead", "getSignificantBits")
   unsigned getMinSignedBits() const { return getSignificantBits(); }
 
   /// Get zero extended value
@@ -1556,6 +1556,7 @@
     return countLeadingZerosSlowCase();
   }
 
+  LLVM_DEPRECATED("use countl_zero instead", "countl_zero")
   unsigned countLeadingZeros() const { return countl_zero(); }
 
   /// Count the number of leading one bits.
@@ -1574,6 +1575,7 @@
     return countLeadingOnesSlowCase();
   }
 
+  LLVM_DEPRECATED("use countl_one instead", "countl_one")
   unsigned countLeadingOnes() const { return countl_one(); }
 
   /// Computes the number of leading bits of this APInt that are equal to its
@@ -1597,6 +1599,7 @@
     return countTrailingZerosSlowCase();
   }
 
+  LLVM_DEPRECATED("use countr_zero instead", "countr_zero")
   unsigned countTrailingZeros() const { return countr_zero(); }
 
   /// Count the number of trailing one bits.
@@ -1612,6 +1615,7 @@
     return countTrailingOnesSlowCase();
   }
 
+  LLVM_DEPRECATED("use countr_one instead", "countr_one")
   unsigned countTrailingOnes() const { return countr_one(); }
 
   /// Count the number of bits set.
@@ -1626,6 +1630,7 @@
     return countPopulationSlowCase();
   }
 
+  LLVM_DEPRECATED("use popcount instead", "popcount")
   unsigned countPopulation() const { return popcount(); }
 
   /// @}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144423.498924.patch
Type: text/x-patch
Size: 3367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230220/555be718/attachment.bin>


More information about the llvm-commits mailing list