[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.28 - 1.29 --- Log message: Reorganize some code to make it clearer, avoid a few uninitialized memory reads, and reduce the number of temporary APInt instances we construct. --- Diffs of the changes: (+57 -56) APInt.cpp | 113 +++--- 1 files changed, 57 insertions(+), 56 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.28 llvm/lib/Support/APInt.cpp:1.29 --- llvm/lib/Support/APInt.cpp:1.28 Tue Feb 20 23:44:56 2007 +++ llvm/lib/Support/APInt.cpp Wed Feb 21 02:21:52 2007 @@ -280,7 +280,7 @@ for (uint32_t i = 1; i ylen; ++i) { uint64_t ly = y[i] 0xULL, hy = y[i] 32; -uint64_t carry = 0, lx, hx; +uint64_t carry = 0, lx = 0, hx = 0; for (uint32_t j = 0; j xlen; ++j) { lx = x[j] 0xULL; hx = x[j] 32; @@ -309,29 +309,42 @@ /// given APInt RHS and assigns the result to this APInt. APInt APInt::operator*=(const APInt RHS) { assert(BitWidth == RHS.BitWidth Bit widths must be the same); - if (isSingleWord()) + if (isSingleWord()) { VAL *= RHS.VAL; - else { -// one-based first non-zero bit position. -uint32_t first = getActiveBits(); -uint32_t xlen = !first ? 0 : whichWord(first - 1) + 1; -if (!xlen) - return *this; -else { - first = RHS.getActiveBits(); - uint32_t ylen = !first ? 0 : whichWord(first - 1) + 1; - if (!ylen) { -memset(pVal, 0, getNumWords() * APINT_WORD_SIZE); -return *this; - } - uint64_t *dest = getMemory(xlen+ylen); - mul(dest, pVal, xlen, RHS.pVal, ylen); - memcpy(pVal, dest, ((xlen + ylen = getNumWords()) ? - getNumWords() : xlen + ylen) * APINT_WORD_SIZE); - delete[] dest; -} +clearUnusedBits(); +return *this; } - clearUnusedBits(); + + // Get some bit facts about LHS and check for zero + uint32_t lhsBits = getActiveBits(); + uint32_t lhsWords = !lhsBits ? 0 : whichWord(lhsBits - 1) + 1; + if (!lhsWords) +// 0 * X === 0 +return *this; + + // Get some bit facts about RHS and check for zero + uint32_t rhsBits = RHS.getActiveBits(); + uint32_t rhsWords = !rhsBits ? 0 : whichWord(rhsBits - 1) + 1; + if (!rhsWords) { +// X * 0 === 0 +clear(); +return *this; + } + + // Allocate space for the result + uint32_t destWords = rhsWords + lhsWords; + uint64_t *dest = getMemory(destWords); + + // Perform the long multiply + mul(dest, pVal, lhsWords, RHS.pVal, rhsWords); + + // Copy result back into *this + clear(); + uint32_t wordsToCopy = destWords = getNumWords() ? getNumWords() : destWords; + memcpy(pVal, dest, wordsToCopy * APINT_WORD_SIZE); + + // delete dest array and return + delete[] dest; return *this; } @@ -1239,7 +1252,7 @@ delete Quotient-pVal; Quotient-BitWidth = LHS.BitWidth; if (!Quotient-isSingleWord()) -Quotient-pVal = getClearedMemory(lhsWords); +Quotient-pVal = getClearedMemory(Quotient-getNumWords()); } else Quotient-clear(); @@ -1270,7 +1283,7 @@ delete Remainder-pVal; Remainder-BitWidth = RHS.BitWidth; if (!Remainder-isSingleWord()) -Remainder-pVal = getClearedMemory(rhsWords); +Remainder-pVal = getClearedMemory(Remainder-getNumWords()); } else Remainder-clear(); @@ -1316,25 +1329,19 @@ uint32_t lhsBits = this-getActiveBits(); uint32_t lhsWords = !lhsBits ? 0 : (APInt::whichWord(lhsBits - 1) + 1); - // Make a temporary to hold the result - APInt Result(*this); - // Deal with some degenerate cases if (!lhsWords) -return Result; // 0 / X == 0 - else if (lhsWords rhsWords || Result.ult(RHS)) { -// X / Y with X Y == 0 -memset(Result.pVal, 0, Result.getNumWords() * APINT_WORD_SIZE); -return Result; - } else if (Result == RHS) { -// X / X == 1 -memset(Result.pVal, 0, Result.getNumWords() * APINT_WORD_SIZE); -Result.pVal[0] = 1; -return Result; +// 0 / X === 0 +return APInt(BitWidth, 0); + else if (lhsWords rhsWords || this-ult(RHS)) { +// X / Y === 0, iff X Y +return APInt(BitWidth, 0); + } else if (*this == RHS) { +// X / X === 1 +return APInt(BitWidth, 1); } else if (lhsWords == 1 rhsWords == 1) { // All high words are zero, just use native divide -Result.pVal[0] /= RHS.pVal[0]; -return Result; +return APInt(BitWidth, this-pVal[0] / RHS.pVal[0]); } // We have to compute it the hard way. Invoke the Knuth divide algorithm. @@ -1352,34 +1359,28 @@ return APInt(BitWidth, VAL % RHS.VAL); } - // Make a temporary to hold the result - APInt Result(*this); + // Get some facts about the LHS + uint32_t lhsBits = getActiveBits(); + uint32_t lhsWords = !lhsBits ? 0 : (whichWord(lhsBits - 1) + 1); // Get some facts about the RHS uint32_t rhsBits = RHS.getActiveBits();
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp
Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt: gptest.cpp updated: 1.1 - 1.2 --- Log message: Improve this test: 1. Remove dead code (hold overs from another test). 2. Simplify communication with gp. 3. Fix a read uninitialized data bug by terminating the read buffer with 0 4. Consolidate reporting into a single function to make output consistent. 5. Add support for all arithmetic and copmarison operators. 6. Cleanup the output. 7. dup2 the stderr fd for gp so it writes errors back to test program. 8. Handle sigint so we can clean up on interrupt (shut down pipes nicely) --- Diffs of the changes: (+123 -184) gptest.cpp | 307 - 1 files changed, 123 insertions(+), 184 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.2 --- llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.1 Tue Feb 20 14:44:00 2007 +++ llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp Wed Feb 21 02:28:20 2007 @@ -11,16 +11,16 @@ //===--===// #include llvm/ADT/APInt.h +#include llvm/ADT/StringExtras.h +#include llvm/System/Signals.h #include stdio.h #include stdlib.h #include sys/wait.h #include unistd.h -#include llvm/System/Signals.h using namespace llvm; -APInt x(21, 0x1f); -APInt y(21, 0x0f); +static int input = 0, output = 0; void print(const APInt X, bool wantSigned = false, bool withNL = true) { std::string decstr = X.toString(10,wantSigned); @@ -39,210 +39,146 @@ return val; } -void test_interface(const APInt val) { - printf(INTERFACE TEST: val = ); print(val); - unsigned bitwidth = val.getBitWidth(); - unsigned pos = rand() % bitwidth; - printf(val[%u] = %d\n, pos, val[pos]); - APInt smax(APInt::getMaxValue(bitwidth, true)); - APInt umax(APInt::getMaxValue(bitwidth, false)); - APInt smin(APInt::getMinValue(bitwidth, true)); - APInt umin(APInt::getMinValue(bitwidth, false)); - printf(APInt::getMinValue(%d, true) = , bitwidth); print(smin,true); - printf(APInt::getMaxValue(%d, true) = , bitwidth); print(smax,true); - printf(APInt::getMinValue(%d, false) = , bitwidth); print(umin); - printf(APInt::getMaxValue(%d, false) = , bitwidth); print(umax); - APInt null = APInt::getNullValue(bitwidth); - APInt allone = APInt::getAllOnesValue(bitwidth); - printf(APInt::getNullValue(%d) = , bitwidth); print(null); - printf(APInt::getAllOnesValue(%d) = , bitwidth); print(allone); - APInt x(val); - x.set(pos); - printf(val.set(%d) = , pos); print(x); - x.set(); - printf(val.set() = ); print(x); - x = val; - x.clear(pos); - printf(val.clear(%d) = , pos); print(x); - x.clear(); - printf(val.clear() = ); print(x); - x = val; - x.flip(pos); - printf(val.flip(%d) = , pos); print(x); - x = val; - x.flip(); - printf(val.flip() = ); print(x); - unsigned bitsize = bitwidth / 2; - printf(val.getHiBits(%d) = , bitsize); print(val.getHiBits(bitsize)); - printf(val.getLoBits(%d) = , bitsize); print(val.getLoBits(bitsize)); - printf(val.isIntN(%d) = %d\n, bitwidth, val.isIntN(bitwidth)); -} - -void test_unops(const APInt val) { - printf(UNARY OPERATORS TEST: val = ); print(val); - APInt x(val); - x++; - printf(val++ = ); print(x); - x = val; - ++x; - printf(++val = ); print(x); - x = val; - x--; - printf(val-- = ); print(x); - x = val; - --x; - printf(--val = ); print(x); - x = -val; - printf(-val = ); print(x); - x = ~val; - printf(~val = ); print(x); - printf(!val = %d\n, !val); - printf(val.isPowerOf2() = %d\n, val.isPowerOf2()); - printf(val.logBase2() = %d\n, val.logBase2()); - printf(val.countLeadingZeros() = %d\n, val.countLeadingZeros()); - printf(val.countTrailingZeros() = %d\n, val.countTrailingZeros()); - printf(val.countPopulation() = %d\n, val.countPopulation()); - printf(val.getBitWidth() = %d\n, val.getBitWidth()); - if (val.getBitWidth() = 16 val.getBitWidth() % 16 == 0) { -x = val.byteSwap(); -printf(val.byteSwap() = ); print(x); - } - printf(val.roundToDouble(false) = %f\n, val.roundToDouble(false)); - printf(val.roundToDouble(true) = %f\n, val.roundToDouble(true)); - printf(val.getValue() = ); - if (val.getBitWidth() 64) -printf(too wide\n); - else -printf(%lu\n, val.getValue()); -} - -void old_test_binops(const APInt v1, const APInt v2) { - printf(BINARY OPERATORS TEST: \n vl: ); print(v1,false,false); - printf(\n v2: ); print(v2); - APInt result(v1); - result = v2; - printf(v1 = v2: ); print(result); - result = v1; - result |= v2; - printf(v1 |= v2: ); print(result); - result = v1; - result ^= v2; - printf(v1 ^= v2: ); print(result); - result = v1; - result *= v2; - printf(v1 *= v2: ); print(result); - result = v1; - result += v2; - printf(v1 += v2:
[llvm-commits] CVS: llvm-www/header.incl
Changes in directory llvm-www: header.incl updated: 1.51 - 1.52 --- Log message: add new status update --- Diffs of the changes: (+15 -14) header.incl | 29 +++-- 1 files changed, 15 insertions(+), 14 deletions(-) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.51 llvm-www/header.incl:1.52 --- llvm-www/header.incl:1.51 Wed Nov 29 16:15:26 2006 +++ llvm-www/header.inclWed Feb 21 12:11:42 2007 @@ -66,26 +66,27 @@ bStatusnbsp;Updates/b div class=www_sidebar span style=font-size:smaller + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2007-February/21.html;Feb 21, 2007/abr a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2006-November/20.html;Nov 19, 2006/abr a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2006-August/19.html;Aug 9, 2006/abr a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2006-April/18.html;Apr 20, 2006/abr a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2005-November/17.html;Nov 8, 2005/abr a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2005-May/16.html;May 18, 2005/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2005-February/15.html;February 14, 2005/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-December/13.html;December 9, 2004/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-October/12.html;October 11, 2004/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-August/11.html;August 13, 2004/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-July/10.html;July 12, 2004/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-June/09.html;June 9, 2004/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2005-February/15.html;Feb 14, 2005/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-December/13.html;Dec 9, 2004/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-October/12.html;Oct 11, 2004/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-August/11.html;Aug 13, 2004/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-July/10.html;Jul 12, 2004/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-June/09.html;Jun 9, 2004/abr a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-May/08.html;May 6, 2004/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-March/06.html;March 19, 2004/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-February/05.html;February 6, 2004/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2003-December/04.html;December 17, 2003/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2003-November/03.html;November 18, 2003/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-October/000501.html;October 7, 2003/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-September/000489.html;September 10, 2003/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-August/000448.html;August 15, 2003/abr - a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-June/000416.html;June 26, 2003/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-March/06.html;Mar 19, 2004/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2004-February/05.html;Feb 6, 2004/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2003-December/04.html;Dec 17, 2003/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvm-announce/2003-November/03.html;Nov 18, 2003/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-October/000501.html;Oct 7, 2003/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-September/000489.html;Sep 10, 2003/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-August/000448.html;Aug 15, 2003/abr + a href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2003-June/000416.html;Jun 26, 2003/abr a href=/OldNews.htmlOlder News/abr /span /div ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Analysis/ET-Forest.h
Changes in directory llvm/include/llvm/Analysis: ET-Forest.h updated: 1.8 - 1.9 --- Log message: Simplify --- Diffs of the changes: (+1 -2) ET-Forest.h |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/ET-Forest.h diff -u llvm/include/llvm/Analysis/ET-Forest.h:1.8 llvm/include/llvm/Analysis/ET-Forest.h:1.9 --- llvm/include/llvm/Analysis/ET-Forest.h:1.8 Tue Feb 20 20:36:31 2007 +++ llvm/include/llvm/Analysis/ET-Forest.h Wed Feb 21 13:57:33 2007 @@ -141,8 +141,7 @@ // removeFromForest() ~ETNode() { delete RightmostOcc; -if (ParentOcc) - delete ParentOcc; +delete ParentOcc; } void removeFromForest() { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [124164] Backport mingw32 support from FSF GCC mainline.
Revision: 124164 Author: dpatel Date: 2007-02-21 13:13:42 -0800 (Wed, 21 Feb 2007) Log Message: --- Backport mingw32 support from FSF GCC mainline. Patch by Anton Korobeynikov. Added Paths: --- apple-local/branches/llvm/gcc/config/i386/winnt-cxx.c apple-local/branches/llvm/gcc/config/i386/winnt-stubs.c Added: apple-local/branches/llvm/gcc/config/i386/winnt-cxx.c === --- apple-local/branches/llvm/gcc/config/i386/winnt-cxx.c (rev 0) +++ apple-local/branches/llvm/gcc/config/i386/winnt-cxx.c 2007-02-21 21:13:42 UTC (rev 124164) @@ -0,0 +1,167 @@ +/* Target support for C++ classes on Windows. + Contributed by Danny Smith ([EMAIL PROTECTED]) + Copyright (C) 2005 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to +the Free Software Foundation, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include config.h +#include system.h +#include coretypes.h +#include tm.h +#include rtl.h +#include regs.h +#include hard-reg-set.h +#include output.h +#include tree.h +#include cp/cp-tree.h /* this is why we're a separate module */ +#include flags.h +#include tm_p.h +#include toplev.h +#include hashtab.h + +bool +i386_pe_type_dllimport_p (tree decl) +{ + gcc_assert (TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == FUNCTION_DECL); + + if (TARGET_NOP_FUN_DLLIMPORT TREE_CODE (decl) == FUNCTION_DECL) + return false; + + /* We ignore the dllimport attribute for inline member functions. + This differs from MSVC behavior which treats it like GNUC + 'extern inline' extension. Also ignore for template + instantiations with linkonce semantics and artificial methods. */ +if (TREE_CODE (decl) == FUNCTION_DECL + (DECL_DECLARED_INLINE_P (decl) + || DECL_TEMPLATE_INSTANTIATION (decl) + || DECL_ARTIFICIAL (decl))) + return false; + + /* Since we can't treat a pointer to a dllimport'd symbol as a + constant address, we turn off the attribute on C++ virtual + methods to allow creation of vtables using thunks. */ +else if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE + DECL_VIRTUAL_P (decl)) + { + /* Even though we ignore the attribute from the start, warn if we later see + an out-of class definition, as we do for other member functions in + tree.c:merge_dllimport_decl_attributes. If this is the key method, the + definition may affect the import-export status of vtables, depending + on how we handle MULTIPLE_SYMBOL_SPACES in cp/decl2.c. */ + if (DECL_INITIAL (decl)) + { + warning (%q+D redeclared without dllimport attribute: + previous dllimport ignored, decl); +#ifdef PE_DLL_DEBUG + if (decl == CLASSTYPE_KEY_METHOD (DECL_CONTEXT (decl))) + warning (key method %q+D of dllimport'd class defined + decl); +#endif + } + return false; + } + + /* Don't mark defined functions as dllimport. This code will only be + reached if we see a non-inline function defined out-of-class. */ +else if (TREE_CODE (decl) == FUNCTION_DECL + (DECL_INITIAL (decl))) + return false; + +/* Don't allow definitions of static data members in dllimport class, +If vtable data is marked as DECL_EXTERNAL, import it; otherwise just +ignore the class attribute. */ +else if (TREE_CODE (decl) == VAR_DECL + TREE_STATIC (decl) TREE_PUBLIC (decl) + !DECL_EXTERNAL (decl)) + { + if (!DECL_VIRTUAL_P (decl)) +error (definition of static data member %q+D of + dllimport'd class, decl); + return false; + } + +return true; +} + + +bool +i386_pe_type_dllexport_p (tree decl) +{ + gcc_assert (TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == FUNCTION_DECL); + /* Avoid exporting compiler-generated default dtors and copy ctors. + The only artificial methods that need to be exported are virtual + and non-virtual thunks. */ + if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE +DECL_ARTIFICIAL (decl) !DECL_THUNK_P (decl)) + return false; + return true; +} + +static inline void
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.320 - 1.321 --- Log message: ELF / PIC requires GOT be in the EBX register during calls via PLT GOT pointer. Add implicit uses of EBX to calls to ensure liveintervalanalysis does not treat the GOT in EBX move as dead upon definition. This should fix PR1207: http://llvm.org/PR1207 . --- Diffs of the changes: (+14 -0) X86ISelLowering.cpp | 14 ++ 1 files changed, 14 insertions(+) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.320 llvm/lib/Target/X86/X86ISelLowering.cpp:1.321 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.320 Thu Feb 1 02:39:52 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Feb 21 15:18:14 2007 @@ -794,6 +794,8 @@ InFlag = Chain.getValue(1); } + // ELF / PIC requires GOT in the EBX register before function calls via PLT + // GOT pointer. if (getTargetMachine().getRelocationModel() == Reloc::PIC_ Subtarget-isPICStyleGOT()) { Chain = DAG.getCopyToReg(Chain, X86::EBX, @@ -825,6 +827,11 @@ for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) Ops.push_back(DAG.getRegister(RegsToPass[i].first, RegsToPass[i].second.getValueType())); + + // Add an implicit use GOT pointer in EBX. + if (getTargetMachine().getRelocationModel() == Reloc::PIC_ + Subtarget-isPICStyleGOT()) +Ops.push_back(DAG.getRegister(X86::EBX, getPointerTy())); if (InFlag.Val) Ops.push_back(InFlag); @@ -1788,6 +1795,8 @@ } else if (ExternalSymbolSDNode *S = dyn_castExternalSymbolSDNode(Callee)) Callee = DAG.getTargetExternalSymbol(S-getSymbol(), getPointerTy()); + // ELF / PIC requires GOT in the EBX register before function calls via PLT + // GOT pointer. if (getTargetMachine().getRelocationModel() == Reloc::PIC_ Subtarget-isPICStyleGOT()) { Chain = DAG.getCopyToReg(Chain, X86::EBX, @@ -1809,6 +1818,11 @@ Ops.push_back(DAG.getRegister(RegsToPass[i].first, RegsToPass[i].second.getValueType())); + // Add an implicit use GOT pointer in EBX. + if (getTargetMachine().getRelocationModel() == Reloc::PIC_ + Subtarget-isPICStyleGOT()) +Ops.push_back(DAG.getRegister(X86::EBX, getPointerTy())); + if (InFlag.Val) Ops.push_back(InFlag); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Intrinsics.td
Changes in directory llvm/include/llvm: Intrinsics.td updated: 1.46 - 1.47 --- Log message: Add new intrinsics for eh support. --- Diffs of the changes: (+3 -1) Intrinsics.td |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Intrinsics.td diff -u llvm/include/llvm/Intrinsics.td:1.46 llvm/include/llvm/Intrinsics.td:1.47 --- llvm/include/llvm/Intrinsics.td:1.46Wed Feb 14 20:26:09 2007 +++ llvm/include/llvm/Intrinsics.td Wed Feb 21 16:35:57 2007 @@ -232,7 +232,9 @@ //===-- Exception Handling Intrinsics--===// // def int_eh_exception : Intrinsic[llvm_ptr_ty]; -def int_eh_handlers : Intrinsic[llvm_i32_ty, llvm_ptr_ty, llvm_vararg_ty]; +def int_eh_handlers : Intrinsic[llvm_i32_ty, llvm_ptr_ty, llvm_ptr_ty, + llvm_vararg_ty]; +def int_eh_typeid_for : Intrinsic[llvm_i32_ty, llvm_ptr_ty]; //===--===// // Target-specific intrinsics ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.177 - 1.178 --- Log message: Add new instructions for handling data passed into eh landing pad. --- Diffs of the changes: (+9 -1) SelectionDAGNodes.h | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.177 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.178 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.177 Wed Feb 14 21:39:17 2007 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Wed Feb 21 16:37:22 2007 @@ -91,6 +91,14 @@ // to the current function's frame or return address, an index of one to the // parent's frame or return address, and so on. FRAMEADDR, RETURNADDR, + +// RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the +// address of the exception block on entry to an landing pad block. +EXCEPTIONADDR, + +// RESULT, OUTCHAIN = EHSELECTION(INCHAIN, EXCEPTION) - This node represents +// the selection index of the exception thrown. +EHSELECTION, // TargetConstant* - Like Constant*, but the DAG does not do any folding or // simplification of the constant. @@ -457,7 +465,7 @@ // Operand #0 : input chain. // Operand #1 : module unique number use to identify the label. LABEL, - + // STACKSAVE - STACKSAVE has one operand, an input chain. It produces a // value, the same type as the pointer type for the system, and an output // chain. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineModuleInfo.h
Changes in directory llvm/include/llvm/CodeGen: MachineModuleInfo.h updated: 1.4 - 1.5 --- Log message: Add structures used for collecting eh information. --- Diffs of the changes: (+78 -0) MachineModuleInfo.h | 78 1 files changed, 78 insertions(+) Index: llvm/include/llvm/CodeGen/MachineModuleInfo.h diff -u llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.4 llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.5 --- llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.4 Thu Feb 1 10:31:34 2007 +++ llvm/include/llvm/CodeGen/MachineModuleInfo.h Wed Feb 21 16:38:31 2007 @@ -44,6 +44,7 @@ class Constant; class DebugInfoDesc; class GlobalVariable; +class MachineBasicBlock; class MachineFunction; class MachineMove; class Module; @@ -949,6 +950,27 @@ }; //===--===// +/// LandingPadInfo - This structure is used to retain landing pad info for +/// the current function. +/// +struct LandingPadInfo { + MachineBasicBlock *LandingPadBlock; // Landing pad block. + unsigned BeginLabel; // Label prior to invoke. + unsigned EndLabel;// Label after invoke. + unsigned LandingPadLabel; // Label at beginning of landing pad. + Function *Personality;// Personality function. + std::vectorunsigned TypeIds;// List of type ids. + + LandingPadInfo(MachineBasicBlock *MBB) + : LandingPadBlock(MBB) + , BeginLabel(0) + , EndLabel(0) + , LandingPadLabel(0) + , TypeIds() + {} +}; + +//===--===// /// MachineModuleInfo - This class contains meta information specific to a /// module. Queries can be made by different debugging and exception handling /// schemes and reformated for specific use. @@ -987,6 +1009,14 @@ // FrameMoves - List of moves done by a function's prolog. Used to construct // frame maps by debug and exception handling consumers. std::vectorMachineMove FrameMoves; + + // LandingPads - List of LandingPadInfo describing the landing pad information + // in the current function. + std::vectorLandingPadInfo LandingPads; + + // TypeInfos - List of C++ TypeInfo used in the currect function. + // + std::vectorGlobalVariable * TypeInfos; public: MachineModuleInfo(); @@ -1147,6 +1177,54 @@ /// function's prologue. Used to construct frame maps for debug and exception /// handling comsumers. std::vectorMachineMove getFrameMoves() { return FrameMoves; } + + //===-EH-===// + + /// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the + /// specified MachineBasicBlock. + LandingPadInfo getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad); + + /// addInvoke - Provide the begin and end labels of an invoke style call and + /// associate it with a try landing pad block. + void addInvoke(MachineBasicBlock *LandingPad, unsigned BeginLabel, +unsigned EndLabel); + + /// addLandingPad - Add a new panding pad. Returns the label ID for the + /// landing pad entry. + unsigned addLandingPad(MachineBasicBlock *LandingPad); + + /// addPersonality - Provide the personality function for the exception + /// information. + void addPersonality(MachineBasicBlock *LandingPad, Function *Personality); + + /// addCatchTypeInfo - Provide the catch typeinfo for a landing pad. + /// + void addCatchTypeInfo(MachineBasicBlock *LandingPad, +std::vectorGlobalVariable * TyInfo); + + /// getTypeIDFor - Return the type id for the specified typeinfo. This is + /// function wide. + unsigned getTypeIDFor(GlobalVariable *TI); + + /// TidyLandingPads - Remap landing pad labels and remove any deleted landing + /// pads. + void TidyLandingPads(); + + /// getLandingPadInfos - Return a reference to the landing pad info for the + /// current function. + const std::vectorLandingPadInfo getLandingPads() const { +return LandingPads; + } + + /// getTypeInfos - Return a reference to the C++ typeinfo for the current + /// function. + const std::vectorGlobalVariable * getTypeInfos() const { +return TypeInfos; + } + + /// getPersonality - Return a personality function if available. The presence + /// of one is required to emit exception handling info. + Function *getPersonality() const; }; // End class MachineModuleInfo ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/MachineModuleInfo.cpp
Changes in directory llvm/lib/CodeGen: MachineModuleInfo.cpp updated: 1.3 - 1.4 --- Log message: Add structures used for collecting eh information. --- Diffs of the changes: (+94 -0) MachineModuleInfo.cpp | 94 ++ 1 files changed, 94 insertions(+) Index: llvm/lib/CodeGen/MachineModuleInfo.cpp diff -u llvm/lib/CodeGen/MachineModuleInfo.cpp:1.3 llvm/lib/CodeGen/MachineModuleInfo.cpp:1.4 --- llvm/lib/CodeGen/MachineModuleInfo.cpp:1.3 Thu Feb 1 10:31:34 2007 +++ llvm/lib/CodeGen/MachineModuleInfo.cpp Wed Feb 21 16:38:31 2007 @@ -1472,6 +1472,7 @@ , ScopeMap() , RootScope(NULL) , FrameMoves() +, LandingPads() {} MachineModuleInfo::~MachineModuleInfo() { @@ -1510,6 +1511,10 @@ // Clean up frame info. FrameMoves.clear(); + + // Clean up exception info. + LandingPads.clear(); + TypeInfos.clear(); } /// getDescFor - Convert a Value to a debug information descriptor. @@ -1640,6 +1645,95 @@ return Slot; } +//===-EH---===// + +/// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the +/// specified MachineBasicBlock. +LandingPadInfo MachineModuleInfo::getOrCreateLandingPadInfo +(MachineBasicBlock *LandingPad) { + unsigned N = LandingPads.size(); + for (unsigned i = 0; i N; ++i) { +LandingPadInfo UI = LandingPads[i]; +if (UI.LandingPadBlock == LandingPad) + return UI; + } + + LandingPads.push_back(LandingPadInfo(LandingPad)); + return LandingPads[N]; +} + +/// addInvoke - Provide the begin and end labels of an invoke style call and +/// associate it with a try landing pad block. +void MachineModuleInfo::addInvoke(MachineBasicBlock *LandingPad, + unsigned BeginLabel, unsigned EndLabel) { + LandingPadInfo UI = getOrCreateLandingPadInfo(LandingPad); + if (!UI.BeginLabel) UI.BeginLabel = BeginLabel; + UI.EndLabel = EndLabel; +} + +/// addLandingPad - Provide the label of a try LandingPad block. +/// +unsigned MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) { + unsigned LandingPadLabel = NextLabelID(); + LandingPadInfo UI = getOrCreateLandingPadInfo(LandingPad); + UI.LandingPadLabel = LandingPadLabel; + return LandingPadLabel; +} + +/// addPersonality - Provide the personality function for the exception +/// information. +void MachineModuleInfo::addPersonality(MachineBasicBlock *LandingPad, + Function *Personality) { + LandingPadInfo UI = getOrCreateLandingPadInfo(LandingPad); + UI.Personality = Personality; +} + +/// addCatchTypeInfo - Provide the catch typeinfo for a landing pad. +/// +void MachineModuleInfo::addCatchTypeInfo(MachineBasicBlock *LandingPad, +std::vectorGlobalVariable * TyInfo) { + LandingPadInfo UI = getOrCreateLandingPadInfo(LandingPad); + for (unsigned N = TyInfo.size(); N; --N) +UI.TypeIds.push_back(getTypeIDFor(TyInfo[N - 1])); +} + +/// TidyLandingPads - Remap landing pad labels and remove any deleted landing +/// pads. +void MachineModuleInfo::TidyLandingPads() { + for (unsigned i = 0; i != LandingPads.size(); ) { +LandingPadInfo LandingPad = LandingPads[i]; +LandingPad.BeginLabel = MappedLabel(LandingPad.BeginLabel); +LandingPad.EndLabel = MappedLabel(LandingPad.EndLabel); +LandingPad.LandingPadLabel = MappedLabel(LandingPad.LandingPadLabel); + +if (!LandingPad.BeginLabel || +!LandingPad.EndLabel || +!LandingPad.LandingPadLabel) { + LandingPads.erase(LandingPads.begin() + i); + continue; +} + +++i; + } +} + +/// getTypeIDFor - Return the type id for the specified typeinfo. This is +/// function wide. +unsigned MachineModuleInfo::getTypeIDFor(GlobalVariable *TI) { + for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i) +if (TypeInfos[i] == TI) return i + 1; + + TypeInfos.push_back(TI); + return TypeInfos.size(); +} + +/// getLandingPadInfos - Return a reference to the landing pad info for the +/// current function. +Function *MachineModuleInfo::getPersonality() const { + return !LandingPads.empty() ? LandingPads[0].Personality : NULL; +} + + //===--===// /// DebugLabelFolding pass - This pass prunes out redundant labels. This allows /// a info consumer to determine if the range of two labels is empty, by seeing ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.210 - 1.211 --- Log message: Allow for live in registers for eh landing pads. --- Diffs of the changes: (+6 -5) LiveIntervalAnalysis.cpp | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.210 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.211 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.210 Tue Feb 20 20:27:39 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Feb 21 16:41:17 2007 @@ -658,14 +658,15 @@ } void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB, + unsigned MIIdx, LiveInterval interval) { DOUT \t\tlivein register: ; DEBUG(printRegName(interval.reg)); // Look for kills, if it reaches a def before it's killed, then it shouldn't // be considered a livein. MachineBasicBlock::iterator mi = MBB-begin(); - unsigned baseIndex = 0; - unsigned start = 0; + unsigned baseIndex = MIIdx; + unsigned start = baseIndex; unsigned end = start; while (mi != MBB-end()) { if (lv_-KillsRegister(mi, interval.reg)) { @@ -690,8 +691,8 @@ assert(start end did not find end of interval?); LiveRange LR(start, end, interval.getNextValue(~0U, 0)); - interval.addRange(LR); DOUT + LR '\n'; + interval.addRange(LR); } /// computeIntervals - computes the live intervals for virtual @@ -715,9 +716,9 @@ // Create intervals for live-ins to this BB first. for (MachineBasicBlock::const_livein_iterator LI = MBB-livein_begin(), LE = MBB-livein_end(); LI != LE; ++LI) { -handleLiveInRegister(MBB, getOrCreateInterval(*LI)); +handleLiveInRegister(MBB, MIIndex, getOrCreateInterval(*LI)); for (const unsigned* AS = mri_-getAliasSet(*LI); *AS; ++AS) - handleLiveInRegister(MBB, getOrCreateInterval(*AS)); + handleLiveInRegister(MBB, MIIndex, getOrCreateInterval(*AS)); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.71 - 1.72 --- Log message: Allow for live in registers for eh landing pads. --- Diffs of the changes: (+3 -1) LiveIntervalAnalysis.h |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.71 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.72 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.71 Mon Feb 19 15:49:53 2007 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.hWed Feb 21 16:41:17 2007 @@ -240,7 +240,9 @@ unsigned SrcReg); /// handleLiveInRegister - Create interval for a livein register. -void handleLiveInRegister(MachineBasicBlock* mbb, LiveInterval interval); +void handleLiveInRegister(MachineBasicBlock* mbb, + unsigned MIIdx, + LiveInterval interval); /// Return true if the two specified registers belong to different /// register classes. The registers may be either phys or virt regs. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h
Changes in directory llvm/include/llvm/CodeGen: MachineBasicBlock.h updated: 1.58 - 1.59 --- Log message: Add a flag to MBBs to indicate whether it is an eh landing pad. --- Diffs of the changes: (+18 -1) MachineBasicBlock.h | 19 ++- 1 files changed, 18 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.58 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.59 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.58 Mon Feb 19 15:49:53 2007 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Wed Feb 21 16:39:52 2007 @@ -74,10 +74,15 @@ /// LiveIns - Keep track of the physical registers that are livein of /// the basicblock. std::vectorunsigned LiveIns; + + /// IsLandingPad - Indicate that this basic block is entered via an + /// exception handler. + bool IsLandingPad; public: MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0), BB(bb), -Number(-1), Parent(0) { +Number(-1), Parent(0), +IsLandingPad(false) { Insts.parent = this; } @@ -152,6 +157,18 @@ const_livein_iterator livein_end() const { return LiveIns.end(); } boollivein_empty() const { return LiveIns.empty(); } + /// isLandingPad - Returns true if the block is a landing pad. That is + /// this basic block is entered via an exception handler. + bool isLandingPad() const { return IsLandingPad; } + + /// setIsLandingPad - Indicates the block is a landing pad. That is + /// this basic block is entered via an exception handler. + void setIsLandingPad() { IsLandingPad = true; } + + /// isAccessable - Returns true if the block is alive. That is, if it has + /// predecessors or is an eh landing pad. + bool isAccessable() const { return !pred_empty() || isLandingPad(); } + // Code Layout methods. /// moveBefore/moveAfter - move 'this' block before or after the specified ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp
Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.42 - 1.43 --- Log message: Make branch folding behave in the presence of landing pads. --- Diffs of the changes: (+30 -25) BranchFolding.cpp | 55 +- 1 files changed, 30 insertions(+), 25 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.42 llvm/lib/CodeGen/BranchFolding.cpp:1.43 --- llvm/lib/CodeGen/BranchFolding.cpp:1.42 Fri Feb 16 18:44:34 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Wed Feb 21 16:42:20 2007 @@ -67,7 +67,8 @@ /// RemoveDeadBlock - Remove the specified dead machine basic block from the /// function, updating the CFG. void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) { - assert(MBB-pred_empty() MBB must be dead!); + assert(!MBB-isAccessable() MBB must be dead!); + DOUT \nRemoving MBB: *MBB; MachineFunction *MF = MBB-getParent(); // drop all successors. @@ -439,7 +440,7 @@ OptimizeBlock(MBB); // If it is dead, remove it. -if (MBB-pred_empty()) { +if (!MBB-isAccessable()) { RemoveDeadBlock(MBB); MadeChange = true; ++NumDeadBlocks; @@ -485,6 +486,8 @@ } else if (*SI == DestB) { DestB = 0; ++SI; +} else if ((*SI)-isLandingPad()) { + ++SI; } else { // Otherwise, this is a superfluous edge, remove it. MBB.removeSuccessor(SI); @@ -615,14 +618,14 @@ // explicitly. if (MBB-empty()) { // Dead block? Leave for cleanup later. -if (MBB-pred_empty()) return; +if (!MBB-isAccessable()) return; if (FallThrough == MBB-getParent()-end()) { // TODO: Simplify preds to not branch here if possible! } else { // Rewrite all predecessors of the old block to go to the fallthrough // instead. - while (!MBB-pred_empty()) { + while (MBB-isAccessable()) { MachineBasicBlock *Pred = *(MBB-pred_end()-1); ReplaceUsesOfBlockWith(Pred, MBB, FallThrough, TII); } @@ -855,28 +858,30 @@ bool CurFallsThru = CanFallThrough(MBB, CurUnAnalyzable, CurTBB, CurFBB, CurCond); -// Check all the predecessors of this block. If one of them has no fall -// throughs, move this block right after it. -for (MachineBasicBlock::pred_iterator PI = MBB-pred_begin(), - E = MBB-pred_end(); PI != E; ++PI) { - // Analyze the branch at the end of the pred. - MachineBasicBlock *PredBB = *PI; - MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough; - if (PredBB != MBB !CanFallThrough(PredBB) - (!CurFallsThru || MBB-getNumber() = PredBB-getNumber())) { -// If the current block doesn't fall through, just move it. -// If the current block can fall through and does not end with a -// conditional branch, we need to append an unconditional jump to -// the (current) next block. To avoid a possible compile-time -// infinite loop, move blocks only backward in this case. -if (CurFallsThru) { - MachineBasicBlock *NextBB = next(MachineFunction::iterator(MBB)); - CurCond.clear(); - TII-InsertBranch(*MBB, NextBB, 0, CurCond); +if (!MBB-isLandingPad()) { + // Check all the predecessors of this block. If one of them has no fall + // throughs, move this block right after it. + for (MachineBasicBlock::pred_iterator PI = MBB-pred_begin(), + E = MBB-pred_end(); PI != E; ++PI) { +// Analyze the branch at the end of the pred. +MachineBasicBlock *PredBB = *PI; +MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough; +if (PredBB != MBB !CanFallThrough(PredBB) + (!CurFallsThru || MBB-getNumber() = PredBB-getNumber())) { + // If the current block doesn't fall through, just move it. + // If the current block can fall through and does not end with a + // conditional branch, we need to append an unconditional jump to + // the (current) next block. To avoid a possible compile-time + // infinite loop, move blocks only backward in this case. + if (CurFallsThru) { +MachineBasicBlock *NextBB = next(MachineFunction::iterator(MBB)); +CurCond.clear(); +TII-InsertBranch(*MBB, NextBB, 0, CurCond); + } + MBB-moveAfter(PredBB); + MadeChange = true; + return OptimizeBlock(MBB); } -MBB-moveAfter(PredBB); -MadeChange = true; -return OptimizeBlock(MBB); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h
Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.25 - 1.26 --- Log message: Add TAI field for exception table section. --- Diffs of the changes: (+8 -0) TargetAsmInfo.h |8 1 files changed, 8 insertions(+) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.25 llvm/include/llvm/Target/TargetAsmInfo.h:1.26 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.25 Thu Feb 1 10:31:34 2007 +++ llvm/include/llvm/Target/TargetAsmInfo.hWed Feb 21 16:43:40 2007 @@ -313,6 +313,11 @@ /// DwarfEHFrameSection - Section directive for Exception frames. /// const char *DwarfEHFrameSection; // Defaults to .eh_frame. + +/// DwarfExceptionSection - Section directive for Exception table. +/// +const char *DwarfExceptionSection; // Defaults to .gcc_except_table. + //===--- CBE Asm Translation Table ---===// @@ -540,6 +545,9 @@ const char *getDwarfEHFrameSection() const { return DwarfEHFrameSection; } +const char *getDwarfExceptionSection() const { + return DwarfExceptionSection; +} const char** getAsmCBE() const { return AsmTransCBE; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp
Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.18 - 1.19 --- Log message: Add TAI field for exception table section. --- Diffs of the changes: (+1 -0) TargetAsmInfo.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/TargetAsmInfo.cpp diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.18 llvm/lib/Target/TargetAsmInfo.cpp:1.19 --- llvm/lib/Target/TargetAsmInfo.cpp:1.18 Thu Feb 1 10:31:34 2007 +++ llvm/lib/Target/TargetAsmInfo.cpp Wed Feb 21 16:43:40 2007 @@ -86,6 +86,7 @@ DwarfRangesSection(.debug_ranges), DwarfMacInfoSection(.debug_macinfo), DwarfEHFrameSection(.eh_frame), + DwarfExceptionSection(.gcc_except_table), AsmTransCBE(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/PPCTargetAsmInfo.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCTargetAsmInfo.cpp updated: 1.17 - 1.18 --- Log message: Add TAI field for exception table section. --- Diffs of the changes: (+1 -0) PPCTargetAsmInfo.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.17 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.18 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.17 Thu Feb 1 10:31:34 2007 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cppWed Feb 21 16:43:40 2007 @@ -43,6 +43,7 @@ DwarfMacInfoSection = .section __DWARF,__debug_macinfo,regular,debug; DwarfEHFrameSection = .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support; + DwarfExceptionSection = .section __DATA,__gcc_except_tab; } DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine TM) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.151 - 1.152 --- Log message: Add support for changes in DwarfWriter. --- Diffs of the changes: (+12 -0) AsmPrinter.cpp | 12 1 files changed, 12 insertions(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.151 llvm/lib/CodeGen/AsmPrinter.cpp:1.152 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.151 Thu Feb 15 19:54:53 2007 +++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Feb 21 16:47:38 2007 @@ -370,6 +370,14 @@ return LinkName; } +/// EmitExternalGlobal - Emit the external reference to a global variable. +/// Should be overridden if an indirect reference should be used. +void AsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) { + O getGlobalLinkName(GV); +} + + + //===--===// /// LEB 128 number encoding. @@ -440,6 +448,9 @@ /// EOL - Print a newline character to asm stream. If a comment is present /// then it will be printed first. Comments should not contain '\n'. +void AsmPrinter::EOL() const { + O \n; +} void AsmPrinter::EOL(const std::string Comment) const { if (AsmVerbose !Comment.empty()) { O \t @@ -569,6 +580,7 @@ O TAI-getAlignDirective() NumBits \n; } + /// EmitZeros - Emit a block of zeros. /// void AsmPrinter::EmitZeros(uint64_t NumZeros) const { ___ 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/PPCAsmPrinter.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.233 - 1.234 --- Log message: Add support for changes in DwarfWriter. --- Diffs of the changes: (+14 -0) PPCAsmPrinter.cpp | 14 ++ 1 files changed, 14 insertions(+) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.233 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.234 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.233 Wed Jan 31 18:39:08 2007 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Feb 21 16:47:38 2007 @@ -280,6 +280,8 @@ virtual bool runOnMachineFunction(MachineFunction F) = 0; virtual bool doFinalization(Module M) = 0; + +virtual void EmitExternalGlobal(const GlobalVariable *GV); }; /// LinuxAsmPrinter - PowerPC assembly printer, customized for Linux @@ -401,6 +403,18 @@ } } +/// EmitExternalGlobal - In this case we need to use the indirect symbol. +/// +void PPCAsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) { + std::string Name = getGlobalLinkName(GV); + if (TM.getRelocationModel() != Reloc::Static) { +GVStubs.insert(Name); +O L Name $non_lazy_ptr; +return; + } + O Name; +} + /// PrintAsmOperand - Print out an operand for an inline asm expression. /// bool PPCAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h
Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.61 - 1.62 --- Log message: Add support for changes in DwarfWriter. --- Diffs of the changes: (+5 -0) AsmPrinter.h |5 + 1 files changed, 5 insertions(+) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.61 llvm/include/llvm/CodeGen/AsmPrinter.h:1.62 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.61 Fri Jan 26 08:34:51 2007 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Wed Feb 21 16:47:38 2007 @@ -105,6 +105,10 @@ /// generate the appropriate value. virtual const std::string getGlobalLinkName(const GlobalVariable *GV) const; +/// EmitExternalGlobal - Emit the external reference to a global variable. +/// Should be overridden if an indirect reference should be used. +virtual void EmitExternalGlobal(const GlobalVariable *GV); + protected: /// doInitialization - Set up the AsmPrinter when we are working on a new /// module. If your pass overrides this, it must make sure to explicitly @@ -204,6 +208,7 @@ /// EOL - Print a newline character to asm stream. If a comment is present /// then it will be printed first. Comments should not contain '\n'. +void EOL() const; void EOL(const std::string Comment) const; /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.125 - 1.126 AsmPrinter.cpp updated: 1.152 - 1.153 --- Log message: Exception handling support. --- Diffs of the changes: (+313 -94) AsmPrinter.cpp |2 DwarfWriter.cpp | 405 +++- 2 files changed, 313 insertions(+), 94 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.125 llvm/lib/CodeGen/DwarfWriter.cpp:1.126 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.125 Thu Feb 1 11:48:20 2007 +++ llvm/lib/CodeGen/DwarfWriter.cppWed Feb 21 16:48:45 2007 @@ -55,7 +55,7 @@ //===--===// /// DWLabel - Labels are used to track locations in the assembler file. -/// Labels appear in the form prefixdebug_TagNumber, where the tag is a +/// Labels appear in the form prefixTagNumber, where the tag is a /// category of label (Ex. location) and number is a value unique in that /// category. class DWLabel { @@ -80,7 +80,7 @@ if (O) print(*O); } void print(std::ostream O) const { -O .debug_ Tag; +O . Tag; if (Number) O Number; } #endif @@ -791,14 +791,6 @@ /// MachineModuleInfo *MMI; - /// didInitial - Flag to indicate if initial emission has been done. - /// - bool didInitial; - - /// shouldEmit - Flag to indicate if debug information should be emitted. - /// - bool shouldEmit; - /// SubprogramCount - The running count of functions being compiled. /// unsigned SubprogramCount; @@ -812,8 +804,6 @@ , M(NULL) , MF(NULL) , MMI(NULL) - , didInitial(false) - , shouldEmit(false) , SubprogramCount(0) { } @@ -827,20 +817,13 @@ MachineModuleInfo *getMMI() const { return MMI; } const TargetAsmInfo *getTargetAsmInfo() const { return TAI; } - /// ShouldEmitDwarf - Returns true if Dwarf declarations should be made. - /// - bool ShouldEmitDwarf() const { return shouldEmit; } - - /// PrintLabelName - Print label name in form used by Dwarf writer. /// void PrintLabelName(DWLabel Label) const { PrintLabelName(Label.Tag, Label.Number); } void PrintLabelName(const char *Tag, unsigned Number) const { -O TAI-getPrivateGlobalPrefix() - ((Tag *Tag) ? debug_ : label_) - Tag; +O TAI-getPrivateGlobalPrefix() Tag; if (Number) O Number; } @@ -932,7 +915,7 @@ Asm-TM.getFrameInfo()-getStackGrowthDirection() == TargetFrameInfo::StackGrowsUp ? TAI-getAddressSize() : -TAI-getAddressSize(); -bool IsLocal = BaseLabel strcmp(BaseLabel, ) == 0; +bool IsLocal = BaseLabel strcmp(BaseLabel, label) == 0; for (unsigned i = 0, N = Moves.size(); i N; ++i) { MachineMove Move = Moves[i]; @@ -952,11 +935,11 @@ if (BaseLabel LabelID (BaseLabelID != LabelID || !IsLocal)) { Asm-EmitInt8(DW_CFA_advance_loc4); Asm-EOL(DW_CFA_advance_loc4); -EmitDifference(, LabelID, BaseLabel, BaseLabelID, true); -Asm-EOL(); +EmitDifference(label, LabelID, BaseLabel, BaseLabelID, true); +Asm-EOL(); BaseLabelID = LabelID; -BaseLabel = ; +BaseLabel = label; IsLocal = true; } @@ -1066,8 +1049,19 @@ /// std::vectorstd::vectorSourceLineInfo SectionSourceLines; + /// didInitial - Flag to indicate if initial emission has been done. + /// + bool didInitial; + + /// shouldEmit - Flag to indicate if debug information should be emitted. + /// + bool shouldEmit; public: + + /// ShouldEmitDwarf - Returns true if Dwarf declarations should be made. + /// + bool ShouldEmitDwarf() const { return shouldEmit; } /// AssignAbbrevNumber - Define a unique number for the abbreviation. /// @@ -1850,14 +1844,14 @@ // Add the scope bounds. if (StartID) { AddLabel(ScopeDie, DW_AT_low_pc, DW_FORM_addr, - DWLabel(, StartID)); + DWLabel(label, StartID)); } else { AddLabel(ScopeDie, DW_AT_low_pc, DW_FORM_addr, DWLabel(func_begin, SubprogramCount)); } if (EndID) { AddLabel(ScopeDie, DW_AT_high_pc, DW_FORM_addr, - DWLabel(, EndID)); + DWLabel(label, EndID)); } else { AddLabel(ScopeDie, DW_AT_high_pc, DW_FORM_addr, DWLabel(func_end, SubprogramCount)); @@ -1944,7 +1938,7 @@ unsigned AbbrevNumber = Die-getAbbrevNumber(); const DIEAbbrev *Abbrev = Abbreviations[AbbrevNumber - 1]; -Asm-EOL(); +Asm-EOL(); // Emit the code (index) for the abbreviation. Asm-EmitULEB128Bytes(AbbrevNumber); @@ -2082,7 +2076,7 @@ Asm-EmitInt8(0); Asm-EOL(Extra Pad For GDB); EmitLabel(info_end, Unit-getID()); -Asm-EOL(); +
[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerInvoke.cpp
Changes in directory llvm/lib/Transforms/Utils: LowerInvoke.cpp updated: 1.55 - 1.56 --- Log message: Itanium ABI exception handing support. --- Diffs of the changes: (+50 -36) LowerInvoke.cpp | 86 1 files changed, 50 insertions(+), 36 deletions(-) Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.55 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.56 --- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.55 Mon Feb 19 01:34:47 2007 +++ llvm/lib/Transforms/Utils/LowerInvoke.cpp Wed Feb 21 16:49:50 2007 @@ -57,6 +57,9 @@ static cl::optbool ExpensiveEHSupport(enable-correct-eh-support, cl::desc(Make the -lowerinvoke pass insert expensive, but correct, EH code)); + +static cl::optbool ItaniumEHSupport(enable-real-eh-support, + cl::desc(Make the -lowerinvoke pass insert itanium ABI EH code)); namespace { class VISIBILITY_HIDDEN LowerInvoke : public FunctionPass { @@ -94,6 +97,7 @@ void splitLiveRangesLiveAcrossInvokes(std::vectorInvokeInst* Invokes); void rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo, AllocaInst *InvokeNum, SwitchInst *CatchSwitch); +bool insertItaniumEHSupport(Function F); bool insertExpensiveEHSupport(Function F); }; @@ -111,46 +115,50 @@ // doInitialization - Make sure that there is a prototype for abort in the // current module. bool LowerInvoke::doInitialization(Module M) { - const Type *VoidPtrTy = PointerType::get(Type::Int8Ty); - AbortMessage = 0; - if (ExpensiveEHSupport) { -// Insert a type for the linked list of jump buffers. -unsigned JBSize = TLI ? TLI-getJumpBufSize() : 0; -JBSize = JBSize ? JBSize : 200; -const Type *JmpBufTy = ArrayType::get(VoidPtrTy, JBSize); - -{ // The type is recursive, so use a type holder. - std::vectorconst Type* Elements; - Elements.push_back(JmpBufTy); - OpaqueType *OT = OpaqueType::get(); - Elements.push_back(PointerType::get(OT)); - PATypeHolder JBLType(StructType::get(Elements)); - OT-refineAbstractTypeTo(JBLType.get()); // Complete the cycle. - JBLinkTy = JBLType.get(); - M.addTypeName(llvm.sjljeh.jmpbufty, JBLinkTy); -} + if (ItaniumEHSupport) { +// Let Invoke pass through for ItaniumEHSupport support. + } else { +const Type *VoidPtrTy = PointerType::get(Type::Int8Ty); +AbortMessage = 0; +if (ExpensiveEHSupport) { + // Insert a type for the linked list of jump buffers. + unsigned JBSize = TLI ? TLI-getJumpBufSize() : 0; + JBSize = JBSize ? JBSize : 200; + const Type *JmpBufTy = ArrayType::get(VoidPtrTy, JBSize); + + { // The type is recursive, so use a type holder. +std::vectorconst Type* Elements; +Elements.push_back(JmpBufTy); +OpaqueType *OT = OpaqueType::get(); +Elements.push_back(PointerType::get(OT)); +PATypeHolder JBLType(StructType::get(Elements)); +OT-refineAbstractTypeTo(JBLType.get()); // Complete the cycle. +JBLinkTy = JBLType.get(); +M.addTypeName(llvm.sjljeh.jmpbufty, JBLinkTy); + } -const Type *PtrJBList = PointerType::get(JBLinkTy); + const Type *PtrJBList = PointerType::get(JBLinkTy); -// Now that we've done that, insert the jmpbuf list head global, unless it -// already exists. -if (!(JBListHead = M.getGlobalVariable(llvm.sjljeh.jblist, PtrJBList))) { - JBListHead = new GlobalVariable(PtrJBList, false, - GlobalValue::LinkOnceLinkage, - Constant::getNullValue(PtrJBList), - llvm.sjljeh.jblist, M); + // Now that we've done that, insert the jmpbuf list head global, unless it + // already exists. + if (!(JBListHead = M.getGlobalVariable(llvm.sjljeh.jblist, PtrJBList))){ +JBListHead = new GlobalVariable(PtrJBList, false, +GlobalValue::LinkOnceLinkage, +Constant::getNullValue(PtrJBList), +llvm.sjljeh.jblist, M); + } + SetJmpFn = M.getOrInsertFunction(llvm.setjmp, Type::Int32Ty, + PointerType::get(JmpBufTy), (Type *)0); + LongJmpFn = M.getOrInsertFunction(llvm.longjmp, Type::VoidTy, +PointerType::get(JmpBufTy), +Type::Int32Ty, (Type *)0); } -SetJmpFn = M.getOrInsertFunction(llvm.setjmp, Type::Int32Ty, - PointerType::get(JmpBufTy), (Type *)0); -LongJmpFn = M.getOrInsertFunction(llvm.longjmp, Type::VoidTy, - PointerType::get(JmpBufTy), - Type::Int32Ty, (Type *)0); - } - // We need the 'write' and 'abort' functions for both
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.67 - 1.68 --- Log message: Selection and lowering for exception handling. --- Diffs of the changes: (+5 -0) IntrinsicLowering.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.67 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.68 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.67 Tue Feb 13 00:01:22 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Feb 21 16:53:45 2007 @@ -357,6 +357,11 @@ case Intrinsic::dbg_func_start: case Intrinsic::dbg_declare: break;// Simply strip out debugging intrinsics + + case Intrinsic::eh_exception: + case Intrinsic::eh_handlers: +assert(0 Should not have leaked through); +break; case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: { ___ 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/LegalizeDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.476 - 1.477 SelectionDAG.cpp updated: 1.389 - 1.390 SelectionDAGISel.cpp updated: 1.369 - 1.370 --- Log message: Selection and lowering for exception handling. --- Diffs of the changes: (+141 -2) LegalizeDAG.cpp |2 SelectionDAG.cpp |2 SelectionDAGISel.cpp | 139 ++- 3 files changed, 141 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.476 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.477 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.476 Wed Feb 14 21:39:18 2007 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 21 16:53:45 2007 @@ -668,6 +668,8 @@ break; case ISD::FRAMEADDR: case ISD::RETURNADDR: + case ISD::EXCEPTIONADDR: + case ISD::EHSELECTION: // The only option for these nodes is to custom lower them. If the target // does not custom lower them, then return zero. Tmp1 = TLI.LowerOperation(Op, DAG); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.389 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.390 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.389Sun Feb 4 02:35:21 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Feb 21 16:53:45 2007 @@ -2679,6 +2679,8 @@ case ISD::GLOBAL_OFFSET_TABLE: return GLOBAL_OFFSET_TABLE; case ISD::RETURNADDR: return RETURNADDR; case ISD::FRAMEADDR: return FRAMEADDR; + case ISD::EXCEPTIONADDR: return EXCEPTIONADDR; + case ISD::EHSELECTION: return EHSELECTION; case ISD::ConstantPool: return ConstantPool; case ISD::ExternalSymbol: return ExternalSymbol; case ISD::INTRINSIC_WO_CHAIN: { Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.369 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.370 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.369Wed Feb 14 21:39:18 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb 21 16:53:45 2007 @@ -496,8 +496,8 @@ void visitJumpTable(SelectionDAGISel::JumpTable JT); // These all get lowered before this pass. - void visitInvoke(InvokeInst I) { assert(0 TODO); } - void visitUnwind(UnwindInst I) { assert(0 TODO); } + void visitInvoke(InvokeInst I); + void visitUnwind(UnwindInst I); void visitScalarBinary(User I, unsigned OpCode); void visitVectorBinary(User I, unsigned OpCode); @@ -1101,6 +1101,56 @@ return; } +void SelectionDAGLowering::visitInvoke(InvokeInst I) { + // Retrieve successors. + MachineBasicBlock *Return = FuncInfo.MBBMap[I.getSuccessor(0)]; + MachineBasicBlock *LandingPad = FuncInfo.MBBMap[I.getSuccessor(1)]; + + // Mark landing pad so that it doesn't get deleted in branch folding. + LandingPad-setIsLandingPad(); + + // Insert a label before the invoke call to mark the try range. + // This can be used to detect deletion of the invoke via the + // MachineModuleInfo. + MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); + unsigned BeginLabel = MMI-NextLabelID(); + DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), + DAG.getConstant(BeginLabel, MVT::i32))); + + // Insert a normal call instruction. + std::vectorValue* Args; + for (InvokeInst::op_iterator OI = I.op_begin() + 3, E = I.op_end(); + OI != E; ++OI) { +Args.push_back(*OI); + } + CallInst *NewCall = new CallInst(I.getCalledValue(), Args[0], Args.size(), + I.getName(), I); + NewCall-setCallingConv(I.getCallingConv()); + I.replaceAllUsesWith(NewCall); + visitCall(*NewCall); + + // Insert a label before the invoke call to mark the try range. + // This can be used to detect deletion of the invoke via the + // MachineModuleInfo. + unsigned EndLabel = MMI-NextLabelID(); + DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), + DAG.getConstant(EndLabel, MVT::i32))); + + // Inform MachineModuleInfo of range. + MMI-addInvoke(LandingPad, BeginLabel, EndLabel); + + // Drop into normal successor. + DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(), + DAG.getBasicBlock(Return))); + + // Update successor info + CurMBB-addSuccessor(Return); + CurMBB-addSuccessor(LandingPad); +} + +void SelectionDAGLowering::visitUnwind(UnwindInst I) { +} + void SelectionDAGLowering::visitSwitch(SwitchInst I) { // Figure out which block is immediately after the current one. MachineBasicBlock *NextBlock = 0; @@ -2033,6 +2083,91 @@ return 0; } + case Intrinsic::eh_exception: { +MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); + +// Add a label to mark the beginning of the landing pad. Deletion of the
[llvm-commits] CVS: llvm/include/llvm/Target/MRegisterInfo.h
Changes in directory llvm/include/llvm/Target: MRegisterInfo.h updated: 1.94 - 1.95 --- Log message: Support to provide exception and selector registers. --- Diffs of the changes: (+9 -1) MRegisterInfo.h | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/MRegisterInfo.h diff -u llvm/include/llvm/Target/MRegisterInfo.h:1.94 llvm/include/llvm/Target/MRegisterInfo.h:1.95 --- llvm/include/llvm/Target/MRegisterInfo.h:1.94 Mon Feb 19 15:49:53 2007 +++ llvm/include/llvm/Target/MRegisterInfo.hWed Feb 21 16:54:50 2007 @@ -469,7 +469,15 @@ /// getRARegister - This method should return the register where the return /// address can be found. virtual unsigned getRARegister() const = 0; - + + /// getEHExceptionRegister - This method should return the register containing + /// the address of the exception info on entry to a landing pad. + virtual unsigned getEHExceptionRegister() const = 0; + + /// getEHHandlerRegister - This method should return the register containing + /// the switch table selection on entry to an landing pad. + virtual unsigned getEHHandlerRegister() const = 0; + /// getLocation - This method should return the actual location of a frame /// variable given the frame index. The location is returned in ML. /// Subclasses should override this method for special handling of frame ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp SparcRegisterInfo.cpp SparcRegisterInfo.h
Changes in directory llvm/lib/Target/Sparc: SparcISelDAGToDAG.cpp updated: 1.119 - 1.120 SparcRegisterInfo.cpp updated: 1.54 - 1.55 SparcRegisterInfo.h updated: 1.20 - 1.21 --- Log message: Support to provide exception and selector registers. --- Diffs of the changes: (+17 -0) SparcISelDAGToDAG.cpp |3 +++ SparcRegisterInfo.cpp | 10 ++ SparcRegisterInfo.h |4 3 files changed, 17 insertions(+) Index: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp diff -u llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.119 llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.120 --- llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.119 Mon Jan 29 16:58:52 2007 +++ llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Wed Feb 21 16:54:50 2007 @@ -871,6 +871,9 @@ // Frame Return address. Currently unimplemented case ISD::RETURNADDR: break; case ISD::FRAMEADDR: break; + // Exception address and exception selector. Currently unimplemented. + case ISD::EXCEPTIONADDR: break; + case ISD::EHSELECTION: break; } return SDOperand(); } Index: llvm/lib/Target/Sparc/SparcRegisterInfo.cpp diff -u llvm/lib/Target/Sparc/SparcRegisterInfo.cpp:1.54 llvm/lib/Target/Sparc/SparcRegisterInfo.cpp:1.55 --- llvm/lib/Target/Sparc/SparcRegisterInfo.cpp:1.54Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/Sparc/SparcRegisterInfo.cpp Wed Feb 21 16:54:50 2007 @@ -250,5 +250,15 @@ return SP::G1; } +unsigned SparcRegisterInfo::getEHExceptionRegister() const { + assert(0 What is the exception register); + return 0; +} + +unsigned SparcRegisterInfo::getEHHandlerRegister() const { + assert(0 What is the exception handler register); + return 0; +} + #include SparcGenRegisterInfo.inc Index: llvm/lib/Target/Sparc/SparcRegisterInfo.h diff -u llvm/lib/Target/Sparc/SparcRegisterInfo.h:1.20 llvm/lib/Target/Sparc/SparcRegisterInfo.h:1.21 --- llvm/lib/Target/Sparc/SparcRegisterInfo.h:1.20 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/Sparc/SparcRegisterInfo.h Wed Feb 21 16:54:50 2007 @@ -70,6 +70,10 @@ // Debug information queries. unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction MF) const; + + // Exception handling queries. + unsigned getEHExceptionRegister() const; + unsigned getEHHandlerRegister() const; }; } // end namespace llvm ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelLowering.cpp IA64RegisterInfo.cpp IA64RegisterInfo.h
Changes in directory llvm/lib/Target/IA64: IA64ISelLowering.cpp updated: 1.53 - 1.54 IA64RegisterInfo.cpp updated: 1.31 - 1.32 IA64RegisterInfo.h updated: 1.14 - 1.15 --- Log message: Support to provide exception and selector registers. --- Diffs of the changes: (+17 -0) IA64ISelLowering.cpp |3 +++ IA64RegisterInfo.cpp | 10 ++ IA64RegisterInfo.h |4 3 files changed, 17 insertions(+) Index: llvm/lib/Target/IA64/IA64ISelLowering.cpp diff -u llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.53 llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.54 --- llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.53 Mon Jan 29 16:58:52 2007 +++ llvm/lib/Target/IA64/IA64ISelLowering.cpp Wed Feb 21 16:54:50 2007 @@ -590,6 +590,9 @@ // Frame Return address. Currently unimplemented case ISD::RETURNADDR: break; case ISD::FRAMEADDR: break; + // Exception address and exception selector. Currently unimplemented. + case ISD::EXCEPTIONADDR: break; + case ISD::EHSELECTION: break; } return SDOperand(); } Index: llvm/lib/Target/IA64/IA64RegisterInfo.cpp diff -u llvm/lib/Target/IA64/IA64RegisterInfo.cpp:1.31 llvm/lib/Target/IA64/IA64RegisterInfo.cpp:1.32 --- llvm/lib/Target/IA64/IA64RegisterInfo.cpp:1.31 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/IA64/IA64RegisterInfo.cpp Wed Feb 21 16:54:50 2007 @@ -360,5 +360,15 @@ return hasFP(MF) ? IA64::r5 : IA64::r12; } +unsigned IA64RegisterInfo::getEHExceptionRegister() const { + assert(0 What is the exception register); + return 0; +} + +unsigned IA64RegisterInfo::getEHHandlerRegister() const { + assert(0 What is the exception handler register); + return 0; +} + #include IA64GenRegisterInfo.inc Index: llvm/lib/Target/IA64/IA64RegisterInfo.h diff -u llvm/lib/Target/IA64/IA64RegisterInfo.h:1.14 llvm/lib/Target/IA64/IA64RegisterInfo.h:1.15 --- llvm/lib/Target/IA64/IA64RegisterInfo.h:1.14Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/IA64/IA64RegisterInfo.h Wed Feb 21 16:54:50 2007 @@ -64,6 +64,10 @@ // Debug information queries. unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction MF) const; + + // Exception handling queries. + unsigned getEHExceptionRegister() const; + unsigned getEHHandlerRegister() const; }; } // End llvm namespace ___ 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/ARMISelLowering.cpp ARMRegisterInfo.cpp ARMRegisterInfo.h
Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.14 - 1.15 ARMRegisterInfo.cpp updated: 1.69 - 1.70 ARMRegisterInfo.h updated: 1.10 - 1.11 --- Log message: Support to provide exception and selector registers. --- Diffs of the changes: (+17 -0) ARMISelLowering.cpp |3 +++ ARMRegisterInfo.cpp | 10 ++ ARMRegisterInfo.h |4 3 files changed, 17 insertions(+) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.14 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.15 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.14Tue Feb 13 08:07:13 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Wed Feb 21 16:54:50 2007 @@ -1190,6 +1190,9 @@ return LowerFORMAL_ARGUMENTS(Op, DAG); case ISD::RETURNADDR:break; case ISD::FRAMEADDR: break; + // Exception address and exception selector. Currently unimplemented. + case ISD::EXCEPTIONADDR: break; + case ISD::EHSELECTION: break; } return SDOperand(); } Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.69 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.70 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.69Mon Feb 19 15:49:53 2007 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Wed Feb 21 16:54:50 2007 @@ -1287,5 +1287,15 @@ return STI.useThumbBacktraces() ? ARM::R7 : ARM::R11; } +unsigned ARMRegisterInfo::getEHExceptionRegister() const { + assert(0 What is the exception register); + return 0; +} + +unsigned ARMRegisterInfo::getEHHandlerRegister() const { + assert(0 What is the exception handler register); + return 0; +} + #include ARMGenRegisterInfo.inc Index: llvm/lib/Target/ARM/ARMRegisterInfo.h diff -u llvm/lib/Target/ARM/ARMRegisterInfo.h:1.10 llvm/lib/Target/ARM/ARMRegisterInfo.h:1.11 --- llvm/lib/Target/ARM/ARMRegisterInfo.h:1.10 Mon Feb 19 15:49:53 2007 +++ llvm/lib/Target/ARM/ARMRegisterInfo.h Wed Feb 21 16:54:50 2007 @@ -85,6 +85,10 @@ // Debug information queries. unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction MF) const; + + // Exception handling queries. + unsigned getEHExceptionRegister() const; + unsigned getEHHandlerRegister() const; }; } // end namespace llvm ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelLowering.cpp AlphaRegisterInfo.cpp AlphaRegisterInfo.h
Changes in directory llvm/lib/Target/Alpha: AlphaISelLowering.cpp updated: 1.81 - 1.82 AlphaRegisterInfo.cpp updated: 1.60 - 1.61 AlphaRegisterInfo.h updated: 1.20 - 1.21 --- Log message: Support to provide exception and selector registers. --- Diffs of the changes: (+18 -1) AlphaISelLowering.cpp |5 - AlphaRegisterInfo.cpp | 10 ++ AlphaRegisterInfo.h |4 3 files changed, 18 insertions(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.81 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.82 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.81Thu Feb 8 11:37:41 2007 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Wed Feb 21 16:54:50 2007 @@ -548,8 +548,11 @@ return DAG.getNode(AlphaISD::GlobalRetAddr, MVT::i64); //FIXME: implement case ISD::FRAMEADDR: break; + // Exception address and exception selector. Currently unimplemented. + case ISD::EXCEPTIONADDR: break; + case ISD::EHSELECTION: break; } - + return SDOperand(); } Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.60 llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.61 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.60Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Wed Feb 21 16:54:50 2007 @@ -399,6 +399,16 @@ return hasFP(MF) ? Alpha::R15 : Alpha::R30; } +unsigned AlphaRegisterInfo::getEHExceptionRegister() const { + assert(0 What is the exception register); + return 0; +} + +unsigned AlphaRegisterInfo::getEHHandlerRegister() const { + assert(0 What is the exception handler register); + return 0; +} + #include AlphaGenRegisterInfo.inc std::string AlphaRegisterInfo::getPrettyName(unsigned reg) Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.h diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.20 llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.21 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.20 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.h Wed Feb 21 16:54:50 2007 @@ -68,6 +68,10 @@ unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction MF) const; + // Exception handling queries. + unsigned getEHExceptionRegister() const; + unsigned getEHHandlerRegister() const; + static std::string getPrettyName(unsigned reg); }; ___ 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/PPCISelLowering.cpp PPCRegisterInfo.cpp PPCRegisterInfo.h
Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.251 - 1.252 PPCRegisterInfo.cpp updated: 1.108 - 1.109 PPCRegisterInfo.h updated: 1.27 - 1.28 --- Log message: Support to provide exception and selector registers. --- Diffs of the changes: (+40 -1) PPCISelLowering.cpp | 28 PPCRegisterInfo.cpp |9 - PPCRegisterInfo.h |4 3 files changed, 40 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.251 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.252 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.251 Sat Feb 17 00:57:26 2007 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Feb 21 16:54:50 2007 @@ -2610,6 +2610,30 @@ } } +/// LowerEXCEPTIONADDR - Replace EXCEPTIONADDR with a copy from the exception +/// register. The register was made live in the ISel. +static SDOperand LowerEXCEPTIONADDR(SDOperand Op, SelectionDAG DAG) { + const MRegisterInfo *MRI = DAG.getTargetLoweringInfo(). + getTargetMachine(). + getRegisterInfo(); + MVT::ValueType VT = Op.Val-getValueType(0); + unsigned Reg = MRI-getEHExceptionRegister(); + SDOperand Result = DAG.getCopyFromReg(Op.getOperand(0), Reg, VT); + return Result.getValue(Op.ResNo); +} + +/// LowerEXCEPTIONADDR - Replace EHSELECTION with a copy from the exception +/// selection register. The register was made live in the ISel. +static SDOperand LowerEHSELECTION(SDOperand Op, SelectionDAG DAG) { + const MRegisterInfo *MRI = DAG.getTargetLoweringInfo(). + getTargetMachine(). + getRegisterInfo(); + MVT::ValueType VT = Op.Val-getValueType(0); + unsigned Reg = MRI-getEHHandlerRegister(); + SDOperand Result = DAG.getCopyFromReg(Op.getOperand(1), Reg, VT); + return Result.getValue(Op.ResNo); +} + /// LowerOperation - Provide custom lowering hooks for some operations. /// SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG DAG) { @@ -2647,6 +2671,10 @@ // Frame Return address. Currently unimplemented case ISD::RETURNADDR: break; case ISD::FRAMEADDR: break; + + // Exception address and exception selector. + case ISD::EXCEPTIONADDR: return LowerEXCEPTIONADDR(Op, DAG); + case ISD::EHSELECTION:return LowerEHSELECTION(Op, DAG); } return SDOperand(); } Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.108 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.109 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.108 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Wed Feb 21 16:54:50 2007 @@ -1022,7 +1022,6 @@ unsigned PPCRegisterInfo::getRARegister() const { return !Subtarget.isPPC64() ? PPC::LR : PPC::LR8; - } unsigned PPCRegisterInfo::getFrameRegister(MachineFunction MF) const { @@ -1040,5 +1039,13 @@ Moves.push_back(MachineMove(0, Dst, Src)); } +unsigned PPCRegisterInfo::getEHExceptionRegister() const { + return !Subtarget.isPPC64() ? PPC::R3 : PPC::X3; +} + +unsigned PPCRegisterInfo::getEHHandlerRegister() const { + return !Subtarget.isPPC64() ? PPC::R4 : PPC::X4; +} + #include PPCGenRegisterInfo.inc Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.h diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.27 llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.28 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.27 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.h Wed Feb 21 16:54:50 2007 @@ -89,6 +89,10 @@ unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction MF) const; void getInitialFrameState(std::vectorMachineMove Moves) const; + + // Exception handling queries. + unsigned getEHExceptionRegister() const; + unsigned getEHHandlerRegister() const; }; } // end namespace llvm ___ 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 X86RegisterInfo.cpp X86RegisterInfo.h
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.321 - 1.322 X86RegisterInfo.cpp updated: 1.203 - 1.204 X86RegisterInfo.h updated: 1.48 - 1.49 --- Log message: Support to provide exception and selector registers. --- Diffs of the changes: (+18 -0) X86ISelLowering.cpp |4 X86RegisterInfo.cpp | 10 ++ X86RegisterInfo.h |4 3 files changed, 18 insertions(+) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.321 llvm/lib/Target/X86/X86ISelLowering.cpp:1.322 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.321 Wed Feb 21 15:18:14 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Feb 21 16:54:50 2007 @@ -4675,7 +4675,11 @@ case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG); case ISD::RETURNADDR: return LowerRETURNADDR(Op, DAG); case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG); + // Exception address and exception selector. Currently unimplemented. + case ISD::EXCEPTIONADDR: break; + case ISD::EHSELECTION: break; } + return SDOperand(); } const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const { Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.203 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.204 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.203 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Wed Feb 21 16:54:50 2007 @@ -1193,6 +1193,16 @@ Moves.push_back(MachineMove(0, Dst, Src)); } +unsigned X86RegisterInfo::getEHExceptionRegister() const { + assert(0 What is the exception register); + return 0; +} + +unsigned X86RegisterInfo::getEHHandlerRegister() const { + assert(0 What is the exception handler register); + return 0; +} + namespace llvm { unsigned getX86SubSuperRegister(unsigned Reg, MVT::ValueType VT, bool High) { switch (VT) { Index: llvm/lib/Target/X86/X86RegisterInfo.h diff -u llvm/lib/Target/X86/X86RegisterInfo.h:1.48 llvm/lib/Target/X86/X86RegisterInfo.h:1.49 --- llvm/lib/Target/X86/X86RegisterInfo.h:1.48 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/X86/X86RegisterInfo.h Wed Feb 21 16:54:50 2007 @@ -101,6 +101,10 @@ unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction MF) const; void getInitialFrameState(std::vectorMachineMove Moves) const; + + // Exception handling queries. + unsigned getEHExceptionRegister() const; + unsigned getEHHandlerRegister() const; }; // getX86SubSuperRegister - X86 utility function. It returns the sub or super ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h
On Feb 21, 2007, at 2:40 PM, Jim Laskey wrote: + + /// IsLandingPad - Indicate that this basic block is entered via an + /// exception handler. + bool IsLandingPad; Since you are touching this... :-) Seems to me there is a way to reorganize the fields within MachineBasicBlock to save some space (not to mention putting them in a more sensible order). Can we steal a bit from the Number field to indicate isLandingPad? Evan public: MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0), BB(bb), -Number(-1), Parent (0) { +Number(-1), Parent (0), +IsLandingPad(false) { Insts.parent = this; } @@ -152,6 +157,18 @@ const_livein_iterator livein_end() const { return LiveIns.end (); } boollivein_empty() const { return LiveIns.empty(); } + /// isLandingPad - Returns true if the block is a landing pad. That is + /// this basic block is entered via an exception handler. + bool isLandingPad() const { return IsLandingPad; } + + /// setIsLandingPad - Indicates the block is a landing pad. That is + /// this basic block is entered via an exception handler. + void setIsLandingPad() { IsLandingPad = true; } + + /// isAccessable - Returns true if the block is alive. That is, if it has + /// predecessors or is an eh landing pad. + bool isAccessable() const { return !pred_empty() || isLandingPad (); } + // Code Layout methods. /// moveBefore/moveAfter - move 'this' block before or after the specified ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ 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.29 - 1.30 --- Log message: Fix countLeadingZeros in the case that the bitwidth evenly divides the word size. This fixes all reads of uninitialized data (buffer over read) and makes APInt.cpp memory clean, per valgrind. The only remaining problem is division in a few cases. --- Diffs of the changes: (+4 -1) APInt.cpp |5 - 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.29 llvm/lib/Support/APInt.cpp:1.30 --- llvm/lib/Support/APInt.cpp:1.29 Wed Feb 21 02:21:52 2007 +++ llvm/lib/Support/APInt.cpp Wed Feb 21 18:22:00 2007 @@ -726,7 +726,10 @@ } } } - return Count - (APINT_BITS_PER_WORD - (BitWidth % APINT_BITS_PER_WORD)); + uint32_t remainder = BitWidth % APINT_BITS_PER_WORD; + if (remainder) +Count -= APINT_BITS_PER_WORD - remainder; + return Count; } /// countTrailingZeros - This function is a APInt version corresponding to ___ 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.30 - 1.31 --- Log message: When converting from 64 to 32-bits, use the actual number of words to extract the value, not the number of words implied by the active bits. This fixes numerous, but not all divide bugs. --- Diffs of the changes: (+2 -2) APInt.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.30 llvm/lib/Support/APInt.cpp:1.31 --- llvm/lib/Support/APInt.cpp:1.30 Wed Feb 21 18:22:00 2007 +++ llvm/lib/Support/APInt.cpp Wed Feb 21 18:58:45 2007 @@ -1177,7 +1177,7 @@ uint32_t *U = new uint32_t[m + n + 1]; memset(U, 0, (m+n+1)*sizeof(uint32_t)); for (unsigned i = 0; i lhsWords; ++i) { -uint64_t tmp = (lhsWords == 1 ? LHS.VAL : LHS.pVal[i]); +uint64_t tmp = (LHS.getNumWords() == 1 ? LHS.VAL : LHS.pVal[i]); U[i * 2] = tmp mask; U[i * 2 + 1] = tmp (sizeof(uint32_t)*8); } @@ -1186,7 +1186,7 @@ uint32_t *V = new uint32_t[n]; memset(V, 0, (n)*sizeof(uint32_t)); for (unsigned i = 0; i rhsWords; ++i) { -uint64_t tmp = (rhsWords == 1 ? RHS.VAL : RHS.pVal[i]); +uint64_t tmp = (RHS.getNumWords() == 1 ? RHS.VAL : RHS.pVal[i]); V[i * 2] = tmp mask; V[i * 2 + 1] = tmp (sizeof(uint32_t)*8); } ___ 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.2 - 1.3 --- Log message: Don't invoke gp with the --test flag, it causes the output lines to wrap and that causes false positives. --- Diffs of the changes: (+13 -6) gptest.cpp | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.2 llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.3 --- llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp:1.2 Wed Feb 21 02:28:20 2007 +++ llvm-test/SingleSource/UnitTests/Integer/APInt/gptest.cpp Wed Feb 21 19:03:12 2007 @@ -182,7 +182,7 @@ } /* function executed by the user-interacting process. */ -void test_driver(int input_pipe[], int output_pipe[]) { +void test_driver(int low, int high, int input_pipe[], int output_pipe[]) { int c;/* user input - must be 'int', to recognize EOF (= -1). */ char ch; /* the same - as a char. */ @@ -203,7 +203,7 @@ srand(0); // Start loop over the range of bits of interest - for (unsigned bits = 1; bits = 1024; bits++) { + for (int bits = low; bits = high; bits++) { // Indicate which test case we are running printf(\nTEST CASE: %d BITS\n, bits); fflush(stdout); @@ -270,8 +270,7 @@ // exec gp with modes: // --quiet (don't print banner), // --fast (don't read init files) -// --test (no history, wrap long lines) -execlp(gp, gp, --quiet, --fast, --test, (char*)NULL); +execlp(gp, gp, --quiet, --fast, (char*)NULL); perror(execlp); exit(1); } @@ -285,6 +284,14 @@ int translator_to_user[2]; int pid; /* pid of child process, or 0, as returned via fork.*/ int rc;/* stores return values of various routines.*/ +int low_bit = 1; +int high_bit = 1024; + +// Get the arguments +if (argc 2) { + low_bit = atoi(argv[1]); + high_bit = atoi(argv[2]); +} /* first, create one pipe. */ rc = pipe(user_to_translator); @@ -307,10 +314,10 @@ perror(main: fork); exit(1); case 0: /* inside child process. */ - calculator(user_to_translator, translator_to_user); /* line 'A' */ + calculator(user_to_translator, translator_to_user); /* NOT REACHED */ default:/* inside parent process. */ - test_driver(translator_to_user, user_to_translator); /* line 'B' */ + test_driver(low_bit, high_bit, translator_to_user, user_to_translator); /* NOT REACHED */ } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [124166] writable strings shouldn't be cached.
Revision: 124166 Author: clattner Date: 2007-02-21 19:28:53 -0800 (Wed, 21 Feb 2007) Log Message: --- writable strings shouldn't be cached. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp === --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-22 01:53:25 UTC (rev 124165) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-22 03:28:53 UTC (rev 124166) @@ -5229,16 +5229,18 @@ Constant *TreeConstantToLLVM::EmitLV_STRING_CST(tree exp) { Constant *Init = TreeConstantToLLVM::ConvertSTRING_CST(exp); - - // Cache the string constants to avoid making obvious duplicate strings that - // have to be folded by the optimizer. - static std::mapConstant*, GlobalVariable* StringCSTCache; - GlobalVariable *Slot = StringCSTCache[Init]; - if (Slot) return Slot; - + // Support -fwritable-strings. bool StringIsConstant = !flag_writable_strings; - + + if (StringIsConstant) { +// Cache the string constants to avoid making obvious duplicate strings that +// have to be folded by the optimizer. +static std::mapConstant*, GlobalVariable* StringCSTCache; +GlobalVariable *Slot = StringCSTCache[Init]; +if (Slot) return Slot; + } + // Create a new string global. return Slot = new GlobalVariable(Init-getType(), StringIsConstant, GlobalVariable::InternalLinkage, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [124167] refactor
Revision: 124167 Author: clattner Date: 2007-02-21 20:26:05 -0800 (Wed, 21 Feb 2007) Log Message: --- refactor Modified Paths: -- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp === --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-22 03:28:53 UTC (rev 124166) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-22 04:26:05 UTC (rev 124167) @@ -5233,18 +5233,23 @@ // Support -fwritable-strings. bool StringIsConstant = !flag_writable_strings; + GlobalVariable **SlotP = 0; + if (StringIsConstant) { // Cache the string constants to avoid making obvious duplicate strings that // have to be folded by the optimizer. static std::mapConstant*, GlobalVariable* StringCSTCache; GlobalVariable *Slot = StringCSTCache[Init]; if (Slot) return Slot; +SlotP = Slot; } // Create a new string global. - return Slot = new GlobalVariable(Init-getType(), StringIsConstant, - GlobalVariable::InternalLinkage, - Init, str, TheModule); + GlobalVariable *GV = new GlobalVariable(Init-getType(), StringIsConstant, + GlobalVariable::InternalLinkage, + Init, str, TheModule); + if (SlotP) *SlotP = GV; + return GV; } Constant *TreeConstantToLLVM::EmitLV_ARRAY_REF(tree exp) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp PPCRegisterInfo.cpp PPCRegisterInfo.h
Support to provide exception and selector registers. Hey Jim, This behavior: +/// LowerEXCEPTIONADDR - Replace EXCEPTIONADDR with a copy from the exception +/// register. The register was made live in the ISel. +static SDOperand LowerEXCEPTIONADDR(SDOperand Op, SelectionDAG DAG) { + const MRegisterInfo *MRI = DAG.getTargetLoweringInfo(). + getTargetMachine(). + getRegisterInfo(); + MVT::ValueType VT = Op.Val-getValueType(0); + unsigned Reg = MRI-getEHExceptionRegister(); + SDOperand Result = DAG.getCopyFromReg(Op.getOperand(0), Reg, VT); + return Result.getValue(Op.ResNo); +} Is almost certainly guaranteed to work for other targets as well (not just PPC). Can you change this code so that Legalize has this code, and invokes it when the target requests that EXCEPTIONADDR be expanded? Right now, all non-ppc targets abort when this happens, which isn't very nice. Please just have them lower to returning something stupid but that will compile correctly (like return a constant zero) if MRI- getEHExceptionRegister() returns 0. With these changes, you should be able to remove the code you added to each target. -Chris + +/// LowerEXCEPTIONADDR - Replace EHSELECTION with a copy from the exception +/// selection register. The register was made live in the ISel. +static SDOperand LowerEHSELECTION(SDOperand Op, SelectionDAG DAG) { + const MRegisterInfo *MRI = DAG.getTargetLoweringInfo(). + getTargetMachine(). + getRegisterInfo(); + MVT::ValueType VT = Op.Val-getValueType(0); + unsigned Reg = MRI-getEHHandlerRegister(); + SDOperand Result = DAG.getCopyFromReg(Op.getOperand(1), Reg, VT); + return Result.getValue(Op.ResNo); +} + /// LowerOperation - Provide custom lowering hooks for some operations. /// SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG DAG) { @@ -2647,6 +2671,10 @@ // Frame Return address. Currently unimplemented case ISD::RETURNADDR: break; case ISD::FRAMEADDR: break; + + // Exception address and exception selector. + case ISD::EXCEPTIONADDR: return LowerEXCEPTIONADDR(Op, DAG); + case ISD::EHSELECTION:return LowerEHSELECTION(Op, DAG); } return SDOperand(); } Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.108 llvm/lib/ Target/PowerPC/PPCRegisterInfo.cpp:1.109 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.108 Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Wed Feb 21 16:54:50 2007 @@ -1022,7 +1022,6 @@ unsigned PPCRegisterInfo::getRARegister() const { return !Subtarget.isPPC64() ? PPC::LR : PPC::LR8; - } unsigned PPCRegisterInfo::getFrameRegister(MachineFunction MF) const { @@ -1040,5 +1039,13 @@ Moves.push_back(MachineMove(0, Dst, Src)); } +unsigned PPCRegisterInfo::getEHExceptionRegister() const { + return !Subtarget.isPPC64() ? PPC::R3 : PPC::X3; +} + +unsigned PPCRegisterInfo::getEHHandlerRegister() const { + return !Subtarget.isPPC64() ? PPC::R4 : PPC::X4; +} + #include PPCGenRegisterInfo.inc Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.h diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.27 llvm/lib/ Target/PowerPC/PPCRegisterInfo.h:1.28 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.27Mon Feb 19 15:49:54 2007 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.h Wed Feb 21 16:54:50 2007 @@ -89,6 +89,10 @@ unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction MF) const; void getInitialFrameState(std::vectorMachineMove Moves) const; + + // Exception handling queries. + unsigned getEHExceptionRegister() const; + unsigned getEHHandlerRegister() const; }; } // end namespace llvm ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/Intrinsics.td
Intrinsics.td updated: 1.46 - 1.47 --- Log message: Add new intrinsics for eh support. Please make sure to document the eh intrinsics in LangRef.html, -Chris --- Diffs of the changes: (+3 -1) Intrinsics.td |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Intrinsics.td diff -u llvm/include/llvm/Intrinsics.td:1.46 llvm/include/llvm/ Intrinsics.td:1.47 --- llvm/include/llvm/Intrinsics.td:1.46 Wed Feb 14 20:26:09 2007 +++ llvm/include/llvm/Intrinsics.td Wed Feb 21 16:35:57 2007 @@ -232,7 +232,9 @@ //===-- Exception Handling Intrinsics--===// // def int_eh_exception : Intrinsic[llvm_ptr_ty]; -def int_eh_handlers : Intrinsic[llvm_i32_ty, llvm_ptr_ty, llvm_vararg_ty]; +def int_eh_handlers : Intrinsic[llvm_i32_ty, llvm_ptr_ty, llvm_ptr_ty, + llvm_vararg_ty]; +def int_eh_typeid_for : Intrinsic[llvm_i32_ty, llvm_ptr_ty]; // ===--- ---===// // Target-specific intrinsics ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/DeveloperPolicy.html
Changes in directory llvm/docs: DeveloperPolicy.html updated: 1.34 - 1.35 --- Log message: clarify llvm-gcc GPL issue --- Diffs of the changes: (+6 -6) DeveloperPolicy.html | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/docs/DeveloperPolicy.html diff -u llvm/docs/DeveloperPolicy.html:1.34 llvm/docs/DeveloperPolicy.html:1.35 --- llvm/docs/DeveloperPolicy.html:1.34 Mon Feb 19 12:32:40 2007 +++ llvm/docs/DeveloperPolicy.html Thu Feb 22 00:33:23 2007 @@ -442,13 +442,13 @@ read the a href=http://www.opensource.org/licenses/UoI-NCSA.php;License/a if further clarification is needed./p - pNote that the LLVM Project does distribute some code that includes GPL - software (notably, llvm-gcc which is based on the GCC GPL source base). + pNote that the LLVM Project does distribute llvm-gcc, bwhich is GPL./b This means that anything linked into llvm-gcc must itself be compatible with the GPL, and must be releasable under the terms of the GPL. This implies - that bany code linked into llvm-gcc and distributed to others may be - subject to - the viral aspects of the GPL/b. This is not a problem for the main LLVM + that bany code linked into llvm-gcc and distributed to others may be subject + to the viral aspects of the GPL/b (for example, a proprietary code generator + linked into llvm-gcc must be made available under + the GPL). This is not a problem for the main LLVM distribution (which is already licensed under a more liberal license), but may be a problem if you intend to base commercial development on llvm-gcc without redistributing your source code./p @@ -499,7 +499,7 @@ Written by the a href=mailto:[EMAIL PROTECTED]LLVM Oversight Group/abr a href=http://llvm.org;The LLVM Compiler Infrastructure/abr - Last modified: $Date: 2007/02/19 18:32:40 $ + Last modified: $Date: 2007/02/22 06:33:23 $ /address /body /html ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] Patch for strict alias warning in Support/Allocator.cpp
I only saw 3 warnings compiling llvm, 2 of which looked like flex's fault, so it made me want to fix the other one: Allocator.cpp: In member function 'void* llvm::BumpPtrAllocator::Allocate(unsigned int, unsigned int)': Allocator.cpp:96: warning: dereferencing type-punned pointer will break strict-aliasing rules I'm not convinced it actually broke aliasing rules, but it's a fairly trivial fix that simplifies the code, so it seems worth it. Only possible drawback is that it (opaquely) exposes MemRegion, but that identifier is used nowhere else in llvm at the moment. HTH, Scott McMurray Index: include/llvm/Support/Allocator.h === RCS file: /var/cvs/llvm/llvm/include/llvm/Support/Allocator.h,v retrieving revision 1.1 diff -t -d -u -p -5 -r1.1 Allocator.h --- include/llvm/Support/Allocator.h 29 Oct 2006 22:08:03 - 1.1 +++ include/llvm/Support/Allocator.h 22 Feb 2007 06:15:06 - @@ -26,16 +26,18 @@ public: void *Allocate(unsigned Size, unsigned Alignment) { return malloc(Size); } void Deallocate(void *Ptr) { free(Ptr); } void PrintStats() const {} }; +class MemRegion; + /// BumpPtrAllocator - This allocator is useful for containers that need very /// simple memory allocation strategies. In particular, this just keeps /// allocating memory, and never deletes it until the entire block is dead. This /// makes allocation speedy, but must only be used when the trade-off is ok. class BumpPtrAllocator { - void *TheMemory; + MemRegion *TheMemory; public: BumpPtrAllocator(); ~BumpPtrAllocator(); void *Allocate(unsigned Size, unsigned Alignment); Index: lib/Support/Allocator.cpp === RCS file: /var/cvs/llvm/llvm/lib/Support/Allocator.cpp,v retrieving revision 1.5 diff -t -d -u -p -5 -r1.5 Allocator.cpp --- lib/Support/Allocator.cpp 7 Dec 2006 23:41:45 - 1.5 +++ lib/Support/Allocator.cpp 22 Feb 2007 06:15:06 - @@ -19,11 +19,11 @@ using namespace llvm; //===--===// // MemRegion class implementation //===--===// -namespace { +namespace llvm { /// MemRegion - This is one chunk of the BumpPtrAllocator. class MemRegion { unsigned RegionSize; MemRegion *Next; char *NextPtr; @@ -82,26 +82,26 @@ public: //===--===// // BumpPtrAllocator class implementation //===--===// BumpPtrAllocator::BumpPtrAllocator() { - TheMemory = malloc(4096); - ((MemRegion*)TheMemory)-Init(4096, 1, 0); + TheMemory = (MemRegion*)malloc(4096); + TheMemory-Init(4096, 1, 0); } BumpPtrAllocator::~BumpPtrAllocator() { - ((MemRegion*)TheMemory)-Deallocate(); + TheMemory-Deallocate(); } void *BumpPtrAllocator::Allocate(unsigned Size, unsigned Align) { - return ((MemRegion*)TheMemory)-Allocate(Size, Align,(MemRegion**)TheMemory); + return TheMemory-Allocate(Size, Align,TheMemory); } void BumpPtrAllocator::PrintStats() const { unsigned BytesUsed = 0; unsigned NumRegions = 0; - const MemRegion *R = (MemRegion*)TheMemory; + const MemRegion *R = TheMemory; for (; R; R = R-getNext(), ++NumRegions) BytesUsed += R-getNumBytesAllocated(); cerr \nNumber of memory regions: NumRegions \n; cerr Bytes allocated: BytesUsed \n; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits