Index: llvm/trunk/include/llvm/ADT/APInt.h =================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h +++ llvm/trunk/include/llvm/ADT/APInt.h @@ -85,7 +85,7 @@ UP, }; - static const WordType WORD_MAX = ~WordType(0); + static const WordType WORDTYPE_MAX = ~WordType(0); private: /// This union is used to store the integer value. When the @@ -150,7 +150,7 @@ unsigned WordBits = ((BitWidth-1) % APINT_BITS_PER_WORD) + 1; // Mask out the high bits. - uint64_t mask = WORD_MAX >> (APINT_BITS_PER_WORD - WordBits); + uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - WordBits); if (isSingleWord()) U.VAL &= mask; else @@ -395,7 +395,7 @@ /// This checks to see if the value has all bits of the APInt are set or not. bool isAllOnesValue() const { if (isSingleWord()) - return U.VAL == WORD_MAX >> (APINT_BITS_PER_WORD - BitWidth); + return U.VAL == WORDTYPE_MAX >> (APINT_BITS_PER_WORD - BitWidth); return countTrailingOnesSlowCase() == BitWidth; } @@ -496,7 +496,7 @@ assert(numBits != 0 && "numBits must be non-zero"); assert(numBits <= BitWidth && "numBits out of range"); if (isSingleWord()) - return U.VAL == (WORD_MAX >> (APINT_BITS_PER_WORD - numBits)); + return U.VAL == (WORDTYPE_MAX >> (APINT_BITS_PER_WORD - numBits)); unsigned Ones = countTrailingOnesSlowCase(); return (numBits == Ones) && ((Ones + countLeadingZerosSlowCase()) == BitWidth); @@ -560,7 +560,7 @@ /// /// \returns the all-ones value for an APInt of the specified bit-width. static APInt getAllOnesValue(unsigned numBits) { - return APInt(numBits, WORD_MAX, true); + return APInt(numBits, WORDTYPE_MAX, true); } /// Get the '0' value. @@ -1383,7 +1383,7 @@ /// Set every bit to 1. void setAllBits() { if (isSingleWord()) - U.VAL = WORD_MAX; + U.VAL = WORDTYPE_MAX; else // Set all the bits in all the words. memset(U.pVal, -1, getNumWords() * APINT_WORD_SIZE); @@ -1416,7 +1416,7 @@ if (loBit == hiBit) return; if (loBit < APINT_BITS_PER_WORD && hiBit <= APINT_BITS_PER_WORD) { - uint64_t mask = WORD_MAX >> (APINT_BITS_PER_WORD - (hiBit - loBit)); + uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - (hiBit - loBit)); mask <<= loBit; if (isSingleWord()) U.VAL |= mask; @@ -1470,7 +1470,7 @@ /// Toggle every bit to its opposite value. void flipAllBits() { if (isSingleWord()) { - U.VAL ^= WORD_MAX; + U.VAL ^= WORDTYPE_MAX; clearUnusedBits(); } else { flipAllBitsSlowCase(); @@ -1759,7 +1759,7 @@ /// referencing 2 in a space where 2 does no exist. unsigned nearestLogBase2() const { // Special case when we have a bitwidth of 1. If VAL is 1, then we - // get 0. If VAL is 0, we get WORD_MAX which gets truncated to + // get 0. If VAL is 0, we get WORDTYPE_MAX which gets truncated to // UINT32_MAX. if (BitWidth == 1) return U.VAL - 1; Index: llvm/trunk/lib/Support/APInt.cpp =================================================================== --- llvm/trunk/lib/Support/APInt.cpp +++ llvm/trunk/lib/Support/APInt.cpp @@ -79,7 +79,7 @@ U.pVal[0] = val; if (isSigned && int64_t(val) < 0) for (unsigned i = 1; i < getNumWords(); ++i) - U.pVal[i] = WORD_MAX; + U.pVal[i] = WORDTYPE_MAX; clearUnusedBits(); } @@ -305,13 +305,13 @@ unsigned hiWord = whichWord(hiBit); // Create an initial mask for the low word with zeros below loBit. - uint64_t loMask = WORD_MAX << whichBit(loBit); + uint64_t loMask = WORDTYPE_MAX << whichBit(loBit); // If hiBit is not aligned, we need a high mask. unsigned hiShiftAmt = whichBit(hiBit); if (hiShiftAmt != 0) { // Create a high mask with zeros above hiBit. - uint64_t hiMask = WORD_MAX >> (APINT_BITS_PER_WORD - hiShiftAmt); + uint64_t hiMask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - hiShiftAmt); // If loWord and hiWord are equal, then we combine the masks. Otherwise, // set the bits in hiWord. if (hiWord == loWord) @@ -324,7 +324,7 @@ // Fill any words between loWord and hiWord with all ones. for (unsigned word = loWord + 1; word < hiWord; ++word) - U.pVal[word] = WORD_MAX; + U.pVal[word] = WORDTYPE_MAX; } /// Toggle every bit to its opposite value. @@ -355,7 +355,7 @@ // Single word result can be done as a direct bitmask. if (isSingleWord()) { - uint64_t mask = WORD_MAX >> (APINT_BITS_PER_WORD - subBitWidth); + uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - subBitWidth); U.VAL &= ~(mask << bitPosition); U.VAL |= (subBits.U.VAL << bitPosition); return; @@ -367,7 +367,7 @@ // Insertion within a single word can be done as a direct bitmask. if (loWord == hi1Word) { - uint64_t mask = WORD_MAX >> (APINT_BITS_PER_WORD - subBitWidth); + uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - subBitWidth); U.pVal[loWord] &= ~(mask << loBit); U.pVal[loWord] |= (subBits.U.VAL << loBit); return; @@ -383,7 +383,7 @@ // Mask+insert remaining bits. unsigned remainingBits = subBitWidth % APINT_BITS_PER_WORD; if (remainingBits != 0) { - uint64_t mask = WORD_MAX >> (APINT_BITS_PER_WORD - remainingBits); + uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - remainingBits); U.pVal[hi1Word] &= ~mask; U.pVal[hi1Word] |= subBits.getWord(subBitWidth - 1); } @@ -559,7 +559,7 @@ unsigned Count = llvm::countLeadingOnes(U.pVal[i] << shift); if (Count == highWordBits) { for (i--; i >= 0; --i) { - if (U.pVal[i] == WORD_MAX) + if (U.pVal[i] == WORDTYPE_MAX) Count += APINT_BITS_PER_WORD; else { Count += llvm::countLeadingOnes(U.pVal[i]); @@ -583,7 +583,7 @@ unsigned APInt::countTrailingOnesSlowCase() const { unsigned Count = 0; unsigned i = 0; - for (; i < getNumWords() && U.pVal[i] == WORD_MAX; ++i) + for (; i < getNumWords() && U.pVal[i] == WORDTYPE_MAX; ++i) Count += APINT_BITS_PER_WORD; if (i < getNumWords()) Count += llvm::countTrailingOnes(U.pVal[i]);