[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.478 - 1.479 --- Log message: Drop unused operand. --- Diffs of the changes: (+0 -2) LegalizeDAG.cpp |2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.478 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.479 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.478 Thu Feb 22 09:37:19 2007 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Feb 24 03:44:17 2007 @@ -677,8 +677,6 @@ Result = DAG.getConstant(0, TLI.getPointerTy()); break; case ISD::EHSELECTION: -LegalizeOp(Node-getOperand(1)); -// Fall Thru case ISD::EXCEPTIONADDR: { Tmp1 = LegalizeOp(Node-getOperand(0)); MVT::ValueType VT = Node-getValueType(0); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.373 - 1.374 --- Log message: Deal with cases when MMI is not requested. --- Diffs of the changes: (+14 -0) SelectionDAGISel.cpp | 14 ++ 1 files changed, 14 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.373 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.374 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.373Fri Feb 23 15:45:01 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Feb 24 03:45:44 2007 @@ -2101,6 +2101,12 @@ SDOperand Op = DAG.getNode(ISD::EXCEPTIONADDR, VTs, Ops, 1); setValue(I, Op); DAG.setRoot(Op.getValue(1)); +} else { + SDOperand Op = DAG.getNode(ISD::MERGE_VALUES, TLI.getPointerTy(), + DAG.getConstant(0, TLI.getPointerTy()), + DAG.getRoot()); + setValue(I, Op); + DAG.setRoot(Op.getValue(1)); } return 0; } @@ -2145,6 +2151,12 @@ SDOperand Op = DAG.getNode(ISD::EHSELECTION, VTs, Ops, 2); setValue(I, Op); DAG.setRoot(Op.getValue(1)); +} else { + SDOperand Op = DAG.getNode(ISD::MERGE_VALUES, TLI.getPointerTy(), + DAG.getConstant(0, TLI.getPointerTy()), + getValue(I.getOperand(1))); + setValue(I, Op); + DAG.setRoot(Op.getValue(1)); } return 0; @@ -2169,6 +2181,8 @@ unsigned TypeID = MMI-getTypeIDFor(GV); setValue(I, DAG.getConstant(TypeID, MVT::i32)); +} else { + setValue(I, DAG.getConstant(0, MVT::i32)); } return 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Changes in directory llvm/include/llvm/ADT: APInt.h updated: 1.16 - 1.17 --- Log message: Improve documentation. Make divide function internal (it was briefly external for testing). --- Diffs of the changes: (+16 -12) APInt.h | 28 1 files changed, 16 insertions(+), 12 deletions(-) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.16 llvm/include/llvm/ADT/APInt.h:1.17 --- llvm/include/llvm/ADT/APInt.h:1.16 Tue Feb 20 21:56:12 2007 +++ llvm/include/llvm/ADT/APInt.h Sat Feb 24 03:50:13 2007 @@ -107,8 +107,8 @@ } /// This method is used internally to clear the to N bits that are not used - /// by the APInt. This is needed after a word is assigned a value to ensure - /// that those bits are zero'd out. + /// by the APInt. This is needed after the most significant word is assigned + /// a value to ensure that those bits are zero'd out. /// @brief Clear high order bits inline void clearUnusedBits() { if (isSingleWord()) @@ -119,31 +119,35 @@ } /// @returns the corresponding word for the specified bit position. - /// This is a constant version. + /// @brief Get the word corresponding to a bit position inline uint64_t getWord(uint32_t bitPosition) const { return isSingleWord() ? VAL : pVal[whichWord(bitPosition)]; } - /// @brief Converts a char array into an integer. + /// This is used by the constructors that take string arguments. + /// @brief Converts a char array into an APInt void fromString(uint32_t numBits, const char *StrStart, uint32_t slen, uint8_t radix); + /// This is used by the toString method to divide by the radix. It simply + /// provides a more convenient form of divide for internal use. + /// @brief An internal division function for dividing APInts. + static void divide(const APInt LHS, uint32_t lhsWords, + const APInt RHS, uint32_t rhsWords, + APInt *Quotient, APInt *Remainder); + #ifndef NDEBUG /// @brief debug method void dump() const; #endif public: - /// @brief An internal division function for dividing APInts. - static void divide(const APInt LHS, uint32_t lhsWords, - const APInt RHS, uint32_t rhsWords, - APInt *Quotient, APInt *Remainder); - - /// @brief Create a new APInt of numBits bit-width, and initialized as val. + /// @brief Create a new APInt of numBits width, initialized as val. APInt(uint32_t numBits, uint64_t val); - /// @brief Create a new APInt of numBits bit-width, and initialized as - /// bigVal[]. + /// Note that numWords can be smaller or larger than the corresponding bit + /// width but any extraneous bits will be dropped. + /// @brief Create a new APInt of numBits width, initialized as bigVal[]. APInt(uint32_t numBits, uint32_t numWords, uint64_t bigVal[]); /// @brief Create a new APInt by translating the string represented ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp
Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt: gptest.cpp updated: 1.3 - 1.4 --- Log message: Add logical operators, shift, and index tests. --- Diffs of the changes: (+133 -8) gptest.cpp | 141 + 1 files changed, 133 insertions(+), 8 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.3 llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.4 --- llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.3 Wed Feb 21 19:03:12 2007 +++ llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp Sat Feb 24 03:51:47 2007 @@ -40,6 +40,10 @@ } std::string getResult(const std::string cmd) { +#if 0 + printf(Command: %s, cmd.c_str()); + fflush(stdout); +#endif const char *command = cmd.c_str(); if (-1 == write(output, command, cmd.size())) { std::string msg = write: + cmd; @@ -47,7 +51,6 @@ perror(msg.c_str()); exit(1); } - usleep(1); // try to switch contexts char buf[4096]; int len = read(input, buf, 4095); if (-1 == len) { @@ -76,13 +79,9 @@ } -bool getCompare(const APInt v1, const std::string op, -const APInt v2, bool wantSigned = false) { - - std::string cmd = v1.toString(10, wantSigned) + op + -v2.toString(10, wantSigned) + '\n'; - std::string result = getResult(cmd); - return bool(atoi(result.c_str())); +void report(const std::string cmd, +const std::string result, const std::string apresult) { + printf(%s = %s (not %s)\n, cmd.c_str(), result.c_str(), apresult.c_str()); } void report(const APInt v1, const APInt v2, const std::string op, @@ -94,6 +93,14 @@ fflush(stdout); } +void report(const APInt v1, const std::string op, +const std::string result, const std::string apresult) { + printf(op.c_str()); + print(v1, false, false); + printf( = %s (not %s)\n, result.c_str(), apresult.c_str()); + fflush(stdout); +} + void doMultiply(const APInt v1, const APInt v2) { std::string result = getBinop(v1, *, v2); APInt r = v1 * v2; @@ -138,6 +145,117 @@ report(v1,v2, - , result,apresult); } +void doAnd(const APInt v1, const APInt v2) { + std::string cmd; + cmd += bitand(; + cmd += v1.toString(10,false); + cmd += ,; + cmd += v2.toString(10,false); + cmd += )\n; + std::string result = getResult(cmd); + APInt r = v1 v2; + std::string apresult = r.toString(10, false); + if (result != apresult) +report(cmd, result,apresult); +} + +void doOr(const APInt v1, const APInt v2) { + std::string cmd; + cmd += bitor(; + cmd += v1.toString(10,false); + cmd += ,; + cmd += v2.toString(10,false); + cmd += )\n; + std::string result = getResult(cmd); + APInt r = v1 | v2; + std::string apresult = r.toString(10, false); + if (result != apresult) +report(cmd, result,apresult); +} + +void doXor(const APInt v1, const APInt v2) { + std::string cmd; + cmd += bitxor(; + cmd += v1.toString(10,false); + cmd += ,; + cmd += v2.toString(10,false); + cmd += )\n; + std::string result = getResult(cmd); + APInt r = v1 ^ v2; + std::string apresult = r.toString(10, false); + if (result != apresult) +report(cmd, result,apresult); +} + +void doComplement(const APInt v1) { + std::string cmd; + cmd += bitneg(; + cmd += v1.toString(10,false); + cmd += , + utostr(v1.getBitWidth()) + )\n; + std::string result = getResult(cmd); + APInt r = ~v1; + std::string apresult = r.toString(10, false); + if (result != apresult) +report(v1, ~ , result,apresult); +} + +void doBitTest(const APInt v1) { + for (int i = 0; i v1.getBitWidth(); i++) { +std::string cmd; +cmd += bittest(; +cmd += v1.toString(10,false); +cmd += , + utostr(i) + )\n; +bool gpresult = atoi(getResult(cmd).c_str()); +bool apresult = v1[i]; +if (gpresult != apresult) { + print(v1, false, false); + printf([%d] = %s (not %s)\n, i, +(gpresult?true:false), (apresult?true:false)); + fflush(stdout); +} + } +} + +void doShift(const APInt v1) { + APInt mask = APInt::getAllOnesValue(v1.getBitWidth()); + for (int i = 1; i = v1.getBitWidth(); i++) { +std::string cmd; +cmd += bitand(truncate(shift(; +cmd += v1.toString(10,false); +cmd += , + utostr(unsigned(i)) + )), ; +cmd += bitneg(0, + utostr(unsigned(v1.getBitWidth())) + ))\n; +std::string gpresult = getResult(cmd); +APInt R1 = v1.shl(i); +std::string apresult = R1.toString(10,false); +if (gpresult != apresult) { + print(v1, false, false); + printf( %d = %s (not %s)\n, i, gpresult.c_str(), apresult.c_str()); + fflush(stdout); +} +cmd = bitand(truncate(shift(; +cmd += v1.toString(10,false); +cmd += ,- + utostr(i) + )), ; +cmd += bitneg(0, + utostr(unsigned(v1.getBitWidth())) + ))\n; +gpresult = getResult(cmd); +R1 = v1.lshr(i); +
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.33 - 1.34 --- Log message: 1. Fix last bug in KnuthDiv. All divide tests pass up to 1024 bits now. 2. Clean up comments, style, coding standards, etc. 3. Simplify a constructor. Extended testing revealed some additional bugs in shifting. I'll fix these tomorrow. --- Diffs of the changes: (+54 -62) APInt.cpp | 116 -- 1 files changed, 54 insertions(+), 62 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.33 llvm/lib/Support/APInt.cpp:1.34 --- llvm/lib/Support/APInt.cpp:1.33 Fri Feb 23 21:58:46 2007 +++ llvm/lib/Support/APInt.cpp Sat Feb 24 04:01:42 2007 @@ -2,8 +2,9 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by Sheng Zhou and is distributed under the -// University of Illinois Open Source License. See LICENSE.TXT for details. +// This file was developed by Sheng Zhou and Reid Spencer and is distributed +// under the // University of Illinois Open Source License. See LICENSE.TXT +// for details. // //===--===// // @@ -20,14 +21,13 @@ #include cstring #include cstdlib #ifndef NDEBUG -#include iostream #include iomanip #endif using namespace llvm; // A utility function for allocating memory, checking for allocation failures, -// and ensuring the contents is zeroed. +// and ensuring the contents are zeroed. inline static uint64_t* getClearedMemory(uint32_t numWords) { uint64_t * result = new uint64_t[numWords]; assert(result APInt memory allocation fails!); @@ -36,6 +36,7 @@ } // A utility function for allocating memory and checking for allocation failure. +// The content is not zero'd inline static uint64_t* getMemory(uint32_t numWords) { uint64_t * result = new uint64_t[numWords]; assert(result APInt memory allocation fails!); @@ -60,38 +61,31 @@ assert(BitWidth = IntegerType::MAX_INT_BITS bitwidth too large); assert(bigVal Null pointer detected!); if (isSingleWord()) -VAL = bigVal[0] (~uint64_t(0ULL) (APINT_BITS_PER_WORD - BitWidth)); +VAL = bigVal[0]; else { -pVal = getMemory(getNumWords()); -// Calculate the actual length of bigVal[]. -uint32_t maxN = std::maxuint32_t(numWords, getNumWords()); -uint32_t minN = std::minuint32_t(numWords, getNumWords()); -memcpy(pVal, bigVal, (minN - 1) * APINT_WORD_SIZE); -pVal[minN-1] = bigVal[minN-1] -(~uint64_t(0ULL) - (APINT_BITS_PER_WORD - BitWidth % APINT_BITS_PER_WORD)); -if (maxN == getNumWords()) - memset(pVal+numWords, 0, (getNumWords() - numWords) * APINT_WORD_SIZE); +// Get memory, cleared to 0 +pVal = getClearedMemory(getNumWords()); +// Calculate the number of words to copy +uint32_t words = std::minuint32_t(numWords, getNumWords()); +// Copy the words from bigVal to pVal +memcpy(pVal, bigVal, words * APINT_WORD_SIZE); } + // Make sure unused high bits are cleared + clearUnusedBits(); } -/// @brief Create a new APInt by translating the char array represented -/// integer value. APInt::APInt(uint32_t numbits, const char StrStart[], uint32_t slen, uint8_t radix) : BitWidth(numbits), VAL(0) { fromString(numbits, StrStart, slen, radix); } -/// @brief Create a new APInt by translating the string represented -/// integer value. APInt::APInt(uint32_t numbits, const std::string Val, uint8_t radix) : BitWidth(numbits), VAL(0) { assert(!Val.empty() String empty?); fromString(numbits, Val.c_str(), Val.size(), radix); } -/// @brief Copy constructor APInt::APInt(const APInt that) : BitWidth(that.BitWidth), VAL(0) { if (isSingleWord()) @@ -107,8 +101,6 @@ delete[] pVal; } -/// @brief Copy assignment operator. Create a new object from the given -/// APInt one by initialization. APInt APInt::operator=(const APInt RHS) { assert(BitWidth == RHS.BitWidth Bit widths must be the same); if (isSingleWord()) @@ -118,8 +110,6 @@ return *this; } -/// @brief Assignment operator. Assigns a common case integer value to -/// the APInt. APInt APInt::operator=(uint64_t RHS) { if (isSingleWord()) VAL = RHS; @@ -134,15 +124,13 @@ /// digit integer array, x[]. x[] is modified to reflect the addition and /// 1 is returned if there is a carry out, otherwise 0 is returned. /// @returns the carry of the addition. -static uint64_t add_1(uint64_t dest[], - uint64_t x[], uint32_t len, - uint64_t y) { +static uint64_t add_1(uint64_t dest[], uint64_t x[], uint32_t len, uint64_t y) { for (uint32_t i = 0; i len; ++i) { dest[i] = y + x[i]; if (dest[i] y) - y = 1; + y = 1; // Carry one to next digit. else { - y = 0; + y = 0; // No need to carry so exit early
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.34 - 1.35 --- Log message: 1. Fix a bug in fromString for the = 64bits case 2. Fix shl when shiftAmount == BitWidth. --- Diffs of the changes: (+30 -18) APInt.cpp | 48 ++-- 1 files changed, 30 insertions(+), 18 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.34 llvm/lib/Support/APInt.cpp:1.35 --- llvm/lib/Support/APInt.cpp:1.34 Sat Feb 24 04:01:42 2007 +++ llvm/lib/Support/APInt.cpp Sat Feb 24 14:19:37 2007 @@ -945,24 +945,33 @@ /// Left-shift this APInt by shiftAmt. /// @brief Left-shift function. APInt APInt::shl(uint32_t shiftAmt) const { + assert(shiftAmt = BitWidth Invalid shift amount); APInt API(*this); - if (API.isSingleWord()) -API.VAL = shiftAmt; - else if (shiftAmt = API.BitWidth) -memset(API.pVal, 0, API.getNumWords() * APINT_WORD_SIZE); - else { -if (uint32_t offset = shiftAmt / APINT_BITS_PER_WORD) { - for (uint32_t i = API.getNumWords() - 1; i offset - 1; --i) -API.pVal[i] = API.pVal[i-offset]; - memset(API.pVal, 0, offset * APINT_WORD_SIZE); -} -shiftAmt %= APINT_BITS_PER_WORD; -uint32_t i; -for (i = API.getNumWords() - 1; i 0; --i) - API.pVal[i] = (API.pVal[i] shiftAmt) | -(API.pVal[i-1] (APINT_BITS_PER_WORD - shiftAmt)); -API.pVal[i] = shiftAmt; - } + if (API.isSingleWord()) { +if (shiftAmt == BitWidth) + API.VAL = 0; +else + API.VAL = shiftAmt; +API.clearUnusedBits(); +return API; + } + + if (shiftAmt == BitWidth) { +memset(API.pVal, 0, getNumWords() * APINT_WORD_SIZE); +return API; + } + + if (uint32_t offset = shiftAmt / APINT_BITS_PER_WORD) { +for (uint32_t i = API.getNumWords() - 1; i offset - 1; --i) + API.pVal[i] = API.pVal[i-offset]; +memset(API.pVal, 0, offset * APINT_WORD_SIZE); + } + shiftAmt %= APINT_BITS_PER_WORD; + uint32_t i; + for (i = API.getNumWords() - 1; i 0; --i) +API.pVal[i] = (API.pVal[i] shiftAmt) | + (API.pVal[i-1] (APINT_BITS_PER_WORD - shiftAmt)); + API.pVal[i] = shiftAmt; API.clearUnusedBits(); return API; } @@ -1423,7 +1432,10 @@ *this *= apradix; // Add in the digit we just interpreted -apdigit.pVal[0] = digit; +if (apdigit.isSingleWord()) + apdigit.VAL = digit; +else + apdigit.pVal[0] = digit; *this += apdigit; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp
Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt: gptest.cpp updated: 1.4 - 1.5 --- Log message: Consolidate reporting. Consolidate comparison tests. Fix output for remainder. --- Diffs of the changes: (+24 -56) gptest.cpp | 80 ++--- 1 files changed, 24 insertions(+), 56 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.4 llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.5 --- llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.4 Sat Feb 24 03:51:47 2007 +++ llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp Sat Feb 24 14:20:46 2007 @@ -78,12 +78,6 @@ return getResult(cmd); } - -void report(const std::string cmd, -const std::string result, const std::string apresult) { - printf(%s = %s (not %s)\n, cmd.c_str(), result.c_str(), apresult.c_str()); -} - void report(const APInt v1, const APInt v2, const std::string op, const std::string result, const std::string apresult) { print(v1, false, false); @@ -93,14 +87,6 @@ fflush(stdout); } -void report(const APInt v1, const std::string op, -const std::string result, const std::string apresult) { - printf(op.c_str()); - print(v1, false, false); - printf( = %s (not %s)\n, result.c_str(), apresult.c_str()); - fflush(stdout); -} - void doMultiply(const APInt v1, const APInt v2) { std::string result = getBinop(v1, *, v2); APInt r = v1 * v2; @@ -126,7 +112,7 @@ APInt r = APIntOps::urem(v1, v2); std::string apresult = r.toString(10, false); if (result != apresult) -report(v1,v2, % , result,apresult); +report(v1,v2, %% , result,apresult); } void doAdd(const APInt v1, const APInt v2) { @@ -156,7 +142,7 @@ APInt r = v1 v2; std::string apresult = r.toString(10, false); if (result != apresult) -report(cmd, result,apresult); +report(v1, v2, and , result,apresult); } void doOr(const APInt v1, const APInt v2) { @@ -170,7 +156,7 @@ APInt r = v1 | v2; std::string apresult = r.toString(10, false); if (result != apresult) -report(cmd, result,apresult); +report(v1, v2, or , result,apresult); } void doXor(const APInt v1, const APInt v2) { @@ -184,7 +170,7 @@ APInt r = v1 ^ v2; std::string apresult = r.toString(10, false); if (result != apresult) -report(cmd, result,apresult); +report(v1, v2, xor , result,apresult); } void doComplement(const APInt v1) { @@ -195,8 +181,12 @@ std::string result = getResult(cmd); APInt r = ~v1; std::string apresult = r.toString(10, false); - if (result != apresult) -report(v1, ~ , result,apresult); + if (result != apresult) { +printf(~ ); +print(v1, false, false); +printf( = %s (not %s)\n, result.c_str(), apresult.c_str()); +fflush(stdout); + } } void doBitTest(const APInt v1) { @@ -241,46 +231,19 @@ apresult = R1.toString(10,false); if (gpresult != apresult) { print(v1, false, false); - printf( s %d = %s (not %s)\n, i, gpresult.c_str(), apresult.c_str()); + printf( u %d = %s (not %s)\n, i, gpresult.c_str(), apresult.c_str()); fflush(stdout); } } } -bool getCompare(const APInt v1, const std::string op, -const APInt v2, bool wantSigned = false) { - - std::string cmd = v1.toString(10, wantSigned) + op + -v2.toString(10, wantSigned) + '\n'; - std::string result = getResult(cmd); - return bool(atoi(result.c_str())); -} - -void doComparisons(const APInt v1, const APInt v2) { - bool result = getCompare(v1, ==, v2); - bool apresult = v1 == v2; - if (result != apresult) -report(v1,v2, == , (result?true:false), (apresult?true:false)); - result = getCompare(v1, !=, v2); - apresult = v1 != v2; - if (result != apresult) -report(v1,v2, != , (result?true:false), (apresult?true:false)); - result = getCompare(v1, , v2); - apresult = v1.ult(v2); - if (result != apresult) -report(v1,v2, , (result?true:false), (apresult?true:false)); - result = getCompare(v1, =, v2); - apresult = v1.ule(v2); - if (result != apresult) -report(v1,v2, = , (result?true:false), (apresult?true:false)); - result = getCompare(v1, , v2); - apresult = v1.ugt(v2); - if (result != apresult) -report(v1,v2, , (result?true:false), (apresult?true:false)); - result = getCompare(v1, =, v2); - apresult = v1.uge(v2); - if (result != apresult) -report(v1,v2, = , (result?true:false), (apresult?true:false)); +void doCompare(const APInt v1, const std::string op, +const APInt v2, bool apresult) { + std::string cmd = v1.toString(10, false) + op + +v2.toString(10, false) + '\n'; + bool gpresult = atoi(getResult(cmd).c_str()); + if (gpresult != apresult) +report(v1,v2, op, (apresult?true:false), (apresult?true:false)); } void
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.35 - 1.36 --- Log message: Fix the remainder shifting in KnuthDiv. --- Diffs of the changes: (+13 -6) APInt.cpp | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.35 llvm/lib/Support/APInt.cpp:1.36 --- llvm/lib/Support/APInt.cpp:1.35 Sat Feb 24 14:19:37 2007 +++ llvm/lib/Support/APInt.cpp Sat Feb 24 14:38:01 2007 @@ -1134,12 +1134,19 @@ // The value d is expressed by the shift value above since we avoided // multiplication by d by using a shift left. So, all we have to do is // shift right here. In order to mak -uint32_t carry = 0; -DEBUG(cerr KnuthDiv: remainder:); -for (int i = n-1; i = 0; i--) { - r[i] = (u[i] shift) | carry; - carry = u[i] shift; - DEBUG(cerr r[i]); +if (shift) { + uint32_t carry = 0; + DEBUG(cerr KnuthDiv: remainder:); + for (int i = n-1; i = 0; i--) { +r[i] = (u[i] shift) | carry; +carry = u[i] (32 - shift); +DEBUG(cerr r[i]); + } +} else { + for (int i = n-1; i = 0; i--) { +r[i] = u[i]; +DEBUG(cerr r[i]); + } } DEBUG(cerr '\n'); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp README.txt
Changes in directory llvm/lib/Target/ARM: ARMConstantIslandPass.cpp updated: 1.27 - 1.28 README.txt updated: 1.12 - 1.13 --- Log message: Removed WaterListOffset, inserted BBOffsets. Remove TODO item about this from README. When no water available, use end of block if in range. (More to do here.) --- Diffs of the changes: (+114 -109) ARMConstantIslandPass.cpp | 207 +++--- README.txt| 16 ++- 2 files changed, 114 insertions(+), 109 deletions(-) Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.27 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.28 --- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.27 Thu Feb 22 23:02:36 2007 +++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Sat Feb 24 18:47:03 2007 @@ -4,6 +4,7 @@ // // This file was developed by Chris Lattner and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. +// Substantial modifications by Evan Cheng and Dale Johannesen. // //===--===// // @@ -49,21 +50,19 @@ class VISIBILITY_HIDDEN ARMConstantIslands : public MachineFunctionPass { /// NextUID - Assign unique ID's to CPE's. unsigned NextUID; - + /// BBSizes - The size of each MachineBasicBlock in bytes of code, indexed /// by MBB Number. std::vectorunsigned BBSizes; +/// BBOffsets - the offset of each MBB in bytes, starting from 0. +std::vectorunsigned BBOffsets; + /// WaterList - A sorted list of basic blocks where islands could be placed /// (i.e. blocks that don't fall through to the following block, due /// to a return, unreachable, or unconditional branch). std::vectorMachineBasicBlock* WaterList; -// WaterListOffsets - the offset of the beginning of each WaterList block. -// This is computed as needed in HandleConstantPoolUser; not necessarily -// valid at arbitrary times. -std::vectorunsigned WaterListOffsets; - /// CPUser - One user of a constant pool, keeping the machine instruction /// pointer, the constant pool being referenced, and the max displacement /// allowed from the instruction to the CP. @@ -139,16 +138,17 @@ const std::vectorMachineInstr* CPEMIs); MachineBasicBlock *SplitBlockBeforeInstr(MachineInstr *MI); void UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB); +void AdjustBBOffsetsAfter(MachineBasicBlock *BB, int delta); bool DecrementOldEntry(unsigned CPI, MachineInstr* CPEMI, unsigned Size); -void ComputeWaterListOffsets(MachineFunction Fn); int LookForExistingCPEntry(CPUser U, unsigned UserOffset); bool HandleConstantPoolUser(MachineFunction Fn, CPUser U); bool CPEIsInRange(MachineInstr *MI, unsigned UserOffset, MachineInstr *CPEMI, unsigned Disp, bool DoDump); -bool WaterIsInRange(unsigned UserOffset, -std::vectorMachineBasicBlock*::iterator IP, +bool WaterIsInRange(unsigned UserOffset, MachineBasicBlock *Water, unsigned Disp); +bool OffsetIsInRange(unsigned UserOffset, unsigned TrialOffset, +unsigned Disp, bool NegativeOK); bool BBIsInRange(MachineInstr *MI, MachineBasicBlock *BB, unsigned Disp); bool FixUpImmediateBr(MachineFunction Fn, ImmBranch Br); bool FixUpConditionalBr(MachineFunction Fn, ImmBranch Br); @@ -156,7 +156,6 @@ bool UndoLRSpillRestore(); unsigned GetOffsetOf(MachineInstr *MI) const; -unsigned GetOffsetOf(MachineBasicBlock *MBB) const; }; } @@ -213,6 +212,7 @@ MadeChange |= UndoLRSpillRestore(); BBSizes.clear(); + BBOffsets.clear(); WaterList.clear(); CPUsers.clear(); CPEntries.clear(); @@ -293,6 +293,7 @@ /// and finding all of the constant pool users. void ARMConstantIslands::InitialFunctionScan(MachineFunction Fn, const std::vectorMachineInstr* CPEMIs) { + unsigned Offset = 0; for (MachineFunction::iterator MBBI = Fn.begin(), E = Fn.end(); MBBI != E; ++MBBI) { MachineBasicBlock MBB = *MBBI; @@ -419,6 +420,8 @@ MBBSize += 2; BBSizes.push_back(MBBSize); +BBOffsets.push_back(Offset); +Offset += MBBSize; } } @@ -431,11 +434,7 @@ // The offset is composed of two things: the sum of the sizes of all MBB's // before this instruction's block, and the offset from the start of the block // it is in. - unsigned Offset = 0; - - // Sum block sizes before MBB. - for (unsigned BB = 0, e = MBB-getNumber(); BB != e; ++BB) -Offset += BBSizes[BB]; + unsigned Offset = BBOffsets[MBB-getNumber()]; // Sum instructions before MI in MBB. for (MachineBasicBlock::iterator I = MBB-begin(); ; ++I) { @@ -445,18 +444,6 @@ } } -/// GetOffsetOf - Return the
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.36 - 1.37 --- Log message: Fix the 64 bits case for left shift. --- Diffs of the changes: (+52 -27) APInt.cpp | 79 -- 1 files changed, 52 insertions(+), 27 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.36 llvm/lib/Support/APInt.cpp:1.37 --- llvm/lib/Support/APInt.cpp:1.36 Sat Feb 24 14:38:01 2007 +++ llvm/lib/Support/APInt.cpp Sat Feb 24 18:56:44 2007 @@ -946,34 +946,59 @@ /// @brief Left-shift function. APInt APInt::shl(uint32_t shiftAmt) const { assert(shiftAmt = BitWidth Invalid shift amount); - APInt API(*this); - if (API.isSingleWord()) { + if (isSingleWord()) { if (shiftAmt == BitWidth) - API.VAL = 0; -else - API.VAL = shiftAmt; -API.clearUnusedBits(); -return API; - } - - if (shiftAmt == BitWidth) { -memset(API.pVal, 0, getNumWords() * APINT_WORD_SIZE); -return API; - } - - if (uint32_t offset = shiftAmt / APINT_BITS_PER_WORD) { -for (uint32_t i = API.getNumWords() - 1; i offset - 1; --i) - API.pVal[i] = API.pVal[i-offset]; -memset(API.pVal, 0, offset * APINT_WORD_SIZE); - } - shiftAmt %= APINT_BITS_PER_WORD; - uint32_t i; - for (i = API.getNumWords() - 1; i 0; --i) -API.pVal[i] = (API.pVal[i] shiftAmt) | - (API.pVal[i-1] (APINT_BITS_PER_WORD - shiftAmt)); - API.pVal[i] = shiftAmt; - API.clearUnusedBits(); - return API; + return APInt(BitWidth, 0); // avoid undefined shift results +return APInt(BitWidth, (VAL shiftAmt) + (~uint64_t(0ULL) +(APINT_BITS_PER_WORD - BitWidth))); + } + + // If all the bits were shifted out, the result is 0. This avoids issues + // with shifting by the size of the integer type, which produces undefined + // results. We define these undefined results to always be 0. + if (shiftAmt == BitWidth) +return APInt(BitWidth, 0); + + // Create some space for the result. + uint64_t * val = new uint64_t[getNumWords()]; + + // If we are shifting less than a word, do it the easy way + if (shiftAmt APINT_BITS_PER_WORD) { +uint64_t carry = 0; +shiftAmt %= APINT_BITS_PER_WORD; +for (uint32_t i = 0; i getNumWords(); i++) { + val[i] = pVal[i] shiftAmt | carry; + carry = pVal[i] (APINT_BITS_PER_WORD - shiftAmt); +} +val[getNumWords()-1] = ~uint64_t(0ULL) (APINT_BITS_PER_WORD - BitWidth); +return APInt(val, BitWidth); + } + + // Compute some values needed by the remaining shift algorithms + uint32_t wordShift = shiftAmt % APINT_BITS_PER_WORD; + uint32_t offset = shiftAmt / APINT_BITS_PER_WORD; + + // If we are shifting whole words, just move whole words + if (wordShift == 0) { +for (uint32_t i = 0; i offset; i++) + val[i] = 0; +for (uint32_t i = offset; i getNumWords(); i++) + val[i] = pVal[i-offset]; +val[getNumWords()-1] = ~uint64_t(0ULL) (APINT_BITS_PER_WORD - BitWidth); +return APInt(val,BitWidth); + } + + // Copy whole words from this to Result. + uint32_t i = getNumWords() - 1; + for (; i offset; --i) +val[i] = pVal[i-offset] wordShift | + pVal[i-offset-1] (APINT_BITS_PER_WORD - wordShift); + val[offset] = pVal[offset-1] wordShift; + for (i = 0; i offset; ++i) +val[i] = 0; + val[getNumWords()-1] = ~uint64_t(0ULL) (APINT_BITS_PER_WORD - BitWidth); + return APInt(val, BitWidth); } /// Implementation of Knuth's Algorithm D (Division of nonnegative integers) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.37 - 1.38 --- Log message: Whoops, last word with bits in large shift left wasn't correct. --- Diffs of the changes: (+1 -1) APInt.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.37 llvm/lib/Support/APInt.cpp:1.38 --- llvm/lib/Support/APInt.cpp:1.37 Sat Feb 24 18:56:44 2007 +++ llvm/lib/Support/APInt.cpp Sat Feb 24 19:08:58 2007 @@ -994,7 +994,7 @@ for (; i offset; --i) val[i] = pVal[i-offset] wordShift | pVal[i-offset-1] (APINT_BITS_PER_WORD - wordShift); - val[offset] = pVal[offset-1] wordShift; + val[offset] = pVal[0] wordShift; for (i = 0; i offset; ++i) val[i] = 0; val[getNumWords()-1] = ~uint64_t(0ULL) (APINT_BITS_PER_WORD - BitWidth); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [124287] Fix PR1221, which is subtle fallout from the symtab change.
Revision: 124287 Author: clattner Date: 2007-02-24 17:23:21 -0800 (Sat, 24 Feb 2007) Log Message: --- Fix PR1221, which is subtle fallout from the symtab change. getName().c_str() now cannot be used, because the string returned by getName() is temporary and is destroyed when the expression is fully evaluated. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-backend.cpp Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp === --- apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-02-24 22:46:38 UTC (rev 124286) +++ apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-02-25 01:23:21 UTC (rev 124287) @@ -45,6 +45,7 @@ #include llvm/Analysis/LoadValueNumbering.h #include llvm/Transforms/IPO.h #include llvm/ADT/StringExtras.h +#include llvm/ADT/StringMap.h #include llvm/Support/Streams.h #include llvm/Support/ManagedStatic.h #include cassert @@ -860,7 +861,7 @@ /// llvm_get_decl_name - Used by varasm.c, returns the specified declaration's /// name. const char *llvm_get_decl_name(void *LLVM) { - return ((Value*)LLVM)-getName().c_str(); + return ((Value*)LLVM)-getValueName()-getKeyData(); } // llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.94 - 1.95 --- Log message: initialize a instance variable --- Diffs of the changes: (+1 -0) TargetLowering.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.94 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.95 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.94 Fri Feb 23 20:09:29 2007 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppSat Feb 24 19:28:05 2007 @@ -148,6 +148,7 @@ allowUnalignedMemoryAccesses = false; UseUnderscoreSetJmp = false; UseUnderscoreLongJmp = false; + SelectIsExpensive = false; IntDivIsCheap = false; Pow2DivIsCheap = false; StackPointerRegisterToSaveRestore = 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
Changes in directory llvm/lib/Target/ARM: ARMConstantIslandPass.cpp updated: 1.28 - 1.29 --- Log message: remove crediting of Evan Cheng and me. --- Diffs of the changes: (+0 -1) ARMConstantIslandPass.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.28 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.29 --- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.28 Sat Feb 24 18:47:03 2007 +++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Sat Feb 24 19:42:36 2007 @@ -4,7 +4,6 @@ // // This file was developed by Chris Lattner and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// Substantial modifications by Evan Cheng and Dale Johannesen. // //===--===// // ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.38 - 1.39 --- Log message: Clean up lshr and ashr to coding standards. Handle the single word cases for shiftAmt == BitWidth. --- Diffs of the changes: (+79 -53) APInt.cpp | 132 +- 1 files changed, 79 insertions(+), 53 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.38 llvm/lib/Support/APInt.cpp:1.39 --- llvm/lib/Support/APInt.cpp:1.38 Sat Feb 24 19:08:58 2007 +++ llvm/lib/Support/APInt.cpp Sat Feb 24 19:56:07 2007 @@ -894,52 +894,59 @@ /// Arithmetic right-shift this APInt by shiftAmt. /// @brief Arithmetic right-shift function. APInt APInt::ashr(uint32_t shiftAmt) const { - APInt API(*this); - if (API.isSingleWord()) -API.VAL = - (((int64_t(API.VAL) (APINT_BITS_PER_WORD - API.BitWidth)) - (APINT_BITS_PER_WORD - API.BitWidth)) shiftAmt) - (~uint64_t(0UL) (APINT_BITS_PER_WORD - API.BitWidth)); - else { -if (shiftAmt = API.BitWidth) { - memset(API.pVal, API[API.BitWidth-1] ? 1 : 0, - (API.getNumWords()-1) * APINT_WORD_SIZE); - API.pVal[API.getNumWords() - 1] = -~uint64_t(0UL) - (APINT_BITS_PER_WORD - API.BitWidth % APINT_BITS_PER_WORD); -} else { - uint32_t i = 0; - for (; i API.BitWidth - shiftAmt; ++i) -if (API[i+shiftAmt]) - API.set(i); -else - API.clear(i); - for (; i API.BitWidth; ++i) -if (API[API.BitWidth-1]) - API.set(i); -else API.clear(i); -} + if (isSingleWord()) { +if (shiftAmt == BitWidth) + return APInt(BitWidth, -1ull); +else + return APInt(BitWidth, +(((int64_t(VAL) (APINT_BITS_PER_WORD - BitWidth)) +(APINT_BITS_PER_WORD - BitWidth)) shiftAmt) +(~uint64_t(0UL) (APINT_BITS_PER_WORD - BitWidth))); + } + + APInt Result(*this); + if (shiftAmt = BitWidth) { +memset(Result.pVal, Result[BitWidth-1] ? 1 : 0, + (getNumWords()-1) * APINT_WORD_SIZE); +Result.pVal[getNumWords() - 1] = ~uint64_t(0UL) +(APINT_BITS_PER_WORD - BitWidth % APINT_BITS_PER_WORD); + } else { +uint32_t i = 0; +for (; i BitWidth - shiftAmt; ++i) + if (Result[i+shiftAmt]) +Result.set(i); + else +Result.clear(i); +for (; i BitWidth; ++i) + if (Result[BitWidth-1]) +Result.set(i); + else +Result.clear(i); } - return API; + return Result; } /// Logical right-shift this APInt by shiftAmt. /// @brief Logical right-shift function. APInt APInt::lshr(uint32_t shiftAmt) const { - APInt API(*this); - if (API.isSingleWord()) -API.VAL = shiftAmt; - else { -if (shiftAmt = API.BitWidth) - memset(API.pVal, 0, API.getNumWords() * APINT_WORD_SIZE); -uint32_t i = 0; -for (i = 0; i API.BitWidth - shiftAmt; ++i) - if (API[i+shiftAmt]) API.set(i); - else API.clear(i); -for (; i API.BitWidth; ++i) - API.clear(i); - } - return API; + if (isSingleWord()) +if (shiftAmt == BitWidth) + return APInt(BitWidth, 0); +else + return APInt(BitWidth, this-VAL shiftAmt); + + APInt Result(*this); + if (shiftAmt = Result.BitWidth) +memset(Result.pVal, 0, Result.getNumWords() * APINT_WORD_SIZE); + uint32_t i = 0; + for (i = 0; i Result.BitWidth - shiftAmt; ++i) +if (Result[i+shiftAmt]) + Result.set(i); +else + Result.clear(i); + for (; i Result.BitWidth; ++i) +Result.clear(i); + return Result; } /// Left-shift this APInt by shiftAmt. @@ -1197,8 +1204,29 @@ uint64_t mask = ~0ull (sizeof(uint32_t)*8); uint32_t n = rhsWords * 2; uint32_t m = (lhsWords * 2) - n; - // FIXME: allocate space on stack if m and n are sufficiently small. - uint32_t *U = new uint32_t[m + n + 1]; + + // Allocate space for the temporary values we need either on the stack, if + // it will fit, or on the heap if it won't. + uint32_t SPACE[128]; + uint32_t *U = 0; + uint32_t *V = 0; + uint32_t *Q = 0; + uint32_t *R = 0; + if ((Remainder?4:3)*n+2*m+1 = 128) { +U = SPACE[0]; +V = SPACE[m+n+1]; +Q = SPACE[(m+n+1) + n]; +if (Remainder) + R = SPACE[(m+n+1) + n + (m+n)]; + } else { +U = new uint32_t[m + n + 1]; +V = new uint32_t[n]; +Q = new uint32_t[m+n]; +if (Remainder) + R = new uint32_t[n]; + } + + // Initialize the dividend memset(U, 0, (m+n+1)*sizeof(uint32_t)); for (unsigned i = 0; i lhsWords; ++i) { uint64_t tmp = (LHS.getNumWords() == 1 ? LHS.VAL : LHS.pVal[i]); @@ -1207,7 +1235,7 @@ } U[m+n] = 0; // this extra word is for spill in the Knuth algorithm. - uint32_t *V = new uint32_t[n]; + // Initialize the divisor memset(V, 0, (n)*sizeof(uint32_t)); for (unsigned i = 0; i rhsWords; ++i) { uint64_t tmp = (RHS.getNumWords() == 1 ? RHS.VAL : RHS.pVal[i]); @@ -1215,14 +1243,10 @@ V[i * 2 + 1] =
Re: [llvm-commits] CVS: llvm/lib/Support/APInt.cpp
/ Clean up the memory we allocated. - delete [] U; - delete [] V; - delete [] Q; - delete [] R; + if (U != SPACE[0]) { +delete [] U; +delete [] V; +delete [] Q; +delete [] R; + } } Please just use SmallVectoruint32, N instead of explicitly doing it yourself. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/LICENSE.TXT
Changes in directory llvm: LICENSE.TXT updated: 1.29 - 1.30 --- Log message: remove these. --- Diffs of the changes: (+0 -1) LICENSE.TXT |1 - 1 files changed, 1 deletion(-) Index: llvm/LICENSE.TXT diff -u llvm/LICENSE.TXT:1.29 llvm/LICENSE.TXT:1.30 --- llvm/LICENSE.TXT:1.29 Thu Jan 18 15:22:36 2007 +++ llvm/LICENSE.TXTSat Feb 24 20:28:21 2007 @@ -63,7 +63,6 @@ --- - System Library llvm/lib/System Compiler Driver llvm/tools/llvmc -PowerPC Backend llvm/lib/Target/PowerPC bzip2 llvm/lib/Support/bzip2/LICENSE Autoconfllvm/autoconf llvm/projects/ModuleMaker/autoconf ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.39 - 1.40 --- Log message: this doesn't compile, disable it --- Diffs of the changes: (+4 -0) APInt.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.39 llvm/lib/Support/APInt.cpp:1.40 --- llvm/lib/Support/APInt.cpp:1.39 Sat Feb 24 19:56:07 2007 +++ llvm/lib/Support/APInt.cpp Sat Feb 24 20:32:44 2007 @@ -26,6 +26,8 @@ using namespace llvm; +#if 0 + // A utility function for allocating memory, checking for allocation failures, // and ensuring the contents are zeroed. inline static uint64_t* getClearedMemory(uint32_t numWords) { @@ -1587,3 +1589,5 @@ cerr ( this-toString(10, false) )\n std::setbase(10); } #endif + +#endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCJITInfo.cpp PPCSubtarget.h PPCTargetMachine.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCJITInfo.cpp updated: 1.36 - 1.37 PPCSubtarget.h updated: 1.24 - 1.25 PPCTargetMachine.cpp updated: 1.116 - 1.117 --- Log message: Improve JIT support for linux/ppc: Patch by Nicolas Geoffray! --- Diffs of the changes: (+70 -2) PPCJITInfo.cpp | 65 +++ PPCSubtarget.h |3 ++ PPCTargetMachine.cpp |4 +-- 3 files changed, 70 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.36 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.37 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.36 Mon Dec 11 12:10:54 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Sat Feb 24 23:04:13 2007 @@ -134,6 +134,71 @@ mtlr r2\n bctr\n ); + +#elif defined(__PPC__) !defined(__ppc64__) +// Linux/PPC support + +// CompilationCallback stub - We can't use a C function with inline assembly in +// it, because we the prolog/epilog inserted by GCC won't work for us. Instead, +// write our own wrapper, which does things our way, so we have complete control +// over register saving and restoring. +asm( +.text\n +.align 2\n +.globl PPC32CompilationCallback\n +PPC32CompilationCallback:\n +// Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the +// FIXME: need to save v[0-19] for altivec? +// FIXME: could shrink frame +// Set up a proper stack frame +// FIXME Layout +// PowerPC64 ABI linkage- 24 bytes +// parameters - 32 bytes +// 13 double registers - 104 bytes +// 8 int registers - 32 bytes +mflr 0\n +stw 0, 4(1)\n +stwu 1, -180(1)\n +// Save all int arg registers +stw 10, 176(1)\nstw 9, 172(1)\n +stw 8, 168(1)\nstw 7, 164(1)\n +stw 6, 160(1)\nstw 5, 156(1)\n +stw 4, 152(1)\nstw 3, 148(1)\n +// Save all call-clobbered FP regs. +stfd 10, 144(1)\n +stfd 9, 136(1)\n stfd 8, 128(1)\n +stfd 7, 120(1)\n stfd 6, 112(1)\n +stfd 5, 104(1)\n stfd 4, 96(1)\n +stfd 3, 88(1)\n stfd 2, 80(1)\n +stfd 1, 72(1)\n +// Arguments to Compilation Callback: +// r3 - our lr (address of the call instruction in stub plus 4) +// r4 - stub's lr (address of instruction that called the stub plus 4) +// r5 - is64Bit - always 0. +mr 3, 0\n +lwz 11, 180(1)\n // stub's frame +lwz 4, 4(11)\n // stub's lr +li 5, 0\n // 0 == 32 bit +bl PPCCompilationCallbackC\n +mtctr 3\n +// Restore all int arg registers +lwz 10, 176(1)\nlwz 9, 172(1)\n +lwz 8, 168(1)\nlwz 7, 164(1)\n +lwz 6, 160(1)\nlwz 5, 156(1)\n +lwz 4, 152(1)\nlwz 3, 148(1)\n +// Restore all FP arg registers +lfd 10, 144(1)\n +lfd 9, 136(1)\nlfd 8, 128(1)\n +lfd 7, 120(1)\nlfd 6, 112(1)\n +lfd 5, 104(1)\nlfd 4, 96(1)\n +lfd 3, 88(1)\nlfd 2, 80(1)\n +lfd 1, 72(1)\n +// Pop 3 frames off the stack and branch to target +lwz 1, 184(1)\n +lwz 11, 4(1)\n +mtlr 11\n +bctr\n +); #else void PPC32CompilationCallback() { assert(0 This is not a power pc, you can't execute this!); Index: llvm/lib/Target/PowerPC/PPCSubtarget.h diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.24 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.25 --- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.24 Tue Feb 13 23:52:17 2007 +++ llvm/lib/Target/PowerPC/PPCSubtarget.h Sat Feb 24 23:04:13 2007 @@ -134,6 +134,9 @@ bool isDarwin() const { return IsDarwin; } + bool isMachoABI() const { return IsDarwin; } + bool isELF_ABI() const { return !IsDarwin; } + unsigned getAsmFlavor() const { return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0; } Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.116 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.117 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.116 Wed Feb 7 19:39:44 2007 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cppSat Feb 24 23:04:13 2007 @@ -35,14 +35,14 @@ } unsigned PPC32TargetMachine::getJITMatchQuality() { -#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) +#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__) if (sizeof(void*) == 4) return 10; #endif return 0; } unsigned PPC64TargetMachine::getJITMatchQuality() { -#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) +#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__) if (sizeof(void*) == 8) return 10; #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrFormats.td
Changes in directory llvm/lib/Target/PowerPC: PPCInstrFormats.td updated: 1.88 - 1.89 --- Log message: Add XLForm_1_ext template, patch by Nicolas Geoffray. --- Diffs of the changes: (+24 -14) PPCInstrFormats.td | 38 -- 1 files changed, 24 insertions(+), 14 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrFormats.td diff -u llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.88 llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.89 --- llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.88 Wed Dec 6 15:35:10 2006 +++ llvm/lib/Target/PowerPC/PPCInstrFormats.td Sat Feb 24 23:07:49 2007 @@ -349,21 +349,31 @@ // 1.7.7 XL-Form class XLForm_1bits6 opcode, bits10 xo, dag OL, string asmstr, - InstrItinClass itin + InstrItinClass itin, listdag pattern +: Iopcode, OL, asmstr, itin { + bits5 CRD; + bits5 CRA; + bits5 CRB; + + let Pattern = pattern; + + let Inst{6-10} = CRD; + let Inst{11-15} = CRA; + let Inst{16-20} = CRB; + let Inst{21-30} = xo; + let Inst{31}= 0; +} + +class XLForm_1_extbits6 opcode, bits10 xo, dag OL, string asmstr, + InstrItinClass itin, listdag pattern : Iopcode, OL, asmstr, itin { - bits3 CRD; - bits2 CRDb; - bits3 CRA; - bits2 CRAb; - bits3 CRB; - bits2 CRBb; - - let Inst{6-8} = CRD; - let Inst{9-10} = CRDb; - let Inst{11-13} = CRA; - let Inst{14-15} = CRAb; - let Inst{16-18} = CRB; - let Inst{19-20} = CRBb; + bits5 CRD; + + let Pattern = pattern; + + let Inst{6-10} = CRD; + let Inst{11-15} = CRD; + let Inst{16-20} = CRD; let Inst{21-30} = xo; let Inst{31}= 0; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp PPCFrameInfo.h PPCHazardRecognizers.cpp PPCISelLowering.cpp PPCISelLowering.h PPCInstr64Bit.td PPCInstrInfo.td PPCRegisterInfo.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCCodeEmitter.cpp updated: 1.74 - 1.75 PPCFrameInfo.h updated: 1.12 - 1.13 PPCHazardRecognizers.cpp updated: 1.18 - 1.19 PPCISelLowering.cpp updated: 1.253 - 1.254 PPCISelLowering.h updated: 1.58 - 1.59 PPCInstr64Bit.td updated: 1.38 - 1.39 PPCInstrInfo.td updated: 1.272 - 1.273 PPCRegisterInfo.cpp updated: 1.111 - 1.112 --- Log message: implement support for the linux/ppc function call ABI. Patch by Nicolas Geoffray! --- Diffs of the changes: (+343 -102) PPCCodeEmitter.cpp |7 +- PPCFrameInfo.h | 50 +++ PPCHazardRecognizers.cpp |2 PPCISelLowering.cpp | 149 ++- PPCISelLowering.h|2 PPCInstr64Bit.td | 44 +++-- PPCInstrInfo.td | 64 PPCRegisterInfo.cpp | 127 8 files changed, 343 insertions(+), 102 deletions(-) Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.74 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.75 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.74 Fri Dec 15 10:44:10 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Sat Feb 24 23:34:32 2007 @@ -133,7 +133,8 @@ } else if (MO.isGlobalAddress() || MO.isExternalSymbol() || MO.isConstantPoolIndex() || MO.isJumpTableIndex()) { unsigned Reloc = 0; -if (MI.getOpcode() == PPC::BL || MI.getOpcode() == PPC::BL8) +if (MI.getOpcode() == PPC::BL_Macho || MI.getOpcode() == PPC::BL8_Macho || +MI.getOpcode() == PPC::BL_ELF || MI.getOpcode() == PPC::BL8_ELF) Reloc = PPC::reloc_pcrel_bx; else { if (TM.getRelocationModel() == Reloc::PIC_) { @@ -213,7 +214,9 @@ } else if (MO.isMachineBasicBlock()) { unsigned Reloc = 0; unsigned Opcode = MI.getOpcode(); -if (Opcode == PPC::B || Opcode == PPC::BL || Opcode == PPC::BLA) +if (Opcode == PPC::B || Opcode == PPC::BL_Macho || +Opcode == PPC::BLA_Macho || Opcode == PPC::BL_ELF || +Opcode == PPC::BLA_ELF) Reloc = PPC::reloc_pcrel_bx; else // BCC instruction Reloc = PPC::reloc_pcrel_bcx; Index: llvm/lib/Target/PowerPC/PPCFrameInfo.h diff -u llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.12 llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.13 --- llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.12 Wed Dec 6 11:42:06 2006 +++ llvm/lib/Target/PowerPC/PPCFrameInfo.h Sat Feb 24 23:34:32 2007 @@ -29,41 +29,61 @@ /// getReturnSaveOffset - Return the previous frame offset to save the /// return address. - static unsigned getReturnSaveOffset(bool LP64) { -return LP64 ? 16 : 8; + static unsigned getReturnSaveOffset(bool LP64, bool isMacho) { +if (isMacho) + return LP64 ? 16 : 8; +// For ELF ABI: +return LP64 ? 8 : 4; } /// getFramePointerSaveOffset - Return the previous frame offset to save the /// frame pointer. - static unsigned getFramePointerSaveOffset(bool LP64) { + static unsigned getFramePointerSaveOffset(bool LP64, bool isMacho) { +// For MachO ABI: // Use the TOC save slot in the PowerPC linkage area for saving the frame // pointer (if needed.) LLVM does not generate code that uses the TOC (R2 // is treated as a caller saved register.) -return LP64 ? 40 : 20; +if (isMacho) + return LP64 ? 40 : 20; + +// For ELF ABI: +// Save it right before the link register +return LP64 ? -8 : -4; } /// getLinkageSize - Return the size of the PowerPC ABI linkage area. /// - static unsigned getLinkageSize(bool LP64) { -return 6 * (LP64 ? 8 : 4); + static unsigned getLinkageSize(bool LP64, bool isMacho) { +if (isMacho) + return 6 * (LP64 ? 8 : 4); + +// For ELF ABI: +return LP64 ? 16 : 8; } /// getMinCallArgumentsSize - Return the size of the minium PowerPC ABI /// argument area. - static unsigned getMinCallArgumentsSize(bool LP64) { - // The prolog code of the callee may store up to 8 GPR argument registers to - // the stack, allowing va_start to index over them in memory if its varargs. - // Because we cannot tell if this is needed on the caller side, we have to - // conservatively assume that it is needed. As such, make sure we have at - // least enough stack space for the caller to store the 8 GPRs. -return 8 * (LP64 ? 8 : 4); + static unsigned getMinCallArgumentsSize(bool LP64, bool isMacho) { +// For Macho ABI: +// The prolog code of the callee may store up to 8 GPR argument registers to +// the stack, allowing va_start to index over them in memory if its varargs. +// Because we cannot tell if this is needed on the caller side, we have to +// conservatively assume that it is needed. As such, make sure we have at +// least enough stack space for the caller to store the 8 GPRs. +if (isMacho) + return 8 * (LP64 ? 8 : 4); + +
[llvm-commits] CVS: llvm/test/CodeGen/X86/i128-ret.ll
Changes in directory llvm/test/CodeGen/X86: i128-ret.ll added (r1.1) --- Log message: verify i128 return on x86-64 continues to codegen optimally. --- Diffs of the changes: (+8 -0) i128-ret.ll |8 1 files changed, 8 insertions(+) Index: llvm/test/CodeGen/X86/i128-ret.ll diff -c /dev/null llvm/test/CodeGen/X86/i128-ret.ll:1.1 *** /dev/null Sun Feb 25 00:06:59 2007 --- llvm/test/CodeGen/X86/i128-ret.ll Sun Feb 25 00:06:49 2007 *** *** 0 --- 1,8 + ; RUN: llvm-as %s | llc -march=x86-64 | grep 'movq 8(%rdi), %rdx' + ; RUN: llvm-as %s | llc -march=x86-64 | grep 'movq (%rdi), %rax' + + define i128 @test(i128 *%P) { + %A = load i128* %P + ret i128 %A + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.323 - 1.324 --- Log message: remove std::vector's in RET lowering. --- Diffs of the changes: (+11 -22) X86ISelLowering.cpp | 33 +++-- 1 files changed, 11 insertions(+), 22 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.323 llvm/lib/Target/X86/X86ISelLowering.cpp:1.324 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.323 Thu Feb 22 08:56:36 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sun Feb 25 00:21:57 2007 @@ -4014,13 +4014,9 @@ if (DAG.getMachineFunction().liveout_empty()) DAG.getMachineFunction().addLiveOut(X86::ST0); -std::vectorMVT::ValueType Tys; -Tys.push_back(MVT::Other); -Tys.push_back(MVT::Flag); -std::vectorSDOperand Ops; -Ops.push_back(Op.getOperand(0)); -Ops.push_back(Op.getOperand(1)); -Copy = DAG.getNode(X86ISD::FP_SET_RESULT, Tys, Ops[0], Ops.size()); +SDVTList Tys = DAG.getVTList(MVT::Other, MVT::Flag); +SDOperand Ops[] = { Op.getOperand(0), Op.getOperand(1) }; +Copy = DAG.getNode(X86ISD::FP_SET_RESULT, Tys, Ops, 2); } else { // FP return with ScalarSSE (return on fp-stack). if (DAG.getMachineFunction().liveout_empty()) @@ -4042,21 +4038,14 @@ MemLoc = DAG.getFrameIndex(SSFI, getPointerTy()); Chain = DAG.getStore(Op.getOperand(0), Value, MemLoc, NULL, 0); } -std::vectorMVT::ValueType Tys; -Tys.push_back(MVT::f64); -Tys.push_back(MVT::Other); -std::vectorSDOperand Ops; -Ops.push_back(Chain); -Ops.push_back(MemLoc); -Ops.push_back(DAG.getValueType(ArgVT)); -Copy = DAG.getNode(X86ISD::FLD, Tys, Ops[0], Ops.size()); -Tys.clear(); -Tys.push_back(MVT::Other); -Tys.push_back(MVT::Flag); -Ops.clear(); -Ops.push_back(Copy.getValue(1)); -Ops.push_back(Copy); -Copy = DAG.getNode(X86ISD::FP_SET_RESULT, Tys, Ops[0], Ops.size()); +SDVTList Tys = DAG.getVTList(MVT::f64, MVT::Other); +SDOperand Ops[] = { Chain, MemLoc, DAG.getValueType(ArgVT) }; +Copy = DAG.getNode(X86ISD::FLD, Tys, Ops, 3); + +Tys = DAG.getVTList(MVT::Other, MVT::Flag); +Ops[0] = Copy.getValue(1); +Ops[1] = Copy; +Copy = DAG.getNode(X86ISD::FP_SET_RESULT, Tys, Ops, 2); } break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.324 - 1.325 --- Log message: eliminate temporary vectors created during X86 lowering. --- Diffs of the changes: (+47 -70) X86ISelLowering.cpp | 117 1 files changed, 47 insertions(+), 70 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.324 llvm/lib/Target/X86/X86ISelLowering.cpp:1.325 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.324 Sun Feb 25 00:21:57 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sun Feb 25 00:40:16 2007 @@ -815,9 +815,8 @@ } else if (ExternalSymbolSDNode *S = dyn_castExternalSymbolSDNode(Callee)) Callee = DAG.getTargetExternalSymbol(S-getSymbol(), getPointerTy()); - std::vectorMVT::ValueType NodeTys; - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag);// Returns a flag for retval copy to use. + // Returns a chain a flag for retval copy to use. + SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); std::vectorSDOperand Ops; Ops.push_back(Chain); Ops.push_back(Callee); @@ -856,10 +855,10 @@ NumBytesForCalleeToPush = NumSRetBytes; } - NodeTys.clear(); - NodeTys.push_back(MVT::Other); // Returns a chain if (RetVT != MVT::Other) -NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. +NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); + else +NodeTys = DAG.getVTList(MVT::Other); Ops.clear(); Ops.push_back(Chain); Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); @@ -870,19 +869,18 @@ InFlag = Chain.getValue(1); std::vectorSDOperand ResultVals; - NodeTys.clear(); switch (RetVT) { default: assert(0 Unknown value type to return!); case MVT::Other: break; case MVT::i8: Chain = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag).getValue(1); ResultVals.push_back(Chain.getValue(0)); -NodeTys.push_back(MVT::i8); +NodeTys = DAG.getVTList(MVT::i8, MVT::Other); break; case MVT::i16: Chain = DAG.getCopyFromReg(Chain, X86::AX, MVT::i16, InFlag).getValue(1); ResultVals.push_back(Chain.getValue(0)); -NodeTys.push_back(MVT::i16); +NodeTys = DAG.getVTList(MVT::i16, MVT::Other); break; case MVT::i32: if (Op.Val-getValueType(1) == MVT::i32) { @@ -891,12 +889,12 @@ Chain = DAG.getCopyFromReg(Chain, X86::EDX, MVT::i32, Chain.getValue(2)).getValue(1); ResultVals.push_back(Chain.getValue(0)); - NodeTys.push_back(MVT::i32); + NodeTys = DAG.getVTList(MVT::i32, MVT::i32, MVT::Other); } else { Chain = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag).getValue(1); ResultVals.push_back(Chain.getValue(0)); + NodeTys = DAG.getVTList(MVT::i32, MVT::Other); } -NodeTys.push_back(MVT::i32); break; case MVT::v16i8: case MVT::v8i16: @@ -907,7 +905,7 @@ assert(!isStdCall Unknown value type to return!); Chain = DAG.getCopyFromReg(Chain, X86::XMM0, RetVT, InFlag).getValue(1); ResultVals.push_back(Chain.getValue(0)); -NodeTys.push_back(RetVT); +NodeTys = DAG.getVTList(RetVT, MVT::Other); break; case MVT::f32: case MVT::f64: { @@ -947,7 +945,7 @@ // operation is okay to eliminate if we allow excess FP precision. RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); ResultVals.push_back(RetVal); -NodeTys.push_back(RetVT); +NodeTys = DAG.getVTList(RetVT, MVT::Other); break; } } @@ -957,7 +955,6 @@ return Chain; // Otherwise, merge everything together with a MERGE_VALUES node. - NodeTys.push_back(MVT::Other); ResultVals.push_back(Chain); SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, ResultVals[0], ResultVals.size()); @@ -1367,9 +1364,8 @@ } else if (ExternalSymbolSDNode *S = dyn_castExternalSymbolSDNode(Callee)) Callee = DAG.getTargetExternalSymbol(S-getSymbol(), getPointerTy()); - std::vectorMVT::ValueType NodeTys; - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag);// Returns a flag for retval copy to use. + // Returns a chain a flag for retval copy to use. + SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); std::vectorSDOperand Ops; Ops.push_back(Chain); Ops.push_back(Callee); @@ -1388,10 +1384,11 @@ NodeTys, Ops[0], Ops.size()); InFlag = Chain.getValue(1); - NodeTys.clear(); - NodeTys.push_back(MVT::Other); // Returns a chain if (RetVT != MVT::Other) -NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. +// Returns a flag for retval copy to use. +NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); + else +NodeTys = DAG.getVTList(MVT::Other); Ops.clear(); Ops.push_back(Chain); Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); @@
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.325 - 1.326 --- Log message: eliminate a bunch more temporary vectors from X86 lowering. --- Diffs of the changes: (+141 -176) X86ISelLowering.cpp | 317 +++- 1 files changed, 141 insertions(+), 176 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.325 llvm/lib/Target/X86/X86ISelLowering.cpp:1.326 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.325 Sun Feb 25 00:40:16 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sun Feb 25 01:10:00 2007 @@ -520,7 +520,7 @@ MachineFunction MF = DAG.getMachineFunction(); MachineFrameInfo *MFI = MF.getFrameInfo(); SDOperand Root = Op.getOperand(0); - std::vectorSDOperand ArgValues; + SmallVectorSDOperand, 8 ArgValues; bool isVarArg = castConstantSDNode(Op.getOperand(2))-getValue() != 0; // Add DAG nodes to load the arguments... On entry to a function on the X86, @@ -549,8 +549,8 @@ }; // Handle regparm attribute - std::vectorbool ArgInRegs(NumArgs, false); - std::vectorbool SRetArgs(NumArgs, false); + SmallVectorbool, 8 ArgInRegs(NumArgs, false); + SmallVectorbool, 8 SRetArgs(NumArgs, false); if (!isVarArg) { for (unsigned i = 0; iNumArgs; ++i) { unsigned Flags = castConstantSDNode(Op.getOperand(3+i))-getValue(); @@ -642,9 +642,8 @@ MF.getInfoX86FunctionInfo()-setBytesToPopOnReturn(BytesToPopOnReturn); // Return the new list of results. - std::vectorMVT::ValueType RetVTs(Op.Val-value_begin(), - Op.Val-value_end()); - return DAG.getNode(ISD::MERGE_VALUES, RetVTs, ArgValues[0],ArgValues.size()); + return DAG.getNode(ISD::MERGE_VALUES, Op.Val-getVTList(), + ArgValues[0], ArgValues.size()); } SDOperand X86TargetLowering::LowerallTo(SDOperand Op, SelectionDAG DAG, @@ -673,8 +672,8 @@ unsigned NumSRetBytes= 0; // Handle regparm attribute - std::vectorbool ArgInRegs(NumOps, false); - std::vectorbool SRetArgs(NumOps, false); + SmallVectorbool, 8 ArgInRegs(NumOps, false); + SmallVectorbool, 8 SRetArgs(NumOps, false); for (unsigned i = 0; iNumOps; ++i) { unsigned Flags = dyn_castConstantSDNode(Op.getOperand(5+2*i+1))-getValue(); @@ -714,8 +713,8 @@ unsigned ArgOffset = 0; NumXMMRegs = 0; NumIntRegs = 0; - std::vectorstd::pairunsigned, SDOperand RegsToPass; - std::vectorSDOperand MemOpChains; + SmallVectorstd::pairunsigned, SDOperand, 8 RegsToPass; + SmallVectorSDOperand, 8 MemOpChains; SDOperand StackPtr = DAG.getRegister(X86StackPtr, getPointerTy()); for (unsigned i = 0; i != NumOps; ++i) { SDOperand Arg = Op.getOperand(5+2*i); @@ -817,7 +816,7 @@ // Returns a chain a flag for retval copy to use. SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); - std::vectorSDOperand Ops; + SmallVectorSDOperand, 8 Ops; Ops.push_back(Chain); Ops.push_back(Callee); @@ -868,7 +867,7 @@ if (RetVT != MVT::Other) InFlag = Chain.getValue(1); - std::vectorSDOperand ResultVals; + SmallVectorSDOperand, 8 ResultVals; switch (RetVT) { default: assert(0 Unknown value type to return!); case MVT::Other: break; @@ -909,15 +908,9 @@ break; case MVT::f32: case MVT::f64: { -std::vectorMVT::ValueType Tys; -Tys.push_back(MVT::f64); -Tys.push_back(MVT::Other); -Tys.push_back(MVT::Flag); -std::vectorSDOperand Ops; -Ops.push_back(Chain); -Ops.push_back(InFlag); -SDOperand RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, - Ops[0], Ops.size()); +SDVTList Tys = DAG.getVTList(MVT::f64, MVT::Other, MVT::Flag); +SDOperand GROps[] = { Chain, InFlag }; +SDOperand RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, GROps, 2); Chain = RetVal.getValue(1); InFlag = RetVal.getValue(2); if (X86ScalarSSE) { @@ -927,15 +920,11 @@ MachineFunction MF = DAG.getMachineFunction(); int SSFI = MF.getFrameInfo()-CreateStackObject(8, 8); SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); - Tys.clear(); - Tys.push_back(MVT::Other); - Ops.clear(); - Ops.push_back(Chain); - Ops.push_back(RetVal); - Ops.push_back(StackSlot); - Ops.push_back(DAG.getValueType(RetVT)); - Ops.push_back(InFlag); - Chain = DAG.getNode(X86ISD::FST, Tys, Ops[0], Ops.size()); + Tys = DAG.getVTList(MVT::Other); + SDOperand Ops[] = { +Chain, RetVal, StackSlot, DAG.getValueType(RetVT), InFlag + }; + Chain = DAG.getNode(X86ISD::FST, Tys, Ops, 5); RetVal = DAG.getLoad(RetVT, Chain, StackSlot, NULL, 0); Chain = RetVal.getValue(1); } @@ -1031,7 +1020,7 @@ MachineFrameInfo *MFI = MF.getFrameInfo(); SDOperand Root = Op.getOperand(0); bool isVarArg = castConstantSDNode(Op.getOperand(2))-getValue() != 0; - std::vectorSDOperand
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.326 - 1.327 --- Log message: make void-return not a special case --- Diffs of the changes: (+17 -33) X86ISelLowering.cpp | 50 +- 1 files changed, 17 insertions(+), 33 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.326 llvm/lib/Target/X86/X86ISelLowering.cpp:1.327 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.326 Sun Feb 25 01:10:00 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sun Feb 25 01:18:38 2007 @@ -854,10 +854,7 @@ NumBytesForCalleeToPush = NumSRetBytes; } - if (RetVT != MVT::Other) -NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); - else -NodeTys = DAG.getVTList(MVT::Other); + NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); Ops.clear(); Ops.push_back(Chain); Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); @@ -870,7 +867,9 @@ SmallVectorSDOperand, 8 ResultVals; switch (RetVT) { default: assert(0 Unknown value type to return!); - case MVT::Other: break; + case MVT::Other: +NodeTys = DAG.getVTList(MVT::Other); +break; case MVT::i8: Chain = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag).getValue(1); ResultVals.push_back(Chain.getValue(0)); @@ -939,11 +938,7 @@ } } - // If the function returns void, just return the chain. - if (ResultVals.empty()) -return Chain; - - // Otherwise, merge everything together with a MERGE_VALUES node. + // Merge everything together with a MERGE_VALUES node. ResultVals.push_back(Chain); SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, ResultVals[0], ResultVals.size()); @@ -1372,11 +1367,8 @@ NodeTys, Ops[0], Ops.size()); InFlag = Chain.getValue(1); - if (RetVT != MVT::Other) -// Returns a flag for retval copy to use. -NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); - else -NodeTys = DAG.getVTList(MVT::Other); + // Returns a flag for retval copy to use. + NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); Ops.clear(); Ops.push_back(Chain); Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); @@ -1389,7 +1381,9 @@ SmallVectorSDOperand, 8 ResultVals; switch (RetVT) { default: assert(0 Unknown value type to return!); - case MVT::Other: break; + case MVT::Other: +NodeTys = DAG.getVTList(MVT::Other); +break; case MVT::i8: Chain = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag).getValue(1); ResultVals.push_back(Chain.getValue(0)); @@ -1435,11 +1429,7 @@ break; } - // If the function returns void, just return the chain. - if (ResultVals.empty()) -return Chain; - - // Otherwise, merge everything together with a MERGE_VALUES node. + // Merge everything together with a MERGE_VALUES node. ResultVals.push_back(Chain); SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, ResultVals[0], ResultVals.size()); @@ -1812,11 +1802,8 @@ NodeTys, Ops[0], Ops.size()); InFlag = Chain.getValue(1); - if (RetVT != MVT::Other) -// Returns a flag for retval copy to use. -NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); - else -NodeTys = DAG.getVTList(MVT::Other); + // Returns a flag for retval copy to use. + NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); Ops.clear(); Ops.push_back(Chain); Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); @@ -1829,7 +1816,9 @@ SmallVectorSDOperand, 8 ResultVals; switch (RetVT) { default: assert(0 Unknown value type to return!); - case MVT::Other: break; + case MVT::Other: +NodeTys = DAG.getVTList(MVT::Other); +break; case MVT::i8: Chain = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag).getValue(1); ResultVals.push_back(Chain.getValue(0)); @@ -1908,12 +1897,7 @@ } } - - // If the function returns void, just return the chain. - if (ResultVals.empty()) -return Chain; - - // Otherwise, merge everything together with a MERGE_VALUES node. + // Merge everything together with a MERGE_VALUES node. ResultVals.push_back(Chain); SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, ResultVals[0], ResultVals.size()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Changes in directory llvm/include/llvm/ADT: APInt.h updated: 1.17 - 1.18 --- Log message: Add a private constructor for efficiency. --- Diffs of the changes: (+4 -0) APInt.h |4 1 files changed, 4 insertions(+) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.17 llvm/include/llvm/ADT/APInt.h:1.18 --- llvm/include/llvm/ADT/APInt.h:1.17 Sat Feb 24 03:50:13 2007 +++ llvm/include/llvm/ADT/APInt.h Sun Feb 25 01:29:03 2007 @@ -60,6 +60,7 @@ /// @brief Class for arbitrary precision integers. class APInt { public: + uint32_t BitWidth; /// The number of bits in this APInt. /// This union is used to store the integer value. When the @@ -76,6 +77,9 @@ APINT_WORD_SIZE = sizeof(uint64_t) }; + // Fast internal constructor + APInt(uint64_t* val, uint32_t bits) : BitWidth(bits), pVal(val) { } + /// Here one word's bitwidth equals to that of uint64_t. /// @returns the number of words to hold the integer value of this APInt. /// @brief Get the number of words. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits