reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

include/llvm/ADT/APInt.h
  114   bool isSingleWord() const { return BitWidth <= APINT_BITS_PER_WORD; }
  149     unsigned WordBits = ((BitWidth-1) % APINT_BITS_PER_WORD) + 1;
  279     assert(BitWidth && "bitwidth too small");
  321   APInt(const APInt &that) : BitWidth(that.BitWidth) {
  329   APInt(APInt &&that) : BitWidth(that.BitWidth) {
  331     that.BitWidth = 0;
  363   bool isNegative() const { return (*this)[BitWidth - 1]; }
  375   bool isSignBitSet() const { return (*this)[BitWidth-1]; }
  397       return U.VAL == WORDTYPE_MAX >> (APINT_BITS_PER_WORD - BitWidth);
  398     return countTrailingOnesSlowCase() == BitWidth;
  413     return countLeadingZerosSlowCase() == BitWidth - 1;
  428       return U.VAL == ((WordType(1) << (BitWidth - 1)) - 1);
  429     return !isNegative() && countTrailingOnesSlowCase() == BitWidth - 1;
  444       return U.VAL == (WordType(1) << (BitWidth - 1));
  445     return isNegative() && countTrailingZerosSlowCase() == BitWidth - 1;
  496     assert(numBits <= BitWidth && "numBits out of range");
  501            ((Ones + countLeadingZerosSlowCase()) == BitWidth);
  511     return (Ones > 0) && ((Ones + countLeadingZerosSlowCase()) == BitWidth);
  521     return (Ones + LeadZ + countTrailingZeros()) == BitWidth;
  724     return countLeadingZerosSlowCase() == BitWidth;
  738       BitWidth = RHS.BitWidth;
  738       BitWidth = RHS.BitWidth;
  761     BitWidth = that.BitWidth;
  761     BitWidth = that.BitWidth;
  762     that.BitWidth = 0;
  792     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  792     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  822     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  822     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  852     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  852     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  905     assert(ShiftAmt <= BitWidth && "Invalid shift amount");
  907       if (ShiftAmt == BitWidth)
  954     assert(ShiftAmt <= BitWidth && "Invalid shift amount");
  956       int64_t SExtVAL = SignExtend64(U.VAL, BitWidth);
  957       if (ShiftAmt == BitWidth)
  978     assert(ShiftAmt <= BitWidth && "Invalid shift amount");
  980       if (ShiftAmt == BitWidth)
 1134     assert(BitWidth == RHS.BitWidth && "Comparison requires equal bit widths");
 1134     assert(BitWidth == RHS.BitWidth && "Comparison requires equal bit widths");
 1325     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1325     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1333     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1333     assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1407     assert(BitPosition < BitWidth && "BitPosition out of range");
 1417     setBit(BitWidth - 1);
 1422     assert(hiBit <= BitWidth && "hiBit out of range");
 1423     assert(loBit <= BitWidth && "loBit out of range");
 1441     return setBits(loBit, BitWidth);
 1451     return setBits(BitWidth - hiBits, BitWidth);
 1451     return setBits(BitWidth - hiBits, BitWidth);
 1466     assert(BitPosition < BitWidth && "BitPosition out of range");
 1476     assert(loBits <= BitWidth && "More bits than bitwidth");
 1477     APInt Keep = getHighBitsSet(BitWidth, BitWidth - loBits);
 1477     APInt Keep = getHighBitsSet(BitWidth, BitWidth - loBits);
 1483     clearBit(BitWidth - 1);
 1521   unsigned getBitWidth() const { return BitWidth; }
 1528   unsigned getNumWords() const { return getNumWords(BitWidth); }
 1545   unsigned getActiveBits() const { return BitWidth - countLeadingZeros(); }
 1566       return BitWidth - countLeadingOnes() + 1;
 1589       return SignExtend64(U.VAL, BitWidth);
 1610       unsigned unusedBits = APINT_BITS_PER_WORD - BitWidth;
 1626       return llvm::countLeadingOnes(U.VAL << (APINT_BITS_PER_WORD - BitWidth));
 1646       return std::min(unsigned(llvm::countTrailingZeros(U.VAL)), BitWidth);
 1782     if (BitWidth == 1)
lib/Support/APInt.cpp
   92   assert(BitWidth && "Bitwidth too small");
  120   assert(BitWidth && "Bitwidth too small");
  127     BitWidth = NewBitWidth;
  136   BitWidth = NewBitWidth;
  160   ID.AddInteger(BitWidth);
  194   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  194   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  214   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  214   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  231   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  231   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  233     return APInt(BitWidth, U.VAL * RHS.U.VAL);
  256   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  256   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
  276   assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
  276   assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
  284   assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
  284   assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
  286     int64_t lhsSext = SignExtend64(U.VAL, BitWidth);
  287     int64_t rhsSext = SignExtend64(RHS.U.VAL, BitWidth);
  340   assert(bitPosition < BitWidth && "Out of the bit-width range!");
  347   assert(0 < subBitWidth && (subBitWidth + bitPosition) <= BitWidth &&
  351   if (subBitWidth == BitWidth) {
  433   assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth &&
  433   assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth &&
  471   assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth &&
  471   assert(bitPosition < BitWidth && (numBits + bitPosition) <= BitWidth &&
  566   return this->lshr(BitWidth - numBits);
  571   APInt Result(getLowBitsSet(BitWidth, numBits));
  599   unsigned Mod = BitWidth % APINT_BITS_PER_WORD;
  605   unsigned highWordBits = BitWidth % APINT_BITS_PER_WORD;
  635   return std::min(Count, BitWidth);
  645   assert(Count <= BitWidth);
  673   assert(BitWidth >= 16 && BitWidth % 16 == 0 && "Cannot byteswap!");
  673   assert(BitWidth >= 16 && BitWidth % 16 == 0 && "Cannot byteswap!");
  674   if (BitWidth == 16)
  675     return APInt(BitWidth, ByteSwap_16(uint16_t(U.VAL)));
  676   if (BitWidth == 32)
  677     return APInt(BitWidth, ByteSwap_32(unsigned(U.VAL)));
  678   if (BitWidth == 48) {
  683     return APInt(BitWidth, (uint64_t(Tmp2) << 32) | Tmp1);
  685   if (BitWidth == 64)
  686     return APInt(BitWidth, ByteSwap_64(U.VAL));
  691   if (Result.BitWidth != BitWidth) {
  691   if (Result.BitWidth != BitWidth) {
  692     Result.lshrInPlace(Result.BitWidth - BitWidth);
  692     Result.lshrInPlace(Result.BitWidth - BitWidth);
  693     Result.BitWidth = BitWidth;
  693     Result.BitWidth = BitWidth;
  699   switch (BitWidth) {
  701     return APInt(BitWidth, llvm::reverseBits<uint64_t>(U.VAL));
  703     return APInt(BitWidth, llvm::reverseBits<uint32_t>(U.VAL));
  705     return APInt(BitWidth, llvm::reverseBits<uint16_t>(U.VAL));
  707     return APInt(BitWidth, llvm::reverseBits<uint8_t>(U.VAL));
  713   APInt Reversed(BitWidth, 0);
  714   unsigned S = BitWidth;
  814       int64_t sext = SignExtend64(getWord(0), BitWidth);
  821   bool isNeg = isSigned ? (*this)[BitWidth-1] : false;
  866   assert(width < BitWidth && "Invalid APInt Truncate request");
  889   assert(Width > BitWidth && "Invalid APInt SignExtend request");
  892     return APInt(Width, SignExtend64(U.VAL, BitWidth));
  902                    ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1);
  913   assert(width > BitWidth && "Invalid APInt ZeroExtend request");
  931   if (BitWidth < width)
  933   if (BitWidth > width)
  939   if (BitWidth < width)
  941   if (BitWidth > width)
  947   if (BitWidth < width)
  953   if (BitWidth < width)
  961   ashrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth));
  982         U.pVal[getNumWords() - 1], ((BitWidth - 1) % APINT_BITS_PER_WORD) + 1);
 1010   lshrInPlace((unsigned)shiftAmt.getLimitedValue(BitWidth));
 1023   *this <<= (unsigned)shiftAmt.getLimitedValue(BitWidth);
 1046   return rotl(rotateModulo(BitWidth, rotateAmt));
 1050   rotateAmt %= BitWidth;
 1053   return shl(rotateAmt) | lshr(BitWidth - rotateAmt);
 1057   return rotr(rotateModulo(BitWidth, rotateAmt));
 1061   rotateAmt %= BitWidth;
 1064   return lshr(rotateAmt) | shl(BitWidth - rotateAmt);
 1091     return APInt(BitWidth, results[ (isSingleWord() ? U.VAL : U.pVal[0]) ]);
 1099     return APInt(BitWidth,
 1109   unsigned nbits = BitWidth, i = 4;
 1110   APInt testy(BitWidth, 16);
 1111   APInt x_old(BitWidth, 1);
 1112   APInt x_new(BitWidth, 0);
 1113   APInt two(BitWidth, 2);
 1167   APInt t[2] = { APInt(BitWidth, 0), APInt(BitWidth, 1) };
 1167   APInt t[2] = { APInt(BitWidth, 0), APInt(BitWidth, 1) };
 1168   APInt q(BitWidth, 0);
 1185     return APInt(BitWidth, 0);
 1577   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1577   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1582     return APInt(BitWidth, U.VAL / RHS.U.VAL);
 1594     return APInt(BitWidth, 0);
 1600     return APInt(BitWidth, 0);
 1603     return APInt(BitWidth, 1);
 1606     return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]);
 1609   APInt Quotient(BitWidth, 0); // to hold result.
 1619     return APInt(BitWidth, U.VAL / RHS);
 1627     return APInt(BitWidth, 0);
 1633     return APInt(BitWidth, 0);
 1636     return APInt(BitWidth, 1);
 1639     return APInt(BitWidth, this->U.pVal[0] / RHS);
 1642   APInt Quotient(BitWidth, 0); // to hold result.
 1670   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1670   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1673     return APInt(BitWidth, U.VAL % RHS.U.VAL);
 1687     return APInt(BitWidth, 0);
 1690     return APInt(BitWidth, 0);
 1696     return APInt(BitWidth, 0);
 1699     return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]);
 1702   APInt Remainder(BitWidth, 0);
 1763   assert(LHS.BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1763   assert(LHS.BitWidth == RHS.BitWidth && "Bit widths must be the same");
 1764   unsigned BitWidth = LHS.BitWidth;
 1835   unsigned BitWidth = LHS.BitWidth;
 1974   if (countLeadingZeros() + RHS.countLeadingZeros() + 2 <= BitWidth) {
 1993     return APInt(BitWidth, 0);
 2006     return APInt(BitWidth, 0);
 2019   return isNegative() ? APInt::getSignedMinValue(BitWidth)
 2020                       : APInt::getSignedMaxValue(BitWidth);
 2029   return APInt::getMaxValue(BitWidth);
 2038   return isNegative() ? APInt::getSignedMinValue(BitWidth)
 2039                       : APInt::getSignedMaxValue(BitWidth);
 2048   return APInt(BitWidth, 0);
 2060   return ResIsNegative ? APInt::getSignedMinValue(BitWidth)
 2061                        : APInt::getSignedMaxValue(BitWidth);
 2070   return APInt::getMaxValue(BitWidth);
 2079   return isNegative() ? APInt::getSignedMinValue(BitWidth)
 2080                       : APInt::getSignedMaxValue(BitWidth);
 2089   return APInt::getMaxValue(BitWidth);
 2269   dbgs() << "APInt(" << BitWidth << "b, "