From lattner at cs.uiuc.edu Mon Feb 21 10:35:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 21 Feb 2005 10:35:47 -0600 Subject: [llvm-commits] CVS: llvm/docs/CFEBuildInstrs.html Message-ID: <200502211635.j1LGZlkx005819@apoc.cs.uiuc.edu> Changes in directory llvm/docs: CFEBuildInstrs.html updated: 1.44 -> 1.45 --- Log message: add another plausible reason --- Diffs of the changes: (+2 -1) CFEBuildInstrs.html | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/docs/CFEBuildInstrs.html diff -u llvm/docs/CFEBuildInstrs.html:1.44 llvm/docs/CFEBuildInstrs.html:1.45 --- llvm/docs/CFEBuildInstrs.html:1.44 Fri Feb 11 15:17:26 2005 +++ llvm/docs/CFEBuildInstrs.html Mon Feb 21 10:35:31 2005 @@ -46,6 +46,7 @@
  1. you really, really, really can't use the binaries we distribute
  2. you are an elite GCC hacker.
  3. +
  4. you want to use the latest bits from CVS.

We welcome patches to help make this process simpler.

@@ -345,7 +346,7 @@ Brian Gaeke
LLVM Compiler Infrastructure
- Last modified: $Date: 2005/02/11 21:17:26 $ + Last modified: $Date: 2005/02/21 16:35:31 $ From lattner at cs.uiuc.edu Mon Feb 21 14:46:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 21 Feb 2005 14:46:03 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502212046.j1LKk3Xo013500@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.18 -> 1.19 --- Log message: Cloned function bodies get internal linkage --- Diffs of the changes: (+1 -1) PointerCompress.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.18 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.19 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.18 Wed Feb 16 13:45:24 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Mon Feb 21 14:45:47 2005 @@ -863,7 +863,7 @@ FunctionType *CFTy = FunctionType::get(RetTy, ParamTypes, FTy->isVarArg()); // Next, create the clone prototype and insert it into the module. - Clone = new Function(CFTy, GlobalValue::/*Internal*/ ExternalLinkage, + Clone = new Function(CFTy, GlobalValue::InternalLinkage, F->getName()+".pc"); F->getParent()->getFunctionList().insert(F, Clone); From alenhar2 at cs.uiuc.edu Mon Feb 21 22:58:42 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 21 Feb 2005 22:58:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/Makefile Message-ID: <200502220458.j1M4wgUY023871@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: Makefile updated: 1.1 -> 1.2 --- Log message: no longer build as a shared library --- Diffs of the changes: (+0 -1) Makefile | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/Alpha/Makefile diff -u llvm/lib/Target/Alpha/Makefile:1.1 llvm/lib/Target/Alpha/Makefile:1.2 --- llvm/lib/Target/Alpha/Makefile:1.1 Sat Jan 22 17:41:55 2005 +++ llvm/lib/Target/Alpha/Makefile Mon Feb 21 22:58:26 2005 @@ -9,7 +9,6 @@ LEVEL = ../../.. LIBRARYNAME = LLVMAlpha TARGET = Alpha -SHARED_LIBRARY=1 # Make sure that tblgen is run, first thing. BUILT_SOURCES = AlphaGenRegisterInfo.h.inc AlphaGenRegisterNames.inc \ From lattner at cs.uiuc.edu Tue Feb 22 01:23:55 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 01:23:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200502220723.j1M7Nt6B027253@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.60 -> 1.61 --- Log message: Fix a bug in the 'store fpimm, ptr' -> 'store intimm, ptr' handling code. Changing 'op' here caused us to not enter the store into a map, causing reemission of the code!! In practice, a simple loop like this: no_exit: ; preds = %no_exit, %entry %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; [#uses=3] %tmp.4 = getelementptr "complex long double"* %P, uint %indvar, uint 0 ; [#uses=1] store double 0.000000e+00, double* %tmp.4 %indvar.next = add uint %indvar, 1 ; [#uses=2] %exitcond = seteq uint %indvar.next, %N ; [#uses=1] br bool %exitcond, label %return, label %no_exit was being code gen'd to: .LBBtest_1: # no_exit movl %edx, %esi shll $4, %esi movl $0, 4(%eax,%esi) movl $0, (%eax,%esi) incl %edx movl $0, (%eax,%esi) movl $0, 4(%eax,%esi) cmpl %ecx, %edx jne .LBBtest_1 # no_exit Note that we are doing 4 32-bit stores instead of 2. Now we generate: .LBBtest_1: # no_exit movl %edx, %esi incl %esi shll $4, %edx movl $0, (%eax,%edx) movl $0, 4(%eax,%edx) cmpl %ecx, %esi movl %esi, %edx jne .LBBtest_1 # no_exit This is much happier, though it would be even better if the increment of ESI was scheduled after the compare :-/ --- Diffs of the changes: (+1 -2) LegalizeDAG.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.60 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.61 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.60 Fri Feb 4 12:39:19 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Feb 22 01:23:39 2005 @@ -515,8 +515,7 @@ Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, DAG.getConstant(V.I, MVT::i64), Tmp2); } - Op = Result; - Node = Op.Val; + Node = Result.Val; } switch (getTypeAction(Node->getOperand(1).getValueType())) { From lattner at cs.uiuc.edu Tue Feb 22 11:20:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 11:20:44 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/voronoi/Makefile Message-ID: <200502221720.j1MHKi7t028827@apoc.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Olden/voronoi: Makefile updated: 1.15 -> 1.16 --- Log message: Make the program take non-zero time in normal problem size. --- Diffs of the changes: (+2 -0) Makefile | 2 ++ 1 files changed, 2 insertions(+) Index: llvm-test/MultiSource/Benchmarks/Olden/voronoi/Makefile diff -u llvm-test/MultiSource/Benchmarks/Olden/voronoi/Makefile:1.15 llvm-test/MultiSource/Benchmarks/Olden/voronoi/Makefile:1.16 --- llvm-test/MultiSource/Benchmarks/Olden/voronoi/Makefile:1.15 Wed Sep 1 09:33:25 2004 +++ llvm-test/MultiSource/Benchmarks/Olden/voronoi/Makefile Tue Feb 22 11:20:28 2005 @@ -7,6 +7,8 @@ FP_TOLERANCE = 0.0001 ifdef LARGE_PROBLEM_SIZE RUN_OPTIONS = 1000000 20 32 7 +else +RUN_OPTIONS = 100000 20 32 7 endif include $(LEVEL)/MultiSource/Makefile.multisrc From lattner at cs.uiuc.edu Tue Feb 22 13:35:00 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 13:35:00 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/ Message-ID: <200502221935.j1MJZ0NS031644@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/PtrCompAllocator: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-poolalloc/runtime/PtrCompAllocator added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From lattner at cs.uiuc.edu Tue Feb 22 13:35:22 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 13:35:22 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/Makefile PtrCompAllocator.cpp PtrCompAllocator.h Message-ID: <200502221935.j1MJZMaI031680@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/PtrCompAllocator: Makefile added (r1.1) PtrCompAllocator.cpp added (r1.1) PtrCompAllocator.h added (r1.1) --- Log message: inital checkin of runtime library for pointer compression. --- Diffs of the changes: (+173 -0) Makefile | 11 +++++ PtrCompAllocator.cpp | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++ PtrCompAllocator.h | 50 ++++++++++++++++++++++ 3 files changed, 173 insertions(+) Index: llvm-poolalloc/runtime/PtrCompAllocator/Makefile diff -c /dev/null llvm-poolalloc/runtime/PtrCompAllocator/Makefile:1.1 *** /dev/null Tue Feb 22 13:35:17 2005 --- llvm-poolalloc/runtime/PtrCompAllocator/Makefile Tue Feb 22 13:35:07 2005 *************** *** 0 **** --- 1,11 ---- + LEVEL = ../.. + BYTECODE_LIBRARY=1 + SHARED_LIBRARY=1 + LIBRARYNAME=ptrcomp_rt + + CXXFLAGS += -fno-exceptions + + include $(LEVEL)/Makefile.common + + # Always build optimized and debug versions + all:: $(LIBNAME_OBJO) $(LIBNAME_OBJG) Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp diff -c /dev/null llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.1 *** /dev/null Tue Feb 22 13:35:22 2005 --- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Tue Feb 22 13:35:07 2005 *************** *** 0 **** --- 1,112 ---- + //===- PtrCompAllocator.cpp - Implementation of ptr compression runtime ---===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the pointer compression runtime with a simple + // node-based, bitmapped allocator. + // + //===----------------------------------------------------------------------===// + + #include "PtrCompAllocator.h" + #include + #include + #include + #include + + #define POOLSIZE (256*1024*1024) + + // poolinit_pc - Initialize a pool descriptor to empty + // + void poolinit_pc(PoolTy *Pool, unsigned NewSize, unsigned OldSize, + unsigned ObjAlignment) { + assert(Pool && OldSize && NewSize && ObjAlignment); + assert((ObjAlignment & (ObjAlignment-1)) == 0 && "Alignment not 2^k!"); + Pool->OrigSize = OldSize; + + // Round up to the next alignment boundary. + Pool->NewSize = (NewSize+NewSize-1) & ~(ObjAlignment-1); + + Pool->PoolBase = 0; + Pool->BitVector = 0; + } + + // pooldestroy_pc - Release all memory allocated for a pool + // + void pooldestroy_pc(PoolTy *Pool) { + assert(Pool && "Null pool pointer passed in to pooldestroy!\n"); + if (!Pool->PoolBase) return; // No memory ever allocated. + + munmap(Pool->PoolBase, POOLSIZE); + Pool->PoolBase = 0; + free(Pool->BitVector); + } + + static void CreatePool(PoolTy *Pool) __attribute__((noinline)); + static void CreatePool(PoolTy *Pool) { + Pool->PoolBase = (char*)mmap(0, POOLSIZE, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, 0, 0); + Pool->NumNodesInBitVector = 1024; + Pool->BitVector = (unsigned long*)malloc(Pool->NumNodesInBitVector*2/8); + Pool->NumUsed = 0; + } + + static inline void MarkNodeAllocated(PoolTy *Pool, unsigned long NodeNum) { + Pool->BitVector[NodeNum*2/(sizeof(long)*8)] |= + 3 << (2*(NodeNum & (sizeof(long)*8/2-1))); + } + + static inline void MarkNodeFree(PoolTy *Pool, unsigned long NodeNum) { + Pool->BitVector[NodeNum*2/(sizeof(long)*8)] &= + ~(3 << (2*(NodeNum & (sizeof(long)*8/2-1)))); + } + + + unsigned long poolalloc_pc(PoolTy *Pool, unsigned NumBytes) { + assert(Pool && "Null pool pointer passed in to poolalloc!\n"); + + unsigned OrigSize = Pool->OrigSize; + unsigned NodesToAllocate; + if (NumBytes == OrigSize) + NodesToAllocate = 1; // Common case. + else + NodesToAllocate = (NumBytes+OrigSize-1)/OrigSize; + + assert(NodesToAllocate == 1 && "Array allocation not implemented yet!"); + + if (Pool->PoolBase == 0) + CreatePool(Pool); + + AllocNode: + // FIXME: This should attempt to reuse free'd nodes! + + // See if we can grow the pool without allocating new bitvector space. + if (Pool->NumUsed < Pool->NumNodesInBitVector) { + unsigned long Result = Pool->NumUsed++; + MarkNodeAllocated(Pool, Result); + return Result; + } + + // Otherwise, we need to grow the bitvector. Double its size. + Pool->NumNodesInBitVector <<= 1; + Pool->BitVector = (unsigned long*)realloc(Pool->BitVector, + Pool->NumNodesInBitVector*2/8); + goto AllocNode; + } + + void poolfree_pc(PoolTy *Pool, unsigned long Node) { + assert(Pool && Node < Pool->NumUsed && "Node or pool incorrect!"); + + // If freeing the last node, just pop it from the end. + if (Node == Pool->NumUsed-1) { + --Pool->NumUsed; + return; + } + + // Otherwise, mark the node free'd. + MarkNodeFree(Pool, Node); + } Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h diff -c /dev/null llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h:1.1 *** /dev/null Tue Feb 22 13:35:22 2005 --- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h Tue Feb 22 13:35:07 2005 *************** *** 0 **** --- 1,50 ---- + //===- PtrCompAllocator.h - Runtime Lib for pointer compression -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines the interface which is implemented by the pointer + // compression runtime library. + // + //===----------------------------------------------------------------------===// + + #ifndef PTRCOMP_ALLOCATOR_H + #define PTRCOMP_ALLOCATOR_H + + struct PoolTy { + char *PoolBase; // The actual pool. + unsigned long *BitVector;// Bitvector of bits. This stores two bits per node. + + // OrigSize - The size of the nodes in a non-compressed pool. + unsigned OrigSize; + + // NewSize - The size of the nodes to actually allocate out of the pool. This + // size already considers object padding due to alignment. + unsigned NewSize; + + // NumNodesInBitVector - This indicates the amount of space we have for nodes + // in the bitvector. We actually have space for 2* this number of bits. + unsigned long NumNodesInBitVector; + + // NumUsed - The number of nodes that are currently initialized out of + // NumNodesInBitVector. Invariant: NumUsed <= NumNodesInBitVector. + unsigned long NumUsed; + }; + + extern "C" { + void poolinit_pc(PoolTy *Pool, unsigned NewSize, unsigned OldSize, + unsigned ObjAlignment); + void pooldestroy_pc(PoolTy *Pool); + unsigned long poolalloc_pc(PoolTy *Pool, unsigned NumBytes); + void poolfree_pc(PoolTy *Pool, unsigned long Node); + //void *poolmemalign_pc(PoolTy *Pool, unsigned Alignment, unsigned NumBytes); + + // FIXME: Add support for bump pointer pools. These pools don't need the + // bitvector. + } + + #endif From lattner at cs.uiuc.edu Tue Feb 22 13:35:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 13:35:34 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/Makefile Message-ID: <200502221935.j1MJZYF7031689@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime: Makefile updated: 1.4 -> 1.5 --- Log message: Build the ptrcompression runtime --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/runtime/Makefile diff -u llvm-poolalloc/runtime/Makefile:1.4 llvm-poolalloc/runtime/Makefile:1.5 --- llvm-poolalloc/runtime/Makefile:1.4 Thu Dec 25 13:45:09 2003 +++ llvm-poolalloc/runtime/Makefile Tue Feb 22 13:35:20 2005 @@ -6,6 +6,6 @@ # # List all of the subdirectories that we will compile. # -DIRS=PoolAllocator FreeListAllocator FL2Allocator +DIRS=PoolAllocator FreeListAllocator FL2Allocator PtrCompAllocator include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Tue Feb 22 14:11:42 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 14:11:42 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp PtrCompAllocator.h Message-ID: <200502222011.j1MKBgZr001755@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/PtrCompAllocator: PtrCompAllocator.cpp updated: 1.1 -> 1.2 PtrCompAllocator.h updated: 1.1 -> 1.2 --- Log message: implement tracing and debugging support. --- Diffs of the changes: (+147 -0) PtrCompAllocator.cpp | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++ PtrCompAllocator.h | 4 + 2 files changed, 147 insertions(+) Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.1 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.2 --- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.1 Tue Feb 22 13:35:07 2005 +++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Tue Feb 22 14:11:26 2005 @@ -16,16 +16,137 @@ #include #include #include +#include #include #define POOLSIZE (256*1024*1024) +#ifndef NDEBUG +// Configuration macros. Define up to one of these. +//#define PRINT_NUM_POOLS // Print use dynamic # pools info +//#define PRINT_POOLDESTROY_STATS // When pools are destroyed, print stats +#define PRINT_POOL_TRACE // Print a full trace +#endif + + +//===----------------------------------------------------------------------===// +// Pool Debugging stuff. +//===----------------------------------------------------------------------===// + +#ifdef PRINT_POOL_TRACE +#define PRINT_POOLDESTROY_STATS + +struct PoolID { + PoolTy *PD; + unsigned ID; +}; + +struct PoolID *PoolIDs = 0; +static unsigned NumLivePools = 0; +static unsigned NumPoolIDsAllocated = 0; +static unsigned CurPoolID = 0; + +static unsigned addPoolNumber(PoolTy *PD) { + if (NumLivePools == NumPoolIDsAllocated) { + NumPoolIDsAllocated = (10+NumPoolIDsAllocated)*2; + PoolIDs = (PoolID*)realloc(PoolIDs, sizeof(PoolID)*NumPoolIDsAllocated); + } + + PoolIDs[NumLivePools].PD = PD; + PoolIDs[NumLivePools].ID = ++CurPoolID; + NumLivePools++; + return CurPoolID; +} + +static unsigned getPoolNumber(PoolTy *PD) { + if (PD == 0) return 1234567; + for (unsigned i = 0; i != NumLivePools; ++i) + if (PoolIDs[i].PD == PD) + return PoolIDs[i].ID; + fprintf(stderr, "INVALID/UNKNOWN POOL DESCRIPTOR: 0x%lX\n", (unsigned long)PD); + return 0; +} + +static unsigned removePoolNumber(PoolTy *PD) { + for (unsigned i = 0; i != NumLivePools; ++i) + if (PoolIDs[i].PD == PD) { + unsigned PN = PoolIDs[i].ID; + memmove(&PoolIDs[i], &PoolIDs[i+1], sizeof(PoolID)*(NumLivePools-i-1)); + --NumLivePools; + return PN; + } + fprintf(stderr, "INVALID/UNKNOWN POOL DESCRIPTOR: 0x%lX\n", (unsigned long)PD); + return 0; +} + +static void PrintPoolStats(PoolTy *Pool); +static void PrintLivePoolInfo() { + for (unsigned i = 0; i != NumLivePools; ++i) { + PoolTy *Pool = PoolIDs[i].PD; + fprintf(stderr, "[%d] pool at exit ", PoolIDs[i].ID); + PrintPoolStats(Pool); + } +} + +#define DO_IF_TRACE(X) X +#else +#define DO_IF_TRACE(X) +#endif + +#ifdef PRINT_POOLDESTROY_STATS +#define DO_IF_POOLDESTROY_STATS(X) X +#define PRINT_NUM_POOLS + +static void PrintPoolStats(PoolTy *Pool) { + fprintf(stderr, + "(0x%X) BytesAlloc=%d NumObjs=%d" + " bitvectorsize=%d numused=%d OrigSize=%d NewSize=%d\n", + Pool, Pool->BytesAllocated, Pool->NumObjects, + Pool->NumNodesInBitVector, Pool->NumUsed, Pool->OrigSize, + Pool->NewSize); +} + +#else +#define DO_IF_POOLDESTROY_STATS(X) +#endif + +#ifdef PRINT_NUM_POOLS +static unsigned PoolCounter = 0; +static unsigned PoolsInited = 0; +static void PoolCountPrinter() { + DO_IF_TRACE(PrintLivePoolInfo()); + fprintf(stderr, "\n\n" + "*** %d DYNAMIC POOLS INITIALIZED ***\n\n" + "*** %d DYNAMIC POOLS ALLOCATED FROM ***\n\n", + PoolsInited, PoolCounter); +} + +static void InitPrintNumPools() { + static bool Initialized = 0; + if (!Initialized) { + Initialized = 1; + atexit(PoolCountPrinter); + } +} + +#define DO_IF_PNP(X) X +#else +#define DO_IF_PNP(X) +#endif + + +//===----------------------------------------------------------------------===// +// Pointer Compression Runtime implementation +//===----------------------------------------------------------------------===// + // poolinit_pc - Initialize a pool descriptor to empty // void poolinit_pc(PoolTy *Pool, unsigned NewSize, unsigned OldSize, unsigned ObjAlignment) { assert(Pool && OldSize && NewSize && ObjAlignment); assert((ObjAlignment & (ObjAlignment-1)) == 0 && "Alignment not 2^k!"); + + DO_IF_PNP(memset(Pool, 0, sizeof(PoolTy))); Pool->OrigSize = OldSize; // Round up to the next alignment boundary. @@ -33,6 +154,11 @@ Pool->PoolBase = 0; Pool->BitVector = 0; + + DO_IF_TRACE(fprintf(stderr, "[%d] poolinit_pc(0x%X, %d)\n", + addPoolNumber(Pool), Pool, ObjAlignment)); + DO_IF_PNP(++PoolsInited); // Track # pools initialized + DO_IF_PNP(InitPrintNumPools()); } // pooldestroy_pc - Release all memory allocated for a pool @@ -41,6 +167,9 @@ assert(Pool && "Null pool pointer passed in to pooldestroy!\n"); if (!Pool->PoolBase) return; // No memory ever allocated. + DO_IF_TRACE(fprintf(stderr, "[%d] pooldestroy_pc", removePoolNumber(Pool))); + DO_IF_POOLDESTROY_STATS(PrintPoolStats(Pool)); + munmap(Pool->PoolBase, POOLSIZE); Pool->PoolBase = 0; free(Pool->BitVector); @@ -69,6 +198,8 @@ unsigned long poolalloc_pc(PoolTy *Pool, unsigned NumBytes) { assert(Pool && "Null pool pointer passed in to poolalloc!\n"); + DO_IF_PNP(if (Pool->NumObjects == 0) ++PoolCounter); // Track # pools. + unsigned OrigSize = Pool->OrigSize; unsigned NodesToAllocate; if (NumBytes == OrigSize) @@ -76,6 +207,13 @@ else NodesToAllocate = (NumBytes+OrigSize-1)/OrigSize; + DO_IF_TRACE(fprintf(stderr, "[%d] poolalloc_pc(%d [%d node%s]) -> ", + getPoolNumber(Pool), NumBytes, NodesToAllocate, + NodesToAllocate == 1 ? "" : "s")); + + DO_IF_PNP(++Pool->NumObjects); + DO_IF_PNP(Pool->BytesAllocated += NumBytes); + assert(NodesToAllocate == 1 && "Array allocation not implemented yet!"); if (Pool->PoolBase == 0) @@ -88,6 +226,7 @@ if (Pool->NumUsed < Pool->NumNodesInBitVector) { unsigned long Result = Pool->NumUsed++; MarkNodeAllocated(Pool, Result); + DO_IF_TRACE(fprintf(stderr, "0x%X\n", (unsigned)Result)); return Result; } @@ -99,11 +238,15 @@ } void poolfree_pc(PoolTy *Pool, unsigned long Node) { + if (Node == 0) return; assert(Pool && Node < Pool->NumUsed && "Node or pool incorrect!"); + DO_IF_TRACE(fprintf(stderr, "[%d] poolfree_pc(0x%X) ", + getPoolNumber(Pool), (unsigned)Node)); // If freeing the last node, just pop it from the end. if (Node == Pool->NumUsed-1) { --Pool->NumUsed; + DO_IF_TRACE(fprintf(stderr, "1 node\n")); return; } Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h:1.1 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h:1.2 --- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h:1.1 Tue Feb 22 13:35:07 2005 +++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.h Tue Feb 22 14:11:26 2005 @@ -33,6 +33,10 @@ // NumUsed - The number of nodes that are currently initialized out of // NumNodesInBitVector. Invariant: NumUsed <= NumNodesInBitVector. unsigned long NumUsed; + + + // These fields are only used in debug mode. + unsigned BytesAllocated, NumObjects; }; extern "C" { From lattner at cs.uiuc.edu Tue Feb 22 14:13:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 14:13:02 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Message-ID: <200502222013.j1MKD2T5002255@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/PtrCompAllocator: PtrCompAllocator.cpp updated: 1.2 -> 1.3 --- Log message: Make sure that node #0 is reserved for the null pointer. --- Diffs of the changes: (+11 -9) PtrCompAllocator.cpp | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.2 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.3 --- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.2 Tue Feb 22 14:11:26 2005 +++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Tue Feb 22 14:12:49 2005 @@ -175,15 +175,6 @@ free(Pool->BitVector); } -static void CreatePool(PoolTy *Pool) __attribute__((noinline)); -static void CreatePool(PoolTy *Pool) { - Pool->PoolBase = (char*)mmap(0, POOLSIZE, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, 0, 0); - Pool->NumNodesInBitVector = 1024; - Pool->BitVector = (unsigned long*)malloc(Pool->NumNodesInBitVector*2/8); - Pool->NumUsed = 0; -} - static inline void MarkNodeAllocated(PoolTy *Pool, unsigned long NodeNum) { Pool->BitVector[NodeNum*2/(sizeof(long)*8)] |= 3 << (2*(NodeNum & (sizeof(long)*8/2-1))); @@ -194,6 +185,17 @@ ~(3 << (2*(NodeNum & (sizeof(long)*8/2-1)))); } +static void CreatePool(PoolTy *Pool) __attribute__((noinline)); +static void CreatePool(PoolTy *Pool) { + Pool->PoolBase = (char*)mmap(0, POOLSIZE, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_NORESERVE|MAP_ANONYMOUS, 0, 0); + Pool->NumNodesInBitVector = 1024; + Pool->BitVector = (unsigned long*)malloc(Pool->NumNodesInBitVector*2/8); + + // Mark the null pointer allocated. + Pool->NumUsed = 1; + MarkNodeAllocated(Pool, 0); +} unsigned long poolalloc_pc(PoolTy *Pool, unsigned NumBytes) { assert(Pool && "Null pool pointer passed in to poolalloc!\n"); From lattner at cs.uiuc.edu Tue Feb 22 14:16:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 14:16:15 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Message-ID: <200502222016.j1MKGFTJ003584@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/PtrCompAllocator: PtrCompAllocator.cpp updated: 1.3 -> 1.4 --- Log message: Remember that we give the program byte offsets into the pool, not node numbers. This allows tree add to run correctly with pointer compression! --- Diffs of the changes: (+6 -3) PtrCompAllocator.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.3 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.4 --- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.3 Tue Feb 22 14:12:49 2005 +++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Tue Feb 22 14:16:02 2005 @@ -228,8 +228,9 @@ if (Pool->NumUsed < Pool->NumNodesInBitVector) { unsigned long Result = Pool->NumUsed++; MarkNodeAllocated(Pool, Result); - DO_IF_TRACE(fprintf(stderr, "0x%X\n", (unsigned)Result)); - return Result; + DO_IF_TRACE(fprintf(stderr, "Node %ld: 0x%lX byte from poolbase\n", Result, + Result*Pool->NewSize)); + return Result*Pool->NewSize; } // Otherwise, we need to grow the bitvector. Double its size. @@ -241,7 +242,9 @@ void poolfree_pc(PoolTy *Pool, unsigned long Node) { if (Node == 0) return; - assert(Pool && Node < Pool->NumUsed && "Node or pool incorrect!"); + assert(Pool && (Node % Pool->NewSize == 0) && + (Node/Pool->NewSize < Pool->NumUsed) && "Node or pool incorrect!"); + Node /= Pool->NewSize; DO_IF_TRACE(fprintf(stderr, "[%d] poolfree_pc(0x%X) ", getPoolNumber(Pool), (unsigned)Node)); From lattner at cs.uiuc.edu Tue Feb 22 14:20:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 14:20:21 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Message-ID: <200502222020.j1MKKLwC004487@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/PtrCompAllocator: PtrCompAllocator.cpp updated: 1.4 -> 1.5 --- Log message: Compute aligned object size correctly to avoid allocating too much memory for each node. --- Diffs of the changes: (+1 -1) PtrCompAllocator.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp diff -u llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.4 llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.5 --- llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp:1.4 Tue Feb 22 14:16:02 2005 +++ llvm-poolalloc/runtime/PtrCompAllocator/PtrCompAllocator.cpp Tue Feb 22 14:20:06 2005 @@ -150,7 +150,7 @@ Pool->OrigSize = OldSize; // Round up to the next alignment boundary. - Pool->NewSize = (NewSize+NewSize-1) & ~(ObjAlignment-1); + Pool->NewSize = (NewSize+ObjAlignment-1) & ~(ObjAlignment-1); Pool->PoolBase = 0; Pool->BitVector = 0; From alenhar2 at cs.uiuc.edu Tue Feb 22 16:00:04 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 22 Feb 2005 16:00:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaRegisterInfo.cpp Message-ID: <200502222200.j1MM04LI004745@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.53 -> 1.54 AlphaRegisterInfo.cpp updated: 1.11 -> 1.12 --- Log message: dynamic stack allocas --- Diffs of the changes: (+154 -65) AlphaISelPattern.cpp | 88 +++++++++++++++++++++++++-------- AlphaRegisterInfo.cpp | 131 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 154 insertions(+), 65 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.53 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.54 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.53 Sun Feb 13 23:41:43 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 22 15:59:48 2005 @@ -26,6 +26,7 @@ #include "llvm/Target/TargetLowering.h" #include "llvm/Support/MathExtras.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Support/Debug.h" #include #include using namespace llvm; @@ -156,7 +157,7 @@ BuildMI(&BB, Alpha::IDEF, 0, args_float[count]); argVreg[count] = MF.getSSARegMap()->createVirtualRegister( - getRegClassFor(getValueType(I->getType()))); + getRegClassFor(getValueType(I->getType()))); argPreg[count] = args_float[count]; argOpc[count] = Alpha::CPYS; argt = newroot = DAG.getCopyFromReg(argVreg[count], @@ -180,7 +181,6 @@ DAG.getNode(ISD::TRUNCATE, getValueType(I->getType()), newroot); break; } - ++count; } else { //more args // Create the frame index object for this incoming parameter... int FI = MFI->CreateFixedObject(8, 8 * (count - 6)); @@ -191,19 +191,14 @@ argt = newroot = DAG.getLoad(getValueType(I->getType()), DAG.getEntryNode(), FIN); } + ++count; DAG.setRoot(newroot.getValue(1)); ArgValues.push_back(argt); } BuildMI(&BB, Alpha::IDEF, 0, Alpha::R29); BuildMI(&BB, Alpha::BIS, 2, GP).addReg(Alpha::R29).addReg(Alpha::R29); - for (int i = 0; i < count; ++i) { - if (argPreg[i] == Alpha::F16 || argPreg[i] == Alpha::F17 || - argPreg[i] == Alpha::F18 || argPreg[i] == Alpha::F19 || - argPreg[i] == Alpha::F20 || argPreg[i] == Alpha::F21) - { - assert(argOpc[i] == Alpha::CPYS && "Using BIS for a float??"); - } + for (int i = 0; i < count && i < 6; ++i) { BuildMI(&BB, argOpc[i], 2, argVreg[i]).addReg(argPreg[i]).addReg(argPreg[i]); } @@ -311,6 +306,7 @@ /// InstructionSelectBasicBlock - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. virtual void InstructionSelectBasicBlock(SelectionDAG &DAG) { + DEBUG(BB->dump()); // Codegen the basic block. Select(DAG.getRoot()); @@ -570,8 +566,9 @@ BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } else if(Address.getOpcode() == ISD::FrameIndex) { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + BuildMI(BB, Opc, 2, Result) + .addFrameIndex(cast(Address)->getIndex()) + .addReg(Alpha::F31); } else { long offset; SelectAddr(Address, Tmp1, offset); @@ -636,7 +633,9 @@ } else if(Address.getOpcode() == ISD::FrameIndex) { Tmp2 = cast(Address)->getIndex(); - BuildMI(BB, Alpha::LDS, 2, Tmp1).addFrameIndex(Tmp2).addReg(Alpha::F31); + BuildMI(BB, Alpha::LDS, 2, Tmp1) + .addFrameIndex(cast(Address)->getIndex()) + .addReg(Alpha::F31); } else { long offset; SelectAddr(Address, Tmp2, offset); @@ -723,6 +722,47 @@ Node->dump(); assert(0 && "Node not handled!\n"); + case ISD::DYNAMIC_STACKALLOC: + // Generate both result values. + if (Result != 1) + ExprMap[N.getValue(1)] = 1; // Generate the token + else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + + // FIXME: We are currently ignoring the requested alignment for handling + // greater than the stack alignment. This will need to be revisited at some + // point. Align = N.getOperand(2); + + if (!isa(N.getOperand(2)) || + cast(N.getOperand(2))->getValue() != 0) { + std::cerr << "Cannot allocate stack object with greater alignment than" + << " the stack alignment yet!"; + abort(); + } + + Select(N.getOperand(0)); + if (ConstantSDNode* CN = dyn_cast(N.getOperand(1))) + { + if (CN->getValue() < 32000) + { + BuildMI(BB, Alpha::LDA, 2, Alpha::R30) + .addImm(-CN->getValue()).addReg(Alpha::R30); + } else { + Tmp1 = SelectExpr(N.getOperand(1)); + // Subtract size from stack pointer, thereby allocating some space. + BuildMI(BB, Alpha::SUBQ, 2, Alpha::R30).addReg(Alpha::R30).addReg(Tmp1); + } + } else { + Tmp1 = SelectExpr(N.getOperand(1)); + // Subtract size from stack pointer, thereby allocating some space. + BuildMI(BB, Alpha::SUBQ, 2, Alpha::R30).addReg(Alpha::R30).addReg(Tmp1); + } + + // Put a pointer to the space into the result register, by copying the stack + // pointer. + BuildMI(BB, Alpha::BIS, 1, Result).addReg(Alpha::R30).addReg(Alpha::R30); + return Result; + case ISD::ConstantPool: Tmp1 = cast(N)->getIndex(); AlphaLowering.restoreGP(BB); @@ -730,8 +770,9 @@ return Result; case ISD::FrameIndex: - Tmp1 = cast(N)->getIndex(); - BuildMI(BB, Alpha::LDA, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + BuildMI(BB, Alpha::LDA, 2, Result) + .addFrameIndex(cast(N)->getIndex()) + .addReg(Alpha::F31); return Result; case ISD::EXTLOAD: @@ -776,8 +817,9 @@ BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } else if(Address.getOpcode() == ISD::FrameIndex) { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + BuildMI(BB, Opc, 2, Result) + .addFrameIndex(cast(Address)->getIndex()) + .addReg(Alpha::F31); } else { long offset; SelectAddr(Address, Tmp1, offset); @@ -1111,14 +1153,16 @@ //Can only compare doubles, and dag won't promote for me if (SetCC->getOperand(0).getValueType() == MVT::f32) { - std::cerr << "Setcc On float?\n"; + //assert(0 && "Setcc On float?\n"); + std::cerr << "Setcc on float!\n"; Tmp3 = MakeReg(MVT::f64); BuildMI(BB, Alpha::CVTST, 1, Tmp3).addReg(Tmp1); Tmp1 = Tmp3; } if (SetCC->getOperand(1).getValueType() == MVT::f32) { - std::cerr << "Setcc On float?\n"; + //assert (0 && "Setcc On float?\n"); + std::cerr << "Setcc on float!\n"; Tmp3 = MakeReg(MVT::f64); BuildMI(BB, Alpha::CVTST, 1, Tmp3).addReg(Tmp2); Tmp2 = Tmp3; @@ -1338,7 +1382,6 @@ SDNode *Node = N.Val; - switch (opcode) { default: @@ -1457,8 +1500,9 @@ } else if(Address.getOpcode() == ISD::FrameIndex) { - Tmp2 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 3).addReg(Tmp1).addFrameIndex(Tmp2).addReg(Alpha::F31); + BuildMI(BB, Opc, 3).addReg(Tmp1) + .addFrameIndex(cast(Address)->getIndex()) + .addReg(Alpha::F31); } else { @@ -1475,7 +1519,7 @@ case ISD::LOAD: case ISD::CopyFromReg: case ISD::CALL: - // case ISD::DYNAMIC_STACKALLOC: + case ISD::DYNAMIC_STACKALLOC: ExprMap.erase(N); SelectExpr(N); return; Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.11 llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.12 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.11 Fri Feb 4 20:24:26 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Tue Feb 22 15:59:48 2005 @@ -30,6 +30,21 @@ #include using namespace llvm; +static long getLower16(long l) +{ + long y = l / 65536; + if (l % 65536 > 32767) + ++y; + return l - y * 65536; +} + +static long getUpper16(long l) +{ + long y = l / 65536; + if (l % 65536 > 32767) + ++y; + return y; +} AlphaRegisterInfo::AlphaRegisterInfo() : AlphaGenRegisterInfo(Alpha::ADJUSTSTACKDOWN, Alpha::ADJUSTSTACKUP) @@ -102,7 +117,6 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { if (hasFP(MF)) { - assert(0 && "TODO"); // If we have a frame pointer, turn the adjcallstackup instruction into a // 'sub ESP, ' and the adjcallstackdown instruction into 'add ESP, // ' @@ -115,32 +129,40 @@ unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment(); Amount = (Amount+Align-1)/Align*Align; -// MachineInstr *New; -// if (Old->getOpcode() == X86::ADJCALLSTACKDOWN) { -// New=BuildMI(X86::SUB32ri, 1, X86::ESP, MachineOperand::UseAndDef) -// .addZImm(Amount); -// } else { -// assert(Old->getOpcode() == X86::ADJCALLSTACKUP); -// New=BuildMI(X86::ADD32ri, 1, X86::ESP, MachineOperand::UseAndDef) -// .addZImm(Amount); -// } - + MachineInstr *New; + if (Old->getOpcode() == Alpha::ADJUSTSTACKDOWN) { + New=BuildMI(Alpha::LDA, 2, Alpha::R30) + .addImm(-Amount).addReg(Alpha::R30); + } else { + assert(Old->getOpcode() == Alpha::ADJUSTSTACKUP); + New=BuildMI(Alpha::LDA, 2, Alpha::R30) + .addImm(Amount).addReg(Alpha::R30); + } + // Replace the pseudo instruction with a new instruction... - //MBB.insert(I, New); - abort(); + MBB.insert(I, New); } } MBB.erase(I); } +//Alpha has a slightly funny stack: +//Args +//<- incoming SP +//fixed locals (and spills, callee saved, etc) +//<- FP +//variable locals +//<- SP + void AlphaRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II) const { unsigned i = 0; MachineInstr &MI = *II; MachineBasicBlock &MBB = *MI.getParent(); MachineFunction &MF = *MBB.getParent(); - + bool FP = hasFP(MF); + while (!MI.getOperand(i).isFrameIndex()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); @@ -149,22 +171,32 @@ int FrameIndex = MI.getOperand(i).getFrameIndex(); // Add the base register of R30 (SP) or R15 (FP). - MI.SetMachineOperandReg(i + 1, hasFP(MF) ? Alpha::R15 : Alpha::R30); + MI.SetMachineOperandReg(i + 1, FP ? Alpha::R15 : Alpha::R30); - // Now add the frame object offset to the offset from r1. + // Now add the frame object offset to the offset from the virtual frame index. int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex); - // If we're not using a Frame Pointer that has been set to the value of the - // SP before having the stack size subtracted from it, then add the stack size - // to Offset to get the correct offset. + DEBUG(std::cerr << "FI: " << FrameIndex << " Offset: " << Offset << "\n"); + Offset += MF.getFrameInfo()->getStackSize(); + + DEBUG(std::cerr << "Corrected Offset " << Offset << + " for stack size: " << MF.getFrameInfo()->getStackSize() << "\n"); - if (Offset > 32767 || Offset < -32768) { - std::cerr << "Offset needs to be " << Offset << "\n"; - assert(0 && "stack too big"); - } else { - MI.SetMachineOperandConst(i, MachineOperand::MO_SignExtendedImmed, Offset); - } + if (Offset > 32767 || Offset < -32768) { + //so in this case, we need to use a temporary register, and move the original + //inst off the SP/FP + //fix up the old: + MI.SetMachineOperandReg(i + 1, Alpha::R28); + MI.SetMachineOperandConst(i, MachineOperand::MO_SignExtendedImmed, + getLower16(Offset)); + //insert the new + MachineInstr* nMI=BuildMI(Alpha::LDAH, 2, Alpha::R28) + .addImm(getUpper16(Offset)).addReg(FP ? Alpha::R15 : Alpha::R30); + MBB.insert(--II, nMI); + } else { + MI.SetMachineOperandConst(i, MachineOperand::MO_SignExtendedImmed, Offset); + } } @@ -173,6 +205,7 @@ MachineBasicBlock::iterator MBBI = MBB.begin(); MachineFrameInfo *MFI = MF.getFrameInfo(); MachineInstr *MI; + bool FP = hasFP(MF); //handle GOP offset MI = BuildMI(Alpha::LDGP, 0); @@ -181,42 +214,48 @@ // Get the number of bytes to allocate from the FrameInfo unsigned NumBytes = MFI->getStackSize(); - if (MFI->hasCalls()) { + if (MFI->hasCalls() && !FP) { // We reserve argument space for call sites in the function immediately on // entry to the current function. This eliminates the need for add/sub // brackets around call sites. + //If there is a frame pointer, then we don't do this NumBytes += MFI->getMaxCallFrameSize(); std::cerr << "Added " << MFI->getMaxCallFrameSize() << " to the stack due to calls\n"; } + if (FP) + NumBytes += 8; //reserve space for the old FP + // Do we need to allocate space on the stack? if (NumBytes == 0) return; - // Add the size of R30 to NumBytes size for the store of R30 to the - // stack -// std::cerr << "Spillsize of R30 is " << getSpillSize(Alpha::R30) << "\n"; -// NumBytes = NumBytes + getSpillSize(Alpha::R30)/8; - // Update frame info to pretend that this is part of the stack... MFI->setStackSize(NumBytes); - + // adjust stack pointer: r30 -= numbytes - if (NumBytes <= 32767) { MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(-NumBytes).addReg(Alpha::R30); MBB.insert(MBBI, MI); } else if ((unsigned long)NumBytes <= (unsigned long)32767 * (unsigned long)65536) { - long y = NumBytes / 65536; - if (NumBytes % 65536 > 32767) - ++y; - MI=BuildMI(Alpha::LDAH, 2, Alpha::R30).addImm(-y).addReg(Alpha::R30); + MI=BuildMI(Alpha::LDAH, 2, Alpha::R30).addImm(getUpper16(-NumBytes)).addReg(Alpha::R30); MBB.insert(MBBI, MI); - MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(-(NumBytes - y * 65536)).addReg(Alpha::R30); + MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(getLower16(-NumBytes)).addReg(Alpha::R30); MBB.insert(MBBI, MI); } else { std::cerr << "Too big a stack frame at " << NumBytes << "\n"; abort(); } + + //now if we need to, save the old FP and set the new + if (FP) + { + MI=BuildMI(Alpha::STQ, 3).addReg(Alpha::R15).addImm(0).addReg(Alpha::R30); + MBB.insert(MBBI, MI); + //this must be the last instr in the prolog + MI=BuildMI(Alpha::BIS, 2, Alpha::R15).addReg(Alpha::R30).addReg(Alpha::R30); + MBB.insert(MBBI, MI); + } + } void AlphaRegisterInfo::emitEpilogue(MachineFunction &MF, @@ -227,21 +266,27 @@ assert((MBBI->getOpcode() == Alpha::RET || MBBI->getOpcode() == Alpha::RETURN) && "Can only insert epilog into returning blocks"); + bool FP = hasFP(MF); + // Get the number of bytes allocated from the FrameInfo... unsigned NumBytes = MFI->getStackSize(); + //now if we need to, restore the old FP + if (FP) + { + MI=BuildMI(Alpha::LDQ, 2, Alpha::R15).addImm(0).addReg(Alpha::R15); + MBB.insert(MBBI, MI); + } + if (NumBytes != 0) { if (NumBytes <= 32767) { MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(NumBytes).addReg(Alpha::R30); MBB.insert(MBBI, MI); } else if ((unsigned long)NumBytes <= (unsigned long)32767 * (unsigned long)65536) { - long y = NumBytes / 65536; - if (NumBytes % 65536 > 32767) - ++y; - MI=BuildMI(Alpha::LDAH, 2, Alpha::R30).addImm(y).addReg(Alpha::R30); + MI=BuildMI(Alpha::LDAH, 2, Alpha::R30).addImm(getUpper16(NumBytes)).addReg(Alpha::R30); MBB.insert(MBBI, MI); - MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(NumBytes - y * 65536).addReg(Alpha::R30); + MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(getLower16(NumBytes)).addReg(Alpha::R30); MBB.insert(MBBI, MI); } else { std::cerr << "Too big a stack frame at " << NumBytes << "\n"; From lattner at cs.uiuc.edu Tue Feb 22 17:14:14 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 17:14:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200502222314.j1MNEEn5022304@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.211 -> 1.212 --- Log message: C++ is not a functional programming language. --- Diffs of the changes: (+7 -5) llvmAsmParser.y | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.211 llvm/lib/AsmParser/llvmAsmParser.y:1.212 --- llvm/lib/AsmParser/llvmAsmParser.y:1.211 Mon Jan 31 19:47:42 2005 +++ llvm/lib/AsmParser/llvmAsmParser.y Tue Feb 22 17:13:58 2005 @@ -1024,8 +1024,9 @@ } | UpRTypesV '(' ArgTypeListI ')' { // Function derived type? std::vector Params; - mapto($3->begin(), $3->end(), std::back_inserter(Params), - std::mem_fun_ref(&PATypeHolder::get)); + for (std::list::iterator I = $3->begin(), + E = $3->end(); I != E; ++I) + Params.push_back(*I); bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); @@ -1050,9 +1051,10 @@ } | '{' TypeListI '}' { // Structure type? std::vector Elements; - mapto($2->begin(), $2->end(), std::back_inserter(Elements), - std::mem_fun_ref(&PATypeHolder::get)); - + for (std::list::iterator I = $2->begin(), + E = $2->end(); I != E; ++I) + Elements.push_back(*I); + $$ = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); delete $2; } From lattner at cs.uiuc.edu Tue Feb 22 17:19:59 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 17:19:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/STLExtras.h Message-ID: <200502222319.j1MNJxYF030259@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: STLExtras.h updated: 1.18 -> 1.19 --- Log message: Remove a bunch of dead templates. --- Diffs of the changes: (+0 -73) STLExtras.h | 73 ------------------------------------------------------------ 1 files changed, 73 deletions(-) Index: llvm/include/llvm/ADT/STLExtras.h diff -u llvm/include/llvm/ADT/STLExtras.h:1.18 llvm/include/llvm/ADT/STLExtras.h:1.19 --- llvm/include/llvm/ADT/STLExtras.h:1.18 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/ADT/STLExtras.h Tue Feb 22 17:19:42 2005 @@ -187,79 +187,6 @@ return it; } - -//===----------------------------------------------------------------------===// -// Extra additions to -//===----------------------------------------------------------------------===// - -// apply_until - Apply a functor to a sequence continually, unless the -// functor returns true. Return true if the functor returned true, return false -// if the functor never returned true. -// -template -bool apply_until(InputIt First, InputIt Last, Function Func) { - for ( ; First != Last; ++First) - if (Func(*First)) return true; - return false; -} - - -// reduce - Reduce a sequence values into a single value, given an initial -// value and an operator. -// -template -ValueType reduce(InputIt First, InputIt Last, Function Func, ValueType Value) { - for ( ; First != Last; ++First) - Value = Func(*First, Value); - return Value; -} - -#if 1 // This is likely to be more efficient - -// reduce_apply - Reduce the result of applying a function to each value in a -// sequence, given an initial value, an operator, a function, and a sequence. -// -template -inline ValueType reduce_apply(InputIt First, InputIt Last, Function Func, - ValueType Value, TransFunc XForm) { - for ( ; First != Last; ++First) - Value = Func(XForm(*First), Value); - return Value; -} - -#else // This is arguably more elegant - -// reduce_apply - Reduce the result of applying a function to each value in a -// sequence, given an initial value, an operator, a function, and a sequence. -// -template -inline ValueType reduce_apply2(InputIt First, InputIt Last, Function Func, - ValueType Value, TransFunc XForm) { - return reduce(map_iterator(First, XForm), map_iterator(Last, XForm), - Func, Value); -} -#endif - - -// reduce_apply_bool - Reduce the result of applying a (bool returning) function -// to each value in a sequence. All of the bools returned by the mapped -// function are bitwise or'd together, and the result is returned. -// -template -inline bool reduce_apply_bool(InputIt First, InputIt Last, Function Func) { - return reduce_apply(First, Last, bitwise_or(), false, Func); -} - - -// map - This function maps the specified input sequence into the specified -// output iterator, applying a unary function in between. -// -template -inline OutIt mapto(InIt Begin, InIt End, OutIt Dest, Functor F) { - return copy(map_iterator(Begin, F), map_iterator(End, F), Dest); -} - - //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Tue Feb 22 17:23:14 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 17:23:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp Message-ID: <200502222323.j1MNNEC4002143@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.89 -> 1.90 --- Log message: Remove use of bind_obj --- Diffs of the changes: (+3 -2) ADCE.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.89 llvm/lib/Transforms/Scalar/ADCE.cpp:1.90 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.89 Thu Feb 17 13:28:49 2005 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Tue Feb 22 17:22:58 2005 @@ -116,8 +116,9 @@ if (It != CDG.end()) { // Get the blocks that this node is control dependent on... const PostDominanceFrontier::DomSetType &CDB = It->second; - for_each(CDB.begin(), CDB.end(), // Mark all their terminators as live - bind_obj(this, &ADCE::markTerminatorLive)); + for (PostDominanceFrontier::DomSetType::const_iterator I = + CDB.begin(), E = CDB.end(); I != E; ++I) + markTerminatorLive(*I); // Mark all their terminators as live } // If this basic block is live, and it ends in an unconditional branch, then From lattner at cs.uiuc.edu Tue Feb 22 17:27:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 17:27:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IntervalPartition.cpp Message-ID: <200502222327.j1MNRYfM004656@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: IntervalPartition.cpp updated: 1.27 -> 1.28 --- Log message: Remove use of bind_obj, deleter, and finegrainify namespacification. --- Diffs of the changes: (+15 -18) IntervalPartition.cpp | 33 +++++++++++++++------------------ 1 files changed, 15 insertions(+), 18 deletions(-) Index: llvm/lib/Analysis/IntervalPartition.cpp diff -u llvm/lib/Analysis/IntervalPartition.cpp:1.27 llvm/lib/Analysis/IntervalPartition.cpp:1.28 --- llvm/lib/Analysis/IntervalPartition.cpp:1.27 Mon Dec 6 22:03:45 2004 +++ llvm/lib/Analysis/IntervalPartition.cpp Tue Feb 22 17:27:21 2005 @@ -13,10 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/IntervalIterator.h" -#include "llvm/ADT/STLExtras.h" -#include - -namespace llvm { +using namespace llvm; static RegisterAnalysis X("intervals", "Interval Partition Construction", true); @@ -27,7 +24,8 @@ // destroy - Reset state back to before function was analyzed void IntervalPartition::destroy() { - std::for_each(Intervals.begin(), Intervals.end(), deleter); + for (unsigned i = 0, e = Intervals.size(); i != e; ++i) + delete Intervals[i]; IntervalMap.clear(); RootInterval = 0; } @@ -74,14 +72,14 @@ ++I; // After the first one... - // Add the rest of the intervals to the partition... - for_each(I, intervals_end(&F), - bind_obj(this, &IntervalPartition::addIntervalToPartition)); + // Add the rest of the intervals to the partition. + for (function_interval_iterator E = intervals_end(&F); I != E; ++I) + addIntervalToPartition(*I); // Now that we know all of the successor information, propagate this to the - // predecessors for each block... - for_each(Intervals.begin(), Intervals.end(), - bind_obj(this, &IntervalPartition::updatePredecessors)); + // predecessors for each block. + for (unsigned i = 0, e = Intervals.size(); i != e; ++i) + updatePredecessors(Intervals[i]); return false; } @@ -102,14 +100,13 @@ ++I; // After the first one... - // Add the rest of the intervals to the partition... - for_each(I, intervals_end(IP), - bind_obj(this, &IntervalPartition::addIntervalToPartition)); + // Add the rest of the intervals to the partition. + for (interval_part_interval_iterator E = intervals_end(IP); I != E; ++I) + addIntervalToPartition(*I); // Now that we know all of the successor information, propagate this to the - // predecessors for each block... - for_each(Intervals.begin(), Intervals.end(), - bind_obj(this, &IntervalPartition::updatePredecessors)); + // predecessors for each block. + for (unsigned i = 0, e = Intervals.size(); i != e; ++i) + updatePredecessors(Intervals[i]); } -} // End llvm namespace From alenhar2 at cs.uiuc.edu Tue Feb 22 17:29:38 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 22 Feb 2005 17:29:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502222329.j1MNTcnp012389@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.54 -> 1.55 --- Log message: oops --- Diffs of the changes: (+1 -1) AlphaISelPattern.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.54 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.55 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.54 Tue Feb 22 15:59:48 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 22 17:29:25 2005 @@ -760,7 +760,7 @@ // Put a pointer to the space into the result register, by copying the stack // pointer. - BuildMI(BB, Alpha::BIS, 1, Result).addReg(Alpha::R30).addReg(Alpha::R30); + BuildMI(BB, Alpha::BIS, 2, Result).addReg(Alpha::R30).addReg(Alpha::R30); return Result; case ISD::ConstantPool: From lattner at cs.uiuc.edu Tue Feb 22 17:36:52 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 17:36:52 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/STLExtras.h Message-ID: <200502222336.j1MNaq7E020155@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: STLExtras.h updated: 1.19 -> 1.20 --- Log message: remove some more dead templates and a dead macro. --- Diffs of the changes: (+0 -33) STLExtras.h | 33 --------------------------------- 1 files changed, 33 deletions(-) Index: llvm/include/llvm/ADT/STLExtras.h diff -u llvm/include/llvm/ADT/STLExtras.h:1.19 llvm/include/llvm/ADT/STLExtras.h:1.20 --- llvm/include/llvm/ADT/STLExtras.h:1.19 Tue Feb 22 17:19:42 2005 +++ llvm/include/llvm/ADT/STLExtras.h Tue Feb 22 17:36:37 2005 @@ -27,39 +27,6 @@ // Extra additions to //===----------------------------------------------------------------------===// -// bind_obj - Often times you want to apply the member function of an object -// as a unary functor. This macro is shorthand that makes it happen less -// verbosely. -// -// Example: -// struct Summer { void accumulate(int x); } -// vector Numbers; -// Summer MyS; -// for_each(Numbers.begin(), Numbers.end(), -// bind_obj(&MyS, &Summer::accumulate)); -// -// TODO: When I get lots of extra time, convert this from an evil macro -// -#define bind_obj(OBJ, METHOD) std::bind1st(std::mem_fun(METHOD), OBJ) - - -// bitwise_or - This is a simple functor that applys operator| on its two -// arguments to get a boolean result. -// -template -struct bitwise_or : public std::binary_function { - bool operator()(const Ty& left, const Ty& right) const { - return left | right; - } -}; - -template -struct less_ptr : public std::binary_function { - bool operator()(const Ty* left, const Ty* right) const { - return *left < *right; - } -}; - template struct greater_ptr : public std::binary_function { bool operator()(const Ty* left, const Ty* right) const { From tbrethou at cs.uiuc.edu Tue Feb 22 20:02:01 2005 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Tue, 22 Feb 2005 20:02:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp MSSchedule.h ModuloScheduling.cpp ModuloScheduling.h Message-ID: <200502230202.j1N221O5021074@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9/ModuloScheduling: MSSchedule.cpp updated: 1.12 -> 1.13 MSSchedule.h updated: 1.3 -> 1.4 ModuloScheduling.cpp updated: 1.42 -> 1.43 ModuloScheduling.h updated: 1.23 -> 1.24 --- Log message: Fixed bug in findAllcircuits. Fixed branch addition to schedule. Added debug information. --- Diffs of the changes: (+150 -92) MSSchedule.cpp | 9 +- MSSchedule.h | 2 ModuloScheduling.cpp | 226 ++++++++++++++++++++++++++++++--------------------- ModuloScheduling.h | 5 + 4 files changed, 150 insertions(+), 92 deletions(-) Index: llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp diff -u llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp:1.12 llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp:1.13 --- llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp:1.12 Thu Dec 2 01:22:15 2004 +++ llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp Tue Feb 22 20:01:42 2005 @@ -19,6 +19,7 @@ using namespace llvm; +//Returns a boolean indicating if the start cycle needs to be increased/decreased bool MSSchedule::insert(MSchedGraphNode *node, int cycle) { //First, check if the cycle has a spot free to start @@ -147,6 +148,7 @@ std::map::iterator resourceUse = resourcesForCycle->second.find(resourceNum); //assert if not in the map.. since it should be! //assert(resourceUse != resourcesForCycle.end() && "Resource should be in map!"); + DEBUG(std::cerr << "Removing resource num " << resourceNum << " from cycle " << oldCycle << "\n"); --resourceUse->second; } } @@ -163,7 +165,7 @@ } -bool MSSchedule::constructKernel(int II) { +bool MSSchedule::constructKernel(int II, std::vector &branches) { int stageNum = (schedule.rbegin()->first)/ II; DEBUG(std::cerr << "Number of Stages: " << stageNum << "\n"); @@ -188,6 +190,11 @@ } } + //Push on branches. Branch vector is in order of last branch to first. + for(std::vector::reverse_iterator B = branches.rbegin() , BE = branches.rend(); B != BE; ++B) { + kernel.push_back(std::make_pair(*B, 0)); + } + if(stageNum > 0) maxStage = stageNum; else Index: llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.h diff -u llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.h:1.3 llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.h:1.4 --- llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.h:1.3 Sun Nov 28 17:36:15 2004 +++ llvm/lib/Target/SparcV9/ModuloScheduling/MSSchedule.h Tue Feb 22 20:01:42 2005 @@ -45,7 +45,7 @@ int getStartCycle(MSchedGraphNode *node); void clear() { schedule.clear(); resourceNumPerCycle.clear(); kernel.clear(); } std::vector >* getKernel() { return &kernel; } - bool constructKernel(int II); + bool constructKernel(int II, std::vector &branches); int getMaxStage() { return maxStage; } Index: llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp diff -u llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp:1.42 llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp:1.43 --- llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp:1.42 Tue Feb 15 22:00:59 2005 +++ llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp Tue Feb 22 20:01:42 2005 @@ -1029,7 +1029,38 @@ } } +void ModuloSchedulingPass::searchPath(MSchedGraphNode *node, + std::vector &path, + std::set &nodesToAdd) { + //Push node onto the path + path.push_back(node); + + //Loop over all successors and see if there is a path from this node to + //a recurrence in the partial order, if so.. add all nodes to be added to recc + for(MSchedGraphNode::succ_iterator S = node->succ_begin(), SE = node->succ_end(); S != SE; + ++S) { + + //If this node exists in a recurrence already in the partial order, then add all + //nodes in the path to the set of nodes to add + //Check if its already in our partial order, if not add it to the final vector + for(std::vector >::iterator PO = partialOrder.begin(), + PE = partialOrder.end(); PO != PE; ++PO) { + + //Check if we should ignore this edge first + if(ignoreEdge(node,*S)) + continue; + if(PO->count(*S)) { + nodesToAdd.insert(*S); + } + searchPath(*S, path, nodesToAdd); + } + + } + + //Pop Node off the path + path.pop_back(); +} @@ -1042,74 +1073,79 @@ //on BA being there? std::vector branches; - //Loop over all recurrences and add to our partial order - //be sure to remove nodes that are already in the partial order in - //a different recurrence and don't add empty recurrences. - for(std::set > >::reverse_iterator I = recurrenceList.rbegin(), E=recurrenceList.rend(); I !=E; ++I) { - - //Add nodes that connect this recurrence to the previous recurrence - - //If this is the first recurrence in the partial order, add all predecessors - for(std::vector::const_iterator N = I->second.begin(), NE = I->second.end(); N != NE; ++N) { - - } - + //Steps to add a recurrence to the partial order + // 1) Find reccurrence with the highest RecMII. Add it to the partial order. + // 2) For each recurrence with decreasing RecMII, add it to the partial order along with + // any nodes that connect this recurrence to recurrences already in the partial order + for(std::set > >::reverse_iterator + I = recurrenceList.rbegin(), E=recurrenceList.rend(); I !=E; ++I) { std::set new_recurrence; + //Loop through recurrence and remove any nodes already in the partial order - for(std::vector::const_iterator N = I->second.begin(), NE = I->second.end(); N != NE; ++N) { + for(std::vector::const_iterator N = I->second.begin(), + NE = I->second.end(); N != NE; ++N) { + bool found = false; - for(std::vector >::iterator PO = partialOrder.begin(), PE = partialOrder.end(); PO != PE; ++PO) { + for(std::vector >::iterator PO = partialOrder.begin(), + PE = partialOrder.end(); PO != PE; ++PO) { if(PO->count(*N)) found = true; } + + //Check if its a branch, and remove to handle special if(!found) { if((*N)->isBranch()) { branches.push_back(*N); } else new_recurrence.insert(*N); - } - if(partialOrder.size() == 0) - //For each predecessors, add it to this recurrence ONLY if it is not already in it - for(MSchedGraphNode::pred_iterator P = (*N)->pred_begin(), - PE = (*N)->pred_end(); P != PE; ++P) { - - //Check if we are supposed to ignore this edge or not - if(!ignoreEdge(*P, *N)) - //Check if already in this recurrence - if(std::find(I->second.begin(), I->second.end(), *P) == I->second.end()) { - //Also need to check if in partial order - bool predFound = false; - for(std::vector >::iterator PO = partialOrder.begin(), PEND = partialOrder.end(); PO != PEND; ++PO) { - if(PO->count(*P)) - predFound = true; - } - - if(!predFound) - if(!new_recurrence.count(*P)) { - if((*P)->isBranch()) { - branches.push_back(*P); - } - else - new_recurrence.insert(*P); - - } - } - } + } + } - if(new_recurrence.size() > 0) + + if(new_recurrence.size() > 0) { + + std::vector path; + std::set nodesToAdd; + + //Add nodes that connect this recurrence to recurrences in the partial path + for(std::set::iterator N = new_recurrence.begin(), + NE = new_recurrence.end(); N != NE; ++N) + searchPath(*N, path, nodesToAdd); + + //Add nodes to this recurrence if they are not already in the partial order + for(std::set::iterator N = nodesToAdd.begin(), NE = nodesToAdd.end(); + N != NE; ++N) { + bool found = false; + for(std::vector >::iterator PO = partialOrder.begin(), + PE = partialOrder.end(); PO != PE; ++PO) { + if(PO->count(*N)) + found = true; + } + if(!found) { + assert("FOUND CONNECTOR"); + new_recurrence.insert(*N); + } + } + partialOrder.push_back(new_recurrence); + + } } //Add any nodes that are not already in the partial order //Add them in a set, one set per connected component std::set lastNodes; - for(std::map::iterator I = nodeToAttributesMap.begin(), E = nodeToAttributesMap.end(); I != E; ++I) { + for(std::map::iterator I = nodeToAttributesMap.begin(), + E = nodeToAttributesMap.end(); I != E; ++I) { + bool found = false; + //Check if its already in our partial order, if not add it to the final vector - for(std::vector >::iterator PO = partialOrder.begin(), PE = partialOrder.end(); PO != PE; ++PO) { + for(std::vector >::iterator PO = partialOrder.begin(), + PE = partialOrder.end(); PO != PE; ++PO) { if(PO->count(I->first)) found = true; } @@ -1131,9 +1167,7 @@ if(ccSet.size() > 0) partialOrder.push_back(ccSet); } - //if(lastNodes.size() > 0) - //partialOrder.push_back(lastNodes); - + //Clean up branches by putting them in final order std::map branchOrder; for(std::vector::iterator I = branches.begin(), E = branches.end(); I != E; ++I) @@ -1441,9 +1475,8 @@ while(!success) { - int branchES = II - 1; - int branchLS = II - 1; - bool lastBranch = true; + //Keep track of branches, but do not insert into the schedule + std::vector branches; //Loop over the final node order and process each node for(std::vector::iterator I = FinalNodeOrder.begin(), @@ -1465,54 +1498,62 @@ for(std::vector::iterator schedNode = nodesByCycle->second.begin(), SNE = nodesByCycle->second.end(); schedNode != SNE; ++schedNode) { if((*I)->isPredecessor(*schedNode)) { - //if(!ignoreEdge(*schedNode, *I)) { - int diff = (*I)->getInEdge(*schedNode).getIteDiff(); - int ES_Temp = nodesByCycle->first + (*schedNode)->getLatency() - diff * II; - DEBUG(std::cerr << "Diff: " << diff << " Cycle: " << nodesByCycle->first << "\n"); - DEBUG(std::cerr << "Temp EarlyStart: " << ES_Temp << " Prev EarlyStart: " << EarlyStart << "\n"); - EarlyStart = std::max(EarlyStart, ES_Temp); - hasPred = true; - //} + int diff = (*I)->getInEdge(*schedNode).getIteDiff(); + int ES_Temp = nodesByCycle->first + (*schedNode)->getLatency() - diff * II; + DEBUG(std::cerr << "Diff: " << diff << " Cycle: " << nodesByCycle->first << "\n"); + DEBUG(std::cerr << "Temp EarlyStart: " << ES_Temp << " Prev EarlyStart: " << EarlyStart << "\n"); + EarlyStart = std::max(EarlyStart, ES_Temp); + hasPred = true; } if((*I)->isSuccessor(*schedNode)) { - //if(!ignoreEdge(*I,*schedNode)) { - int diff = (*schedNode)->getInEdge(*I).getIteDiff(); - int LS_Temp = nodesByCycle->first - (*I)->getLatency() + diff * II; - DEBUG(std::cerr << "Diff: " << diff << " Cycle: " << nodesByCycle->first << "\n"); - DEBUG(std::cerr << "Temp LateStart: " << LS_Temp << " Prev LateStart: " << LateStart << "\n"); - LateStart = std::min(LateStart, LS_Temp); - hasSucc = true; - //} + int diff = (*schedNode)->getInEdge(*I).getIteDiff(); + int LS_Temp = nodesByCycle->first - (*I)->getLatency() + diff * II; + DEBUG(std::cerr << "Diff: " << diff << " Cycle: " << nodesByCycle->first << "\n"); + DEBUG(std::cerr << "Temp LateStart: " << LS_Temp << " Prev LateStart: " << LateStart << "\n"); + LateStart = std::min(LateStart, LS_Temp); + hasSucc = true; } } } } else { - if(lastBranch) { - EarlyStart = branchES; - LateStart = branchLS; - lastBranch = false; - --branchES; - branchLS = 0; + branches.push_back(*I); + continue; + } + + //Check if this node is a pred or succ to a branch, and restrict its placement + //even though the branch is not in the schedule + int count = branches.size(); + for(std::vector::iterator B = branches.begin(), BE = branches.end(); + B != BE; ++B) { + if((*I)->isPredecessor(*B)) { + int diff = (*I)->getInEdge(*B).getIteDiff(); + int ES_Temp = (II+count) + (*B)->getLatency() - diff * II; + DEBUG(std::cerr << "Diff: " << diff << " Cycle: " << (II+count) << "\n"); + DEBUG(std::cerr << "Temp EarlyStart: " << ES_Temp << " Prev EarlyStart: " << EarlyStart << "\n"); + EarlyStart = std::max(EarlyStart, ES_Temp); + hasPred = true; } - else { - EarlyStart = branchLS; - LateStart = branchES; - assert( (EarlyStart >= 0) && (LateStart >=0) && "EarlyStart and LateStart must be greater then 0"); - --branchES; + + if((*I)->isSuccessor(*B)) { + int diff = (*B)->getInEdge(*I).getIteDiff(); + int LS_Temp = (II+count) - (*I)->getLatency() + diff * II; + DEBUG(std::cerr << "Diff: " << diff << " Cycle: " << (II+count) << "\n"); + DEBUG(std::cerr << "Temp LateStart: " << LS_Temp << " Prev LateStart: " << LateStart << "\n"); + LateStart = std::min(LateStart, LS_Temp); + hasSucc = true; } - hasPred = 0; - hasSucc = 1; + + count--; } - DEBUG(std::cerr << "Has Successors: " << hasSucc << ", Has Pred: " << hasPred << "\n"); - DEBUG(std::cerr << "EarlyStart: " << EarlyStart << ", LateStart: " << LateStart << "\n"); - - //Check if the node has no pred or successors and set Early Start to its ASAP if(!hasSucc && !hasPred) EarlyStart = nodeToAttributesMap.find(*I)->second.ASAP; + DEBUG(std::cerr << "Has Successors: " << hasSucc << ", Has Pred: " << hasPred << "\n"); + DEBUG(std::cerr << "EarlyStart: " << EarlyStart << ", LateStart: " << LateStart << "\n"); + //Now, try to schedule this node depending upon its pred and successor in the schedule //already if(!hasSucc && hasPred) @@ -1520,10 +1561,13 @@ else if(!hasPred && hasSucc) success = scheduleNode(*I, LateStart, (LateStart - II +1)); else if(hasPred && hasSucc) { - if(EarlyStart > LateStart) - success = false; - else - success = scheduleNode(*I, EarlyStart, std::min(LateStart, (EarlyStart + II -1))); + if(EarlyStart > LateStart) { + //success = false; + LateStart = EarlyStart; + DEBUG(std::cerr << "Early Start can not be later then the late start cycle, schedule fails\n"); + } + //else + success = scheduleNode(*I, EarlyStart, std::min(LateStart, (EarlyStart + II -1))); } else success = scheduleNode(*I, EarlyStart, EarlyStart + II - 1); @@ -1539,7 +1583,7 @@ if(success) { DEBUG(std::cerr << "Constructing Schedule Kernel\n"); - success = schedule.constructKernel(II); + success = schedule.constructKernel(II, branches); DEBUG(std::cerr << "Done Constructing Schedule Kernel\n"); if(!success) { ++IncreasedII; @@ -1548,8 +1592,10 @@ } } - if(II >= capII) + if(II >= capII) { + DEBUG(std::cerr << "Maximum II reached, giving up\n"); return false; + } assert(II < capII && "The II should not exceed the original loop number of cycles"); } Index: llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h diff -u llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h:1.23 llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h:1.24 --- llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h:1.23 Thu Feb 10 11:02:58 2005 +++ llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h Tue Feb 22 20:01:42 2005 @@ -97,7 +97,12 @@ void unblock(MSchedGraphNode *u, std::set &blocked, std::map > &B); + void searchPath(MSchedGraphNode *node, + std::vector &path, + std::set &nodesToAdd); + void computePartialOrder(); + bool computeSchedule(); bool scheduleNode(MSchedGraphNode *node, int start, int end); From lattner at cs.uiuc.edu Tue Feb 22 23:33:28 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 23:33:28 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502230533.j1N5XSwt025543@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.19 -> 1.20 --- Log message: Fix two issues: 1. When running on Olden/perimeter, we hit the case where we called a function and passed in a null pointer. Because it was null we didn't have a pool associated with it, so didn't compress it. This was a problem because it actually did need to be compressed. Fix this by checking for this case on the callee side. 2. Fix a problem that made bugpoint mostly useless. In particular, ptrcompress would crash when asked to clone an external function. This implements it, but the result isn't actually useful: you'll get a link error. --- Diffs of the changes: (+77 -15) PointerCompress.cpp | 92 +++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 77 insertions(+), 15 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.19 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.20 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.19 Mon Feb 21 14:45:47 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Tue Feb 22 23:33:12 2005 @@ -18,6 +18,7 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/InstVisitor.h" @@ -96,6 +97,12 @@ void getAnalysisUsage(AnalysisUsage &AU) const; + PoolAllocate *getPoolAlloc() const { return PoolAlloc; } + + const DSGraph &getGraphForFunc(PA::FuncInfo *FI) const { + return ECG->getDSGraph(FI->F); + } + /// getCloneInfo - If the specified function is a clone, return the /// information about the cloning process for it. Otherwise, return a null /// pointer. @@ -695,17 +702,64 @@ if (isa(CI.getType()) && getNodeIfCompressed(&CI)) OpsToCompress.push_back(0); - // Check to see if we need to compress any arguments. + // Check to see if we need to compress any arguments, keeping track of any + // null pointers passed in. + std::vector NullArgs; for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) - if (isa(CI.getOperand(i)->getType()) && - getNodeIfCompressed(CI.getOperand(i))) - OpsToCompress.push_back(i); + if (isa(CI.getOperand(i)->getType())) + if (isa(CI.getOperand(i))) + NullArgs.push_back(i-1); + else if(getNodeIfCompressed(CI.getOperand(i))) + OpsToCompress.push_back(i); // If this function doesn't require compression, there is nothing to do! if (OpsToCompress.empty()) return; Function *Callee = CI.getCalledFunction(); assert(Callee && "Indirect calls not implemented yet!"); - + + // Null arguments do not have any pool information immediately available for + // them. Check the callee's graph to see if the formal argument points into a + // pool that we are compressing (because of some other argument or the ret + // value). If we need to compress the call argument, mark the null pointer to + // be compressed as well. + if (!NullArgs.empty()) { + PA::FuncInfo *FI = PtrComp.getPoolAlloc()->getFuncInfoOrClone(*Callee); + const DSGraph &CG = PtrComp.getGraphForFunc(FI); + unsigned NumPoolArgs = FI->ArgNodes.size(); + + std::set CompressedPools; + + // Mark all compressed argument nodes. + // FIXME: This will only work for one-level compressed pools. This will + // have to be generalized in the future. + for (unsigned i = 0, e = OpsToCompress.size(); i != e; ++i) { + DSNode *N; + if (OpsToCompress[i] == 0) + N = CG.getReturnNodeFor(FI->F).getNode(); + else { + Argument *OrigArg = next(FI->F.abegin(), OpsToCompress[i]-1); + assert(isa(OrigArg->getType()) && "Something went wrong!"); + N = CG.getNodeForValue(OrigArg).getNode(); + } + CompressedPools.insert(N); + } + + // Now that we have marked the nodes that will already be compressed, check + // to see if the null arguments point to any of these nodes. + for (unsigned i = 0, e = NullArgs.size(); i != e; ++i) { + // Figure out what argument number it was in the unpoolallocated function. + unsigned ArgNo = NullArgs[i]-NumPoolArgs; + Argument *OrigArg = next(FI->F.abegin(), ArgNo); + assert(isa(OrigArg->getType()) && "Something went wrong!"); + DSNode *N = CG.getNodeForValue(OrigArg).getNode(); + if (N && CompressedPools.count(N)) + OpsToCompress.push_back(NullArgs[i]+1); + } + + // Make sure this vector stays sorted. + std::sort(OpsToCompress.begin(), OpsToCompress.end()); + } + // Get the clone of this function that uses compressed pointers instead of // normal pointers. Function *Clone = PtrComp.GetFunctionClone(Callee, OpsToCompress); @@ -713,12 +767,17 @@ // Okay, we now have our clone: rewrite the call instruction. std::vector Operands; Operands.reserve(CI.getNumOperands()-1); + unsigned OTCIdx = OpsToCompress[0] == 0; // Skip ret value if present + for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) if (isa(CI.getOperand(i)->getType()) && - getNodeIfCompressed(CI.getOperand(i))) + OTCIdx < OpsToCompress.size() && OpsToCompress[OTCIdx] == i) { Operands.push_back(getTransformedValue(CI.getOperand(i))); - else + ++OTCIdx; + } else { Operands.push_back(CI.getOperand(i)); + } + Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); if (OpsToCompress[0] == 0) // Compressing return value? setTransformedValue(CI, NC); @@ -874,6 +933,9 @@ ++NumCloned; std::cerr << " CLONING FUNCTION: " << F->getName() << " -> " << Clone->getName() << "\n"; + + if (F->isExternal()) return Clone; + std::map ValueMap; // Create dummy Value*'s of pointer type for any arguments that are @@ -903,25 +965,25 @@ // Clone the actual function body over. std::vector Returns; CloneFunctionInto(Clone, F, ValueMap, Returns); - Returns.clear(); // We don't need this. - + Returns.clear(); // Don't need this. + // Invert the ValueMap into the NewToOldValueMap std::map &NewToOldValueMap = CFI.NewToOldValueMap; for (std::map::iterator I = ValueMap.begin(), E = ValueMap.end(); I != E; ++I) NewToOldValueMap.insert(std::make_pair(I->second, I->first)); - + // Compute the PoolDescriptors map for the cloned function. PA::FuncInfo *FI = PoolAlloc->getFuncInfoOrClone(*F); - for (std::map::iterator I =FI->PoolDescriptors.begin(), - E = FI->PoolDescriptors.end(); I != E; ++I) + for (std::map::iterator I = + FI->PoolDescriptors.begin(), E = FI->PoolDescriptors.end(); + I != E; ++I) CFI.PoolDescriptors[I->first] = ValueMap[I->second]; - + ValueMap.clear(); - + // Recursively transform the function. CompressPoolsInFunction(*Clone, &RemappedArgs); - return Clone; } From lattner at cs.uiuc.edu Tue Feb 22 23:48:46 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 23:48:46 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502230548.j1N5mkbH027642@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.20 -> 1.21 --- Log message: Implement some more features, for perimeter, including handling of it's array of four pointers. --- Diffs of the changes: (+7 -2) PointerCompress.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.20 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.21 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.20 Tue Feb 22 23:33:12 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Tue Feb 22 23:48:30 2005 @@ -180,7 +180,7 @@ NewTy = ComputeCompressedType(Pool->getType(), 0, Nodes); // Get the compressed type size. - NewSize = TD.getTypeSize(NewTy); + NewSize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0; } @@ -193,7 +193,7 @@ if (const PointerType *PTY = dyn_cast(OrigTy)) { // FIXME: check to see if this pointer is actually compressed! return MEMUINTTYPE; - } else if (OrigTy->isFirstClassType()) + } else if (OrigTy->isFirstClassType() || OrigTy == Type::VoidTy) return OrigTy; // Okay, we have an aggregate type. @@ -204,7 +204,12 @@ Elements.push_back(ComputeCompressedType(STy->getElementType(i), NodeOffset, Nodes)); return StructType::get(Elements); + } else if (const ArrayType *ATy = dyn_cast(OrigTy)) { + return ArrayType::get(ComputeCompressedType(ATy->getElementType(), + NodeOffset, Nodes), + ATy->getNumElements()); } else { + std::cerr << "TYPE: " << *OrigTy << "\n"; assert(0 && "FIXME: Unhandled aggregate type!"); } } From lattner at cs.uiuc.edu Tue Feb 22 23:51:38 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 23:51:38 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502230551.j1N5pc2A028178@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.21 -> 1.22 --- Log message: Another bugfix for improved bugpointability --- Diffs of the changes: (+4 -1) PointerCompress.cpp | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.21 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.22 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.21 Tue Feb 22 23:48:30 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Tue Feb 22 23:51:24 2005 @@ -939,7 +939,10 @@ std::cerr << " CLONING FUNCTION: " << F->getName() << " -> " << Clone->getName() << "\n"; - if (F->isExternal()) return Clone; + if (F->isExternal()) { + Clone->setLinkage(GlobalValue::ExternalLinkage); + return Clone; + } std::map ValueMap; From lattner at cs.uiuc.edu Tue Feb 22 23:57:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 22 Feb 2005 23:57:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200502230557.j1N5vY0Q028378@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.89 -> 1.90 --- Log message: Silence some uninit variable warnings. --- Diffs of the changes: (+2 -0) X86ISelPattern.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.89 llvm/lib/Target/X86/X86ISelPattern.cpp:1.90 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.89 Tue Jan 25 14:35:10 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Tue Feb 22 23:57:21 2005 @@ -2933,6 +2933,7 @@ RP.push_back(std::make_pair(getRegPressure(N.getOperand(2)), 2)); std::sort(RP.begin(), RP.end()); + Tmp1 = 0; // Silence a warning. for (unsigned i = 0; i != 3; ++i) switch (RP[2-i].second) { default: assert(0 && "Unknown operand number!"); @@ -2989,6 +2990,7 @@ RP.push_back(std::make_pair(getRegPressure(N.getOperand(2)), 2)); std::sort(RP.begin(), RP.end()); + Tmp1 = 0; // Silence a warning. for (unsigned i = 0; i != 3; ++i) switch (RP[2-i].second) { default: assert(0 && "Unknown operand number!"); From lattner at cs.uiuc.edu Wed Feb 23 00:12:24 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 00:12:24 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExtractFunction.cpp Message-ID: <200502230612.j1N6COoG028927@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExtractFunction.cpp updated: 1.41 -> 1.42 --- Log message: Fix a bugpoint crash that JeffC noticed, looking like this: *** Attempting to perform final cleanups: Final cleanups failed. Sorry. :( Ple ase report a bug! llc.exe: bytecode didn't read correctly. llc.exe: bytecode didn't read correctly. Assertion failed: M && "You can't write a null module!!", file c:\llvm\lib\bytec ode\writer\writer.cpp, line 1094 The fact that llc bombed (in this case) is ok, but bugpoint shouldn't crash after this. --- Diffs of the changes: (+2 -1) ExtractFunction.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.41 llvm/tools/bugpoint/ExtractFunction.cpp:1.42 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.41 Thu Nov 18 13:40:13 2004 +++ llvm/tools/bugpoint/ExtractFunction.cpp Wed Feb 23 00:12:11 2005 @@ -98,7 +98,7 @@ /// performFinalCleanups - This method clones the current Program and performs /// a series of cleanups intended to get rid of extra cruft on the module -/// before handing it to the user... +/// before handing it to the user. /// Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) { // Make all functions external, so GlobalDCE doesn't delete them... @@ -118,6 +118,7 @@ Module *New = runPassesOn(M, CleanupPasses); if (New == 0) { std::cerr << "Final cleanups failed. Sorry. :( Please report a bug!\n"; + return M; } delete M; return New; From lattner at cs.uiuc.edu Wed Feb 23 01:09:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 01:09:21 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Message-ID: <200502230709.j1N79LNG004155@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.54 -> 1.55 --- Log message: Reduce the amount of searching this assertion does. On a testcase of mine, this reduces the time for -simplifycfg in a debug build from 106s to 14.82s --- Diffs of the changes: (+3 -1) BasicBlock.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.54 llvm/lib/VMCore/BasicBlock.cpp:1.55 --- llvm/lib/VMCore/BasicBlock.cpp:1.54 Sat Jan 29 18:08:49 2005 +++ llvm/lib/VMCore/BasicBlock.cpp Wed Feb 23 01:09:08 2005 @@ -136,8 +136,10 @@ // called while the predecessor still refers to this block. // void BasicBlock::removePredecessor(BasicBlock *Pred) { - assert(find(pred_begin(this), pred_end(this), Pred) != pred_end(this) && + assert((getNumUses() > 16 ||// Reduce cost of this assertion for complex CFGs. + find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) && "removePredecessor: BB is not a predecessor!"); + if (InstList.empty()) return; PHINode *APN = dyn_cast(&front()); if (!APN) return; // Quick exit. From lattner at cs.uiuc.edu Wed Feb 23 10:51:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 10:51:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Value.h Message-ID: <200502231651.j1NGpFJb029959@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Value.h updated: 1.70 -> 1.71 --- Log message: Add new method. --- Diffs of the changes: (+7 -2) Value.h | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Value.h diff -u llvm/include/llvm/Value.h:1.70 llvm/include/llvm/Value.h:1.71 --- llvm/include/llvm/Value.h:1.70 Fri Feb 4 19:37:44 2005 +++ llvm/include/llvm/Value.h Wed Feb 23 10:50:59 2005 @@ -117,9 +117,14 @@ /// bool hasNUses(unsigned N) const; + /// hasNUsesOrMore - Return true if this value has N users or more. This is + /// logically equivalent to getNumUses() >= N. + /// + bool hasNUsesOrMore(unsigned N) const; + /// getNumUses - This method computes the number of uses of this Value. This - /// is a linear time operation. Use hasOneUse or hasNUses to check for - /// specific values. + /// is a linear time operation. Use hasOneUse, hasNUses, or hasMoreThanNUses + /// to check for specific values. unsigned getNumUses() const; /// addUse/killUse - These two methods should only be used by the Use class. From lattner at cs.uiuc.edu Wed Feb 23 10:51:24 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 10:51:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Value.cpp Message-ID: <200502231651.j1NGpOhp030698@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Value.cpp updated: 1.53 -> 1.54 --- Log message: new method --- Diffs of the changes: (+13 -0) Value.cpp | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/lib/VMCore/Value.cpp diff -u llvm/lib/VMCore/Value.cpp:1.53 llvm/lib/VMCore/Value.cpp:1.54 --- llvm/lib/VMCore/Value.cpp:1.53 Fri Feb 4 19:37:58 2005 +++ llvm/lib/VMCore/Value.cpp Wed Feb 23 10:51:11 2005 @@ -72,6 +72,19 @@ return UI == E; } +/// hasNUsesOrMore - Return true if this value has N users or more. This is +/// logically equivalent to getNumUses() >= N. +/// +bool Value::hasNUsesOrMore(unsigned N) const { + use_const_iterator UI = use_begin(), E = use_end(); + + for (; N; --N, ++UI) + if (UI == E) return false; // Too few. + + return true; +} + + /// getNumUses - This method computes the number of uses of this Value. This /// is a linear time operation. Use hasOneUse or hasNUses to check for specific /// values. From lattner at cs.uiuc.edu Wed Feb 23 10:53:11 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 10:53:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200502231653.j1NGrBuG004070@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.35 -> 1.36 --- Log message: make this more efficient. Scan up to 16 nodes, not the whole list. --- Diffs of the changes: (+1 -1) GlobalOpt.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.35 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.36 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.35 Thu Feb 10 12:36:30 2005 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Wed Feb 23 10:52:58 2005 @@ -377,7 +377,7 @@ else assert(0 && "Unknown aggregate sequential type!"); - if (NumElements > 16 && GV->getNumUses() > 16) + if (NumElements > 16 && GV->hasNUsesOrMore(16)) return 0; // It's not worth it. NewGlobals.reserve(NumElements); for (unsigned i = 0, e = NumElements; i != e; ++i) { From lattner at cs.uiuc.edu Wed Feb 23 10:53:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 10:53:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Message-ID: <200502231653.j1NGrHd3004162@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.55 -> 1.56 --- Log message: make this more efficient. Scan up to 16 nodes, not the whole list. --- Diffs of the changes: (+1 -1) BasicBlock.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.55 llvm/lib/VMCore/BasicBlock.cpp:1.56 --- llvm/lib/VMCore/BasicBlock.cpp:1.55 Wed Feb 23 01:09:08 2005 +++ llvm/lib/VMCore/BasicBlock.cpp Wed Feb 23 10:53:04 2005 @@ -136,7 +136,7 @@ // called while the predecessor still refers to this block. // void BasicBlock::removePredecessor(BasicBlock *Pred) { - assert((getNumUses() > 16 ||// Reduce cost of this assertion for complex CFGs. + assert((hasNUsesOrMore(16)||// Reduce cost of this assertion for complex CFGs. find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) && "removePredecessor: BB is not a predecessor!"); From lattner at cs.uiuc.edu Wed Feb 23 11:33:41 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 11:33:41 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-representation.c llvm-representation.h Message-ID: <200502231733.j1NHXfXX005527@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-representation.c updated: 1.16 -> 1.17 llvm-representation.h updated: 1.12 -> 1.13 --- Log message: add a new helper function. --- Diffs of the changes: (+11 -0) llvm-representation.c | 9 +++++++++ llvm-representation.h | 2 ++ 2 files changed, 11 insertions(+) Index: llvm-gcc/gcc/llvm-representation.c diff -u llvm-gcc/gcc/llvm-representation.c:1.16 llvm-gcc/gcc/llvm-representation.c:1.17 --- llvm-gcc/gcc/llvm-representation.c:1.16 Tue Nov 30 14:02:18 2004 +++ llvm-gcc/gcc/llvm-representation.c Wed Feb 23 11:33:28 2005 @@ -593,6 +593,15 @@ return New; } +llvm_instruction *create_select_inst(const char *Name, llvm_value *Cond, + llvm_value *TrueVal, llvm_value *FalseVal){ + llvm_instruction *New = llvm_instruction_new(TrueVal->Ty, Name, O_Select, 3); + New->Operands[0] = Cond; + New->Operands[1] = TrueVal; + New->Operands[2] = FalseVal; + return New; +} + llvm_instruction *create_uncond_branch(llvm_basicblock *Dest) { llvm_instruction *New = llvm_instruction_new(VoidTy, "", O_Br, 1); New->Operands[0] = D2V(Dest); Index: llvm-gcc/gcc/llvm-representation.h diff -u llvm-gcc/gcc/llvm-representation.h:1.12 llvm-gcc/gcc/llvm-representation.h:1.13 --- llvm-gcc/gcc/llvm-representation.h:1.12 Sun Nov 28 01:54:45 2004 +++ llvm-gcc/gcc/llvm-representation.h Wed Feb 23 11:33:28 2005 @@ -205,6 +205,8 @@ llvm_instruction *create_store_inst(llvm_value *Val, llvm_value *Ptr,int isVol); llvm_instruction *create_binary_inst(const char *Name, enum InstOpcode Opc, llvm_value *Op1, llvm_value *Op2); +llvm_instruction *create_select_inst(const char *Name, llvm_value *Cond, + llvm_value *TrueVal, llvm_value *FalseVal); llvm_instruction *create_uncond_branch(struct llvm_basicblock *Dest); /* create_cond_branch - Create a conditional branch on Val to the two blocks. From alenhar2 at cs.uiuc.edu Wed Feb 23 11:33:58 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 23 Feb 2005 11:33:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502231733.j1NHXwJd005958@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.55 -> 1.56 --- Log message: Ah the problems you have to fix when you stray from the One True Way (TM) --- Diffs of the changes: (+2 -2) AlphaISelPattern.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.55 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.56 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.55 Tue Feb 22 17:29:25 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Wed Feb 23 11:33:42 2005 @@ -724,8 +724,8 @@ case ISD::DYNAMIC_STACKALLOC: // Generate both result values. - if (Result != 1) - ExprMap[N.getValue(1)] = 1; // Generate the token + if (Result != notIn) + ExprMap[N.getValue(1)] = notIn; // Generate the token else Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); From lattner at cs.uiuc.edu Wed Feb 23 11:53:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 11:53:02 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200502231753.j1NHr2mT008119@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.86 -> 1.87 --- Log message: GCC seriously abuses COND_EXPR nodes (essentially ?: expressions) internally, building zillions of them for no apparent reason. Instead of always expanding these into control flow and letting the llvm optimizer put them back together into selects, do so explicitly when we are certain this is safe. For example, in this simple example: _Bool X; void test(int A, int B) { X |= A > B; } llvm-gcc used to spew: void %test(int %A, int %B) { entry: %A_addr = alloca int ; ty=int* %B_addr = alloca int ; ty=int* %mem_tmp.0 = alloca int ; ty=int* %mem_tmp.1 = alloca bool ; ty=bool* %mem_tmp.2 = alloca bool ; ty=bool* %mem_tmp.3 = alloca bool ; ty=bool* store int %A, int* %A_addr store int %B, int* %B_addr %tmp.0 = load bool* %X ; ty=bool %tmp.1 = cast bool %tmp.0 to int ; ty=int store int %tmp.1, int* %mem_tmp.0 %tmp.2 = load int* %A_addr ; ty=int %tmp.3 = load int* %B_addr ; ty=int %tmp.4 = setgt int %tmp.2, %tmp.3 ; ty=bool %tmp.5 = cast bool %tmp.4 to int ; ty=int br bool %tmp.4, label %cond_true.0, label %cond_false.0 cond_true.0: %se_val.0 = load int* %mem_tmp.0 ; ty=int %tmp.6 = or int %se_val.0, 1 ; ty=int %tmp.7 = setne int %tmp.6, 0 ; ty=bool %tmp.8 = cast bool %tmp.7 to int ; ty=int br bool %tmp.7, label %cond_true.1, label %cond_false.1 cond_true.1: store bool true, bool* %mem_tmp.2 br label %cond_continue.1 cond_false.1: store bool false, bool* %mem_tmp.2 br label %cond_continue.1 cond_continue.1: %tmp.9 = load bool* %mem_tmp.2 ; ty=bool store bool %tmp.9, bool* %mem_tmp.1 br label %cond_continue.0 cond_false.0: %se_val.1 = load int* %mem_tmp.0 ; ty=int %tmp.10 = setne int %se_val.1, 0 ; ty=bool %tmp.11 = cast bool %tmp.10 to int ; ty=int br bool %tmp.10, label %cond_true.2, label %cond_false.2 cond_true.2: store bool true, bool* %mem_tmp.3 br label %cond_continue.2 cond_false.2: store bool false, bool* %mem_tmp.3 br label %cond_continue.2 cond_continue.2: %tmp.12 = load bool* %mem_tmp.3 ; ty=bool store bool %tmp.12, bool* %mem_tmp.1 br label %cond_continue.0 cond_continue.0: %tmp.13 = load bool* %mem_tmp.1 ; ty=bool store bool %tmp.13, bool* %X br label %return return: ret void } Now it spews: void %test(int %A, int %B) { entry: %A_addr = alloca int ; ty=int* %B_addr = alloca int ; ty=int* %mem_tmp.0 = alloca int ; ty=int* %mem_tmp.1 = alloca bool ; ty=bool* store int %A, int* %A_addr store int %B, int* %B_addr %tmp.0 = load bool* %X ; ty=bool %tmp.1 = cast bool %tmp.0 to int ; ty=int store int %tmp.1, int* %mem_tmp.0 %tmp.2 = load int* %A_addr ; ty=int %tmp.3 = load int* %B_addr ; ty=int %tmp.4 = setgt int %tmp.2, %tmp.3 ; ty=bool %tmp.5 = cast bool %tmp.4 to int ; ty=int br bool %tmp.4, label %cond_true, label %cond_false cond_true: %se_val.0 = load int* %mem_tmp.0 ; ty=int %tmp.6 = or int %se_val.0, 1 ; ty=int %tmp.7 = setne int %tmp.6, 0 ; ty=bool %tmp.8 = cast bool %tmp.7 to int ; ty=int %tmp.9 = select bool %tmp.7, bool true, bool false ; ty=bool store bool %tmp.9, bool* %mem_tmp.1 br label %cond_continue cond_false: %se_val.1 = load int* %mem_tmp.0 ; ty=int %tmp.10 = setne int %se_val.1, 0 ; ty=bool %tmp.11 = cast bool %tmp.10 to int ; ty=int %tmp.12 = select bool %tmp.10, bool true, bool false ; ty=bool store bool %tmp.12, bool* %mem_tmp.1 br label %cond_continue cond_continue: %tmp.13 = load bool* %mem_tmp.1 ; ty=bool store bool %tmp.13, bool* %X br label %return return: ret void } Note the two select instructions generated, which eliminates two mem_tmp allocas and some basic blocks among other things. Also note that the two selects are trivially turnable into casts by the llvm optimizer. gccas reduces this to: void %test(int %A, int %B) { %tmp.0 = load bool* %X ; [#uses=1] %tmp.4 = setgt int %A, %B ; [#uses=1] %mem_tmp.1.0 = or bool %tmp.4, %tmp.0 ; [#uses=1] store bool %mem_tmp.1.0, bool* %X ret void } --- Diffs of the changes: (+56 -12) llvm-expand.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 56 insertions(+), 12 deletions(-) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.86 llvm-gcc/gcc/llvm-expand.c:1.87 --- llvm-gcc/gcc/llvm-expand.c:1.86 Sun Feb 20 22:04:14 2005 +++ llvm-gcc/gcc/llvm-expand.c Wed Feb 23 11:52:46 2005 @@ -4288,7 +4288,6 @@ llvm_value *op0, llvm_value *op1){ enum InstOpcode Opcode; llvm_value *Compare; - llvm_instruction *Select; const char *Name; assert(op0->Ty == op1->Ty && "Operands must have same type!"); @@ -4306,11 +4305,7 @@ if (TREE_CODE(exp) == ABS_EXPR) op1 = append_inst(Fn, create_binary_inst("abs.pos", O_Sub, op1, op0)); - Select = llvm_instruction_new(op0->Ty, Name, O_Select, 3); - Select->Operands[0] = Compare; - Select->Operands[1] = op0; - Select->Operands[2] = op1; - return append_inst(Fn, Select); + return append_inst(Fn, create_select_inst(Name, Compare, op0, op1)); } static llvm_function *CreateIntrinsicFnWithType(const char *Name, @@ -5905,6 +5900,28 @@ InitializeComplex(Fn, DestLoc, ResultR, ResultI, 0); } +/* isSimpleEnoughToEvaluateUnconditionally - Return true if this expression is + * simple enough to evaluate unconditionally in a case where it would normally + * be only conditionally executed. + */ +static int isSimpleEnoughToEvaluateUnconditionally(tree exp) { + switch (TREE_CODE(exp)) { + default: return 0; + case REAL_CST: + case INTEGER_CST: return 1; + case NOP_EXPR: + return isSimpleEnoughToEvaluateUnconditionally(TREE_OPERAND(exp, 0)); + case VAR_DECL: + case PARM_DECL: + /* Allow variables that will probably be promoted to ssa registers. */ + + /* Must be defined in this function. */ + if (!DECL_CONTEXT(exp) || TREE_CODE(DECL_CONTEXT(exp)) != FUNCTION_DECL) + return false; + /* Must not be static, must not have its address taken. */ + return !TREE_STATIC(exp) && !TREE_ADDRESSABLE(exp) && !DECL_EXTERNAL(exp); + } +} /* llvm_expand_expr: generate code for computing expression EXP. If the * expression produces a scalar value (which can be held in an LLVM register), @@ -6538,19 +6555,46 @@ } case COND_EXPR: { /* ?: expression */ /* Allocate a new temporary to hold the result of the expression */ - llvm_basicblock *TrueBlock = llvm_basicblock_new("cond_true"); - llvm_basicblock *FalseBlock = llvm_basicblock_new("cond_false"); - llvm_basicblock *ContinueBlock = llvm_basicblock_new("cond_continue"); + llvm_basicblock *TrueBlock; + llvm_basicblock *FalseBlock; + llvm_basicblock *ContinueBlock; - /* Expand condition and branch */ + /* Expand condition */ llvm_value *Cond = llvm_expand_expr(Fn, TREE_OPERAND(exp, 0), 0); + Cond = cast_if_type_not_equal(Fn, Cond, BoolTy); + + /* If we can prove that the two operands to this conditional are very simple + * (aka, safe and profitable to evaluate unconditionally), emit a select + * instruction instead of a conditional branch sequence. + */ + if (!DestLoc) { /* Only handle scalars */ + if (isSimpleEnoughToEvaluateUnconditionally(TREE_OPERAND(exp, 1)) && + isSimpleEnoughToEvaluateUnconditionally(TREE_OPERAND(exp, 2))) { + /* Okay, this is simple enough, expand the LHS and RHS unconditionally. + */ + llvm_value *LHS = llvm_expand_expr(Fn, TREE_OPERAND(exp, 1), 0); + llvm_value *RHS = llvm_expand_expr(Fn, TREE_OPERAND(exp, 2), 0); + LHS = cast_if_type_not_equal(Fn, LHS, DestTy); + RHS = cast_if_type_not_equal(Fn, RHS, DestTy); + return append_inst(Fn, create_select_inst("tmp", Cond, LHS, RHS)); + } + } + + /* If this is a complicated ?: expression, expand this as a conditional + * branch with the values evalutated in the arms of the conditionals. + */ + + TrueBlock = llvm_basicblock_new("cond_true"); + FalseBlock = llvm_basicblock_new("cond_false"); + ContinueBlock = llvm_basicblock_new("cond_continue"); + append_inst(Fn, create_cond_branch(Cond, TrueBlock, FalseBlock)); + if (DestLoc) { /* This is an aggregate ?: expression */ Result = DestLoc; } else { Result = DestTy != VoidTy ? D2V(make_temporary_alloca(Fn, DestTy)) : 0; } - Cond = cast_if_type_not_equal(Fn, Cond, BoolTy); - append_inst(Fn, create_cond_branch(Cond, TrueBlock, FalseBlock)); + /* Add the true block as the fall through */ llvm_emit_label(Fn, TrueBlock); From lattner at cs.uiuc.edu Wed Feb 23 20:14:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 20:14:05 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll Message-ID: <200502240214.j1O2E53E010793@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: switch_create.ll updated: 1.1 -> 1.2 --- Log message: add another testcase to make sure it gets turned into a switch (answer: yes it does) --- Diffs of the changes: (+15 -0) switch_create.ll | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll diff -u llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll:1.1 llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll:1.2 --- llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll:1.1 Mon Feb 23 23:34:44 2004 +++ llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll Wed Feb 23 20:13:50 2005 @@ -31,3 +31,18 @@ } +void %test3(int %V) { + %C1 = seteq int %V, 4 + br bool %C1, label %T, label %N +N: + %C2 = seteq int %V, 17 + br bool %C2, label %T, label %F +T: + call void %foo1() + ret void +F: + call void %foo2() + ret void +} + + From tbrethou at cs.uiuc.edu Wed Feb 23 20:14:55 2005 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Wed, 23 Feb 2005 20:14:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp Message-ID: <200502240214.j1O2Etcr010808@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9TargetMachine.cpp updated: 1.133 -> 1.134 --- Log message: Only print out machine instructions before modulo scheduling if we are actually doing modulo scheduling! :) --- Diffs of the changes: (+1 -1) SparcV9TargetMachine.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp diff -u llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.133 llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.134 --- llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.133 Thu Feb 10 11:02:06 2005 +++ llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp Wed Feb 23 20:14:44 2005 @@ -195,7 +195,7 @@ if (!DisableSched) PM.add(createInstructionSchedulingWithSSAPass(*this)); - if(PrintMachineCode) + if(PrintMachineCode && EnableModSched) PM.add(createMachineFunctionPrinterPass(&std::cerr, "Before modulo scheduling:\n")); //Use ModuloScheduling if enabled, otherwise use local scheduling if not disabled. From lattner at cs.uiuc.edu Wed Feb 23 20:37:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 20:37:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/BasicBlock.h Message-ID: <200502240237.j1O2bVib012448@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: BasicBlock.h updated: 1.47 -> 1.48 --- Log message: add a new method. --- Diffs of the changes: (+6 -1) BasicBlock.h | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.47 llvm/include/llvm/BasicBlock.h:1.48 --- llvm/include/llvm/BasicBlock.h:1.47 Sat Jan 29 18:08:26 2005 +++ llvm/include/llvm/BasicBlock.h Wed Feb 23 20:37:17 2005 @@ -107,7 +107,12 @@ /// void eraseFromParent(); - + /// getSinglePredecessor - If this basic block has a single predecessor block, + /// return the block, otherwise return a null pointer. + BasicBlock *getSinglePredecessor(); + const BasicBlock *getSinglePredecessor() const { + return const_cast(this)->getSinglePredecessor(); + } //===--------------------------------------------------------------------===// /// Instruction iterator methods From lattner at cs.uiuc.edu Wed Feb 23 20:37:40 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 20:37:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Message-ID: <200502240237.j1O2beBF012471@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.56 -> 1.57 --- Log message: add a new method. --- Diffs of the changes: (+10 -0) BasicBlock.cpp | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.56 llvm/lib/VMCore/BasicBlock.cpp:1.57 --- llvm/lib/VMCore/BasicBlock.cpp:1.56 Wed Feb 23 10:53:04 2005 +++ llvm/lib/VMCore/BasicBlock.cpp Wed Feb 23 20:37:26 2005 @@ -129,6 +129,16 @@ I->dropAllReferences(); } +/// getSinglePredecessor - If this basic block has a single predecessor block, +/// return the block, otherwise return a null pointer. +BasicBlock *BasicBlock::getSinglePredecessor() { + pred_iterator PI = pred_begin(this), E = pred_end(this); + if (PI == E) return 0; // No preds. + BasicBlock *ThePred = *PI; + ++PI; + return (PI == E) ? ThePred : 0 /*multiple preds*/; +} + // removePredecessor - This method is used to notify a BasicBlock that the // specified Predecessor of the block is no longer able to reach it. This is // actually not used to update the Predecessor list, but is actually used to From reid at x10sys.com Wed Feb 23 21:56:43 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 23 Feb 2005 21:56:43 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.config.in Makefile.rules Message-ID: <200502240356.VAA07765@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.config.in updated: 1.49 -> 1.50 Makefile.rules updated: 1.300 -> 1.301 --- Log message: For PR528: http://llvm.cs.uiuc.edu/PR528 : * Consolidate all "install" usage to the install program/script found by autoconf which includes the autoconf/install-sh script if necessary * Change Makefile.rules to not use the -D flag to install but use the MKDIR command as necessary. * Change Makefile.rules to differentiate between installation of executable files and regular data files to get the permission modes correct. --- Diffs of the changes: (+16 -15) Makefile.config.in | 4 ---- Makefile.rules | 27 ++++++++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.49 llvm/Makefile.config.in:1.50 --- llvm/Makefile.config.in:1.49 Wed Feb 16 10:21:00 2005 +++ llvm/Makefile.config.in Wed Feb 23 21:56:32 2005 @@ -128,10 +128,6 @@ FLEX := @LEX@ GREP := @GREP@ INSTALL := @INSTALL@ -INSTALL_SH := $(LLVM_SRC_ROOT)/autoconf/install-sh -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_DATA = @INSTALL_DATA@ MKDIR := $(LLVM_SRC_ROOT)/autoconf/mkinstalldirs MV := @MV@ RANLIB := @RANLIB@ Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.300 llvm/Makefile.rules:1.301 --- llvm/Makefile.rules:1.300 Wed Feb 16 10:17:11 2005 +++ llvm/Makefile.rules Wed Feb 23 21:56:32 2005 @@ -305,7 +305,6 @@ C.Flags += -v CXX.Flags += -v LD.Flags += -v - Install.Flags += -v VERBOSE := 1 endif @@ -363,7 +362,8 @@ $(CompileCommonOpts) LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \ $(Install.Flags) -Install = $(INSTALL) $(Install.Flags) +ProgInstall = $(INSTALL) $(Install.Flags) -m 0755 +DataInstall = $(INSTALL) $(Install.Flags) -m 0644 Burg = $(BURG) -I $(PROJ_SRC_DIR) TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR) Archive = $(AR) $(AR.Flags) @@ -530,9 +530,9 @@ $(Echo) Installing Configuration Files To $(PROJ_etcdir) $(Verb)for file in $(CONFIG_FILES); do \ if test -f $(PROJ_OBJ_DIR)/$${file} ; then \ - $(Install) -m 0644 $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \ + $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \ elif test -f $(PROJ_SRC_DIR)/$${file} ; then \ - $(Install) -m 0644 $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \ + $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \ else \ $(ECHO) Error: cannot find config file $${file}. ; \ fi \ @@ -594,7 +594,7 @@ $(DestModule): $(ModuleDestDir) $(Module) $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule) - $(Verb) $(Install) -D $(Module) $@ + $(Verb) $(ProgInstall) $(Module) $(DestModule) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule) @@ -708,7 +708,7 @@ $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA) $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib) - $(Verb) $(Install) -D $(LibName.BCA) $@ + $(Verb) $(ProgInstall) $(LibName.BCA) $(DestBytecodeLib) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib) @@ -902,7 +902,7 @@ $(DestTool): $(PROJ_bindir) $(ToolBuildPath) $(Echo) Installing $(BuildMode) $(DestTool) - $(Verb) $(Install) -D $(ToolBuildPath) $(DestTool) + $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool) uninstall-local:: $(Echo) Uninstalling $(BuildMode) $(DestTool) @@ -1465,17 +1465,22 @@ install-local:: $(Echo) Installing include files $(Verb) $(MKDIR) $(PROJ_includedir) - $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \ + $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \ cd $(PROJ_SRC_ROOT)/include && \ for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \ -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \ - $(Install) -D -m 0644 $$hdr $(PROJ_includedir)/$$hdr ; \ + instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \ + if test \! -d "$$instdir" ; then \ + $(EchoCmd) Making install directory $$instdir ; \ + $(MKDIR) $$instdir ;\ + fi ; \ + $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \ done ; \ fi - $(Verb) if [ -d "$(PROJ_OBJ_ROOT)/include" ] ; then \ + $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \ cd $(PROJ_OBJ_ROOT)/include && \ for hdr in `find . -type f -print` ; do \ - $(Install) -D -m 0644 $$hdr $(PROJ_includedir)/$$hdr ; \ + $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \ done ; \ fi From criswell at cs.uiuc.edu Wed Feb 23 22:10:55 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 23 Feb 2005 22:10:55 -0600 Subject: [llvm-commits] CVS: llvm-www/releases/register.cgi Message-ID: <200502240410.WAA08174@zion.cs.uiuc.edu> Changes in directory llvm-www/releases: register.cgi updated: 1.13 -> 1.14 --- Log message: Add some debugging. It seems broken to everybody, so might as well. --- Diffs of the changes: (+7 -2) register.cgi | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm-www/releases/register.cgi diff -u llvm-www/releases/register.cgi:1.13 llvm-www/releases/register.cgi:1.14 --- llvm-www/releases/register.cgi:1.13 Thu Dec 18 15:26:59 2003 +++ llvm-www/releases/register.cgi Wed Feb 23 22:10:44 2005 @@ -246,17 +246,19 @@ return -#print ('Content-type: text/plain\n\n') -#print ('') +print ('Content-type: text/plain\n\n') +print ('') # # Parse the CGI input # +print ('Parsing CGI form') form = cgi.FieldStorage () # # Verify that everything in the form is correct. # +print ('Validating form') error = ValidateForm (form) if (error == 'registered'): print ('Location: /releases/download.html') @@ -275,17 +277,20 @@ # # Log the information provided by the form. # +print ('Logging form') LogForm (form) # # Subscribe the user the LLVM Announcements list (if they so desire) # +print ('Subscribing form') Subscribe (form) # # Send the user to the download page. # +print ('Finalize form') print ('Location: /releases/download.html') print ('') From lattner at cs.uiuc.edu Wed Feb 23 23:00:06 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 23:00:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200502240500.j1O506cJ025562@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.212 -> 1.213 --- Log message: Do not read free'd memory when printing an error message. --- Diffs of the changes: (+1 -1) llvmAsmParser.y | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.212 llvm/lib/AsmParser/llvmAsmParser.y:1.213 --- llvm/lib/AsmParser/llvmAsmParser.y:1.212 Tue Feb 22 17:13:58 2005 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Feb 23 22:59:49 2005 @@ -156,7 +156,7 @@ // Any forward referenced blocks left? if (!BBForwardRefs.empty()) ThrowException("Undefined reference to label " + - BBForwardRefs.begin()->second.first.getName()); + BBForwardRefs.begin()->first->getName()); // Resolve all forward references now. ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); From lattner at cs.uiuc.edu Wed Feb 23 23:25:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 23:25:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200502240525.j1O5PUel027621@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.213 -> 1.214 --- Log message: add more checking --- Diffs of the changes: (+6 -2) llvmAsmParser.y | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.213 llvm/lib/AsmParser/llvmAsmParser.y:1.214 --- llvm/lib/AsmParser/llvmAsmParser.y:1.213 Wed Feb 23 22:59:49 2005 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Feb 23 23:25:17 2005 @@ -1815,8 +1815,12 @@ std::vector >::iterator I = $8->begin(), E = $8->end(); - for (; I != E; ++I) - S->addCase(I->first, I->second); + for (; I != E; ++I) { + if (ConstantInt *CI = dyn_cast(I->first)) + S->addCase(CI, I->second); + else + ThrowException("Switch case is constant, but not a simple integer!"); + } delete $8; } | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' { From lattner at cs.uiuc.edu Wed Feb 23 23:26:18 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 23:26:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200502240526.j1O5QImE028293@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.153 -> 1.154 --- Log message: use more specific cast. --- Diffs of the changes: (+1 -1) Reader.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.153 llvm/lib/Bytecode/Reader/Reader.cpp:1.154 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.153 Sun Feb 13 11:48:18 2005 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Feb 23 23:26:04 2005 @@ -711,7 +711,7 @@ getBasicBlock(Oprnds[1]), Oprnds.size()/2-1); for (unsigned i = 2, e = Oprnds.size(); i != e; i += 2) - I->addCase(cast(getValue(iType, Oprnds[i])), + I->addCase(cast(getValue(iType, Oprnds[i])), getBasicBlock(Oprnds[i+1])); Result = I; break; From lattner at cs.uiuc.edu Wed Feb 23 23:32:13 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 23:32:13 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Message-ID: <200502240532.j1O5WDc2002309@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h updated: 1.13 -> 1.14 --- Log message: switch instructions only allow constantints for their values, be more specific. --- Diffs of the changes: (+8 -7) Instructions.h | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.13 llvm/include/llvm/Instructions.h:1.14 --- llvm/include/llvm/Instructions.h:1.13 Fri Feb 4 19:44:18 2005 +++ llvm/include/llvm/Instructions.h Wed Feb 23 23:31:57 2005 @@ -22,6 +22,7 @@ namespace llvm { class BasicBlock; +class ConstantInt; class PointerType; //===----------------------------------------------------------------------===// @@ -1084,14 +1085,14 @@ /// getCaseValue - Return the specified case value. Note that case #0, the /// default destination, does not have a case value. - Constant *getCaseValue(unsigned i) { + ConstantInt *getCaseValue(unsigned i) { assert(i && i < getNumCases() && "Illegal case value to get!"); return getSuccessorValue(i); } /// getCaseValue - Return the specified case value. Note that case #0, the /// default destination, does not have a case value. - const Constant *getCaseValue(unsigned i) const { + const ConstantInt *getCaseValue(unsigned i) const { assert(i && i < getNumCases() && "Illegal case value to get!"); return getSuccessorValue(i); } @@ -1099,7 +1100,7 @@ /// findCaseValue - Search all of the case values for the specified constant. /// If it is explicitly handled, return the case number of it, otherwise /// return 0 to indicate that it is handled by the default handler. - unsigned findCaseValue(const Constant *C) const { + unsigned findCaseValue(const ConstantInt *C) const { for (unsigned i = 1, e = getNumCases(); i != e; ++i) if (getCaseValue(i) == C) return i; @@ -1108,7 +1109,7 @@ /// addCase - Add an entry to the switch instruction... /// - void addCase(Constant *OnVal, BasicBlock *Dest); + void addCase(ConstantInt *OnVal, BasicBlock *Dest); /// removeCase - This method removes the specified successor from the switch /// instruction. Note that this cannot be used to remove the default @@ -1130,15 +1131,15 @@ // getSuccessorValue - Return the value associated with the specified // successor. - inline Constant *getSuccessorValue(unsigned idx) const { + inline ConstantInt *getSuccessorValue(unsigned idx) const { assert(idx < getNumSuccessors() && "Successor # out of range!"); - return cast(getOperand(idx*2)); + return (ConstantInt*)getOperand(idx*2); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SwitchInst *) { return true; } static inline bool classof(const Instruction *I) { - return (I->getOpcode() == Instruction::Switch); + return I->getOpcode() == Instruction::Switch; } static inline bool classof(const Value *V) { return isa(V) && classof(cast(V)); From lattner at cs.uiuc.edu Wed Feb 23 23:32:22 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 23 Feb 2005 23:32:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp Message-ID: <200502240532.j1O5WMbD002319@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.11 -> 1.12 --- Log message: switch instructions only allow constantints for their values, be more specific. --- Diffs of the changes: (+1 -1) Instructions.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.11 llvm/lib/VMCore/Instructions.cpp:1.12 --- llvm/lib/VMCore/Instructions.cpp:1.11 Fri Feb 4 19:38:38 2005 +++ llvm/lib/VMCore/Instructions.cpp Wed Feb 23 23:32:09 2005 @@ -948,7 +948,7 @@ /// addCase - Add an entry to the switch instruction... /// -void SwitchInst::addCase(Constant *OnVal, BasicBlock *Dest) { +void SwitchInst::addCase(ConstantInt *OnVal, BasicBlock *Dest) { unsigned OpNo = NumOperands; if (OpNo+2 > ReservedSpace) resizeOperands(0); // Get more space! From criswell at cs.uiuc.edu Wed Feb 23 23:46:38 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 23 Feb 2005 23:46:38 -0600 Subject: [llvm-commits] CVS: llvm-www/releases/register.cgi Message-ID: <200502240546.XAA10361@zion.cs.uiuc.edu> Changes in directory llvm-www/releases: register.cgi updated: 1.14 -> 1.15 --- Log message: Try using tank as the SMTP mailer. --- Diffs of the changes: (+1 -1) register.cgi | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/releases/register.cgi diff -u llvm-www/releases/register.cgi:1.14 llvm-www/releases/register.cgi:1.15 --- llvm-www/releases/register.cgi:1.14 Wed Feb 23 22:10:44 2005 +++ llvm-www/releases/register.cgi Wed Feb 23 23:46:27 2005 @@ -222,7 +222,7 @@ # # Send email to notify that someone has downloaded LLVM yet again! # - mailer = smtplib.SMTP ('localhost') + mailer = smtplib.SMTP ('tank.cs.uiuc.edu') for receiver in notifylist: header = 'From: ' + email + '\r\nTo: ' + receiver + '\r\n' try: From criswell at cs.uiuc.edu Wed Feb 23 23:50:04 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 23 Feb 2005 23:50:04 -0600 Subject: [llvm-commits] CVS: llvm-www/releases/register.cgi Message-ID: <200502240550.XAA10425@zion.cs.uiuc.edu> Changes in directory llvm-www/releases: register.cgi updated: 1.15 -> 1.16 --- Log message: Remove debugging cruft. --- Diffs of the changes: (+0 -8) register.cgi | 8 -------- 1 files changed, 8 deletions(-) Index: llvm-www/releases/register.cgi diff -u llvm-www/releases/register.cgi:1.15 llvm-www/releases/register.cgi:1.16 --- llvm-www/releases/register.cgi:1.15 Wed Feb 23 23:46:27 2005 +++ llvm-www/releases/register.cgi Wed Feb 23 23:49:53 2005 @@ -246,19 +246,14 @@ return -print ('Content-type: text/plain\n\n') -print ('') - # # Parse the CGI input # -print ('Parsing CGI form') form = cgi.FieldStorage () # # Verify that everything in the form is correct. # -print ('Validating form') error = ValidateForm (form) if (error == 'registered'): print ('Location: /releases/download.html') @@ -277,20 +272,17 @@ # # Log the information provided by the form. # -print ('Logging form') LogForm (form) # # Subscribe the user the LLVM Announcements list (if they so desire) # -print ('Subscribing form') Subscribe (form) # # Send the user to the download page. # -print ('Finalize form') print ('Location: /releases/download.html') print ('') From lattner at cs.uiuc.edu Thu Feb 24 00:15:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 00:15:43 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/switch_thread.ll Message-ID: <200502240615.j1O6Fh9g007581@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: switch_thread.ll added (r1.1) --- Log message: new testcase for a simple optimization that simplifycfg is about to do. All CFG edges to DEAD should be eliminated. --- Diffs of the changes: (+78 -0) switch_thread.ll | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+) Index: llvm/test/Regression/Transforms/SimplifyCFG/switch_thread.ll diff -c /dev/null llvm/test/Regression/Transforms/SimplifyCFG/switch_thread.ll:1.1 *** /dev/null Thu Feb 24 00:15:37 2005 --- llvm/test/Regression/Transforms/SimplifyCFG/switch_thread.ll Thu Feb 24 00:15:27 2005 *************** *** 0 **** --- 1,78 ---- + ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep 'call void %DEAD' + + ; Test that we can thread a simple known condition through switch statements. + + declare void %foo1() + declare void %foo2() + declare void %DEAD() + + void %test1(uint %V) { + switch uint %V, label %A [ + uint 4, label %T + uint 17, label %Done + uint 1234, label %A + ] + + T: ;; V == 4 if we get here. + call void %foo1() + ;; This switch is always statically determined. + switch uint %V, label %A2 [ + uint 4, label %B + uint 17, label %C + uint 42, label %C + ] + A2: + call void %DEAD() + call void %DEAD() + %cond2 = seteq uint %V, 4 ;; always false + br bool %cond2, label %Done, label %C + + A: + call void %foo1() + %cond = setne uint %V, 4 ;; always true + br bool %cond, label %Done, label %C + + + Done: + ret void + + B: + call void %foo2() + %cond3 = seteq uint %V, 4 ;; always true + br bool %cond3, label %Done, label %C + C: + call void %DEAD() + ret void + } + + void %test2(uint %V) { + switch uint %V, label %A [ + uint 4, label %T + uint 17, label %D + uint 1234, label %E + ] + + A: ;; V != 4, 17, 1234 here. + call void %foo1() + ;; This switch is always statically determined. + switch uint %V, label %E [ + uint 4, label %C + uint 17, label %C + uint 42, label %D + ] + C: + call void %DEAD() ;; unreacahble. + ret void + T: + call void %foo1() + call void %foo1() + ret void + + D: + call void %foo1() + ret void + + E: + ret void + } + From lattner at cs.uiuc.edu Thu Feb 24 00:18:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 00:18:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200502240618.j1O6I5hi007598@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.63 -> 1.64 --- Log message: Implement Transforms/SimplifyCFG/switch_thread.ll This does a simple form of "jump threading", which eliminates CFG edges that are provably dead. This triggers 90 times in the external tests, and eliminating CFG edges is always always a good thing! :) --- Diffs of the changes: (+190 -4) SimplifyCFG.cpp | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 190 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.63 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.64 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.63 Fri Jan 28 18:38:26 2005 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Thu Feb 24 00:17:52 2005 @@ -420,6 +420,175 @@ } +// EliminateBlockCases - Given an vector of bb/value pairs, remove any entries +// in the list that match the specified block. +static void EliminateBlockCases(BasicBlock *BB, + std::vector > &Cases) { + for (unsigned i = 0, e = Cases.size(); i != e; ++i) + if (Cases[i].second == BB) { + Cases.erase(Cases.begin()+i); + --i; --e; + } +} + +// ValuesOverlap - Return true if there are any keys in C1 that exist in C2 as +// well. +static bool +ValuesOverlap(std::vector > &C1, + std::vector > &C2) { + std::vector > *V1 = &C1, *V2 = &C2; + + // Make V1 be smaller than V2. + if (V1->size() > V2->size()) + std::swap(V1, V2); + + if (V1->size() == 0) return false; + if (V1->size() == 1) { + // Just scan V2. + ConstantInt *TheVal = (*V1)[0].first; + for (unsigned i = 0, e = V2->size(); i != e; ++i) + if (TheVal == (*V2)[i].first) + return true; + } + + // Otherwise, just sort both lists and compare element by element. + std::sort(V1->begin(), V1->end()); + std::sort(V2->begin(), V2->end()); + unsigned i1 = 0, i2 = 0, e1 = V1->size(), e2 = V2->size(); + while (i1 != e1 && i2 != e2) { + if ((*V1)[i1].first == (*V2)[i2].first) + return true; + if ((*V1)[i1].first < (*V2)[i2].first) + ++i1; + else + ++i2; + } + return false; +} + +// SimplifyEqualityComparisonWithOnlyPredecessor - If TI is known to be a +// terminator instruction and its block is known to only have a single +// predecessor block, check to see if that predecessor is also a value +// comparison with the same value, and if that comparison determines the outcome +// of this comparison. If so, simplify TI. This does a very limited form of +// jump threading. +static bool SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI, + BasicBlock *Pred) { + Value *PredVal = isValueEqualityComparison(Pred->getTerminator()); + if (!PredVal) return false; // Not a value comparison in predecessor. + + Value *ThisVal = isValueEqualityComparison(TI); + assert(ThisVal && "This isn't a value comparison!!"); + if (ThisVal != PredVal) return false; // Different predicates. + + // Find out information about when control will move from Pred to TI's block. + std::vector > PredCases; + BasicBlock *PredDef = GetValueEqualityComparisonCases(Pred->getTerminator(), + PredCases); + EliminateBlockCases(PredDef, PredCases); // Remove default from cases. + + // Find information about how control leaves this block. + std::vector > ThisCases; + BasicBlock *ThisDef = GetValueEqualityComparisonCases(TI, ThisCases); + EliminateBlockCases(ThisDef, ThisCases); // Remove default from cases. + + // If TI's block is the default block from Pred's comparison, potentially + // simplify TI based on this knowledge. + if (PredDef == TI->getParent()) { + // If we are here, we know that the value is none of those cases listed in + // PredCases. If there are any cases in ThisCases that are in PredCases, we + // can simplify TI. + if (ValuesOverlap(PredCases, ThisCases)) { + if (BranchInst *BTI = dyn_cast(TI)) { + // Okay, one of the successors of this condbr is dead. Convert it to a + // uncond br. + assert(ThisCases.size() == 1 && "Branch can only have one case!"); + Value *Cond = BTI->getCondition(); + // Insert the new branch. + Instruction *NI = new BranchInst(ThisDef, TI); + + // Remove PHI node entries for the dead edge. + ThisCases[0].second->removePredecessor(TI->getParent()); + + DEBUG(std::cerr << "Threading pred instr: " << *Pred->getTerminator() + << "Through successor TI: " << *TI << "Leaving: " << *NI << "\n"); + + TI->eraseFromParent(); // Nuke the old one. + // If condition is now dead, nuke it. + if (Instruction *CondI = dyn_cast(Cond)) + ErasePossiblyDeadInstructionTree(CondI); + return true; + + } else { + SwitchInst *SI = cast(TI); + // Okay, TI has cases that are statically dead, prune them away. + std::set DeadCases; + for (unsigned i = 0, e = PredCases.size(); i != e; ++i) + DeadCases.insert(PredCases[i].first); + + DEBUG(std::cerr << "Threading pred instr: " << *Pred->getTerminator() + << "Through successor TI: " << *TI); + + for (unsigned i = SI->getNumCases()-1; i != 0; --i) + if (DeadCases.count(SI->getCaseValue(i))) { + SI->getSuccessor(i)->removePredecessor(TI->getParent()); + SI->removeCase(i); + } + + DEBUG(std::cerr << "Leaving: " << *TI << "\n"); + return true; + } + } + + } else { + // Otherwise, TI's block must correspond to some matched value. Find out + // which value (or set of values) this is. + ConstantInt *TIV = 0; + BasicBlock *TIBB = TI->getParent(); + for (unsigned i = 0, e = PredCases.size(); i != e; ++i) + if (PredCases[i].second == TIBB) + if (TIV == 0) + TIV = PredCases[i].first; + else + return false; // Cannot handle multiple values coming to this block. + assert(TIV && "No edge from pred to succ?"); + + // Okay, we found the one constant that our value can be if we get into TI's + // BB. Find out which successor will unconditionally be branched to. + BasicBlock *TheRealDest = 0; + for (unsigned i = 0, e = ThisCases.size(); i != e; ++i) + if (ThisCases[i].first == TIV) { + TheRealDest = ThisCases[i].second; + break; + } + + // If not handled by any explicit cases, it is handled by the default case. + if (TheRealDest == 0) TheRealDest = ThisDef; + + // Remove PHI node entries for dead edges. + BasicBlock *CheckEdge = TheRealDest; + for (succ_iterator SI = succ_begin(TIBB), e = succ_end(TIBB); SI != e; ++SI) + if (*SI != CheckEdge) + (*SI)->removePredecessor(TIBB); + else + CheckEdge = 0; + + // Insert the new branch. + Instruction *NI = new BranchInst(TheRealDest, TI); + + DEBUG(std::cerr << "Threading pred instr: " << *Pred->getTerminator() + << "Through successor TI: " << *TI << "Leaving: " << *NI << "\n"); + Instruction *Cond = 0; + if (BranchInst *BI = dyn_cast(TI)) + Cond = dyn_cast(BI->getCondition()); + TI->eraseFromParent(); // Nuke the old one. + + if (Cond) ErasePossiblyDeadInstructionTree(Cond); + return true; + } + return false; +} + // FoldValueComparisonIntoPredecessors - The specified terminator is a value // equality comparison instruction (either a switch or a branch on "X == c"). // See if any of the predecessors of the terminator block are value comparisons @@ -908,13 +1077,30 @@ return true; } - } else if (SwitchInst *SI = dyn_cast(BB->begin())) { - if (isValueEqualityComparison(SI)) - if (FoldValueComparisonIntoPredecessors(SI)) - return SimplifyCFG(BB) || 1; + } else if (SwitchInst *SI = dyn_cast(BB->getTerminator())) { + if (isValueEqualityComparison(SI)) { + // If we only have one predecessor, and if it is a branch on this value, + // see if that predecessor totally determines the outcome of this switch. + if (BasicBlock *OnlyPred = BB->getSinglePredecessor()) + if (SimplifyEqualityComparisonWithOnlyPredecessor(SI, OnlyPred)) + return SimplifyCFG(BB) || 1; + + // If the block only contains the switch, see if we can fold the block + // away into any preds. + if (SI == &BB->front()) + if (FoldValueComparisonIntoPredecessors(SI)) + return SimplifyCFG(BB) || 1; + } } else if (BranchInst *BI = dyn_cast(BB->getTerminator())) { if (BI->isConditional()) { if (Value *CompVal = isValueEqualityComparison(BI)) { + // If we only have one predecessor, and if it is a branch on this value, + // see if that predecessor totally determines the outcome of this + // switch. + if (BasicBlock *OnlyPred = BB->getSinglePredecessor()) + if (SimplifyEqualityComparisonWithOnlyPredecessor(BI, OnlyPred)) + return SimplifyCFG(BB) || 1; + // This block must be empty, except for the setcond inst, if it exists. BasicBlock::iterator I = BB->begin(); if (&*I == BI || From reid at x10sys.com Thu Feb 24 01:12:54 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 01:12:54 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200502240712.BAA11608@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.301 -> 1.302 --- Log message: Fix the other half of PR528: http://llvm.cs.uiuc.edu/PR528 .. don't try to strip header files! --- Diffs of the changes: (+3 -3) Makefile.rules | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.301 llvm/Makefile.rules:1.302 --- llvm/Makefile.rules:1.301 Wed Feb 23 21:56:32 2005 +++ llvm/Makefile.rules Thu Feb 24 01:12:43 2005 @@ -322,7 +322,7 @@ ifndef KEEP_SYMBOLS Strip := $(PLATFORMSTRIPOPTS) StripWarnMsg := "(without symbols)" - Install.Flags += -s + Install.StripFlag += -s endif # Adjust linker flags for building an executable @@ -362,8 +362,8 @@ $(CompileCommonOpts) LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \ $(Install.Flags) -ProgInstall = $(INSTALL) $(Install.Flags) -m 0755 -DataInstall = $(INSTALL) $(Install.Flags) -m 0644 +ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 +DataInstall = $(INSTALL) -m 0644 Burg = $(BURG) -I $(PROJ_SRC_DIR) TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR) Archive = $(AR) $(AR.Flags) From lattner at cs.uiuc.edu Thu Feb 24 10:58:45 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 10:58:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Verifier.cpp Message-ID: <200502241658.j1OGwjli011494@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.170 -> 1.171 Verifier.cpp updated: 1.125 -> 1.126 --- Log message: Fix some problems where the verifier would crash on invalid input instead of reporting the problem and exiting. --- Diffs of the changes: (+7 -3) AsmWriter.cpp | 9 ++++++--- Verifier.cpp | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.170 llvm/lib/VMCore/AsmWriter.cpp:1.171 --- llvm/lib/VMCore/AsmWriter.cpp:1.170 Wed Feb 9 11:45:03 2005 +++ llvm/lib/VMCore/AsmWriter.cpp Thu Feb 24 10:58:29 2005 @@ -755,9 +755,12 @@ void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType, bool PrintName) { - assert(Operand != 0 && "Illegal Operand"); - if (PrintType) { Out << ' '; printType(Operand->getType()); } - WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine); + if (Operand != 0) { + if (PrintType) { Out << ' '; printType(Operand->getType()); } + WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine); + } else { + Out << ""; + } } Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.125 llvm/lib/VMCore/Verifier.cpp:1.126 --- llvm/lib/VMCore/Verifier.cpp:1.125 Sat Jan 22 11:36:16 2005 +++ llvm/lib/VMCore/Verifier.cpp Thu Feb 24 10:58:29 2005 @@ -592,6 +592,7 @@ for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { // Check to make sure that the "address of" an intrinsic function is never // taken. + Assert1(I.getOperand(i) != 0, "Instruction has null operand!", &I); if (Function *F = dyn_cast(I.getOperand(i))) { Assert1(!F->isIntrinsic() || (i == 0 && isa(I)), "Cannot take the address of an intrinsic!", &I); From reid at x10sys.com Thu Feb 24 12:25:34 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 12:25:34 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/m4/config_project.m4 Message-ID: <200502241825.MAA26878@zion.cs.uiuc.edu> Changes in directory llvm/autoconf/m4: config_project.m4 added (r1.1) --- Log message: Add a new macro for configuring projects, LLVM_CONFIG_PROJECT. This macro takes care of the --with-llvmsrc and --with-llvmobj options for the project It was moved here from the project's configure.ac file because there is some tricky handling of the llvm_src variable to tell the project where the llvm source tree is (for mkinstalldirs and install-sh commands). --- Diffs of the changes: (+14 -0) config_project.m4 | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/autoconf/m4/config_project.m4 diff -c /dev/null llvm/autoconf/m4/config_project.m4:1.1 *** /dev/null Thu Feb 24 12:25:34 2005 --- llvm/autoconf/m4/config_project.m4 Thu Feb 24 12:25:24 2005 *************** *** 0 **** --- 1,14 ---- + # + # Provide the arguments and other processing needed for an LLVM project + # + AC_DEFUN([LLVM_CONFIG_PROJECT], + [AC_ARG_WITH([llvmsrc], + AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]), + [llvm_src="$withval"],[llvm_src=`cd ${srcdir}/../..; pwd`]) + AC_SUBST(LLVM_SRC,$llvm_src) + AC_ARG_WITH([llvmobj], + AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]), + [llvm_obj="$withval"],[llvm_obj=`cd ../..; pwd`]) + AC_SUBST(LLVM_OBJ,$llvm_obj) + AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"]) + ]) From reid at x10sys.com Thu Feb 24 12:28:31 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 12:28:31 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/m4/config_makefile.m4 Message-ID: <200502241828.MAA26916@zion.cs.uiuc.edu> Changes in directory llvm/autoconf/m4: config_makefile.m4 updated: 1.1 -> 1.2 --- Log message: This macro cannot assume that the location of install-sh and mkinstalldirs is in ${srcdir}/autoconf because that is only true if the project is LLVM. For other projects (e.g. sample), we don't want to have to distribute the mkinstalldirs or install-sh programs because it opens a window of breakage for projects. So, this change requires that the llvm_src variable be set up via another AC_CONFIG_COMMANDS call. For LLVM this is done in the configure.ac. For projects its done in the LLVM_CONFIG_PROJECT macro. --- Diffs of the changes: (+3 -1) config_makefile.m4 | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/autoconf/m4/config_makefile.m4 diff -u llvm/autoconf/m4/config_makefile.m4:1.1 llvm/autoconf/m4/config_makefile.m4:1.2 --- llvm/autoconf/m4/config_makefile.m4:1.1 Tue Sep 7 01:56:14 2004 +++ llvm/autoconf/m4/config_makefile.m4 Thu Feb 24 12:28:20 2005 @@ -3,5 +3,7 @@ # date. This macro is unique to LLVM. # AC_DEFUN([AC_CONFIG_MAKEFILE], -[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`) +[AC_CONFIG_COMMANDS($1, + [${llvm_src}/autoconf/mkinstalldirs `dirname $1` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/$1 $1]) ]) From reid at x10sys.com Thu Feb 24 12:31:38 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 12:31:38 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200502241831.MAA26980@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.169 -> 1.170 --- Log message: Add a call to AC_CONFIG_COMMANDS to ensure that llvm_src is set properly in the config.status script. This allows the AC_CONFIG_MAKEFILE macro to work properly after it was changed to support sub-projects. --- Diffs of the changes: (+1 -0) configure.ac | 1 + 1 files changed, 1 insertion(+) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.169 llvm/autoconf/configure.ac:1.170 --- llvm/autoconf/configure.ac:1.169 Wed Feb 16 10:21:00 2005 +++ llvm/autoconf/configure.ac Thu Feb 24 12:31:27 2005 @@ -586,6 +586,7 @@ AC_CONFIG_FILES([docs/doxygen.cfg]) dnl Do special configuration of Makefiles +AC_CONFIG_COMMANDS([setup],,[llvm_src="${srcdir}"]) AC_CONFIG_MAKEFILE(Makefile) AC_CONFIG_MAKEFILE(Makefile.common) AC_CONFIG_MAKEFILE(examples/Makefile) From alenhar2 at cs.uiuc.edu Thu Feb 24 12:36:48 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 24 Feb 2005 12:36:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Message-ID: <200502241836.j1OIamQS013686@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaRegisterInfo.cpp updated: 1.12 -> 1.13 --- Log message: fix Allocas. Really. I mean it this time. --- Diffs of the changes: (+6 -1) AlphaRegisterInfo.cpp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.12 llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.13 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.12 Tue Feb 22 15:59:48 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Thu Feb 24 12:36:32 2005 @@ -220,7 +220,8 @@ // brackets around call sites. //If there is a frame pointer, then we don't do this NumBytes += MFI->getMaxCallFrameSize(); - std::cerr << "Added " << MFI->getMaxCallFrameSize() << " to the stack due to calls\n"; + DEBUG(std::cerr << "Added " << MFI->getMaxCallFrameSize() + << " to the stack due to calls\n"); } if (FP) @@ -274,6 +275,10 @@ //now if we need to, restore the old FP if (FP) { + //copy the FP into the SP (discards allocas) + MI=BuildMI(Alpha::BIS, 2, Alpha::R30).addReg(Alpha::R15).addReg(Alpha::R15); + MBB.insert(MBBI, MI); + //restore the FP MI=BuildMI(Alpha::LDQ, 2, Alpha::R15).addImm(0).addReg(Alpha::R15); MBB.insert(MBBI, MI); } From reid at x10sys.com Thu Feb 24 12:42:45 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 12:42:45 -0600 Subject: [llvm-commits] CVS: llvm/projects/sample/autoconf/AutoRegen.sh Message-ID: <200502241842.MAA27089@zion.cs.uiuc.edu> Changes in directory llvm/projects/sample/autoconf: AutoRegen.sh updated: 1.1 -> 1.2 --- Log message: * Fix an output message * Make aclocal look in LLVM's autoconf/m4 directory for macros * Don't force generation of missing files --- Diffs of the changes: (+3 -3) AutoRegen.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/projects/sample/autoconf/AutoRegen.sh diff -u llvm/projects/sample/autoconf/AutoRegen.sh:1.1 llvm/projects/sample/autoconf/AutoRegen.sh:1.2 --- llvm/projects/sample/autoconf/AutoRegen.sh:1.1 Wed Jan 5 00:41:10 2005 +++ llvm/projects/sample/autoconf/AutoRegen.sh Thu Feb 24 12:42:34 2005 @@ -19,12 +19,12 @@ llvm_m4=`pwd` cd $cwd else - die "Can't find the LLVM autoconf/m4 directory. llvm-test should be checked out to projects directory" + die "Can't find the LLVM autoconf/m4 directory. The project should be checked out to projects directory" fi echo "Regenerating aclocal.m4 with aclocal" rm -f aclocal.m4 -aclocal -I $cwd/m4 -I $llvm_m4 || die "aclocal failed" +aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed" echo "Regenerating configure with autoconf 2.5x" -autoconf --force --warnings=all -o ../configure configure.ac || die "autoconf failed" +autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed" cd .. exit 0 From lattner at cs.uiuc.edu Thu Feb 24 12:48:22 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 12:48:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200502241848.j1OImMbV014185@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.193 -> 1.194 --- Log message: Fix a bug introduced by revision 1.187 of this file. --- Diffs of the changes: (+2 -1) DataStructure.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.193 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.194 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.193 Tue Feb 15 12:48:48 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Feb 24 12:48:07 2005 @@ -1925,11 +1925,12 @@ // The final unresolved call nodes must be handled specially at the end of // the BU pass (i.e., in main or other roots of the call graph). for (afc_iterator CI = afc_begin(), E = afc_end(); CI != E; ++CI) - if (AuxFCallsAlive.insert(&*CI).second && + if (!AuxFCallsAlive.count(&*CI) && (CI->isIndirectCall() || CallSiteUsesAliveArgs(*CI, Alive, Visited, Flags & DSGraph::RemoveUnreachableGlobals))) { CI->markReachableNodes(Alive); + AuxFCallsAlive.insert(&*CI); Iterate = true; } } while (Iterate); From llvm at cs.uiuc.edu Thu Feb 24 12:49:48 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Thu, 24 Feb 2005 12:49:48 -0600 Subject: [llvm-commits] CVS: llvm/projects/sample/autoconf/aclocal.m4 Message-ID: <200502241849.MAA27160@zion.cs.uiuc.edu> Changes in directory llvm/projects/sample/autoconf: aclocal.m4 (r1.2) removed --- Log message: Don't put generated files into CVS. --- Diffs of the changes: (+0 -0) 0 files changed From reid at x10sys.com Thu Feb 24 12:51:04 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 12:51:04 -0600 Subject: [llvm-commits] CVS: llvm/projects/sample/autoconf/configure.ac Message-ID: <200502241851.MAA27186@zion.cs.uiuc.edu> Changes in directory llvm/projects/sample/autoconf: configure.ac updated: 1.3 -> 1.4 --- Log message: * Move all the "standard" configuration stuff to the start of the file * Make the auxilliary directory be llvm/autoconf not the project's * Use the LLVM_CONFIG_PROJECT macro to get the --with-llvm{src,obj} args --- Diffs of the changes: (+15 -15) configure.ac | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) Index: llvm/projects/sample/autoconf/configure.ac diff -u llvm/projects/sample/autoconf/configure.ac:1.3 llvm/projects/sample/autoconf/configure.ac:1.4 --- llvm/projects/sample/autoconf/configure.ac:1.3 Wed Jan 5 00:41:10 2005 +++ llvm/projects/sample/autoconf/configure.ac Thu Feb 24 12:50:53 2005 @@ -3,15 +3,22 @@ dnl ************************************************************************** AC_INIT([[[SAMPLE]]],[[[x.xx]]],[bugs at yourdomain]) -dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR(autoconf) +dnl Tell autoconf that the auxilliary files are actually located in +dnl the LLVM autoconf directory, not here. +AC_CONFIG_AUX_DIR(../../autoconf) + +dnl Tell autoconf that this is an LLVM project being configured +dnl This provides the --with-llvmsrc and --with-llvmobj options +LLVM_CONFIG_PROJECT -dnl Configure a header file -AC_CONFIG_FILES(Makefile.common) +dnl Verify that the source directory is valid +AC_CONFIG_SRCDIR(["Makefile.common.in"]) -dnl Configure Makefiles -dnl List every Makefile that ecists within your source tree +dnl Configure a common Makefile +AC_CONFIG_FILES(Makefile.common) +dnl Configure project makefiles +dnl List every Makefile that exists within your source tree AC_CONFIG_MAKEFILE(Makefile) AC_CONFIG_MAKEFILE(lib/Makefile) AC_CONFIG_MAKEFILE(lib/sample/Makefile) @@ -26,9 +33,6 @@ dnl * Check for programs. dnl ************************************************************************** -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR(["Makefile.common.in"]) - dnl ************************************************************************** dnl * Check for libraries. dnl ************************************************************************** @@ -53,13 +57,9 @@ dnl * Set the location of various third-party software packages dnl ************************************************************************** -dnl Location of LLVM source code -AC_ARG_WITH(llvmsrc,AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) - -dnl Location of LLVM object code -AC_ARG_WITH(llvmobj,AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) - dnl ************************************************************************** dnl * Create the output files dnl ************************************************************************** + +dnl This must be last AC_OUTPUT From llvm at cs.uiuc.edu Thu Feb 24 12:52:34 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Thu, 24 Feb 2005 12:52:34 -0600 Subject: [llvm-commits] CVS: llvm/projects/sample/autoconf/install-sh ltmain.sh mkinstalldirs Message-ID: <200502241852.MAA27210@zion.cs.uiuc.edu> Changes in directory llvm/projects/sample/autoconf: install-sh (r1.1) removed ltmain.sh (r1.1) removed mkinstalldirs (r1.1) removed --- Log message: Remove auxilliary files that are now picked up from llvm/autoconf. This avoids version conflict problems with ltmain.sh (libtool), mkinstalldirs and install-sh. This prevents projects from becoming stale when the LLVM build system is upgraded or modified. --- Diffs of the changes: (+0 -0) 0 files changed From reid at x10sys.com Thu Feb 24 12:53:58 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 12:53:58 -0600 Subject: [llvm-commits] CVS: llvm/projects/sample/configure Message-ID: <200502241853.MAA27234@zion.cs.uiuc.edu> Changes in directory llvm/projects/sample: configure updated: 1.2 -> 1.3 --- Log message: Update to reflect various changes in the autoconf directory. THe recommended configuration of projects is now much simplified and depends on LLVM file presence rather than local project file presence. --- Diffs of the changes: (+38 -34) configure | 72 ++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 38 insertions(+), 34 deletions(-) Index: llvm/projects/sample/configure diff -u llvm/projects/sample/configure:1.2 llvm/projects/sample/configure:1.3 --- llvm/projects/sample/configure:1.2 Sat Jan 1 03:26:55 2005 +++ llvm/projects/sample/configure Thu Feb 24 12:53:47 2005 @@ -1238,7 +1238,7 @@ ac_aux_dir= -for ac_dir in autoconf $srcdir/autoconf; do +for ac_dir in ../../autoconf $srcdir/../../autoconf; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1254,8 +1254,8 @@ fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../autoconf $srcdir/../../autoconf" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in ../../autoconf $srcdir/../../autoconf" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" @@ -1263,57 +1263,59 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - ac_config_files="$ac_config_files Makefile.common" +# Check whether --with-llvmsrc or --without-llvmsrc was given. +if test "${with_llvmsrc+set}" = set; then + withval="$with_llvmsrc" + llvm_src="$withval" +else + llvm_src=`cd ${srcdir}/../..; pwd` +fi; + LLVM_SRC=$llvm_src - ac_config_commands="$ac_config_commands Makefile" +# Check whether --with-llvmobj or --without-llvmobj was given. +if test "${with_llvmobj+set}" = set; then + withval="$with_llvmobj" + llvm_obj="$withval" +else + llvm_obj=`cd ../..; pwd` +fi; + LLVM_OBJ=$llvm_obj + ac_config_commands="$ac_config_commands setup" - ac_config_commands="$ac_config_commands lib/Makefile" - ac_config_commands="$ac_config_commands lib/sample/Makefile" - ac_config_commands="$ac_config_commands tools/Makefile" + ac_config_files="$ac_config_files Makefile.common" - ac_config_commands="$ac_config_commands tools/sample/Makefile" - + ac_config_commands="$ac_config_commands Makefile" + ac_config_commands="$ac_config_commands lib/Makefile" + ac_config_commands="$ac_config_commands lib/sample/Makefile" + ac_config_commands="$ac_config_commands tools/Makefile" + ac_config_commands="$ac_config_commands tools/sample/Makefile" -# Check whether --with-llvmsrc or --without-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval="$with_llvmsrc" - LLVM_SRC=$withval -else - LLVM_SRC=`cd ${srcdir}/../..; pwd` -fi; -# Check whether --with-llvmobj or --without-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval="$with_llvmobj" - LLVM_OBJ=$withval -else - LLVM_OBJ=`cd ../..; pwd` -fi; cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -1864,11 +1866,7 @@ # INIT-COMMANDS section. # -${srcdir}/autoconf/mkinstalldirs `dirname Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/sample/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname tools/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname tools/sample/Makefile` +llvm_src="${LLVM_SRC}" _ACEOF @@ -1880,6 +1878,7 @@ case "$ac_config_target" in # Handling of arguments. "Makefile.common" ) CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; + "setup" ) CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;; "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "lib/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; "lib/sample/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/sample/Makefile" ;; @@ -2320,11 +2319,16 @@ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in - Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - lib/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - lib/sample/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/sample/Makefile lib/sample/Makefile ;; - tools/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; - tools/sample/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/sample/Makefile tools/sample/Makefile ;; + Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + lib/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + lib/sample/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/sample/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/sample/Makefile lib/sample/Makefile ;; + tools/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; + tools/sample/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/sample/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/sample/Makefile tools/sample/Makefile ;; esac done _ACEOF From reid at x10sys.com Thu Feb 24 13:05:30 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 13:05:30 -0600 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200502241905.NAA27590@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.175 -> 1.176 --- Log message: Adjust to changes needed to more easily support projects via the new LLVM_CONFIG_PROJECT macro. --- Diffs of the changes: (+24 -20) configure | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-) Index: llvm/configure diff -u llvm/configure:1.175 llvm/configure:1.176 --- llvm/configure:1.175 Wed Feb 16 10:21:00 2005 +++ llvm/configure Thu Feb 24 13:05:19 2005 @@ -30242,6 +30242,8 @@ ac_config_files="$ac_config_files docs/doxygen.cfg" + ac_config_commands="$ac_config_commands setup" + ac_config_commands="$ac_config_commands Makefile" @@ -30811,16 +30813,7 @@ # INIT-COMMANDS section. # -${srcdir}/autoconf/mkinstalldirs `dirname Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname Makefile.common` -${srcdir}/autoconf/mkinstalldirs `dirname examples/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Makefile.tests` -${srcdir}/autoconf/mkinstalldirs `dirname tools/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname utils/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname projects/Makefile` +llvm_src="${srcdir}" _ACEOF @@ -30837,6 +30830,7 @@ "tools/llvmc/ll" ) CONFIG_FILES="$CONFIG_FILES tools/llvmc/ll" ;; "tools/llvmc/c" ) CONFIG_FILES="$CONFIG_FILES tools/llvmc/c" ;; "docs/doxygen.cfg" ) CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;; + "setup" ) CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;; "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "Makefile.common" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.common" ;; "examples/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS examples/Makefile" ;; @@ -31617,16 +31611,26 @@ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in - Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - Makefile.common ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile.common Makefile.common ;; - examples/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/examples/Makefile examples/Makefile ;; - lib/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - runtime/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; - test/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; - test/Makefile.tests ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Makefile.tests test/Makefile.tests ;; - tools/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; - utils/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Makefile utils/Makefile ;; - projects/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/Makefile projects/Makefile ;; + Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + Makefile.common ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.common` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.common Makefile.common ;; + examples/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname examples/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/examples/Makefile examples/Makefile ;; + lib/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + runtime/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; + test/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; + test/Makefile.tests ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile.tests` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile.tests test/Makefile.tests ;; + tools/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; + utils/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname utils/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/utils/Makefile utils/Makefile ;; + projects/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname projects/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/projects/Makefile projects/Makefile ;; esac done _ACEOF From lattner at cs.uiuc.edu Thu Feb 24 13:22:48 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 13:22:48 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502241922.j1OJMmV0016604@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.22 -> 1.23 --- Log message: Keep the function clone info NewToOldValueMap map updated when we delete or rename values. Dangling pointers cause major problems (duh), particularly because we can get unlucky and have newly allocated instructions allocated at the same address as some deleted instruction. --- Diffs of the changes: (+37 -8) PointerCompress.cpp | 45 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 37 insertions(+), 8 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.22 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.23 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.22 Tue Feb 22 23:51:24 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 24 13:22:32 2005 @@ -69,6 +69,10 @@ const Value *getValueInOriginalFunction(Value *V) const { std::map::const_iterator I = NewToOldValueMap.find(V); + if (I == NewToOldValueMap.end()) { + for (I = NewToOldValueMap.begin(); I != NewToOldValueMap.end(); ++I) + std::cerr << "MAP: " << *I->first << " TO: " << *I->second << "\n"; + } assert (I != NewToOldValueMap.end() && "Value did not come from clone!"); return I->second; } @@ -106,8 +110,8 @@ /// getCloneInfo - If the specified function is a clone, return the /// information about the cloning process for it. Otherwise, return a null /// pointer. - const FunctionCloneRecord *getCloneInfo(Function &F) const { - std::map::const_iterator I = + FunctionCloneRecord *getCloneInfo(Function &F) { + std::map::iterator I = ClonedFunctionInfoMap.find(&F); return I == ClonedFunctionInfoMap.end() ? 0 : &I->second; } @@ -322,14 +326,13 @@ /// FCR - If we are compressing a clone of a pool allocated function (as /// opposed to the pool allocated function itself), this contains /// information about the clone. - const FunctionCloneRecord *FCR; + FunctionCloneRecord *FCR; PointerCompress &PtrComp; public: InstructionRewriter(const PointerCompress::PoolInfoMap &poolInfo, const DSGraph &dsg, PA::FuncInfo &pafi, - const FunctionCloneRecord *fcr, - PointerCompress &ptrcomp) + FunctionCloneRecord *fcr, PointerCompress &ptrcomp) : PoolInfo(poolInfo), TD(dsg.getTargetData()), DSG(dsg), PAFuncInfo(pafi), FCR(fcr), PtrComp(ptrcomp) { } @@ -419,6 +422,26 @@ return 0; } + /// ValueRemoved - Whenever we remove a value from the current function, + /// update any maps that contain that pointer so we don't have stale + /// pointers hanging around. + void ValueRemoved(Value *V) { + if (FCR) FCR->NewToOldValueMap.erase(V); + } + + /// ValueReplaced - Whenever we replace a value from the current function, + /// update any maps that contain that pointer so we don't have stale + /// pointers hanging around. + void ValueReplaced(Value &Old, Value *New) { + if (FCR) { + std::map::iterator I = + FCR->NewToOldValueMap.find(&Old); + assert(I != FCR->NewToOldValueMap.end() && "Didn't find element!?"); + FCR->NewToOldValueMap.insert(std::make_pair(New, I->second)); + FCR->NewToOldValueMap.erase(I); + } + } + //===------------------------------------------------------------------===// // Visitation methods. These do all of the heavy lifting for the various // cases we have to handle. @@ -463,8 +486,10 @@ I->first->replaceAllUsesWith(UndefValue::get(I->first->getType())); // Finally, remove it from the program. - if (Instruction *Inst = dyn_cast(I->first)) + if (Instruction *Inst = dyn_cast(I->first)) { Inst->eraseFromParent(); + ValueRemoved(Inst); + } else if (Argument *Arg = dyn_cast(I->first)) { assert(Arg->getParent() == 0 && "Unexpected argument type here!"); delete Arg; // Marker node used when cloning. @@ -527,6 +552,7 @@ getTransformedValue(SCI.getOperand(1)), Name, &SCI); SCI.replaceAllUsesWith(New); + ValueReplaced(SCI, New); SCI.eraseFromParent(); } @@ -597,6 +623,7 @@ setTransformedValue(LI, NewLoad); } else { LI.replaceAllUsesWith(NewLoad); + ValueReplaced(LI, NewLoad); LI.eraseFromParent(); } } @@ -787,8 +814,10 @@ if (OpsToCompress[0] == 0) // Compressing return value? setTransformedValue(CI, NC); else { - if (!CI.use_empty()) + if (CI.getType() != Type::VoidTy) { CI.replaceAllUsesWith(NC); + ValueReplaced(CI, NC); + } CI.eraseFromParent(); } } @@ -804,7 +833,7 @@ // If this is a pointer compressed clone of a pool allocated function, get the // the pool allocated function. Rewriting a clone means that there are // incoming arguments that point into compressed pools. - const FunctionCloneRecord *FCR = getCloneInfo(F); + FunctionCloneRecord *FCR = getCloneInfo(F); Function *CloneSource = FCR ? FCR->PAFn : 0; PA::FuncInfo *FI; From lattner at cs.uiuc.edu Thu Feb 24 13:36:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 13:36:09 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502241936.j1OJa9xT018352@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.23 -> 1.24 --- Log message: 'load null' does not really make any sense, but we have to support it correctly. Particularly since bugpoint is fond of producing these when reducing testcases. --- Diffs of the changes: (+9 -1) PointerCompress.cpp | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.23 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.24 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.23 Thu Feb 24 13:22:32 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 24 13:35:56 2005 @@ -353,6 +353,8 @@ Value *getTransformedValue(Value *V) { if (isa(V)) // null -> uint 0 return Constant::getNullValue(SCALARUINTTYPE); + if (isa(V)) // undef -> uint undef + return UndefValue::get(SCALARUINTTYPE); assert(getNodeIfCompressed(V) && "Value is not compressed!"); Value *&RV = OldToNewValueMap[V]; @@ -582,7 +584,13 @@ } void InstructionRewriter::visitLoadInst(LoadInst &LI) { - if (isa(LI.getOperand(0))) return; // load null ?? + if (isa(LI.getOperand(0))) { // load null ?? + // Load null doesn't make any sense, but if the result is a pointer into a + // compressed pool, we have to transform it. + if (isa(LI.getType()) && getPoolInfo(&LI)) + setTransformedValue(LI, UndefValue::get(SCALARUINTTYPE)); + return; + } const CompressedPoolInfo *SrcPI = getPoolInfo(LI.getOperand(0)); if (SrcPI == 0) { From lattner at cs.uiuc.edu Thu Feb 24 13:55:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 13:55:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200502241955.j1OJtiom019507@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.121 -> 1.122 --- Log message: This instruction: X = gep null, ... Used to not create a scalar map entry for X, which caused clients to barf. This is bad. --- Diffs of the changes: (+2 -1) Local.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.121 llvm/lib/Analysis/DataStructure/Local.cpp:1.122 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.121 Sun Jan 30 17:51:02 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Thu Feb 24 13:55:31 2005 @@ -318,7 +318,8 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); - if (Value.isNull()) return; + if (Value.isNull()) + Value = createNode(); // As a special case, if all of the index operands of GEP are constant zeros, // handle this just like we handle casts (ie, don't do much). From lattner at cs.uiuc.edu Thu Feb 24 14:45:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 14:45:31 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502242045.j1OKjV90023636@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.24 -> 1.25 --- Log message: Fix crash handling 'store P, null' --- Diffs of the changes: (+5 -2) PointerCompress.cpp | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.24 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.25 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.24 Thu Feb 24 13:35:56 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 24 14:45:16 2005 @@ -641,8 +641,11 @@ void InstructionRewriter::visitStoreInst(StoreInst &SI) { const CompressedPoolInfo *DestPI = getPoolInfo(SI.getOperand(1)); if (DestPI == 0) { - assert(getPoolInfo(SI.getOperand(0)) == 0 && - "Cannot store a compressed pointer into non-compressed memory!"); + if (isa(SI.getOperand(1))) + SI.eraseFromParent(); + else + assert(getPoolInfo(SI.getOperand(0)) == 0 && + "Cannot store a compressed pointer into non-compressed memory!"); return; } From reid at x10sys.com Thu Feb 24 15:28:19 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 15:28:19 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/Makefile Message-ID: <200502242128.PAA29063@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: Makefile updated: 1.11 -> 1.12 --- Log message: For PR528: http://llvm.cs.uiuc.edu/PR528 : Use the DataInstall and MKDIR macros instead of using $(INSTALL) directly --- Diffs of the changes: (+8 -8) Makefile | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/docs/CommandGuide/Makefile diff -u llvm/docs/CommandGuide/Makefile:1.11 llvm/docs/CommandGuide/Makefile:1.12 --- llvm/docs/CommandGuide/Makefile:1.11 Sat Jan 15 20:21:29 2005 +++ llvm/docs/CommandGuide/Makefile Thu Feb 24 15:28:08 2005 @@ -79,16 +79,16 @@ install-local:: $(HTML) $(MAN) $(PS) $(Echo) Installing HTML CommandGuide Documentation - $(Verb) $(INSTALL) -d $(HTML_DIR) - $(Verb) $(INSTALL) -C $(HTML) $(HTML_DIR) - $(Verb) $(INSTALL) -C $(PROJ_SRC_DIR)/index.html $(HTML_DIR) - $(Verb) $(INSTALL) -C $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR) + $(Verb) $(MKDIR) $(HTML_DIR) + $(Verb) $(DataInstall) $(HTML) $(HTML_DIR) + $(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR) + $(Verb) $(DataInstall) -C $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR) $(Echo) Installing MAN CommandGuide Documentation - $(Verb) $(INSTALL) -d $(MAN_DIR) - $(Verb) $(INSTALL) -C $(MAN) $(MAN_DIR) + $(Verb) $(MKDIR) $(MAN_DIR) + $(Verb) $(DataInstall) $(MAN) $(MAN_DIR) $(Echo) Installing PS CommandGuide Documentation - $(Verb) $(INSTALL) -d $(PS_DIR) - $(Verb) $(INSTALL) -C $(PS) $(PS_DIR) + $(Verb) $(MKDIR) $(PS_DIR) + $(Verb) $(DataInstall) $(PS) $(PS_DIR) uninstall-local:: $(Echo) Uninstalling Documentation From reid at x10sys.com Thu Feb 24 15:28:19 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 15:28:19 -0600 Subject: [llvm-commits] CVS: llvm/docs/Makefile Message-ID: <200502242128.PAA29061@zion.cs.uiuc.edu> Changes in directory llvm/docs: Makefile updated: 1.7 -> 1.8 --- Log message: For PR528: http://llvm.cs.uiuc.edu/PR528 : Use the DataInstall and MKDIR macros instead of using $(INSTALL) directly --- Diffs of the changes: (+8 -8) Makefile | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/docs/Makefile diff -u llvm/docs/Makefile:1.7 llvm/docs/Makefile:1.8 --- llvm/docs/Makefile:1.7 Sat Jan 15 20:21:06 2005 +++ llvm/docs/Makefile Thu Feb 24 15:28:08 2005 @@ -29,11 +29,11 @@ install-html: $(PROJ_OBJ_DIR)/html.tar.gz $(Echo) Installing HTML documentation - $(Verb) $(INSTALL) -d $(PROJ_docsdir)/html - $(Verb) $(INSTALL) -d $(PROJ_docsdir)/html/img - $(Verb) $(INSTALL) -C $(HTML) $(PROJ_docsdir)/html - $(Verb) $(INSTALL) -C $(IMAGES) $(PROJ_docsdir)/html/img - $(Verb) $(INSTALL) -C $(PROJ_OBJ_DIR)/html.tar.gz $(PROJ_docsdir) + $(Verb) $(MKDIR) $(PROJ_docsdir)/html + $(Verb) $(MKDIR) $(PROJ_docsdir)/html/img + $(Verb) $(DataInstall) $(HTML) $(PROJ_docsdir)/html + $(Verb) $(DataInstall) $(IMAGES) $(PROJ_docsdir)/html/img + $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(PROJ_docsdir) $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) $(Echo) Packaging HTML documentation @@ -45,11 +45,11 @@ install-doxygen: doxygen $(Echo) Installing doxygen documentation $(Echo) Installing doxygen documentation - $(Verb) $(INSTALL) -d $(PROJ_docsdir)/html/doxygen - $(Verb) $(INSTALL) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_docsdir) + $(Verb) $(MKDIR) $(PROJ_docsdir)/html/doxygen + $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_docsdir) $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \ $(FIND) . -type f -exec \ - $(INSTALL) -C {} $(PROJ_docsdir)/html/doxygen \; + $(DataInstall) {} $(PROJ_docsdir)/html/doxygen \; doxygen: $(PROJ_OBJ_DIR)/doxygen.tar.gz From reid at x10sys.com Thu Feb 24 15:30:48 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 15:30:48 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200502242130.PAA29112@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.302 -> 1.303 --- Log message: The install program doesn't know how to strip bytecode files so install bytecode as data, not program. --- Diffs of the changes: (+1 -1) Makefile.rules | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.302 llvm/Makefile.rules:1.303 --- llvm/Makefile.rules:1.302 Thu Feb 24 01:12:43 2005 +++ llvm/Makefile.rules Thu Feb 24 15:30:37 2005 @@ -594,7 +594,7 @@ $(DestModule): $(ModuleDestDir) $(Module) $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule) - $(Verb) $(ProgInstall) $(Module) $(DestModule) + $(Verb) $(DataInstall) $(Module) $(DestModule) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule) From reid at x10sys.com Thu Feb 24 15:36:43 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 15:36:43 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200502242136.PAA29183@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.303 -> 1.304 --- Log message: Don't try to strip bytecode files! --- Diffs of the changes: (+1 -1) Makefile.rules | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.303 llvm/Makefile.rules:1.304 --- llvm/Makefile.rules:1.303 Thu Feb 24 15:30:37 2005 +++ llvm/Makefile.rules Thu Feb 24 15:36:32 2005 @@ -708,7 +708,7 @@ $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA) $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib) - $(Verb) $(ProgInstall) $(LibName.BCA) $(DestBytecodeLib) + $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib) From reid at x10sys.com Thu Feb 24 15:41:37 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 15:41:37 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/Makefile Message-ID: <200502242141.PAA29261@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: Makefile updated: 1.12 -> 1.13 --- Log message: Remove a -C I forgot to remove earlier. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/docs/CommandGuide/Makefile diff -u llvm/docs/CommandGuide/Makefile:1.12 llvm/docs/CommandGuide/Makefile:1.13 --- llvm/docs/CommandGuide/Makefile:1.12 Thu Feb 24 15:28:08 2005 +++ llvm/docs/CommandGuide/Makefile Thu Feb 24 15:41:26 2005 @@ -82,7 +82,7 @@ $(Verb) $(MKDIR) $(HTML_DIR) $(Verb) $(DataInstall) $(HTML) $(HTML_DIR) $(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR) - $(Verb) $(DataInstall) -C $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR) + $(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR) $(Echo) Installing MAN CommandGuide Documentation $(Verb) $(MKDIR) $(MAN_DIR) $(Verb) $(DataInstall) $(MAN) $(MAN_DIR) From reid at x10sys.com Thu Feb 24 15:43:54 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 24 Feb 2005 15:43:54 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvmc/Makefile Message-ID: <200502242143.PAA29293@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: Makefile updated: 1.13 -> 1.14 --- Log message: Use DataInstall macro instead of INSTALL. --- Diffs of the changes: (+4 -4) Makefile | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/tools/llvmc/Makefile diff -u llvm/tools/llvmc/Makefile:1.13 llvm/tools/llvmc/Makefile:1.14 --- llvm/tools/llvmc/Makefile:1.13 Sun Jan 16 18:42:31 2005 +++ llvm/tools/llvmc/Makefile Thu Feb 24 15:43:43 2005 @@ -16,7 +16,7 @@ install:: $(Echo) Installing additional C++ configuration clones - $(Verb)$(INSTALL) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/cc - $(Verb)$(INSTALL) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/c++ - $(Verb)$(INSTALL) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/cxx - $(Verb)$(INSTALL) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/C + $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/cc + $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/c++ + $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/cxx + $(Verb)$(DataInstall) $(PROJ_OBJ_DIR)/cpp $(PROJ_etcdir)/C From lattner at cs.uiuc.edu Thu Feb 24 15:47:16 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 15:47:16 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502242147.j1OLlGGx026666@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.25 -> 1.26 --- Log message: Handle cast -> int. --- Diffs of the changes: (+10 -4) PointerCompress.cpp | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.25 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.26 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.25 Thu Feb 24 14:45:16 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 24 15:47:00 2005 @@ -491,13 +491,12 @@ if (Instruction *Inst = dyn_cast(I->first)) { Inst->eraseFromParent(); ValueRemoved(Inst); - } - else if (Argument *Arg = dyn_cast(I->first)) { + } else if (Argument *Arg = dyn_cast(I->first)) { assert(Arg->getParent() == 0 && "Unexpected argument type here!"); delete Arg; // Marker node used when cloning. } else { assert(0 && "Unknown entry in this map!"); - } + } } } @@ -512,7 +511,14 @@ void InstructionRewriter::visitCastInst(CastInst &CI) { - if (!isa(CI.getType())) return; + if (!isa(CI.getType())) { + // If this is a pointer -> integer cast, turn this into an idx -> integer + // cast. + if (isa(CI.getOperand(0)->getType()) && + getPoolInfo(CI.getOperand(0))) + CI.setOperand(0, getTransformedValue(CI.getOperand(0))); + return; + } const CompressedPoolInfo *PI = getPoolInfo(&CI); if (!PI) return; From alenhar2 at cs.uiuc.edu Thu Feb 24 15:50:45 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 24 Feb 2005 15:50:45 -0600 Subject: [llvm-commits] CVS: llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h Message-ID: <200502242150.j1OLojIh026943@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/libstdc++-v3/config/cpu/alpha: atomicity.h updated: 1.1.1.1 -> 1.2 --- Log message: make the alpha skip asm, and do the ops like the other archs do, rather than using ../generic --- Diffs of the changes: (+8 -3) atomicity.h | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h diff -u llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h:1.1.1.1 llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h:1.2 --- llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h:1.1.1.1 Thu Jan 8 15:59:29 2004 +++ llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h Thu Feb 24 15:50:32 2005 @@ -42,7 +42,10 @@ __exchange_and_add (volatile _Atomic_word* __mem, int __val) { register int __result, __tmp; - +#ifdef __llvm__ + __result = *__mem; + *__mem += __val; +#else __asm__ __volatile__ ( "\n$Lxadd_%=:\n\t" "ldl_l %0,%3\n\t" @@ -52,7 +55,7 @@ "mb" : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) : "m" (*__mem), "r"(__val)); - +#endif return __result; } @@ -61,7 +64,9 @@ __atomic_add (volatile _Atomic_word* __mem, int __val) { register _Atomic_word __result; - +#ifdef __llvm__ + *__mem += __val; +#else __asm__ __volatile__ ( "\n$Ladd_%=:\n\t" "ldl_l %0,%2\n\t" From alenhar2 at cs.uiuc.edu Thu Feb 24 16:01:27 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 24 Feb 2005 16:01:27 -0600 Subject: [llvm-commits] CVS: llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h Message-ID: <200502242201.j1OM1ROR026978@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/libstdc++-v3/config/cpu/alpha: atomicity.h updated: 1.2 -> 1.3 --- Log message: failing to terminate ifdefs leads to cool error messages --- Diffs of the changes: (+1 -0) atomicity.h | 1 + 1 files changed, 1 insertion(+) Index: llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h diff -u llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h:1.2 llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h:1.3 --- llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h:1.2 Thu Feb 24 15:50:32 2005 +++ llvm-gcc/libstdc++-v3/config/cpu/alpha/atomicity.h Thu Feb 24 16:01:14 2005 @@ -76,6 +76,7 @@ "mb" : "=&r"(__result), "=m"(*__mem) : "m" (*__mem), "r"(__val)); +#endif } #endif /* atomicity.h */ From alenhar2 at cs.uiuc.edu Thu Feb 24 16:16:15 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 24 Feb 2005 16:16:15 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/cp/init.c Message-ID: <200502242216.j1OMGFWA027058@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc/cp: init.c updated: 1.2 -> 1.3 --- Log message: init.c won't compile without being able to resolve EMIT_LLVM --- Diffs of the changes: (+1 -0) init.c | 1 + 1 files changed, 1 insertion(+) Index: llvm-gcc/gcc/cp/init.c diff -u llvm-gcc/gcc/cp/init.c:1.2 llvm-gcc/gcc/cp/init.c:1.3 --- llvm-gcc/gcc/cp/init.c:1.2 Sat Feb 12 00:42:46 2005 +++ llvm-gcc/gcc/cp/init.c Thu Feb 24 16:16:00 2005 @@ -34,6 +34,7 @@ #include "output.h" #include "except.h" #include "toplev.h" +#include "llvm-out.h" static bool begin_init_stmts (tree *, tree *); static tree finish_init_stmts (bool, tree, tree); From lattner at cs.uiuc.edu Thu Feb 24 19:28:04 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 19:28:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200502250128.j1P1S4JJ029280@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.122 -> 1.123 --- Log message: Handle null a bit more carefully. Actually teach dsa about select instructions. This doesn't affect the graph in any way other than not setting a spurious U marker on pointer nodes that are selected. --- Diffs of the changes: (+11 -1) Local.cpp | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.122 llvm/lib/Analysis/DataStructure/Local.cpp:1.123 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.122 Thu Feb 24 13:55:31 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Thu Feb 24 19:27:48 2005 @@ -104,6 +104,7 @@ void handleAlloc(AllocationInst &AI, bool isHeap); void visitPHINode(PHINode &PN); + void visitSelectInst(SelectInst &SI); void visitGetElementPtrInst(User &GEP); void visitReturnInst(ReturnInst &RI); @@ -316,6 +317,14 @@ PNDest.mergeWith(getValueDest(*PN.getIncomingValue(i))); } +void GraphBuilder::visitSelectInst(SelectInst &SI) { + if (!isPointerType(SI.getType())) return; // Only pointer Selects + + DSNodeHandle &Dest = ScalarMap[&SI]; + Dest.mergeWith(getValueDest(*SI.getOperand(1))); + Dest.mergeWith(getValueDest(*SI.getOperand(2))); +} + void GraphBuilder::visitGetElementPtrInst(User &GEP) { DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); if (Value.isNull()) @@ -430,7 +439,8 @@ void GraphBuilder::visitLoadInst(LoadInst &LI) { DSNodeHandle Ptr = getValueDest(*LI.getOperand(0)); - if (Ptr.getNode() == 0) return; + if (Ptr.isNull()) + Ptr = createNode(); // Make that the node is read from... Ptr.getNode()->setReadMarker(); From lattner at cs.uiuc.edu Thu Feb 24 19:30:32 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 24 Feb 2005 19:30:32 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502250130.j1P1UWg7029721@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.26 -> 1.27 --- Log message: teach ptrcomp to rewrite select instructions. --- Diffs of the changes: (+11 -0) PointerCompress.cpp | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.26 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.27 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.26 Thu Feb 24 15:47:00 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 24 19:30:19 2005 @@ -451,6 +451,7 @@ void visitReturnInst(ReturnInst &RI); void visitCastInst(CastInst &CI); void visitPHINode(PHINode &PN); + void visitSelectInst(SelectInst &SI); void visitSetCondInst(SetCondInst &SCI); void visitGetElementPtrInst(GetElementPtrInst &GEPI); void visitLoadInst(LoadInst &LI); @@ -542,6 +543,16 @@ setTransformedValue(PN, New); } +void InstructionRewriter::visitSelectInst(SelectInst &SI) { + const CompressedPoolInfo *DestPI = getPoolInfo(&SI); + if (DestPI == 0) return; + + setTransformedValue(SI, new SelectInst(SI.getOperand(0), + getTransformedValue(SI.getOperand(1)), + getTransformedValue(SI.getOperand(2)), + SI.getName(), &SI)); +} + void InstructionRewriter::visitSetCondInst(SetCondInst &SCI) { if (!isa(SCI.getOperand(0)->getType())) return; Value *NonNullPtr = SCI.getOperand(0); From alkis at cs.uiuc.edu Thu Feb 24 22:21:04 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 24 Feb 2005 22:21:04 -0600 Subject: [llvm-commits] CVS: llvm-java/configure Message-ID: <200502250421.WAA07030@zion.cs.uiuc.edu> Changes in directory llvm-java: configure updated: 1.9 -> 1.10 --- Log message: Adapt to new project build structure. --- Diffs of the changes: (+62 -57) configure | 119 ++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 62 insertions(+), 57 deletions(-) Index: llvm-java/configure diff -u llvm-java/configure:1.9 llvm-java/configure:1.10 --- llvm-java/configure:1.9 Wed Dec 8 00:38:19 2004 +++ llvm-java/configure Thu Feb 24 22:20:53 2005 @@ -274,7 +274,8 @@ PACKAGE_BUGREPORT='llvmbugs at cs.uiuc.edu' ac_unique_file="Makefile.common.in" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS JAVA JAVAC JAVAH LLVM_SRC LLVM_OBJ LIBOBJS LTLIBOBJS' +ac_unique_file="Makefile.common.in" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ JAVA JAVAC JAVAH LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1258,7 +1259,7 @@ ac_aux_dir= -for ac_dir in autoconf $srcdir/autoconf; do +for ac_dir in ../../autoconf $srcdir/../../autoconf; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1274,8 +1275,8 @@ fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../autoconf $srcdir/../../autoconf" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in ../../autoconf $srcdir/../../autoconf" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" @@ -1284,6 +1285,33 @@ +# Check whether --with-llvmsrc or --without-llvmsrc was given. +if test "${with_llvmsrc+set}" = set; then + withval="$with_llvmsrc" + llvm_src="$withval" +else + llvm_src=`cd ${srcdir}/../..; pwd` +fi; + LLVM_SRC=$llvm_src + + +# Check whether --with-llvmobj or --without-llvmobj was given. +if test "${with_llvmobj+set}" = set; then + withval="$with_llvmobj" + llvm_obj="$withval" +else + llvm_obj=`cd ../..; pwd` +fi; + LLVM_OBJ=$llvm_obj + + ac_config_commands="$ac_config_commands setup" + + + + + + ac_config_files="$ac_config_files Makefile.common" + ac_config_commands="$ac_config_commands Makefile" @@ -1325,9 +1353,6 @@ - ac_config_files="$ac_config_files Makefile.common" - - # Extract the first word of "java", so it can be a program name with args. @@ -1464,28 +1489,6 @@ - -# Check whether --with-llvmsrc or --without-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval="$with_llvmsrc" - LLVM_SRC=$withval - -else - LLVM_SRC=`cd ${srcdir}/../..; pwd` - -fi; - - -# Check whether --with-llvmobj or --without-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval="$with_llvmobj" - LLVM_OBJ=$withval - -else - LLVM_OBJ=`cd ../..; pwd` - -fi; - cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -2035,19 +2038,7 @@ # INIT-COMMANDS section. # -${srcdir}/autoconf/mkinstalldirs `dirname Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/ClassFile/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Makefile.test` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/UnitTests/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile.singlesrc` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Regression/ClassFile/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Regression/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname tools/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname tools/classdump/Makefile` +llvm_src="${LLVM_SRC}" _ACEOF @@ -2059,6 +2050,7 @@ case "$ac_config_target" in # Handling of arguments. "Makefile.common" ) CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; + "setup" ) CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;; "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "lib/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; "lib/ClassFile/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/ClassFile/Makefile" ;; @@ -2156,11 +2148,11 @@ s, at ECHO_N@,$ECHO_N,;t t s, at ECHO_T@,$ECHO_T,;t t s, at LIBS@,$LIBS,;t t +s, at LLVM_SRC@,$LLVM_SRC,;t t +s, at LLVM_OBJ@,$LLVM_OBJ,;t t s, at JAVA@,$JAVA,;t t s, at JAVAC@,$JAVAC,;t t s, at JAVAH@,$JAVAH,;t t -s, at LLVM_SRC@,$LLVM_SRC,;t t -s, at LLVM_OBJ@,$LLVM_OBJ,;t t s, at LIBOBJS@,$LIBOBJS,;t t s, at LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -2510,19 +2502,32 @@ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in - Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - lib/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - lib/ClassFile/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/ClassFile/Makefile lib/ClassFile/Makefile ;; - test/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; - test/Makefile.test ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Makefile.test test/Makefile.test ;; - test/Programs/SingleSource/UnitTests/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/UnitTests/Makefile test/Programs/SingleSource/UnitTests/Makefile ;; - test/Programs/SingleSource/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile test/Programs/SingleSource/Makefile ;; - test/Programs/SingleSource/Makefile.singlesrc ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile.singlesrc test/Programs/SingleSource/Makefile.singlesrc ;; - test/Programs/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/Makefile test/Programs/Makefile ;; - test/Regression/ClassFile/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Regression/ClassFile/Makefile test/Regression/ClassFile/Makefile ;; - test/Regression/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Regression/Makefile test/Regression/Makefile ;; - tools/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; - tools/classdump/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/classdump/Makefile tools/classdump/Makefile ;; + Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + lib/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + lib/ClassFile/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/ClassFile/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/ClassFile/Makefile lib/ClassFile/Makefile ;; + test/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; + test/Makefile.test ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile.test` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile.test test/Makefile.test ;; + test/Programs/SingleSource/UnitTests/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/UnitTests/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/UnitTests/Makefile test/Programs/SingleSource/UnitTests/Makefile ;; + test/Programs/SingleSource/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile test/Programs/SingleSource/Makefile ;; + test/Programs/SingleSource/Makefile.singlesrc ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile.singlesrc` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile.singlesrc test/Programs/SingleSource/Makefile.singlesrc ;; + test/Programs/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Programs/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Programs/Makefile test/Programs/Makefile ;; + test/Regression/ClassFile/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Regression/ClassFile/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Regression/ClassFile/Makefile test/Regression/ClassFile/Makefile ;; + test/Regression/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Regression/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Regression/Makefile test/Regression/Makefile ;; + tools/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; + tools/classdump/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/classdump/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/classdump/Makefile tools/classdump/Makefile ;; esac done _ACEOF From alkis at cs.uiuc.edu Thu Feb 24 22:21:04 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 24 Feb 2005 22:21:04 -0600 Subject: [llvm-commits] CVS: llvm-java/autoconf/configure.ac mkinstalldirs ltmain.sh install-sh Makefile Message-ID: <200502250421.WAA07034@zion.cs.uiuc.edu> Changes in directory llvm-java/autoconf: configure.ac updated: 1.11 -> 1.12 mkinstalldirs (r1.1) removed ltmain.sh (r1.1) removed install-sh (r1.1) removed Makefile (r1.1) removed --- Log message: Adapt to new project build structure. --- Diffs of the changes: (+13 -21) configure.ac | 34 +++++++++++++--------------------- 1 files changed, 13 insertions(+), 21 deletions(-) Index: llvm-java/autoconf/configure.ac diff -u llvm-java/autoconf/configure.ac:1.11 llvm-java/autoconf/configure.ac:1.12 --- llvm-java/autoconf/configure.ac:1.11 Wed Dec 8 00:37:37 2004 +++ llvm-java/autoconf/configure.ac Thu Feb 24 22:20:53 2005 @@ -3,14 +3,22 @@ dnl ************************************************************************** AC_INIT([[Java]], [[0.0]], [llvmbugs at cs.uiuc.edu]) -dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR([autoconf]) +dnl Tell autoconf that the auxilliary files are actually located in +dnl the LLVM autoconf directory, not here. +AC_CONFIG_AUX_DIR([../../autoconf]) + +dnl Tell autoconf that this is an LLVM project being configured +dnl This provides the --with-llvmsrc and --with-llvmobj options +LLVM_CONFIG_PROJECT -dnl Configure a header file +dnl Verify that the source directory is valid +AC_CONFIG_SRCDIR([Makefile.common.in]) -dnl Configure Makefiles -dnl List every Makefile that exists within your source tree +dnl Configure a common Makefile +AC_CONFIG_FILES(Makefile.common) +dnl Configure project makefiles +dnl List every Makefile that exists within your source tree AC_CONFIG_MAKEFILE([Makefile]) AC_CONFIG_MAKEFILE([lib/Makefile]) AC_CONFIG_MAKEFILE([lib/ClassFile/Makefile]) @@ -25,8 +33,6 @@ AC_CONFIG_MAKEFILE([tools/Makefile]) AC_CONFIG_MAKEFILE([tools/classdump/Makefile]) -AC_CONFIG_FILES(Makefile.common) - dnl ************************************************************************** dnl * Determine which system we are building on dnl ************************************************************************** @@ -83,20 +89,6 @@ dnl * Set the location of various third-party software packages dnl ************************************************************************** -dnl Location of LLVM source code -AC_ARG_WITH([llvmsrc], - AS_HELP_STRING([--with-llvmsrc], - [Location of LLVM Source Code]), - AC_SUBST(LLVM_SRC,$withval), - AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) - -dnl Location of LLVM object code -AC_ARG_WITH([llvmobj], - AS_HELP_STRING([--with-llvmobj], - [Location of LLVM Object Code]), - AC_SUBST(LLVM_OBJ,$withval), - AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) - dnl ************************************************************************** dnl * Create the output files dnl ************************************************************************** From alenhar2 at cs.uiuc.edu Thu Feb 24 22:28:29 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 24 Feb 2005 22:28:29 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/config/alpha/alpha.c Message-ID: <200502250428.j1P4STsD030080@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc/config/alpha: alpha.c updated: 1.1.1.2 -> 1.2 --- Log message: make va_list be a pointer on alpha --- Diffs of the changes: (+5 -0) alpha.c | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm-gcc/gcc/config/alpha/alpha.c diff -u llvm-gcc/gcc/config/alpha/alpha.c:1.1.1.2 llvm-gcc/gcc/config/alpha/alpha.c:1.2 --- llvm-gcc/gcc/config/alpha/alpha.c:1.1.1.2 Tue Jan 13 10:49:40 2004 +++ llvm-gcc/gcc/config/alpha/alpha.c Thu Feb 24 22:28:13 2005 @@ -52,6 +52,7 @@ #include "langhooks.h" #include #include "cfglayout.h" +#include "llvm-out.h" /* Specify which cpu to schedule for. */ @@ -6091,6 +6092,10 @@ { tree base, ofs, record, type_decl; + /* ABUSE the ABI in a major way here */ + if (EMIT_LLVM) + return ptr_type_node; + if (TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK) return ptr_type_node; From lattner at cs.uiuc.edu Fri Feb 25 01:51:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 01:51:47 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502250751.j1P7plx3001503@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.27 -> 1.28 --- Log message: completely change how we decide what arguments to compress and how we represent the cache of precloned functions. This simplifies some things (e.g. gets rid of the special cases needed for passing null into functions), and is important for "future growth". This is needed in order to handle compression of pools that point to each other, and cases where a single pool in a caller maps to multiple pools in the callee. These cases aren't added yet though. --- Diffs of the changes: (+94 -85) PointerCompress.cpp | 179 +++++++++++++++++++++++++++------------------------- 1 files changed, 94 insertions(+), 85 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.27 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.28 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.27 Thu Feb 24 19:30:19 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Fri Feb 25 01:51:31 2005 @@ -86,7 +86,7 @@ /// ClonedFunctionMap - Every time we clone a function to compress its /// arguments, keep track of the clone and which arguments are compressed. - typedef std::pair > CloneID; + typedef std::pair > CloneID; std::map ClonedFunctionMap; /// ClonedFunctionInfoMap - This identifies the pool allocated function that @@ -117,7 +117,8 @@ } Function *GetFunctionClone(Function *F, - const std::vector &OpsToCompress); + std::set &PoolsToCompress, + PA::FuncInfo &FI, const DSGraph &CG); private: void InitializePoolLibraryFunctions(Module &M); @@ -460,6 +461,8 @@ void visitCallInst(CallInst &CI); void visitPoolInit(CallInst &CI); void visitPoolDestroy(CallInst &CI); + void visitPoolAlloc(CallInst &CI); + void visitPoolFree(CallInst &CI); void visitInstruction(Instruction &I) { #ifndef NDEBUG @@ -741,6 +744,30 @@ CI.eraseFromParent(); } +void InstructionRewriter::visitPoolAlloc(CallInst &CI) { + // Transform to poolalloc_pc if this is allocating from a compressed pool. + const CompressedPoolInfo *PI = getPoolInfo(&CI); + if (PI == 0) return; // Pool isn't compressed. + + std::vector Ops; + Ops.push_back(CI.getOperand(1)); + Ops.push_back(CI.getOperand(2)); + CallInst *NC = new CallInst(PtrComp.PoolAllocPC, Ops, CI.getName(), &CI); + setTransformedValue(CI, NC); +} + +void InstructionRewriter::visitPoolFree(CallInst &CI) { + // Transform to poolfree_pc if this is freeing from a compressed pool. + const CompressedPoolInfo *PI = getPoolInfo(CI.getOperand(2)); + if (PI == 0) return; // Pool isn't compressed. + + std::vector Ops; + Ops.push_back(CI.getOperand(1)); + Ops.push_back(getTransformedValue(CI.getOperand(2))); + new CallInst(PtrComp.PoolFreePC, Ops, "", &CI); + CI.eraseFromParent(); +} + void InstructionRewriter::visitCallInst(CallInst &CI) { if (Function *F = CI.getCalledFunction()) // These functions are handled specially. @@ -750,96 +777,71 @@ } else if (F->getName() == "pooldestroy") { visitPoolDestroy(CI); return; + } else if (F->getName() == "poolalloc") { + visitPoolAlloc(CI); + return; + } else if (F->getName() == "poolfree") { + visitPoolFree(CI); + return; } // Normal function call: check to see if this call produces or uses a pointer // into a compressed pool. If so, we will need to transform the callee or use - // a previously transformed version. For these purposes, we treat the return - // value as "operand #0". - std::vector OpsToCompress; + // a previously transformed version. + + // PoolsToCompress - Keep track of which pools we are supposed to compress, + // with the nodes from the callee's graph. + std::set PoolsToCompress; + + // If this is a direct call, get the information about the callee. + PA::FuncInfo *FI = 0; + const DSGraph *CG = 0; + if (Function *Callee = CI.getCalledFunction()) + if (FI = PtrComp.getPoolAlloc()->getFuncInfoOrClone(*Callee)) + CG = &PtrComp.getGraphForFunc(FI); // Do we need to compress the return value? if (isa(CI.getType()) && getNodeIfCompressed(&CI)) - OpsToCompress.push_back(0); + PoolsToCompress.insert(CG->getReturnNodeFor(FI->F).getNode()); - // Check to see if we need to compress any arguments, keeping track of any - // null pointers passed in. - std::vector NullArgs; + // Find the arguments we need to compress. + unsigned NumPoolArgs = FI ? FI->ArgNodes.size() : 0; for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) - if (isa(CI.getOperand(i)->getType())) - if (isa(CI.getOperand(i))) - NullArgs.push_back(i-1); - else if(getNodeIfCompressed(CI.getOperand(i))) - OpsToCompress.push_back(i); + if (isa(CI.getOperand(i)->getType()) && + getNodeIfCompressed(CI.getOperand(i))) { + Argument *FormalArg = next(FI->F.abegin(), i-1-NumPoolArgs); + PoolsToCompress.insert(CG->getNodeForValue(FormalArg).getNode()); + } // If this function doesn't require compression, there is nothing to do! - if (OpsToCompress.empty()) return; + if (PoolsToCompress.empty()) return; Function *Callee = CI.getCalledFunction(); assert(Callee && "Indirect calls not implemented yet!"); - // Null arguments do not have any pool information immediately available for - // them. Check the callee's graph to see if the formal argument points into a - // pool that we are compressing (because of some other argument or the ret - // value). If we need to compress the call argument, mark the null pointer to - // be compressed as well. - if (!NullArgs.empty()) { - PA::FuncInfo *FI = PtrComp.getPoolAlloc()->getFuncInfoOrClone(*Callee); - const DSGraph &CG = PtrComp.getGraphForFunc(FI); - unsigned NumPoolArgs = FI->ArgNodes.size(); - - std::set CompressedPools; - - // Mark all compressed argument nodes. - // FIXME: This will only work for one-level compressed pools. This will - // have to be generalized in the future. - for (unsigned i = 0, e = OpsToCompress.size(); i != e; ++i) { - DSNode *N; - if (OpsToCompress[i] == 0) - N = CG.getReturnNodeFor(FI->F).getNode(); - else { - Argument *OrigArg = next(FI->F.abegin(), OpsToCompress[i]-1); - assert(isa(OrigArg->getType()) && "Something went wrong!"); - N = CG.getNodeForValue(OrigArg).getNode(); - } - CompressedPools.insert(N); - } - - // Now that we have marked the nodes that will already be compressed, check - // to see if the null arguments point to any of these nodes. - for (unsigned i = 0, e = NullArgs.size(); i != e; ++i) { - // Figure out what argument number it was in the unpoolallocated function. - unsigned ArgNo = NullArgs[i]-NumPoolArgs; - Argument *OrigArg = next(FI->F.abegin(), ArgNo); - assert(isa(OrigArg->getType()) && "Something went wrong!"); - DSNode *N = CG.getNodeForValue(OrigArg).getNode(); - if (N && CompressedPools.count(N)) - OpsToCompress.push_back(NullArgs[i]+1); - } - - // Make sure this vector stays sorted. - std::sort(OpsToCompress.begin(), OpsToCompress.end()); - } - // Get the clone of this function that uses compressed pointers instead of // normal pointers. - Function *Clone = PtrComp.GetFunctionClone(Callee, OpsToCompress); + Function *Clone = PtrComp.GetFunctionClone(Callee, PoolsToCompress, *FI, *CG); // Okay, we now have our clone: rewrite the call instruction. std::vector Operands; Operands.reserve(CI.getNumOperands()-1); - unsigned OTCIdx = OpsToCompress[0] == 0; // Skip ret value if present - for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) + Function::aiterator AI = FI->F.abegin(); + + // Pass pool descriptors. + for (unsigned i = 1; i != NumPoolArgs+1; ++i) + Operands.push_back(CI.getOperand(i)); + + for (unsigned i = NumPoolArgs+1, e = CI.getNumOperands(); i != e; ++i, ++AI) if (isa(CI.getOperand(i)->getType()) && - OTCIdx < OpsToCompress.size() && OpsToCompress[OTCIdx] == i) { + PoolsToCompress.count(CG->getNodeForValue(AI).getNode())) { Operands.push_back(getTransformedValue(CI.getOperand(i))); - ++OTCIdx; } else { Operands.push_back(CI.getOperand(i)); } Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); - if (OpsToCompress[0] == 0) // Compressing return value? + if (NC->getType() != CI.getType()) // Compressing return value? setTransformedValue(CI, NC); else { if (CI.getType() != Type::VoidTy) { @@ -955,29 +957,36 @@ /// need in compressed form. This memoizes the functions that have been cloned /// to allow only one clone of each function in a desired permutation. Function *PointerCompress:: -GetFunctionClone(Function *F, const std::vector &OpsToCompress) { - assert(!OpsToCompress.empty() && "No clone needed!"); +GetFunctionClone(Function *F, std::set &PoolsToCompress, + PA::FuncInfo &FI, const DSGraph &CG) { + assert(!PoolsToCompress.empty() && "No clone needed!"); // Check to see if we have already compressed this function, if so, there is // no need to make another clone. This is also important to avoid infinite // recursion. - Function *&Clone = ClonedFunctionMap[std::make_pair(F, OpsToCompress)]; + Function *&Clone = ClonedFunctionMap[std::make_pair(F, PoolsToCompress)]; if (Clone) return Clone; // First step, construct the new function prototype. const FunctionType *FTy = F->getFunctionType(); const Type *RetTy = FTy->getReturnType(); - unsigned OTCIdx = 0; - if (OpsToCompress[0] == 0) { + if (isa(RetTy) && + PoolsToCompress.count(CG.getReturnNodeFor(FI.F).getNode())) { RetTy = SCALARUINTTYPE; - OTCIdx++; } std::vector ParamTypes; - for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) - if (OTCIdx != OpsToCompress.size() && OpsToCompress[OTCIdx] == i+1) { - assert(isa(FTy->getParamType(i)) && "Not a pointer?"); + unsigned NumPoolArgs = FI.ArgNodes.size(); + + // Pass all pool args unmodified. + for (unsigned i = 0; i != NumPoolArgs; ++i) + ParamTypes.push_back(FTy->getParamType(i)); + + Function::aiterator AI = FI.F.abegin(); + for (unsigned i = NumPoolArgs, e = FTy->getNumParams(); i != e; ++i, ++AI) + if (isa(FTy->getParamType(i)) && + PoolsToCompress.count(CG.getNodeForValue(AI).getNode())) { + // Compressed pool, pass an index. ParamTypes.push_back(SCALARUINTTYPE); - ++OTCIdx; } else { ParamTypes.push_back(FTy->getParamType(i)); } @@ -1037,11 +1046,20 @@ for (std::map::iterator I = ValueMap.begin(), E = ValueMap.end(); I != E; ++I) NewToOldValueMap.insert(std::make_pair(I->second, I->first)); + + +#if 0 + /// computeNodeMapping - Given roots in two different DSGraphs, traverse the + /// nodes reachable from the two graphs, computing the mapping of nodes from + /// the first to the second graph. + /// + static void computeNodeMapping(const DSNodeHandle &NH1, + const DSNodeHandle &NH2, NodeMapTy &NodeMap); +#endif // Compute the PoolDescriptors map for the cloned function. - PA::FuncInfo *FI = PoolAlloc->getFuncInfoOrClone(*F); for (std::map::iterator I = - FI->PoolDescriptors.begin(), E = FI->PoolDescriptors.end(); + FI.PoolDescriptors.begin(), E = FI.PoolDescriptors.end(); I != E; ++I) CFI.PoolDescriptors[I->first] = ValueMap[I->second]; @@ -1069,15 +1087,6 @@ PoolFreePC = M.getOrInsertFunction("poolfree_pc", Type::VoidTy, PoolDescPtrTy, SCALARUINTTYPE, 0); // FIXME: Need bumppointer versions as well as realloc??/memalign?? - - // PoolAllocPC/PoolFreePC can be handled just like any other compressed - // functions. - std::vector Ops; - Ops.push_back(0); // poolalloc -> compress return value. - ClonedFunctionMap[std::make_pair(PoolAlloc->PoolAlloc, Ops)] = PoolAllocPC; - - Ops[0] = 2; // Pool free -> compress second argument. - ClonedFunctionMap[std::make_pair(PoolAlloc->PoolFree, Ops)] = PoolFreePC; } bool PointerCompress::runOnModule(Module &M) { From lattner at cs.uiuc.edu Fri Feb 25 14:30:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 14:30:36 -0600 Subject: [llvm-commits] CVS: llvm/docs/FAQ.html Message-ID: <200502252030.j1PKUaSu005004@apoc.cs.uiuc.edu> Changes in directory llvm/docs: FAQ.html updated: 1.28 -> 1.29 --- Log message: add an entry, add links to entries for demo page. --- Diffs of the changes: (+54 -28) FAQ.html | 82 +++++++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 54 insertions(+), 28 deletions(-) Index: llvm/docs/FAQ.html diff -u llvm/docs/FAQ.html:1.28 llvm/docs/FAQ.html:1.29 --- llvm/docs/FAQ.html:1.28 Tue Dec 14 18:14:01 2004 +++ llvm/docs/FAQ.html Fri Feb 25 14:30:21 2005 @@ -72,12 +72,13 @@
  • Questions about code generated by the GCC front-end
      -
    1. What is this __main() call that gets inserted into - main()?
    2. -
    3. Where did all of my code go??
    4. -
    5. What is this llvm.global_ctors and +
    6. What is this __main() call that gets inserted into + main()?
    7. +
    8. What is this llvm.global_ctors and _GLOBAL__I__tmp_webcompile... stuff that happens when I - #include <iostream>?
    9. + #include <iostream>? +
    10. Where did all of my code go??
    11. +
    12. What is this "undef" thing that shows up in my code?
  • @@ -448,6 +449,7 @@

    + What is this __main() call that gets inserted into main()?

    @@ -469,29 +471,8 @@ -

    -Where did all of my code go?? -

    - -
    -

    -If you are using the LLVM demo page, you may often wonder what happened to all -of the code that you typed in. Remember that the demo script is running the -code through the LLVM optimizers, so if your code doesn't actually do anything -useful, it might all be deleted. -

    - -

    -To prevent this, make sure that the code is actually needed. For example, if -you are computing some expression, return the value from the function instead of -leaving it in a local variable. If you really want to constrain the optimizer, -you can read from and assign to volatile global variables. -

    -
    - - -
    +

    What is this llvm.global_ctors and _GLOBAL__I__tmp_webcompile... stuff that happens when I #include <iostream>?

    @@ -520,6 +501,51 @@
    + + +

    + +Where did all of my code go?? +

    + +
    +

    +If you are using the LLVM demo page, you may often wonder what happened to all +of the code that you typed in. Remember that the demo script is running the +code through the LLVM optimizers, so if your code doesn't actually do anything +useful, it might all be deleted. +

    + +

    +To prevent this, make sure that the code is actually needed. For example, if +you are computing some expression, return the value from the function instead of +leaving it in a local variable. If you really want to constrain the optimizer, +you can read from and assign to volatile global variables. +

    +
    + + + +

    + +

    What is this "undef" thing that shows up in my code? +

    + +
    +

    +undef is the LLVM way of representing +a value that is not defined. You can get these if you do not initialize a +variable before you use it. For example, the C function:

    + +
    + int X() { int i; return i; } +
    + +

    Is compiled to "ret int undef" because "i" never has a value +specified for it. +

    +
    +
    @@ -530,7 +556,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/12/15 00:14:01 $ + Last modified: $Date: 2005/02/25 20:30:21 $ From lattner at cs.uiuc.edu Fri Feb 25 14:35:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 14:35:15 -0600 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200502252035.j1PKZFbH005038@apoc.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.38 -> 1.39 --- Log message: Add symlinks from the generated code to the FAQ for various items --- Diffs of the changes: (+8 -3) index.cgi | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.38 llvm-www/demo/index.cgi:1.39 --- llvm-www/demo/index.cgi:1.38 Thu Feb 3 10:32:26 2005 +++ llvm-www/demo/index.cgi Fri Feb 25 14:35:02 2005 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2005/02/03 16:32:26 $ +# Last modified $Date: 2005/02/25 20:35:02 $ # use strict; @@ -95,6 +95,11 @@ my ($input) = @_; $input =~ s@\b(void|bool|sbyte|ubyte|short|ushort|int|uint|long|ulong|float|double|type|label|opaque)\b@$1@g; $input =~ s@\b(add|sub|mul|div|rem|and|or|xor|setne|seteq|setlt|setgt|setle|setge|phi|call|cast|to|shl|shr|vaarg|vanext|ret|br|switch|invoke|unwind|malloc|alloca|free|load|store|getelementptr|begin|end|true|false|declare|global|constant|const|internal|uninitialized|external|implementation|linkonce|weak|appending|null|to|except|not|target|endian|pointersize|big|little|volatile)\b@$1@g; + + # Add links to the FAQ. + $input =~ s@(_ZNSt8ios_base4Init[DC]1Ev)@$1@g; + $input =~ s@%__main@%__main@g; + $input =~ s@\bundef\b@undef@g; return $input; } @@ -226,8 +231,8 @@ print "

    ", $c->submit, "\n", $c->endform; print "\n

    If you have questions about the LLVM code generated by the -front-end, please check the FAQ (e.g., -what is this __main thing?). If the FAQ does not address it, please +front-end, please check the FAQ. + If the FAQ does not address it, please send an email to the llvmdev mailing list.

    \n

    Note that the generated LLVM code will be easier to read if From lattner at cs.uiuc.edu Fri Feb 25 14:36:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 14:36:31 -0600 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200502252036.j1PKaV4c005062@apoc.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.39 -> 1.40 --- Log message: fix link to faq --- Diffs of the changes: (+4 -4) index.cgi | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.39 llvm-www/demo/index.cgi:1.40 --- llvm-www/demo/index.cgi:1.39 Fri Feb 25 14:35:02 2005 +++ llvm-www/demo/index.cgi Fri Feb 25 14:36:18 2005 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2005/02/25 20:35:02 $ +# Last modified $Date: 2005/02/25 20:36:18 $ # use strict; @@ -97,9 +97,9 @@ $input =~ s@\b(add|sub|mul|div|rem|and|or|xor|setne|seteq|setlt|setgt|setle|setge|phi|call|cast|to|shl|shr|vaarg|vanext|ret|br|switch|invoke|unwind|malloc|alloca|free|load|store|getelementptr|begin|end|true|false|declare|global|constant|const|internal|uninitialized|external|implementation|linkonce|weak|appending|null|to|except|not|target|endian|pointersize|big|little|volatile)\b@$1@g; # Add links to the FAQ. - $input =~ s@(_ZNSt8ios_base4Init[DC]1Ev)@$1@g; - $input =~ s@%__main@%__main@g; - $input =~ s@\bundef\b@undef@g; + $input =~ s@(_ZNSt8ios_base4Init[DC]1Ev)@$1@g; + $input =~ s@%__main@%__main@g; + $input =~ s@\bundef\b@undef@g; return $input; } From lattner at cs.uiuc.edu Fri Feb 25 15:01:27 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 15:01:27 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200502252101.j1PL1RXl005961@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PoolAllocate.cpp updated: 1.104 -> 1.105 --- Log message: remove obsolete comments --- Diffs of the changes: (+1 -5) PoolAllocate.cpp | 6 +----- 1 files changed, 1 insertion(+), 5 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.104 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.105 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.104 Tue Feb 15 12:52:51 2005 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Fri Feb 25 15:01:14 2005 @@ -52,11 +52,7 @@ const Type *VoidPtrTy; - // The type to allocate for a pool descriptor: { sbyte*, uint, uint } - // void *Data (the data) - // unsigned NodeSize (size of an allocated node) - // unsigned FreeablePool (are slabs in the pool freeable upon calls to - // poolfree?) + // The type to allocate for a pool descriptor. const Type *PoolDescType; cl::opt From lattner at cs.uiuc.edu Fri Feb 25 15:02:20 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 15:02:20 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502252102.j1PL2KfJ005977@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.28 -> 1.29 --- Log message: initial support for pools that point to other pools. --- Diffs of the changes: (+44 -10) PointerCompress.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 44 insertions(+), 10 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.28 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.29 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.28 Fri Feb 25 01:51:31 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Fri Feb 25 15:02:07 2005 @@ -248,7 +248,8 @@ return false; } - // If this has no pointer fields, don't compress. + // FIXME: If any non-type-safe nodes point to this one, we cannot compress it. +#if 0 bool HasFields = false; for (DSNode::const_edge_iterator I = N->edge_begin(), E = N->edge_end(); I != E; ++I) @@ -265,6 +266,7 @@ DEBUG(std::cerr << "Node does not contain any pointers to compress:\n"); return false; } +#endif if (N->isArray()) { DEBUG(std::cerr << "Node is an array (not yet handled!):\n"); @@ -377,12 +379,11 @@ EV = New; } - /// getNodeIfCompressed - If the specified value is a pointer that will be - /// compressed, return the DSNode corresponding to the pool it belongs to. - const DSNode *getNodeIfCompressed(Value *V) { - if (!isa(V->getType()) || isa(V) || - isa(V)) - return false; + /// getMappedNodeHandle - Given a pointer value that may be cloned multiple + /// times (once for PA, once for PC) return the node handle in DSG, or a + /// null descriptor if the value didn't exist. + DSNodeHandle getMappedNodeHandle(Value *V) { + assert(isa(V->getType()) && "Not a pointer value!"); // If this is a function clone, map the value to the original function. if (FCR) @@ -392,9 +393,20 @@ // function. if (!PAFuncInfo.NewToOldValueMap.empty()) if ((V = PAFuncInfo.MapValueToOriginal(V)) == 0) - return 0; // Value didn't exist in the orig program (pool desc?) + // Value didn't exist in the orig program (pool desc?). + return DSNodeHandle(); + + return DSG.getNodeForValue(V); + } - DSNode *N = DSG.getNodeForValue(V).getNode(); + /// getNodeIfCompressed - If the specified value is a pointer that will be + /// compressed, return the DSNode corresponding to the pool it belongs to. + const DSNode *getNodeIfCompressed(Value *V) { + if (!isa(V->getType()) || isa(V) || + isa(V)) + return false; + + DSNode *N = getMappedNodeHandle(V).getNode(); return PoolInfo.count(N) ? N : 0; } @@ -800,9 +812,15 @@ if (FI = PtrComp.getPoolAlloc()->getFuncInfoOrClone(*Callee)) CG = &PtrComp.getGraphForFunc(FI); + // CalleeCallerMap - Mapping from nodes in the callee to nodes in the caller. + DSGraph::NodeMapTy CalleeCallerMap; + // Do we need to compress the return value? - if (isa(CI.getType()) && getNodeIfCompressed(&CI)) + if (isa(CI.getType()) && getNodeIfCompressed(&CI)) { + DSGraph::computeNodeMapping(CG->getReturnNodeFor(FI->F), + getMappedNodeHandle(&CI), CalleeCallerMap); PoolsToCompress.insert(CG->getReturnNodeFor(FI->F).getNode()); + } // Find the arguments we need to compress. unsigned NumPoolArgs = FI ? FI->ArgNodes.size() : 0; @@ -810,6 +828,11 @@ if (isa(CI.getOperand(i)->getType()) && getNodeIfCompressed(CI.getOperand(i))) { Argument *FormalArg = next(FI->F.abegin(), i-1-NumPoolArgs); + + DSGraph::computeNodeMapping(CG->getNodeForValue(FormalArg), + getMappedNodeHandle(CI.getOperand(i)), + CalleeCallerMap); + PoolsToCompress.insert(CG->getNodeForValue(FormalArg).getNode()); } @@ -818,6 +841,17 @@ Function *Callee = CI.getCalledFunction(); assert(Callee && "Indirect calls not implemented yet!"); + // Now that we know the basic pools passed/returned through the + // argument/retval of the call, add the compressed pools that are reachable + // from them. The CalleeCallerMap contains a mapping from callee nodes to the + // caller nodes they correspond to (a many-to-one mapping). + for (DSGraph::NodeMapTy::iterator I = CalleeCallerMap.begin(), + E = CalleeCallerMap.end(); I != E; ++I) { + // If the destination is compressed, so should the source be. + if (PoolInfo.count(I->second.getNode())) + PoolsToCompress.insert(I->first); + } + // Get the clone of this function that uses compressed pointers instead of // normal pointers. Function *Clone = PtrComp.GetFunctionClone(Callee, PoolsToCompress, *FI, *CG); From lattner at cs.uiuc.edu Fri Feb 25 15:14:25 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 15:14:25 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502252114.j1PLEP8T006516@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.29 -> 1.30 --- Log message: switch a vector to a set, no functionality changes. --- Diffs of the changes: (+19 -20) PointerCompress.cpp | 39 +++++++++++++++++++-------------------- 1 files changed, 19 insertions(+), 20 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.29 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.30 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.29 Fri Feb 25 15:02:07 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Fri Feb 25 15:14:12 2005 @@ -126,7 +126,7 @@ std::vector > *PremappedVals = 0); - void FindPoolsToCompress(std::vector &Pools, Function &F, + void FindPoolsToCompress(std::set &Pools, Function &F, DSGraph &DSG, PA::FuncInfo *FI); }; @@ -283,8 +283,8 @@ /// FindPoolsToCompress - Inspect the specified function and find pools that are /// compressible that are homed in that function. Return those pools in the -/// Pools vector. -void PointerCompress::FindPoolsToCompress(std::vector &Pools, +/// Pools set. +void PointerCompress::FindPoolsToCompress(std::set &Pools, Function &F, DSGraph &DSG, PA::FuncInfo *FI) { DEBUG(std::cerr << "In function '" << F.getName() << "':\n"); @@ -292,7 +292,7 @@ const DSNode *N = FI->NodesToPA[i]; if (PoolIsCompressible(N, F)) { - Pools.push_back(N); + Pools.insert(N); ++NumCompressed; } else { DEBUG(std::cerr << "PCF: "; N->dump()); @@ -925,11 +925,11 @@ // Get the DSGraph for this function. DSGraph &DSG = ECG->getDSGraph(FI->F); - std::vector PoolsToCompressList; + std::set PoolsToCompressSet; // Compute the set of compressible pools in this function that are hosted // here. - FindPoolsToCompress(PoolsToCompressList, F, DSG, FI); + FindPoolsToCompress(PoolsToCompressSet, F, DSG, FI); // Handle pools that are passed into the function through arguments or // returned by the function. If this occurs, we must be dealing with a ptr @@ -937,34 +937,33 @@ if (FCR) { // Compressed the return value? if (F.getReturnType() != FCR->PAFn->getReturnType()) - PoolsToCompressList.push_back(DSG.getReturnNodeFor(FI->F).getNode()); + PoolsToCompressSet.insert(DSG.getReturnNodeFor(FI->F).getNode()); for (Function::aiterator CI = F.abegin(), OI = CloneSource->abegin(), E = F.aend(); CI != E; ++CI, ++OI) if (CI->getType() != OI->getType()) { // Compressed this argument? Value *OrigVal = FI->MapValueToOriginal(OI); - PoolsToCompressList.push_back(DSG.getNodeForValue(OrigVal).getNode()); + PoolsToCompressSet.insert(DSG.getNodeForValue(OrigVal).getNode()); } } // If there is nothing that we can compress, exit now. - if (PoolsToCompressList.empty()) return false; + if (PoolsToCompressSet.empty()) return false; // Compute the initial collection of compressed pointer infos. std::map PoolsToCompress; - for (unsigned i = 0, e = PoolsToCompressList.size(); i != e; ++i) - if (PoolsToCompress.count(PoolsToCompressList[i]) == 0) { - const DSNode *N = PoolsToCompressList[i]; - Value *PD; - if (FCR) - PD = FCR->PoolDescriptors.find(N)->second; - else - PD = FI->PoolDescriptors[N]; - assert(PD && "No pool descriptor available for this pool???"); + for (std::set::iterator I = PoolsToCompressSet.begin(), + E = PoolsToCompressSet.end(); I != E; ++I) { + Value *PD; + if (FCR) + PD = FCR->PoolDescriptors.find(*I)->second; + else + PD = FI->PoolDescriptors[*I]; + assert(PD && "No pool descriptor available for this pool???"); - PoolsToCompress.insert(std::make_pair(N, CompressedPoolInfo(N, PD))); - } + PoolsToCompress.insert(std::make_pair(*I, CompressedPoolInfo(*I, PD))); + } // Use these to compute the closure of compression information. In // particular, if one pool points to another, we need to know if the outgoing From alenhar2 at cs.uiuc.edu Fri Feb 25 16:55:31 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 25 Feb 2005 16:55:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502252255.j1PMtVvV007592@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.6 -> 1.7 AlphaISelPattern.cpp updated: 1.56 -> 1.57 AlphaInstrInfo.td updated: 1.25 -> 1.26 --- Log message: make BB labels be exported for debuging, add fp negation optimization, further pecimise the FP instructions --- Diffs of the changes: (+61 -30) AlphaAsmPrinter.cpp | 8 +++--- AlphaISelPattern.cpp | 64 +++++++++++++++++++++++++++++++++++++-------------- AlphaInstrInfo.td | 19 +++++++-------- 3 files changed, 61 insertions(+), 30 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.6 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.7 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.6 Fri Feb 4 08:09:38 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Fri Feb 25 16:55:15 2005 @@ -119,7 +119,7 @@ case MachineOperand::MO_MachineBasicBlock: { MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); - O << "$LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) + O << "LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) << "_" << MBBOp->getNumber() << "\t" << CommentString << " " << MBBOp->getBasicBlock()->getName(); return; @@ -169,7 +169,7 @@ // Print out labels for the function. O << "\t.text\n"; - emitAlignment(4); + emitAlignment(3); O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.ent\t" << CurrentFnName << "\n"; @@ -179,7 +179,7 @@ for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); I != E; ++I) { // Print a label for the basic block. - O << "$LBB" << CurrentFnName << "_" << I->getNumber() << ":\t" + O << "LBB" << CurrentFnName << "_" << I->getNumber() << ":\t" << CommentString << " " << I->getBasicBlock()->getName() << "\n"; for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); II != E; ++II) { @@ -190,7 +190,7 @@ } ++LabelNumber; - O << "\t.end\t" << CurrentFnName << "\n"; + O << "\t.end " << CurrentFnName << "\n"; // We didn't modify anything. return false; Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.56 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.57 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.56 Wed Feb 23 11:33:42 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Fri Feb 25 16:55:15 2005 @@ -447,19 +447,38 @@ //a = b: c = 0 //a < b: c < 0 //a > b: c > 0 - unsigned Tmp1 = SelectExpr(SetCC->getOperand(0)); - unsigned Tmp2 = SelectExpr(SetCC->getOperand(1)); - unsigned Tmp3 = MakeReg(MVT::f64); - BuildMI(BB, Alpha::SUBT, 2, Tmp3).addReg(Tmp1).addReg(Tmp2); + + bool invTest = false; + unsigned Tmp3; + + ConstantFPSDNode *CN; + if ((CN = dyn_cast(SetCC->getOperand(1))) + && (CN->isExactlyValue(+0.0) || CN->isExactlyValue(-0.0))) + Tmp3 = SelectExpr(SetCC->getOperand(0)); + else if ((CN = dyn_cast(SetCC->getOperand(0))) + && (CN->isExactlyValue(+0.0) || CN->isExactlyValue(-0.0))) + { + Tmp3 = SelectExpr(SetCC->getOperand(1)); + invTest = true; + } + else + { + unsigned Tmp1 = SelectExpr(SetCC->getOperand(0)); + unsigned Tmp2 = SelectExpr(SetCC->getOperand(1)); + bool isD = SetCC->getOperand(0).getValueType() == MVT::f64; + Tmp3 = MakeReg(isD ? MVT::f64 : MVT::f32); + BuildMI(BB, isD ? Alpha::SUBT : Alpha::SUBS, 2, Tmp3) + .addReg(Tmp1).addReg(Tmp2); + } switch (SetCC->getCondition()) { default: CC.Val->dump(); assert(0 && "Unknown FP comparison!"); - case ISD::SETEQ: Opc = Alpha::FBEQ; break; - case ISD::SETLT: Opc = Alpha::FBLT; break; - case ISD::SETLE: Opc = Alpha::FBLE; break; - case ISD::SETGT: Opc = Alpha::FBGT; break; - case ISD::SETGE: Opc = Alpha::FBGE; break; - case ISD::SETNE: Opc = Alpha::FBNE; break; + case ISD::SETEQ: Opc = invTest ? Alpha::FBNE : Alpha::FBEQ; break; + case ISD::SETLT: Opc = invTest ? Alpha::FBGT : Alpha::FBLT; break; + case ISD::SETLE: Opc = invTest ? Alpha::FBGE : Alpha::FBLE; break; + case ISD::SETGT: Opc = invTest ? Alpha::FBLT : Alpha::FBGT; break; + case ISD::SETGE: Opc = invTest ? Alpha::FBLE : Alpha::FBGE; break; + case ISD::SETNE: Opc = invTest ? Alpha::FBEQ : Alpha::FBNE; break; } BuildMI(BB, Opc, 2).addReg(Tmp3).addMBB(Dest); return; @@ -598,9 +617,19 @@ case ISD::SUB: Opc = DestType == MVT::f64 ? Alpha::SUBT : Alpha::SUBS; break; case ISD::SDIV: Opc = DestType == MVT::f64 ? Alpha::DIVT : Alpha::DIVS; break; }; - Tmp1 = SelectExpr(N.getOperand(0)); - Tmp2 = SelectExpr(N.getOperand(1)); - BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + + ConstantFPSDNode *CN; + if (opcode == ISD::SUB + && (CN = dyn_cast(N.getOperand(0))) + && (CN->isExactlyValue(+0.0) || CN->isExactlyValue(-0.0))) + { + Tmp2 = SelectExpr(N.getOperand(1)); + BuildMI(BB, Alpha::CPYSN, 2, Result).addReg(Tmp2).addReg(Tmp2); + } else { + Tmp1 = SelectExpr(N.getOperand(0)); + Tmp2 = SelectExpr(N.getOperand(1)); + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + } return Result; case ISD::EXTLOAD: @@ -1301,13 +1330,14 @@ // special calling conventions //Restore GP because it is a call after all... switch(opcode) { - case ISD::UREM: AlphaLowering.restoreGP(BB); Opc = Alpha::REMQU; break; - case ISD::SREM: AlphaLowering.restoreGP(BB); Opc = Alpha::REMQ; break; - case ISD::UDIV: AlphaLowering.restoreGP(BB); Opc = Alpha::DIVQU; break; - case ISD::SDIV: AlphaLowering.restoreGP(BB); Opc = Alpha::DIVQ; break; + case ISD::UREM: Opc = Alpha::REMQU; break; + case ISD::SREM: Opc = Alpha::REMQ; break; + case ISD::UDIV: Opc = Alpha::DIVQU; break; + case ISD::SDIV: Opc = Alpha::DIVQ; break; } Tmp1 = SelectExpr(N.getOperand(0)); Tmp2 = SelectExpr(N.getOperand(1)); + AlphaLowering.restoreGP(BB); BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); return Result; Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.25 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.26 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.25 Sat Feb 12 15:10:58 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Fri Feb 25 16:55:15 2005 @@ -25,7 +25,7 @@ def s64imm : Operand; def PHI : PseudoInstAlpha<(ops ), "#phi">; -def IDEF : PseudoInstAlpha<(ops ), "#idef">; +def IDEF : PseudoInstAlpha<(ops GPRC:$RA), "#idef $RA">; def WTF : PseudoInstAlpha<(ops ), "#wtf">; def ADJUSTSTACKUP : PseudoInstAlpha<(ops ), "ADJUP">; def ADJUSTSTACKDOWN : PseudoInstAlpha<(ops ), "ADJDOWN">; @@ -337,18 +337,19 @@ def CPYSN : FPForm<0x17, 0x021, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "cpysn $RA,$RB,$RC">; //Copy sign negate //Basic Floating point ops -def ADDS : FPForm<0x16, 0x080, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "adds $RA,$RB,$RC">; //Add S_floating -def ADDT : FPForm<0x16, 0x0A0, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "addt $RA,$RB,$RC">; //Add T_floating -def SUBS : FPForm<0x16, 0x081, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "subs $RA,$RB,$RC">; //Subtract S_floating -def SUBT : FPForm<0x16, 0x0A1, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "subt $RA,$RB,$RC">; //Subtract T_floating -def DIVS : FPForm<0x16, 0x083, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "divs $RA,$RB,$RC">; //Divide S_floating -def DIVT : FPForm<0x16, 0x0A3, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "divt $RA,$RB,$RC">; //Divide T_floating -def MULS : FPForm<0x16, 0x082, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "muls $RA,$RB,$RC">; //Multiply S_floating -def MULT : FPForm<0x16, 0x0A2, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "mult $RA,$RB,$RC">; //Multiply T_floating +def ADDS : FPForm<0x16, 0x080, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "adds/sui $RA,$RB,$RC">; //Add S_floating +def ADDT : FPForm<0x16, 0x0A0, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "addt/sui $RA,$RB,$RC">; //Add T_floating +def SUBS : FPForm<0x16, 0x081, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "subs/sui $RA,$RB,$RC">; //Subtract S_floating +def SUBT : FPForm<0x16, 0x0A1, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "subt/sui $RA,$RB,$RC">; //Subtract T_floating +def DIVS : FPForm<0x16, 0x083, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "divs/sui $RA,$RB,$RC">; //Divide S_floating +def DIVT : FPForm<0x16, 0x0A3, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "divt/sui $RA,$RB,$RC">; //Divide T_floating +def MULS : FPForm<0x16, 0x082, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "muls/sui $RA,$RB,$RC">; //Multiply S_floating +def MULT : FPForm<0x16, 0x0A2, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "mult/sui $RA,$RB,$RC">; //Multiply T_floating def SQRTS : FPForm<0x14, 0x08B, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "sqrts $RA,$RB,$RC">; //Square root S_floating def SQRTT : FPForm<0x14, 0x0AB, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "sqrtt $RA,$RB,$RC">; //Square root T_floating //INT reg to FP reg and back again +//not supported on 21164 def FTOIS : FPForm<0x1C, 0x078, (ops FPRC:$RC, GPRC:$RA), "ftois $RA,$RC">; //Floating to integer move, S_floating def FTOIT : FPForm<0x1C, 0x070, (ops FPRC:$RC, GPRC:$RA), "ftoit $RA,$RC">; //Floating to integer move, T_floating def ITOFS : FPForm<0x14, 0x004, (ops FPRC:$RC, GPRC:$RA), "itofs $RA,$RC">; //Integer to floating move, S_floating From lattner at cs.uiuc.edu Fri Feb 25 18:48:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 25 Feb 2005 18:48:12 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502260048.j1Q0mCt0010916@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.30 -> 1.31 --- Log message: Implement general support for external function calls that are passed compressed pointers, restoring bugpoint tranquility. This also means we don't have to handle poolalloc/poolfree as a special case at all anymore. Implement initial continued support for passing dependent pools to functions. --- Diffs of the changes: (+110 -80) PointerCompress.cpp | 190 ++++++++++++++++++++++++++++++---------------------- 1 files changed, 110 insertions(+), 80 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.30 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.31 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.30 Fri Feb 25 15:14:12 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Fri Feb 25 18:47:56 2005 @@ -89,12 +89,15 @@ typedef std::pair > CloneID; std::map ClonedFunctionMap; + std::map >, + Function*> ExtCloneFunctionMap; + /// ClonedFunctionInfoMap - This identifies the pool allocated function that /// a clone came from. std::map ClonedFunctionInfoMap; public: - Function *PoolInitPC, *PoolDestroyPC, *PoolAllocPC, *PoolFreePC; + Function *PoolInitPC, *PoolDestroyPC; typedef std::map PoolInfoMap; bool runOnModule(Module &M); @@ -119,12 +122,14 @@ Function *GetFunctionClone(Function *F, std::set &PoolsToCompress, PA::FuncInfo &FI, const DSGraph &CG); + Function *GetExtFunctionClone(Function *F, + const std::vector &Args); private: void InitializePoolLibraryFunctions(Module &M); bool CompressPoolsInFunction(Function &F, - std::vector > *PremappedVals = 0); + std::vector > *PremappedVals = 0, + std::set *ExternalPoolsToCompress = 0); void FindPoolsToCompress(std::set &Pools, Function &F, DSGraph &DSG, PA::FuncInfo *FI); @@ -291,13 +296,16 @@ for (unsigned i = 0, e = FI->NodesToPA.size(); i != e; ++i) { const DSNode *N = FI->NodesToPA[i]; - if (PoolIsCompressible(N, F)) { - Pools.insert(N); - ++NumCompressed; - } else { - DEBUG(std::cerr << "PCF: "; N->dump()); - ++NumNotCompressed; - } + // Ignore potential pools that the pool allocation heuristic decided not to + // pool allocated. + if (!isa(FI->PoolDescriptors[N])) + if (PoolIsCompressible(N, F)) { + Pools.insert(N); + ++NumCompressed; + } else { + DEBUG(std::cerr << "PCF: "; N->dump()); + ++NumNotCompressed; + } } } @@ -473,8 +481,6 @@ void visitCallInst(CallInst &CI); void visitPoolInit(CallInst &CI); void visitPoolDestroy(CallInst &CI); - void visitPoolAlloc(CallInst &CI); - void visitPoolFree(CallInst &CI); void visitInstruction(Instruction &I) { #ifndef NDEBUG @@ -756,30 +762,6 @@ CI.eraseFromParent(); } -void InstructionRewriter::visitPoolAlloc(CallInst &CI) { - // Transform to poolalloc_pc if this is allocating from a compressed pool. - const CompressedPoolInfo *PI = getPoolInfo(&CI); - if (PI == 0) return; // Pool isn't compressed. - - std::vector Ops; - Ops.push_back(CI.getOperand(1)); - Ops.push_back(CI.getOperand(2)); - CallInst *NC = new CallInst(PtrComp.PoolAllocPC, Ops, CI.getName(), &CI); - setTransformedValue(CI, NC); -} - -void InstructionRewriter::visitPoolFree(CallInst &CI) { - // Transform to poolfree_pc if this is freeing from a compressed pool. - const CompressedPoolInfo *PI = getPoolInfo(CI.getOperand(2)); - if (PI == 0) return; // Pool isn't compressed. - - std::vector Ops; - Ops.push_back(CI.getOperand(1)); - Ops.push_back(getTransformedValue(CI.getOperand(2))); - new CallInst(PtrComp.PoolFreePC, Ops, "", &CI); - CI.eraseFromParent(); -} - void InstructionRewriter::visitCallInst(CallInst &CI) { if (Function *F = CI.getCalledFunction()) // These functions are handled specially. @@ -789,12 +771,6 @@ } else if (F->getName() == "pooldestroy") { visitPoolDestroy(CI); return; - } else if (F->getName() == "poolalloc") { - visitPoolAlloc(CI); - return; - } else if (F->getName() == "poolfree") { - visitPoolFree(CI); - return; } // Normal function call: check to see if this call produces or uses a pointer @@ -808,38 +784,77 @@ // If this is a direct call, get the information about the callee. PA::FuncInfo *FI = 0; const DSGraph *CG = 0; - if (Function *Callee = CI.getCalledFunction()) + Function *Callee = CI.getCalledFunction(); + if (Callee) if (FI = PtrComp.getPoolAlloc()->getFuncInfoOrClone(*Callee)) CG = &PtrComp.getGraphForFunc(FI); - // CalleeCallerMap - Mapping from nodes in the callee to nodes in the caller. - DSGraph::NodeMapTy CalleeCallerMap; + if (!Callee) { + // Indirect call: you CAN'T passed compress pointers in. Don't even think + // about it. + return; + } else if (Callee->isExternal()) { + // We don't have a DSG for the callee in this case. Assume that things will + // work out if we pass compressed pointers. + std::vector Operands; + Operands.reserve(CI.getNumOperands()-1); + + std::vector CompressedArgs; + if (isa(CI.getType()) && getPoolInfo(&CI)) + CompressedArgs.push_back(0); // Compress retval. + + for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) + if (isa(CI.getOperand(i)->getType()) && + getPoolInfo(CI.getOperand(i))) { + CompressedArgs.push_back(i); + Operands.push_back(getTransformedValue(CI.getOperand(i))); + } else { + Operands.push_back(CI.getOperand(i)); + } + + if (CompressedArgs.empty()) + return; // Nothing to compress! + Function *Clone = PtrComp.GetExtFunctionClone(Callee, CompressedArgs); + Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); + if (NC->getType() != CI.getType()) // Compressing return value? + setTransformedValue(CI, NC); + else { + if (CI.getType() != Type::VoidTy) { + CI.replaceAllUsesWith(NC); + ValueReplaced(CI, NC); + } + CI.eraseFromParent(); + } + return; + } + + // CalleeCallerMap: Mapping from nodes in the callee to nodes in the caller. + DSGraph::NodeMapTy CalleeCallerMap; + // Do we need to compress the return value? if (isa(CI.getType()) && getNodeIfCompressed(&CI)) { DSGraph::computeNodeMapping(CG->getReturnNodeFor(FI->F), getMappedNodeHandle(&CI), CalleeCallerMap); PoolsToCompress.insert(CG->getReturnNodeFor(FI->F).getNode()); } - + // Find the arguments we need to compress. unsigned NumPoolArgs = FI ? FI->ArgNodes.size() : 0; for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) if (isa(CI.getOperand(i)->getType()) && getNodeIfCompressed(CI.getOperand(i))) { Argument *FormalArg = next(FI->F.abegin(), i-1-NumPoolArgs); - + DSGraph::computeNodeMapping(CG->getNodeForValue(FormalArg), getMappedNodeHandle(CI.getOperand(i)), CalleeCallerMap); - + PoolsToCompress.insert(CG->getNodeForValue(FormalArg).getNode()); } // If this function doesn't require compression, there is nothing to do! if (PoolsToCompress.empty()) return; - Function *Callee = CI.getCalledFunction(); - assert(Callee && "Indirect calls not implemented yet!"); // Now that we know the basic pools passed/returned through the // argument/retval of the call, add the compressed pools that are reachable @@ -851,10 +866,12 @@ if (PoolInfo.count(I->second.getNode())) PoolsToCompress.insert(I->first); } - + // Get the clone of this function that uses compressed pointers instead of // normal pointers. - Function *Clone = PtrComp.GetFunctionClone(Callee, PoolsToCompress, *FI, *CG); + Function *Clone = PtrComp.GetFunctionClone(Callee, PoolsToCompress, + *FI, *CG); + // Okay, we now have our clone: rewrite the call instruction. std::vector Operands; @@ -891,7 +908,8 @@ /// function and compress them. bool PointerCompress:: CompressPoolsInFunction(Function &F, - std::vector > *PremappedVals){ + std::vector > *PremappedVals, + std::set *ExternalPoolsToCompress){ if (F.isExternal()) return false; // If this is a pointer compressed clone of a pool allocated function, get the @@ -934,18 +952,9 @@ // Handle pools that are passed into the function through arguments or // returned by the function. If this occurs, we must be dealing with a ptr // compressed clone of the pool allocated clone of the original function. - if (FCR) { - // Compressed the return value? - if (F.getReturnType() != FCR->PAFn->getReturnType()) - PoolsToCompressSet.insert(DSG.getReturnNodeFor(FI->F).getNode()); - - for (Function::aiterator CI = F.abegin(), OI = CloneSource->abegin(), - E = F.aend(); CI != E; ++CI, ++OI) - if (CI->getType() != OI->getType()) { // Compressed this argument? - Value *OrigVal = FI->MapValueToOriginal(OI); - PoolsToCompressSet.insert(DSG.getNodeForValue(OrigVal).getNode()); - } - } + if (ExternalPoolsToCompress) + PoolsToCompressSet.insert(ExternalPoolsToCompress->begin(), + ExternalPoolsToCompress->end()); // If there is nothing that we can compress, exit now. if (PoolsToCompressSet.empty()) return false; @@ -986,6 +995,41 @@ } +/// GetExtFunctionClone - Return a clone of the specified external function with +/// the specified arguments compressed. +Function *PointerCompress:: +GetExtFunctionClone(Function *F, const std::vector &ArgsToComp) { + assert(!ArgsToComp.empty() && "No reason to make a clone!"); + Function *&Clone = ExtCloneFunctionMap[std::make_pair(F, ArgsToComp)]; + if (Clone) return Clone; + + const FunctionType *FTy = F->getFunctionType(); + const Type *RetTy = FTy->getReturnType(); + unsigned ArgIdx = 0; + if (isa(RetTy) && ArgsToComp[0] == 0) { + RetTy = SCALARUINTTYPE; + ++ArgIdx; + } + + std::vector ParamTypes; + + for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) + if (ArgIdx < ArgsToComp.size() && ArgsToComp[ArgIdx]-1 == i) { + // Compressed pool, pass an index. + ParamTypes.push_back(SCALARUINTTYPE); + ++ArgIdx; + } else { + ParamTypes.push_back(FTy->getParamType(i)); + } + FunctionType *CFTy = FunctionType::get(RetTy, ParamTypes, FTy->isVarArg()); + + // Next, create the clone prototype and insert it into the module. + Clone = new Function(CFTy, GlobalValue::ExternalLinkage, + F->getName()+"_pc"); + F->getParent()->getFunctionList().insert(F, Clone); + return Clone; +} + /// GetFunctionClone - Lazily create clones of pool allocated functions that we /// need in compressed form. This memoizes the functions that have been cloned /// to allow only one clone of each function in a desired permutation. @@ -1080,16 +1124,6 @@ E = ValueMap.end(); I != E; ++I) NewToOldValueMap.insert(std::make_pair(I->second, I->first)); - -#if 0 - /// computeNodeMapping - Given roots in two different DSGraphs, traverse the - /// nodes reachable from the two graphs, computing the mapping of nodes from - /// the first to the second graph. - /// - static void computeNodeMapping(const DSNodeHandle &NH1, - const DSNodeHandle &NH2, NodeMapTy &NodeMap); -#endif - // Compute the PoolDescriptors map for the cloned function. for (std::map::iterator I = FI.PoolDescriptors.begin(), E = FI.PoolDescriptors.end(); @@ -1099,7 +1133,7 @@ ValueMap.clear(); // Recursively transform the function. - CompressPoolsInFunction(*Clone, &RemappedArgs); + CompressPoolsInFunction(*Clone, &RemappedArgs, &PoolsToCompress); return Clone; } @@ -1115,10 +1149,6 @@ Type::UIntTy, Type::UIntTy, 0); PoolDestroyPC = M.getOrInsertFunction("pooldestroy_pc", Type::VoidTy, PoolDescPtrTy, 0); - PoolAllocPC = M.getOrInsertFunction("poolalloc_pc", SCALARUINTTYPE, - PoolDescPtrTy, Type::UIntTy, 0); - PoolFreePC = M.getOrInsertFunction("poolfree_pc", Type::VoidTy, - PoolDescPtrTy, SCALARUINTTYPE, 0); // FIXME: Need bumppointer versions as well as realloc??/memalign?? } From lattner at cs.uiuc.edu Sat Feb 26 11:31:06 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 11:31:06 -0600 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200502261731.j1QHV6c8014157@apoc.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.40 -> 1.41 --- Log message: be a bit more clear. --- Diffs of the changes: (+3 -3) index.cgi | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.40 llvm-www/demo/index.cgi:1.41 --- llvm-www/demo/index.cgi:1.40 Fri Feb 25 14:36:18 2005 +++ llvm-www/demo/index.cgi Sat Feb 26 11:30:50 2005 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2005/02/25 20:36:18 $ +# Last modified $Date: 2005/02/26 17:30:50 $ # use strict; @@ -155,9 +155,9 @@

    Bitter Melon the cat says, paste a C/C++ program in the text box or upload one from your computer, and you can see the equivalent LLVM code, meow!!

    -

    If you want to upload a file from a program with header files, you should +

    If you want to try out a file that uses non-standard header files, you should preprocess it (e.g., with the -save-temps or -E options to - gcc) first.

    + gcc) then upload the result.

    END From lattner at cs.uiuc.edu Sat Feb 26 12:33:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 12:33:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200502261833.j1QIXixN015778@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.64 -> 1.65 --- Log message: remove extraneous cast --- Diffs of the changes: (+1 -2) SimplifyCFG.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.64 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.65 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.64 Thu Feb 24 00:17:52 2005 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Sat Feb 26 12:33:28 2005 @@ -406,8 +406,7 @@ if (SwitchInst *SI = dyn_cast(TI)) { Cases.reserve(SI->getNumCases()); for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i) - Cases.push_back(std::make_pair(cast(SI->getCaseValue(i)), - SI->getSuccessor(i))); + Cases.push_back(std::make_pair(SI->getCaseValue(i), SI->getSuccessor(i))); return SI->getDefaultDest(); } From lattner at cs.uiuc.edu Sat Feb 26 12:40:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 12:40:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Message-ID: <200502261840.j1QIeF3Z015835@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: ScalarEvolutionExpressions.h updated: 1.4 -> 1.5 --- Log message: Fix a case where we incorrectly returned hasComputableLoopEvolution for a ternary commutative expr. Remove FIXME that does not need to be fixed (can't happen). --- Diffs of the changes: (+10 -4) ScalarEvolutionExpressions.h | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.4 llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.5 --- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.4 Sat Feb 12 22:34:51 2005 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Sat Feb 26 12:40:02 2005 @@ -197,10 +197,18 @@ return true; } + // hasComputableLoopEvolution - Commutative expressions have computable loop + // evolutions iff they have at least one operand that varies with the loop, + // but that all varying operands are computable. virtual bool hasComputableLoopEvolution(const Loop *L) const { + bool HasVarying = false; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) - if (getOperand(i)->hasComputableLoopEvolution(L)) return true; - return false; + if (!getOperand(i)->isLoopInvariant(L)) + if (getOperand(i)->hasComputableLoopEvolution(L)) + HasVarying = true; + else + return false; + return HasVarying; } SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym, @@ -382,8 +390,6 @@ virtual bool hasComputableLoopEvolution(const Loop *QL) const { if (L == QL) return true; - /// FIXME: What if the start or step value a recurrence for the specified - /// loop? return false; } From lattner at cs.uiuc.edu Sat Feb 26 12:49:16 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 12:49:16 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/2005-02-26-ExitValueCompute.ll Message-ID: <200502261849.j1QInGnH016221@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify: 2005-02-26-ExitValueCompute.ll added (r1.1) --- Log message: A testcase that we miscompile, noticed from the demo page. --- Diffs of the changes: (+19 -0) 2005-02-26-ExitValueCompute.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Regression/Transforms/IndVarsSimplify/2005-02-26-ExitValueCompute.ll diff -c /dev/null llvm/test/Regression/Transforms/IndVarsSimplify/2005-02-26-ExitValueCompute.ll:1.1 *** /dev/null Sat Feb 26 12:49:14 2005 --- llvm/test/Regression/Transforms/IndVarsSimplify/2005-02-26-ExitValueCompute.ll Sat Feb 26 12:49:04 2005 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep 'ret int 152' + + int %main() { + entry: + br label %no_exit + + no_exit: ; preds = %no_exit, %entry + %i.1.0 = phi int [ 0, %entry ], [ %inc, %no_exit ] ; [#uses=2] + %tmp.4 = setgt int %i.1.0, 50 ; [#uses=1] + %tmp.7 = select bool %tmp.4, int 100, int 0 ; [#uses=1] + %i.0 = add int %i.1.0, 1 ; [#uses=1] + %inc = add int %i.0, %tmp.7 ; [#uses=3] + %tmp.1 = setlt int %inc, 100 ; [#uses=1] + br bool %tmp.1, label %no_exit, label %loopexit + + loopexit: ; preds = %no_exit + ret int %inc + } + From lattner at cs.uiuc.edu Sat Feb 26 12:50:32 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 12:50:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200502261850.j1QIoW5E016237@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.33 -> 1.34 --- Log message: 1 + 100 + 51 == 152, not 52. If we fold three constants together (c1+c2+c3), make sure to keep LHSC updated, instead of reusing (in this case), the 1 instead of the partial sum. --- Diffs of the changes: (+2 -0) ScalarEvolution.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.33 llvm/lib/Analysis/ScalarEvolution.cpp:1.34 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.33 Thu Feb 17 10:54:16 2005 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sat Feb 26 12:50:19 2005 @@ -625,6 +625,7 @@ Ops[0] = SCEVConstant::get(CI); Ops.erase(Ops.begin()+1); // Erase the folded element if (Ops.size() == 1) return Ops[0]; + LHSC = cast(Ops[0]); } else { // If we couldn't fold the expression, move to the next constant. Note // that this is impossible to happen in practice because we always @@ -861,6 +862,7 @@ Ops[0] = SCEVConstant::get(CI); Ops.erase(Ops.begin()+1); // Erase the folded element if (Ops.size() == 1) return Ops[0]; + LHSC = cast(Ops[0]); } else { // If we couldn't fold the expression, move to the next constant. Note // that this is impossible to happen in practice because we always From lattner at cs.uiuc.edu Sat Feb 26 13:36:20 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 13:36:20 -0600 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200502261936.j1QJaKep017195@apoc.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.41 -> 1.42 --- Log message: don't email brian anymore. --- Diffs of the changes: (+4 -4) index.cgi | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.41 llvm-www/demo/index.cgi:1.42 --- llvm-www/demo/index.cgi:1.41 Sat Feb 26 11:30:50 2005 +++ llvm-www/demo/index.cgi Sat Feb 26 13:36:04 2005 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2005/02/26 17:30:50 $ +# Last modified $Date: 2005/02/26 19:36:04 $ # use strict; @@ -21,7 +21,7 @@ my $LOGFILE = '/tmp/webcompile/log.txt'; my $FORM_URL = 'index.cgi'; -my $CONTACT_ADDRESS = 'gaeke -at- uiuc.edu'; +my $CONTACT_ADDRESS = 'Questions or comments? Email the LLVMdev mailing list.'; my $LOGO_IMAGE_URL = 'cathead.png'; my $TIMEOUTAMOUNT = 20; @@ -137,7 +137,7 @@ EOF if ($LOGO_IMAGE_URL) { - print ""; + print ""; } if ( -f "/tmp/webcompile/locked" ) { @@ -234,7 +234,7 @@ front-end, please check the FAQ. If the FAQ does not address it, please send an email to the llvmdev mailing +href='http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev'>LLVMdev mailing list.

    \n

    Note that the generated LLVM code will be easier to read if you use stdio (e.g., printf) than iostreams (e.g., std::cout).

    \n"; From lattner at cs.uiuc.edu Sat Feb 26 13:36:35 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 13:36:35 -0600 Subject: [llvm-commits] CVS: llvm-www/demo/cathead.png Message-ID: <200502261936.j1QJaZG2017202@apoc.cs.uiuc.edu> Changes in directory llvm-www/demo: cathead.png updated: 1.3 -> 1.4 --- Log message: instead of forcing browsers to downscale the image, just scale it correctly on the server. This also reduces the file size by about 2x. --- Diffs of the changes: (+0 -0) cathead.png | 0 1 files changed Index: llvm-www/demo/cathead.png From reid at x10sys.com Sat Feb 26 16:00:43 2005 From: reid at x10sys.com (Reid Spencer) Date: Sat, 26 Feb 2005 16:00:43 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Archive.h Message-ID: <200502262200.QAA04139@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Archive.h updated: 1.9 -> 1.10 --- Log message: Implement an isBytecodeArchive method to determine if an archive contains bytecode file members or not. Patch Contributed By Adam Treat --- Diffs of the changes: (+9 -0) Archive.h | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/include/llvm/Bytecode/Archive.h diff -u llvm/include/llvm/Bytecode/Archive.h:1.9 llvm/include/llvm/Bytecode/Archive.h:1.10 --- llvm/include/llvm/Bytecode/Archive.h:1.9 Sun Dec 12 20:58:16 2004 +++ llvm/include/llvm/Bytecode/Archive.h Sat Feb 26 16:00:32 2005 @@ -414,6 +414,15 @@ std::set& symbols, ///< Symbols to be sought std::set& modules ///< The modules matching \p symbols ); + + /// This method determines whether the archive is a properly formed llvm + /// bytecode archive. It first makes sure the symbol table has been loaded + /// and has a non-zero size. If it does, then it is an archive. If not, + /// then it tries to load all the bytecode modules of the archive. Finally, + /// it returns whether it was successfull. + /// @returns true if the archive is a proper llvm bytecode archive + /// @brief Determine whether the archive is a proper llvm bytecode archive. + bool isBytecodeArchive(); /// @} /// @name Mutators From reid at x10sys.com Sat Feb 26 16:00:43 2005 From: reid at x10sys.com (Reid Spencer) Date: Sat, 26 Feb 2005 16:00:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp Message-ID: <200502262200.QAA04143@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.38 -> 1.39 --- Log message: Implement an isBytecodeArchive method to determine if an archive contains bytecode file members or not. Patch Contributed By Adam Treat --- Diffs of the changes: (+29 -0) ArchiveReader.cpp | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.38 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.39 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.38 Tue Dec 28 19:20:24 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Sat Feb 26 16:00:32 2005 @@ -503,3 +503,32 @@ } } } + +bool +Archive::isBytecodeArchive() +{ + //Make sure the symTab has been loaded... + //in most cases this should have been done + //when the archive was constructed, but still, + //this is just in case. + if ( !symTab.size() ) + loadSymbolTable(); + + //Now that we know it's been loaded, return true + //if it has a size + if ( symTab.size() ) return true; + + //We still can't be sure it isn't a bytecode archive + loadArchive(); + + std::vector Modules; + std::string ErrorMessage; + + //If getAllModules gives an error then this isn't a proper + //bytecode archive + if ( getAllModules( Modules, &ErrorMessage ) ) return false; + + //Finally, if we find any bytecode modules then this is a proper + //bytecode archive + return Modules.size(); +} From lattner at cs.uiuc.edu Sat Feb 26 17:37:00 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 17:37:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200502262337.j1QNb02b018666@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.34 -> 1.35 --- Log message: DCE a dead function --- Diffs of the changes: (+0 -19) ScalarEvolution.cpp | 19 ------------------- 1 files changed, 19 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.34 llvm/lib/Analysis/ScalarEvolution.cpp:1.35 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.34 Sat Feb 26 12:50:19 2005 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sat Feb 26 17:36:45 2005 @@ -495,25 +495,6 @@ } -/// Binomial - Evaluate N!/((N-M)!*M!) . Note that N is often large and M is -/// often very small, so we try to reduce the number of N! terms we need to -/// evaluate by evaluating this as (N!/(N-M)!)/M! -static ConstantInt *Binomial(ConstantInt *N, unsigned M) { - uint64_t NVal = N->getRawValue(); - uint64_t FirstTerm = 1; - for (unsigned i = 0; i != M; ++i) - FirstTerm *= NVal-i; - - unsigned MFactorial = 1; - for (; M; --M) - MFactorial *= M; - - Constant *Result = ConstantUInt::get(Type::ULongTy, FirstTerm/MFactorial); - Result = ConstantExpr::getCast(Result, N->getType()); - assert(isa(Result) && "Cast of integer not folded??"); - return cast(Result); -} - /// PartialFact - Compute V!/(V-NumSteps)! static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) { // Handle this case efficiently, it is common to have constant iteration From lattner at cs.uiuc.edu Sat Feb 26 22:32:50 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 26 Feb 2005 22:32:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/ToolRunner.cpp Message-ID: <200502270432.j1R4Wou3019633@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: ToolRunner.cpp updated: 1.38 -> 1.39 --- Log message: Remove some stuff I checked in accidentally --- Diffs of the changes: (+0 -6) ToolRunner.cpp | 6 ------ 1 files changed, 6 deletions(-) Index: llvm/lib/Support/ToolRunner.cpp diff -u llvm/lib/Support/ToolRunner.cpp:1.38 llvm/lib/Support/ToolRunner.cpp:1.39 --- llvm/lib/Support/ToolRunner.cpp:1.38 Sun Feb 13 17:13:47 2005 +++ llvm/lib/Support/ToolRunner.cpp Sat Feb 26 22:32:35 2005 @@ -391,10 +391,6 @@ sys::Path OutputBinary (ProgramFile+".gcc.exe"); OutputBinary.makeUnique(); GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file... - GCCArgs.push_back("-L/home/vadve/shared/localtools/x86/lib"); - GCCArgs.push_back("-lf2c"); // Hard-code the math library... - GCCArgs.push_back("-lpng"); // Hard-code the math library... - GCCArgs.push_back("-lz"); // Hard-code the math library... GCCArgs.push_back("-lm"); // Hard-code the math library... GCCArgs.push_back("-O2"); // Optimize the program a bit... #if defined (HAVE_LINK_R) @@ -410,8 +406,6 @@ } std::vector ProgramArgs; - //ProgramArgs.push_back("valgrind"); - //ProgramArgs.push_back("--tool=memcheck"); ProgramArgs.push_back(OutputBinary.c_str()); // Add optional parameters to the running program from Argv From lattner at cs.uiuc.edu Sun Feb 27 00:14:33 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:14:33 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2003-05-21-EmptyStructTest.ll Message-ID: <200502270614.j1R6EXeO019928@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2003-05-21-EmptyStructTest.ll updated: 1.2 -> 1.3 --- Log message: Fix misspellings, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) 2003-05-21-EmptyStructTest.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/Assembler/2003-05-21-EmptyStructTest.ll diff -u llvm/test/Regression/Assembler/2003-05-21-EmptyStructTest.ll:1.2 llvm/test/Regression/Assembler/2003-05-21-EmptyStructTest.ll:1.3 --- llvm/test/Regression/Assembler/2003-05-21-EmptyStructTest.ll:1.2 Sat Nov 6 16:07:09 2004 +++ llvm/test/Regression/Assembler/2003-05-21-EmptyStructTest.ll Sun Feb 27 00:14:18 2005 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s -o /dev/null -f ; The old C front-end never generated empty structures, now the new one -; can. For some reason we never handled them in the parser. Wierd. +; can. For some reason we never handled them in the parser. Weird. %X = global {} {} From lattner at cs.uiuc.edu Sun Feb 27 00:14:35 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:14:35 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2002-01-24-HandleCallInsnSEGV.c Message-ID: <200502270614.j1R6EZRm019934@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2002-01-24-HandleCallInsnSEGV.c updated: 1.2 -> 1.3 --- Log message: Fix misspellings, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) 2002-01-24-HandleCallInsnSEGV.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CFrontend/2002-01-24-HandleCallInsnSEGV.c diff -u llvm/test/Regression/CFrontend/2002-01-24-HandleCallInsnSEGV.c:1.2 llvm/test/Regression/CFrontend/2002-01-24-HandleCallInsnSEGV.c:1.3 --- llvm/test/Regression/CFrontend/2002-01-24-HandleCallInsnSEGV.c:1.2 Sat Nov 6 16:41:00 2004 +++ llvm/test/Regression/CFrontend/2002-01-24-HandleCallInsnSEGV.c Sun Feb 27 00:14:19 2005 @@ -5,5 +5,5 @@ void ap_os_dso_unload(void *handle) { dlclose(handle); - return; /* This return triggers the bug: Wierd */ + return; /* This return triggers the bug: Weird */ } From lattner at cs.uiuc.edu Sun Feb 27 00:14:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:14:36 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/ExecutionEngine/test-constantexpr.ll Message-ID: <200502270614.j1R6EaS1019940@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/ExecutionEngine: test-constantexpr.ll updated: 1.2 -> 1.3 --- Log message: Fix misspellings, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) test-constantexpr.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/ExecutionEngine/test-constantexpr.ll diff -u llvm/test/Regression/ExecutionEngine/test-constantexpr.ll:1.2 llvm/test/Regression/ExecutionEngine/test-constantexpr.ll:1.3 --- llvm/test/Regression/ExecutionEngine/test-constantexpr.ll:1.2 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/test-constantexpr.ll Sun Feb 27 00:14:21 2005 @@ -1,7 +1,7 @@ ; RUN: llvm-as -f %s -o %t.bc ; RUN: lli %t.bc > /dev/null -; This tests to make sure that we can evaluate wierd constant expressions +; This tests to make sure that we can evaluate weird constant expressions %A = global int 5 %B = global int 6 From lattner at cs.uiuc.edu Sun Feb 27 00:15:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:15:21 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h User.h Message-ID: <200502270615.j1R6FLLv019960@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.71 -> 1.72 User.h updated: 1.33 -> 1.34 --- Log message: Fix spelling, patch contributed by Gabor Greif --- Diffs of the changes: (+3 -1) Type.h | 2 +- User.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.71 llvm/include/llvm/Type.h:1.72 --- llvm/include/llvm/Type.h:1.71 Mon Jan 24 10:28:03 2005 +++ llvm/include/llvm/Type.h Sun Feb 27 00:15:09 2005 @@ -23,7 +23,7 @@ // identical if they are pointer equals of each other. This allows us to have // two opaque types that end up resolving to different concrete types later. // -// Opaque types are also kinda wierd and scary and different because they have +// Opaque types are also kinda weird and scary and different because they have // to keep a list of uses of the type. When, through linking, parsing, or // bytecode reading, they become resolved, they need to find and update all // users of the unknown type, causing them to reference a new, more concrete Index: llvm/include/llvm/User.h diff -u llvm/include/llvm/User.h:1.33 llvm/include/llvm/User.h:1.34 --- llvm/include/llvm/User.h:1.33 Fri Jan 28 18:29:39 2005 +++ llvm/include/llvm/User.h Sun Feb 27 00:15:09 2005 @@ -97,6 +97,7 @@ return static_cast(Val->get()); } }; + template<> struct simplify_type : public simplify_type {}; @@ -107,6 +108,7 @@ return static_cast(Val->get()); } }; + template<> struct simplify_type : public simplify_type {}; From lattner at cs.uiuc.edu Sun Feb 27 00:16:04 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:16:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200502270616.j1R6G4vb019979@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.194 -> 1.195 --- Log message: Fix spelling, patch contributed by Gabor Greif --- Diffs of the changes: (+1 -1) DataStructure.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.194 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.195 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.194 Thu Feb 24 12:48:07 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sun Feb 27 00:15:51 2005 @@ -2001,7 +2001,7 @@ #if 0 if (CS.getNumPtrArgs() && CS.getCalleeNode() == CS.getPtrArg(0).getNode() && CS.getCalleeNode() && CS.getCalleeNode()->getGlobals().empty()) - std::cerr << "WARNING: WIERD CALL SITE FOUND!\n"; + std::cerr << "WARNING: WEIRD CALL SITE FOUND!\n"; #endif } AssertNodeInGraph(CS.getRetVal().getNode()); From lattner at cs.uiuc.edu Sun Feb 27 00:16:28 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:16:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200502270616.j1R6GSRx019998@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.92 -> 1.93 --- Log message: Fix spelling, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) Writer.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.92 llvm/lib/Bytecode/Writer/Writer.cpp:1.93 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.92 Sat Dec 4 15:28:47 2004 +++ llvm/lib/Bytecode/Writer/Writer.cpp Sun Feb 27 00:16:15 2005 @@ -424,7 +424,7 @@ //===----------------------------------------------------------------------===// typedef unsigned char uchar; -// outputInstructionFormat0 - Output those wierd instructions that have a large +// outputInstructionFormat0 - Output those weird instructions that have a large // number of operands or have large operands themselves... // // Format: [opcode] [type] [numargs] [arg0] [arg1] ... [arg] From lattner at cs.uiuc.edu Sun Feb 27 00:16:40 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:16:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200502270616.j1R6GeVB020007@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.118 -> 1.119 --- Log message: Fix spelling, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) X86InstrInfo.td | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.118 llvm/lib/Target/X86/X86InstrInfo.td:1.119 --- llvm/lib/Target/X86/X86InstrInfo.td:1.118 Wed Jan 19 01:50:03 2005 +++ llvm/lib/Target/X86/X86InstrInfo.td Sun Feb 27 00:16:27 2005 @@ -1549,7 +1549,7 @@ // NOTE: GAS and apparently all other AT&T style assemblers have a broken notion // of some of the 'reverse' forms of the fsub and fdiv instructions. As such, -// we have to put some 'r's in and take them out of wierd places. +// we have to put some 'r's in and take them out of weird places. def FSUBRST0r : FPST0rInst <0xE8, (ops RST:$op), "fsubr $op">; def FSUBrST0 : FPrST0Inst <0xE8, (ops RST:$op), From lattner at cs.uiuc.edu Sun Feb 27 00:17:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:17:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/RaiseAllocations.cpp Message-ID: <200502270617.j1R6H82R020026@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: RaiseAllocations.cpp updated: 1.27 -> 1.28 --- Log message: Fix spelling, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) RaiseAllocations.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/RaiseAllocations.cpp diff -u llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.27 llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.28 --- llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.27 Mon Nov 8 23:10:56 2004 +++ llvm/lib/Transforms/IPO/RaiseAllocations.cpp Sun Feb 27 00:16:55 2005 @@ -186,7 +186,7 @@ // If no prototype was provided for free, we may need to cast the // source pointer. This should be really uncommon, but it's necessary - // just in case we are dealing with wierd code like this: + // just in case we are dealing with weird code like this: // free((long)ptr); // Value *Source = *CS.arg_begin(); From lattner at cs.uiuc.edu Sun Feb 27 00:17:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:17:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200502270617.j1R6HHgw020035@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.65 -> 1.66 --- Log message: Fix spelling, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) SimplifyCFG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.65 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.66 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.65 Sat Feb 26 12:33:28 2005 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Sun Feb 27 00:17:04 2005 @@ -196,7 +196,7 @@ if (!I) return true; // Non-instructions all dominate instructions. BasicBlock *PBB = I->getParent(); - // We don't want to allow wierd loops that might have the "if condition" in + // We don't want to allow weird loops that might have the "if condition" in // the bottom of this block. if (PBB == BB) return false; From lattner at cs.uiuc.edu Sun Feb 27 00:18:38 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 00:18:38 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp Message-ID: <200502270618.j1R6IcSH020188@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Miscompilation.cpp updated: 1.59 -> 1.60 --- Log message: Fix spelling, patch contributed by Gabor Greif! --- Diffs of the changes: (+1 -1) Miscompilation.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.59 llvm/tools/bugpoint/Miscompilation.cpp:1.60 --- llvm/tools/bugpoint/Miscompilation.cpp:1.59 Fri Jan 14 18:07:19 2005 +++ llvm/tools/bugpoint/Miscompilation.cpp Sun Feb 27 00:18:25 2005 @@ -425,7 +425,7 @@ MiscompiledFunctions); Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract); if (Extracted == 0) { - // Wierd, extraction should have worked. + // Weird, extraction should have worked. std::cerr << "Nondeterministic problem extracting blocks??\n"; delete ProgClone; delete ToExtract; From alkis at cs.uiuc.edu Sun Feb 27 04:08:32 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 27 Feb 2005 04:08:32 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Makefile.multisrc Message-ID: <200502271008.EAA02751@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource: Makefile.multisrc updated: 1.45 -> 1.46 --- Log message: Change target from llc-ls to llc-beta --- Diffs of the changes: (+1 -1) Makefile.multisrc | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/MultiSource/Makefile.multisrc diff -u llvm-test/MultiSource/Makefile.multisrc:1.45 llvm-test/MultiSource/Makefile.multisrc:1.46 --- llvm-test/MultiSource/Makefile.multisrc:1.45 Mon Sep 27 11:31:54 2004 +++ llvm-test/MultiSource/Makefile.multisrc Sun Feb 27 04:08:18 2005 @@ -41,7 +41,7 @@ bugpoint-gccld: Output/$(PROG).bugpoint-gccld bugpoint-jit: Output/$(PROG).bugpoint-jit bugpoint-llc: Output/$(PROG).bugpoint-llc -bugpoint-llc-ls: Output/$(PROG).bugpoint-llc-ls +bugpoint-llc-beta: Output/$(PROG).bugpoint-llc-beta # Raw bytecode files are files created by simply assembling the output of the # GCC frontend, without running any optimizations. From alkis at cs.uiuc.edu Sun Feb 27 04:21:49 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 27 Feb 2005 04:21:49 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200502271021.EAA06566@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.304 -> 1.305 --- Log message: Add llc to tools. --- Diffs of the changes: (+3 -0) Makefile.rules | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.304 llvm/Makefile.rules:1.305 --- llvm/Makefile.rules:1.304 Thu Feb 24 15:36:32 2005 +++ llvm/Makefile.rules Sun Feb 27 04:21:37 2005 @@ -275,6 +275,9 @@ ifndef LLI LLI := $(LLVMToolDir)/lli$(EXEEXT) endif +ifndef LLC +LLC := $(LLVMToolDir)/llc$(EXEEXT) +endif ifndef LOPT LOPT := $(LLVMToolDir)/opt$(EXEEXT) endif From alkis at cs.uiuc.edu Sun Feb 27 04:22:25 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 27 Feb 2005 04:22:25 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Makefile.test Message-ID: <200502271022.EAA12731@zion.cs.uiuc.edu> Changes in directory llvm-java/test: Makefile.test updated: 1.40 -> 1.41 --- Log message: Add rules to compile native code using llc as well. --- Diffs of the changes: (+24 -6) Makefile.test | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-) Index: llvm-java/test/Makefile.test diff -u llvm-java/test/Makefile.test:1.40 llvm-java/test/Makefile.test:1.41 --- llvm-java/test/Makefile.test:1.40 Fri Feb 11 17:19:21 2005 +++ llvm-java/test/Makefile.test Sun Feb 27 04:22:13 2005 @@ -31,6 +31,13 @@ -$(Verb)$(LOPT) -load $(LibDir)/LLVMJavaTransforms -addstubs -f -o=$*.stubbed.raw.llvm.bc $*.raw.llvm.bc -$(Verb)$(MV) -f $*.stubbed.raw.llvm.bc $*.raw.llvm.bc +# rule to make native executable +%.llc.s: %.llvm.bc + -$(Verb)$(LLC) -f $< -o $@ + +%.llc: %.llc.s + -$(Verb)$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ + # add function trace code %.tracef.llvm %.tracef.llvm.bc: %.llvm %.llvm.bc $(LOPT) $(Echo) Adding function trace code to $< @@ -61,12 +68,14 @@ # Output produced by tests NATIVE_OUTPUT := $(addsuffix .out-nat, $(PREFIXED_JAVA_TESTS)) JIT_OUTPUT := $(addsuffix .out-jit, $(PREFIXED_JAVA_TESTS)) +LLC_OUTPUT := $(addsuffix .out-llc, $(PREFIXED_JAVA_TESTS)) # Diffs of output produced by native and llvm-java runs -DIFFS := $(addsuffix .diff, $(PREFIXED_JAVA_TESTS)) +JIT_DIFFS := $(addsuffix .diff-jit, $(PREFIXED_JAVA_TESTS)) +JIT_DIFFS := $(addsuffix .diff-llc, $(PREFIXED_JAVA_TESTS)) # Keep the output and diffs -.PRECIOUS: %.out-nat %.out-jit %.diff +.PRECIOUS: %.out-nat %.out-jit %.out-llc %.diff-jit %.diff-llc # rule to run a .class file with the jvm %.out-nat: %.class @@ -77,12 +86,21 @@ %.out-jit: %.llvm.bc -$(Verb)$(LLI) $< > $*.out-jit 2>&1 +# rule to run a .class file with llc +%.out-llc: %.llc + -$(Verb)./$< > $*.out-llc 2>&1 + # rule to diff test output -%.diff: %.out-nat %.out-jit +%.diff-jit: %.out-nat %.out-jit $(Verb)diff $*.out-nat $*.out-jit > $@ \ - && echo "PASS: $(notdir $*)" \ - || echo "FAIL: $(notdir $*)" + && echo "PASS(jit): $(notdir $*)" \ + || echo "FAIL(jit): $(notdir $*)" + +%.diff-llc: %.out-nat %.out-llc + $(Verb)diff $*.out-nat $*.out-llc > $@ \ + && echo "PASS(llc): $(notdir $*)" \ + || echo "FAIL(llc): $(notdir $*)" -all-local:: $(DIFFS) +all-local:: $(JIT_DIFFS) $(LLC_DIFFS) endif From alkis at cs.uiuc.edu Sun Feb 27 04:26:34 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 27 Feb 2005 04:26:34 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Makefile.test Message-ID: <200502271026.EAA13709@zion.cs.uiuc.edu> Changes in directory llvm-java/test: Makefile.test updated: 1.41 -> 1.42 --- Log message: Fix typo. --- Diffs of the changes: (+1 -1) Makefile.test | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-java/test/Makefile.test diff -u llvm-java/test/Makefile.test:1.41 llvm-java/test/Makefile.test:1.42 --- llvm-java/test/Makefile.test:1.41 Sun Feb 27 04:22:13 2005 +++ llvm-java/test/Makefile.test Sun Feb 27 04:26:23 2005 @@ -72,7 +72,7 @@ # Diffs of output produced by native and llvm-java runs JIT_DIFFS := $(addsuffix .diff-jit, $(PREFIXED_JAVA_TESTS)) -JIT_DIFFS := $(addsuffix .diff-llc, $(PREFIXED_JAVA_TESTS)) +LLC_DIFFS := $(addsuffix .diff-llc, $(PREFIXED_JAVA_TESTS)) # Keep the output and diffs .PRECIOUS: %.out-nat %.out-jit %.out-llc %.diff-jit %.diff-llc From alkis at cs.uiuc.edu Sun Feb 27 05:38:18 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 27 Feb 2005 05:38:18 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Makefile.test Message-ID: <200502271138.FAA31050@zion.cs.uiuc.edu> Changes in directory llvm-java/test: Makefile.test updated: 1.42 -> 1.43 --- Log message: Add bugpoint rules. --- Diffs of the changes: (+14 -0) Makefile.test | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm-java/test/Makefile.test diff -u llvm-java/test/Makefile.test:1.42 llvm-java/test/Makefile.test:1.43 --- llvm-java/test/Makefile.test:1.42 Sun Feb 27 04:26:23 2005 +++ llvm-java/test/Makefile.test Sun Feb 27 05:38:07 2005 @@ -101,6 +101,20 @@ && echo "PASS(llc): $(notdir $*)" \ || echo "FAIL(llc): $(notdir $*)" +# rules to invoke bugpoint +GCCLD_PASS_ARGS := $(shell $(GCCLD) /dev/null -debug-pass=Arguments 2>&1 | \ + grep 'Pass Arguments' | \ + sed 's/Pass Arguments: //') + +%.bugpoint.lli: %.llvm.bc %.out-nat + $(LBUGPOINT) $< -run-lli -output=$*.out-nat + +%.bugpoint.llc: %.llvm.bc %.out-nat + $(LBUGPOINT) $< -run-llc -output=$*.out-nat + +%.bugpoint.gccld: %.raw.llvm.bc %.out-nat + $(LBUGPOINT) $< $(GCCLD_PASS_ARGS) + all-local:: $(JIT_DIFFS) $(LLC_DIFFS) endif From lattner at cs.uiuc.edu Sun Feb 27 12:19:41 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 12:19:41 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2005-02-27-MarkGlobalConstant.c Message-ID: <200502271819.j1RIJf2h028094@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2005-02-27-MarkGlobalConstant.c added (r1.1) --- Log message: Test that a global is marked constant when it can be. --- Diffs of the changes: (+10 -0) 2005-02-27-MarkGlobalConstant.c | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/test/Regression/CFrontend/2005-02-27-MarkGlobalConstant.c diff -c /dev/null llvm/test/Regression/CFrontend/2005-02-27-MarkGlobalConstant.c:1.1 *** /dev/null Sun Feb 27 12:19:36 2005 --- llvm/test/Regression/CFrontend/2005-02-27-MarkGlobalConstant.c Sun Feb 27 12:19:26 2005 *************** *** 0 **** --- 1,10 ---- + // RUN: %llvmgcc -xc %s -S -o - | grep 'ctor_.* constant ' + + // The synthetic global made by the CFE for big initializer should be marked + // constant. + + void bar(); + void foo() { + char Blah[] = "asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd"; + bar(Blah); + } From lattner at cs.uiuc.edu Sun Feb 27 12:20:28 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 12:20:28 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200502271820.j1RIKSkZ028108@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.87 -> 1.88 --- Log message: When the CFE produces globals to hold the initial constant value for large initializers, we can mark it constant. This implements: Regression/CFrontend/2005-02-27-MarkGlobalConstant.c --- Diffs of the changes: (+1 -0) llvm-expand.c | 1 + 1 files changed, 1 insertion(+) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.87 llvm-gcc/gcc/llvm-expand.c:1.88 --- llvm-gcc/gcc/llvm-expand.c:1.87 Wed Feb 23 11:52:46 2005 +++ llvm-gcc/gcc/llvm-expand.c Sun Feb 27 12:20:15 2005 @@ -4249,6 +4249,7 @@ sprintf(Name, ".ctor_%d", ++CtorCounter); G = llvm_global_new(D2V(C)->Ty, Name); G->Init = C; + G->isConstant = 1; G->Linkage = L_Internal; llvm_ilist_push_back(llvm_global, TheProgram.Globals, G); EmitMemCpyMove(Fn, target, G2V(G), From lattner at cs.uiuc.edu Sun Feb 27 12:47:32 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 12:47:32 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalOpt/memcpy.ll Message-ID: <200502271847.j1RIlW8b029158@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GlobalOpt: memcpy.ll added (r1.1) --- Log message: new testcase globalopt should implement --- Diffs of the changes: (+16 -0) memcpy.ll | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm/test/Regression/Transforms/GlobalOpt/memcpy.ll diff -c /dev/null llvm/test/Regression/Transforms/GlobalOpt/memcpy.ll:1.1 *** /dev/null Sun Feb 27 12:47:27 2005 --- llvm/test/Regression/Transforms/GlobalOpt/memcpy.ll Sun Feb 27 12:47:17 2005 *************** *** 0 **** --- 1,16 ---- + ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep 'G1 = internal constant' + + %G1 = internal global [58 x sbyte] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" + + implementation + + declare void %llvm.memcpy(sbyte*, sbyte*, uint, uint) + + void %foo() { + %Blah = alloca [58 x sbyte] ; <[58 x sbyte]*> [#uses=2] + %tmp.0 = getelementptr [58 x sbyte]* %Blah, int 0, int 0 ; [#uses=1] + call void %llvm.memcpy( sbyte* %tmp.0, sbyte* getelementptr ([58 x sbyte]* %G1, int 0, int 0), uint 58, uint 1 ) + ret void + } + + From lattner at cs.uiuc.edu Sun Feb 27 12:48:32 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 12:48:32 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalOpt/memset.ll Message-ID: <200502271848.j1RImWV1029278@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GlobalOpt: memset.ll added (r1.1) --- Log message: new testcase globalopt should handle. --- Diffs of the changes: (+21 -0) memset.ll | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/test/Regression/Transforms/GlobalOpt/memset.ll diff -c /dev/null llvm/test/Regression/Transforms/GlobalOpt/memset.ll:1.1 *** /dev/null Sun Feb 27 12:48:29 2005 --- llvm/test/Regression/Transforms/GlobalOpt/memset.ll Sun Feb 27 12:48:19 2005 *************** *** 0 **** --- 1,21 ---- + ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep internal + ; both globals are write only, delete them. + + %G0 = internal global [58 x sbyte] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" + + %G1 = internal global [4 x int] [ int 1, int 2, int 3, int 4] + + implementation ; Functions: + + declare void %llvm.memcpy(sbyte*, sbyte*, uint, uint) + declare void %llvm.memset(sbyte*, ubyte, uint, uint) + + void %foo() { + %Blah = alloca [58 x sbyte] ; <[58 x sbyte]*> [#uses=2] + %tmp3 = cast [58 x sbyte]* %Blah to sbyte* + call void %llvm.memcpy( sbyte* cast ([4 x int]* %G1 to sbyte*), sbyte* %tmp3, uint 16, uint 1) + call void %llvm.memset( sbyte* getelementptr ([58 x sbyte]* %G0, int 0, int 0), ubyte 17, uint 58, uint 1) + ret void + } + + From lattner at cs.uiuc.edu Sun Feb 27 12:59:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 12:59:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200502271859.j1RIx5Mm029944@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.36 -> 1.37 --- Log message: Teach globalopt how memset/cpy/move affect memory, to allow better optimization. --- Diffs of the changes: (+40 -25) GlobalOpt.cpp | 65 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 40 insertions(+), 25 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.36 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.37 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.36 Wed Feb 23 10:52:58 2005 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Sun Feb 27 12:58:52 2005 @@ -18,6 +18,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Support/Debug.h" @@ -194,7 +195,7 @@ } else { GS.StoredType = GlobalStatus::isStored; } - } else if (I->getOpcode() == Instruction::GetElementPtr) { + } else if (isa(I)) { if (AnalyzeGlobal(I, GS, PHIUsers)) return true; // If the first two indices are constants, this can be SRA'd. @@ -212,7 +213,7 @@ } else { GS.isNotSuitableForSRA = true; } - } else if (I->getOpcode() == Instruction::Select) { + } else if (isa(I)) { if (AnalyzeGlobal(I, GS, PHIUsers)) return true; GS.isNotSuitableForSRA = true; } else if (PHINode *PN = dyn_cast(I)) { @@ -223,6 +224,16 @@ GS.isNotSuitableForSRA = true; } else if (isa(I)) { GS.isNotSuitableForSRA = true; + } else if (isa(I) || isa(I)) { + if (I->getOperand(1) == V) + GS.StoredType = GlobalStatus::isStored; + if (I->getOperand(2) == V) + GS.isLoaded = true; + GS.isNotSuitableForSRA = true; + } else if (isa(I)) { + assert(I->getOperand(1) == V && "Memset only takes one pointer!"); + GS.StoredType = GlobalStatus::isStored; + GS.isNotSuitableForSRA = true; } else { return true; // Any other non-load instruction might take address! } @@ -270,6 +281,7 @@ } static Constant *TraverseGEPInitializer(User *GEP, Constant *Init) { + if (Init == 0) return 0; if (GEP->getNumOperands() == 1 || !isa(GEP->getOperand(1)) || !cast(GEP->getOperand(1))->isNullValue()) @@ -294,47 +306,50 @@ User *U = *UI++; if (LoadInst *LI = dyn_cast(U)) { - // Replace the load with the initializer. - LI->replaceAllUsesWith(Init); - LI->eraseFromParent(); - Changed = true; + if (Init) { + // Replace the load with the initializer. + LI->replaceAllUsesWith(Init); + LI->eraseFromParent(); + Changed = true; + } } else if (StoreInst *SI = dyn_cast(U)) { // Store must be unreachable or storing Init into the global. SI->eraseFromParent(); Changed = true; } else if (ConstantExpr *CE = dyn_cast(U)) { if (CE->getOpcode() == Instruction::GetElementPtr) { - if (Constant *SubInit = TraverseGEPInitializer(CE, Init)) - Changed |= CleanupConstantGlobalUsers(CE, SubInit); - if (CE->use_empty()) { - CE->destroyConstant(); - Changed = true; - } + Constant *SubInit = TraverseGEPInitializer(CE, Init); + Changed |= CleanupConstantGlobalUsers(CE, SubInit); + } else if (CE->getOpcode() == Instruction::Cast && + isa(CE->getType())) { + // Pointer cast, delete any stores and memsets to the global. + Changed |= CleanupConstantGlobalUsers(CE, 0); } - } else if (GetElementPtrInst *GEP = dyn_cast(U)) { - if (Constant *SubInit = TraverseGEPInitializer(GEP, Init)) - Changed |= CleanupConstantGlobalUsers(GEP, SubInit); - else { - // If this GEP has variable indexes, we should still be able to delete - // any stores through it. - for (Value::use_iterator GUI = GEP->use_begin(), E = GEP->use_end(); - GUI != E;) - if (StoreInst *SI = dyn_cast(*GUI++)) { - SI->eraseFromParent(); - Changed = true; - } + + if (CE->use_empty()) { + CE->destroyConstant(); + Changed = true; } + } else if (GetElementPtrInst *GEP = dyn_cast(U)) { + Constant *SubInit = TraverseGEPInitializer(GEP, Init); + Changed |= CleanupConstantGlobalUsers(GEP, SubInit); if (GEP->use_empty()) { GEP->eraseFromParent(); Changed = true; } + } else if (MemIntrinsic *MI = dyn_cast(U)) { // memset/cpy/mv + if (MI->getRawDest() == V) { + MI->eraseFromParent(); + Changed = true; + } + } else if (Constant *C = dyn_cast(U)) { // If we have a chain of dead constantexprs or other things dangling from // us, and if they are all dead, nuke them without remorse. if (ConstantIsDead(C)) { C->destroyConstant(); - // This could have incalidated UI, start over from scratch.x + // This could have invalidated UI, start over from scratch. CleanupConstantGlobalUsers(V, Init); return true; } From lattner at cs.uiuc.edu Sun Feb 27 13:05:37 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 13:05:37 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ThreadSupport.h.in Message-ID: <200502271905.j1RJ5bbt030098@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: ThreadSupport.h.in updated: 1.3 -> 1.4 --- Log message: Rename include guard, patch contributed by Evan Jones! --- Diffs of the changes: (+2 -2) ThreadSupport.h.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Support/ThreadSupport.h.in diff -u llvm/include/llvm/Support/ThreadSupport.h.in:1.3 llvm/include/llvm/Support/ThreadSupport.h.in:1.4 --- llvm/include/llvm/Support/ThreadSupport.h.in:1.3 Fri Sep 24 16:19:06 2004 +++ llvm/include/llvm/Support/ThreadSupport.h.in Sun Feb 27 13:05:24 2005 @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#ifndef SUPPORT_THREADSUPPORT_H -#define SUPPORT_THREADSUPPORT_H +#ifndef LLVM_SUPPORT_THREADSUPPORT_H +#define LLVM_SUPPORT_THREADSUPPORT_H #undef HAVE_PTHREAD_MUTEX_LOCK From lattner at cs.uiuc.edu Sun Feb 27 13:06:23 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 13:06:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200502271906.j1RJ6NES030408@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.65 -> 1.66 --- Log message: Use const iterators where possible. Patch by Evan Jones! --- Diffs of the changes: (+2 -2) ExecutionEngine.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.65 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.66 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.65 Wed Feb 2 14:50:50 2005 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Sun Feb 27 13:06:10 2005 @@ -494,7 +494,7 @@ // Loop over all of the global variables in the program, allocating the memory // to hold them. - for (Module::giterator I = getModule().gbegin(), E = getModule().gend(); + for (Module::const_giterator I = getModule().gbegin(), E = getModule().gend(); I != E; ++I) if (!I->isExternal()) { // Get the type of the global... @@ -518,7 +518,7 @@ // Now that all of the globals are set up in memory, loop through them all and // initialize their contents. - for (Module::giterator I = getModule().gbegin(), E = getModule().gend(); + for (Module::const_giterator I = getModule().gbegin(), E = getModule().gend(); I != E; ++I) if (!I->isExternal()) EmitGlobalVariable(I); From lattner at cs.uiuc.edu Sun Feb 27 13:07:52 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 13:07:52 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ThreadSupport-PThreads.h Message-ID: <200502271907.j1RJ7qN1030428@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: ThreadSupport-PThreads.h updated: 1.3 -> 1.4 --- Log message: Fix this to create a recursive mutex. Patch by Evan Jones! --- Diffs of the changes: (+27 -4) ThreadSupport-PThreads.h | 31 +++++++++++++++++++++++++++---- 1 files changed, 27 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Support/ThreadSupport-PThreads.h diff -u llvm/include/llvm/Support/ThreadSupport-PThreads.h:1.3 llvm/include/llvm/Support/ThreadSupport-PThreads.h:1.4 --- llvm/include/llvm/Support/ThreadSupport-PThreads.h:1.3 Wed Sep 1 17:55:35 2004 +++ llvm/include/llvm/Support/ThreadSupport-PThreads.h Sun Feb 27 13:07:36 2005 @@ -32,11 +32,34 @@ void operator=(const Mutex &); // DO NOT IMPLEMENT public: Mutex() { + // Initialize the mutex as a recursive mutex pthread_mutexattr_t Attr; - pthread_mutex_init(&mutex, &Attr); + int errorcode = pthread_mutexattr_init(&Attr); + assert(errorcode == 0); + + errorcode = pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE); + assert(errorcode == 0); + + errorcode = pthread_mutex_init(&mutex, &Attr); + assert(errorcode == 0); + + errorcode = pthread_mutexattr_destroy(&Attr); + assert(errorcode == 0); + } + + ~Mutex() { + int errorcode = pthread_mutex_destroy(&mutex); + assert(errorcode == 0); + } + + void acquire () { + int errorcode = pthread_mutex_lock(&mutex); + assert(errorcode == 0); + } + + void release () { + int errorcode = pthread_mutex_unlock(&mutex); + assert(errorcode == 0); } - ~Mutex() { pthread_mutex_destroy(&mutex); } - void acquire () { pthread_mutex_lock (&mutex); } - void release () { pthread_mutex_unlock (&mutex); } }; } // end namespace llvm From lattner at cs.uiuc.edu Sun Feb 27 13:28:45 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 13:28:45 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2005-02-27-PlacementArrayNewCrash.cpp Message-ID: <200502271928.j1RJSjdO031290@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2005-02-27-PlacementArrayNewCrash.cpp added (r1.1) --- Log message: New testcase for PR529: http://llvm.cs.uiuc.edu/PR529 --- Diffs of the changes: (+8 -0) 2005-02-27-PlacementArrayNewCrash.cpp | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/test/Regression/C++Frontend/2005-02-27-PlacementArrayNewCrash.cpp diff -c /dev/null llvm/test/Regression/C++Frontend/2005-02-27-PlacementArrayNewCrash.cpp:1.1 *** /dev/null Sun Feb 27 13:28:40 2005 --- llvm/test/Regression/C++Frontend/2005-02-27-PlacementArrayNewCrash.cpp Sun Feb 27 13:28:30 2005 *************** *** 0 **** --- 1,8 ---- + // RUN: %llvmgxx -S %s -o - + + #include + typedef double Ty[4]; + + void foo(Ty *XX) { + new(XX) Ty(); + } From lattner at cs.uiuc.edu Sun Feb 27 13:29:04 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 13:29:04 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200502271929.j1RJT40E031301@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.88 -> 1.89 --- Log message: fix 2005-02-27-PlacementArrayNewCrash.cpp and PR529: http://llvm.cs.uiuc.edu/PR529 . --- Diffs of the changes: (+2 -1) llvm-expand.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.88 llvm-gcc/gcc/llvm-expand.c:1.89 --- llvm-gcc/gcc/llvm-expand.c:1.88 Sun Feb 27 12:20:15 2005 +++ llvm-gcc/gcc/llvm-expand.c Sun Feb 27 13:28:51 2005 @@ -4067,7 +4067,8 @@ } /* If we have constant lower bound for the range of the type, get it. */ - if (TYPE_MIN_VALUE (domain) && host_integerp (TYPE_MIN_VALUE (domain), 0)) + if (domain && TYPE_MIN_VALUE (domain) && + host_integerp (TYPE_MIN_VALUE (domain), 0)) minelt = tree_low_cst (TYPE_MIN_VALUE (domain), 0); /* From lattner at cs.uiuc.edu Sun Feb 27 13:31:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 13:31:15 -0600 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200502271931.j1RJVFgn031331@apoc.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.302 -> 1.303 --- Log message: Bug fixed --- Diffs of the changes: (+3 -1) ReleaseNotes.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.302 llvm/docs/ReleaseNotes.html:1.303 --- llvm/docs/ReleaseNotes.html:1.302 Sun Feb 20 17:31:49 2005 +++ llvm/docs/ReleaseNotes.html Sun Feb 27 13:31:02 2005 @@ -170,6 +170,8 @@ virtual function thunk with an unnamed argument
  • [llvm-gcc] Crash on certain C99 complex number routines
  • +
  • [llvm-g++] Crash using placement + new on an array type
  • @@ -591,7 +593,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/02/20 23:31:49 $ + Last modified: $Date: 2005/02/27 19:31:02 $ From jeffc at jolt-lang.org Sun Feb 27 13:37:18 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 27 Feb 2005 13:37:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200502271937.NAA13831@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.1 -> 1.2 --- Log message: First pass at improved Loop Strength Reduction. Still not yet ready for prime time. --- Diffs of the changes: (+39 -35) LoopStrengthReduce.cpp | 74 +++++++++++++++++++++++++------------------------ 1 files changed, 39 insertions(+), 35 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.1 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.2 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.1 Mon Oct 18 16:08:22 2004 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Feb 27 13:37:07 2005 @@ -50,6 +50,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); + AU.addRequiredID(LoopSimplifyID); AU.addRequired(); AU.addRequired(); } @@ -99,50 +100,38 @@ // // We currently only handle GEP instructions that consist of zero or more // constants and one instance of the canonical induction variable. - bool foundIndvar = false; - bool indvarLast = false; + unsigned indvar = 0; std::vector pre_op_vector; std::vector inc_op_vector; Value *CanonicalIndVar = L->getCanonicalInductionVariable(); + BasicBlock *Header = L->getHeader(); + for (unsigned op = 1, e = GEPI->getNumOperands(); op != e; ++op) { Value *operand = GEPI->getOperand(op); if (operand == CanonicalIndVar) { - // FIXME: We currently only support strength reducing GEP instructions - // with one instance of the canonical induction variable. This means that - // we can't deal with statements of the form A[i][i]. - if (foundIndvar == true) - return; - // FIXME: use getCanonicalInductionVariableIncrement to choose between // one and neg one maybe? We need to support int *foo = GEP base, -1 const Type *Ty = CanonicalIndVar->getType(); pre_op_vector.push_back(Constant::getNullValue(Ty)); inc_op_vector.push_back(ConstantInt::get(Ty, 1)); - foundIndvar = true; - indvarLast = true; + indvar = op; + break; } else if (isa(operand)) { pre_op_vector.push_back(operand); - if (indvarLast == true) indvarLast = false; + } else if (Instruction *inst = dyn_cast(operand)) { + if (!DS->dominates(inst, Header->begin())) + return; + pre_op_vector.push_back(operand); } else return; } - // FIXME: handle GEPs where the indvar is not the last element of the index - // array. - if (indvarLast == false) - return; - assert(true == foundIndvar && "Indvar used by GEP not found in operand list"); + assert(indvar > 0 && "Indvar used by GEP not found in operand list"); - // FIXME: Being able to hoist the definition of the initial pointer value - // would allow us to strength reduce more loops. For example, %tmp.32 in the - // following loop: - // entry: - // br label %no_exit.0 - // no_exit.0: ; preds = %entry, %no_exit.0 - // %init.1.0 = phi uint [ 0, %entry ], [ %indvar.next, %no_exit.0 ] - // %tmp.32 = load uint** %CROSSING - // %tmp.35 = getelementptr uint* %tmp.32, uint %init.1.0 - // br label %no_exit.0 - BasicBlock *Header = L->getHeader(); + // Ensure the pointer base is loop invariant. While strength reduction + // makes sense even if the pointer changed on every iteration, there is no + // realistic way of handling it unless GEPs were completely decomposed into + // their constituent operations so we have explicit multiplications to work + // with. if (Instruction *GepPtrOp = dyn_cast(GEPI->getOperand(0))) if (!DS->dominates(GepPtrOp, Header->begin())) return; @@ -153,8 +142,6 @@ // If there is only one operand after the initial non-constant one, we know // that it was the induction variable, and has been replaced by a constant // null value. In this case, replace the GEP with a use of pointer directly. - // - // BasicBlock *Preheader = L->getLoopPreheader(); Value *PreGEP; if (isa(GEPI->getOperand(0))) { @@ -164,7 +151,7 @@ PreGEP = GEPI->getOperand(0); } else { PreGEP = new GetElementPtrInst(GEPI->getOperand(0), - pre_op_vector, GEPI->getName(), + pre_op_vector, GEPI->getName()+".pre", Preheader->getTerminator()); } @@ -175,9 +162,10 @@ GEPI->getName()+".str", InsertBefore); NewPHI->addIncoming(PreGEP, Preheader); - // Now, create the GEP instruction to increment the value selected by the PHI - // instruction we just created above by one, and add it as the second incoming - // Value and BasicBlock pair to the PHINode. + // Now, create the GEP instruction to increment by one the value selected by + // the PHI instruction we just created above, and add it as the second + // incoming Value/BasicBlock pair to the PHINode. It is inserted before the + // increment of the canonical induction variable. Instruction *IncrInst = const_cast(L->getCanonicalInductionVariableIncrement()); GetElementPtrInst *StrGEP = new GetElementPtrInst(NewPHI, inc_op_vector, @@ -185,8 +173,24 @@ IncrInst); NewPHI->addIncoming(StrGEP, IncrInst->getParent()); - // Replace all uses of the old GEP instructions with the new PHI - GEPI->replaceAllUsesWith(NewPHI); + if (GEPI->getNumOperands() - 1 == indvar) { + // If there were no operands following the induction variable, replace all + // uses of the old GEP instruction with the new PHI. + GEPI->replaceAllUsesWith(NewPHI); + } else { + // Create a new GEP instruction using the new PHI as the base. The + // operands of the original GEP past the induction variable become + // operands of this new GEP. + std::vector op_vector; + const Type *Ty = CanonicalIndVar->getType(); + op_vector.push_back(Constant::getNullValue(Ty)); + for (unsigned op = indvar + 1; op < GEPI->getNumOperands(); op++) + op_vector.push_back(GEPI->getOperand(op)); + GetElementPtrInst *newGEP = new GetElementPtrInst(NewPHI, op_vector, + GEPI->getName() + ".lsr", + GEPI); + GEPI->replaceAllUsesWith(newGEP); +} // The old GEP is now dead. DeadInsts.insert(GEPI); From lattner at cs.uiuc.edu Sun Feb 27 14:09:10 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 14:09:10 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502272009.j1RK9ASM008336@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.31 -> 1.32 --- Log message: Properly implement loading/storing compressed pointers from non-compressed memory. --- Diffs of the changes: (+16 -15) PointerCompress.cpp | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.31 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.32 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.31 Fri Feb 25 18:47:56 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Sun Feb 27 14:08:54 2005 @@ -622,18 +622,16 @@ } void InstructionRewriter::visitLoadInst(LoadInst &LI) { - if (isa(LI.getOperand(0))) { // load null ?? - // Load null doesn't make any sense, but if the result is a pointer into a - // compressed pool, we have to transform it. - if (isa(LI.getType()) && getPoolInfo(&LI)) - setTransformedValue(LI, UndefValue::get(SCALARUINTTYPE)); - return; - } - const CompressedPoolInfo *SrcPI = getPoolInfo(LI.getOperand(0)); if (SrcPI == 0) { - assert(getPoolInfo(&LI) == 0 && - "Cannot load a compressed pointer from non-compressed memory!"); + // If we are loading a compressed pointer from a non-compressessed memory + // object, retain the load, but cast from the pointer type to our scalar + // type. + if (getPoolInfo(&LI)) { + Value *NLI = new LoadInst(LI.getOperand(0), LI.getName()+".cp", &LI); + Value *NC = new CastInst(NLI, SCALARUINTTYPE, NLI->getName(), &LI); + setTransformedValue(LI, NC); + } return; } @@ -679,11 +677,14 @@ void InstructionRewriter::visitStoreInst(StoreInst &SI) { const CompressedPoolInfo *DestPI = getPoolInfo(SI.getOperand(1)); if (DestPI == 0) { - if (isa(SI.getOperand(1))) - SI.eraseFromParent(); - else - assert(getPoolInfo(SI.getOperand(0)) == 0 && - "Cannot store a compressed pointer into non-compressed memory!"); + // If we are storing a compressed pointer into uncompressed memory, just + // cast the index to a pointer type and store that. + if (getPoolInfo(SI.getOperand(0))) { + Value *SrcVal = getTransformedValue(SI.getOperand(0)); + SrcVal = new CastInst(SrcVal, SI.getOperand(0)->getType(), + SrcVal->getName(), &SI); + SI.setOperand(0, SrcVal); + } return; } From jeffc at jolt-lang.org Sun Feb 27 15:08:15 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 27 Feb 2005 15:08:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200502272108.PAA14623@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.2 -> 1.3 --- Log message: PHI nodes were incorrectly placed when more than one GEP is reduced in a loop. --- Diffs of the changes: (+6 -7) LoopStrengthReduce.cpp | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.2 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.3 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.2 Sun Feb 27 13:37:07 2005 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Feb 27 15:08:04 2005 @@ -99,7 +99,8 @@ // GEP. // // We currently only handle GEP instructions that consist of zero or more - // constants and one instance of the canonical induction variable. + // constants or loop invariable expressions prior to an instance of the + // canonical induction variable. unsigned indvar = 0; std::vector pre_op_vector; std::vector inc_op_vector; @@ -208,21 +209,19 @@ if (0 == PN) return; - // Insert secondary PHI nodes after the canonical induction variable's PHI - // for the strength reduced pointers that we will be creating. - Instruction *InsertBefore = PN->getNext(); - // FIXME: Need to use SCEV to detect GEP uses of the indvar, since indvars // pass creates code like this, which we can't currently detect: // %tmp.1 = sub uint 2000, %indvar // %tmp.8 = getelementptr int* %y, uint %tmp.1 - // Strength reduce all GEPs in the Loop + // Strength reduce all GEPs in the Loop. Insert secondary PHI nodes for the + // strength reduced pointers we'll be creating after the canonical induction + // variable's PHI. std::set DeadInsts; for (Value::use_iterator UI = PN->use_begin(), UE = PN->use_end(); UI != UE; ++UI) if (GetElementPtrInst *GEPI = dyn_cast(*UI)) - strengthReduceGEP(GEPI, L, InsertBefore, DeadInsts); + strengthReduceGEP(GEPI, L, PN->getNext(), DeadInsts); // Clean up after ourselves if (!DeadInsts.empty()) { From lattner at cs.uiuc.edu Sun Feb 27 15:32:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 15:32:43 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h Message-ID: <200502272132.j1RLWhff014797@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PoolAllocate.h updated: 1.43 -> 1.44 --- Log message: introduce a typedef to reduce the size of typenames. --- Diffs of the changes: (+3 -2) PoolAllocate.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h:1.43 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h:1.44 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h:1.43 Wed Feb 16 12:10:40 2005 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h Sun Feb 27 15:32:27 2005 @@ -77,14 +77,15 @@ /// contains a mapping from all of the values in the new function back to /// the values they correspond to in the old function. /// - std::map NewToOldValueMap; + typedef std::map NewToOldValueMapTy; + NewToOldValueMapTy NewToOldValueMap; /// MapValueToOriginal - Given a value in the cloned version of this /// function, map it back to the original. If the specified value did not /// exist in the original function (e.g. because it's a pool descriptor), /// return null. Value *MapValueToOriginal(Value *V) const { - std::map::const_iterator I =NewToOldValueMap.find(V); + NewToOldValueMapTy::const_iterator I = NewToOldValueMap.find(V); return I != NewToOldValueMap.end() ? const_cast(I->second) : 0; } }; From lattner at cs.uiuc.edu Sun Feb 27 15:33:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 15:33:09 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502272133.j1RLX997014808@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.32 -> 1.33 --- Log message: Fix some *really* nasty dangling pointer problems. Unfortunately this is not all of them. :( --- Diffs of the changes: (+42 -14) PointerCompress.cpp | 56 +++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 42 insertions(+), 14 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.32 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.33 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.32 Sun Feb 27 14:08:54 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Sun Feb 27 15:32:56 2005 @@ -328,7 +328,7 @@ const TargetData &TD; - const DSGraph &DSG; + DSGraph &DSG; /// PAFuncInfo - Information about the transformation the pool allocator did /// to the original function. @@ -342,7 +342,7 @@ PointerCompress &PtrComp; public: InstructionRewriter(const PointerCompress::PoolInfoMap &poolInfo, - const DSGraph &dsg, PA::FuncInfo &pafi, + DSGraph &dsg, PA::FuncInfo &pafi, FunctionCloneRecord *fcr, PointerCompress &ptrcomp) : PoolInfo(poolInfo), TD(dsg.getTargetData()), DSG(dsg), PAFuncInfo(pafi), FCR(fcr), PtrComp(ptrcomp) { @@ -367,7 +367,8 @@ if (isa(V)) // undef -> uint undef return UndefValue::get(SCALARUINTTYPE); - assert(getNodeIfCompressed(V) && "Value is not compressed!"); + if (!getNodeIfCompressed(V)) + assert(getNodeIfCompressed(V) && "Value is not compressed!"); Value *&RV = OldToNewValueMap[V]; if (RV) return RV; @@ -449,19 +450,45 @@ /// update any maps that contain that pointer so we don't have stale /// pointers hanging around. void ValueRemoved(Value *V) { - if (FCR) FCR->NewToOldValueMap.erase(V); + if (FCR) { + // If this is in a pointer-compressed clone, update our map. + FCR->NewToOldValueMap.erase(V); + } else if (!PAFuncInfo.NewToOldValueMap.empty()) { + // Otherwise if this exists in a pool allocator clone, update it now. + PAFuncInfo.NewToOldValueMap.erase(V); + } else { + // Otherwise if this was in the original function, remove it from the + // DSG scalar map if it is there. + DSG.getScalarMap().eraseIfExists(V); + } } /// ValueReplaced - Whenever we replace a value from the current function, - /// update any maps that contain that pointer so we don't have stale - /// pointers hanging around. + /// update any maps that contain that value so we don't have stale pointers + /// hanging around. void ValueReplaced(Value &Old, Value *New) { + // If this value exists in a pointer compress clone, update it now. if (FCR) { std::map::iterator I = FCR->NewToOldValueMap.find(&Old); assert(I != FCR->NewToOldValueMap.end() && "Didn't find element!?"); FCR->NewToOldValueMap.insert(std::make_pair(New, I->second)); - FCR->NewToOldValueMap.erase(I); + FCR->NewToOldValueMap.erase(I); + } else if (!PAFuncInfo.NewToOldValueMap.empty()) { + // Otherwise if this exists in a pool allocator clone, update it now. + PA::FuncInfo::NewToOldValueMapTy::iterator I = + PAFuncInfo.NewToOldValueMap.find(&Old); + if (I != PAFuncInfo.NewToOldValueMap.end()) { + PAFuncInfo.NewToOldValueMap[New] = I->second; + PAFuncInfo.NewToOldValueMap.erase(I); + } + + } else { + // Finally, if this occurred in a function that neither the pool + // allocator nor the ptr compression implementation had to change, + // update the DSGraph. + if (DSG.getScalarMap().count(&Old)) + DSG.getScalarMap().replaceScalar(&Old, New); } } @@ -511,8 +538,8 @@ // Finally, remove it from the program. if (Instruction *Inst = dyn_cast(I->first)) { - Inst->eraseFromParent(); ValueRemoved(Inst); + Inst->eraseFromParent(); } else if (Argument *Arg = dyn_cast(I->first)) { assert(Arg->getParent() == 0 && "Unexpected argument type here!"); delete Arg; // Marker node used when cloning. @@ -821,10 +848,9 @@ if (NC->getType() != CI.getType()) // Compressing return value? setTransformedValue(CI, NC); else { - if (CI.getType() != Type::VoidTy) { + if (CI.getType() != Type::VoidTy) CI.replaceAllUsesWith(NC); - ValueReplaced(CI, NC); - } + ValueReplaced(CI, NC); CI.eraseFromParent(); } return; @@ -892,14 +918,16 @@ Operands.push_back(CI.getOperand(i)); } + std::cerr << "REPL: " << CI; + Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); + std::cerr << "WITH: " << *NC; if (NC->getType() != CI.getType()) // Compressing return value? setTransformedValue(CI, NC); else { - if (CI.getType() != Type::VoidTy) { + if (CI.getType() != Type::VoidTy) CI.replaceAllUsesWith(NC); - ValueReplaced(CI, NC); - } + ValueReplaced(CI, NC); CI.eraseFromParent(); } } From lattner at cs.uiuc.edu Sun Feb 27 16:32:18 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 16:32:18 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200502272232.j1RMWIUA016354@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PoolAllocate.cpp updated: 1.105 -> 1.106 --- Log message: Allow users to run this pass in opt. --- Diffs of the changes: (+1 -1) PoolAllocate.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.105 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.106 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.105 Fri Feb 25 15:01:14 2005 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Sun Feb 27 16:30:33 2005 @@ -39,7 +39,7 @@ namespace { RegisterOpt X("poolalloc", "Pool allocate disjoint data structures"); - RegisterPass + RegisterOpt Y("poolalloc-passing-all-pools", "Pool allocate disjoint data structures"); Statistic<> NumArgsAdded("poolalloc", "Number of function arguments added"); From lattner at cs.uiuc.edu Sun Feb 27 16:32:18 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 16:32:18 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200502272232.j1RMWITe016353@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: TransformFunctionBody.cpp updated: 1.36 -> 1.37 --- Log message: Make sure to keep the NewToOldValueMap up-to-date, even for non-pointer values! This fixes the horrible dangling pointer problems that I was hitting, and allows pointer compression to successfully transform perimeter (hopefully it will even run) :) --- Diffs of the changes: (+7 -17) TransformFunctionBody.cpp | 24 +++++++----------------- 1 files changed, 7 insertions(+), 17 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.36 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.37 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.36 Sun Feb 13 15:24:43 2005 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Sun Feb 27 16:32:04 2005 @@ -75,7 +75,7 @@ Instruction *TransformAllocationInstr(Instruction *I, Value *Size); Instruction *InsertPoolFreeInstr(Value *V, Instruction *Where); - void UpdateNewToOldValueMap(Value *OldVal, Value *NewV1, Value *NewV2) { + void UpdateNewToOldValueMap(Value *OldVal, Value *NewV1, Value *NewV2 = 0) { std::map::iterator I = FI.NewToOldValueMap.find(OldVal); assert(I != FI.NewToOldValueMap.end() && "OldVal not found in clone?"); @@ -563,26 +563,16 @@ if (CII != SM.end()) { SM[NewCall] = CII->second; SM.erase(CII); // Destroy the CallInst - } else { - // Otherwise update the NewToOldValueMap with the new CI return value - if (DS::isPointerType(TheCall->getType())) { - std::map::iterator CII = - FI.NewToOldValueMap.find(TheCall); - assert(CII != FI.NewToOldValueMap.end() && "CI not found in clone?"); - FI.NewToOldValueMap.insert(std::make_pair(NewCall, CII->second)); - FI.NewToOldValueMap.erase(CII); - } + } else if (!FI.NewToOldValueMap.empty()) { + // Otherwise, if this is a clone, update the NewToOldValueMap with the new + // CI return value. + UpdateNewToOldValueMap(TheCall, NewCall); } } else if (!FI.NewToOldValueMap.empty()) { - std::map::iterator II = - FI.NewToOldValueMap.find(TheCall); - assert(II != FI.NewToOldValueMap.end() && - "CI not found in clone?"); - FI.NewToOldValueMap.insert(std::make_pair(NewCall, II->second)); - FI.NewToOldValueMap.erase(II); + UpdateNewToOldValueMap(TheCall, NewCall); } - TheCall->getParent()->getInstList().erase(TheCall); + TheCall->eraseFromParent(); visitInstruction(*NewCall); } From lattner at cs.uiuc.edu Sun Feb 27 16:32:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 16:32:34 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Message-ID: <200502272232.j1RMWYvj016366@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.33 -> 1.34 --- Log message: Remove some printouts, drop some unneeded {}'s --- Diffs of the changes: (+2 -6) PointerCompress.cpp | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.33 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.34 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.33 Sun Feb 27 15:32:56 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Sun Feb 27 16:30:51 2005 @@ -912,16 +912,12 @@ for (unsigned i = NumPoolArgs+1, e = CI.getNumOperands(); i != e; ++i, ++AI) if (isa(CI.getOperand(i)->getType()) && - PoolsToCompress.count(CG->getNodeForValue(AI).getNode())) { + PoolsToCompress.count(CG->getNodeForValue(AI).getNode())) Operands.push_back(getTransformedValue(CI.getOperand(i))); - } else { + else Operands.push_back(CI.getOperand(i)); - } - - std::cerr << "REPL: " << CI; Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); - std::cerr << "WITH: " << *NC; if (NC->getType() != CI.getType()) // Compressing return value? setTransformedValue(CI, NC); else { From lattner at cs.uiuc.edu Sun Feb 27 16:33:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 27 Feb 2005 16:33:09 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/LICENSE.TXT Message-ID: <200502272233.j1RMX9tC016380@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc: LICENSE.TXT updated: 1.1 -> 1.2 --- Log message: This was horribly out of date. Thanks to resistor for pointing this out. --- Diffs of the changes: (+36 -23) LICENSE.TXT | 59 ++++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 36 insertions(+), 23 deletions(-) Index: llvm-poolalloc/LICENSE.TXT diff -u llvm-poolalloc/LICENSE.TXT:1.1 llvm-poolalloc/LICENSE.TXT:1.2 --- llvm-poolalloc/LICENSE.TXT:1.1 Tue Aug 12 10:02:35 2003 +++ llvm-poolalloc/LICENSE.TXT Sun Feb 27 16:32:56 2005 @@ -1,31 +1,44 @@ -LLVM Automatic Pool Allocation Transformation pre-release license: +============================================================================== +LLVM Pool Allocator Release License +============================================================================== +University of Illinois/NCSA +Open Source License -This is a pre-release version of the Automatic Pool Allocation -transformation, a component of the LLVM Compiler Infrastructure. The -entire LLVM Infrastructure (including the Automatic Pool Allocation -transformation) is covered by the license terms below. In addition, -note that the Automatic Pool Allocation Transformation is being provided -separately, strictly for internal use, and will not be included in -initial public distributions of the LLVM infrastructure. This version -of the transformation code may not be distributed to third parties, even -after the LLVM Infrastructure is released in the public domain. - -LLVM pre-release license: - -This is a pre-release distribution of the LLVM software and is provided for -evaluation only. This version of the LLVM software or modifications thereof -should not be distributed to third parties for any purpose. Any third parties -interested in it can request a copy directly by sending e-mail to -llvmdev at cs.uiuc.edu. As this is an evaluation release, we would appreciate any -and all feedback, ideas, and reports of bugs that you encounter. These can be -submitted through the llvmbugs at cs.uiuc.edu or llvmdev at cs.uiuc.edu mailing lists -as appropriate. We thank you for your interest in LLVM and look forward to any -comments or feedback you may have. +Copyright (c) 2003, 2004, 2005 University of Illinois at Urbana-Champaign. +All rights reserved. -THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.cs.uiuc.edu + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. + From jeffc at jolt-lang.org Sun Feb 27 18:09:07 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 27 Feb 2005 18:09:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200502280009.SAA15672@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.3 -> 1.4 --- Log message: Fix crash in LSR due to attempt to remove original induction variable. However, for reasons explained in the comments, I also deactivated this code as it needs more thought. --- Diffs of the changes: (+14 -3) LoopStrengthReduce.cpp | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.3 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.4 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.3 Sun Feb 27 15:08:04 2005 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Feb 27 18:08:56 2005 @@ -78,9 +78,14 @@ Instruction *I = *Insts.begin(); Insts.erase(Insts.begin()); if (isInstructionTriviallyDead(I)) { - for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (Instruction *U = dyn_cast(I->getOperand(i))) - Insts.insert(U); + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { + // Note: the PHI nodes had dropAllReferences() called on it, so its + // operands will all be NULL. + Value *V = I->getOperand(i); + if (V) + if (Instruction *U = dyn_cast(V)) + Insts.insert(U); + } I->getParent()->getInstList().erase(I); Changed = true; } @@ -237,6 +242,11 @@ // 4. the add is used by the cann indvar // If all four cases above are true, then we can remove both the add and // the cann indvar. +#if 0 + // FIXME: it's not clear this code is correct. An induction variable with + // but one use, an increment, implies an infinite loop. Not illegal, but + // of questionable utility. It also does not update the loop info with the + // new induction variable. if (PN->hasOneUse()) { BinaryOperator *BO = dyn_cast(*(PN->use_begin())); if (BO && BO->getOpcode() == Instruction::Add) @@ -250,5 +260,6 @@ } } } +#endif } } From reid at x10sys.com Sun Feb 27 18:40:39 2005 From: reid at x10sys.com (Reid Spencer) Date: Sun, 27 Feb 2005 18:40:39 -0600 Subject: [llvm-commits] CVS: llvm/docs/Projects.html Message-ID: <200502280040.SAA15911@zion.cs.uiuc.edu> Changes in directory llvm/docs: Projects.html updated: 1.16 -> 1.17 --- Log message: Add a little more detail about the configuration process for projects. --- Diffs of the changes: (+30 -17) Projects.html | 47 ++++++++++++++++++++++++++++++----------------- 1 files changed, 30 insertions(+), 17 deletions(-) Index: llvm/docs/Projects.html diff -u llvm/docs/Projects.html:1.16 llvm/docs/Projects.html:1.17 --- llvm/docs/Projects.html:1.16 Sat Jan 15 20:38:06 2005 +++ llvm/docs/Projects.html Sun Feb 27 18:40:29 2005 @@ -89,39 +89,52 @@
  • Add your source code and Makefiles to your source tree.
  • -
  • If you want your Makefiles to be configured by the configure -script, or if you want to support multiple object directories, add your -Makefiles to the configure script by adding them into the -autoconf/configure.ac file. The macro AC_CONFIG_MAKEFILE will -copy a file, unmodified, from the source directory to the object directory.
  • +
  • If you want your project to be configured with the configure script +then you need to edit autoconf/configure.ac as follows: +
      +
    • AC_INIT. Place the name of your project, its version number and + a contact email address for your project as the arguments to this macro
    • +
    • AC_CONFIG_AUC_DIR. If your project isn't in the + llvm/projects directory then you might need to adjust this so that + it specifies a relative path to the llvm/autoconf directory.
    • +
    • LLVM_CONFIG_PROJECT. Just leave this alone.
    • +
    • AC_CONFIG_SRCDIR. Specify a path to a file name that identifies + your project; or just leave it at Makefile.config.in
    • +
    • AC_CONFIG_FILES. Do not change.
    • +
    • AC_CONFIG_MAKEFILE. Use one of these macros for each Makefile + that your project uses. This macro arranges for your makefiles to be copied + from the source directory, unmodified, to the build directory.
    • +
    +
  • After updating autoconf/configure.ac, regenerate the configure script with these commands:

    % cd autoconf
    - % autoconf -o ../configure

    + % AutoRegen.sh

    -

    You must be using Autoconf version 2.57 or higher.

  • +

    You must be using Autoconf version 2.59 or later and your aclocal version +should 1.9 or later.

  • Run configure in the directory in which you want to place object code. Use the following options to tell your project where it can find LLVM:
    -
    --with-llvmsrc=<directory> -
    - Tell your project where the LLVM source tree is located. -

    -

    --with-llvmobj=<directory> -
    - Tell your project where the LLVM object tree is located. +
    --with-llvmsrc=<directory>
    +
    Tell your project where the LLVM source tree is located.
    +

    --with-llvmobj=<directory>
    +
    Tell your project where the LLVM object tree is located.
    +

    --prefix=<directory>
    +
    Tell your project where it should get installed.
    -

    That's it! Now all you have to do is type gmake in the root of -your object directory, and your project should build.

    +

    That's it! Now all you have to do is type gmake (or make +if your on a GNU/Linux system) in the root of your object directory, and your +project should build.

    @@ -438,7 +451,7 @@ John Criswell
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/01/16 02:38:06 $ + Last modified: $Date: 2005/02/28 00:40:29 $ From reid at x10sys.com Sun Feb 27 19:10:59 2005 From: reid at x10sys.com (Reid Spencer) Date: Sun, 27 Feb 2005 19:10:59 -0600 Subject: [llvm-commits] CVS: llvm/docs/Projects.html Message-ID: <200502280110.TAA16304@zion.cs.uiuc.edu> Changes in directory llvm/docs: Projects.html updated: 1.17 -> 1.18 --- Log message: A few small steps toward HTML 4.01 Strict compliance. --- Diffs of the changes: (+5 -9) Projects.html | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) Index: llvm/docs/Projects.html diff -u llvm/docs/Projects.html:1.17 llvm/docs/Projects.html:1.18 --- llvm/docs/Projects.html:1.17 Sun Feb 27 18:40:29 2005 +++ llvm/docs/Projects.html Sun Feb 27 19:10:48 2005 @@ -94,7 +94,7 @@
    • AC_INIT. Place the name of your project, its version number and a contact email address for your project as the arguments to this macro
    • -
    • AC_CONFIG_AUC_DIR. If your project isn't in the +
    • AC_CONFIG_AUC_DIR. If your project isn't in the llvm/projects directory then you might need to adjust this so that it specifies a relative path to the llvm/autoconf directory.
    • LLVM_CONFIG_PROJECT. Just leave this alone.
    • @@ -203,19 +203,15 @@ test procedure uses RUN lines in the actual test case to determine how to run the test. See the TestingGuide for more details. You - can easily write Makefile support similar to the Makefiles in llvm/test - to use Dejagnu to run your project's tests. - -

      - + can easily write Makefile support similar to the Makefiles in + llvm/test to use Dejagnu to run your project's tests.

    • LLVM contains an optional package called llvm-test which provides benchmarks and programs that are known to compile with the LLVM GCC front ends. You can use these programs to test your code, gather statistics information, and compare it to the current LLVM performance statistics. -

      - Currently, there is no way to hook your tests directly into the +
      Currently, there is no way to hook your tests directly into the llvm/test testing harness. You will simply need to find a way to use the source provided within that directory on your own. @@ -451,7 +447,7 @@ John Criswell
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2005/02/28 00:40:29 $ + Last modified: $Date: 2005/02/28 01:10:48 $ From alenhar2 at cs.uiuc.edu Sun Feb 27 21:19:08 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 27 Feb 2005 21:19:08 -0600 Subject: [llvm-commits] CVS: llvm-www/testresults/index.html Message-ID: <200502280319.j1S3J813017882@apoc.cs.uiuc.edu> Changes in directory llvm-www/testresults: index.html updated: 1.27 -> 1.28 --- Log message: added fenris --- Diffs of the changes: (+4 -1) index.html | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm-www/testresults/index.html diff -u llvm-www/testresults/index.html:1.27 llvm-www/testresults/index.html:1.28 --- llvm-www/testresults/index.html:1.27 Mon Feb 14 10:06:31 2005 +++ llvm-www/testresults/index.html Sun Feb 27 21:18:53 2005 @@ -49,7 +49,10 @@

      Alpha

        -
      1. Linux (Single 21164 EV56 500 MHz) -- debug +
      2. Linux (Single 21164 EV56 500 MHz) -- release +build
      3. + +
      4. Linux (Single 22164 EV7 633 MHz) -- debug build
      From alenhar2 at cs.uiuc.edu Sun Feb 27 21:21:58 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 27 Feb 2005 21:21:58 -0600 Subject: [llvm-commits] CVS: llvm-www/testresults/index.html Message-ID: <200502280321.j1S3LwNX017941@apoc.cs.uiuc.edu> Changes in directory llvm-www/testresults: index.html updated: 1.28 -> 1.29 --- Log message: typo --- Diffs of the changes: (+1 -1) index.html | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/testresults/index.html diff -u llvm-www/testresults/index.html:1.28 llvm-www/testresults/index.html:1.29 --- llvm-www/testresults/index.html:1.28 Sun Feb 27 21:18:53 2005 +++ llvm-www/testresults/index.html Sun Feb 27 21:21:45 2005 @@ -52,7 +52,7 @@
    • Linux (Single 21164 EV56 500 MHz) -- release build
    • -
    • Linux (Single 22164 EV7 633 MHz) -- debug +
    • Linux (Single 21264 EV7 633 MHz) -- debug build