From lattner at cs.uiuc.edu Mon Nov 15 01:02:56 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 01:02:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200411150702.iAF72utI000639@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.108 -> 1.109 --- Log message: Count more accurately --- Diffs of the changes: (+4 -0) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.108 llvm/lib/Transforms/Scalar/SCCP.cpp:1.109 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.108 Sun Nov 14 23:45:33 2004 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Nov 15 01:02:42 2004 @@ -44,6 +44,7 @@ // namespace { Statistic<> NumInstRemoved("sccp", "Number of instructions removed"); + Statistic<> NumDeadBlocks ("sccp", "Number of basic blocks unreachable"); class LatticeVal { enum { @@ -853,6 +854,8 @@ for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (!ExecutableBBs.count(BB)) { DEBUG(std::cerr << " BasicBlock Dead:" << *BB); + ++NumDeadBlocks; + // Delete the instructions backwards, as it has a reduced likelihood of // having to update as many def-use and use-def chains. std::vector Insts; @@ -866,6 +869,7 @@ I->replaceAllUsesWith(UndefValue::get(I->getType())); BB->getInstList().erase(I); MadeChanges = true; + ++NumInstRemoved; } } From lattner at cs.uiuc.edu Mon Nov 15 01:15:16 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 01:15:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200411150715.iAF7FGpc000878@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.109 -> 1.110 --- Log message: Minor cleanups. There is no reason for SCCP to derive from instvisitor anymore. --- Diffs of the changes: (+14 -21) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.109 llvm/lib/Transforms/Scalar/SCCP.cpp:1.110 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.109 Mon Nov 15 01:02:42 2004 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Nov 15 01:15:04 2004 @@ -794,23 +794,21 @@ namespace { -//===----------------------------------------------------------------------===// -// -/// SCCP Class - This class does all of the work of Sparse Conditional Constant -/// Propagation. -/// -class SCCP : public FunctionPass, public InstVisitor { -public: - - // runOnFunction - Run the Sparse Conditional Constant Propagation algorithm, - // and return true if the function was modified. + //===--------------------------------------------------------------------===// // - bool runOnFunction(Function &F); - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesCFG(); - } -}; + /// SCCP Class - This class uses the SCCPSolver to implement a per-function + /// Sparse Conditional COnstant Propagator. + /// + struct SCCP : public FunctionPass { + // runOnFunction - Run the Sparse Conditional Constant Propagation + // algorithm, and return true if the function was modified. + // + bool runOnFunction(Function &F); + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + } + }; RegisterOpt X("sccp", "Sparse Conditional Constant Propagation"); } // end anonymous namespace @@ -822,10 +820,6 @@ } -//===----------------------------------------------------------------------===// -// SCCP Class Implementation - - // runOnFunction() - Run the Sparse Conditional Constant Propagation algorithm, // and return true if the function was modified. // @@ -907,4 +901,3 @@ return MadeChanges; } - From reid at x10sys.com Mon Nov 15 11:20:39 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 11:20:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Signals.cpp Message-ID: <200411151720.LAA23894@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Signals.cpp updated: 1.10 -> 1.11 --- Log message: Adjust implementation to match new interface. Patch provided by Morten Ofstad --- Diffs of the changes: (+2 -2) Index: llvm/lib/System/Win32/Signals.cpp diff -u llvm/lib/System/Win32/Signals.cpp:1.10 llvm/lib/System/Win32/Signals.cpp:1.11 --- llvm/lib/System/Win32/Signals.cpp:1.10 Fri Nov 5 16:15:36 2004 +++ llvm/lib/System/Win32/Signals.cpp Mon Nov 15 11:20:28 2004 @@ -72,7 +72,7 @@ } // RemoveFileOnSignal - The public API -void sys::RemoveFileOnSignal(const std::string &Filename) { +void sys::RemoveFileOnSignal(const sys::Path &Filename) { RegisterHandler(); if (CleanupExecuted) @@ -81,7 +81,7 @@ if (FilesToRemove == NULL) FilesToRemove = new std::vector; - FilesToRemove->push_back(sys::Path(Filename)); + FilesToRemove->push_back(sys::Path(Filename.get())); LeaveCriticalSection(&CriticalSection); } From reid at x10sys.com Mon Nov 15 11:22:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 11:22:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Win32.h Message-ID: <200411151722.LAA23937@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Win32.h updated: 1.1 -> 1.2 --- Log message: Provide the ThrowErrno utility. Patch contributed by Morten Ofstad --- Diffs of the changes: (+3 -0) Index: llvm/lib/System/Win32/Win32.h diff -u llvm/lib/System/Win32/Win32.h:1.1 llvm/lib/System/Win32/Win32.h:1.2 --- llvm/lib/System/Win32/Win32.h:1.1 Wed Sep 15 00:48:11 2004 +++ llvm/lib/System/Win32/Win32.h Mon Nov 15 11:21:57 2004 @@ -31,3 +31,6 @@ throw s; } +inline void ThrowErrno(const std::string& prefix) { + ThrowError(prefix + ": " + strerror(errno)); +} From reid at x10sys.com Mon Nov 15 11:27:11 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 11:27:11 -0600 Subject: [llvm-commits] CVS: llvm/win32/Support/Support.vcproj Message-ID: <200411151727.LAA24035@zion.cs.uiuc.edu> Changes in directory llvm/win32/Support: Support.vcproj updated: 1.2 -> 1.3 --- Log message: Update relative files. Patch contributed by Morten Ofstad. --- Diffs of the changes: (+105 -0) Index: llvm/win32/Support/Support.vcproj diff -u llvm/win32/Support/Support.vcproj:1.2 llvm/win32/Support/Support.vcproj:1.3 --- llvm/win32/Support/Support.vcproj:1.2 Sat Nov 6 11:07:36 2004 +++ llvm/win32/Support/Support.vcproj Mon Nov 15 11:27:00 2004 @@ -183,6 +183,111 @@ Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From reid at x10sys.com Mon Nov 15 11:28:19 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 11:28:19 -0600 Subject: [llvm-commits] CVS: llvm/win32/VMCore/VMCore.vcproj Message-ID: <200411151728.LAA24075@zion.cs.uiuc.edu> Changes in directory llvm/win32/VMCore: VMCore.vcproj updated: 1.2 -> 1.3 --- Log message: Updates to Visual C++ project files for building on win32. Patch contributed by Morten Ofstad. --- Diffs of the changes: (+0 -3) Index: llvm/win32/VMCore/VMCore.vcproj diff -u llvm/win32/VMCore/VMCore.vcproj:1.2 llvm/win32/VMCore/VMCore.vcproj:1.3 --- llvm/win32/VMCore/VMCore.vcproj:1.2 Sat Nov 6 11:07:36 2004 +++ llvm/win32/VMCore/VMCore.vcproj Mon Nov 15 11:28:08 2004 @@ -142,9 +142,6 @@ RelativePath="..\..\lib\VMCore\LeakDetector.cpp"> - - Changes in directory llvm/win32/System: System.vcproj updated: 1.2 -> 1.3 --- Log message: Updates to Visual C++ project files for building on win32. Patch contributed by Morten Ofstad. --- Diffs of the changes: (+2 -4) Index: llvm/win32/System/System.vcproj diff -u llvm/win32/System/System.vcproj:1.2 llvm/win32/System/System.vcproj:1.3 --- llvm/win32/System/System.vcproj:1.2 Sat Nov 6 11:07:36 2004 +++ llvm/win32/System/System.vcproj Mon Nov 15 11:28:08 2004 @@ -230,15 +230,13 @@ + Name="Debug|Win32"> + Name="Release|Win32"> From reid at x10sys.com Mon Nov 15 11:29:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 11:29:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200411151729.LAA24110@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.28 -> 1.29 --- Log message: Remove unused variable for compilation by VC++. Patch contributed by Morten Ofstad. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.28 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.29 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.28 Sat Nov 13 23:00:19 2004 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Nov 15 11:29:41 2004 @@ -336,7 +336,7 @@ for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); UI != E; ) { GetElementPtrInst *GEPI = cast(*UI++); - gep_type_iterator I = gep_type_begin(GEPI), E = gep_type_end(GEPI); + gep_type_iterator I = gep_type_begin(GEPI); ++I; if (const ArrayType *AT = dyn_cast(*I)) { From lattner at cs.uiuc.edu Mon Nov 15 13:02:50 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 13:02:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/BasicBlock.h DerivedTypes.h Function.h Instructions.h Module.h SymbolTable.h User.h Message-ID: <200411151902.iAFJ2oTa002220@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: BasicBlock.h updated: 1.44 -> 1.45 DerivedTypes.h updated: 1.63 -> 1.64 Function.h updated: 1.54 -> 1.55 Instructions.h updated: 1.6 -> 1.7 Module.h updated: 1.53 -> 1.54 SymbolTable.h updated: 1.37 -> 1.38 User.h updated: 1.31 -> 1.32 --- Log message: Warning fixes for VC++, contributed by Morten Ofstad! --- Diffs of the changes: (+14 -14) Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.44 llvm/include/llvm/BasicBlock.h:1.45 --- llvm/include/llvm/BasicBlock.h:1.44 Wed Oct 27 11:14:47 2004 +++ llvm/include/llvm/BasicBlock.h Mon Nov 15 13:02:35 2004 @@ -121,7 +121,7 @@ inline reverse_iterator rend () { return InstList.rend(); } inline const_reverse_iterator rend () const { return InstList.rend(); } - inline unsigned size() const { return InstList.size(); } + inline size_t size() const { return InstList.size(); } inline bool empty() const { return InstList.empty(); } inline const Instruction &front() const { return InstList.front(); } inline Instruction &front() { return InstList.front(); } Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.63 llvm/include/llvm/DerivedTypes.h:1.64 --- llvm/include/llvm/DerivedTypes.h:1.63 Tue Oct 19 00:49:46 2004 +++ llvm/include/llvm/DerivedTypes.h Mon Nov 15 13:02:35 2004 @@ -140,7 +140,7 @@ /// getNumParams - Return the number of fixed parameters this function type /// requires. This does not consider varargs. /// - unsigned getNumParams() const { return ContainedTys.size()-1; } + unsigned getNumParams() const { return (unsigned)ContainedTys.size()-1; } // Implement the AbstractTypeUser interface. virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); @@ -206,7 +206,7 @@ element_iterator element_end() const { return ContainedTys.end(); } // Random access to the elements - unsigned getNumElements() const { return ContainedTys.size(); } + unsigned getNumElements() const { return (unsigned)ContainedTys.size(); } const Type *getElementType(unsigned N) const { assert(N < ContainedTys.size() && "Element number out of range!"); return ContainedTys[N]; Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.54 llvm/include/llvm/Function.h:1.55 --- llvm/include/llvm/Function.h:1.54 Tue Oct 19 00:50:34 2004 +++ llvm/include/llvm/Function.h Mon Nov 15 13:02:35 2004 @@ -168,7 +168,7 @@ reverse_iterator rend () { return BasicBlocks.rend(); } const_reverse_iterator rend () const { return BasicBlocks.rend(); } - unsigned size() const { return BasicBlocks.size(); } + size_t size() const { return BasicBlocks.size(); } bool empty() const { return BasicBlocks.empty(); } const BasicBlock &front() const { return BasicBlocks.front(); } BasicBlock &front() { return BasicBlocks.front(); } @@ -188,7 +188,7 @@ reverse_aiterator arend () { return ArgumentList.rend(); } const_reverse_aiterator arend () const { return ArgumentList.rend(); } - unsigned asize() const { return ArgumentList.size(); } + size_t asize() const { return ArgumentList.size(); } bool aempty() const { return ArgumentList.empty(); } const Argument &afront() const { return ArgumentList.front(); } Argument &afront() { return ArgumentList.front(); } Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.6 llvm/include/llvm/Instructions.h:1.7 --- llvm/include/llvm/Instructions.h:1.6 Wed Oct 27 11:14:47 2004 +++ llvm/include/llvm/Instructions.h Mon Nov 15 13:02:35 2004 @@ -275,7 +275,7 @@ : Instruction((static_cast(&EPI)->getType()), GetElementPtr) { Operands.reserve(EPI.Operands.size()); - for (unsigned i = 0, E = EPI.Operands.size(); i != E; ++i) + for (unsigned i = 0, E = (unsigned)EPI.Operands.size(); i != E; ++i) Operands.push_back(Use(EPI.Operands[i], this)); } void init(Value *Ptr, const std::vector &Idx); @@ -712,7 +712,7 @@ /// getNumIncomingValues - Return the number of incoming edges /// - unsigned getNumIncomingValues() const { return Operands.size()/2; } + unsigned getNumIncomingValues() const { return (unsigned)Operands.size()/2; } /// getIncomingValue - Return incoming value #x /// @@ -994,7 +994,7 @@ /// getNumCases - return the number of 'cases' in this switch instruction. /// Note that case #0 is always the default case. unsigned getNumCases() const { - return Operands.size()/2; + return (unsigned)Operands.size()/2; } /// getCaseValue - Return the specified case value. Note that case #0, the @@ -1055,7 +1055,7 @@ assert(idx < getNumSuccessors() && "Successor # out of range!"); return cast(Operands[idx*2].get()); } - virtual unsigned getNumSuccessors() const { return Operands.size()/2; } + virtual unsigned getNumSuccessors() const { return (unsigned)Operands.size()/2; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SwitchInst *) { return true; } Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.53 llvm/include/llvm/Module.h:1.54 --- llvm/include/llvm/Module.h:1.53 Fri Oct 29 14:20:42 2004 +++ llvm/include/llvm/Module.h Mon Nov 15 13:02:35 2004 @@ -201,7 +201,7 @@ inline reverse_giterator grend () { return GlobalList.rend(); } inline const_reverse_giterator grend () const { return GlobalList.rend(); } - inline unsigned gsize() const { return GlobalList.size(); } + inline size_t gsize() const { return GlobalList.size(); } inline bool gempty() const { return GlobalList.empty(); } inline const GlobalVariable &gfront() const { return GlobalList.front(); } inline GlobalVariable &gfront() { return GlobalList.front(); } @@ -219,7 +219,7 @@ inline reverse_iterator rend () { return FunctionList.rend(); } inline const_reverse_iterator rend () const { return FunctionList.rend(); } - inline unsigned size() const { return FunctionList.size(); } + inline size_t size() const { return FunctionList.size(); } inline bool empty() const { return FunctionList.empty(); } inline const Function &front() const { return FunctionList.front(); } inline Function &front() { return FunctionList.front(); } @@ -236,7 +236,7 @@ inline lib_iterator lib_end() const { return LibraryList.end(); } /// @brief Returns the number of items in the list of libraries. - inline unsigned lib_size() const { return LibraryList.size(); } + inline size_t lib_size() const { return LibraryList.size(); } /// @brief Add a library to the list of dependent libraries inline void addLibrary(const std::string& Lib){ LibraryList.insert(Lib); } Index: llvm/include/llvm/SymbolTable.h diff -u llvm/include/llvm/SymbolTable.h:1.37 llvm/include/llvm/SymbolTable.h:1.38 --- llvm/include/llvm/SymbolTable.h:1.37 Sat Jul 17 18:30:45 2004 +++ llvm/include/llvm/SymbolTable.h Mon Nov 15 13:02:35 2004 @@ -119,7 +119,7 @@ unsigned type_size(const Type *TypeID) const; /// @brief The number of name/type pairs is returned. - inline unsigned num_types() const { return tmap.size(); } + inline unsigned num_types() const { return (unsigned)tmap.size(); } /// Finds the value \p val in the symbol table and returns its /// name. Only the type plane associated with the type of \p val Index: llvm/include/llvm/User.h diff -u llvm/include/llvm/User.h:1.31 llvm/include/llvm/User.h:1.32 --- llvm/include/llvm/User.h:1.31 Sat Jul 17 18:32:11 2004 +++ llvm/include/llvm/User.h Mon Nov 15 13:02:35 2004 @@ -44,7 +44,7 @@ assert(i < Operands.size() && "setOperand() out of range!"); Operands[i] = Val; } - inline unsigned getNumOperands() const { return Operands.size(); } + inline unsigned getNumOperands() const { return (unsigned)Operands.size(); } // --------------------------------------------------------------------------- // Operand Iterator interface... From reid at x10sys.com Mon Nov 15 13:12:17 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 13:12:17 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ar.pod Message-ID: <200411151912.NAA25264@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-ar.pod updated: 1.3 -> 1.4 --- Log message: Changes/corrections suggested from Chris Lattner's review. --- Diffs of the changes: (+75 -28) Index: llvm/docs/CommandGuide/llvm-ar.pod diff -u llvm/docs/CommandGuide/llvm-ar.pod:1.3 llvm/docs/CommandGuide/llvm-ar.pod:1.4 --- llvm/docs/CommandGuide/llvm-ar.pod:1.3 Thu Nov 11 18:16:51 2004 +++ llvm/docs/CommandGuide/llvm-ar.pod Mon Nov 15 13:12:06 2004 @@ -6,7 +6,7 @@ =head1 SYNOPSIS -B [-X32_64] [-]{dmpqrtx}[Rabfikouz] [relpos] [count] [files...] +B [-]{dmpqrtx}[Rabfikouz] [relpos] [count] [files...] =head1 DESCRIPTION @@ -14,16 +14,29 @@ The B command is similar to the common Unix utility, C. It archives several files together into a single file. The intent for this is to produce archive libraries by LLVM bytecode that can be linked into an -LLVM program. However, the archive can contain any kind of file. If requested, -B can generate a symbol table that makes linking faster because +LLVM program. However, the archive can contain any kind of file. By default, +B generates a symbol table that makes linking faster because only the symbol table needs to be consulted, not each individual file member of the archive. -While the B command produces files that are similar to the format -used by older C implementations, it has several significant departures -in order to make the archive appropriate for LLVM. Consequently, archives -produced with B probably won't be readable or editable with any -C implementation unless the archive content is very simple. +The B command can be used to I both SVR4 and BSD style archive +files. However, it cannot be used to write them. While the B command +produces files that are I identical to the format used by other C +implementations, it has two significant departures in order to make the +archive appropriate for LLVM. There are first departure is that B only +uses BSD4.4 style long path names (stored immediately after the header) and +never contains a string table for long names. The second departure is that the +symbol table is formated for efficient construction of an in-memory data +structure that permits rapid (red-black tree) lookups. Consequently, archives +produced with B usually won't be readable or editable with any +C implementation or useful for linking. Using the C modifier to flatten +file names will make the archive readable by other C implementations +but not for linking because the symbol table format for LLVM is unique. If an +SVR4 or BSD style archive is used with the C (replace) or C (quick +update) operations, the archive will be reconstructed in LLVM format. This +means that the string table will be dropped (in deference to BSD 4.4 long names) +and an LLVM symbol table will be added (by default). The system symbol table +will be retained. Here's where B departs from previous C implementations: @@ -48,10 +61,10 @@ =item I B can compress the members of an archive to save space. The -compression used depends on what's available on the platform but favors -bzip2 and then zlib. Note that for very small files, bzip2 may increase -the file size but generally does about 10% better than zlib on LLVM -bytecode files. +compression used depends on what's available on the platform and what choices +the LLVM Compressor utility makes. It generally favors bzip2 but will select +between "no compression", bzip2 or zlib depending on what makes sense for the +file's content. =item I @@ -82,7 +95,7 @@ The Operations and Modifiers are explained in the sections below. The minimal set of options is at least one operator and the name of the archive. Typically archive files end with a C<.a> suffix, but this is not required. Following -the F comes a list of F that indicate the specific members +the F comes a list of F that indicate the specific members of the archive to operate on. If the F option is not specified, it generally means either "none" or "all" members, depending on the operation. @@ -117,9 +130,9 @@ Quickly append files to the end of the archive. The F, F, and F modifiers apply to this operation. This operation quickly adds the -F to the archive without checking for duplicates that shoud be +F to the archive without checking for duplicates that should be removed first. If no F are specified, the archive is not modified. -Becasue of the way that B constructs the archive file, its dubious +Because of the way that B constructs the archive file, its dubious whether the F operation is any faster than the F operation. =item r[Rabfuz] @@ -211,7 +224,7 @@ =item [u] When replacing existing files in the archive, only replace those files that have -a timestamp than the timestamp of the member in the archive. +a time stamp than the time stamp of the member in the archive. =item [z] @@ -239,7 +252,7 @@ This modifier requests that an archive index (or symbol table) be added to the archive. This is the default mode of operation. The symbol table will contain all the externally visible functions and global variables defined by all the -bytecode files in the archive. Using this modifer is more efficient that using +bytecode files in the archive. Using this modifier is more efficient that using L which also creates the symbol table. =item [S] @@ -251,7 +264,7 @@ =item [v] This modifier instructs B to be verbose about what it is doing. Each -editing operation taken agains the archive will produce a line of output saying +editing operation taken against the archive will produce a line of output saying what is being done. =back @@ -264,11 +277,12 @@ file format follow. Each archive begins with the archive magic number which is the eight printable -characters !\n where \n represents the newline character (0x0A). Following -the magic number, the file is composed of even length members that begin with an -archive header and end with a \n padding character if necessary (to make the -length even). Each file member is composed of a header (defined below), an -optional null-terminated "long file name" and the contents of the file. +characters "!\n" where \n represents the newline character (0x0A). +Following the magic number, the file is composed of even length members that +begin with an archive header and end with a \n padding character if necessary +(to make the length even). Each file member is composed of a header (defined +below), an optional newline-terminated "long file name" and the contents of +the file. The fields of the header are described in the items below. All fields of the header contain only ASCII characters, are left justified and are right padded @@ -293,28 +307,28 @@ =item uid - char[6] -This field provides the user id of the file encoded as a decimal ascii string. +This field provides the user id of the file encoded as a decimal ASCII string. This field might not make much sense on non-Unix systems. On Unix, it is the same value as the st_uid field of the stat structure returned by the stat(2) operating system call. =item gid - char[6] -This field provides the group id of the file encoded as a decimal ascii string. +This field provides the group id of the file encoded as a decimal ASCII string. This field might not make much sense on non-Unix systems. On Unix, it is the same value as the st_gid field of the stat structure returned by the stat(2) operating system call. =item mode - char[8] -This field provides the access mode of the file encoded as an octal ascii +This field provides the access mode of the file encoded as an octal ASCII string. This field might not make much sense on non-Unix systems. On Unix, it is the same value as the st_mode field of the stat structure returned by the stat(2) operating system call. =item size - char[10] -This field provides the size of the file, in bytes, encoded as a decimal ascii +This field provides the size of the file, in bytes, encoded as a decimal ASCII string. If the size field is negative (starts with a minus sign, 0x02D), then the archive member is stored in compressed form. The first byte of the archive member's data indicates the compression type used. A value of 0 (0x30) indicates @@ -325,11 +339,44 @@ =item fmag - char[2] This field is the archive file member magic number. Its content is always the -two characters backtick (0x60) and newline (0x0A). This provides some measure +two characters back tick (0x60) and newline (0x0A). This provides some measure utility in identifying archive files that have been corrupted. =back +The LLVM symbol table has the special name "#_LLVM_SYM_TAB_#". It is presumed +that no regular archive member file will want this name. The LLVM symbol table +is simply composed of a sequence of triplets: byte offset, length of symbol, +and the symbol itself. Symbols are not null or newline terminated. Here are +the details on each of these items: + +=over + +=item offset - vbr encoded 32-bit integer + +The offset item provides the offset into the archive file where the bytecode +member is stored that is associated with the symbol. The offset value is 0 +based at the start of the first "normal" file member. To derive the actual +file offset of the member, you must add the number of bytes occupied by the file +signature (8 bytes) and the symbol tables. The value of this item is encoded +using variable bit rate encoding to reduce the size of the symbol table. +Variable bit rate encoding uses the high bit (0x80) of each byte to indicate +if there are more bytes to follow. The remaining 7 bits in each byte carry bits +from the value. The final byte does not have the high bit set. + +=item length - vbr encoded 32-bit integer + +The length item provides the length of the symbol that follows. Like this +I item, the length is variable bit rate encoded. + +=item symbol - character array + +The symbol item provides the text of the symbol that is associated with the +I. The symbol is not terminated by any character. Its length is provided +by the I field. Note that is allowed (but unwise) to use non-printing +characters (even 0x00) in the symbol. This allows for multiple encodings of +symbol names. + =head1 EXIT STATUS If B succeeds, it will exit with 0. A usage error, results From tbrethou at cs.uiuc.edu Mon Nov 15 13:22:15 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Mon, 15 Nov 2004 13:22:15 -0600 (CST) Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200411151922.NAA12244@kain.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.17 -> 1.18 --- Log message: This file was originally developed by the LLVM research group so this comment should stay. I also do NOT want my name explicity listed on src files. I am already mentioned in the credits. --- Diffs of the changes: (+2 -3) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.17 llvm/tools/llvm-ar/llvm-ar.cpp:1.18 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.17 Sun Nov 14 17:17:41 2004 +++ llvm/tools/llvm-ar/llvm-ar.cpp Mon Nov 15 13:21:49 2004 @@ -2,9 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the Reid Spencer based on the original design by -// Tanya Lattner and is distributed by the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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. // //===----------------------------------------------------------------------===// // From brukman at cs.uiuc.edu Mon Nov 15 13:30:16 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 13:30:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200411151930.NAA03043@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.164 -> 1.165 --- Log message: Remove extra space char --- Diffs of the changes: (+1 -1) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.164 llvm/lib/VMCore/AsmWriter.cpp:1.165 --- llvm/lib/VMCore/AsmWriter.cpp:1.164 Sun Nov 14 15:04:34 2004 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Nov 15 13:30:05 2004 @@ -671,7 +671,7 @@ const Module* getModule() { return TheModule; } -private : +private: void printModule(const Module *M); void printSymbolTable(const SymbolTable &ST); void printConstant(const Constant *CPV); From reid at x10sys.com Mon Nov 15 13:45:41 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 13:45:41 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ar.pod Message-ID: <200411151945.NAA03182@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-ar.pod updated: 1.4 -> 1.5 --- Log message: Terminate a list. Remove reference to llvm-ld --- Diffs of the changes: (+3 -1) Index: llvm/docs/CommandGuide/llvm-ar.pod diff -u llvm/docs/CommandGuide/llvm-ar.pod:1.4 llvm/docs/CommandGuide/llvm-ar.pod:1.5 --- llvm/docs/CommandGuide/llvm-ar.pod:1.4 Mon Nov 15 13:12:06 2004 +++ llvm/docs/CommandGuide/llvm-ar.pod Mon Nov 15 13:45:29 2004 @@ -377,6 +377,8 @@ characters (even 0x00) in the symbol. This allows for multiple encodings of symbol names. +=back + =head1 EXIT STATUS If B succeeds, it will exit with 0. A usage error, results @@ -386,7 +388,7 @@ =head1 SEE ALSO -L, L +L =head1 AUTHORS From reid at x10sys.com Mon Nov 15 13:47:31 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 13:47:31 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ranlib.pod Message-ID: <200411151947.NAA03586@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-ranlib.pod updated: 1.1 -> 1.2 --- Log message: Remove reference to llvm-ld. --- Diffs of the changes: (+1 -1) Index: llvm/docs/CommandGuide/llvm-ranlib.pod diff -u llvm/docs/CommandGuide/llvm-ranlib.pod:1.1 llvm/docs/CommandGuide/llvm-ranlib.pod:1.2 --- llvm/docs/CommandGuide/llvm-ranlib.pod:1.1 Thu Nov 11 18:18:35 2004 +++ llvm/docs/CommandGuide/llvm-ranlib.pod Mon Nov 15 13:47:20 2004 @@ -43,7 +43,7 @@ =head1 SEE ALSO -L,L +L =head1 AUTHORS From brukman at cs.uiuc.edu Mon Nov 15 13:50:26 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 13:50:26 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ar.pod Message-ID: <200411151950.NAA03843@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-ar.pod updated: 1.5 -> 1.6 --- Log message: This is llvm-ar, not llvm-as. --- Diffs of the changes: (+1 -1) Index: llvm/docs/CommandGuide/llvm-ar.pod diff -u llvm/docs/CommandGuide/llvm-ar.pod:1.5 llvm/docs/CommandGuide/llvm-ar.pod:1.6 --- llvm/docs/CommandGuide/llvm-ar.pod:1.5 Mon Nov 15 13:45:29 2004 +++ llvm/docs/CommandGuide/llvm-ar.pod Mon Nov 15 13:50:15 2004 @@ -381,7 +381,7 @@ =head1 EXIT STATUS -If B succeeds, it will exit with 0. A usage error, results +If B succeeds, it will exit with 0. A usage error, results in an exit code of 1. A hard (file system typically) error results in an exit code of 2. Miscellaneous or unknown errors result in an exit code of 3. From brukman at cs.uiuc.edu Mon Nov 15 13:53:53 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 13:53:53 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/index.html Message-ID: <200411151953.NAA04020@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: index.html updated: 1.19 -> 1.20 --- Log message: * Add an entry for llvm-ranlib * Add missing dashes --- Diffs of the changes: (+6 -3) Index: llvm/docs/CommandGuide/index.html diff -u llvm/docs/CommandGuide/index.html:1.19 llvm/docs/CommandGuide/index.html:1.20 --- llvm/docs/CommandGuide/index.html:1.19 Thu Nov 11 03:29:36 2004 +++ llvm/docs/CommandGuide/index.html Mon Nov 15 13:53:43 2004 @@ -48,7 +48,7 @@ directly run a program compiled to bytecode using a JIT compiler or interpreter -
  • llvm-link +
  • llvm-link - link several bytecode files into one
  • analyze - @@ -57,7 +57,10 @@
  • llvm-ar - archive bytecode files
  • -
  • llvm-nm +
  • llvm-ranlib - + create an index for archives made with llvm-ar
  • + +
  • llvm-nm - print out the names and types of symbols in a bytecode file
  • llvm-prof - @@ -131,7 +134,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/11 09:29:36 $ + Last modified: $Date: 2004/11/15 19:53:43 $ From lattner at cs.uiuc.edu Mon Nov 15 14:06:25 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 14:06:25 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/Makefile Message-ID: <200411152006.iAFK6Pp0012026@apoc.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: Makefile updated: 1.3 -> 1.4 --- Log message: Bump version. Shouldn't this come from somewhere else?? --- Diffs of the changes: (+1 -1) Index: llvm/docs/CommandGuide/Makefile diff -u llvm/docs/CommandGuide/Makefile:1.3 llvm/docs/CommandGuide/Makefile:1.4 --- llvm/docs/CommandGuide/Makefile:1.3 Fri May 14 15:29:11 2004 +++ llvm/docs/CommandGuide/Makefile Mon Nov 15 14:06:11 2004 @@ -13,7 +13,7 @@ --podpath=. --noindex --infile=$< --outfile=$@ man/man1/%.1: %.pod - pod2man --release=1.3 --center="LLVM Command Guide" $< $@ + pod2man --release=1.4 --center="LLVM Command Guide" $< $@ ps/%.ps: man/man1/%.1 groff -Tps -man $< > $@ From brukman at cs.uiuc.edu Mon Nov 15 14:23:00 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 14:23:00 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llc.pod Message-ID: <200411152023.OAA04732@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llc.pod updated: 1.5 -> 1.6 --- Log message: Add the PowerPC 32-bit ABI output option --- Diffs of the changes: (+4 -0) Index: llvm/docs/CommandGuide/llc.pod diff -u llvm/docs/CommandGuide/llc.pod:1.5 llvm/docs/CommandGuide/llc.pod:1.6 --- llvm/docs/CommandGuide/llc.pod:1.5 Wed Jul 21 07:53:14 2004 +++ llvm/docs/CommandGuide/llc.pod Mon Nov 15 14:22:49 2004 @@ -76,6 +76,10 @@ Intel IA-32 (Pentium and above) +=item I + +32-bit PowerPC (MacOS X, 32-bit ABI) + =item I 64-bit SPARC V9 From alkis at cs.uiuc.edu Mon Nov 15 14:24:15 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Mon, 15 Nov 2004 14:24:15 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200411152024.OAA04767@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.143 -> 1.144 --- Log message: Lazily initialize class info, vtable info and object array vtable info maps. Also disable class initialization functions as these pull way too many methods. --- Diffs of the changes: (+14 -8) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.143 llvm-java/lib/Compiler/Compiler.cpp:1.144 --- llvm-java/lib/Compiler/Compiler.cpp:1.143 Mon Nov 8 02:04:27 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Mon Nov 15 14:24:03 2004 @@ -218,7 +218,7 @@ /// Initializes the class info map; in other words it adds the /// class info of java.lang.Object. - void initializeClassInfoMap() { + bool initializeClassInfoMap() { DEBUG(std::cerr << "Building ClassInfo for: java/lang/Object\n"); ClassFile* cf = ClassFile::get("java/lang/Object"); ClassInfo& ci = c2ciMap_[cf]; @@ -255,11 +255,12 @@ assert(ci.type && "ClassInfo not initialized properly!"); emitStaticInitializers(cf); DEBUG(std::cerr << "Built ClassInfo for: java/lang/Object\n"); + return true; } /// Initializes the VTableInfo map; in other words it adds the /// VTableInfo for java.lang.Object. - void initializeVTableInfoMap() { + bool initializeVTableInfoMap() { DEBUG(std::cerr << "Building VTableInfo for: java/lang/Object\n"); ClassFile* cf = ClassFile::get("java/lang/Object"); VTableInfo& vi = c2viMap_[cf]; @@ -349,10 +350,13 @@ "java/lang/Object", &module_); DEBUG(std::cerr << "Built VTableInfo for: java/lang/Object\n"); + return true; } /// Returns the ClassInfo object associated with this classfile. const ClassInfo& getClassInfo(ClassFile* cf) { + static bool initialized = initializeClassInfoMap(); + Class2ClassInfoMap::iterator it = c2ciMap_.lower_bound(cf); if (it != c2ciMap_.end() && it->first == cf) return it->second; @@ -637,6 +641,8 @@ /// Returns the VTableInfo associated with this classfile. const VTableInfo& getVTableInfo(ClassFile* cf) { + static bool initialized = initializeVTableInfoMap(); + Class2VTableInfoMap::iterator it = c2viMap_.lower_bound(cf); if (it != c2viMap_.end() && it->first == cf) return it->second; @@ -854,7 +860,7 @@ /// Initializes the VTableInfo map for object arrays; in other /// words it adds the VTableInfo for java.lang.Object[]. - void initializeObjectArrayVTableInfoMap() { + bool initializeObjectArrayVTableInfoMap() { DEBUG(std::cerr << "Building VTableInfo for: java/lang/Object[]\n"); ClassFile* cf = ClassFile::get("java/lang/Object"); VTableInfo& vi = ac2viMap_[cf]; @@ -927,6 +933,8 @@ } const VTableInfo& getObjectArrayVTableInfo(ClassFile* cf) { + static bool initialized = initializeObjectArrayVTableInfoMap(); + Class2VTableInfoMap::iterator it = ac2viMap_.lower_bound(cf); if (it != ac2viMap_.end() && it->first == cf) return it->second; @@ -1210,6 +1218,8 @@ } } +// FIXME: This pulls in too many methods for now so we disable it. +#if 0 // Call its class initialization method if it exists. if (const Method* method = classfile->getMethod("()V")) { std::string name = classfile->getThisClass()->getName()->str(); @@ -1229,6 +1239,7 @@ LLVM_JAVA_STATIC_INIT " should have a terminator!"); new CallInst(init, "", hook->front().getTerminator()); } +#endif } } @@ -1295,11 +1306,6 @@ BasicBlock* staticInitBB = new BasicBlock("entry", staticInit); new ReturnInst(NULL, staticInitBB); - // Initialize type maps and vtable globals. - initializeClassInfoMap(); - initializeVTableInfoMap(); - initializeObjectArrayVTableInfoMap(); - // Create the method requested. Function* function = getFunction(getMethod(classMethodDesc)); toCompileFunctions_.insert(function); From reid at x10sys.com Mon Nov 15 14:25:19 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 14:25:19 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvmc.pod llvm-bcanalyzer.pod Message-ID: <200411152025.OAA04858@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvmc.pod updated: 1.5 -> 1.6 llvm-bcanalyzer.pod updated: 1.4 -> 1.5 --- Log message: Remove personal email address. --- Diffs of the changes: (+2 -2) Index: llvm/docs/CommandGuide/llvmc.pod diff -u llvm/docs/CommandGuide/llvmc.pod:1.5 llvm/docs/CommandGuide/llvmc.pod:1.6 --- llvm/docs/CommandGuide/llvmc.pod:1.5 Sun Aug 8 22:10:39 2004 +++ llvm/docs/CommandGuide/llvmc.pod Mon Nov 15 14:25:08 2004 @@ -390,6 +390,6 @@ =head1 AUTHORS -Reid Spencer, L +Maintained by the LLVM Team (L). =cut Index: llvm/docs/CommandGuide/llvm-bcanalyzer.pod diff -u llvm/docs/CommandGuide/llvm-bcanalyzer.pod:1.4 llvm/docs/CommandGuide/llvm-bcanalyzer.pod:1.5 --- llvm/docs/CommandGuide/llvm-bcanalyzer.pod:1.4 Tue Aug 24 19:35:20 2004 +++ llvm/docs/CommandGuide/llvm-bcanalyzer.pod Mon Nov 15 14:25:08 2004 @@ -312,6 +312,6 @@ =head1 AUTHORS -Maintained by Reid Spencer (L). +Maintained by the LLVM Team (L). =cut From brukman at cs.uiuc.edu Mon Nov 15 14:30:29 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 14:30:29 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-prof.pod Message-ID: <200411152030.OAA05109@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-prof.pod updated: 1.3 -> 1.4 --- Log message: Fix syntax within a B<> tag --- Diffs of the changes: (+2 -2) Index: llvm/docs/CommandGuide/llvm-prof.pod diff -u llvm/docs/CommandGuide/llvm-prof.pod:1.3 llvm/docs/CommandGuide/llvm-prof.pod:1.4 --- llvm/docs/CommandGuide/llvm-prof.pod:1.3 Fri Jul 2 11:06:19 2004 +++ llvm/docs/CommandGuide/llvm-prof.pod Mon Nov 15 14:30:19 2004 @@ -47,8 +47,8 @@ =head1 EXIT STATUS -B returns 1 if it cannot load the bytecode file or the -profile information. Otherwise, it exits with zero. +B returns 1 if it cannot load the bytecode file or the profile +information. Otherwise, it exits with zero. =head1 AUTHOR From brukman at cs.uiuc.edu Mon Nov 15 14:33:09 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 14:33:09 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-link.pod Message-ID: <200411152033.OAA05270@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-link.pod updated: 1.2 -> 1.3 --- Log message: Force a short link to gccld's man page --- Diffs of the changes: (+1 -1) Index: llvm/docs/CommandGuide/llvm-link.pod diff -u llvm/docs/CommandGuide/llvm-link.pod:1.2 llvm/docs/CommandGuide/llvm-link.pod:1.3 --- llvm/docs/CommandGuide/llvm-link.pod:1.2 Fri Jul 2 11:06:19 2004 +++ llvm/docs/CommandGuide/llvm-link.pod Mon Nov 15 14:32:58 2004 @@ -65,7 +65,7 @@ =head1 SEE ALSO -L +L =head1 AUTHORS From brukman at cs.uiuc.edu Mon Nov 15 14:36:50 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 14:36:50 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-link.pod Message-ID: <200411152036.OAA05559@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-link.pod updated: 1.3 -> 1.4 --- Log message: No need for the verbose `the llvm-link command' when simply `llvm-link' will do --- Diffs of the changes: (+9 -10) Index: llvm/docs/CommandGuide/llvm-link.pod diff -u llvm/docs/CommandGuide/llvm-link.pod:1.3 llvm/docs/CommandGuide/llvm-link.pod:1.4 --- llvm/docs/CommandGuide/llvm-link.pod:1.3 Mon Nov 15 14:32:58 2004 +++ llvm/docs/CommandGuide/llvm-link.pod Mon Nov 15 14:36:39 2004 @@ -10,15 +10,15 @@ =head1 DESCRIPTION -The B command takes several LLVM bytecode files and links them -together into a single LLVM bytecode file. It writes the output file to -standard output, unless the B<-o> option is used to specify a filename. - -The B command attempts to load the input files from the current -directory. If that fails, it looks for each file in each of the directories -specified by the B<-L> options on the command line. The library search paths -are global; each one is searched for every input file if necessary. The -directories are searched in the order they were specified on the command line. +B takes several LLVM bytecode files and links them together into a +single LLVM bytecode file. It writes the output file to standard output, unless +the B<-o> option is used to specify a filename. + +B attempts to load the input files from the current directory. If +that fails, it looks for each file in each of the directories specified by the +B<-L> options on the command line. The library search paths are global; each +one is searched for every input file if necessary. The directories are searched +in the order they were specified on the command line. =head1 OPTIONS @@ -72,4 +72,3 @@ Maintained by the LLVM Team (L). =cut - From brukman at cs.uiuc.edu Mon Nov 15 14:39:41 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 14:39:41 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-as.pod Message-ID: <200411152039.OAA05732@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-as.pod updated: 1.2 -> 1.3 --- Log message: Be less verbose when `The' and `command' just aren't necessary --- Diffs of the changes: (+3 -3) Index: llvm/docs/CommandGuide/llvm-as.pod diff -u llvm/docs/CommandGuide/llvm-as.pod:1.2 llvm/docs/CommandGuide/llvm-as.pod:1.3 --- llvm/docs/CommandGuide/llvm-as.pod:1.2 Fri Jul 2 11:06:19 2004 +++ llvm/docs/CommandGuide/llvm-as.pod Mon Nov 15 14:39:30 2004 @@ -10,9 +10,9 @@ =head1 DESCRIPTION -The B command invokes the LLVM assembler. It reads a file containing -human-readable LLVM assembly language, translates it to LLVM bytecode, and -writes the result into a file or to standard output. +B is the LLVM assembler. It reads a file containing human-readable +LLVM assembly language, translates it to LLVM bytecode, and writes the result +into a file or to standard output. If F is omitted or is C<->, then B reads its input from standard input. From lattner at cs.uiuc.edu Mon Nov 15 14:54:23 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 14:54:23 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c Message-ID: <200411152054.iAFKsNhE014262@apoc.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Olden/voronoi: newvor.c updated: 1.6 -> 1.7 --- Log message: Get malloc.h for memalign. --- Diffs of the changes: (+1 -0) Index: llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c diff -u llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c:1.6 llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c:1.7 --- llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c:1.6 Wed Jun 23 18:16:53 2004 +++ llvm-test/MultiSource/Benchmarks/Olden/voronoi/newvor.c Mon Nov 15 14:54:09 2004 @@ -2,6 +2,7 @@ #include #include +#include #include "defines.h" VERTEX_PTR *vp ; From brukman at cs.uiuc.edu Mon Nov 15 15:05:18 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 15:05:18 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200411152105.PAA06771@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.73 -> 1.74 --- Log message: * Add entry for Linux/PowerPC * Mark MacOS X/PPC support as 32-bit-only * Fix FreeBSD space usage -- it's in MB, not GB --- Diffs of the changes: (+15 -5) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.73 llvm/docs/GettingStarted.html:1.74 --- llvm/docs/GettingStarted.html:1.73 Sun Nov 14 23:19:53 2004 +++ llvm/docs/GettingStarted.html Mon Nov 15 15:05:08 2004 @@ -217,12 +217,12 @@ FreeBSD x861 57 MB - 850 GB + 850 MB 40 MB 1 GB - MacOS X + MacOS X2 PowerPC 57 MB 1.5 GB @@ -230,18 +230,28 @@ 1.6 GB - AIX2 + AIX3 PowerPC 92 MB 2.8 GB 123 MB 3 GB + + Linux3 + PowerPC + 30 MB + 1.1 GB + -- + 1 GB +

    +Notes:
    1 Code generation supported for Pentium processors and up
    -2 No native code generation +2 Code generation supported for 32-bit ABI only
    +3 No native code generation

    The LLVM suite may compile on other platforms, but it is not @@ -1313,7 +1323,7 @@ Chris Lattner
    Reid Spencer
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/15 05:19:53 $ + Last modified: $Date: 2004/11/15 21:05:08 $ From lattner at cs.uiuc.edu Mon Nov 15 15:05:20 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 15:05:20 -0600 Subject: [llvm-commits] CVS: poolalloc/lib/PoolAllocate/PoolAllocate.cpp PoolAllocate.h PoolOptimize.cpp TransformFunctionBody.cpp Message-ID: <200411152105.iAFL5KJu016056@apoc.cs.uiuc.edu> Changes in directory poolalloc/lib/PoolAllocate: PoolAllocate.cpp updated: 1.93 -> 1.94 PoolAllocate.h updated: 1.31 -> 1.32 PoolOptimize.cpp updated: 1.1 -> 1.2 TransformFunctionBody.cpp updated: 1.32 -> 1.33 --- Log message: Implement support for memalign and initial support for posix_memalign, transforming them into poolmemalign. --- Diffs of the changes: (+104 -8) Index: poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.93 poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.94 --- poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.93 Wed Nov 10 17:41:04 2004 +++ poolalloc/lib/PoolAllocate/PoolAllocate.cpp Mon Nov 15 15:05:09 2004 @@ -165,6 +165,10 @@ PoolRealloc = CurModule->getOrInsertFunction("poolrealloc", VoidPtrTy, PoolDescPtrTy, VoidPtrTy, Type::UIntTy, 0); + // The poolmemalign function. + PoolMemAlign = CurModule->getOrInsertFunction("poolmemalign", + VoidPtrTy, PoolDescPtrTy, + Type::UIntTy, Type::UIntTy, 0); // Get the poolfree function. PoolFree = CurModule->getOrInsertFunction("poolfree", Type::VoidTy, Index: poolalloc/lib/PoolAllocate/PoolAllocate.h diff -u poolalloc/lib/PoolAllocate/PoolAllocate.h:1.31 poolalloc/lib/PoolAllocate/PoolAllocate.h:1.32 --- poolalloc/lib/PoolAllocate/PoolAllocate.h:1.31 Wed Nov 10 15:13:47 2004 +++ poolalloc/lib/PoolAllocate/PoolAllocate.h Mon Nov 15 15:05:09 2004 @@ -95,7 +95,8 @@ public: - Function *PoolInit, *PoolDestroy, *PoolAlloc, *PoolRealloc, *PoolFree; + Function *PoolInit, *PoolDestroy, *PoolAlloc, *PoolRealloc, *PoolMemAlign; + Function *PoolFree; static const Type *PoolDescPtrTy; PA::Heuristic *CurHeuristic; Index: poolalloc/lib/PoolAllocate/PoolOptimize.cpp diff -u poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.1 poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.2 --- poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.1 Wed Nov 10 17:40:49 2004 +++ poolalloc/lib/PoolAllocate/PoolOptimize.cpp Mon Nov 15 15:05:09 2004 @@ -59,6 +59,10 @@ Function *PoolRealloc = M.getOrInsertFunction("poolrealloc", VoidPtrTy, PoolDescPtrTy, VoidPtrTy, Type::UIntTy, 0); + // The poolmemalign function. + Function *PoolMemAlign = M.getOrInsertFunction("poolmemalign", + VoidPtrTy, PoolDescPtrTy, + Type::UIntTy, Type::UIntTy, 0); // Get the poolfree function. Function *PoolFree = M.getOrInsertFunction("poolfree", Type::VoidTy, @@ -81,6 +85,9 @@ Function *Realloc = M.getOrInsertFunction("realloc", VoidPtrTy, VoidPtrTy, Type::UIntTy, 0); + Function *MemAlign = M.getOrInsertFunction("memalign", + VoidPtrTy, Type::UIntTy, + Type::UIntTy, 0); // Optimize poolreallocs @@ -130,6 +137,21 @@ } } + // Optimize poolmemaligns + getCallsOf(PoolFree, Calls); + for (unsigned i = 0, e = Calls.size(); i != e; ++i) { + CallInst *CI = Calls[i]; + // poolmemalign(null, X, Y) -> memalign(X, Y) + if (isa(CI->getOperand(1))) { + std::vector Ops; + Ops.push_back(CI->getOperand(2)); + Ops.push_back(CI->getOperand(3)); + Value *New = new CallInst(MemAlign, Ops, CI->getName(), CI); + CI->replaceAllUsesWith(New); + CI->eraseFromParent(); + } + } + // Optimize poolfrees getCallsOf(PoolFree, Calls); for (unsigned i = 0, e = Calls.size(); i != e; ++i) { Index: poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.32 poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.33 --- poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.32 Thu Nov 4 14:13:00 2004 +++ poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Mon Nov 15 15:05:09 2004 @@ -63,6 +63,7 @@ void visitMallocInst(MallocInst &MI); void visitCallocCall(CallSite CS); void visitReallocCall(CallSite CS); + void visitMemAlignCall(CallSite CS); void visitFreeInst(FreeInst &FI); void visitCallSite(CallSite CS); void visitCallInst(CallInst &CI) { visitCallSite(&CI); } @@ -232,8 +233,8 @@ void FuncTransform::visitCallocCall(CallSite CS) { Module *M = CS.getInstruction()->getParent()->getParent()->getParent(); assert(CS.arg_end()-CS.arg_begin() == 2 && "calloc takes two arguments!"); - Value *V1 = *CS.arg_begin(); - Value *V2 = *(CS.arg_begin()+1); + Value *V1 = CS.getArgument(0); + Value *V2 = CS.getArgument(1); if (V1->getType() != V2->getType()) { V1 = new CastInst(V1, Type::UIntTy, V1->getName(), CS.getInstruction()); V2 = new CastInst(V2, Type::UIntTy, V2->getName(), CS.getInstruction()); @@ -271,8 +272,8 @@ assert(CS.arg_end()-CS.arg_begin() == 2 && "realloc takes two arguments!"); Instruction *I = CS.getInstruction(); Value *PH = getPoolHandle(I); - Value *OldPtr = *CS.arg_begin(); - Value *Size = *(CS.arg_begin()+1); + Value *OldPtr = CS.getArgument(0); + Value *Size = CS.getArgument(1); if (Size->getType() != Type::UIntTy) Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); @@ -307,6 +308,71 @@ } +/// visitMemAlignCall - Handle memalign and posix_memalign. +/// +void FuncTransform::visitMemAlignCall(CallSite CS) { + Instruction *I = CS.getInstruction(); + Value *ResultDest = 0; + Value *Align = 0; + Value *Size = 0; + Value *PH; + + if (CS.getCalledFunction()->getName() == "memalign") { + Align = CS.getArgument(0); + Size = CS.getArgument(1); + PH = getPoolHandle(I); + } else { + assert(CS.getCalledFunction()->getName() == "posix_memalign"); + ResultDest = CS.getArgument(0); + Align = CS.getArgument(1); + Size = CS.getArgument(2); + + assert(0 && "posix_memalign not implemented fully!"); + // We need to get the pool descriptor corresponding to *ResultDest. + PH = getPoolHandle(I); + + // Return success always. + Value *RetVal = Constant::getNullValue(I->getType()); + I->replaceAllUsesWith(RetVal); + + static const Type *PtrPtr=PointerType::get(PointerType::get(Type::SByteTy)); + if (ResultDest->getType() != PtrPtr) + ResultDest = new CastInst(ResultDest, PtrPtr, ResultDest->getName(), I); + } + + if (Align->getType() != Type::UIntTy) + Align = new CastInst(Align, Type::UIntTy, Align->getName(), I); + if (Size->getType() != Type::UIntTy) + Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); + + std::string Name = I->getName(); I->setName(""); + Instruction *V = new CallInst(PAInfo.PoolMemAlign, + make_vector(PH, Align, Size, 0), Name, I); + + Instruction *Casted = V; + if (V->getType() != I->getType()) + Casted = new CastInst(V, I->getType(), V->getName(), I); + + if (ResultDest) + new StoreInst(V, ResultDest, I); + else + I->replaceAllUsesWith(Casted); + + // If we are modifying the original function, update the DSGraph. + if (!FI.Clone) { + // V and Casted now point to whatever the original allocation did. + G.getScalarMap().replaceScalar(I, V); + if (V != Casted) + G.getScalarMap()[Casted] = G.getScalarMap()[V]; + } else { // Otherwise, update the NewToOldValueMap + UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0); + } + + // Remove old allocation instruction. + I->eraseFromParent(); +} + + void FuncTransform::visitCallSite(CallSite CS) { Function *CF = CS.getCalledFunction(); @@ -335,11 +401,14 @@ } else if (CF->getName() == "realloc") { visitReallocCall(CS); return; - } else if (CF->getName() == "strdup") { - assert(0 && "strdup should have been linked into the program!"); } else if (CF->getName() == "memalign" || CF->getName() == "posix_memalign") { - std::cerr << "MEMALIGN USED BUT NOT HANDLED!\n"; + visitMemAlignCall(CS); + return; + } else if (CF->getName() == "strdup") { + assert(0 && "strdup should have been linked into the program!"); + } else if (CF->getName() == "valloc") { + std::cerr << "VALLOC USED BUT NOT HANDLED!\n"; abort(); } From reid at x10sys.com Mon Nov 15 15:15:23 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 15:15:23 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html RequiredSoftware.html Message-ID: <200411152115.PAA07023@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.74 -> 1.75 RequiredSoftware.html (r1.1) removed --- Log message: Merge content of RequiredSoftware.html into GettingStarted.html Remove now defunct RequiredSoftware.html. --- Diffs of the changes: (+155 -49) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.74 llvm/docs/GettingStarted.html:1.75 --- llvm/docs/GettingStarted.html:1.74 Mon Nov 15 15:05:08 2004 +++ llvm/docs/GettingStarted.html Mon Nov 15 15:15:12 2004 @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + Getting Started with LLVM System @@ -267,59 +268,164 @@ -

    - +
    +

    Compiling LLVM requires that you have several software packages + installed. The table below lists those required packages. The Package column + is the usual name for the software package that LLVM depends on. The Version + column provides "known to work" versions of the package. The Notes column + describes how LLVM uses the package and provides other details.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -

    Compiling LLVM requires that you have several software packages -installed:

    - - - -

    There are some additional tools that you may want to have when working with -LLVM:

    +
    PackageVersionNotes
    GNU Make3.79, 3.79.1Makefile/build processor
    GCC3.4.2C/C++ compiler (Note 4)
    Flex2.5.4LEX compiler
    Bison1.35YACC compiler
    DejaGnu1.4.2Automated test suite (Note 2)
    tcl8.3, 8.4Automated test suite (Note 2)
    expect5.38.0Automated test suite (Note 2)
    GNU M4 + 1.4Macro processor for configuration (Note 1)
    GNU Autoconf2.59Configuration script builder (Note 1)
    GNU Automake2.59aclocal macro generator (Note 1)
    perl>5.6.0Nightly tester, utilities
    libtool1.5.10Shared library manager (Note 1)
    QMTest2.0.3Automated test suite (Note 2, + Note 3)
    Python2.3Automated test suite (Note 2, + Note 3)
    CVS>1.11CVS access to LLVM (Note 5)
    - +
  • +
  • Only the C and C++ languages needed so there's no need + to build the other languages for LLVM's purposes. See + below for specific version info. +
  • +
  • You only need CVS if you intend to build from the + latest LLVM sources. If you're working from a release distribution, you + don't need CVS.
  • + +

    Additionally, your compilation host is expected to have the usual + plethora of Unix utilities. Specifically:

    +
      +
    • ar - archive library builder
    • +
    • bzip2* - bzip2 command for distribution generation
    • +
    • bunzip2* - bunzip2 command for distribution checking
    • +
    • chmod - change permissions on a file
    • +
    • cat - output concatentation utility
    • +
    • cp - copy files
    • +
    • date - print the current date/time
    • +
    • echo - print to standard output
    • +
    • egrep - extended regular expression search utility
    • +
    • etags - C/C++ tag file creator for vim/emacs
    • +
    • find - find files/dirs in a file system
    • +
    • grep - regular expression search utility
    • +
    • gzip* - gzip command for distribution generation
    • +
    • gunzip* - gunzip command for distribution checking
    • +
    • install - install directories/files
    • +
    • mkdir - create a directory
    • +
    • mv - move (rename) files
    • +
    • ranlib - symbol table builder for archive libraries
    • +
    • sed - stream editor for transforming output
    • +
    • sh - Bourne shell for make build scripts
    • +
    • tar - tape archive for distribution generation
    • +
    • test - test things in file system
    • +
    • unzip* - unzip command for distribution checking
    • +
    • zip* - zip command for distribution generation
    • +
    @@ -1323,7 +1429,7 @@ Chris Lattner
    Reid Spencer
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/15 21:05:08 $ + Last modified: $Date: 2004/11/15 21:15:12 $ From brukman at cs.uiuc.edu Mon Nov 15 15:20:19 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 15:20:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td Message-ID: <200411152120.PAA07142@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PowerPCInstrInfo.td updated: 1.41 -> 1.42 --- Log message: Add BCTR and LWZU instruction opcodes --- Diffs of the changes: (+7 -2) Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.41 llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.42 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.41 Sat Oct 23 15:29:24 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrInfo.td Mon Nov 15 15:20:09 2004 @@ -14,8 +14,11 @@ include "PowerPCInstrFormats.td" -let isTerminator = 1, isReturn = 1 in - def BLR : XLForm_2_ext<19, 16, 20, 31, 1, 0, 0, (ops), "blr">; +let isTerminator = 1 in { + let isReturn = 1 in + def BLR : XLForm_2_ext<19, 16, 20, 31, 1, 0, 0, (ops), "blr">; + def BCTR : XLForm_2_ext<19, 528, 20, 31, 1, 0, 0, (ops), "bctr">; +} def u5imm : Operand { let PrintMethod = "printU5ImmOperand"; @@ -98,6 +101,8 @@ "lmw $rD, $disp($rA)">; def LWZ : DForm_1<32, 0, 0, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA), "lwz $rD, $disp($rA)">; +def LWZU : DForm_1<33, 0, 0, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA), + "lwzu $rD, $disp($rA)">; } def ADDI : DForm_2<14, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), "addi $rD, $rA, $imm">; From reid at x10sys.com Mon Nov 15 15:27:16 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 15 Nov 2004 15:27:16 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Reader.h Message-ID: <200411152127.PAA07335@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Reader.h updated: 1.22 -> 1.23 --- Log message: Remove useless/confusing namespace qualifier. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Bytecode/Reader.h diff -u llvm/include/llvm/Bytecode/Reader.h:1.22 llvm/include/llvm/Bytecode/Reader.h:1.23 --- llvm/include/llvm/Bytecode/Reader.h:1.22 Sun Nov 14 19:20:02 2004 +++ llvm/include/llvm/Bytecode/Reader.h Mon Nov 15 15:27:05 2004 @@ -79,7 +79,7 @@ /// already in memory. /// @returns the ModuleProvider on success, 0 if the bytecode can't be parsed /// @brief Get a bytecode file's externally visibile defined global symbols. -ModuleProvider* llvm::GetBytecodeSymbols( +ModuleProvider* GetBytecodeSymbols( const unsigned char*Buffer, ///< The buffer to be parsed unsigned Length, ///< The length of \p Buffer const std::string& ModuleID, ///< An identifier for the module From lattner at cs.uiuc.edu Mon Nov 15 15:43:17 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 15:43:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200411152143.iAFLhHfl016332@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.139 -> 1.140 --- Log message: Make functions default to having external linkage if they have no FunctionBlock. --- Diffs of the changes: (+2 -2) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.139 llvm/lib/Bytecode/Reader/Reader.cpp:1.140 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.139 Sun Nov 14 15:59:21 2004 +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Nov 15 15:43:03 2004 @@ -1880,8 +1880,8 @@ cast(cast(Ty)->getElementType()); - // Insert the place hodler - Function* Func = new Function(FTy, GlobalValue::InternalLinkage, + // Insert the place holder. + Function* Func = new Function(FTy, GlobalValue::ExternalLinkage, "", TheModule); insertValue(Func, FnSignature >> 5, ModuleValues); From lattner at cs.uiuc.edu Mon Nov 15 15:46:52 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 15:46:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200411152146.iAFLkqrr016829@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.87 -> 1.88 --- Log message: If a function is external, do not output a FunctionBlock for the function AT ALL. This saves 11 bytes per external function from the bytecode file, and is also required to make GhostLinkage work. --- Diffs of the changes: (+3 -3) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.87 llvm/lib/Bytecode/Writer/Writer.cpp:1.88 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.87 Sun Nov 14 16:01:41 2004 +++ llvm/lib/Bytecode/Writer/Writer.cpp Mon Nov 15 15:46:40 2004 @@ -942,12 +942,12 @@ } void BytecodeWriter::outputFunction(const Function *F) { - BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this); - output_vbr(getEncodedLinkage(F)); - // If this is an external function, there is nothing else to emit! if (F->isExternal()) return; + BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this); + output_vbr(getEncodedLinkage(F)); + // Get slot information about the function... Table.incorporateFunction(F); From lattner at cs.uiuc.edu Mon Nov 15 15:55:47 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 15:55:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200411152155.iAFLtljW017498@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.140 -> 1.141 --- Log message: Make *SURE* to null out the pointer before throwing an exception, otherwise the dtor for the BytecodeReader class will try to free it again! --- Diffs of the changes: (+6 -2) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.140 llvm/lib/Bytecode/Reader/Reader.cpp:1.141 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.140 Mon Nov 15 15:43:03 2004 +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Nov 15 15:55:33 2004 @@ -2240,8 +2240,10 @@ freeState(); delete TheModule; TheModule = 0; - if (decompressedBlock != 0 ) + if (decompressedBlock != 0 ) { ::free(decompressedBlock); + decompressedBlock = 0; + } throw; } catch (...) { std::string msg("Unknown Exception Occurred"); @@ -2249,8 +2251,10 @@ freeState(); delete TheModule; TheModule = 0; - if (decompressedBlock != 0 ) + if (decompressedBlock != 0) { ::free(decompressedBlock); + decompressedBlock = 0; + } throw msg; } } From lattner at cs.uiuc.edu Mon Nov 15 15:55:48 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 15:55:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.h Message-ID: <200411152155.iAFLtm5T017503@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.h updated: 1.18 -> 1.19 --- Log message: Cleanups. Null out pointer after freeing it for paranoia --- Diffs of the changes: (+5 -5) Index: llvm/lib/Bytecode/Reader/Reader.h diff -u llvm/lib/Bytecode/Reader/Reader.h:1.18 llvm/lib/Bytecode/Reader/Reader.h:1.19 --- llvm/lib/Bytecode/Reader/Reader.h:1.18 Sun Nov 14 16:00:09 2004 +++ llvm/lib/Bytecode/Reader/Reader.h Mon Nov 15 15:55:06 2004 @@ -44,17 +44,17 @@ /// @{ public: /// @brief Default constructor. By default, no handler is used. - BytecodeReader( - BytecodeHandler* h = 0 - ) { + BytecodeReader(BytecodeHandler* h = 0) { decompressedBlock = 0; Handler = h; } ~BytecodeReader() { freeState(); - if (decompressedBlock) + if (decompressedBlock) { ::free(decompressedBlock); + decompressedBlock = 0; + } } /// @} @@ -411,7 +411,7 @@ inline const Type* getSanitizedType(unsigned& ID ); /// @brief Read in and get a sanitized type id - inline const Type* BytecodeReader::readSanitizedType(); + inline const Type* readSanitizedType(); /// @brief Converts a Type* to its type slot number unsigned getTypeSlot(const Type *Ty); From lattner at cs.uiuc.edu Mon Nov 15 15:56:45 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 15:56:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200411152156.iAFLujB0017516@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.88 -> 1.89 --- Log message: Disable this change, it was premature --- Diffs of the changes: (+3 -3) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.88 llvm/lib/Bytecode/Writer/Writer.cpp:1.89 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.88 Mon Nov 15 15:46:40 2004 +++ llvm/lib/Bytecode/Writer/Writer.cpp Mon Nov 15 15:56:33 2004 @@ -942,12 +942,12 @@ } void BytecodeWriter::outputFunction(const Function *F) { - // If this is an external function, there is nothing else to emit! - if (F->isExternal()) return; - BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this); output_vbr(getEncodedLinkage(F)); + // If this is an external function, there is nothing else to emit! + if (F->isExternal()) return; + // Get slot information about the function... Table.incorporateFunction(F); From lattner at cs.uiuc.edu Mon Nov 15 16:39:06 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 16:39:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200411152239.iAFMd6Wt022889@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.141 -> 1.142 --- Log message: Use a per-function flag bit to indicate whether or not there is a function body for the function. --- Diffs of the changes: (+6 -3) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.141 llvm/lib/Bytecode/Reader/Reader.cpp:1.142 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.141 Mon Nov 15 15:55:33 2004 +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Nov 15 16:38:52 2004 @@ -1886,10 +1886,13 @@ insertValue(Func, FnSignature >> 5, ModuleValues); // Flags are not used yet. - //unsigned Flags = FnSignature & 31; + unsigned Flags = FnSignature & 31; - // Save this for later so we know type of lazily instantiated functions - FunctionSignatureList.push_back(Func); + // Save this for later so we know type of lazily instantiated functions. + // Note that known-external functions do not have FunctionInfo blocks, so we + // do not add them to the FunctionSignatureList. + if ((Flags & (1 << 4)) == 0) + FunctionSignatureList.push_back(Func); if (Handler) Handler->handleFunctionDeclaration(Func); From lattner at cs.uiuc.edu Mon Nov 15 16:40:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 16:40:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200411152240.iAFMe1q1022902@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.89 -> 1.90 --- Log message: Do not emit FunctionBlock blocks for external functions. This shrinks bytecode files by about 8 bytes per external function --- Diffs of the changes: (+5 -3) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.89 llvm/lib/Bytecode/Writer/Writer.cpp:1.90 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.89 Mon Nov 15 15:56:33 2004 +++ llvm/lib/Bytecode/Writer/Writer.cpp Mon Nov 15 16:39:49 2004 @@ -919,6 +919,8 @@ assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!"); assert(((Slot << 5) >> 5) == Slot && "Slot # too big!"); unsigned ID = (Slot << 5) + 1; + if (I->isExternal()) // If external, we don't have an FunctionInfo block. + ID |= 1 << 4; output_vbr(ID); } output_vbr((unsigned)Table.getSlot(Type::VoidTy) << 5); @@ -942,12 +944,12 @@ } void BytecodeWriter::outputFunction(const Function *F) { - BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this); - output_vbr(getEncodedLinkage(F)); - // If this is an external function, there is nothing else to emit! if (F->isExternal()) return; + BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this); + output_vbr(getEncodedLinkage(F)); + // Get slot information about the function... Table.incorporateFunction(F); From lattner at cs.uiuc.edu Mon Nov 15 16:55:05 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 16:55:05 -0600 Subject: [llvm-commits] CVS: llvm/docs/BytecodeFormat.html Message-ID: <200411152255.iAFMt5iL028891@apoc.cs.uiuc.edu> Changes in directory llvm/docs: BytecodeFormat.html updated: 1.36 -> 1.37 --- Log message: Update to reflect recent change --- Diffs of the changes: (+9 -3) Index: llvm/docs/BytecodeFormat.html diff -u llvm/docs/BytecodeFormat.html:1.36 llvm/docs/BytecodeFormat.html:1.37 --- llvm/docs/BytecodeFormat.html:1.36 Mon Nov 8 03:10:50 2004 +++ llvm/docs/BytecodeFormat.html Mon Nov 15 16:54:50 2004 @@ -1058,8 +1058,14 @@ Description - bit(0-4) - Reserved for future use. Currently set to 00001. + bit(0-3) + Reserved for future use. Currently set to 0001. + + + bit(4) + If this bit is set to 1, the indicated function is + external, and there is no Function Definiton + Block in the bytecode file for the function. bit(5-) @@ -1892,7 +1898,7 @@ Reid Spencer and Chris Lattner
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2004/11/08 09:10:50 $ +Last modified: $Date: 2004/11/15 22:54:50 $ From lattner at cs.uiuc.edu Mon Nov 15 17:17:09 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 17:17:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200411152317.iAFNH9o0032521@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.70 -> 1.71 --- Log message: Add debug-only=jit printout, so we see when lazily resolved symbols are set up. --- Diffs of the changes: (+2 -0) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.70 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.71 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.70 Fri Nov 5 10:17:06 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Mon Nov 15 17:16:55 2004 @@ -79,6 +79,8 @@ /// keep track of where we are. /// unsigned JITResolver::addFunctionReference(unsigned Address, Function *F) { + DEBUG(std::cerr << "Emitting lazily resolved reference to function '" + << F->getName() << "' at address " << std::hex << Address << "\n"); LazyCodeGenMap[Address] = F; return (intptr_t)&JITResolver::CompilationCallback; } From lattner at cs.uiuc.edu Mon Nov 15 17:17:17 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 17:17:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp Message-ID: <200411152317.iAFNHH7x032634@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.294 -> 1.295 --- Log message: Simplify and rearrange long shift code --- Diffs of the changes: (+17 -12) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.294 llvm/lib/Target/X86/X86ISelSimple.cpp:1.295 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.294 Sat Nov 13 14:48:57 2004 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Mon Nov 15 17:16:34 2004 @@ -2979,23 +2979,28 @@ DestReg).addReg(SrcReg ).addReg(SrcReg+1).addImm(Amount); BuildMI(*MBB, IP, Opc[2],2,DestReg+1).addReg(SrcReg+1).addImm(Amount); } - } else { // Shifting more than 32 bits - Amount -= 32; + } else if (Amount == 32) { if (isLeftShift) { - if (Amount != 0) { - BuildMI(*MBB, IP, X86::SHL32ri, 2, - DestReg + 1).addReg(SrcReg).addImm(Amount); - } else { - BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg+1).addReg(SrcReg); - } + BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg+1).addReg(SrcReg); BuildMI(*MBB, IP, X86::MOV32ri, 1, DestReg).addImm(0); } else { - if (Amount != 0) { - BuildMI(*MBB, IP, isSigned ? X86::SAR32ri : X86::SHR32ri, 2, - DestReg).addReg(SrcReg+1).addImm(Amount); + BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg).addReg(SrcReg); + if (!isSigned) { + BuildMI(*MBB, IP, X86::MOV32ri, 1, DestReg+1).addImm(0); } else { - BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg).addReg(SrcReg+1); + BuildMI(*MBB, IP, X86::SAR32ri, 2, + DestReg+1).addReg(SrcReg).addImm(31); } + } + } else { // Shifting more than 32 bits + Amount -= 32; + if (isLeftShift) { + BuildMI(*MBB, IP, X86::SHL32ri, 2, + DestReg + 1).addReg(SrcReg).addImm(Amount); + BuildMI(*MBB, IP, X86::MOV32ri, 1, DestReg).addImm(0); + } else { + BuildMI(*MBB, IP, isSigned ? X86::SAR32ri : X86::SHR32ri, 2, + DestReg).addReg(SrcReg+1).addImm(Amount); BuildMI(*MBB, IP, X86::MOV32ri, 1, DestReg+1).addImm(0); } } From lattner at cs.uiuc.edu Mon Nov 15 17:18:23 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 17:18:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200411152318.iAFNINs8000338@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.46 -> 1.47 --- Log message: There is no reason to try to materialize the function from bytecode if it already has been. This may be a small speedup. --- Diffs of the changes: (+12 -9) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.46 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.47 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.46 Sun Nov 7 17:58:46 2004 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Mon Nov 15 17:18:09 2004 @@ -239,15 +239,18 @@ return Addr; // Check if function already code gen'd // Make sure we read in the function if it exists in this Module - try { - MP->materializeFunction(F); - } catch ( std::string& errmsg ) { - std::cerr << "Error reading bytecode file: " << errmsg << "\n"; - abort(); - } catch (...) { - std::cerr << "Error reading bytecode file!\n"; - abort(); - } + if (F->hasNotBeenReadFromBytecode()) + try { + MP->materializeFunction(F); + } catch ( std::string& errmsg ) { + std::cerr << "Error reading function '" << F->getName() + << "' from bytecode file: " << errmsg << "\n"; + abort(); + } catch (...) { + std::cerr << "Error reading function '" << F->getName() + << "from bytecode file!\n"; + abort(); + } if (F->isExternal()) { void *Addr = getPointerToNamedFunction(F->getName()); From lattner at cs.uiuc.edu Mon Nov 15 17:20:18 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 17:20:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200411152320.iAFNKI3s000356@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.46 -> 1.47 --- Log message: Now that we have ghost linkage, we can force resolution of external symbols immediately instead of lazily. In this program, for example: int main() { printf("hello world\n"); printf("hello world\n"); printf("hello world\n"); printf("hello world\n"); } We used to have to go through compilation callback 4 times (once for each call to printf), now we don't go to it at all. Thanks to Misha for noticing this, and for adding the initial ghost linkage patches. --- Diffs of the changes: (+8 -3) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.46 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.47 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.46 Fri Oct 29 13:22:45 2004 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Mon Nov 15 17:20:04 2004 @@ -213,9 +213,14 @@ uint64_t Emitter::getGlobalValueAddress(GlobalValue *V) { // Try looking up the function to see if it is already compiled, if not return // 0. - if (isa(V)) - return (intptr_t)TheJIT->getPointerToGlobalIfAvailable(V); - else { + if (Function *F = dyn_cast(V)) { + void *Addr = TheJIT->getPointerToGlobalIfAvailable(F); + if (Addr == 0 && F->hasExternalLinkage()) { + // Do not output stubs for external functions. + Addr = TheJIT->getPointerToFunction(F); + } + return (intptr_t)Addr; + } else { return (intptr_t)TheJIT->getOrEmitGlobalVariable(cast(V)); } } From lattner at cs.uiuc.edu Mon Nov 15 17:20:33 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 17:20:33 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/GlobalValue.h Message-ID: <200411152320.iAFNKXpm000366@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.19 -> 1.20 --- Log message: Add an accessor --- Diffs of the changes: (+9 -2) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.19 llvm/include/llvm/GlobalValue.h:1.20 --- llvm/include/llvm/GlobalValue.h:1.19 Sun Nov 14 15:02:28 2004 +++ llvm/include/llvm/GlobalValue.h Mon Nov 15 17:20:19 2004 @@ -67,8 +67,15 @@ void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } - /// Override from Constant class. No GlobalValue's have null values so - /// this always returns false. + /// hasNotBeenReadFromBytecode - If a module provider is being used to lazily + /// stream in functions from disk, this method can be used to check to see if + /// the function has been read in yet or not. Unless you are working on the + /// JIT or something else that streams stuff in lazily, you don't need to + /// worry about this. + bool hasNotBeenReadFromBytecode() const { return Linkage == GhostLinkage; } + + /// Override from Constant class. No GlobalValue's are null values so this + /// always returns false. virtual bool isNullValue() const { return false; } /// Override from Constant class. From brukman at cs.uiuc.edu Mon Nov 15 17:21:03 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 15 Nov 2004 17:21:03 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200411152321.RAA09029@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.75 -> 1.76 --- Log message: * Change test/projects => projects/llvm-test * Add link to complete Command Guide in the "brief intro to major tools" section --- Diffs of the changes: (+4 -3) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.75 llvm/docs/GettingStarted.html:1.76 --- llvm/docs/GettingStarted.html:1.75 Mon Nov 15 15:15:12 2004 +++ llvm/docs/GettingStarted.html Mon Nov 15 17:20:51 2004 @@ -1126,7 +1126,7 @@

    This is not a directory in the normal llvm module, it is a separate CVS - module that must be checked out (usually to test/projects). This + module that must be checked out (usually to projects/llvm-test). This module contains a comprehensive correctness, performance and benchmarking test suite for LLVM. It is a separate CVS module because not every LLVM user is interested in downloading or building such a comprehensive test. For further @@ -1141,7 +1141,8 @@

    The tools directory contains the executables built out of the libraries above, which form the main part of the user interface. You can always get help for a tool by typing tool_name --help. The -following is a brief introduction to the most important tools:

    +following is a brief introduction to the most important tools. More detailed +information is in the Command Guide.

    analyze
    @@ -1429,7 +1430,7 @@ Chris Lattner
    Reid Spencer
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/15 21:15:12 $ + Last modified: $Date: 2004/11/15 23:20:51 $ From lattner at cs.uiuc.edu Mon Nov 15 22:21:31 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 22:21:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200411160421.iAG4LV5d002033@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.71 -> 1.72 --- Log message: * Merge some win32 ifdefs together * Get rid of "emitMaybePCRelativeValue", either we want to emit a PC relative value or not: drop the maybe BS. As it turns out, the only places where the bool was a variable coming in, the bool was a dynamic constant. --- Diffs of the changes: (+17 -22) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.71 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.72 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.71 Mon Nov 15 17:16:55 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Mon Nov 15 22:21:18 2004 @@ -117,6 +117,12 @@ #else unsigned *StackPtr = (unsigned*)__builtin_frame_address(0); unsigned RetAddr = (unsigned)(intptr_t)__builtin_return_address(0); + + // FIXME: __builtin_frame_address doesn't work if frame pointer elimination + // has been performed. Having a variable sized alloca disables frame pointer + // elimination currently, even if it's dead. This is a gross hack. + alloca(10+(RetAddr >> 31)); + #endif assert(StackPtr[1] == RetAddr && "Could not find return address on the stack!"); @@ -124,15 +130,6 @@ // It's a stub if there is an interrupt marker after the call... bool isStub = ((unsigned char*)(intptr_t)RetAddr)[0] == 0xCD; -#ifndef _MSC_VER - // FIXME FIXME FIXME FIXME: __builtin_frame_address doesn't work if frame - // pointer elimination has been performed. Having a variable sized alloca - // disables frame pointer elimination currently, even if it's dead. This is a - // gross hack. - alloca(10+isStub); - // FIXME FIXME FIXME FIXME -#endif - // The call instruction should have pushed the return value onto the stack... RetAddr -= 4; // Backtrack to the reference itself... @@ -210,7 +207,7 @@ void emitBasicBlock(const MachineBasicBlock &MBB); void emitPCRelativeBlockAddress(const MachineBasicBlock *BB); - void emitMaybePCRelativeValue(unsigned Address, bool isPCRelative); + void emitPCRelativeValue(unsigned Address); void emitGlobalAddressForCall(GlobalValue *GV); void emitGlobalAddressForPtr(GlobalValue *GV, int Disp = 0); @@ -259,7 +256,7 @@ for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) { unsigned Location = BasicBlockAddrs[BBRefs[i].first]; unsigned Ref = BBRefs[i].second; - MCE.emitWordAt (Location-Ref-4, (unsigned*)(intptr_t)Ref); + MCE.emitWordAt(Location-Ref-4, (unsigned*)(intptr_t)Ref); } BBRefs.clear(); BasicBlockAddrs.clear(); @@ -270,7 +267,8 @@ if (uint64_t Addr = MCE.getCurrentPCValue()) BasicBlockAddrs[&MBB] = Addr; - for (MachineBasicBlock::const_iterator I = MBB.begin(), E = MBB.end(); I != E; ++I) + for (MachineBasicBlock::const_iterator I = MBB.begin(), E = MBB.end(); + I != E; ++I) emitInstruction(*I); } @@ -285,13 +283,10 @@ MCE.emitWord(0); } -/// emitMaybePCRelativeValue - Emit a 32-bit address which may be PC relative. +/// emitPCRelativeValue - Emit a 32-bit PC relative address. /// -void Emitter::emitMaybePCRelativeValue(unsigned Address, bool isPCRelative) { - if (isPCRelative) - MCE.emitWord(Address-MCE.getCurrentPCValue()-4); - else - MCE.emitWord(Address); +void Emitter::emitPCRelativeValue(unsigned Address) { + MCE.emitWord(Address-MCE.getCurrentPCValue()-4); } /// emitGlobalAddressForCall - Emit the specified address to the code stream @@ -306,7 +301,7 @@ Address = getResolver(MCE).addFunctionReference(MCE.getCurrentPCValue(), cast(GV)); } - emitMaybePCRelativeValue(Address, true); + emitPCRelativeValue(Address); } /// emitGlobalAddress - Emit the specified address to the code stream assuming @@ -325,7 +320,7 @@ Address = getResolver(MCE).getLazyResolver((Function*)GV); } - emitMaybePCRelativeValue(Address + Disp, false); + MCE.emitWord(Address + Disp); } @@ -564,7 +559,7 @@ } else if (MO.isExternalSymbol()) { unsigned Address = MCE.getGlobalValueAddress(MO.getSymbolName()); assert(Address && "Unknown external symbol!"); - emitMaybePCRelativeValue(Address, MO.isPCRelative()); + emitPCRelativeValue(Address); } else if (MO.isImmediate()) { emitConstant(MO.getImmedValue(), sizeOfImm(Desc)); } else { @@ -591,7 +586,7 @@ "Don't know how to emit non-pointer values!"); unsigned Address = MCE.getGlobalValueAddress(MO1.getSymbolName()); assert(Address && "Unknown external symbol!"); - emitMaybePCRelativeValue(Address, MO1.isPCRelative()); + MCE.emitWord(Address); } else { emitConstant(MO1.getImmedValue(), sizeOfImm(Desc)); } From lattner at cs.uiuc.edu Mon Nov 15 22:31:05 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 22:31:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200411160431.iAG4V5ZQ002530@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.72 -> 1.73 --- Log message: Implement a simple FIXME: if we are emitting a basic block address that has already been emitted, we don't have to remember it and deal with it later, just emit it directly. --- Diffs of the changes: (+13 -3) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.72 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.73 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.72 Mon Nov 15 22:21:18 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Mon Nov 15 22:30:51 2004 @@ -278,9 +278,19 @@ /// necessary to resolve this address later (and emits a dummy value). /// void Emitter::emitPCRelativeBlockAddress(const MachineBasicBlock *MBB) { - // FIXME: Emit backward branches directly - BBRefs.push_back(std::make_pair(MBB, MCE.getCurrentPCValue())); - MCE.emitWord(0); + // If this is a backwards branch, we already know the address of the target, + // so just emit the value. + std::map::iterator I = + BasicBlockAddrs.find(MBB); + if (I != BasicBlockAddrs.end()) { + unsigned Location = I->second; + MCE.emitWord(Location-MCE.getCurrentPCValue()-4); + } else { + // Otherwise, remember where this reference was and where it is to so we can + // deal with it later. + BBRefs.push_back(std::make_pair(MBB, MCE.getCurrentPCValue())); + MCE.emitWord(0); + } } /// emitPCRelativeValue - Emit a 32-bit PC relative address. From lattner at cs.uiuc.edu Mon Nov 15 22:34:43 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 22:34:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86TargetMachine.h Message-ID: <200411160434.iAG4YhkX002816@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.73 -> 1.74 X86TargetMachine.h updated: 1.25 -> 1.26 --- Log message: Remove a dead function, which died when we got GAS emission working (phwew, hold your nose!) --- Diffs of the changes: (+0 -16) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.73 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.74 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.73 Mon Nov 15 22:30:51 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Mon Nov 15 22:34:29 2004 @@ -221,14 +221,6 @@ }; } -// This function is required by X86AsmPrinter.cpp to work around GAS bugs -void llvm::X86::emitInstruction(MachineCodeEmitter& mce, - const X86InstrInfo& ii, - const MachineInstr& mi) -{ - Emitter(mce, ii).emitInstruction(mi); -} - /// addPassesToEmitMachineCode - Add passes to the specified pass manager to get /// machine code emitted. This uses a MachineCodeEmitter object to handle /// actually outputting the machine code and resolving things like the address Index: llvm/lib/Target/X86/X86TargetMachine.h diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.25 llvm/lib/Target/X86/X86TargetMachine.h:1.26 --- llvm/lib/Target/X86/X86TargetMachine.h:1.25 Sat Jul 10 21:44:51 2004 +++ llvm/lib/Target/X86/X86TargetMachine.h Mon Nov 15 22:34:29 2004 @@ -51,14 +51,6 @@ static unsigned getModuleMatchQuality(const Module &M); static unsigned getJITMatchQuality(); }; - - // this is implemented in X86CodeEmitter.cpp - namespace X86 { - void emitInstruction(MachineCodeEmitter& mce, - const X86InstrInfo& ii, - const MachineInstr& MI); - } - } // End llvm namespace #endif From lattner at cs.uiuc.edu Mon Nov 15 22:47:46 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 15 Nov 2004 22:47:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp PPC64CodeEmitter.cpp Message-ID: <200411160447.iAG4lkpv013083@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32CodeEmitter.cpp updated: 1.11 -> 1.12 PPC64CodeEmitter.cpp updated: 1.1 -> 1.2 --- Log message: Simplify namespaces --- Diffs of the changes: (+2 -8) Index: llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.11 llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.12 --- llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.11 Sat Oct 23 18:47:34 2004 +++ llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp Mon Nov 15 22:47:32 2004 @@ -21,8 +21,7 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/Debug.h" - -namespace llvm { +using namespace llvm; namespace { class JITResolver { @@ -347,5 +346,3 @@ #include "PPC32GenCodeEmitter.inc" -} // end llvm namespace - Index: llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp:1.1 llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp:1.2 --- llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp:1.1 Tue Aug 10 19:10:41 2004 +++ llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp Mon Nov 15 22:47:33 2004 @@ -12,8 +12,7 @@ #include "PPC64JITInfo.h" #include "PPC64TargetMachine.h" - -namespace llvm { +using namespace llvm; /// addPassesToEmitMachineCode - Add passes to the specified pass manager to get /// machine code emitted. This uses a MachineCodeEmitter object to handle @@ -40,5 +39,3 @@ assert (0 && "PPC64JITInfo::replaceMachineCodeForFunction not implemented"); } -} // end llvm namespace - From reid at x10sys.com Tue Nov 16 00:12:03 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:12:03 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandLine.html Message-ID: <200411160612.AAA14386@zion.cs.uiuc.edu> Changes in directory llvm/docs: CommandLine.html updated: 1.27 -> 1.28 --- Log message: Per code review: *Implement/Document the cl::extrahelp feature instead of the MoreHelp ptr. --- Diffs of the changes: (+31 -1) Index: llvm/docs/CommandLine.html diff -u llvm/docs/CommandLine.html:1.27 llvm/docs/CommandLine.html:1.28 --- llvm/docs/CommandLine.html:1.27 Mon Nov 1 03:16:30 2004 +++ llvm/docs/CommandLine.html Tue Nov 16 00:11:52 2004 @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + CommandLine 2.0 Library Manual @@ -61,6 +62,7 @@
  • The cl::opt class
  • The cl::list class
  • The cl::alias class
  • +
  • The cl::extrahelp class
  • Builtin parsers @@ -1519,6 +1521,34 @@
  • + + + +
    + +

    The cl::extrahelp class is a nontemplated class that allows extra +help text to be printed out for the --help option.

    + +
    +namespace cl {
    +  struct extrahelp;
    +}
    +
    + +

    To use the extrahelp, simply construct one with a const char* +parameter to the constructor. The text passed to the constructor will be printed +at the bottom of the help message, verbatim. Note that multiple +cl::extrahelp can be used but this practice is discouraged. If +your tool needs to print additional help information, put all that help into a +single cl::extrahelp instance.

    +

    For example:

    +
    +  cl::extrahelp("\nADDITIONAL HELP:\n\n  This is the extra help\n");
    +
    +
    +
    Builtin parsers @@ -1776,7 +1806,7 @@ Chris Lattner
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/01 09:16:30 $ + Last modified: $Date: 2004/11/16 06:11:52 $ From reid at x10sys.com Tue Nov 16 00:12:03 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:12:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200411160612.AAA14390@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.52 -> 1.53 --- Log message: Per code review: *Implement/Document the cl::extrahelp feature instead of the MoreHelp ptr. --- Diffs of the changes: (+24 -5) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.52 llvm/lib/Support/CommandLine.cpp:1.53 --- llvm/lib/Support/CommandLine.cpp:1.52 Sun Nov 14 16:04:00 2004 +++ llvm/lib/Support/CommandLine.cpp Tue Nov 16 00:11:52 2004 @@ -838,7 +838,15 @@ // If this variable is set, it is a pointer to a function that the user wants // us to call after we print out the help info. Basically a hook to allow // additional help to be printed. -void (*cl::MoreHelp)() = 0; +static std::vector* MoreHelp = 0; + +extrahelp::extrahelp(const char* Help) + : morehelp(Help) { + if (!MoreHelp) { + MoreHelp = new std::vector; + } + MoreHelp->push_back(Help); +} namespace { @@ -913,11 +921,16 @@ for (unsigned i = 0, e = Options.size(); i != e; ++i) Options[i].second->printOptionInfo(MaxArgLen); - // Call the user's hook so help output can be extended. - if (MoreHelp != 0) - (*MoreHelp)(); + // Print any extra help the user has declared. If MoreHelp is not null, + // then the user used at least one cl::extrahelp instance to provide + // additional help. We just print it out now. + if (MoreHelp != 0) { + for (std::vector::iterator I = MoreHelp->begin(), + E = MoreHelp->end(); I != E; ++I) + std::cerr << *I; + } - // Halt the program if help information is printed + // Halt the program since help information was printed exit(1); } }; @@ -954,4 +967,10 @@ VersOp("version", cl::desc("display the version"), cl::location(VersionPrinterInstance), cl::ValueDisallowed); + } // End anonymous namespace + +// Utility function for printing the help message. +void cl::PrintHelpMessage() { + NormalPrinter = true; +} From reid at x10sys.com Tue Nov 16 00:12:03 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:12:03 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CommandLine.h Message-ID: <200411160612.AAA14389@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CommandLine.h updated: 1.38 -> 1.39 --- Log message: Per code review: *Implement/Document the cl::extrahelp feature instead of the MoreHelp ptr. --- Diffs of the changes: (+13 -7) Index: llvm/include/llvm/Support/CommandLine.h diff -u llvm/include/llvm/Support/CommandLine.h:1.38 llvm/include/llvm/Support/CommandLine.h:1.39 --- llvm/include/llvm/Support/CommandLine.h:1.38 Sun Nov 14 15:49:13 2004 +++ llvm/include/llvm/Support/CommandLine.h Tue Nov 16 00:11:52 2004 @@ -1046,13 +1046,19 @@ void apply(alias &A) const { A.setAliasFor(Opt); } }; -/// Permit the tool to provide additional help output after the normal -/// help output. To use this, create a function that returns void and -/// takes no arguments. Assign its address to cl::MoreHelp. If set, -/// this function will be called just before the CommandLine exits -/// after printing the help. -/// @brief Optional pointer to additional help function -extern void (*MoreHelp)(); +// extrahelp - provide additional help at the end of the normal help +// output. All occurrences of cl::extrahelp will be accumulated and +// printed to std::cerr at the end of the regular help, just before +// exit is called. +struct extrahelp { + const char * morehelp; + extrahelp(const char* help); +}; + +// This function just prints the help message, exactly the same way as if the +// --help option had been given on the command line. +// NOTE: THIS FUNCTION TERMINATES THE PROGRAM! +void PrintHelpMessage(); } // End namespace cl From reid at x10sys.com Tue Nov 16 00:15:31 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:15:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Path.h Message-ID: <200411160615.AAA14452@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Path.h updated: 1.10 -> 1.11 --- Log message: Per code review: * Clean up the StatusInfo constructor to construct all members and give them reasonable values. * Get rid of the Vector typedef and make the interface to getDirectoryContent use a std::set instead of a std::vector so the dir content is sorted. * Make the getStatusInfo method const and not return a useless boolean. --- Diffs of the changes: (+7 -9) Index: llvm/include/llvm/System/Path.h diff -u llvm/include/llvm/System/Path.h:1.10 llvm/include/llvm/System/Path.h:1.11 --- llvm/include/llvm/System/Path.h:1.10 Sun Nov 14 17:29:00 2004 +++ llvm/include/llvm/System/Path.h Tue Nov 16 00:15:19 2004 @@ -14,9 +14,10 @@ #ifndef LLVM_SYSTEM_PATH_H #define LLVM_SYSTEM_PATH_H +#include "llvm/System/TimeValue.h" +#include #include #include -#include "llvm/System/TimeValue.h" namespace llvm { namespace sys { @@ -46,8 +47,6 @@ /// @name Types /// @{ public: - typedef std::vector Vector; - /// This structure provides basic file system information about a file. It /// is patterned after the stat(2) Unix operating system call but made /// platform independent and eliminates many of the unix-specific fields. @@ -58,7 +57,8 @@ /// filled in by the getStatusInfo method. /// @brief File status structure struct StatusInfo { - StatusInfo() : modTime(0,0) { fileSize=0; mode=0; user=0; group=0; } + StatusInfo() : fileSize(0), modTime(0,0), mode(0777), user(999), + group(999), isDir(false) { } size_t fileSize; ///< Size of the file in bytes TimeValue modTime; ///< Time of file's modification uint32_t mode; ///< Mode of the file, if applicable @@ -345,7 +345,7 @@ /// @returns false if \p this is not a directory, true otherwise /// @throws std::string if the directory cannot be searched /// @brief Build a list of directory's contents. - bool getDirectoryContents(Vector& paths) const; + bool getDirectoryContents(std::set& paths) const; /// Obtain a 'C' string for the path name. /// @returns a 'C' string containing the path name. @@ -367,11 +367,9 @@ /// of the file system. If the file does not exist, false is returned. /// For other (hard I/O) errors, a std::string is throwing indicating the /// problem. - /// @returns true if the status info was obtained, false if the file does - /// not exist. /// @throws std::string if an error occurs. /// @brief Get file status. - bool getStatusInfo(StatusInfo& stat); + void getStatusInfo(StatusInfo& info) const; /// This method attempts to set the Path object to \p unverified_path /// and interpret the name as a directory name. The \p unverified_path @@ -527,7 +525,7 @@ /// @name Data /// @{ private: - std::string path; ///< Platform agnostic storage for the path name. + mutable std::string path; ///< Storage for the path name. /// @} }; From reid at x10sys.com Tue Nov 16 00:15:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:15:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Path.cpp Message-ID: <200411160615.AAA14449@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Path.cpp updated: 1.12 -> 1.13 --- Log message: Per code review: * Clean up the StatusInfo constructor to construct all members and give them reasonable values. * Get rid of the Vector typedef and make the interface to getDirectoryContent use a std::set instead of a std::vector so the dir content is sorted. * Make the getStatusInfo method const and not return a useless boolean. --- Diffs of the changes: (+4 -7) Index: llvm/lib/System/Unix/Path.cpp diff -u llvm/lib/System/Unix/Path.cpp:1.12 llvm/lib/System/Unix/Path.cpp:1.13 --- llvm/lib/System/Unix/Path.cpp:1.12 Sun Nov 14 17:30:38 2004 +++ llvm/lib/System/Unix/Path.cpp Tue Nov 16 00:15:19 2004 @@ -239,10 +239,8 @@ return path.substr(pos+1); } -bool -Path::getStatusInfo(StatusInfo& info) { - if (!isFile() || !readable()) - return false; +void +Path::getStatusInfo(StatusInfo& info) const { struct stat buf; if (0 != stat(path.c_str(), &buf)) { ThrowErrno(std::string("Can't get status: ")+path); @@ -255,11 +253,10 @@ info.isDir = S_ISDIR(buf.st_mode); if (info.isDir && path[path.length()-1] != '/') path += '/'; - return true; } bool -Path::getDirectoryContents(Vector& result) const { +Path::getDirectoryContents(std::set& result) const { if (!isDirectory()) return false; DIR* direntries = ::opendir(path.c_str()); @@ -276,7 +273,7 @@ ThrowErrno(aPath.path + ": can't get status"); if (S_ISDIR(buf.st_mode)) aPath.path += "/"; - result.push_back(aPath); + result.insert(aPath); } de = ::readdir(direntries); } From reid at x10sys.com Tue Nov 16 00:22:27 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:22:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/System/TimeValue.h Message-ID: <200411160622.AAA14557@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: TimeValue.h updated: 1.8 -> 1.9 --- Log message: Per code review: * get rid of (void) construct in function declarations * make toString a const member * add a default implementation of toString for Win32 --- Diffs of the changes: (+11 -11) Index: llvm/include/llvm/System/TimeValue.h diff -u llvm/include/llvm/System/TimeValue.h:1.8 llvm/include/llvm/System/TimeValue.h:1.9 --- llvm/include/llvm/System/TimeValue.h:1.8 Sun Nov 14 15:53:55 2004 +++ llvm/include/llvm/System/TimeValue.h Tue Nov 16 00:22:17 2004 @@ -195,24 +195,24 @@ /// Returns only the seconds component of the TimeValue. The nanoseconds /// portion is ignored. No rounding is performed. /// @brief Retrieve the seconds component - SecondsType seconds( void ) const { return seconds_; } + SecondsType seconds() const { return seconds_; } /// Returns only the nanoseconds component of the TimeValue. The seconds /// portion is ignored. /// @brief Retrieve the nanoseconds component. - NanoSecondsType nanoseconds( void ) const { return nanos_; } + NanoSecondsType nanoseconds() const { return nanos_; } /// Returns only the fractional portion of the TimeValue rounded down to the /// nearest microsecond (divide by one thousand). /// @brief Retrieve the fractional part as microseconds; - uint32_t microseconds( void ) const { + uint32_t microseconds() const { return nanos_ / NANOSECONDS_PER_MICROSECOND; } /// Returns only the fractional portion of the TimeValue rounded down to the /// nearest millisecond (divide by one million). /// @brief Retrieve the fractional part as milliseconds; - uint32_t milliseconds( void ) const { + uint32_t milliseconds() const { return nanos_ / NANOSECONDS_PER_MILLISECOND; } @@ -221,7 +221,7 @@ /// the range of a TimeValue. Nevertheless, this is useful on some operating /// systems and is therefore provided. /// @brief Convert to a number of microseconds (can overflow) - uint64_t usec( void ) const { + uint64_t usec() const { return seconds_ * MICROSECONDS_PER_SECOND + ( nanos_ / NANOSECONDS_PER_MICROSECOND ); } @@ -231,7 +231,7 @@ /// the range of a TimeValue. Nevertheless, this is useful on some operating /// systems and is therefore provided. /// @brief Convert to a number of milliseconds (can overflow) - uint64_t msec( void ) const { + uint64_t msec() const { return seconds_ * MILLISECONDS_PER_SECOND + ( nanos_ / NANOSECONDS_PER_MILLISECOND ); } @@ -239,7 +239,7 @@ /// Converts the TimeValue into the corresponding number of "ticks" for /// Posix, correcting for the difference in Posix zero time. /// @brief Convert to unix time (100 nanoseconds since 12:00:00a Jan 1,1970) - uint64_t toPosixTime( void ) const { + uint64_t toPosixTime() const { uint64_t result = seconds_ - PosixZeroTime.seconds_; result += nanos_ / NANOSECONDS_PER_POSIX_TICK; return result; @@ -247,14 +247,14 @@ /// Converts the TimeValue into the corresponding number of seconds /// since the epoch (00:00:00 Jan 1,1970). - uint64_t toEpochTime(void) const { + uint64_t toEpochTime() const { return seconds_ - PosixZeroTime.seconds_; } /// Converts the TiemValue into the correspodning number of "ticks" for /// Win32 platforms, correcting for the difference in Win32 zero time. /// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601) - uint64_t toWin32Time( void ) const { + uint64_t toWin32Time() const { uint64_t result = seconds_ - Win32ZeroTime.seconds_; result += nanos_ / NANOSECONDS_PER_WIN32_TICK; return result; @@ -271,7 +271,7 @@ /// Provides conversion of the TimeValue into a readable time & date. /// @returns std::string containing the readable time value /// @brief Convert time to a string. - std::string toString(); + std::string toString() const; /// @} /// @name Mutators @@ -343,7 +343,7 @@ /// This causes the values to be represented so that the fractional /// part is minimized, possibly incrementing the seconds part. /// @brief Normalize to canonical form. - void normalize (void); + void normalize(); /// @} /// @name Data From reid at x10sys.com Tue Nov 16 00:22:28 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:22:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/TimeValue.cpp Message-ID: <200411160622.AAA14560@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: TimeValue.cpp updated: 1.4 -> 1.5 --- Log message: Per code review: * get rid of (void) construct in function declarations * make toString a const member * add a default implementation of toString for Win32 --- Diffs of the changes: (+1 -1) Index: llvm/lib/System/Unix/TimeValue.cpp diff -u llvm/lib/System/Unix/TimeValue.cpp:1.4 llvm/lib/System/Unix/TimeValue.cpp:1.5 --- llvm/lib/System/Unix/TimeValue.cpp:1.4 Sun Nov 14 22:42:34 2004 +++ llvm/lib/System/Unix/TimeValue.cpp Tue Nov 16 00:22:17 2004 @@ -25,7 +25,7 @@ using namespace sys; -std::string TimeValue::toString() { +std::string TimeValue::toString() const { char buffer[32]; time_t ourTime = time_t(this->toEpochTime()); From reid at x10sys.com Tue Nov 16 00:22:28 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:22:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/TimeValue.cpp Message-ID: <200411160622.AAA14561@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: TimeValue.cpp updated: 1.3 -> 1.4 --- Log message: Per code review: * get rid of (void) construct in function declarations * make toString a const member * add a default implementation of toString for Win32 --- Diffs of the changes: (+4 -0) Index: llvm/lib/System/Win32/TimeValue.cpp diff -u llvm/lib/System/Win32/TimeValue.cpp:1.3 llvm/lib/System/Win32/TimeValue.cpp:1.4 --- llvm/lib/System/Win32/TimeValue.cpp:1.3 Sun Nov 14 22:47:22 2004 +++ llvm/lib/System/Win32/TimeValue.cpp Tue Nov 16 00:22:17 2004 @@ -30,6 +30,10 @@ static_cast( (ft % 10000000) * 100) ); } +std::string TimeValue::toString() const { + return "Don't know how to conver time on Win32"; +} + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab } From lattner at cs.uiuc.edu Tue Nov 16 00:31:52 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 00:31:52 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExtractFunction.cpp ListReducer.h Miscompilation.cpp Message-ID: <200411160631.iAG6VqDk010784@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExtractFunction.cpp updated: 1.39 -> 1.40 ListReducer.h updated: 1.10 -> 1.11 Miscompilation.cpp updated: 1.53 -> 1.54 --- Log message: Make this code not depend on LinkModules leaving the second argument unmolested. --- Diffs of the changes: (+41 -22) Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.39 llvm/tools/bugpoint/ExtractFunction.cpp:1.40 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.39 Sun Sep 19 23:48:05 2004 +++ llvm/tools/bugpoint/ExtractFunction.cpp Tue Nov 16 00:31:37 2004 @@ -143,9 +143,18 @@ // Check to see if we created any new functions. If not, no loops were // extracted and we should return null. - if (M->size() == NewM->size()) { + static unsigned NumExtracted = 15; + + if (M->size() == NewM->size() || --NumExtracted == 0) { delete NewM; return 0; + } else { + assert(M->size() < NewM->size() && "Loop extract removed functions?"); + Module::iterator MI = NewM->begin(); + for (unsigned i = 0, e = M->size(); i != e; ++i) + ++MI; + for (; MI != NewM->end(); ++MI) + std::cerr << "NEW FUNCTION: " << *MI; } return NewM; Index: llvm/tools/bugpoint/ListReducer.h diff -u llvm/tools/bugpoint/ListReducer.h:1.10 llvm/tools/bugpoint/ListReducer.h:1.11 --- llvm/tools/bugpoint/ListReducer.h:1.10 Tue May 11 15:41:07 2004 +++ llvm/tools/bugpoint/ListReducer.h Tue Nov 16 00:31:38 2004 @@ -90,7 +90,7 @@ // could. If there is more two elements in the list, try deleting interior // elements and testing that. // - if (TheList.size() > 2) { + if (0 && TheList.size() > 2) { bool Changed = true; std::vector EmptyList; while (Changed) { Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.53 llvm/tools/bugpoint/Miscompilation.cpp:1.54 --- llvm/tools/bugpoint/Miscompilation.cpp:1.53 Sun Nov 14 17:00:08 2004 +++ llvm/tools/bugpoint/Miscompilation.cpp Tue Nov 16 00:31:38 2004 @@ -171,13 +171,16 @@ bool DeleteInputs) { // Link the two portions of the program back to together. std::string ErrorMsg; - if (!DeleteInputs) M1 = CloneModule(M1); + if (!DeleteInputs) { + M1 = CloneModule(M1); + M2 = CloneModule(M2); + } if (LinkModules(M1, M2, &ErrorMsg)) { std::cerr << BD.getToolName() << ": Error linking modules together:" << ErrorMsg << '\n'; exit(1); } - if (DeleteInputs) delete M2; // We are done with this module... + delete M2; // We are done with this module. Module *OldProgram = BD.swapProgramIn(M1); @@ -289,6 +292,12 @@ std::cout << "*** Loop extraction successful!\n"; + std::vector > MisCompFunctions; + for (Module::iterator I = ToOptimizeLoopExtracted->begin(), + E = ToOptimizeLoopExtracted->end(); I != E; ++I) + MisCompFunctions.push_back(std::make_pair(I->getName(), + I->getFunctionType())); + // Okay, great! Now we know that we extracted a loop and that loop // extraction both didn't break the program, and didn't mask the problem. // Replace the current program with the loop extracted version, and try to @@ -299,21 +308,18 @@ << ErrorMsg << '\n'; exit(1); } + delete ToOptimizeLoopExtracted; // All of the Function*'s in the MiscompiledFunctions list are in the old // module. Update this list to include all of the functions in the // optimized and loop extracted module. MiscompiledFunctions.clear(); - for (Module::iterator I = ToOptimizeLoopExtracted->begin(), - E = ToOptimizeLoopExtracted->end(); I != E; ++I) { - if (!I->isExternal()) { - Function *NewF = ToNotOptimize->getFunction(I->getName(), - I->getFunctionType()); - assert(NewF && "Function not found??"); - MiscompiledFunctions.push_back(NewF); - } + for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) { + Function *NewF = ToNotOptimize->getFunction(MisCompFunctions[i].first, + MisCompFunctions[i].second); + assert(NewF && "Function not found??"); + MiscompiledFunctions.push_back(NewF); } - delete ToOptimizeLoopExtracted; BD.setNewProgram(ToNotOptimize); MadeChange = true; @@ -423,12 +429,19 @@ // together. delete ToExtract; + std::vector > MisCompFunctions; + for (Module::iterator I = Extracted->begin(), E = Extracted->end(); + I != E; ++I) + MisCompFunctions.push_back(std::make_pair(I->getName(), + I->getFunctionType())); + std::string ErrorMsg; if (LinkModules(ProgClone, Extracted, &ErrorMsg)) { std::cerr << BD.getToolName() << ": Error linking modules together:" << ErrorMsg << '\n'; exit(1); } + delete Extracted; // Set the new program and delete the old one. BD.setNewProgram(ProgClone); @@ -436,15 +449,12 @@ // Update the list of miscompiled functions. MiscompiledFunctions.clear(); - for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E; - ++I) - if (!I->isExternal()) { - Function *NF = ProgClone->getFunction(I->getName(), I->getFunctionType()); - assert(NF && "Mapped function not found!"); - MiscompiledFunctions.push_back(NF); - } - - delete Extracted; + for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) { + Function *NewF = ProgClone->getFunction(MisCompFunctions[i].first, + MisCompFunctions[i].second); + assert(NewF && "Function not found??"); + MiscompiledFunctions.push_back(NewF); + } return true; } From lattner at cs.uiuc.edu Tue Nov 16 00:41:07 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 00:41:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp Message-ID: <200411160641.iAG6f7BY011053@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.34 -> 1.35 --- Log message: use an autoptr --- Diffs of the changes: (+3 -7) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.34 llvm/lib/Linker/LinkArchives.cpp:1.35 --- llvm/lib/Linker/LinkArchives.cpp:1.34 Sun Nov 14 17:49:55 2004 +++ llvm/lib/Linker/LinkArchives.cpp Tue Nov 16 00:40:54 2004 @@ -195,18 +195,14 @@ for (std::set::iterator I=Modules.begin(), E=Modules.end(); I != E; ++I) { // Get the module we must link in. - Module* aModule = (*I)->releaseModule(); + std::auto_ptr aModule((*I)->releaseModule()); - // Link it in - if (LinkModules(M, aModule, ErrorMessage)) { + // Link it in. + if (LinkModules(M, aModule.get(), ErrorMessage)) { // don't create a memory leak - delete aModule; delete arch; return true; // Couldn't link in the right object file... } - - // Since we have linked in this object, throw it away now. - delete aModule; } // We have linked in a set of modules determined by the archive to satisfy From reid at x10sys.com Tue Nov 16 00:41:16 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:41:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Message-ID: <200411160641.AAA14819@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ReaderWrappers.cpp updated: 1.35 -> 1.36 --- Log message: Per code review:\ * Get rid of memory leaks on exception \ * Provide better comments of how the memory handling works --- Diffs of the changes: (+12 -8) Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.35 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.36 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.35 Sun Nov 14 19:20:11 2004 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Tue Nov 16 00:41:05 2004 @@ -377,13 +377,12 @@ std::auto_ptr AMP( getBytecodeModuleProvider(fName.get())); // Get the module from the provider - Module* M = AMP->releaseModule(); + Module* M = AMP->materializeModule(); // Get the symbols getSymbols(M, symbols); // Done with the module - delete M; return true; } catch (...) { @@ -393,12 +392,13 @@ ModuleProvider* llvm::GetBytecodeSymbols(const unsigned char*Buffer, unsigned Length, - const std::string& ModuleID, - std::vector& symbols) { + const std::string& ModuleID, + std::vector& symbols) { + ModuleProvider* MP = 0; try { - ModuleProvider* MP = - getBytecodeBufferModuleProvider(Buffer, Length, ModuleID); + // Get the module provider + MP = getBytecodeBufferModuleProvider(Buffer, Length, ModuleID); // Get the module from the provider Module* M = MP->materializeModule(); @@ -406,11 +406,15 @@ // Get the symbols getSymbols(M, symbols); - // Done with the module + // Done with the module. Note that ModuleProvider will delete the + // Module when it is deleted. Also note that its the caller's responsibility + // to delete the ModuleProvider. return MP; } catch (...) { - // Fall through + // We only delete the ModuleProvider here because its destructor will + // also delete the Module (we used materializeModule not releaseModule). + delete MP; } return 0; } From reid at x10sys.com Tue Nov 16 00:41:19 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:41:19 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200411160641.AAA14829@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.18 -> 1.19 --- Log message: Per code review: \ * hide the compatibility option \ * Make static things static \ * Use cl::extrahelp instead of cl::MoreHelp (defunct) \ * Use cl::PrintHelpMessage instead of our own printUse function \ * Use a std::set for the path list because its now required by \ the sys::Path class and also ensues directories are traversed in sorted \ order.\ * Implement symbol table printing locally instead of in libLLVMArchive \ * Adjust to changes in llvm::Archive interface \ * Make sure we destruct objects even if exceptions occur. \ * Fix a typo in an output string. --- Diffs of the changes: (+105 -113) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.18 llvm/tools/llvm-ar/llvm-ar.cpp:1.19 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.18 Mon Nov 15 13:21:49 2004 +++ llvm/tools/llvm-ar/llvm-ar.cpp Tue Nov 16 00:41:09 2004 @@ -25,18 +25,51 @@ using namespace llvm; // Option for compatibility with ASIX, not used but must allow it to be present. -cl::opt -X32Option ("X32_64", cl::desc("Ignored option for compatibility with AIX")); +static cl::opt +X32Option ("X32_64", cl::Hidden, + cl::desc("Ignored option for compatibility with AIX")); -// llvm-ar operation code and modifier flags. This must come first -cl::opt +// llvm-ar operation code and modifier flags. This must come first. +static cl::opt Options(cl::Positional, cl::Required, cl::desc("{operation}[modifiers]...")); -// llvm-ar remaining positional arguments -cl::list +// llvm-ar remaining positional arguments. +static cl::list RestOfArgs(cl::Positional, cl::OneOrMore, cl::desc("[relpos] [count] [members]...")); +// MoreHelp - Provide additional help output explaining the operations and +// modifiers of llvm-ar. This object instructs the CommandLine library +// to print the text of the constructor when the --help option is given. +static cl::extrahelp MoreHelp( + "\nOPERATIONS:\n" + " d[NsS] - delete file(s) from the archive\n" + " m[abiSs] - move file(s) in the archive\n" + " p[kN] - print file(s) found in the archive\n" + " q[ufsS] - quick append file(s) to the archive\n" + " r[abfiuzRsS] - replace or insert file(s) into the archive\n" + " t - display contents of archive\n" + " x[No] - extract file(s) from the archive\n" + "\nMODIFIERS (operation specific):\n" + " [a] - put file(s) after [relpos]\n" + " [b] - put file(s) before [relpos] (same as [i])\n" + " [f] - truncate inserted file names\n" + " [i] - put file(s) before [relpos] (same as [b])\n" + " [k] - always print bytecode files (default is to skip them)\n" + " [N] - use instance [count] of name\n" + " [o] - preserve original dates\n" + " [P] - use full path names when matching\n" + " [R] - recurse through directories when inserting\n" + " [s] - create an archive index (cf. ranlib)\n" + " [S] - do not build a symbol table\n" + " [u] - update only files newer than archive contents\n" + " [z] - compress files before inserting/extracting\n" + "\nMODIFIERS (generic):\n" + " [c] - do not warn if the library had to be created\n" + " [v] - be verbose about actions taken\n" + " [V] - be *really* verbose about actions taken\n" +); + // This enumeration delineates the kinds of operations on an archive // that are permitted. enum ArchiveOperation { @@ -87,62 +120,11 @@ // This variable holds the (possibly expanded) list of path objects that // correspond to files we will -sys::Path::Vector Paths; +std::set Paths; // The Archive object to which all the editing operations will be sent. Archive* TheArchive = 0; -// printMoreHelp - Provide additional help output explaining the operations and -// modifiers of llvm-ar. This function is called by the CommandLine library -// when the --help option is given because we set the global cl::MoreHelp -// variable to the address of this function. -void printMoreHelp() { - std::cout - << "\nOPERATIONS:\n" - << " d[NsS] - delete file(s) from the archive\n" - << " m[abiSs] - move file(s) in the archive\n" - << " p[kN] - print file(s) found in the archive\n" - << " q[ufsS] - quick append file(s) to the archive\n" - << " r[abfiuzRsS] - replace or insert file(s) into the archive\n" - << " t - display contents of archive\n" - << " x[No] - extract file(s) from the archive\n"; - - std::cout - << "\nMODIFIERS (operation specific):\n" - << " [a] - put file(s) after [relpos]\n" - << " [b] - put file(s) before [relpos] (same as [i])\n" - << " [f] - truncate inserted file names\n" - << " [i] - put file(s) before [relpos] (same as [b])\n" - << " [k] - always print bytecode files (default is to skip them)\n" - << " [N] - use instance [count] of name\n" - << " [o] - preserve original dates\n" - << " [P] - use full path names when matching\n" - << " [R] - recurse through directories when inserting\n" - << " [s] - create an archive index (cf. ranlib)\n" - << " [S] - do not build a symbol table\n" - << " [u] - update only files newer than archive contents\n" - << " [z] - compress files before inserting/extracting\n"; - - std::cout - << "\nMODIFIERS (generic):\n" - << " [c] - do not warn if the library had to be created\n" - << " [v] - be verbose about actions taken\n" - << " [V] - be *really* verbose about actions taken\n"; -} - -// printUse - Print out our usage information. This is used in cases where the -// user has made a mistake on the command line syntax. -void printUse() { - std::cout - << "OVERVIEW: LLVM Archiver (llvm-ar)\n\n" - << " This program archives bytecode files into single libraries\n\n" - << "USAGE: llvm-ar [-X32_64] [-]{operation}[modifiers]... " - << "[relpos] [count] archive-file [files..]\n"; - - printMoreHelp(); - exit(1); -} - // getRelPos - Extract the member filename from the command line for // the [relpos] argument associated with a, b, and i modifiers void getRelPos() { @@ -243,7 +225,7 @@ UseCount = true; break; default: - printUse(); + cl::PrintHelpMessage(); } } @@ -287,19 +269,19 @@ // the Paths vector (built by buildPaths, below) and replaces any directories it // finds with all the files in that directory (recursively). It uses the // sys::Path::getDirectoryContent method to perform the actual directory scans. -sys::Path::Vector recurseDirectories(const sys::Path& path) { +std::set recurseDirectories(const sys::Path& path) { assert(path.isDirectory() && "Oops, can't recurse a file"); - sys::Path::Vector result; + std::set result; if (RecurseDirectories) { - sys::Path::Vector content; + std::set content; path.getDirectoryContents(content); - for (sys::Path::Vector::iterator I = content.begin(), E = content.end(); + for (std::set::iterator I = content.begin(), E = content.end(); I != E; ++I) { if (I->isDirectory()) { - sys::Path::Vector moreResults = recurseDirectories(*I); - result.insert(result.begin(), moreResults.begin(), moreResults.end()); + std::set moreResults = recurseDirectories(*I); + result.insert(moreResults.begin(), moreResults.end()); } else { - result.push_back(*I); + result.insert(*I); } } } @@ -320,17 +302,28 @@ sys::Path::StatusInfo si; aPath.getStatusInfo(si); if (si.isDir) { - sys::Path::Vector dirpaths = recurseDirectories(aPath); - Paths.insert(Paths.end(),dirpaths.begin(),dirpaths.end()); + std::set dirpaths = recurseDirectories(aPath); + Paths.insert(dirpaths.begin(),dirpaths.end()); } else { - Paths.push_back(aPath); + Paths.insert(aPath); } } else { - Paths.push_back(aPath); + Paths.insert(aPath); } } } +// printSymbolTable - print out the archive's symbol table. +void printSymbolTable() { + std::cout << "\nArchive Symbol Table:\n"; + const Archive::SymTabType& symtab = TheArchive->getSymbolTable(); + for (Archive::SymTabType::const_iterator I=symtab.begin(), E=symtab.end(); + I != E; ++I ) { + unsigned offset = TheArchive->getFirstFileOffset() + I->second; + std::cout << " " << std::setw(9) << offset << "\t" << I->first <<"\n"; + } +} + // doPrint - Implements the 'p' operation. This function traverses the archive // looking for members that match the path list. It is careful to uncompress // things that should be and to skip bytecode files unless the 'k' modifier was @@ -371,7 +364,7 @@ // putMode - utility function for printing out the file mode when the 't' // operation is in verbose mode. -void putMode(unsigned mode) { +void printMode(unsigned mode) { if (mode & 004) std::cout << "r"; else @@ -412,9 +405,9 @@ else std::cout << " "; unsigned mode = I->getMode(); - putMode((mode >> 6) & 007); - putMode((mode >> 3) & 007); - putMode(mode & 007); + printMode((mode >> 6) & 007); + printMode((mode >> 3) & 007); + printMode(mode & 007); std::cout << " " << std::setw(4) << I->getUser(); std::cout << "/" << std::setw(4) << I->getGroup(); std::cout << " " << std::setw(8) << I->getSize(); @@ -426,15 +419,8 @@ } } } - if (ReallyVerbose) { - std::cout << "\nArchive Symbol Table:\n"; - const Archive::SymTabType& symtab = TheArchive->getSymbolTable(); - for (Archive::SymTabType::const_iterator I=symtab.begin(), E=symtab.end(); - I != E; ++I ) { - unsigned offset = TheArchive->getFirstFileOffset() + I->second; - std::cout << " " << std::setw(9) << offset << "\t" << I->first <<"\n"; - } - } + if (ReallyVerbose) + printSymbolTable(); } // doExtract - Implement the 'x' operation. This function extracts files back to @@ -491,7 +477,7 @@ if (countDown == 1) { Archive::iterator J = I; ++I; - TheArchive->remove(J); + TheArchive->erase(J); } else countDown--; } else { @@ -500,7 +486,9 @@ } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ReallyVerbose); + TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + if (ReallyVerbose) + printSymbolTable(); } // doMore - Implement the move operation. This function re-arranges just the @@ -534,23 +522,25 @@ } // Keep a list of the paths remaining to be moved - sys::Path::Vector remaining(Paths); + std::set remaining(Paths); // Scan the archive again, this time looking for the members to move to the // moveto_spot. for (Archive::iterator I = TheArchive->begin(), E= TheArchive->end(); I != E && !remaining.empty(); ++I ) { - sys::Path::Vector::iterator found = + std::set::iterator found = std::find(remaining.begin(),remaining.end(),I->getPath()); if (found != remaining.end()) { if (I != moveto_spot) - TheArchive->moveMemberBefore(I,moveto_spot); + TheArchive->splice(moveto_spot,*TheArchive,I); remaining.erase(found); } } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ReallyVerbose); + TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + if (ReallyVerbose) + printSymbolTable(); } // doQuickAppend - Implements the 'q' operation. This function just @@ -561,13 +551,15 @@ if (Paths.empty()) return; // Append them quickly. - for (sys::Path::Vector::iterator PI = Paths.begin(), PE = Paths.end(); + for (std::set::iterator PI = Paths.begin(), PE = Paths.end(); PI != PE; ++PI) { TheArchive->addFileBefore(*PI,TheArchive->end()); } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ReallyVerbose); + TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + if (ReallyVerbose) + printSymbolTable(); } // doReplaceOrInsert - Implements the 'r' operation. This function will replace @@ -579,7 +571,7 @@ if (Paths.empty()) return; // Keep track of the paths that remain to be inserted. - sys::Path::Vector remaining(Paths); + std::set remaining(Paths); // Default the insertion spot to the end of the archive Archive::iterator insert_spot = TheArchive->end(); @@ -590,18 +582,22 @@ // Determine if this archive member matches one of the paths we're trying // to replace. - sys::Path::Vector::iterator found = + std::set::iterator found = std::find(remaining.begin(),remaining.end(), I->getPath()); if (found != remaining.end()) { - if (OnlyUpdate) { - // Replace the item only if it is newer. - sys::Path::StatusInfo si; - found->getStatusInfo(si); - if (si.modTime > I->getModTime()) + sys::Path::StatusInfo si; + found->getStatusInfo(si); + if (si.isDir) { + if (OnlyUpdate) { + // Replace the item only if it is newer. + if (si.modTime > I->getModTime()) + I->replaceWith(*found); + } else { + // Replace the item regardless of time stamp I->replaceWith(*found); + } } else { - // Replace the item regardless of time stamp - I->replaceWith(*found); + // We purposefully ignore directories. } // Remove it from our "to do" list @@ -620,24 +616,21 @@ // If we didn't replace all the members, some will remain and need to be // inserted at the previously computed insert-spot. if (!remaining.empty()) { - for (sys::Path::Vector::iterator PI = remaining.begin(), + for (std::set::iterator PI = remaining.begin(), PE = remaining.end(); PI != PE; ++PI) { TheArchive->addFileBefore(*PI,insert_spot); } } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression,ReallyVerbose); + TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + if (ReallyVerbose) + printSymbolTable(); } // main - main program for llvm-ar .. see comments in the code int main(int argc, char **argv) { - // Ensure we initialize the global MoreHelp to tell the command line utility - // that we have a MoreHelp function. This function is called to print more - // help if the --help option is given on the command line - cl::MoreHelp = printMoreHelp; - // Have the command line options parsed and handle things // like --help and --version. cl::ParseCommandLineOptions(argc, argv, @@ -674,6 +667,9 @@ // Make sure we're not fooling ourselves. assert(TheArchive && "Unable to instantiate the archive"); + // Make sure we clean up the archive even on failure. + std::auto_ptr AutoArchive(TheArchive); + // Perform the operation switch (Operation) { case Print: doPrint(); break; @@ -687,15 +683,11 @@ std::cerr << argv[0] << ": No operation was selected.\n"; break; } - - // Close up shop - delete TheArchive; - } catch (const char*msg) { // These errors are usage errors, thrown only by the various checks in the // code above. std::cerr << argv[0] << ": " << msg << "\n\n"; - printUse(); + cl::PrintHelpMessage(); exitCode = 1; } catch (const std::string& msg) { // These errors are thrown by LLVM libraries (e.g. lib System) and represent @@ -704,7 +696,7 @@ exitCode = 2; } catch (...) { // This really shouldn't happen, but just in case .... - std::cerr << argv[0] << ": An nexpected unknown exception occurred.\n"; + std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n"; exitCode = 3; } From reid at x10sys.com Tue Nov 16 00:41:31 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:41:31 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ranlib/llvm-ranlib.cpp Message-ID: <200411160641.AAA14848@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ranlib: llvm-ranlib.cpp updated: 1.1 -> 1.2 --- Log message: Per code review: \ * Make static things static \ * Get rid of unused TmpArchive variable \ * Implement symbol table printing \ * Adjust to changes in llvm::Archive interface \ * Make sure we destruct objects even if exceptions occur. \ * Fix a typo in an output string. --- Diffs of the changes: (+17 -14) Index: llvm/tools/llvm-ranlib/llvm-ranlib.cpp diff -u llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.1 llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.2 --- llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.1 Sun Nov 14 16:29:21 2004 +++ llvm/tools/llvm-ranlib/llvm-ranlib.cpp Tue Nov 16 00:41:20 2004 @@ -17,24 +17,27 @@ #include "llvm/Support/FileUtilities.h" #include "llvm/System/Signals.h" #include -#include #include using namespace llvm; // llvm-ar operation code and modifier flags -cl::opt +static cl::opt ArchiveName(cl::Positional, cl::Optional, cl::desc("...")); -cl::opt +static cl::opt Verbose("verbose",cl::Optional,cl::init(false), cl::desc("Print the symbol table")); -sys::Path TmpArchive; - -void cleanup() { - if (TmpArchive.exists()) - TmpArchive.destroyFile(); +// printSymbolTable - print out the archive's symbol table. +void printSymbolTable(Archive* TheArchive) { + std::cout << "\nArchive Symbol Table:\n"; + const Archive::SymTabType& symtab = TheArchive->getSymbolTable(); + for (Archive::SymTabType::const_iterator I=symtab.begin(), E=symtab.end(); + I != E; ++I ) { + unsigned offset = TheArchive->getFirstFileOffset() + I->second; + std::cout << " " << std::setw(9) << offset << "\t" << I->first <<"\n"; + } } int main(int argc, char **argv) { @@ -64,14 +67,15 @@ if (!ArchivePath.exists()) throw "Archive file does not exist"; - // Archive* TheArchive = Archive::OpenAndLoad(ArchivePath); - Archive* TheArchive = Archive::OpenAndLoad(ArchivePath); + std::auto_ptr AutoArchive(Archive::OpenAndLoad(ArchivePath)); + Archive* TheArchive = AutoArchive.get(); assert(TheArchive && "Unable to instantiate the archive"); - TheArchive->writeToDisk(true,false,false,Verbose); + TheArchive->writeToDisk(true, false, false ); - delete TheArchive; + if (Verbose) + printSymbolTable(TheArchive); } catch (const char*msg) { std::cerr << argv[0] << ": " << msg << "\n\n"; @@ -80,9 +84,8 @@ std::cerr << argv[0] << ": " << msg << "\n"; exitCode = 2; } catch (...) { - std::cerr << argv[0] << ": An nexpected unknown exception occurred.\n"; + std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n"; exitCode = 3; } - cleanup(); return exitCode; } From lattner at cs.uiuc.edu Tue Nov 16 00:41:35 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 00:41:35 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Linker.h Message-ID: <200411160641.iAG6fZsn011066@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Linker.h updated: 1.10 -> 1.11 --- Log message: Document this as clobbering the second arg, make the second arg be non-const --- Diffs of the changes: (+7 -5) Index: llvm/include/llvm/Linker.h diff -u llvm/include/llvm/Linker.h:1.10 llvm/include/llvm/Linker.h:1.11 --- llvm/include/llvm/Linker.h:1.10 Sun Nov 14 15:46:08 2004 +++ llvm/include/llvm/Linker.h Tue Nov 16 00:41:21 2004 @@ -22,15 +22,17 @@ class Module; -/// This is the heart of the linker. The \p Src module is linked into the -/// \p Dest module. If an error occurs, true is returned, otherwise false. If -/// \p ErrorMsg is not null and an error occurs, \p *ErrorMsg will be set to a -/// readable string that indicates the nature of the error. +/// This is the heart of the linker. The \p Src module is linked into the \p +/// Dest module. If an error occurs, true is returned, otherwise false. If \p +/// ErrorMsg is not null and an error occurs, \p *ErrorMsg will be set to a +/// readable string that indicates the nature of the error. Note that this can +/// destroy the Src module in arbitrary ways. +/// /// @returns true if there's an error /// @brief Link two modules together bool LinkModules( Module* Dest, ///< Module into which \p Src is linked - const Module* Src, ///< Module linked into \p Dest + Module* Src, ///< Module linked into \p Dest std::string* ErrorMsg ///< Optional error message string ); From lattner at cs.uiuc.edu Tue Nov 16 00:41:48 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 00:41:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp Message-ID: <200411160641.iAG6fm7t011076@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.90 -> 1.91 --- Log message: The second arg may be clobbered by this function --- Diffs of the changes: (+1 -1) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.90 llvm/lib/Linker/LinkModules.cpp:1.91 --- llvm/lib/Linker/LinkModules.cpp:1.90 Sun Nov 14 17:27:04 2004 +++ llvm/lib/Linker/LinkModules.cpp Tue Nov 16 00:41:36 2004 @@ -848,7 +848,7 @@ // error occurs, true is returned and ErrorMsg (if not null) is set to indicate // the problem. Upon failure, the Dest module could be in a modified state, and // shouldn't be relied on to be consistent. -bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { +bool llvm::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) { assert(Dest != 0 && "Invalid Destination module"); assert(Src != 0 && "Invalid Source Module"); From reid at x10sys.com Tue Nov 16 00:47:06 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:47:06 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Archive.h Message-ID: <200411160647.AAA14948@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Archive.h updated: 1.5 -> 1.6 --- Log message: Per code review:\ * Use STL names for STL operations \ * Do not have Archive doing symbol table printing \ * Avoid compiler warnings about only having private constructors. --- Diffs of the changes: (+23 -18) Index: llvm/include/llvm/Bytecode/Archive.h diff -u llvm/include/llvm/Bytecode/Archive.h:1.5 llvm/include/llvm/Bytecode/Archive.h:1.6 --- llvm/include/llvm/Bytecode/Archive.h:1.5 Sun Nov 14 15:47:41 2004 +++ llvm/include/llvm/Bytecode/Archive.h Tue Nov 16 00:46:55 2004 @@ -243,7 +243,7 @@ typedef std::map SymTabType; /// @} - /// @name ilist interface methods + /// @name ilist accessor methods /// @{ public: inline iterator begin() { return members.begin(); } @@ -264,6 +264,23 @@ inline ArchiveMember& back() { return members.back(); } /// @} + /// @name ilist mutator methods + /// @{ + public: + /// This method splices a \p src member from an archive (possibly \p this), + /// to a position just before the member given by \p dest in \p this. When + /// the archive is written, \p src will be written in its new location. + /// @brief Move a member to a new location + inline void splice(iterator dest, Archive& arch, iterator src) + { return members.splice(dest,arch.members,src); } + + /// This method erases a \p target member from the archive. When the + /// archive is written, it will no longer contain \p target. The associated + /// ArchiveMember is deleted. + /// @brief Erase a member. + inline iterator erase(iterator target) { return members.erase(target); } + + /// @} /// @name Constructors /// @{ public: @@ -405,8 +422,7 @@ void writeToDisk( bool CreateSymbolTable=false, ///< Create Symbol table bool TruncateNames=false, ///< Truncate the filename to 15 chars - bool Compress=false, ///< Compress files - bool PrintSymTab=false ///< Dump symtab to std::out if created + bool Compress=false ///< Compress files ); /// This method adds a new file to the archive. The \p filename is examined @@ -418,22 +434,10 @@ /// @brief Add a file to the archive. void addFileBefore(const sys::Path& filename, iterator where); - /// This method moves a \p target member to a new location in the archive, - /// just before the member given by \p iterator. When the archive is - /// written, \p target will be written in its new location. - /// @brief Move a member to a new location - void moveMemberBefore(iterator target, iterator where); - - /// This method removes a \p target member from the archive. When the - /// archive is written, it will no longer contain \p target. The associated - /// ArchiveMember is deleted. - /// @brief Remove a member. - void remove(iterator target); - /// @} /// @name Implementation /// @{ - private: + protected: /// @brief Construct an Archive for \p filename and optionally map it /// into memory. Archive(const sys::Path& filename, bool map = false ); @@ -454,7 +458,7 @@ void loadSymbolTable(); /// @brief Write the symbol table to an ofstream. - void writeSymbolTable(std::ofstream& ARFile,bool PrintSymTab); + void writeSymbolTable(std::ofstream& ARFile); /// @brief Write one ArchiveMember to an ofstream. void writeMember(const ArchiveMember& member, std::ofstream& ARFile, @@ -474,7 +478,7 @@ /// @} /// @name Data /// @{ - private: + protected: sys::Path archPath; ///< Path to the archive file we read/write MembersList members; ///< The ilist of ArchiveMember sys::MappedFile* mapfile; ///< Raw Archive contents mapped into memory @@ -484,6 +488,7 @@ unsigned symTabSize; ///< Size in bytes of symbol table unsigned firstFileOffset; ///< Offset to first normal file. ModuleMap modules; ///< The modules loaded via symbol lookup. + ArchiveMember* foreignST; ///< This holds the foreign symbol table. /// @} /// @name Hidden From reid at x10sys.com Tue Nov 16 00:47:18 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:47:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/Archive.cpp Message-ID: <200411160647.AAA14969@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: Archive.cpp updated: 1.2 -> 1.3 --- Log message: Per code review:\ * Make sure all members are initialized upon construction --- Diffs of the changes: (+2 -1) Index: llvm/lib/Bytecode/Archive/Archive.cpp diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.2 llvm/lib/Bytecode/Archive/Archive.cpp:1.3 --- llvm/lib/Bytecode/Archive/Archive.cpp:1.2 Sun Nov 14 15:56:13 2004 +++ llvm/lib/Bytecode/Archive/Archive.cpp Tue Nov 16 00:47:07 2004 @@ -124,7 +124,8 @@ // Archive class. Everything else (default,copy) is deprecated. This just // initializes and maps the file into memory, if requested. Archive::Archive(const sys::Path& filename, bool map ) - : archPath(filename), members(), mapfile(0), base(0), symTab(), symTabSize(0) + : archPath(filename), members(), mapfile(0), base(0), symTab(), strtab(), + symTabSize(0), firstFileOffset(0), modules(), foreignST(0) { if (map) { mapfile = new sys::MappedFile(filename); From reid at x10sys.com Tue Nov 16 00:47:29 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:47:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp Message-ID: <200411160647.AAA14988@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.24 -> 1.25 --- Log message: Per code review:\ * Make sure we write out the foreign symbol table if we read one \ * Make the padding calculation more efficiently and avoid Solaris warnings --- Diffs of the changes: (+20 -15) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.24 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.25 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.24 Sun Nov 14 19:40:20 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Tue Nov 16 00:47:19 2004 @@ -16,8 +16,6 @@ using namespace llvm; -namespace { - /// Read a variable-bit-rate encoded unsigned integer inline unsigned readInteger(const char*&At, const char*End) { unsigned Shift = 0; @@ -32,8 +30,6 @@ return Result; } -} - // Completely parse the Archive's symbol table and populate symTab member var. void Archive::parseSymbolTable(const void* data, unsigned size) { @@ -226,34 +222,43 @@ // check if this is the foreign symbol table if (mbr->isForeignSymbolTable()) { - // We don't do anything with this but delete it + // We just save this but don't do anything special + // with it. It doesn't count as the "first file". + foreignST = mbr; At += mbr->getSize(); - delete mbr; - if ((int(At) & 1) == 1) + if ((mbr->getSize() & 1) == 1) At++; } else if (mbr->isStringTable()) { + // Simply suck the entire string table into a string + // variable. This will be used to get the names of the + // members that use the "/ddd" format for their names + // (SVR4 style long names). strtab.assign(At,mbr->getSize()); At += mbr->getSize(); - if ((int(At) & 1) == 1) + if ((mbr->getSize() & 1) == 1) At++; delete mbr; } else if (mbr->isLLVMSymbolTable()) { + // This is the LLVM symbol table for the archive. If we've seen it + // already, its an error. Otherwise, parse the symbol table and move on. if (seenSymbolTable) throw std::string("invalid archive: multiple symbol tables"); parseSymbolTable(mbr->getData(),mbr->getSize()); seenSymbolTable = true; At += mbr->getSize(); - if ((int(At) & 1) == 1) + if ((mbr->getSize() & 1) == 1) At++; - delete mbr; + delete mbr; // We don't need this member in the list of members. } else { + // This is just a regular file. If its the first one, save its offset. + // Otherwise just push it on the list and move on to the next file. if (!foundFirstFile) { firstFileOffset = Save - base; foundFirstFile = true; } members.push_back(mbr); At += mbr->getSize(); - if ((int(At) & 1) == 1) + if ((mbr->getSize() & 1) == 1) At++; } } @@ -309,7 +314,7 @@ if (mbr->isForeignSymbolTable()) { // Skip the foreign symbol table, we don't do anything with it At += mbr->getSize(); - if (mbr->getSize() % 2 != 0) + if ((mbr->getSize() & 1) == 1) At++; delete mbr; @@ -322,7 +327,7 @@ // Process the string table entry strtab.assign((const char*)mbr->getData(),mbr->getSize()); At += mbr->getSize(); - if (mbr->getSize() % 2 != 0) + if ((mbr->getSize() & 1) == 1) At++; delete mbr; // Get the next one @@ -334,7 +339,7 @@ if (mbr->isLLVMSymbolTable()) { parseSymbolTable(mbr->getData(),mbr->getSize()); FirstFile = At + mbr->getSize(); - if (mbr->getSize() % 2 != 0) + if ((mbr->getSize() & 1) == 1) FirstFile++; } else { // There's no symbol table in the file. We have to rebuild it from scratch @@ -442,7 +447,7 @@ // Go to the next file location At += mbr->getSize(); - if (mbr->getSize() % 2 != 0) + if ((mbr->getSize() & 1) == 1) At++; } } From reid at x10sys.com Tue Nov 16 00:47:41 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:47:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Message-ID: <200411160647.AAA15007@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveWriter.cpp updated: 1.3 -> 1.4 --- Log message: Per code review:\ * Make the numVbrBytes function more efficient and better documented \ * Fix a bug in name truncation \ * Add comments before functions \ * Get rid of functions that are now inlined into the header \ * Do not have Archive doing symbol table printing \ * Put assert comments into the assert so they print out \ * Make sure foreign symbol tables are written --- Diffs of the changes: (+46 -44) Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.3 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.4 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.3 Sun Nov 14 19:20:11 2004 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Tue Nov 16 00:47:30 2004 @@ -22,8 +22,6 @@ using namespace llvm; -namespace { - // Write an integer using variable bit rate encoding. This saves a few bytes // per entry in the symbol table. inline void writeInteger(unsigned num, std::ofstream& ARFile) { @@ -43,17 +41,24 @@ // Compute how many bytes are taken by a given VBR encoded value. This is needed // to pre-compute the size of the symbol table. inline unsigned numVbrBytes(unsigned num) { - if (num < 128) // 2^7 - return 1; - if (num < 16384) // 2^14 - return 2; - if (num < 2097152) // 2^21 + + // Note that the following nested ifs are somewhat equivalent to a binary + // search. We split it in half by comparing against 2^14 first. This allows + // most reasonable values to be done in 2 comparisons instead of 1 for + // small ones and four for large ones. We expect this to access file offsets + // in the 2^10 to 2^24 range and symbol lengths in the 2^0 to 2^8 rnage, + // so this approach is reasonable. + if (num < 1<<14) + if (num < 1<<7) + return 1; + else + return 2; + if (num < 1<<21) return 3; - if (num < 268435456) // 2^28 - return 4; - return 5; // anything >= 2^28 takes 5 bytes -} + if (num < 1<<28) + return 4; + return 5; // anything >= 2^28 takes 5 bytes } // Create an empty archive. @@ -63,6 +68,12 @@ return result; } +// Fill the ArchiveMemberHeader with the information from a member. If +// TruncateNames is true, names are flattened to 15 chars or less. The sz field +// is provided here instead of coming from the mbr because the member might be +// stored compressed and the compressed size is not the ArchiveMember's size. +// Furthermore compressed files have negative size fields to identify them as +// compressed. bool Archive::fillHeader(const ArchiveMember &mbr, ArchiveMemberHeader& hdr, int sz, bool TruncateNames) const { @@ -78,7 +89,7 @@ memcpy(hdr.gid,buffer,6); // Set the size field - if (sz < 0 ) { + if (sz < 0) { buffer[0] = '-'; sprintf(&buffer[1],"%-9u",(unsigned)-sz); } else { @@ -108,9 +119,9 @@ nm += slashpos + 1; len -= slashpos +1; } - if (len >15) + if (len > 15) len = 15; - mbrPath.copy(hdr.name,len); + memcpy(hdr.name,nm,len); hdr.name[len] = '/'; } else if (mbrPath.length() < 16 && mbrPath.find('/') == std::string::npos) { mbrPath.copy(hdr.name,mbrPath.length()); @@ -124,6 +135,8 @@ return writeLongName; } +// Insert a file into the archive before some other member. This also takes care +// of extracting the necessary flags and information from the file. void Archive::addFileBefore(const sys::Path& filePath, iterator where) { assert(filePath.exists() && "Can't add a non-existent file"); @@ -156,19 +169,7 @@ members.insert(where,mbr); } -void -Archive::moveMemberBefore(iterator target, iterator where) { - assert(target != end() && "Target iterator for moveMemberBefore is invalid"); - ArchiveMember* mbr = members.remove(target); - members.insert(where, mbr); -} - -void -Archive::remove(iterator target) { - assert(target != end() && "Target iterator for remove is invalid"); - ArchiveMember* mbr = members.remove(target); - delete mbr; -} +// Write one member out to the file. void Archive::writeMember( const ArchiveMember& member, @@ -291,8 +292,9 @@ } } +// Write out the LLVM symbol table as an archive member to the file. void -Archive::writeSymbolTable(std::ofstream& ARFile,bool PrintSymTab ) { +Archive::writeSymbolTable(std::ofstream& ARFile) { // Construct the symbol table's header ArchiveMemberHeader Hdr; @@ -311,10 +313,6 @@ // Save the starting position of the symbol tables data content. unsigned startpos = ARFile.tellp(); - // Print the symbol table header if we're supposed to - if (PrintSymTab) - std::cout << "Symbol Table:\n"; - // Write out the symbols sequentially for ( Archive::SymTabType::iterator I = symTab.begin(), E = symTab.end(); I != E; ++I) @@ -325,13 +323,6 @@ writeInteger(I->first.length(), ARFile); // Write out the symbol ARFile.write(I->first.data(), I->first.length()); - - // Print this entry to std::cout if we should - if (PrintSymTab) { - unsigned filepos = I->second + symTabSize + sizeof(ArchiveMemberHeader) + - (symTabSize % 2 != 0) + 8; - std::cout << " " << std::setw(9) << filepos << "\t" << I->first << "\n"; - } } // Now that we're done with the symbol table, get the ending file position @@ -346,13 +337,17 @@ ARFile << ARFILE_PAD; } +// Write the entire archive to the file specified when the archive was created. +// This writes to a temporary file first. Options are for creating a symbol +// table, flattening the file names (no directories, 15 chars max) and +// compressing each archive member. void -Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, - bool Compress, bool PrintSymTab) { +Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ // Make sure they haven't opened up the file, not loaded it, // but are now trying to write it which would wipe out the file. - assert(!(members.empty() && mapfile->size() > 8)); + assert(!(members.empty() && mapfile->size() > 8) && + "Can't write an archive not opened for writing"); // Create a temporary file to store the archive in sys::Path TmpArchive = archPath; @@ -396,6 +391,8 @@ // ensure compatibility with other archivers we need to put the symbol // table first in the file. Unfortunately, this means mapping the file // we just wrote back in and copying it to the destination file. + + // Map in the archive we just wrote. sys::MappedFile arch(TmpArchive); const char* base = (const char*) arch.map(); @@ -408,8 +405,13 @@ // Write the file magic number FinalFile << ARFILE_MAGIC; - // Put out the symbol table - writeSymbolTable(FinalFile,PrintSymTab); + // If there is a foreign symbol table, put it into the file now. + if (foreignST) { + writeMember(*foreignST, FinalFile, false, false, false); + } + + // Put out the LLVM symbol table now. + writeSymbolTable(FinalFile); // Copy the temporary file contents being sure to skip the file's magic // number. From reid at x10sys.com Tue Nov 16 00:47:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:47:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp Message-ID: <200411160647.AAA15026@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.35 -> 1.36 --- Log message: Per code review:\ * Adjust indentation\ * Ensure memory do not leak if exceptions happen (std::auto_ptr use) --- Diffs of the changes: (+13 -11) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.35 llvm/lib/Linker/LinkArchives.cpp:1.36 --- llvm/lib/Linker/LinkArchives.cpp:1.35 Tue Nov 16 00:40:54 2004 +++ llvm/lib/Linker/LinkArchives.cpp Tue Nov 16 00:47:41 2004 @@ -163,9 +163,9 @@ /// FALSE - No errors. /// bool llvm::LinkInArchive(Module *M, - const std::string &Filename, - std::string* ErrorMessage, - bool Verbose) + const std::string &Filename, + std::string* ErrorMessage, + bool Verbose) { // Find all of the symbols currently undefined in the bytecode program. // If all the symbols are defined, the program is complete, and there is @@ -179,13 +179,16 @@ // Open the archive file if (Verbose) std::cerr << " Loading archive file '" << Filename << "'\n"; - Archive* arch = Archive::OpenAndLoadSymbols(sys::Path(Filename)); + std::auto_ptr AutoArch ( + Archive::OpenAndLoadSymbols(sys::Path(Filename))); + + Archive* arch = AutoArch.get(); // While we are linking in object files, loop. while (true) { std::set Modules; // Find the modules we need to link - arch->findModulesDefiningSymbols(UndefinedSymbols,Modules); + arch->findModulesDefiningSymbols(UndefinedSymbols, Modules); // If we didn't find any more modules to link this time, we are done. if (Modules.empty()) @@ -195,14 +198,13 @@ for (std::set::iterator I=Modules.begin(), E=Modules.end(); I != E; ++I) { // Get the module we must link in. - std::auto_ptr aModule((*I)->releaseModule()); + std::auto_ptr AutoModule( (*I)->releaseModule() ); + + Module* aModule = AutoModule.get(); - // Link it in. - if (LinkModules(M, aModule.get(), ErrorMessage)) { - // don't create a memory leak - delete arch; + // Link it in + if (LinkModules(M, aModule, ErrorMessage)) return true; // Couldn't link in the right object file... - } } // We have linked in a set of modules determined by the archive to satisfy From reid at x10sys.com Tue Nov 16 00:50:47 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:50:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200411160650.AAA15090@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.53 -> 1.54 --- Log message: Add a comment to some code that at first glance just doesn't look right. --- Diffs of the changes: (+6 -0) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.53 llvm/lib/Support/CommandLine.cpp:1.54 --- llvm/lib/Support/CommandLine.cpp:1.53 Tue Nov 16 00:11:52 2004 +++ llvm/lib/Support/CommandLine.cpp Tue Nov 16 00:50:36 2004 @@ -972,5 +972,11 @@ // Utility function for printing the help message. void cl::PrintHelpMessage() { + // This looks weird, but it actually prints the help message. The + // NormalPrinter variable is a HelpPrinter and the help gets printed when + // its operator= is invoked. That's because the "normal" usages of the + // help printer is to be assigned true/false depending on whether the + // --help option was given or not. Since we're circumventing that we have + // to make it look like --help was given, so we assign true. NormalPrinter = true; } From gaeke at cs.uiuc.edu Tue Nov 16 00:52:50 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue, 16 Nov 2004 00:52:50 -0600 (CST) Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp Message-ID: <200411160652.AAA07685@kain.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.13 -> 1.14 --- Log message: Give a better message for a common assertion failure. --- Diffs of the changes: (+2 -1) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.13 llvm/lib/CodeGen/LiveInterval.cpp:1.14 --- llvm/lib/CodeGen/LiveInterval.cpp:1.13 Mon Sep 27 21:38:58 2004 +++ llvm/lib/CodeGen/LiveInterval.cpp Tue Nov 16 00:52:35 2004 @@ -214,7 +214,8 @@ // Check to make sure that we are not overlapping two live ranges with // different ValId's. assert(B->end <= Start && - "Cannot overlap two LiveRanges with differing ValID's"); + "Cannot overlap two LiveRanges with differing ValID's" + " (did you def the same reg twice in a MachineInstr?)"); } } From reid at x10sys.com Tue Nov 16 00:57:41 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:57:41 -0600 Subject: [llvm-commits] CVS: llvm/win32/System/System.vcproj Message-ID: <200411160657.AAA15193@zion.cs.uiuc.edu> Changes in directory llvm/win32/System: System.vcproj updated: 1.3 -> 1.4 --- Log message: Remove dupliate buid of Signals.cpp Patch contributed by Jeff Cohen. --- Diffs of the changes: (+4 -2) Index: llvm/win32/System/System.vcproj diff -u llvm/win32/System/System.vcproj:1.3 llvm/win32/System/System.vcproj:1.4 --- llvm/win32/System/System.vcproj:1.3 Mon Nov 15 11:28:08 2004 +++ llvm/win32/System/System.vcproj Tue Nov 16 00:57:30 2004 @@ -230,13 +230,15 @@ + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + Name="Release|Win32" + ExcludedFromBuild="TRUE"> From reid at x10sys.com Tue Nov 16 00:59:06 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:59:06 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/InstVisitor.h Message-ID: <200411160659.AAA15228@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: InstVisitor.h updated: 1.32 -> 1.33 --- Log message: Standardize on 'class' instead of 'struct'. Gets rid of warnings in VC++ Patch contributed by Jeff Cohen. --- Diffs of the changes: (+2 -1) Index: llvm/include/llvm/Support/InstVisitor.h diff -u llvm/include/llvm/Support/InstVisitor.h:1.32 llvm/include/llvm/Support/InstVisitor.h:1.33 --- llvm/include/llvm/Support/InstVisitor.h:1.32 Sat Oct 16 13:06:23 2004 +++ llvm/include/llvm/Support/InstVisitor.h Tue Nov 16 00:58:55 2004 @@ -70,12 +70,13 @@ template -struct InstVisitor { +class InstVisitor { //===--------------------------------------------------------------------===// // Interface code - This is the public interface of the InstVisitor that you // use to visit instructions... // +public: // Generic visit method - Allow visitation to all instructions in a range template void visit(Iterator Start, Iterator End) { From reid at x10sys.com Tue Nov 16 00:59:06 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 00:59:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/InstCount.cpp Message-ID: <200411160659.AAA15231@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: InstCount.cpp updated: 1.9 -> 1.10 --- Log message: Standardize on 'class' instead of 'struct'. Gets rid of warnings in VC++ Patch contributed by Jeff Cohen. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Analysis/InstCount.cpp diff -u llvm/lib/Analysis/InstCount.cpp:1.9 llvm/lib/Analysis/InstCount.cpp:1.10 --- llvm/lib/Analysis/InstCount.cpp:1.9 Wed Oct 27 11:10:15 2004 +++ llvm/lib/Analysis/InstCount.cpp Tue Nov 16 00:58:55 2004 @@ -29,7 +29,7 @@ #include "llvm/Instruction.def" class InstCount : public FunctionPass, public InstVisitor { - friend struct InstVisitor; + friend class InstVisitor; void visitFunction (Function &F) { ++TotalFuncs; } void visitBasicBlock(BasicBlock &BB) { ++TotalBlocks; } From reid at x10sys.com Tue Nov 16 01:00:04 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 01:00:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Signals.cpp Message-ID: <200411160700.BAA15295@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Signals.cpp updated: 1.11 -> 1.12 --- Log message: Simplify code. Patch contributed by Jeff Cohen. --- Diffs of the changes: (+1 -2) Index: llvm/lib/System/Win32/Signals.cpp diff -u llvm/lib/System/Win32/Signals.cpp:1.11 llvm/lib/System/Win32/Signals.cpp:1.12 --- llvm/lib/System/Win32/Signals.cpp:1.11 Mon Nov 15 11:20:28 2004 +++ llvm/lib/System/Win32/Signals.cpp Tue Nov 16 00:59:53 2004 @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include #include #include @@ -81,7 +80,7 @@ if (FilesToRemove == NULL) FilesToRemove = new std::vector; - FilesToRemove->push_back(sys::Path(Filename.get())); + FilesToRemove->push_back(Filename); LeaveCriticalSection(&CriticalSection); } From reid at x10sys.com Tue Nov 16 01:00:33 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 01:00:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/MappedFile.cpp Memory.cpp Path.cpp Process.cpp Program.cpp SysConfig.cpp Message-ID: <200411160700.BAA15325@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: MappedFile.cpp updated: 1.2 -> 1.3 Memory.cpp updated: 1.3 -> 1.4 Path.cpp updated: 1.6 -> 1.7 Process.cpp updated: 1.1 -> 1.2 Program.cpp updated: 1.3 -> 1.4 SysConfig.cpp updated: 1.1 -> 1.2 --- Log message: Remove useless #include. Patch contributed by Jeff Cohen. --- Diffs of the changes: (+0 -7) Index: llvm/lib/System/Win32/MappedFile.cpp diff -u llvm/lib/System/Win32/MappedFile.cpp:1.2 llvm/lib/System/Win32/MappedFile.cpp:1.3 --- llvm/lib/System/Win32/MappedFile.cpp:1.2 Wed Oct 13 22:05:59 2004 +++ llvm/lib/System/Win32/MappedFile.cpp Tue Nov 16 01:00:23 2004 @@ -16,7 +16,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include "llvm/System/MappedFile.h" #include "llvm/System/Process.h" namespace llvm { Index: llvm/lib/System/Win32/Memory.cpp diff -u llvm/lib/System/Win32/Memory.cpp:1.3 llvm/lib/System/Win32/Memory.cpp:1.4 --- llvm/lib/System/Win32/Memory.cpp:1.3 Wed Sep 15 00:49:50 2004 +++ llvm/lib/System/Win32/Memory.cpp Tue Nov 16 01:00:23 2004 @@ -13,7 +13,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include "llvm/System/Memory.h" #include "llvm/System/Process.h" namespace llvm { Index: llvm/lib/System/Win32/Path.cpp diff -u llvm/lib/System/Win32/Path.cpp:1.6 llvm/lib/System/Win32/Path.cpp:1.7 --- llvm/lib/System/Win32/Path.cpp:1.6 Tue Nov 9 14:27:23 2004 +++ llvm/lib/System/Win32/Path.cpp Tue Nov 16 01:00:23 2004 @@ -20,7 +20,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include #include #include Index: llvm/lib/System/Win32/Process.cpp diff -u llvm/lib/System/Win32/Process.cpp:1.1 llvm/lib/System/Win32/Process.cpp:1.2 --- llvm/lib/System/Win32/Process.cpp:1.1 Wed Sep 15 00:47:40 2004 +++ llvm/lib/System/Win32/Process.cpp Tue Nov 16 01:00:23 2004 @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include "llvm/System/Process.h" //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only Win32 specific code Index: llvm/lib/System/Win32/Program.cpp diff -u llvm/lib/System/Win32/Program.cpp:1.3 llvm/lib/System/Win32/Program.cpp:1.4 --- llvm/lib/System/Win32/Program.cpp:1.3 Fri Nov 5 16:15:36 2004 +++ llvm/lib/System/Win32/Program.cpp Tue Nov 16 01:00:23 2004 @@ -13,7 +13,6 @@ // Include the generic Unix implementation #include "Win32.h" -#include "llvm/System/Program.h" #include //===----------------------------------------------------------------------===// Index: llvm/lib/System/Win32/SysConfig.cpp diff -u llvm/lib/System/Win32/SysConfig.cpp:1.1 llvm/lib/System/Win32/SysConfig.cpp:1.2 --- llvm/lib/System/Win32/SysConfig.cpp:1.1 Wed Sep 15 00:48:49 2004 +++ llvm/lib/System/Win32/SysConfig.cpp Tue Nov 16 01:00:23 2004 @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/System/SysConfig.h" - namespace llvm { // Some LLVM programs such as bugpoint produce core files as a normal part of From reid at x10sys.com Tue Nov 16 01:05:27 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 01:05:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Message-ID: <200411160705.BAA15383@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveWriter.cpp updated: 1.4 -> 1.5 --- Log message: Fix typeo in comment. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.4 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.5 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.4 Tue Nov 16 00:47:30 2004 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Tue Nov 16 01:05:16 2004 @@ -46,7 +46,7 @@ // search. We split it in half by comparing against 2^14 first. This allows // most reasonable values to be done in 2 comparisons instead of 1 for // small ones and four for large ones. We expect this to access file offsets - // in the 2^10 to 2^24 range and symbol lengths in the 2^0 to 2^8 rnage, + // in the 2^10 to 2^24 range and symbol lengths in the 2^0 to 2^8 range, // so this approach is reasonable. if (num < 1<<14) if (num < 1<<7) From lattner at cs.uiuc.edu Tue Nov 16 01:32:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 01:32:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp Message-ID: <200411160732.iAG7W4Cs014450@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.91 -> 1.92 --- Log message: Take advantage of the fact that we are allowed to clobber the input module by splicing function bodies from the src module to the destination module. This speeds up linking quite a bit, e.g. gccld time on 176.gcc from 26s -> 20s when forming the .rbc file, with a profile build. One of the really strange but cool effects of this patch is that it speeds up the optimizers as well, from 12s -> 10.7s, presumably because of better locality??? In any case, this is just a first step. We can trivially get rid of the LocalMap now and do other simplifications. --- Diffs of the changes: (+8 -26) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.91 llvm/lib/Linker/LinkModules.cpp:1.92 --- llvm/lib/Linker/LinkModules.cpp:1.91 Tue Nov 16 00:41:36 2004 +++ llvm/lib/Linker/LinkModules.cpp Tue Nov 16 01:31:51 2004 @@ -676,7 +676,7 @@ // fix up references to values. At this point we know that Dest is an external // function, and that Src is not. // -static bool LinkFunctionBody(Function *Dest, const Function *Src, +static bool LinkFunctionBody(Function *Dest, Function *Src, std::map &GlobalMap, std::string *Err) { assert(Src && Dest && Dest->isExternal() && !Src->isExternal()); @@ -684,7 +684,7 @@ // Go through and convert function arguments over... Function::aiterator DI = Dest->abegin(); - for (Function::const_aiterator I = Src->abegin(), E = Src->aend(); + for (Function::aiterator I = Src->abegin(), E = Src->aend(); I != E; ++I, ++DI) { DI->setName(I->getName()); // Copy the name information over... @@ -692,27 +692,8 @@ LocalMap.insert(std::make_pair(I, DI)); } - // Loop over all of the basic blocks, copying the instructions over... - // - for (Function::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) { - // Create new basic block and add to mapping and the Dest function... - BasicBlock *DBB = new BasicBlock(I->getName(), Dest); - LocalMap.insert(std::make_pair(I, DBB)); - - // Loop over all of the instructions in the src basic block, copying them - // over. Note that this is broken in a strict sense because the cloned - // instructions will still be referencing values in the Src module, not - // the remapped values. In our case, however, we will not get caught and - // so we can delay patching the values up until later... - // - for (BasicBlock::const_iterator II = I->begin(), IE = I->end(); - II != IE; ++II) { - Instruction *DI = II->clone(); - DI->setName(II->getName()); - DBB->getInstList().push_back(DI); - LocalMap.insert(std::make_pair(II, DI)); - } - } + // Splice the body of the source function into the dest function. + Dest->getBasicBlockList().splice(Dest->end(), Src->getBasicBlockList()); // At this point, all of the instructions and values of the function are now // copied over. The only problem is that they are still referencing values in @@ -723,7 +704,8 @@ for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) - *OI = RemapOperand(*OI, LocalMap, &GlobalMap); + if (!isa(*OI) && !isa(*OI)) + *OI = RemapOperand(*OI, LocalMap, &GlobalMap); return false; } @@ -733,14 +715,14 @@ // source module into the DestModule. This consists basically of copying the // function over and fixing up references to values. // -static bool LinkFunctionBodies(Module *Dest, const Module *Src, +static bool LinkFunctionBodies(Module *Dest, Module *Src, std::map &ValueMap, std::string *Err) { // Loop over all of the functions in the src module, mapping them over as we // go // - for (Module::const_iterator SF = Src->begin(), E = Src->end(); SF != E; ++SF){ + for (Module::iterator SF = Src->begin(), E = Src->end(); SF != E; ++SF) { if (!SF->isExternal()) { // No body if function is external Function *DF = cast(ValueMap[SF]); // Destination function From brukman at cs.uiuc.edu Tue Nov 16 01:35:43 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 16 Nov 2004 01:35:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Program.cpp Message-ID: <200411160735.BAA15808@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Program.cpp updated: 1.4 -> 1.5 --- Log message: Erase non-applicable Unix comment, this is Win32 --- Diffs of the changes: (+0 -1) Index: llvm/lib/System/Win32/Program.cpp diff -u llvm/lib/System/Win32/Program.cpp:1.4 llvm/lib/System/Win32/Program.cpp:1.5 --- llvm/lib/System/Win32/Program.cpp:1.4 Tue Nov 16 01:00:23 2004 +++ llvm/lib/System/Win32/Program.cpp Tue Nov 16 01:35:32 2004 @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -// Include the generic Unix implementation #include "Win32.h" #include From lattner at cs.uiuc.edu Tue Nov 16 10:32:42 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 10:32:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200411161632.iAGGWg1D016635@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.110 -> 1.111 --- Log message: Do not delete dead invoke instructions! --- Diffs of the changes: (+1 -2) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.110 llvm/lib/Transforms/Scalar/SCCP.cpp:1.111 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.110 Mon Nov 15 01:15:04 2004 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Tue Nov 16 10:32:28 2004 @@ -875,7 +875,7 @@ Instruction *Inst = BI++; if (Inst->getType() != Type::VoidTy) { LatticeVal &IV = Values[Inst]; - if (IV.isConstant() || IV.isUndefined()) { + if (IV.isConstant() || IV.isUndefined() && !isa(Inst)) { Constant *Const; if (IV.isConstant()) { Const = IV.getConstant(); @@ -900,4 +900,3 @@ return MadeChanges; } - From lattner at cs.uiuc.edu Tue Nov 16 10:39:33 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 10:39:33 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SCCP/2004-11-16-DeadInvoke.ll Message-ID: <200411161639.iAGGdX09016989@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SCCP: 2004-11-16-DeadInvoke.ll added (r1.1) --- Log message: New testcase for recent patch to SCCP, thanks to Nate Begeman for pointing out this recent regression --- Diffs of the changes: (+14 -0) Index: llvm/test/Regression/Transforms/SCCP/2004-11-16-DeadInvoke.ll diff -c /dev/null llvm/test/Regression/Transforms/SCCP/2004-11-16-DeadInvoke.ll:1.1 *** /dev/null Tue Nov 16 10:39:30 2004 --- llvm/test/Regression/Transforms/SCCP/2004-11-16-DeadInvoke.ll Tue Nov 16 10:39:20 2004 *************** *** 0 **** --- 1,14 ---- + ; RUN: llvm-as < %s | opt -sccp -disable-output + + implementation + + declare int %foo() + + void %caller() { + br bool true, label %T, label %F + F: + %X = invoke int %foo() to label %T unwind label %T + + T: + ret void + } From reid at x10sys.com Tue Nov 16 10:46:35 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 10:46:35 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Linker.h Message-ID: <200411161646.KAA11306@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Linker.h updated: 1.11 -> 1.12 --- Log message: Make the comment for LinkFiles a bit more precise and easily understood. --- Diffs of the changes: (+4 -3) Index: llvm/include/llvm/Linker.h diff -u llvm/include/llvm/Linker.h:1.11 llvm/include/llvm/Linker.h:1.12 --- llvm/include/llvm/Linker.h:1.11 Tue Nov 16 00:41:21 2004 +++ llvm/include/llvm/Linker.h Tue Nov 16 10:46:22 2004 @@ -36,9 +36,10 @@ std::string* ErrorMsg ///< Optional error message string ); -/// This function links the bytecode \p Files into the \p HeadModule. No -/// matching of symbols is done. It simply calls loads each module and calls -/// LinkModules for each one. +/// This function links the bytecode \p Files into the \p HeadModule. Note that +/// this does not do any linking of unresolved symbols. The \p Files are all +/// completely linked into \p HeadModule regardless of unresolved symbols. This +/// function just loads each bytecode file and calls LinkModules on them. /// @returns true if an error occurs, false otherwise bool LinkFiles ( const char * progname, ///< Name of the program being linked (for output) From lattner at cs.uiuc.edu Tue Nov 16 11:12:52 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 11:12:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp Message-ID: <200411161712.iAGHCqX1020840@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.92 -> 1.93 --- Log message: Simplify the remapper by only needing one map, since the body of the functions being linked do not need to be remapped any longer. --- Diffs of the changes: (+31 -43) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.92 llvm/lib/Linker/LinkModules.cpp:1.93 --- llvm/lib/Linker/LinkModules.cpp:1.92 Tue Nov 16 01:31:51 2004 +++ llvm/lib/Linker/LinkModules.cpp Tue Nov 16 11:12:38 2004 @@ -275,72 +275,64 @@ } -// RemapOperand - Use LocalMap and GlobalMap to convert references from one -// module to another. This is somewhat sophisticated in that it can -// automatically handle constant references correctly as well... +// RemapOperand - Use ValueMap to convert references from one module to another. +// This is somewhat sophisticated in that it can automatically handle constant +// references correctly as well... // static Value *RemapOperand(const Value *In, - std::map &LocalMap, - std::map *GlobalMap) { - std::map::const_iterator I = LocalMap.find(In); - if (I != LocalMap.end()) return I->second; - - if (GlobalMap) { - I = GlobalMap->find(In); - if (I != GlobalMap->end()) return I->second; - } + std::map &ValueMap) { + std::map::const_iterator I = ValueMap.find(In); + if (I != ValueMap.end()) return I->second; - // Check to see if it's a constant that we are interesting in transforming... + // Check to see if it's a constant that we are interesting in transforming. if (const Constant *CPV = dyn_cast(In)) { if ((!isa(CPV->getType()) && !isa(CPV)) || isa(CPV)) - return const_cast(CPV); // Simple constants stay identical... + return const_cast(CPV); // Simple constants stay identical. Constant *Result = 0; if (const ConstantArray *CPA = dyn_cast(CPV)) { std::vector Operands(CPA->getNumOperands()); for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i) - Operands[i] = - cast(RemapOperand(CPA->getOperand(i), LocalMap, GlobalMap)); + Operands[i] =cast(RemapOperand(CPA->getOperand(i), ValueMap)); Result = ConstantArray::get(cast(CPA->getType()), Operands); } else if (const ConstantStruct *CPS = dyn_cast(CPV)) { std::vector Operands(CPS->getNumOperands()); for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i) - Operands[i] = - cast(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap)); + Operands[i] =cast(RemapOperand(CPS->getOperand(i), ValueMap)); Result = ConstantStruct::get(cast(CPS->getType()), Operands); } else if (isa(CPV) || isa(CPV)) { Result = const_cast(CPV); } else if (isa(CPV)) { - Result = cast(RemapOperand(CPV, LocalMap, GlobalMap)); + Result = cast(RemapOperand(CPV, ValueMap)); } else if (const ConstantExpr *CE = dyn_cast(CPV)) { if (CE->getOpcode() == Instruction::GetElementPtr) { - Value *Ptr = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); + Value *Ptr = RemapOperand(CE->getOperand(0), ValueMap); std::vector Indices; Indices.reserve(CE->getNumOperands()-1); for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i) Indices.push_back(cast(RemapOperand(CE->getOperand(i), - LocalMap, GlobalMap))); + ValueMap))); Result = ConstantExpr::getGetElementPtr(cast(Ptr), Indices); } else if (CE->getNumOperands() == 1) { // Cast instruction assert(CE->getOpcode() == Instruction::Cast); - Value *V = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); + Value *V = RemapOperand(CE->getOperand(0), ValueMap); Result = ConstantExpr::getCast(cast(V), CE->getType()); } else if (CE->getNumOperands() == 3) { // Select instruction assert(CE->getOpcode() == Instruction::Select); - Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); - Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); - Value *V3 = RemapOperand(CE->getOperand(2), LocalMap, GlobalMap); + Value *V1 = RemapOperand(CE->getOperand(0), ValueMap); + Value *V2 = RemapOperand(CE->getOperand(1), ValueMap); + Value *V3 = RemapOperand(CE->getOperand(2), ValueMap); Result = ConstantExpr::getSelect(cast(V1), cast(V2), cast(V3)); } else if (CE->getNumOperands() == 2) { // Binary operator... - Value *V1 = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap); - Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap); + Value *V1 = RemapOperand(CE->getOperand(0), ValueMap); + Value *V2 = RemapOperand(CE->getOperand(1), ValueMap); Result = ConstantExpr::get(CE->getOpcode(), cast(V1), cast(V2)); @@ -353,20 +345,12 @@ } // Cache the mapping in our local map structure... - if (GlobalMap) - GlobalMap->insert(std::make_pair(In, Result)); - else - LocalMap.insert(std::make_pair(In, Result)); + ValueMap.insert(std::make_pair(In, Result)); return Result; } - std::cerr << "XXX LocalMap: \n"; - PrintMap(LocalMap); - - if (GlobalMap) { - std::cerr << "XXX GlobalMap: \n"; - PrintMap(*GlobalMap); - } + std::cerr << "LinkModules ValueMap: \n"; + PrintMap(ValueMap); std::cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n"; assert(0 && "Couldn't remap value!"); @@ -563,7 +547,7 @@ if (SGV->hasInitializer()) { // Only process initialized GV's // Figure out what the initializer looks like in the dest module... Constant *SInit = - cast(RemapOperand(SGV->getInitializer(), ValueMap, 0)); + cast(RemapOperand(SGV->getInitializer(), ValueMap)); GlobalVariable *DGV = cast(ValueMap[SGV]); if (DGV->hasInitializer()) { @@ -680,16 +664,15 @@ std::map &GlobalMap, std::string *Err) { assert(Src && Dest && Dest->isExternal() && !Src->isExternal()); - std::map LocalMap; // Map for function local values - // Go through and convert function arguments over... + // Go through and convert function arguments over, remembering the mapping. Function::aiterator DI = Dest->abegin(); for (Function::aiterator I = Src->abegin(), E = Src->aend(); I != E; ++I, ++DI) { DI->setName(I->getName()); // Copy the name information over... // Add a mapping to our local map - LocalMap.insert(std::make_pair(I, DI)); + GlobalMap.insert(std::make_pair(I, DI)); } // Splice the body of the source function into the dest function. @@ -705,7 +688,12 @@ for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) if (!isa(*OI) && !isa(*OI)) - *OI = RemapOperand(*OI, LocalMap, &GlobalMap); + *OI = RemapOperand(*OI, GlobalMap); + + // There is no need to map the arguments anymore. + for (Function::aiterator I = Src->abegin(), E = Src->aend(); + I != E; ++I, ++DI) + GlobalMap.erase(I); return false; } From reid at x10sys.com Tue Nov 16 11:14:19 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 16 Nov 2004 11:14:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Path.cpp Message-ID: <200411161714.LAA11691@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Path.cpp updated: 1.13 -> 1.14 --- Log message: * Use low-level unix I/O interface since we're on Unix. * Don't use variable length arrays (replaced with alloca) --- Diffs of the changes: (+17 -7) Index: llvm/lib/System/Unix/Path.cpp diff -u llvm/lib/System/Unix/Path.cpp:1.13 llvm/lib/System/Unix/Path.cpp:1.14 --- llvm/lib/System/Unix/Path.cpp:1.13 Tue Nov 16 00:15:19 2004 +++ llvm/lib/System/Unix/Path.cpp Tue Nov 16 11:14:08 2004 @@ -17,6 +17,7 @@ //===----------------------------------------------------------------------===// #include +#include #include "Unix.h" #include #include @@ -157,20 +158,29 @@ bool Path::hasMagicNumber(const std::string &Magic) const { size_t len = Magic.size(); - char buf[ 1 + len]; - std::ifstream f(path.c_str()); - f.read(buf, len); + assert(len < 1024 && "Request for magic string too long"); + char* buf = (char*) alloca(1 + len); + int fd = ::open(path.c_str(),O_RDONLY); + if (fd < 0) + return false; + if (0 != ::read(fd, buf, len)) + return false; + close(fd); buf[len] = '\0'; - f.close(); return Magic == buf; } bool Path::getMagicNumber(std::string& Magic, unsigned len) const { if (!isFile()) return false; - char buf[1 + len]; - std::ifstream f(path.c_str()); - f.read(buf,len); + assert(len < 1024 && "Request for magic string too long"); + char* buf = (char*) alloca(1 + len); + int fd = ::open(path.c_str(),O_RDONLY); + if (fd < 0) + return false; + if (0 != ::read(fd, buf, len)) + return false; + close(fd); buf[len] = '\0'; Magic = buf; return true; From lattner at cs.uiuc.edu Tue Nov 16 12:41:07 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 12:41:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86ISelSimple.cpp Message-ID: <200411161841.iAGIf7HV025737@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.74 -> 1.75 X86ISelSimple.cpp updated: 1.295 -> 1.296 --- Log message: Fix a major bug in the signed shr code, which apparently only breaks 134.perl! --- Diffs of the changes: (+3 -2) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.74 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.75 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.74 Mon Nov 15 22:34:29 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Tue Nov 16 12:40:52 2004 @@ -635,7 +635,8 @@ (Desc.TSFlags & X86II::FormMask)-X86II::MRM0r); if (MI.getOperand(MI.getNumOperands()-1).isImmediate()) { - emitConstant(MI.getOperand(MI.getNumOperands()-1).getImmedValue(), sizeOfImm(Desc)); + emitConstant(MI.getOperand(MI.getNumOperands()-1).getImmedValue(), + sizeOfImm(Desc)); } break; Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.295 llvm/lib/Target/X86/X86ISelSimple.cpp:1.296 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.295 Mon Nov 15 17:16:34 2004 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Tue Nov 16 12:40:52 2004 @@ -2984,7 +2984,7 @@ BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg+1).addReg(SrcReg); BuildMI(*MBB, IP, X86::MOV32ri, 1, DestReg).addImm(0); } else { - BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg).addReg(SrcReg); + BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg).addReg(SrcReg+1); if (!isSigned) { BuildMI(*MBB, IP, X86::MOV32ri, 1, DestReg+1).addImm(0); } else { From lattner at cs.uiuc.edu Tue Nov 16 12:59:34 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 12:59:34 -0600 Subject: [llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp Message-ID: <200411161859.iAGIxY1f029835@apoc.cs.uiuc.edu> Changes in directory llvm/tools/gccld: GenerateCode.cpp updated: 1.35 -> 1.36 --- Log message: Even with -disable-opt we should still internalize and strip if requested. --- Diffs of the changes: (+13 -13) Index: llvm/tools/gccld/GenerateCode.cpp diff -u llvm/tools/gccld/GenerateCode.cpp:1.35 llvm/tools/gccld/GenerateCode.cpp:1.36 --- llvm/tools/gccld/GenerateCode.cpp:1.35 Sun Nov 14 17:00:08 2004 +++ llvm/tools/gccld/GenerateCode.cpp Tue Nov 16 12:59:20 2004 @@ -153,14 +153,14 @@ // arguments). This pass merges the two functions. addPass(Passes, createFunctionResolvingPass()); - if (!DisableOptimizations) { - if (Internalize) { - // Now that composite has been compiled, scan through the module, looking - // for a main function. If main is defined, mark all other functions - // internal. - addPass(Passes, createInternalizePass()); - } + if (Internalize) { + // Now that composite has been compiled, scan through the module, looking + // for a main function. If main is defined, mark all other functions + // internal. + addPass(Passes, createInternalizePass()); + } + if (!DisableOptimizations) { // Now that we internalized some globals, see if we can hack on them! addPass(Passes, createGlobalOptimizerPass()); @@ -168,12 +168,6 @@ // keep one copy of each constant... addPass(Passes, createConstantMergePass()); - // If the -s command line option was specified, strip the symbols out of the - // resulting program to make it smaller. -s is a GCC option that we are - // supporting. - if (Strip) - addPass(Passes, createSymbolStrippingPass()); - // Propagate constants at call sites into the functions they call. addPass(Passes, createIPConstantPropagationPass()); @@ -214,6 +208,12 @@ addPass(Passes, createGlobalDCEPass()); } + // If the -s command line option was specified, strip the symbols out of the + // resulting program to make it smaller. -s is a GCC option that we are + // supporting. + if (Strip) + addPass(Passes, createSymbolStrippingPass()); + // Make sure everything is still good. Passes.add(createVerifierPass()); From lattner at cs.uiuc.edu Tue Nov 16 13:04:54 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 13:04:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp Message-ID: <200411161904.iAGJ4sBq032002@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.93 -> 1.94 --- Log message: Don't increment a dead iterator --- Diffs of the changes: (+2 -3) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.93 llvm/lib/Linker/LinkModules.cpp:1.94 --- llvm/lib/Linker/LinkModules.cpp:1.93 Tue Nov 16 11:12:38 2004 +++ llvm/lib/Linker/LinkModules.cpp Tue Nov 16 13:04:40 2004 @@ -404,7 +404,7 @@ GlobalsByName.find(SGV->getName()); if (EGV != GlobalsByName.end()) DGV = dyn_cast(EGV->second); - if (DGV && RecursiveResolveTypes(SGV->getType(), DGV->getType(), ST, "")) + if (DGV && RecursiveResolveTypes(SGV->getType(), DGV->getType(),ST, "")) DGV = 0; // FIXME: gross. } @@ -691,8 +691,7 @@ *OI = RemapOperand(*OI, GlobalMap); // There is no need to map the arguments anymore. - for (Function::aiterator I = Src->abegin(), E = Src->aend(); - I != E; ++I, ++DI) + for (Function::aiterator I = Src->abegin(), E = Src->aend(); I != E; ++I) GlobalMap.erase(I); return false; From lattner at cs.uiuc.edu Tue Nov 16 14:31:06 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 14:31:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200411162031.iAGKV6fO007775@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.116 -> 1.117 --- Log message: Make this function work with non-abstract types. --- Diffs of the changes: (+35 -14) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.116 llvm/lib/VMCore/Type.cpp:1.117 --- llvm/lib/VMCore/Type.cpp:1.116 Thu Oct 7 14:20:48 2004 +++ llvm/lib/VMCore/Type.cpp Tue Nov 16 14:30:53 2004 @@ -585,40 +585,61 @@ return TypesEqual(Ty, Ty2, EqTypes); } -// TypeHasCycleThrough - Return true there is a path from CurTy to TargetTy in -// the type graph. We know that Ty is an abstract type, so if we ever reach a -// non-abstract type, we know that we don't need to search the subgraph. -static bool TypeHasCycleThrough(const Type *TargetTy, const Type *CurTy, +// AbstractTypeHasCycleThrough - Return true there is a path from CurTy to +// TargetTy in the type graph. We know that Ty is an abstract type, so if we +// ever reach a non-abstract type, we know that we don't need to search the +// subgraph. +static bool AbstractTypeHasCycleThrough(const Type *TargetTy, const Type *CurTy, std::set &VisitedTypes) { if (TargetTy == CurTy) return true; if (!CurTy->isAbstract()) return false; - std::set::iterator VTI = VisitedTypes.lower_bound(CurTy); - if (VTI != VisitedTypes.end() && *VTI == CurTy) - return false; - VisitedTypes.insert(VTI, CurTy); + if (!VisitedTypes.insert(CurTy).second) + return false; // Already been here. for (Type::subtype_iterator I = CurTy->subtype_begin(), E = CurTy->subtype_end(); I != E; ++I) - if (TypeHasCycleThrough(TargetTy, *I, VisitedTypes)) + if (AbstractTypeHasCycleThrough(TargetTy, *I, VisitedTypes)) return true; return false; } +static bool ConcreteTypeHasCycleThrough(const Type *TargetTy, const Type *CurTy, + std::set &VisitedTypes) { + if (TargetTy == CurTy) return true; + + if (!VisitedTypes.insert(CurTy).second) + return false; // Already been here. + + for (Type::subtype_iterator I = CurTy->subtype_begin(), + E = CurTy->subtype_end(); I != E; ++I) + if (ConcreteTypeHasCycleThrough(TargetTy, *I, VisitedTypes)) + return true; + return false; +} /// TypeHasCycleThroughItself - Return true if the specified type has a cycle /// back to itself. static bool TypeHasCycleThroughItself(const Type *Ty) { - assert(Ty->isAbstract() && "This code assumes that Ty was abstract!"); std::set VisitedTypes; - for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); - I != E; ++I) - if (TypeHasCycleThrough(Ty, *I, VisitedTypes)) - return true; + + if (Ty->isAbstract()) { // Optimized case for abstract types. + for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); + I != E; ++I) + if (AbstractTypeHasCycleThrough(Ty, *I, VisitedTypes)) + return true; + } else { + for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); + I != E; ++I) + if (ConcreteTypeHasCycleThrough(Ty, *I, VisitedTypes)) + return true; + } return false; } + + //===----------------------------------------------------------------------===// // Derived Type Factory Functions //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Tue Nov 16 14:39:16 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 16 Nov 2004 14:39:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200411162039.iAGKdGJf008668@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.117 -> 1.118 --- Log message: Minor cleanup and speedup. This reduces link-time for 252.eon from 35.5s to 34.7s with a profile build. --- Diffs of the changes: (+22 -22) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.117 llvm/lib/VMCore/Type.cpp:1.118 --- llvm/lib/VMCore/Type.cpp:1.117 Tue Nov 16 14:30:53 2004 +++ llvm/lib/VMCore/Type.cpp Tue Nov 16 14:39:04 2004 @@ -638,8 +638,6 @@ } - - //===----------------------------------------------------------------------===// // Derived Type Factory Functions //===----------------------------------------------------------------------===// @@ -653,7 +651,9 @@ class TypeMap { std::map Map; - /// TypesByHash - Keep track of each type by its structure hash value. + /// TypesByHash - Keep track of types by their structure hash value. Note + /// that we only keep track of types that have cycles through themselves in + /// this map. /// std::multimap TypesByHash; public: @@ -705,8 +705,7 @@ Map.erase(ValType::get(Ty)); // Remember the structural hash for the type before we start hacking on it, - // in case we need it later. Also, check to see if the type HAD a cycle - // through it, if so, we know it will when we hack on it. + // in case we need it later. unsigned OldTypeHash = ValType::hashTypeStructure(Ty); // Find the type element we are refining... and change it now! @@ -721,17 +720,19 @@ // If there are no cycles going through this node, we can do a simple, // efficient lookup in the map, instead of an inefficient nasty linear // lookup. - bool TypeHasCycle = Ty->isAbstract() && TypeHasCycleThroughItself(Ty); - if (!TypeHasCycle) { - iterator I = Map.find(ValType::get(Ty)); - if (I != Map.end()) { + if (!Ty->isAbstract() || !TypeHasCycleThroughItself(Ty)) { + typename std::map::iterator I; + bool Inserted; + + ValType V = ValType::get(Ty); + tie(I, Inserted) = Map.insert(std::make_pair(V, Ty)); + if (!Inserted) { + // Refined to a different type altogether? + RemoveFromTypesByHash(TypeHash, Ty); + // We already have this type in the table. Get rid of the newly refined // type. - assert(Ty->isAbstract() && "Replacing a non-abstract type?"); TypeClass *NewTy = cast((Type*)I->second.get()); - - // Refined to a different type altogether? - RemoveFromTypesByHash(TypeHash, Ty); Ty->refineAbstractTypeTo(NewTy); return; } @@ -741,8 +742,8 @@ // structurally identical to the newly refined type. If so, this type // gets refined to the pre-existing type. // - std::multimap::iterator I,E, Entry; - tie(I, E) = TypesByHash.equal_range(TypeHash); + std::multimap::iterator I, E, Entry; + tie(I, E) = TypesByHash.equal_range(OldTypeHash); Entry = E; for (; I != E; ++I) { if (I->second != Ty) { @@ -768,20 +769,19 @@ Entry = I; } } + + + // If there is no existing type of the same structure, we reinsert an + // updated record into the map. + Map.insert(std::make_pair(ValType::get(Ty), Ty)); } - // If we succeeded, we need to insert the type into the cycletypes table. - // There are several cases here, depending on whether the original type - // had the same hash code and was itself cyclic. + // If the hash codes differ, update TypesByHash if (TypeHash != OldTypeHash) { RemoveFromTypesByHash(OldTypeHash, Ty); TypesByHash.insert(std::make_pair(TypeHash, Ty)); } - // If there is no existing type of the same structure, we reinsert an - // updated record into the map. - Map.insert(std::make_pair(ValType::get(Ty), Ty)); - // If the type is currently thought to be abstract, rescan all of our // subtypes to see if the type has just become concrete! if (Ty->isAbstract()) From tbrethou at cs.uiuc.edu Tue Nov 16 15:31:53 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Tue, 16 Nov 2004 15:31:53 -0600 (CST) Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp ModuloScheduling.h Message-ID: <200411162131.PAA17190@kain.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9/ModuloScheduling: ModuloScheduling.cpp updated: 1.33 -> 1.34 ModuloScheduling.h updated: 1.18 -> 1.19 --- Log message: Added my own defMap. Only saving values that are not loop invariant. Fixed a couple of assertions that were triggered due to registers not being allocated. These both had to do with PHINodes. --- Diffs of the changes: (+63 -44) Index: llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp diff -u llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp:1.33 llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp:1.34 --- llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp:1.33 Tue Nov 2 15:04:55 2004 +++ llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp Tue Nov 16 15:31:37 2004 @@ -1,3 +1,4 @@ + //===-- ModuloScheduling.cpp - ModuloScheduling ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure @@ -122,6 +123,7 @@ bool ModuloSchedulingPass::runOnFunction(Function &F) { bool Changed = false; + int numMS = 0; DEBUG(std::cerr << "Creating ModuloSchedGraph for each valid BasicBlock in " + F.getName() + "\n"); @@ -139,37 +141,14 @@ defaultInst = 0; - //If we have a basic block to schedule, create our def map - if(Worklist.size() > 0) { - for(MachineFunction::iterator BI = MF.begin(); BI != MF.end(); ++BI) { - for(MachineBasicBlock::iterator I = BI->begin(), E = BI->end(); I != E; ++I) { - for(unsigned opNum = 0; opNum < I->getNumOperands(); ++opNum) { - const MachineOperand &mOp = I->getOperand(opNum); - if(mOp.getType() == MachineOperand::MO_VirtualRegister && mOp.isDef()) { - defMap[mOp.getVRegValue()] = &*I; - } - - //See if we can use this Value* as our defaultInst - if(!defaultInst && mOp.getType() == MachineOperand::MO_VirtualRegister) { - Value *V = mOp.getVRegValue(); - if(!isa(V) && !isa(V) && !isa(V)) - defaultInst = (Instruction*) V; - } - } - } - } - } - - assert(defaultInst && "We must have a default instruction to use as our main point to add to machine code for instruction\n"); - - DEBUG(std::cerr << "Default Instruction: " << *defaultInst << "\n"); - DEBUG(if(Worklist.size() == 0) std::cerr << "No single basic block loops in function to ModuloSchedule\n"); //Iterate over the worklist and perform scheduling for(std::vector::iterator BI = Worklist.begin(), BE = Worklist.end(); BI != BE; ++BI) { + CreateDefMap(*BI); + MSchedGraph *MSG = new MSchedGraph(*BI, target); //Write Graph out to file @@ -234,11 +213,13 @@ //Print out final schedule DEBUG(schedule.print(std::cerr)); - //Final scheduling step is to reconstruct the loop only if we actual have //stage > 0 - if(schedule.getMaxStage() != 0) + if(schedule.getMaxStage() != 0) { reconstructLoop(*BI); + numMS++; + Changed = true; + } else DEBUG(std::cerr << "Max stage is 0, so no change in loop\n"); @@ -248,7 +229,7 @@ recurrenceList.clear(); FinalNodeOrder.clear(); schedule.clear(); - + defMap.clear(); //Clean up. Nuke old MachineBB and llvmBB //BasicBlock *llvmBB = (BasicBlock*) (*BI)->getBasicBlock(); //Function *parent = (Function*) llvmBB->getParent(); @@ -261,10 +242,32 @@ } + DEBUG(std::cerr << "Number of Loop Candidates: " << Worklist.size() << "\n Number ModuloScheduled: " << numMS << "\n"); + return Changed; } +void ModuloSchedulingPass::CreateDefMap(MachineBasicBlock *BI) { + defaultInst = 0; + for(MachineBasicBlock::iterator I = BI->begin(), E = BI->end(); I != E; ++I) { + for(unsigned opNum = 0; opNum < I->getNumOperands(); ++opNum) { + const MachineOperand &mOp = I->getOperand(opNum); + if(mOp.getType() == MachineOperand::MO_VirtualRegister && mOp.isDef()) { + defMap[mOp.getVRegValue()] = &*I; + } + + //See if we can use this Value* as our defaultInst + if(!defaultInst && mOp.getType() == MachineOperand::MO_VirtualRegister) { + Value *V = mOp.getVRegValue(); + if(!isa(V) && !isa(V) && !isa(V) && !isa(V)) + defaultInst = (Instruction*) V; + } + } + } + assert(defaultInst && "We must have a default instruction to use as our main point to add to machine code for instruction\n"); + +} /// This function checks if a Machine Basic Block is valid for modulo /// scheduling. This means that it has no control flow (if/else or /// calls) in the block. Currently ModuloScheduling only works on @@ -1482,6 +1485,8 @@ //Insert into machine basic block machineBB->push_back(instClone); + DEBUG(std::cerr << "Cloned Inst: " << *instClone << "\n"); + if(I->first->isBranch()) { //Add kernel noop BuildMI(machineBB, V9::NOP, 0); @@ -1502,18 +1507,26 @@ //If its in the value saved, we need to create a temp instruction and use that instead if(valuesToSave.count(mOp.getVRegValue())) { - TmpInstruction *tmp = new TmpInstruction(mOp.getVRegValue()); - - //Get machine code for this instruction - MachineCodeForInstruction & tempMvec = MachineCodeForInstruction::get(defaultInst); - tempMvec.addTemp((Value*) tmp); - - //Update the operand in the cloned instruction - instClone->getOperand(i).setValueReg(tmp); - - //save this as our final phi - finalPHIValue[mOp.getVRegValue()] = tmp; - newValLocation[tmp] = machineBB; + + //Check if we already have a final PHI value for this + if(!finalPHIValue.count(mOp.getVRegValue())) { + TmpInstruction *tmp = new TmpInstruction(mOp.getVRegValue()); + + //Get machine code for this instruction + MachineCodeForInstruction & tempMvec = MachineCodeForInstruction::get(defaultInst); + tempMvec.addTemp((Value*) tmp); + + //Update the operand in the cloned instruction + instClone->getOperand(i).setValueReg(tmp); + + //save this as our final phi + finalPHIValue[mOp.getVRegValue()] = tmp; + newValLocation[tmp] = machineBB; + } + else { + //Use the previous final phi value + instClone->getOperand(i).setValueReg(finalPHIValue[mOp.getVRegValue()]); + } } } } @@ -1802,7 +1815,7 @@ //find the value in the map if (const Value* srcI = mOp.getVRegValue()) { - if(isa(srcI) || isa(srcI)) + if(isa(srcI) || isa(srcI) || isa(srcI)) continue; //Before we declare this Value* one that we should save @@ -1813,13 +1826,18 @@ //Should we save this value? bool save = true; - //Assert if not in the def map - assert(defMap.count(srcI) && "No entry for this Value* definition in our map"); + //Continue if not in the def map, loop invariant code does not need to be saved + if(!defMap.count(srcI)) + continue; + MachineInstr *defInstr = defMap[srcI]; + if(lastInstrs.count(defInstr)) { - if(lastInstrs[defInstr] == I->second) + if(lastInstrs[defInstr] == I->second) { save = false; + + } } if(save) Index: llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h diff -u llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h:1.18 llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h:1.19 --- llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h:1.18 Tue Nov 2 15:04:56 2004 +++ llvm/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.h Tue Nov 16 15:31:37 2004 @@ -67,6 +67,7 @@ int II; //Internal functions + void CreateDefMap(MachineBasicBlock *BI); bool MachineBBisValid(const MachineBasicBlock *BI); int calculateResMII(const MachineBasicBlock *BI); int calculateRecMII(MSchedGraph *graph, int MII); From alkis at cs.uiuc.edu Wed Nov 17 04:32:51 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 04:32:51 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200411171032.EAA13509@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.144 -> 1.145 --- Log message: Add stubs to JNI calls when codegening a natively implemented java method. --- Diffs of the changes: (+106 -2) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.144 llvm-java/lib/Compiler/Compiler.cpp:1.145 --- llvm-java/lib/Compiler/Compiler.cpp:1.144 Mon Nov 15 14:24:03 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Nov 17 04:32:39 2004 @@ -70,6 +70,7 @@ class Compiler : public BytecodeParser { Module& module_; + GlobalVariable* JNIEnvPtr_; ClassFile* cf_; std::auto_ptr bbBuilder_; std::list bbWorkList_; @@ -123,6 +124,14 @@ public: Compiler(Module& m) : module_(m) { + Type* JNIEnvTy = OpaqueType::get(); + module_.addTypeName("JNIEnv", JNIEnvTy); + JNIEnvPtr_ = new GlobalVariable(JNIEnvTy, + true, + GlobalVariable::ExternalLinkage, + NULL, + "llvm_java_JNIEnv", + &module_); } private: @@ -216,6 +225,64 @@ } } + /// Returns the type of the Java string descriptor for JNI. If the + /// Type* self is not NULL then that type is used as the first + /// type in function types + Type* getJNIType(ConstantUtf8* descr, Type* self = NULL) { + unsigned i = 0; + return getJNITypeHelper(descr->str(), i, self); + } + + Type* getJNITypeHelper(const std::string& descr, unsigned& i, Type* self) { + assert(i < descr.size()); + switch (descr[i++]) { + case 'B': return Type::SByteTy; + case 'C': return Type::UShortTy; + case 'D': return Type::DoubleTy; + case 'F': return Type::FloatTy; + case 'I': return Type::IntTy; + case 'J': return Type::LongTy; + case 'S': return Type::ShortTy; + case 'Z': return Type::BoolTy; + case 'V': return Type::VoidTy; + case 'L': { + unsigned e = descr.find(';', i); + std::string className = descr.substr(i, e - i); + i = e + 1; + return PointerType::get(Type::VoidTy); + } + case '[': + if (descr[i] == '[') { + do { ++i; } while (descr[i] == '['); + getTypeHelper(descr, i, NULL); + return PointerType::get(Type::VoidTy); + } + else if (descr[i] == 'L') { + getTypeHelper(descr, i, NULL); + return PointerType::get(Type::VoidTy); + } + else { + return PointerType::get( + getPrimitiveArrayInfo(getTypeHelper(descr, i, NULL)).type); + } + break; + case '(': { + std::vector params; + // JNIEnv* + params.push_back(JNIEnvPtr_->getType()); + + assert(self && "first argument after JNIEnv* must be that of a " + "class or an object pointer"); + params.push_back(PointerType::get(self)); + while (descr[i] != ')') + params.push_back(getTypeHelper(descr, i, NULL)); + return FunctionType::get(getTypeHelper(descr, ++i, NULL),params, false); + } + // FIXME: Throw something + default: return NULL; + } + } + /// Initializes the class info map; in other words it adds the /// class info of java.lang.Object. bool initializeClassInfoMap() { @@ -1100,8 +1167,45 @@ assert(function->empty() && "Compiling an already compiled method!"); if (method->isNative()) { - DEBUG(std::cerr << "Ignoring native method: "; - std::cerr << classMethodDesc << '\n'); + DEBUG(std::cerr << "Adding stub for natively implemented method: " + << classMethodDesc << '\n'); + FunctionType* funcTy = cast( + getJNIType(method->getDescriptor(), Type::VoidTy)); + + std::string funcName = "Java_"; + const std::string& className = cf_->getThisClass()->getName()->str(); + for (unsigned i = 0, e = className.size(); i != e; ++i) { + if (className[i] == '/') + funcName += '_'; + else + funcName += className[i]; + } + funcName += '_'; + + const std::string& methodName = method->getName()->str(); + funcName += methodName; + + Function* jniFunction = module_.getOrInsertFunction(funcName, funcTy); + jniFunction->setLinkage(method->isPrivate() ? + Function::InternalLinkage : + Function::ExternalLinkage); + + BasicBlock* bb = new BasicBlock("entry", function); + std::vector params; + params.push_back(JNIEnvPtr_); + if (method->isStatic()) + params.push_back(llvm::Constant::getNullValue( + PointerType::get(Type::VoidTy))); + for (Function::aiterator A = function->abegin(), E = function->aend(); + A != E; ++A) { + params.push_back(&*A); + } + Value* r = new CallInst(jniFunction, params, "", bb); + if (r->getType() == Type::VoidTy) + new ReturnInst(NULL, bb); + else + new ReturnInst(r, bb); + return function; } else if (method->isAbstract()) { From reid at x10sys.com Wed Nov 17 10:13:22 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 10:13:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp Message-ID: <200411171613.KAA17462@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.25 -> 1.26 --- Log message: Despite documentation to the contrary, Mac OSX and BSD 4.4 archive formats *do* include the length of the long file in the length of the member and they are *not* null terminated. --- Diffs of the changes: (+3 -2) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.25 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.26 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.25 Tue Nov 16 00:47:19 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Wed Nov 17 10:13:11 2004 @@ -97,7 +97,8 @@ if (isdigit(Hdr->name[3])) { unsigned len = atoi(&Hdr->name[3]); pathname.assign(At,len); - At += len + 1; // terminated by \n + At += len; + MemberSize -= len; flags |= ArchiveMember::HasLongFilenameFlag; } else throw std::string("invalid long filename"); @@ -155,7 +156,7 @@ default: char* slash = (char*) memchr(Hdr->name,'/',16); if (slash == 0) - throw std::string("missing name terminator"); + slash = Hdr->name + 16; pathname.assign(Hdr->name,slash-Hdr->name); break; } From reid at x10sys.com Wed Nov 17 10:14:31 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 10:14:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Message-ID: <200411171614.KAA17515@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveWriter.cpp updated: 1.5 -> 1.6 --- Log message: Adjust long file name writing to match BSD 4.4 and Mac OSX style archives. --- Diffs of the changes: (+14 -10) Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.5 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.6 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.5 Tue Nov 16 01:05:16 2004 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Wed Nov 17 10:14:21 2004 @@ -88,15 +88,6 @@ sprintf(buffer, "%-6u", mbr.getGroup()); memcpy(hdr.gid,buffer,6); - // Set the size field - if (sz < 0) { - buffer[0] = '-'; - sprintf(&buffer[1],"%-9u",(unsigned)-sz); - } else { - sprintf(buffer, "%-10u", (unsigned)sz); - } - memcpy(hdr.size,buffer,10); - // Set the last modification date uint64_t secondsSinceEpoch = mbr.getModTime().toEpochTime(); sprintf(buffer,"%-12u", unsigned(secondsSinceEpoch)); @@ -130,8 +121,22 @@ std::string nm = "#1/"; nm += utostr(mbrPath.length()); nm.copy(hdr.name,nm.length()); + if (sz < 0) + sz -= mbrPath.length(); + else + sz += mbrPath.length(); writeLongName = true; } + + // Set the size field + if (sz < 0) { + buffer[0] = '-'; + sprintf(&buffer[1],"%-9u",(unsigned)-sz); + } else { + sprintf(buffer, "%-10u", (unsigned)sz); + } + memcpy(hdr.size,buffer,10); + return writeLongName; } @@ -266,7 +271,6 @@ // Write the long filename if its long if (writeLongName) { ARFile << member.getPath().c_str(); - ARFile << '\n'; } // Make sure we write the compressed bytecode magic number if we should. From lattner at cs.uiuc.edu Wed Nov 17 10:41:34 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 10:41:34 -0600 Subject: [llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp gccld.cpp Message-ID: <200411171641.iAHGfYMs027152@apoc.cs.uiuc.edu> Changes in directory llvm/tools/gccld: GenerateCode.cpp updated: 1.36 -> 1.37 gccld.cpp updated: 1.80 -> 1.81 --- Log message: -disable-opt is not -O0, it's okay for it to disable internalize. --- Diffs of the changes: (+9 -8) Index: llvm/tools/gccld/GenerateCode.cpp diff -u llvm/tools/gccld/GenerateCode.cpp:1.36 llvm/tools/gccld/GenerateCode.cpp:1.37 --- llvm/tools/gccld/GenerateCode.cpp:1.36 Tue Nov 16 12:59:20 2004 +++ llvm/tools/gccld/GenerateCode.cpp Wed Nov 17 10:41:19 2004 @@ -153,14 +153,14 @@ // arguments). This pass merges the two functions. addPass(Passes, createFunctionResolvingPass()); - if (Internalize) { - // Now that composite has been compiled, scan through the module, looking - // for a main function. If main is defined, mark all other functions - // internal. - addPass(Passes, createInternalizePass()); - } - if (!DisableOptimizations) { + if (Internalize) { + // Now that composite has been compiled, scan through the module, looking + // for a main function. If main is defined, mark all other functions + // internal. + addPass(Passes, createInternalizePass()); + } + // Now that we internalized some globals, see if we can hack on them! addPass(Passes, createGlobalOptimizerPass()); Index: llvm/tools/gccld/gccld.cpp diff -u llvm/tools/gccld/gccld.cpp:1.80 llvm/tools/gccld/gccld.cpp:1.81 --- llvm/tools/gccld/gccld.cpp:1.80 Sun Nov 14 17:00:08 2004 +++ llvm/tools/gccld/gccld.cpp Wed Nov 17 10:41:19 2004 @@ -163,7 +163,8 @@ std::string ModuleID("gccld-output"); std::auto_ptr Composite(new Module(ModuleID)); - // We always look first in the current directory when searching for libraries. + // We always look first in the current directory when searching for + // libraries. LibPaths.insert(LibPaths.begin(), "."); // If the user specified an extra search path in their environment, respect From lattner at cs.uiuc.edu Wed Nov 17 11:39:31 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 11:39:31 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LICM/2004-11-17-UndefIndexCrash.ll Message-ID: <200411171739.iAHHdVlx029405@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LICM: 2004-11-17-UndefIndexCrash.ll added (r1.1) --- Log message: New testcase that crashes licm --- Diffs of the changes: (+24 -0) Index: llvm/test/Regression/Transforms/LICM/2004-11-17-UndefIndexCrash.ll diff -c /dev/null llvm/test/Regression/Transforms/LICM/2004-11-17-UndefIndexCrash.ll:1.1 *** /dev/null Wed Nov 17 11:39:29 2004 --- llvm/test/Regression/Transforms/LICM/2004-11-17-UndefIndexCrash.ll Wed Nov 17 11:39:19 2004 *************** *** 0 **** --- 1,24 ---- + ; RUN: llvm-as < %s | opt -licm -disable-output + + %struct.roadlet = type { sbyte*, %struct.vehicle*, [8 x %struct.roadlet*], [8 x %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)*] } + %struct.vehicle = type { %struct.roadlet*, sbyte*, int, int, %union.._631., int } + %union.._631. = type { int } + + implementation ; Functions: + + declare %struct.roadlet* %_Z11return_nullP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, int) + + declare %struct.roadlet* %_Z14lane_switch_okP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, int) + + void %main() { + __main.entry: ; preds = %invoke_cont.1 + br label %invoke_cont.3 + + invoke_cont.3: ; preds = %__main.entry, %invoke_cont.3 + %tmp.34.i.i502.7 = getelementptr %struct.roadlet* null, int 0, uint 3, int 7 ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)**> [#uses=1] + store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)* %_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)** %tmp.34.i.i502.7 + store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)* %_Z14lane_switch_okP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)** null + %tmp.4.i.i339 = getelementptr %struct.roadlet* null, int 0, uint 3, int undef ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)**> [#uses=1] + store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)* %_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)** %tmp.4.i.i339 + br label %invoke_cont.3 + } From lattner at cs.uiuc.edu Wed Nov 17 11:39:52 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 11:39:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200411171739.iAHHdqjf029415@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.54 -> 1.55 --- Log message: Simplify conditional and fix LICM/2004-11-17-UndefIndexCrash.ll by saying what we mean --- Diffs of the changes: (+1 -2) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.54 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.55 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.54 Sat Oct 16 11:07:10 2004 +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Wed Nov 17 11:39:39 2004 @@ -379,8 +379,7 @@ // the arguments provided, except substitute 0's for any variable // indexes we find... for (unsigned i = 0; i != GEPOperands.size(); ++i) - if (!isa(GEPOperands[i]) || isa(GEPOperands[i]) || - isa(GEPOperands[i])) + if (!isa(GEPOperands[i])) GEPOperands[i] =Constant::getNullValue(GEPOperands[i]->getType()); int64_t Offset = getTargetData().getIndexedOffset(BasePtr->getType(), GEPOperands); From lattner at cs.uiuc.edu Wed Nov 17 11:59:49 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 11:59:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200411171759.iAHHxnJ0013582@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.67 -> 1.68 --- Log message: Generalize this code to turn any cast-to-first-element-of into a gep constexpr --- Diffs of the changes: (+21 -8) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.67 llvm/lib/VMCore/ConstantFolding.cpp:1.68 --- llvm/lib/VMCore/ConstantFolding.cpp:1.67 Sun Oct 17 16:54:55 2004 +++ llvm/lib/VMCore/ConstantFolding.cpp Wed Nov 17 11:59:35 2004 @@ -565,16 +565,29 @@ return UndefValue::get(DestTy); } - // Check to see if we are casting an array of X to a pointer to X. If so, use - // a GEP to get to the first element of the array instead of a cast! + // Check to see if we are casting an pointer to an aggregate to a pointer to + // the first element. If so, return the appropriate GEP instruction. if (const PointerType *PTy = dyn_cast(V->getType())) - if (const ArrayType *ATy = dyn_cast(PTy->getElementType())) - if (const PointerType *DPTy = dyn_cast(DestTy)) - if (DPTy->getElementType() == ATy->getElementType()) { - std::vector IdxList(2,Constant::getNullValue(Type::IntTy)); - return ConstantExpr::getGetElementPtr(const_cast(V), - IdxList); + if (const PointerType *DPTy = dyn_cast(DestTy)) { + std::vector IdxList; + IdxList.push_back(Constant::getNullValue(Type::IntTy)); + const Type *ElTy = PTy->getElementType(); + while (ElTy != DPTy->getElementType()) { + if (const StructType *STy = dyn_cast(ElTy)) { + ElTy = STy->getElementType(0); + IdxList.push_back(Constant::getNullValue(Type::UIntTy)); + } else if (const SequentialType *STy = dyn_cast(ElTy)) { + if (isa(ElTy)) break; // Can't index into pointers! + ElTy = STy->getElementType(); + IdxList.push_back(IdxList[0]); + } else { + break; } + } + + if (ElTy == DPTy->getElementType()) + return ConstantExpr::getGetElementPtr(const_cast(V),IdxList); + } ConstRules &Rules = ConstRules::get(V, V); From lattner at cs.uiuc.edu Wed Nov 17 12:02:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 12:02:01 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h Message-ID: <200411171802.iAHI21k7013633@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Scalar.h updated: 1.48 -> 1.49 --- Log message: New prototype for lowerpacked pass. --- Diffs of the changes: (+5 -0) Index: llvm/include/llvm/Transforms/Scalar.h diff -u llvm/include/llvm/Transforms/Scalar.h:1.48 llvm/include/llvm/Transforms/Scalar.h:1.49 --- llvm/include/llvm/Transforms/Scalar.h:1.48 Sat Nov 6 18:42:29 2004 +++ llvm/include/llvm/Transforms/Scalar.h Wed Nov 17 12:01:49 2004 @@ -248,6 +248,11 @@ FunctionPass *createLowerSelectPass(bool OnlyFP = false); //===----------------------------------------------------------------------===// +// This pass converts PackedType operations into low-level scalar operations. +// +FunctionPass *createLowerPackedPass(); + +//===----------------------------------------------------------------------===// // This pass converts invoke and unwind instructions to use sjlj exception // handling mechanisms. Note that after this pass runs the CFG is not entirely // accurate (exceptional control flow edges are not correct anymore) so only From lattner at cs.uiuc.edu Wed Nov 17 12:19:44 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 12:19:44 -0600 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200411171819.iAHIJioc014146@apoc.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.248 -> 1.249 --- Log message: Make this more accurate --- Diffs of the changes: (+4 -2) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.248 llvm/docs/ReleaseNotes.html:1.249 --- llvm/docs/ReleaseNotes.html:1.248 Sat Nov 6 19:55:32 2004 +++ llvm/docs/ReleaseNotes.html Wed Nov 17 12:19:32 2004 @@ -97,7 +97,9 @@ program.
  • The LLVM makefiles have been improved to build LLVM much faster and includes new targets (like make dist-check).
  • -
  • The LLVM source code is now compatible with Microsoft Visual C++.
  • +
  • The LLVM source code is much more compatible with Microsoft Visual C++, + including the JIT and runtime-code generation, though the entire system + may not work with it.
  • @@ -643,7 +645,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/07 01:55:32 $ + Last modified: $Date: 2004/11/17 18:19:32 $ From reid at x10sys.com Wed Nov 17 12:25:32 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 12:25:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp Message-ID: <200411171825.MAA18993@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.26 -> 1.27 --- Log message: Make sure we parse bytecode with a module identifier that reflects the full name of the module: "Archive.a(object.o)" --- Diffs of the changes: (+9 -3) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.26 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.27 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.26 Wed Nov 17 10:13:11 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Wed Nov 17 12:25:21 2004 @@ -282,8 +282,10 @@ for (iterator I=begin(), E=end(); I != E; ++I) { if (I->isBytecode() || I->isCompressedBytecode()) { + std::string FullMemberName = archPath.get() + + "(" + I->getPath().get() + ")"; Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(), - I->getSize(), I->getPath().get(), ErrMessage); + I->getSize(), FullMemberName, ErrMessage); if (!M) return true; @@ -391,9 +393,11 @@ ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size()); // Now, load the bytecode module to get the ModuleProvider + std::string FullMemberName = archPath.get() + "(" + + mbr->getPath().get() + ")"; ModuleProvider* mp = getBytecodeBufferModuleProvider( (const unsigned char*) mbr->getData(), mbr->getSize(), - mbr->getPath().get(), 0); + FullMemberName, 0); modules.insert(std::make_pair(fileOffset,std::make_pair(mp,mbr))); @@ -428,8 +432,10 @@ if (mbr->isBytecode() || mbr->isCompressedBytecode()) { // Get the symbols std::vector symbols; + std::string FullMemberName = archPath.get() + "(" + + mbr->getPath().get() + ")"; ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At, - mbr->getSize(), mbr->getPath().get(),symbols); + mbr->getSize(), FullMemberName, symbols); if (MP) { // Insert the module's symbols into the symbol table From reid at x10sys.com Wed Nov 17 12:28:40 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 12:28:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Message-ID: <200411171828.MAA19040@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveWriter.cpp updated: 1.6 -> 1.7 --- Log message: Fix some things for Mac OSX archives: * ensure trailing spaces are eliminated so they don't factor into the length of a member's name. * make sure all the bytes of a name are written even if the name ends in multiple null characters (bug in OSX ar) * make sure we provide the full member name when searching for symbols so the module name is not accidentally duplicated. --- Diffs of the changes: (+14 -5) Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.6 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.7 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.6 Wed Nov 17 10:14:21 2004 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Wed Nov 17 12:28:29 2004 @@ -93,9 +93,16 @@ sprintf(buffer,"%-12u", unsigned(secondsSinceEpoch)); memcpy(hdr.date,buffer,12); + // Get rid of trailing blanks in the name + std::string mbrPath = mbr.getPath().get(); + size_t mbrLen = mbrPath.length(); + while (mbrLen > 0 && mbrPath[mbrLen-1] == ' ') { + mbrPath.erase(mbrLen-1,1); + mbrLen--; + } + // Set the name field in one of its various flavors. bool writeLongName = false; - const std::string& mbrPath = mbr.getPath().get(); if (mbr.isStringTable()) { memcpy(hdr.name,ARFILE_STRTAB_NAME,16); } else if (mbr.isForeignSymbolTable()) { @@ -115,12 +122,12 @@ memcpy(hdr.name,nm,len); hdr.name[len] = '/'; } else if (mbrPath.length() < 16 && mbrPath.find('/') == std::string::npos) { - mbrPath.copy(hdr.name,mbrPath.length()); + memcpy(hdr.name,mbrPath.c_str(),mbrPath.length()); hdr.name[mbrPath.length()] = '/'; } else { std::string nm = "#1/"; nm += utostr(mbrPath.length()); - nm.copy(hdr.name,nm.length()); + memcpy(hdr.name,nm.data(),nm.length()); if (sz < 0) sz -= mbrPath.length(); else @@ -203,8 +210,10 @@ if (CreateSymbolTable && (member.isBytecode() || member.isCompressedBytecode())) { std::vector symbols; + std::string FullMemberName = archPath.get() + "(" + member.getPath().get() + + ")"; ModuleProvider* MP = GetBytecodeSymbols( - (const unsigned char*)data,fSize,member.getPath().get(), symbols); + (const unsigned char*)data,fSize,FullMemberName, symbols); // If the bytecode parsed successfully if ( MP ) { @@ -270,7 +279,7 @@ // Write the long filename if its long if (writeLongName) { - ARFile << member.getPath().c_str(); + ARFile.write(member.getPath().get().data(),member.getPath().get().length()); } // Make sure we write the compressed bytecode magic number if we should. From alkis at cs.uiuc.edu Wed Nov 17 12:57:49 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 12:57:49 -0600 Subject: [llvm-commits] CVS: llvm-java/Makefile.rules Message-ID: <200411171857.MAA19401@zion.cs.uiuc.edu> Changes in directory llvm-java: Makefile.rules updated: 1.13 -> 1.14 --- Log message: Map "_" to "_1" when mangling names for JNI calls. --- Diffs of the changes: (+1 -1) Index: llvm-java/Makefile.rules diff -u llvm-java/Makefile.rules:1.13 llvm-java/Makefile.rules:1.14 --- llvm-java/Makefile.rules:1.13 Mon Nov 8 00:19:40 2004 +++ llvm-java/Makefile.rules Wed Nov 17 12:57:38 2004 @@ -13,4 +13,4 @@ # rule to make bytecode from assembly %.bc: %.ll $(Echo) Assembling $< to bytecode - $(Verb)$(LLVMAS) < $< > $@ + $(Verb)$(LLVMAS) < $< > $@ || rm -f $@ From alkis at cs.uiuc.edu Wed Nov 17 12:58:06 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 12:58:06 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200411171858.MAA19422@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.145 -> 1.146 --- Log message: Map "_" to "_1" when mangling names for JNI calls. --- Diffs of the changes: (+2 -0) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.145 llvm-java/lib/Compiler/Compiler.cpp:1.146 --- llvm-java/lib/Compiler/Compiler.cpp:1.145 Wed Nov 17 04:32:39 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Nov 17 12:57:56 2004 @@ -1177,6 +1177,8 @@ for (unsigned i = 0, e = className.size(); i != e; ++i) { if (className[i] == '/') funcName += '_'; + else if (className[i] == '_') + funcName += "_1"; else funcName += className[i]; } From reid at x10sys.com Wed Nov 17 13:08:54 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 13:08:54 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200411171908.NAA19617@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.235 -> 1.236 --- Log message: Fix PR458: http://llvm.cs.uiuc.edu/PR458 : * Don't include Makefile.rules in set of preconditions, it never has to be copied to objdir. * Enable the "update makefile first before executing targets" feature in gnu make by *not* using a full path to the Makefile in the rule. --- Diffs of the changes: (+3 -3) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.235 llvm/Makefile.rules:1.236 --- llvm/Makefile.rules:1.235 Sun Nov 14 15:46:55 2004 +++ llvm/Makefile.rules Wed Nov 17 13:08:44 2004 @@ -59,8 +59,8 @@ # PRECONDITIONS: that which must be built/checked first ################################################################################ -SrcMakefiles := $(filter %Makefile %Makefile.rules %Makefile.tests \ - %Makefile.JIT,$(wildcard $(BUILD_SRC_DIR)/Makefile*)) +SrcMakefiles := $(filter %Makefile %Makefile.tests %Makefile.JIT,\ + $(wildcard $(BUILD_SRC_DIR)/Makefile*)) ObjMakefiles := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SrcMakefiles)) ConfigureScript := $(LLVM_SRC_ROOT)/configure ConfigStatusScript := $(LLVM_OBJ_ROOT)/config.status @@ -104,7 +104,7 @@ #------------------------------------------------------------------------ ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR)) -$(BUILD_OBJ_DIR)/Makefile : $(BUILD_SRC_DIR)/Makefile +Makefile: $(BUILD_SRC_DIR)/Makefile $(Echo) "Updating Makefile" $(Verb) $(MKDIR) $(@D) $(Verb) cp -f $< $@ From reid at x10sys.com Wed Nov 17 14:19:31 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 14:19:31 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ar.pod Message-ID: <200411172019.OAA20463@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-ar.pod updated: 1.6 -> 1.7 --- Log message: Add a standards section. --- Diffs of the changes: (+10 -0) Index: llvm/docs/CommandGuide/llvm-ar.pod diff -u llvm/docs/CommandGuide/llvm-ar.pod:1.6 llvm/docs/CommandGuide/llvm-ar.pod:1.7 --- llvm/docs/CommandGuide/llvm-ar.pod:1.6 Mon Nov 15 13:50:15 2004 +++ llvm/docs/CommandGuide/llvm-ar.pod Wed Nov 17 14:19:18 2004 @@ -269,6 +269,16 @@ =back +=head1 STANDARDS + +The B utility is intended to provide a superset of the IEEE Std 1003.2 +(POSIX.2) functionality for C. B can read both SVR4 and BSD4.4 (or +Mac OS X) archives. If the C modifier is given to the C or C operations +then B will write SVR4 compatible archives. Without this modifier, +B will write BSD4.4 compatible archives that have long names +immediately after the header and indicated using the "#1/ddd" notation for the +name in the header. + =head1 FILE FORMAT The file format for LLVM Archive files is similar to that of BSD 4.4 or Mac OSX From alkis at cs.uiuc.edu Wed Nov 17 14:53:34 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 14:53:34 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200411172053.OAA07432@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.146 -> 1.147 --- Log message: Map "_" to "_1" when mangling names for JNI calls. --- Diffs of the changes: (+6 -1) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.146 llvm-java/lib/Compiler/Compiler.cpp:1.147 --- llvm-java/lib/Compiler/Compiler.cpp:1.146 Wed Nov 17 12:57:56 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Nov 17 14:53:24 2004 @@ -1185,7 +1185,12 @@ funcName += '_'; const std::string& methodName = method->getName()->str(); - funcName += methodName; + for (unsigned i = 0, e = methodName.size(); i != e; ++i) { + if (funcName[i] == '_') + funcName += "_1"; + else + funcName += methodName[i]; + } Function* jniFunction = module_.getOrInsertFunction(funcName, funcTy); jniFunction->setLinkage(method->isPrivate() ? From alkis at cs.uiuc.edu Wed Nov 17 15:02:36 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 15:02:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp Message-ID: <200411172102.PAA07660@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.5 -> 1.6 --- Log message: Make ReturnInst accept a value of type void as the return value. The ReturnInst constructed is the same as if NULL was passed instead of the void value. --- Diffs of the changes: (+9 -0) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.5 llvm/lib/VMCore/Instructions.cpp:1.6 --- llvm/lib/VMCore/Instructions.cpp:1.5 Sat Oct 16 13:08:06 2004 +++ llvm/lib/VMCore/Instructions.cpp Wed Nov 17 15:02:25 2004 @@ -233,6 +233,15 @@ // ReturnInst Implementation //===----------------------------------------------------------------------===// +void ReturnInst::init(Value* RetVal) { + if (RetVal && RetVal->getType() != Type::VoidTy) { + assert(!isa(RetVal) && + "Cannot return basic block. Probably using the incorrect ctor"); + Operands.reserve(1); + Operands.push_back(Use(RetVal, this)); + } +} + // Out-of-line ReturnInst method, put here so the C++ compiler can choose to // emit the vtable for the class in this translation unit. void ReturnInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) { From alkis at cs.uiuc.edu Wed Nov 17 15:02:36 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 15:02:36 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Message-ID: <200411172102.PAA07663@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h updated: 1.7 -> 1.8 --- Log message: Make ReturnInst accept a value of type void as the return value. The ReturnInst constructed is the same as if NULL was passed instead of the void value. --- Diffs of the changes: (+5 -8) Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.7 llvm/include/llvm/Instructions.h:1.8 --- llvm/include/llvm/Instructions.h:1.7 Mon Nov 15 13:02:35 2004 +++ llvm/include/llvm/Instructions.h Wed Nov 17 15:02:25 2004 @@ -807,23 +807,20 @@ } } - void init(Value *RetVal) { - if (RetVal) { - assert(!isa(RetVal) && - "Cannot return basic block. Probably using the incorrect ctor"); - Operands.reserve(1); - Operands.push_back(Use(RetVal, this)); - } - } + void init(Value *RetVal); public: // ReturnInst constructors: // ReturnInst() - 'ret void' instruction + // ReturnInst( null) - 'ret void' instruction // ReturnInst(Value* X) - 'ret X' instruction // ReturnInst( null, Inst *) - 'ret void' instruction, insert before I // ReturnInst(Value* X, Inst *I) - 'ret X' instruction, insert before I // ReturnInst( null, BB *B) - 'ret void' instruction, insert @ end of BB // ReturnInst(Value* X, BB *B) - 'ret X' instruction, insert @ end of BB + // + // NOTE: If the Value* passed is of type void then the constructor behaves as + // if it was passed NULL. ReturnInst(Value *RetVal = 0, Instruction *InsertBefore = 0) : TerminatorInst(Instruction::Ret, InsertBefore) { init(RetVal); From alkis at cs.uiuc.edu Wed Nov 17 15:03:18 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 15:03:18 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200411172103.PAA07733@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.147 -> 1.148 --- Log message: Use the new ReturnInst constructor. --- Diffs of the changes: (+1 -5) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.147 llvm-java/lib/Compiler/Compiler.cpp:1.148 --- llvm-java/lib/Compiler/Compiler.cpp:1.147 Wed Nov 17 14:53:24 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Nov 17 15:03:08 2004 @@ -1207,11 +1207,7 @@ A != E; ++A) { params.push_back(&*A); } - Value* r = new CallInst(jniFunction, params, "", bb); - if (r->getType() == Type::VoidTy) - new ReturnInst(NULL, bb); - else - new ReturnInst(r, bb); + new ReturnInst(new CallInst(jniFunction, params, "", bb), bb); return function; } From alkis at cs.uiuc.edu Wed Nov 17 17:53:59 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 17 Nov 2004 17:53:59 -0600 Subject: [llvm-commits] CVS: llvm-java/tools/class2llvm/class2llvm.cpp Message-ID: <200411172353.RAA09742@zion.cs.uiuc.edu> Changes in directory llvm-java/tools/class2llvm: class2llvm.cpp updated: 1.17 -> 1.18 --- Log message: Make tool take a '-o' option for the output filename. --- Diffs of the changes: (+15 -1) Index: llvm-java/tools/class2llvm/class2llvm.cpp diff -u llvm-java/tools/class2llvm/class2llvm.cpp:1.17 llvm-java/tools/class2llvm/class2llvm.cpp:1.18 --- llvm-java/tools/class2llvm/class2llvm.cpp:1.17 Wed Sep 29 16:02:08 2004 +++ llvm-java/tools/class2llvm/class2llvm.cpp Wed Nov 17 17:53:49 2004 @@ -21,6 +21,7 @@ #include #include +#include #include using namespace llvm; @@ -28,24 +29,37 @@ static cl::opt InputClass(cl::Positional, cl::desc("")); +static cl::opt +OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename")); + int main(int argc, char* argv[]) { sys::PrintStackTraceOnErrorSignal(); cl::ParseCommandLineOptions(argc, argv, "classfile to llvm utility"); + std::ostream* out = &std::cout; + if (!OutputFilename.empty()) { + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + out = new std::ofstream(OutputFilename.c_str()); + } + try { std::auto_ptr module = Java::compile(InputClass); PassManager passes; passes.add(createVerifierPass()); - passes.add(new WriteBytecodePass(&std::cout)); + passes.add(new WriteBytecodePass(out)); passes.run(*module); } catch (std::exception& e) { std::cerr << e.what() << '\n'; + sys::Path(OutputFilename).destroyFile(); return EXIT_FAILURE; } + if (!OutputFilename.empty()) + delete out; + return EXIT_SUCCESS; } From lattner at cs.uiuc.edu Wed Nov 17 19:29:53 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 19:29:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.h RegAllocIterativeScan.cpp RegAllocLinearScan.cpp Message-ID: <200411180129.iAI1TrtC013757@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.h updated: 1.8 -> 1.9 RegAllocIterativeScan.cpp updated: 1.17 -> 1.18 RegAllocLinearScan.cpp updated: 1.97 -> 1.98 --- Log message: Rename some methods, use 'begin' instead of 'start', add new LiveInterval iterator/begin/end members. --- Diffs of the changes: (+29 -22) Index: llvm/lib/CodeGen/LiveInterval.h diff -u llvm/lib/CodeGen/LiveInterval.h:1.8 llvm/lib/CodeGen/LiveInterval.h:1.9 --- llvm/lib/CodeGen/LiveInterval.h:1.8 Sun Jul 25 01:23:01 2004 +++ llvm/lib/CodeGen/LiveInterval.h Wed Nov 17 19:29:39 2004 @@ -76,6 +76,11 @@ : reg(Reg), weight(Weight), NumValues(0) { } + + typedef Ranges::iterator iterator; + iterator begin() { return ranges.begin(); } + iterator end() { return ranges.end(); } + void swap(LiveInterval& other) { std::swap(reg, other.reg); std::swap(weight, other.weight); @@ -91,21 +96,21 @@ bool empty() const { return ranges.empty(); } - /// start - Return the lowest numbered slot covered by interval. - unsigned start() const { + /// beginNumber - Return the lowest numbered slot covered by interval. + unsigned beginNumber() const { assert(!empty() && "empty interval for register"); return ranges.front().start; } - /// end - return the maximum point of the interval of the whole, + /// endNumber - return the maximum point of the interval of the whole, /// exclusive. - unsigned end() const { + unsigned endNumber() const { assert(!empty() && "empty interval for register"); return ranges.back().end; } bool expiredAt(unsigned index) const { - return end() <= (index + 1); + return endNumber() <= (index + 1); } bool liveAt(unsigned index) const; @@ -142,7 +147,7 @@ void removeRange(unsigned Start, unsigned End); bool operator<(const LiveInterval& other) const { - return start() < other.start(); + return beginNumber() < other.beginNumber(); } void dump() const; Index: llvm/lib/CodeGen/RegAllocIterativeScan.cpp diff -u llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.17 llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.18 --- llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.17 Thu Sep 2 16:24:33 2004 +++ llvm/lib/CodeGen/RegAllocIterativeScan.cpp Wed Nov 17 19:29:39 2004 @@ -270,7 +270,7 @@ unsigned reg = i->reg; // remove expired intervals - if (i->expiredAt(cur->start())) { + if (i->expiredAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " expired\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); @@ -279,7 +279,7 @@ std::iter_swap(ii, --ie); } // move inactive intervals to inactive list - else if (!i->liveAt(cur->start())) { + else if (!i->liveAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " inactive\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); @@ -305,13 +305,13 @@ unsigned reg = i->reg; // remove expired intervals - if (i->expiredAt(cur->start())) { + if (i->expiredAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " expired\n"); // swap with last element and move end iterator back one position std::iter_swap(ii, --ie); } // move re-activated intervals in active list - else if (i->liveAt(cur->start())) { + else if (i->liveAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " active\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); @@ -424,7 +424,7 @@ toSpill[minReg] = true; for (const unsigned* as = mri_->getAliasSet(minReg); *as; ++as) toSpill[*as] = true; - unsigned earliestStart = cur->start(); + unsigned earliestStart = cur->beginNumber(); std::set spilled; Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.97 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.98 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.97 Thu Nov 4 22:47:37 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 17 19:29:39 2004 @@ -29,7 +29,6 @@ #include #include #include - using namespace llvm; namespace { @@ -45,7 +44,8 @@ const TargetMachine* tm_; const MRegisterInfo* mri_; LiveIntervals* li_; - typedef std::vector IntervalPtrs; + typedef LiveInterval* IntervalPtr; + typedef std::vector IntervalPtrs; IntervalPtrs handled_, fixed_, active_, inactive_; typedef std::priority_queuereg; // remove expired intervals - if (i->expiredAt(cur->start())) { + if (i->expiredAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " expired\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); @@ -246,7 +247,7 @@ std::iter_swap(ii, --ie); } // move inactive intervals to inactive list - else if (!i->liveAt(cur->start())) { + else if (!i->liveAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " inactive\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); @@ -267,18 +268,19 @@ { DEBUG(std::cerr << "\tprocessing inactive intervals:\n"); IntervalPtrs::iterator ii = inactive_.begin(), ie = inactive_.end(); + while (ii != ie) { LiveInterval* i = *ii; unsigned reg = i->reg; // remove expired intervals - if (i->expiredAt(cur->start())) { + if (i->expiredAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " expired\n"); // swap with last element and move end iterator back one position std::iter_swap(ii, --ie); } // move re-activated intervals in active list - else if (i->liveAt(cur->start())) { + else if (i->liveAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\tinterval " << *i << " active\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); @@ -413,7 +415,7 @@ // the earliest start of a spilled interval indicates up to where // in handled we need to roll back - unsigned earliestStart = cur->start(); + unsigned earliestStart = cur->beginNumber(); // set of spilled vregs (used later to rollback properly) std::set spilled; @@ -431,7 +433,7 @@ toSpill[vrm_->getPhys(reg)] && cur->overlaps(**i)) { DEBUG(std::cerr << "\t\t\tspilling(a): " << **i << '\n'); - earliestStart = std::min(earliestStart, (*i)->start()); + earliestStart = std::min(earliestStart, (*i)->beginNumber()); int slot = vrm_->assignVirt2StackSlot((*i)->reg); std::vector newIs = li_->addIntervalsForSpills(**i, *vrm_, slot); @@ -446,7 +448,7 @@ toSpill[vrm_->getPhys(reg)] && cur->overlaps(**i)) { DEBUG(std::cerr << "\t\t\tspilling(i): " << **i << '\n'); - earliestStart = std::min(earliestStart, (*i)->start()); + earliestStart = std::min(earliestStart, (*i)->beginNumber()); int slot = vrm_->assignVirt2StackSlot((*i)->reg); std::vector newIs = li_->addIntervalsForSpills(**i, *vrm_, slot); @@ -462,7 +464,7 @@ while (!handled_.empty()) { LiveInterval* i = handled_.back(); // if this interval starts before t we are done - if (i->start() < earliestStart) + if (i->beginNumber() < earliestStart) break; DEBUG(std::cerr << "\t\t\tundo changes for: " << *i << '\n'); handled_.pop_back(); @@ -505,7 +507,7 @@ // put it in inactive if required) for (IntervalPtrs::iterator i = handled_.begin(), e = handled_.end(); i != e; ++i) { - if (!(*i)->expiredAt(earliestStart) && (*i)->expiredAt(cur->start())) { + if (!(*i)->expiredAt(earliestStart) && (*i)->expiredAt(cur->beginNumber())){ DEBUG(std::cerr << "\t\t\tundo changes for: " << **i << '\n'); active_.push_back(*i); if (MRegisterInfo::isPhysicalRegister((*i)->reg)) From lattner at cs.uiuc.edu Wed Nov 17 19:34:56 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 19:34:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.h Message-ID: <200411180134.iAI1YuHu014101@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.h updated: 1.9 -> 1.10 --- Log message: Fix a minor bug in expiredAt. endNumber() is the first number that is not valid. --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/LiveInterval.h diff -u llvm/lib/CodeGen/LiveInterval.h:1.9 llvm/lib/CodeGen/LiveInterval.h:1.10 --- llvm/lib/CodeGen/LiveInterval.h:1.9 Wed Nov 17 19:29:39 2004 +++ llvm/lib/CodeGen/LiveInterval.h Wed Nov 17 19:34:44 2004 @@ -110,7 +110,7 @@ } bool expiredAt(unsigned index) const { - return endNumber() <= (index + 1); + return index >= endNumber(); } bool liveAt(unsigned index) const; From lattner at cs.uiuc.edu Wed Nov 17 20:37:45 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 20:37:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.h Message-ID: <200411180237.iAI2bjbl015456@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.h updated: 1.10 -> 1.11 --- Log message: Add new advanceTo method --- Diffs of the changes: (+13 -0) Index: llvm/lib/CodeGen/LiveInterval.h diff -u llvm/lib/CodeGen/LiveInterval.h:1.10 llvm/lib/CodeGen/LiveInterval.h:1.11 --- llvm/lib/CodeGen/LiveInterval.h:1.10 Wed Nov 17 19:34:44 2004 +++ llvm/lib/CodeGen/LiveInterval.h Wed Nov 17 20:37:31 2004 @@ -81,6 +81,19 @@ iterator begin() { return ranges.begin(); } iterator end() { return ranges.end(); } + + /// advanceTo - Advance the specified iterator to point to the LiveRange + /// containing the specified position, or end() if the position is past the + /// end of the interval. If no LiveRange contains this position, but the + /// position is in a hole, this method returns an iterator pointing the the + /// LiveRange immediately after the hold. + iterator advanceTo(iterator I, unsigned Pos) { + if (Pos >= endNumber()) + return end(); + while (I->end <= Pos) ++I; + return I; + } + void swap(LiveInterval& other) { std::swap(reg, other.reg); std::swap(weight, other.weight); From lattner at cs.uiuc.edu Wed Nov 17 20:42:39 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 20:42:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200411180242.iAI2gdRx015477@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.98 -> 1.99 --- Log message: * Improve comments/documentation substantially * Eliminate the releaseMemory method, this is not an analysis * Change the fixed, active, and inactive lists of intervals to maintain an iterator for the current position in the interval. This allows us to do constant time increments of the iterator instead of having to do a binary search to find our liverange in our liveinterval all of the time, which substantially speeds up cases where LiveIntervals have many LiveRanges - which is very common for physical registers. On targets with many physregs, this can make a noticable difference. With a release build of LLC for PPC, this halves the time in processInactiveIntervals and processActiveIntervals, from 1.5s to .75s. This also lays the ground for more to come. --- Diffs of the changes: (+174 -130) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.98 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.99 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.98 Wed Nov 17 19:29:39 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 17 20:42:27 2004 @@ -29,6 +29,7 @@ #include #include #include + using namespace llvm; namespace { @@ -39,16 +40,33 @@ static unsigned numIterations = 0; static unsigned numIntervals = 0; - class RA : public MachineFunctionPass { + struct RA : public MachineFunctionPass { + typedef std::pair IntervalPtr; + typedef std::vector IntervalPtrs; + private: MachineFunction* mf_; const TargetMachine* tm_; const MRegisterInfo* mri_; LiveIntervals* li_; - typedef LiveInterval* IntervalPtr; - typedef std::vector IntervalPtrs; - IntervalPtrs handled_, fixed_, active_, inactive_; + + /// handled_ - Intervals are added to the handled_ set in the order of their + /// start value. This is uses for backtracking. + std::vector handled_; + + /// fixed_ - Intervals that correspond to machine registers. + /// + IntervalPtrs fixed_; + + /// active_ - Intervals that are currently being processed, and which have a + /// live range active for the current point. + IntervalPtrs active_; + + /// inactive_ - Intervals that are currently being processed, but which have + /// a hold at the current point. + IntervalPtrs inactive_; + typedef std::priority_queue, greater_ptr > IntervalHeap; IntervalHeap unhandled_; std::auto_ptr prt_; @@ -71,26 +89,24 @@ /// runOnMachineFunction - register allocate the whole function bool runOnMachineFunction(MachineFunction&); - void releaseMemory(); - private: /// linearScan - the linear scan algorithm void linearScan(); - /// initIntervalSets - initializa the four interval sets: - /// unhandled, fixed, active and inactive + /// initIntervalSets - initialize the interval sets. + /// void initIntervalSets(); - /// processActiveIntervals - expire old intervals and move - /// non-overlapping ones to the incative list - void processActiveIntervals(LiveInterval* cur); - - /// processInactiveIntervals - expire old intervals and move - /// overlapping ones to the active list - void processInactiveIntervals(LiveInterval* cur); + /// processActiveIntervals - expire old intervals and move non-overlapping + /// ones to the inactive list. + void processActiveIntervals(unsigned CurPoint); + + /// processInactiveIntervals - expire old intervals and move overlapping + /// ones to the active list. + void processInactiveIntervals(unsigned CurPoint); /// updateSpillWeights - updates the spill weights of the - /// specifed physical register and its weight + /// specifed physical register and its weight. void updateSpillWeights(unsigned reg, SpillWeights::value_type weight); /// assignRegOrStackSlotAtInterval - assign a register if one @@ -101,9 +117,8 @@ /// register handling helpers /// - /// getFreePhysReg - return a free physical register for this - /// virtual register interval if we have one, otherwise return - /// 0 + /// getFreePhysReg - return a free physical register for this virtual + /// register interval if we have one, otherwise return 0. unsigned getFreePhysReg(LiveInterval* cur); /// assignVirt2StackSlot - assigns this virtual register to a @@ -114,8 +129,8 @@ void printIntervals(const char* const str, ItTy i, ItTy e) const { if (str) std::cerr << str << " intervals:\n"; for (; i != e; ++i) { - std::cerr << "\t" << **i << " -> "; - unsigned reg = (*i)->reg; + std::cerr << "\t" << *i->first << " -> "; + unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg)) { reg = vrm_->getPhys(reg); } @@ -125,15 +140,6 @@ }; } -void RA::releaseMemory() -{ - while (!unhandled_.empty()) unhandled_.pop(); - fixed_.clear(); - active_.clear(); - inactive_.clear(); - handled_.clear(); -} - bool RA::runOnMachineFunction(MachineFunction &fn) { mf_ = &fn; tm_ = &fn.getTarget(); @@ -150,6 +156,14 @@ spiller_->runOnMachineFunction(*mf_, *vrm_); vrm_.reset(); // Free the VirtRegMap + + + while (!unhandled_.empty()) unhandled_.pop(); + fixed_.clear(); + active_.clear(); + inactive_.clear(); + handled_.clear(); + return true; } @@ -172,19 +186,18 @@ ++numIterations; DEBUG(std::cerr << "\n*** CURRENT ***: " << *cur << '\n'); - processActiveIntervals(cur); - processInactiveIntervals(cur); + processActiveIntervals(cur->beginNumber()); + processInactiveIntervals(cur->beginNumber()); // if this register is fixed we are done if (MRegisterInfo::isPhysicalRegister(cur->reg)) { prt_->addRegUse(cur->reg); - active_.push_back(cur); + active_.push_back(std::make_pair(cur, cur->begin())); handled_.push_back(cur); - } - // otherwise we are allocating a virtual register. try to find - // a free physical register or spill an interval in order to - // assign it one (we could spill the current though). - else { + } else { + // otherwise we are allocating a virtual register. try to find a free + // physical register or spill an interval in order to assign it one (we + // could spill the current though). assignRegOrStackSlotAtInterval(cur); } @@ -197,8 +210,8 @@ // expire any remaining active intervals for (IntervalPtrs::reverse_iterator i = active_.rbegin(); i != active_.rend(); ) { - unsigned reg = (*i)->reg; - DEBUG(std::cerr << "\tinterval " << **i << " expired\n"); + unsigned reg = i->first->reg; + DEBUG(std::cerr << "\tinterval " << *i->first << " expired\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); prt_->delRegUse(reg); @@ -208,13 +221,15 @@ // expire any remaining inactive intervals for (IntervalPtrs::reverse_iterator i = inactive_.rbegin(); i != inactive_.rend(); ) { - DEBUG(std::cerr << "\tinterval " << **i << " expired\n"); + DEBUG(std::cerr << "\tinterval " << *i->first << " expired\n"); i = IntervalPtrs::reverse_iterator(inactive_.erase(i.base()-1)); } DEBUG(std::cerr << *vrm_); } +/// initIntervalSets - initialize the interval sets. +/// void RA::initIntervalSets() { assert(unhandled_.empty() && fixed_.empty() && @@ -224,79 +239,95 @@ for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i){ unhandled_.push(&i->second); if (MRegisterInfo::isPhysicalRegister(i->second.reg)) - fixed_.push_back(&i->second); + fixed_.push_back(std::make_pair(&i->second, i->second.begin())); } } -void RA::processActiveIntervals(IntervalPtrs::value_type cur) +/// processActiveIntervals - expire old intervals and move non-overlapping ones +/// to the inactive list. +void RA::processActiveIntervals(unsigned CurPoint) { DEBUG(std::cerr << "\tprocessing active intervals:\n"); - IntervalPtrs::iterator ii = active_.begin(), ie = active_.end(); - while (ii != ie) { - LiveInterval* i = *ii; - unsigned reg = i->reg; - - // remove expired intervals - if (i->expiredAt(cur->beginNumber())) { - DEBUG(std::cerr << "\t\tinterval " << *i << " expired\n"); + for (unsigned i = 0, e = active_.size(); i != e; ++i) { + LiveInterval *Interval = active_[i].first; + LiveInterval::iterator IntervalPos = active_[i].second; + unsigned reg = Interval->reg; + + IntervalPos = Interval->advanceTo(IntervalPos, CurPoint); + + if (IntervalPos == Interval->end()) { // Remove expired intervals. + DEBUG(std::cerr << "\t\tinterval " << *Interval << " expired\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); prt_->delRegUse(reg); - // swap with last element and move end iterator back one position - std::iter_swap(ii, --ie); - } - // move inactive intervals to inactive list - else if (!i->liveAt(cur->beginNumber())) { - DEBUG(std::cerr << "\t\tinterval " << *i << " inactive\n"); + + // Pop off the end of the list. + active_[i] = active_.back(); + active_.pop_back(); + --i; --e; + + } else if (IntervalPos->start > CurPoint) { + // Move inactive intervals to inactive list. + DEBUG(std::cerr << "\t\tinterval " << *Interval << " inactive\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); prt_->delRegUse(reg); - // add to inactive - inactive_.push_back(i); - // swap with last element and move end iterator back one postion - std::iter_swap(ii, --ie); - } - else { - ++ii; + // add to inactive. + inactive_.push_back(std::make_pair(Interval, IntervalPos)); + + // Pop off the end of the list. + active_[i] = active_.back(); + active_.pop_back(); + --i; --e; + } else { + // Otherwise, just update the iterator position. + active_[i].second = IntervalPos; } } - active_.erase(ie, active_.end()); } -void RA::processInactiveIntervals(IntervalPtrs::value_type cur) +/// processInactiveIntervals - expire old intervals and move overlapping +/// ones to the active list. +void RA::processInactiveIntervals(unsigned CurPoint) { DEBUG(std::cerr << "\tprocessing inactive intervals:\n"); - IntervalPtrs::iterator ii = inactive_.begin(), ie = inactive_.end(); - - while (ii != ie) { - LiveInterval* i = *ii; - unsigned reg = i->reg; - - // remove expired intervals - if (i->expiredAt(cur->beginNumber())) { - DEBUG(std::cerr << "\t\tinterval " << *i << " expired\n"); - // swap with last element and move end iterator back one position - std::iter_swap(ii, --ie); - } - // move re-activated intervals in active list - else if (i->liveAt(cur->beginNumber())) { - DEBUG(std::cerr << "\t\tinterval " << *i << " active\n"); + for (unsigned i = 0, e = inactive_.size(); i != e; ++i) { + LiveInterval *Interval = inactive_[i].first; + LiveInterval::iterator IntervalPos = inactive_[i].second; + unsigned reg = Interval->reg; + + IntervalPos = Interval->advanceTo(IntervalPos, CurPoint); + + if (IntervalPos == Interval->end()) { // remove expired intervals. + DEBUG(std::cerr << "\t\tinterval " << *Interval << " expired\n"); + + // Pop off the end of the list. + inactive_[i] = inactive_.back(); + inactive_.pop_back(); + --i; --e; + } else if (IntervalPos->start <= CurPoint) { + // move re-activated intervals in active list + DEBUG(std::cerr << "\t\tinterval " << *Interval << " active\n"); if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); prt_->addRegUse(reg); // add to active - active_.push_back(i); - // swap with last element and move end iterator back one position - std::iter_swap(ii, --ie); - } - else { - ++ii; + active_.push_back(std::make_pair(Interval, IntervalPos)); + + // Pop off the end of the list. + inactive_[i] = inactive_.back(); + inactive_.pop_back(); + --i; --e; + } else { + // Otherwise, just update the iterator position. + inactive_[i].second = IntervalPos; } } - inactive_.erase(ie, inactive_.end()); } +/// updateSpillWeights - updates the spill weights of the specifed physical +/// register and its weight. void RA::updateSpillWeights(unsigned reg, SpillWeights::value_type weight) { spillWeights_[reg] += weight; @@ -304,6 +335,17 @@ spillWeights_[*as] += weight; } +static RA::IntervalPtrs::iterator FindIntervalInVector(RA::IntervalPtrs &IP, + LiveInterval *LI) { + for (RA::IntervalPtrs::iterator I = IP.begin(), E = IP.end(); I != E; ++I) + if (I->first == LI) return I; + return IP.end(); +} + + + +/// assignRegOrStackSlotAtInterval - assign a register if one is available, or +/// spill. void RA::assignRegOrStackSlotAtInterval(LiveInterval* cur) { DEBUG(std::cerr << "\tallocating current interval: "); @@ -315,22 +357,22 @@ // for each interval in active update spill weights for (IntervalPtrs::const_iterator i = active_.begin(), e = active_.end(); i != e; ++i) { - unsigned reg = (*i)->reg; + unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); - updateSpillWeights(reg, (*i)->weight); + updateSpillWeights(reg, i->first->weight); } // for every interval in inactive we overlap with, mark the // register as not free and update spill weights for (IntervalPtrs::const_iterator i = inactive_.begin(), e = inactive_.end(); i != e; ++i) { - if (cur->overlaps(**i)) { - unsigned reg = (*i)->reg; + if (cur->overlaps(*i->first)) { + unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); prt_->addRegUse(reg); - updateSpillWeights(reg, (*i)->weight); + updateSpillWeights(reg, i->first->weight); } } @@ -338,10 +380,10 @@ // mark the register as not free and update spill weights for (IntervalPtrs::const_iterator i = fixed_.begin(), e = fixed_.end(); i != e; ++i) { - if (cur->overlaps(**i)) { - unsigned reg = (*i)->reg; + if (cur->overlaps(*i->first)) { + unsigned reg = i->first->reg; prt_->addRegUse(reg); - updateSpillWeights(reg, (*i)->weight); + updateSpillWeights(reg, i->first->weight); } } @@ -355,7 +397,7 @@ DEBUG(std::cerr << mri_->getName(physReg) << '\n'); vrm_->assignVirt2Phys(cur->reg, physReg); prt_->addRegUse(physReg); - active_.push_back(cur); + active_.push_back(std::make_pair(cur, cur->begin())); handled_.push_back(cur); return; } @@ -428,64 +470,63 @@ // point for (IntervalPtrs::iterator i = active_.begin(); i != active_.end(); ++i) { - unsigned reg = (*i)->reg; + unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg) && toSpill[vrm_->getPhys(reg)] && - cur->overlaps(**i)) { - DEBUG(std::cerr << "\t\t\tspilling(a): " << **i << '\n'); - earliestStart = std::min(earliestStart, (*i)->beginNumber()); - int slot = vrm_->assignVirt2StackSlot((*i)->reg); + cur->overlaps(*i->first)) { + DEBUG(std::cerr << "\t\t\tspilling(a): " << *i->first << '\n'); + earliestStart = std::min(earliestStart, i->first->beginNumber()); + int slot = vrm_->assignVirt2StackSlot(i->first->reg); std::vector newIs = - li_->addIntervalsForSpills(**i, *vrm_, slot); + li_->addIntervalsForSpills(*i->first, *vrm_, slot); std::copy(newIs.begin(), newIs.end(), std::back_inserter(added)); spilled.insert(reg); } } for (IntervalPtrs::iterator i = inactive_.begin(); i != inactive_.end(); ++i) { - unsigned reg = (*i)->reg; + unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg) && toSpill[vrm_->getPhys(reg)] && - cur->overlaps(**i)) { - DEBUG(std::cerr << "\t\t\tspilling(i): " << **i << '\n'); - earliestStart = std::min(earliestStart, (*i)->beginNumber()); - int slot = vrm_->assignVirt2StackSlot((*i)->reg); + cur->overlaps(*i->first)) { + DEBUG(std::cerr << "\t\t\tspilling(i): " << *i->first << '\n'); + earliestStart = std::min(earliestStart, i->first->beginNumber()); + int slot = vrm_->assignVirt2StackSlot(reg); std::vector newIs = - li_->addIntervalsForSpills(**i, *vrm_, slot); + li_->addIntervalsForSpills(*i->first, *vrm_, slot); std::copy(newIs.begin(), newIs.end(), std::back_inserter(added)); spilled.insert(reg); } } DEBUG(std::cerr << "\t\trolling back to: " << earliestStart << '\n'); - // scan handled in reverse order up to the earliaset start of a + + // Scan handled in reverse order up to the earliest start of a // spilled live interval and undo each one, restoring the state of - // unhandled + // unhandled. while (!handled_.empty()) { LiveInterval* i = handled_.back(); - // if this interval starts before t we are done + // If this interval starts before t we are done. if (i->beginNumber() < earliestStart) break; DEBUG(std::cerr << "\t\t\tundo changes for: " << *i << '\n'); handled_.pop_back(); - // when undoing a live interval allocation we must know if it - // is active or inactive to properly update the PhysRegTracker - // and the VirtRegMap + + // When undoing a live interval allocation we must know if it is active or + // inactive to properly update the PhysRegTracker and the VirtRegMap. IntervalPtrs::iterator it; - if ((it = std::find(active_.begin(), active_.end(), i)) != active_.end()) { + if ((it = FindIntervalInVector(active_, i)) != active_.end()) { active_.erase(it); if (MRegisterInfo::isPhysicalRegister(i->reg)) { prt_->delRegUse(i->reg); unhandled_.push(i); - } - else { + } else { if (!spilled.count(i->reg)) unhandled_.push(i); prt_->delRegUse(vrm_->getPhys(i->reg)); vrm_->clearVirt(i->reg); } - } - else if ((it = std::find(inactive_.begin(), inactive_.end(), i)) != inactive_.end()) { + } else if ((it = FindIntervalInVector(inactive_, i)) != inactive_.end()) { inactive_.erase(it); if (MRegisterInfo::isPhysicalRegister(i->reg)) unhandled_.push(i); @@ -505,15 +546,16 @@ // scan the rest and undo each interval that expired after t and // insert it in active (the next iteration of the algorithm will // put it in inactive if required) - for (IntervalPtrs::iterator i = handled_.begin(), e = handled_.end(); - i != e; ++i) { - if (!(*i)->expiredAt(earliestStart) && (*i)->expiredAt(cur->beginNumber())){ - DEBUG(std::cerr << "\t\t\tundo changes for: " << **i << '\n'); - active_.push_back(*i); - if (MRegisterInfo::isPhysicalRegister((*i)->reg)) - prt_->addRegUse((*i)->reg); + for (unsigned i = 0, e = handled_.size(); i != e; ++i) { + LiveInterval *HI = handled_[i]; + if (!HI->expiredAt(earliestStart) && + HI->expiredAt(cur->beginNumber())) { + DEBUG(std::cerr << "\t\t\tundo changes for: " << *HI << '\n'); + active_.push_back(std::make_pair(HI, HI->begin())); + if (MRegisterInfo::isPhysicalRegister(HI->reg)) + prt_->addRegUse(HI->reg); else - prt_->addRegUse(vrm_->getPhys((*i)->reg)); + prt_->addRegUse(vrm_->getPhys(HI->reg)); } } @@ -522,12 +564,14 @@ unhandled_.push(added[i]); } +/// getFreePhysReg - return a free physical register for this virtual register +/// interval if we have one, otherwise return 0. unsigned RA::getFreePhysReg(LiveInterval* cur) { std::vector inactiveCounts(mri_->getNumRegs(), 0); for (IntervalPtrs::iterator i = inactive_.begin(), e = inactive_.end(); i != e; ++i) { - unsigned reg = (*i)->reg; + unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); ++inactiveCounts[reg]; From lattner at cs.uiuc.edu Wed Nov 17 21:47:46 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 21:47:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp LiveInterval.h Message-ID: <200411180347.iAI3lkFl019222@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.14 -> 1.15 LiveInterval.h updated: 1.11 -> 1.12 --- Log message: Add ability to give hints to the overlaps routines. --- Diffs of the changes: (+27 -7) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.14 llvm/lib/CodeGen/LiveInterval.cpp:1.15 --- llvm/lib/CodeGen/LiveInterval.cpp:1.14 Tue Nov 16 00:52:35 2004 +++ llvm/lib/CodeGen/LiveInterval.cpp Wed Nov 17 21:47:34 2004 @@ -42,6 +42,9 @@ return r->contains(I); } +// overlaps - Return true if the intersection of the two live intervals is +// not empty. +// // An example for overlaps(): // // 0: A = ... @@ -56,11 +59,16 @@ // // A->overlaps(C) should return false since we want to be able to join // A and C. -bool LiveInterval::overlaps(const LiveInterval& other) const { - Ranges::const_iterator i = ranges.begin(); - Ranges::const_iterator ie = ranges.end(); - Ranges::const_iterator j = other.ranges.begin(); - Ranges::const_iterator je = other.ranges.end(); +// +bool LiveInterval::overlapsFrom(const LiveInterval& other, + const_iterator StartPos) const { + const_iterator i = begin(); + const_iterator ie = end(); + const_iterator j = StartPos; + const_iterator je = other.end(); + + assert((StartPos->start <= i->start || StartPos == other.begin()) && + "Bogus start position hint!"); if (i->start < j->start) { i = std::upper_bound(i, ie, j->start); Index: llvm/lib/CodeGen/LiveInterval.h diff -u llvm/lib/CodeGen/LiveInterval.h:1.11 llvm/lib/CodeGen/LiveInterval.h:1.12 --- llvm/lib/CodeGen/LiveInterval.h:1.11 Wed Nov 17 20:37:31 2004 +++ llvm/lib/CodeGen/LiveInterval.h Wed Nov 17 21:47:34 2004 @@ -76,11 +76,14 @@ : reg(Reg), weight(Weight), NumValues(0) { } - typedef Ranges::iterator iterator; iterator begin() { return ranges.begin(); } iterator end() { return ranges.end(); } + typedef Ranges::const_iterator const_iterator; + const_iterator begin() const { return ranges.begin(); } + const_iterator end() const { return ranges.end(); } + /// advanceTo - Advance the specified iterator to point to the LiveRange /// containing the specified position, or end() if the position is past the @@ -139,7 +142,16 @@ bool joinable(const LiveInterval& other, unsigned CopyIdx) const; - bool overlaps(const LiveInterval& other) const; + /// overlaps - Return true if the intersection of the two live intervals is + /// not empty. + bool overlaps(const LiveInterval& other) const { + return overlapsFrom(other, other.begin()); + } + + /// overlapsFrom - Return true if the intersection of the two live intervals + /// is not empty. The specified iterator is a hint that we can begin + /// scanning the Other interval starting at I. + bool overlapsFrom(const LiveInterval& other, const_iterator I) const; /// addRange - Add the specified LiveRange to this interval, merging /// intervals as appropriate. This returns an iterator to the inserted live From lattner at cs.uiuc.edu Wed Nov 17 21:49:42 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 21:49:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200411180349.iAI3ng4g019238@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.99 -> 1.100 --- Log message: Add a counter for the number of times linscan has to backtrack. Start using the iterator hints we have to speed up overlaps(). This speeds linscan up by about .2s (out of 8.7) on 175.vpr for PPC. --- Diffs of the changes: (+36 -22) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.99 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.100 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.99 Wed Nov 17 20:42:27 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 17 21:49:30 2004 @@ -29,13 +29,13 @@ #include #include #include - using namespace llvm; namespace { Statistic efficiency ("regalloc", "Ratio of intervals processed over total intervals"); + Statistic<> NumBacktracks("regalloc", "Number of times we had to backtrack"); static unsigned numIterations = 0; static unsigned numIntervals = 0; @@ -196,8 +196,8 @@ handled_.push_back(cur); } else { // otherwise we are allocating a virtual register. try to find a free - // physical register or spill an interval in order to assign it one (we - // could spill the current though). + // physical register or spill an interval (possibly this one) in order to + // assign it one. assignRegOrStackSlotAtInterval(cur); } @@ -342,6 +342,15 @@ return IP.end(); } +static void RevertVectorIteratorsTo(RA::IntervalPtrs &V, unsigned Point) { + for (unsigned i = 0, e = V.size(); i != e; ++i) { + RA::IntervalPtr &IP = V[i]; + LiveInterval::iterator I = std::upper_bound(IP.first->begin(), + IP.second, Point); + if (I != IP.first->begin()) --I; + IP.second = I; + } +} /// assignRegOrStackSlotAtInterval - assign a register if one is available, or @@ -367,7 +376,7 @@ // register as not free and update spill weights for (IntervalPtrs::const_iterator i = inactive_.begin(), e = inactive_.end(); i != e; ++i) { - if (cur->overlaps(*i->first)) { + if (cur->overlapsFrom(*i->first, i->second-1)) { unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg)) reg = vrm_->getPhys(reg); @@ -376,16 +385,15 @@ } } - // for every interval in fixed we overlap with, - // mark the register as not free and update spill weights + // For every interval in fixed we overlap with, mark the register as not free + // and update spill weights. for (IntervalPtrs::const_iterator i = fixed_.begin(), - e = fixed_.end(); i != e; ++i) { - if (cur->overlaps(*i->first)) { + e = fixed_.end(); i != e; ++i) + if (cur->overlapsFrom(*i->first, i->second)) { unsigned reg = i->first->reg; prt_->addRegUse(reg); updateSpillWeights(reg, i->first->weight); } - } unsigned physReg = getFreePhysReg(cur); // restore the physical register tracker @@ -438,6 +446,8 @@ return; } + ++NumBacktracks; + // push the current interval back to unhandled since we are going // to re-run at least this iteration. Since we didn't modify it it // should go back right in the front of the list @@ -450,7 +460,8 @@ assert(MRegisterInfo::isPhysicalRegister(minReg) && "did not choose a register to spill?"); std::vector toSpill(mri_->getNumRegs(), false); - // we are going to spill minReg and all its aliases + + // We are going to spill minReg and all its aliases. toSpill[minReg] = true; for (const unsigned* as = mri_->getAliasSet(minReg); *as; ++as) toSpill[*as] = true; @@ -462,18 +473,16 @@ // set of spilled vregs (used later to rollback properly) std::set spilled; - // spill live intervals of virtual regs mapped to the physical - // register we want to clear (and its aliases). we only spill - // those that overlap with the current interval as the rest do not - // affect its allocation. we also keep track of the earliest start - // of all spilled live intervals since this will mark our rollback - // point - for (IntervalPtrs::iterator - i = active_.begin(); i != active_.end(); ++i) { + // spill live intervals of virtual regs mapped to the physical register we + // want to clear (and its aliases). We only spill those that overlap with the + // current interval as the rest do not affect its allocation. we also keep + // track of the earliest start of all spilled live intervals since this will + // mark our rollback point. + for (IntervalPtrs::iterator i = active_.begin(); i != active_.end(); ++i) { unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg) && toSpill[vrm_->getPhys(reg)] && - cur->overlaps(*i->first)) { + cur->overlapsFrom(*i->first, i->second)) { DEBUG(std::cerr << "\t\t\tspilling(a): " << *i->first << '\n'); earliestStart = std::min(earliestStart, i->first->beginNumber()); int slot = vrm_->assignVirt2StackSlot(i->first->reg); @@ -483,12 +492,11 @@ spilled.insert(reg); } } - for (IntervalPtrs::iterator - i = inactive_.begin(); i != inactive_.end(); ++i) { + for (IntervalPtrs::iterator i = inactive_.begin(); i != inactive_.end(); ++i){ unsigned reg = i->first->reg; if (MRegisterInfo::isVirtualRegister(reg) && toSpill[vrm_->getPhys(reg)] && - cur->overlaps(*i->first)) { + cur->overlapsFrom(*i->first, i->second-1)) { DEBUG(std::cerr << "\t\t\tspilling(i): " << *i->first << '\n'); earliestStart = std::min(earliestStart, i->first->beginNumber()); int slot = vrm_->assignVirt2StackSlot(reg); @@ -543,6 +551,12 @@ } } + // Rewind the iterators in the active, inactive, and fixed lists back to the + // point we reverted to. + RevertVectorIteratorsTo(active_, earliestStart); + RevertVectorIteratorsTo(inactive_, earliestStart); + RevertVectorIteratorsTo(fixed_, earliestStart); + // scan the rest and undo each interval that expired after t and // insert it in active (the next iteration of the algorithm will // put it in inactive if required) From lattner at cs.uiuc.edu Wed Nov 17 22:02:25 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 22:02:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp Message-ID: <200411180402.iAI42PYq019854@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.15 -> 1.16 --- Log message: Take another .7 seconds off of linear scan time. --- Diffs of the changes: (+5 -3) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.15 llvm/lib/CodeGen/LiveInterval.cpp:1.16 --- llvm/lib/CodeGen/LiveInterval.cpp:1.15 Wed Nov 17 21:47:34 2004 +++ llvm/lib/CodeGen/LiveInterval.cpp Wed Nov 17 22:02:11 2004 @@ -68,14 +68,16 @@ const_iterator je = other.end(); assert((StartPos->start <= i->start || StartPos == other.begin()) && - "Bogus start position hint!"); + StartPos != other.end() && "Bogus start position hint!"); if (i->start < j->start) { i = std::upper_bound(i, ie, j->start); if (i != ranges.begin()) --i; } else if (j->start < i->start) { - j = std::upper_bound(j, je, i->start); - if (j != other.ranges.begin()) --j; + if ((++StartPos)->start <= i->start) { + j = std::upper_bound(j, je, i->start); + if (j != other.ranges.begin()) --j; + } } else { return true; } From lattner at cs.uiuc.edu Wed Nov 17 22:13:14 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 22:13:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200411180413.iAI4DEXk020785@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.100 -> 1.101 --- Log message: Start using the iterators in the fixed_ intervals to avoid having to binary search physreg intervals every time we access it. This takes another half second off of linscan. --- Diffs of the changes: (+12 -5) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.100 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.101 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.100 Wed Nov 17 21:49:30 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 17 22:13:02 2004 @@ -292,6 +292,7 @@ void RA::processInactiveIntervals(unsigned CurPoint) { DEBUG(std::cerr << "\tprocessing inactive intervals:\n"); + for (unsigned i = 0, e = inactive_.size(); i != e; ++i) { LiveInterval *Interval = inactive_[i].first; LiveInterval::iterator IntervalPos = inactive_[i].second; @@ -363,6 +364,8 @@ spillWeights_.assign(mri_->getNumRegs(), 0.0); + unsigned StartPosition = cur->beginNumber(); + // for each interval in active update spill weights for (IntervalPtrs::const_iterator i = active_.begin(), e = active_.end(); i != e; ++i) { @@ -387,13 +390,17 @@ // For every interval in fixed we overlap with, mark the register as not free // and update spill weights. - for (IntervalPtrs::const_iterator i = fixed_.begin(), - e = fixed_.end(); i != e; ++i) - if (cur->overlapsFrom(*i->first, i->second)) { - unsigned reg = i->first->reg; + for (unsigned i = 0, e = fixed_.size(); i != e; ++i) { + IntervalPtr &IP = fixed_[i]; + LiveInterval *I = IP.first; + LiveInterval::iterator II = I->advanceTo(IP.second, StartPosition); + IP.second = II; + if (cur->overlapsFrom(*I, II)) { + unsigned reg = I->reg; prt_->addRegUse(reg); - updateSpillWeights(reg, i->first->weight); + updateSpillWeights(reg, I->weight); } + } unsigned physReg = getFreePhysReg(cur); // restore the physical register tracker From lattner at cs.uiuc.edu Wed Nov 17 22:31:24 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 22:31:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.h Message-ID: <200411180431.iAI4VOkJ022342@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.h updated: 1.12 -> 1.13 --- Log message: Fix typeo --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/LiveInterval.h diff -u llvm/lib/CodeGen/LiveInterval.h:1.12 llvm/lib/CodeGen/LiveInterval.h:1.13 --- llvm/lib/CodeGen/LiveInterval.h:1.12 Wed Nov 17 21:47:34 2004 +++ llvm/lib/CodeGen/LiveInterval.h Wed Nov 17 22:31:10 2004 @@ -89,7 +89,7 @@ /// containing the specified position, or end() if the position is past the /// end of the interval. If no LiveRange contains this position, but the /// position is in a hole, this method returns an iterator pointing the the - /// LiveRange immediately after the hold. + /// LiveRange immediately after the hole. iterator advanceTo(iterator I, unsigned Pos) { if (Pos >= endNumber()) return end(); From lattner at cs.uiuc.edu Wed Nov 17 22:33:45 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 22:33:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200411180433.iAI4Xj7a022358@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.101 -> 1.102 --- Log message: Fix a couple of bugs where we considered physregs past their range as possibly intersecting an interval. --- Diffs of the changes: (+11 -6) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.101 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.102 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.101 Wed Nov 17 22:13:02 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 17 22:33:31 2004 @@ -145,6 +145,7 @@ tm_ = &fn.getTarget(); mri_ = tm_->getRegisterInfo(); li_ = &getAnalysis(); + if (!prt_.get()) prt_.reset(new PhysRegTracker(*mri_)); vrm_.reset(new VirtRegMap(*mf_)); if (!spiller_.get()) spiller_.reset(createSpiller()); @@ -393,12 +394,16 @@ for (unsigned i = 0, e = fixed_.size(); i != e; ++i) { IntervalPtr &IP = fixed_[i]; LiveInterval *I = IP.first; - LiveInterval::iterator II = I->advanceTo(IP.second, StartPosition); - IP.second = II; - if (cur->overlapsFrom(*I, II)) { - unsigned reg = I->reg; - prt_->addRegUse(reg); - updateSpillWeights(reg, I->weight); + if (I->endNumber() > StartPosition) { + LiveInterval::iterator II = I->advanceTo(IP.second, StartPosition); + IP.second = II; + if (II != I->begin() && II->start > StartPosition) + --II; + if (cur->overlapsFrom(*I, II)) { + unsigned reg = I->reg; + prt_->addRegUse(reg); + updateSpillWeights(reg, I->weight); + } } } From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Darwin/DynamicLibrary.cpp Message-ID: <200411180433.WAA12898@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Darwin: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Darwin/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/Darwin/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/Darwin/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- Darwin/DynamicLibrary.cpp - Darwin Dynamic Library -------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Darwin version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Darwin specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/DynamicLibrary.cpp Message-ID: <200411180433.WAA12902@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+47 -0) Index: llvm/lib/System/Win32/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/Win32/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/Win32/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,47 ---- + //===- Win32/DynamicLibrary.cpp - Win32 DL Implementation -------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Win32 specific implementation of the DynamicLibrary + // + //===----------------------------------------------------------------------===// + + #include "Win32.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Win32 specific code + //=== and must not be UNIX code + //===----------------------------------------------------------------------===// + + DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) { + handle = LoadLibrary(filename); + + if (handle == 0) { + char Buffer[100]; + // FIXME: This should use FormatMessage + sprintf(Buffer, "Windows error code %d\n", GetLastError()); + throw std::string(Buffer); + } + } + + DynamicLibrary::~DynamicLibrary() { + if (handle) + FreeLibrary(handle); + } + + void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { + assert(handle !=0 && "Invalid DynamicLibrary handle"); + return GetProcAddress(handle, symbolName); + } + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/AIX/DynamicLibrary.cpp Message-ID: <200411180433.WAA12904@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/AIX: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/AIX/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/AIX/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/AIX/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- AIX/DynamicLibrary.cpp - AIX Dynamic Library -------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the AIX version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only AIX specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/DynamicLibrary.cpp Message-ID: <200411180433.WAA12905@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: DynamicLibrary.cpp added (r1.2) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Linux/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/Linux/DynamicLibrary.cpp:1.2 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/Linux/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- Linux/DynamicLibrary.cpp - Linux Dynamic Library ---------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Linux version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Linux specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/SunOS/DynamicLibrary.cpp Message-ID: <200411180433.WAA12903@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/SunOS: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/SunOS/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/SunOS/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/SunOS/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- SunOS/DynamicLibrary.cpp - SunOS Dynamic Library ---------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the SunOS version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only SunOS specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/DynamicLibrary.cpp Message-ID: <200411180433.WAA12901@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Linux/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/Linux/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/Linux/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- Linux/DynamicLibrary.cpp - Linux Dynamic Library ---------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Linux version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Linux specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/FreeBSD/DynamicLibrary.cpp Message-ID: <200411180433.WAA12919@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/FreeBSD: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/FreeBSD/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/FreeBSD/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/FreeBSD/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- FreeBSD/DynamicLibrary.cpp - FreeBSD Dynamic Library -----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the FreeBSD version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only FreeBSD specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/DynamicLibrary.cpp Message-ID: <200411180433.WAA12921@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+47 -0) Index: llvm/lib/System/Unix/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/Unix/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/Unix/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,47 ---- + //===- Unix/DynamicLibrary.cpp - Generic UNIX Dynamic Library ---*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the generic UNIX variant of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + #include "Unix.h" + + namespace llvm { + using namespace sys; + + + DynamicLibrary::DynamicLibrary(const char *filename) { + #if defined (HAVE_DLOPEN) + if ((handle = dlopen (filename, RTLD_NOW | RTLD_GLOBAL)) == 0) + throw std::string( dlerror() ); + #else + assert (!"Dynamic object linking not implemented for this platform"); + #endif + } + + DynamicLibrary::~DynamicLibrary() { + assert(handle != 0 && "Invalid DynamicLibrary handle"); + #if defined (HAVE_DLOPEN) + dlclose(handle); + #else + assert (!"Dynamic object linking not implemented for this platform"); + #endif + } + + void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { + assert(handle != 0 && "Invalid DynamicLibrary handle"); + #if defined(HAVE_DLOPEN) + return dlsym (handle, symbolName); + #else + assert (0 && "Dynamic symbol lookup not implemented for this platform"); + #endif + } + + } From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/System/DynamicLibrary.h Message-ID: <200411180433.WAA12920@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: DynamicLibrary.h added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+80 -0) Index: llvm/include/llvm/System/DynamicLibrary.h diff -c /dev/null llvm/include/llvm/System/DynamicLibrary.h:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/include/llvm/System/DynamicLibrary.h Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,80 ---- + //===-- llvm/System/DynamicLibrary.h - Portable Dynamic Library -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file declares the sys::DynamicLibrary class. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_SYSTEM_DYNAMIC_LIBRARY_H + #define LLVM_SYSTEM_DYNAMIC_LIBRARY_H + + #include "llvm/System/Path.h" + #include + + namespace llvm { + namespace sys { + + /// This class provides a portable interface to dynamic libraries which also + /// might be known as shared libraries, shared objects, dynamic shared + /// objects, or dynamic link libraries. Regardless of the terminology or the + /// operating system interface, this class provides a portable interface that + /// allows dynamic libraries to be loaded and and searched for externally + /// defined symbols. This is typically used to provide "plug-in" support. + /// @since 1.4 + /// @brief Portable dynamic library abstraction. + class DynamicLibrary { + /// @name Constructors + /// @{ + public: + /// This is the constructor for DynamicLibrary instances. It will open + /// the dynamic library specified by the \filename Path. + /// @throws std::string indicating why the library couldn't be opened. + /// @brief DynamicLibrary constructor + DynamicLibrary(const char* filename); + + /// After destruction, the symbols of the library will no longer be + /// available to the program. It is important to make sure the lifespan + /// of a DynamicLibrary exceeds the lifetime of the pointers returned + /// by the GetAddressOfSymbol otherwise the program may walk off into + /// uncharted territory. + /// @see GetAddressOfSymbol. + /// @brief Closes the DynamicLibrary + ~DynamicLibrary(); + + /// @} + /// @name Accessors + /// @{ + public: + /// Looks up a \p symbolName in the DynamicLibrary and returns its address + /// if it exists. If the symbol does not exist, returns (void*)0. + /// @returns the address of the symbol or 0. + /// @brief Get the address of a symbol in the DynamicLibrary. + void* GetAddressOfSymbol(const char* symbolName); + + /// @brief Convenience function for C++ophiles. + void* GetAddressOfSymbol(const std::string& symbolName) { + return GetAddressOfSymbol(symbolName.c_str()); + } + + /// @} + /// @name Implementation + /// @{ + protected: + void* handle; // Opaque handle for information about the library + + DynamicLibrary(); ///< Do not implement + DynamicLibrary(const DynamicLibrary&); ///< Do not implement + DynamicLibrary& operator=(const DynamicLibrary&); ///< Do not implement + /// @} + }; + + } // End sys namespace + } // End llvm namespace + + #endif // LLVM_SYSTEM_DYNAMIC_LIBRARY_H From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Cygwin/DynamicLibrary.cpp Message-ID: <200411180433.WAA12928@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Cygwin: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Cygwin/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/Cygwin/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/Cygwin/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- Cygwin/DynamicLibrary.cpp - Cygwin Dynamic Library -------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Cygwin version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Cygwin specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Interix/DynamicLibrary.cpp Message-ID: <200411180433.WAA12906@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Interix: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Interix/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/Interix/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/Interix/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,27 ---- + //===- Interix/DynamicLibrary.cpp - Interix Dynamic Library -----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Interix version of DynamicLibrary + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/DynamicLibrary.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Interix specific code + //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Wed Nov 17 22:33:53 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 17 Nov 2004 22:33:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/DynamicLibrary.cpp Message-ID: <200411180433.WAA12931@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: DynamicLibrary.cpp added (r1.1) --- Log message: Dynamic Library abstraction. This makes the abstraction of a single dynamic library (shared library/shared object) whose symbols can be looked up dynamically. Used for plug-ins. --- Diffs of the changes: (+78 -0) Index: llvm/lib/System/DynamicLibrary.cpp diff -c /dev/null llvm/lib/System/DynamicLibrary.cpp:1.1 *** /dev/null Wed Nov 17 22:33:50 2004 --- llvm/lib/System/DynamicLibrary.cpp Wed Nov 17 22:33:40 2004 *************** *** 0 **** --- 1,78 ---- + //===-- DynamicLibrary.cpp - Runtime link/load libraries --------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This header file implements the operating system DynamicLibrary concept. + // + //===----------------------------------------------------------------------===// + + #include "llvm/System/DynamicLibrary.h" + #include "llvm/Config/dlfcn.h" + #include + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only TRULY operating system + //=== independent code. + //===----------------------------------------------------------------------===// + + #ifdef HAVE_LTDL_H + + namespace llvm { + + using namespace sys; + + #ifdef HAVE_LT_DLOPEN + + DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) { + if (0 != lt_dlinit()) + throw std::string(lt_dlerror()); + + handle = lt_dlopen(filename); + + if (handle == 0) + handle = lt_dlopenext(filename); + + if (handle == 0) + throw std::string("Can't open dynamic library:") + filename; + } + + DynamicLibrary::~DynamicLibrary() { + if (handle) + lt_dlclose((lt_dlhandle)handle); + + lt_dlexit(); + } + + void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { + assert(handle != 0 && "Invalid DynamicLibrary handle"); + return lt_dlsym((lt_dlhandle) handle,symbolName); + } + + #else + DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) { + assert(!"Have ltdl.h but not libltdl.a!"); + } + + DynamicLibrary::~DynamicLibrary() { + assert(!"Have ltdl.h but not libltdl.a!"); + } + + void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { + assert(!"Have ltdl.h but not libltdl.a!"); + return 0; + } + + #endif // HAVE_DLOPEN + + } // namespace llvm + + #else // HAVE_LTDL_H + + #include "platform/DynamicLibrary.cpp" + + #endif From natebegeman at mac.com Wed Nov 17 22:57:04 2004 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 17 Nov 2004 22:57:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200411180457.WAA13814@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.102 -> 1.103 --- Log message: Clean up and fix cast codegen by removing cases that are handled elsewhere, and properly emitting signed short to unsigned int. This fixes the last regression vs. the CBE, MultiSource/Applications/hbd. --- Diffs of the changes: (+8 -19) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.102 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.103 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.102 Sun Nov 7 20:25:40 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Wed Nov 17 22:56:53 2004 @@ -3561,16 +3561,11 @@ // handle { byte, short, int } x { byte, short, int } switch (SrcClass) { case cByte: - if (DestClass == cByte) - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); - else - BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg); + BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg); break; case cShort: if (DestClass == cByte) BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg); - else if (DestClass == cShort) - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); else BuildMI(*MBB, IP, PPC::EXTSH, 1, DestReg).addReg(SrcReg); break; @@ -3608,19 +3603,13 @@ // handle u{ byte, short, int } -> { byte, short, int } switch (SrcClass) { case cByte: - if (DestClass == cByte) - // uByte 255 -> signed byte == -1 - BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg); - else - // uByte 255 -> signed short/int == 255 - BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg).addImm(0) - .addImm(24).addImm(31); + // uByte 255 -> signed short/int == 255 + BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg).addImm(0) + .addImm(24).addImm(31); break; case cShort: if (DestClass == cByte) BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg); - else if (DestClass == cShort) - BuildMI(*MBB, IP, PPC::EXTSH, 1, DestReg).addReg(SrcReg); else BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg).addImm(0) .addImm(16).addImm(31); @@ -3660,14 +3649,14 @@ unsigned clearBits = (DestClass == cByte) ? 24 : 16; switch (SrcClass) { case cByte: + BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(SrcReg); + break; case cShort: - if (DestClass == cByte || DestClass == cShort) - // sbyte -1 -> ubyte 0x000000FF + if (DestClass == cByte) BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg) .addImm(0).addImm(clearBits).addImm(31); else - // sbyte -1 -> ubyte 0xFFFFFFFF - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); + BuildMI(*MBB, IP, PPC::EXTSH, 1, DestReg).addReg(SrcReg); break; case cLong: ++SrcReg; From lattner at cs.uiuc.edu Wed Nov 17 23:19:16 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 23:19:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp Message-ID: <200411180519.iAI5JGBF025420@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.16 -> 1.17 --- Log message: Moderate head scratching reveals that this conditional is not needed. If i->start == j->start, then certainly i->end > j->start. --- Diffs of the changes: (+0 -4) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.16 llvm/lib/CodeGen/LiveInterval.cpp:1.17 --- llvm/lib/CodeGen/LiveInterval.cpp:1.16 Wed Nov 17 22:02:11 2004 +++ llvm/lib/CodeGen/LiveInterval.cpp Wed Nov 17 23:19:02 2004 @@ -83,14 +83,10 @@ } while (i != ie && j != je) { - if (i->start == j->start) - return true; - if (i->start > j->start) { std::swap(i, j); std::swap(ie, je); } - assert(i->start < j->start); if (i->end > j->start) return true; From lattner at cs.uiuc.edu Wed Nov 17 23:28:34 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 17 Nov 2004 23:28:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp Message-ID: <200411180528.iAI5SYDk027465@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.17 -> 1.18 --- Log message: There is no need to check to see if j overflowed in this loop as we're only incrementing i. --- Diffs of the changes: (+3 -1) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.17 llvm/lib/CodeGen/LiveInterval.cpp:1.18 --- llvm/lib/CodeGen/LiveInterval.cpp:1.17 Wed Nov 17 23:19:02 2004 +++ llvm/lib/CodeGen/LiveInterval.cpp Wed Nov 17 23:28:21 2004 @@ -82,7 +82,9 @@ return true; } - while (i != ie && j != je) { + if (j == je) return false; + + while (i != ie) { if (i->start > j->start) { std::swap(i, j); std::swap(ie, je); From lattner at cs.uiuc.edu Thu Nov 18 00:01:59 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 00:01:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200411180601.iAI61x6d031170@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.102 -> 1.103 --- Log message: * There is no reason for SpillWeights to be an instance var * Do not put fixed registers into the unhandled set. This means they will never find their way into the inactive, active, or handled sets, so we can simplify a bunch of code. --- Diffs of the changes: (+71 -69) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.102 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.103 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.102 Wed Nov 17 22:33:31 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Thu Nov 18 00:01:45 2004 @@ -73,9 +73,6 @@ std::auto_ptr vrm_; std::auto_ptr spiller_; - typedef std::vector SpillWeights; - SpillWeights spillWeights_; - public: virtual const char* getPassName() const { return "Linear Scan Register Allocator"; @@ -105,10 +102,6 @@ /// ones to the active list. void processInactiveIntervals(unsigned CurPoint); - /// updateSpillWeights - updates the spill weights of the - /// specifed physical register and its weight. - void updateSpillWeights(unsigned reg, SpillWeights::value_type weight); - /// assignRegOrStackSlotAtInterval - assign a register if one /// is available, or spill. void assignRegOrStackSlotAtInterval(LiveInterval* cur); @@ -168,6 +161,22 @@ return true; } +/// initIntervalSets - initialize the interval sets. +/// +void RA::initIntervalSets() +{ + assert(unhandled_.empty() && fixed_.empty() && + active_.empty() && inactive_.empty() && + "interval sets should be empty on initialization"); + + for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { + if (MRegisterInfo::isPhysicalRegister(i->second.reg)) + fixed_.push_back(std::make_pair(&i->second, i->second.begin())); + else + unhandled_.push(&i->second); + } +} + void RA::linearScan() { // linear scan algorithm @@ -190,17 +199,13 @@ processActiveIntervals(cur->beginNumber()); processInactiveIntervals(cur->beginNumber()); - // if this register is fixed we are done - if (MRegisterInfo::isPhysicalRegister(cur->reg)) { - prt_->addRegUse(cur->reg); - active_.push_back(std::make_pair(cur, cur->begin())); - handled_.push_back(cur); - } else { - // otherwise we are allocating a virtual register. try to find a free - // physical register or spill an interval (possibly this one) in order to - // assign it one. - assignRegOrStackSlotAtInterval(cur); - } + assert(MRegisterInfo::isVirtualRegister(cur->reg) && + "Can only allocate virtual registers!"); + + // Allocating a virtual register. try to find a free + // physical register or spill an interval (possibly this one) in order to + // assign it one. + assignRegOrStackSlotAtInterval(cur); DEBUG(printIntervals("active", active_.begin(), active_.end())); DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end())); @@ -213,8 +218,9 @@ i = active_.rbegin(); i != active_.rend(); ) { unsigned reg = i->first->reg; DEBUG(std::cerr << "\tinterval " << *i->first << " expired\n"); - if (MRegisterInfo::isVirtualRegister(reg)) - reg = vrm_->getPhys(reg); + assert(MRegisterInfo::isVirtualRegister(reg) && + "Can only allocate virtual registers!"); + reg = vrm_->getPhys(reg); prt_->delRegUse(reg); i = IntervalPtrs::reverse_iterator(active_.erase(i.base()-1)); } @@ -229,21 +235,6 @@ DEBUG(std::cerr << *vrm_); } -/// initIntervalSets - initialize the interval sets. -/// -void RA::initIntervalSets() -{ - assert(unhandled_.empty() && fixed_.empty() && - active_.empty() && inactive_.empty() && - "interval sets should be empty on initialization"); - - for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i){ - unhandled_.push(&i->second); - if (MRegisterInfo::isPhysicalRegister(i->second.reg)) - fixed_.push_back(std::make_pair(&i->second, i->second.begin())); - } -} - /// processActiveIntervals - expire old intervals and move non-overlapping ones /// to the inactive list. void RA::processActiveIntervals(unsigned CurPoint) @@ -259,8 +250,9 @@ if (IntervalPos == Interval->end()) { // Remove expired intervals. DEBUG(std::cerr << "\t\tinterval " << *Interval << " expired\n"); - if (MRegisterInfo::isVirtualRegister(reg)) - reg = vrm_->getPhys(reg); + assert(MRegisterInfo::isVirtualRegister(reg) && + "Can only allocate virtual registers!"); + reg = vrm_->getPhys(reg); prt_->delRegUse(reg); // Pop off the end of the list. @@ -271,8 +263,9 @@ } else if (IntervalPos->start > CurPoint) { // Move inactive intervals to inactive list. DEBUG(std::cerr << "\t\tinterval " << *Interval << " inactive\n"); - if (MRegisterInfo::isVirtualRegister(reg)) - reg = vrm_->getPhys(reg); + assert(MRegisterInfo::isVirtualRegister(reg) && + "Can only allocate virtual registers!"); + reg = vrm_->getPhys(reg); prt_->delRegUse(reg); // add to inactive. inactive_.push_back(std::make_pair(Interval, IntervalPos)); @@ -311,8 +304,9 @@ } else if (IntervalPos->start <= CurPoint) { // move re-activated intervals in active list DEBUG(std::cerr << "\t\tinterval " << *Interval << " active\n"); - if (MRegisterInfo::isVirtualRegister(reg)) - reg = vrm_->getPhys(reg); + assert(MRegisterInfo::isVirtualRegister(reg) && + "Can only allocate virtual registers!"); + reg = vrm_->getPhys(reg); prt_->addRegUse(reg); // add to active active_.push_back(std::make_pair(Interval, IntervalPos)); @@ -330,11 +324,12 @@ /// updateSpillWeights - updates the spill weights of the specifed physical /// register and its weight. -void RA::updateSpillWeights(unsigned reg, SpillWeights::value_type weight) -{ - spillWeights_[reg] += weight; - for (const unsigned* as = mri_->getAliasSet(reg); *as; ++as) - spillWeights_[*as] += weight; +static void updateSpillWeights(std::vector &Weights, + unsigned reg, float weight, + const MRegisterInfo *MRI) { + Weights[reg] += weight; + for (const unsigned* as = MRI->getAliasSet(reg); *as; ++as) + Weights[*as] += weight; } static RA::IntervalPtrs::iterator FindIntervalInVector(RA::IntervalPtrs &IP, @@ -363,17 +358,19 @@ PhysRegTracker backupPrt = *prt_; - spillWeights_.assign(mri_->getNumRegs(), 0.0); + std::vector SpillWeights; + SpillWeights.assign(mri_->getNumRegs(), 0.0); unsigned StartPosition = cur->beginNumber(); - // for each interval in active update spill weights + // for each interval in active, update spill weights. for (IntervalPtrs::const_iterator i = active_.begin(), e = active_.end(); i != e; ++i) { unsigned reg = i->first->reg; - if (MRegisterInfo::isVirtualRegister(reg)) - reg = vrm_->getPhys(reg); - updateSpillWeights(reg, i->first->weight); + assert(MRegisterInfo::isVirtualRegister(reg) && + "Can only allocate virtual registers!"); + reg = vrm_->getPhys(reg); + updateSpillWeights(SpillWeights, reg, i->first->weight, mri_); } // for every interval in inactive we overlap with, mark the @@ -382,10 +379,11 @@ e = inactive_.end(); i != e; ++i) { if (cur->overlapsFrom(*i->first, i->second-1)) { unsigned reg = i->first->reg; - if (MRegisterInfo::isVirtualRegister(reg)) - reg = vrm_->getPhys(reg); + assert(MRegisterInfo::isVirtualRegister(reg) && + "Can only allocate virtual registers!"); + reg = vrm_->getPhys(reg); prt_->addRegUse(reg); - updateSpillWeights(reg, i->first->weight); + updateSpillWeights(SpillWeights, reg, i->first->weight, mri_); } } @@ -402,7 +400,7 @@ if (cur->overlapsFrom(*I, II)) { unsigned reg = I->reg; prt_->addRegUse(reg); - updateSpillWeights(reg, I->weight); + updateSpillWeights(SpillWeights, reg, I->weight, mri_); } } } @@ -431,8 +429,8 @@ for (TargetRegisterClass::iterator i = rc->allocation_order_begin(*mf_); i != rc->allocation_order_end(*mf_); ++i) { unsigned reg = *i; - if (minWeight > spillWeights_[reg]) { - minWeight = spillWeights_[reg]; + if (minWeight > SpillWeights[reg]) { + minWeight = SpillWeights[reg]; minReg = reg; } } @@ -492,7 +490,7 @@ // mark our rollback point. for (IntervalPtrs::iterator i = active_.begin(); i != active_.end(); ++i) { unsigned reg = i->first->reg; - if (MRegisterInfo::isVirtualRegister(reg) && + if (//MRegisterInfo::isVirtualRegister(reg) && toSpill[vrm_->getPhys(reg)] && cur->overlapsFrom(*i->first, i->second)) { DEBUG(std::cerr << "\t\t\tspilling(a): " << *i->first << '\n'); @@ -506,7 +504,7 @@ } for (IntervalPtrs::iterator i = inactive_.begin(); i != inactive_.end(); ++i){ unsigned reg = i->first->reg; - if (MRegisterInfo::isVirtualRegister(reg) && + if (//MRegisterInfo::isVirtualRegister(reg) && toSpill[vrm_->getPhys(reg)] && cur->overlapsFrom(*i->first, i->second-1)) { DEBUG(std::cerr << "\t\t\tspilling(i): " << *i->first << '\n'); @@ -538,6 +536,7 @@ if ((it = FindIntervalInVector(active_, i)) != active_.end()) { active_.erase(it); if (MRegisterInfo::isPhysicalRegister(i->reg)) { + assert(0 && "daksjlfd"); prt_->delRegUse(i->reg); unhandled_.push(i); } else { @@ -548,17 +547,18 @@ } } else if ((it = FindIntervalInVector(inactive_, i)) != inactive_.end()) { inactive_.erase(it); - if (MRegisterInfo::isPhysicalRegister(i->reg)) + if (MRegisterInfo::isPhysicalRegister(i->reg)) { + assert(0 && "daksjlfd"); unhandled_.push(i); - else { + } else { if (!spilled.count(i->reg)) unhandled_.push(i); vrm_->clearVirt(i->reg); } - } - else { - if (MRegisterInfo::isVirtualRegister(i->reg)) - vrm_->clearVirt(i->reg); + } else { + assert(MRegisterInfo::isVirtualRegister(i->reg) && + "Can only allocate virtual registers!"); + vrm_->clearVirt(i->reg); unhandled_.push(i); } } @@ -578,9 +578,10 @@ HI->expiredAt(cur->beginNumber())) { DEBUG(std::cerr << "\t\t\tundo changes for: " << *HI << '\n'); active_.push_back(std::make_pair(HI, HI->begin())); - if (MRegisterInfo::isPhysicalRegister(HI->reg)) + if (MRegisterInfo::isPhysicalRegister(HI->reg)) { + assert(0 &&"sdflkajsdf"); prt_->addRegUse(HI->reg); - else + } else prt_->addRegUse(vrm_->getPhys(HI->reg)); } } @@ -598,8 +599,9 @@ for (IntervalPtrs::iterator i = inactive_.begin(), e = inactive_.end(); i != e; ++i) { unsigned reg = i->first->reg; - if (MRegisterInfo::isVirtualRegister(reg)) - reg = vrm_->getPhys(reg); + assert(MRegisterInfo::isVirtualRegister(reg) && + "Can only allocate virtual registers!"); + reg = vrm_->getPhys(reg); ++inactiveCounts[reg]; } From natebegeman at mac.com Thu Nov 18 00:51:40 2004 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 18 Nov 2004 00:51:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200411180651.AAA16351@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.103 -> 1.104 --- Log message: When accessing the base register for global variables, use the register directly rather than making a copy for the register allocator to coalesce. This kills thousands of live intervals across the testsuite. --- Diffs of the changes: (+13 -19) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.103 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.104 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.103 Wed Nov 17 22:56:53 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Thu Nov 18 00:51:29 2004 @@ -417,12 +417,12 @@ Value *Cond, Value *TrueVal, Value *FalseVal, unsigned DestReg); - /// copyGlobalBaseToRegister - Output the instructions required to put the - /// base address to use for accessing globals into a register. + /// getGlobalBaseReg - Output the instructions required to put the + /// base address to use for accessing globals into a register. Returns the + /// register containing the base address. /// - void copyGlobalBaseToRegister(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned R); + unsigned getGlobalBaseReg(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP); /// copyConstantToRegister - Output the instructions required to put the /// specified constant into the specified register. @@ -587,12 +587,11 @@ } -/// copyGlobalBaseToRegister - Output the instructions required to put the +/// getGlobalBaseReg - Output the instructions required to put the /// base address to use for accessing globals into a register. /// -void PPC32ISel::copyGlobalBaseToRegister(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned R) { +unsigned PPC32ISel::getGlobalBaseReg(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP) { if (!GlobalBaseInitialized) { // Insert the set of GlobalBaseReg into the first MBB of the function MachineBasicBlock &FirstMBB = F->front(); @@ -602,10 +601,7 @@ BuildMI(FirstMBB, MBBI, PPC::MFLR, 1, GlobalBaseReg).addReg(PPC::LR); GlobalBaseInitialized = true; } - // Emit our copy of GlobalBaseReg to the destination register in the - // current MBB - BuildMI(*MBB, IP, PPC::OR, 2, R).addReg(GlobalBaseReg) - .addReg(GlobalBaseReg); + return GlobalBaseReg; } /// copyConstantToRegister - Output the instructions required to put the @@ -691,9 +687,8 @@ unsigned Reg1 = makeAnotherReg(Type::IntTy); unsigned Opcode = (Ty == Type::FloatTy) ? PPC::LFS : PPC::LFD; // Move value at base + distance into return reg - copyGlobalBaseToRegister(MBB, IP, GlobalBase); - BuildMI(*MBB, IP, PPC::LOADHiAddr, 2, Reg1).addReg(GlobalBase) - .addConstantPoolIndex(CPI); + BuildMI(*MBB, IP, PPC::LOADHiAddr, 2, Reg1) + .addReg(getGlobalBaseReg(MBB, IP)).addConstantPoolIndex(CPI); BuildMI(*MBB, IP, Opcode, 2, R).addConstantPoolIndex(CPI).addReg(Reg1); } else if (isa(C)) { // Copy zero (null pointer) to the register. @@ -708,9 +703,8 @@ || dyn_cast(GV)) ? PPC::LWZ : PPC::LA; // Move value at base + distance into return reg - copyGlobalBaseToRegister(MBB, IP, GlobalBase); - BuildMI(*MBB, IP, PPC::LOADHiAddr, 2, TmpReg).addReg(GlobalBase) - .addGlobalAddress(GV); + BuildMI(*MBB, IP, PPC::LOADHiAddr, 2, TmpReg) + .addReg(getGlobalBaseReg(MBB, IP)).addGlobalAddress(GV); BuildMI(*MBB, IP, Opcode, 2, R).addGlobalAddress(GV).addReg(TmpReg); // Add the GV to the list of things whose addresses have been taken. From natebegeman at mac.com Thu Nov 18 01:22:56 2004 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 18 Nov 2004 01:22:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200411180722.BAA16776@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.104 -> 1.105 --- Log message: Eliminate another common source of moves that the register allocator shouldn't be forced to coalesce for us: folded GEP operations. This too fires thousands of times across the testsuite. --- Diffs of the changes: (+4 -5) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.104 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.105 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.104 Thu Nov 18 00:51:29 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Thu Nov 18 01:22:46 2004 @@ -3834,8 +3834,6 @@ // We now have a base register, an index register, and possibly a constant // remainder. If the GEP is going to be folded, we try to generate the // optimal addressing mode. - unsigned TargetReg = getReg(GEPI, MBB, IP); - unsigned basePtrReg = getReg(Src, MBB, IP); ConstantSInt *remainder = ConstantSInt::get(Type::IntTy, constValue); // If we are emitting this during a fold, copy the current base register to @@ -3853,14 +3851,15 @@ indexReg = TmpReg; remainder = 0; } - BuildMI (*MBB, IP, PPC::OR, 2, TargetReg).addReg(basePtrReg) - .addReg(basePtrReg); - GEPMap[GEPI] = FoldedGEP(TargetReg, indexReg, remainder); + unsigned basePtrReg = getReg(Src, MBB, IP); + GEPMap[GEPI] = FoldedGEP(basePtrReg, indexReg, remainder); return; } // We're not folding, so collapse the base, index, and any remainder into the // destination register. + unsigned TargetReg = getReg(GEPI, MBB, IP); + unsigned basePtrReg = getReg(Src, MBB, IP); if (indexReg != 0) { unsigned TmpReg = makeAnotherReg(Type::IntTy); BuildMI(*MBB, IP, PPC::ADD, 2, TmpReg).addReg(indexReg).addReg(basePtrReg); From reid at x10sys.com Thu Nov 18 03:47:48 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 03:47:48 -0600 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200411180947.DAA07263@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.135 -> 1.136 --- Log message: Changes for testing presence of ltdl.h and lt_dlopen(), libtool functions for cross-platform dynamic loading of shared objects. --- Diffs of the changes: (+148 -309) Index: llvm/configure diff -u llvm/configure:1.135 llvm/configure:1.136 --- llvm/configure:1.135 Sun Nov 7 17:29:39 2004 +++ llvm/configure Thu Nov 18 03:47:36 2004 @@ -3637,6 +3637,8 @@ fi + + # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -4188,7 +4190,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4191 "configure"' > conftest.$ac_ext + echo '#line 4193 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5062,7 +5064,7 @@ # Provide some information about the compiler. -echo "$as_me:5065:" \ +echo "$as_me:5067:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5983,7 +5985,7 @@ ;; esac -enable_dlopen=no +enable_dlopen=yes enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. @@ -6119,11 +6121,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6122: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6124: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6126: \$? = $ac_status" >&5 + echo "$as_me:6128: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6362,11 +6364,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6365: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6367: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6369: \$? = $ac_status" >&5 + echo "$as_me:6371: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6422,11 +6424,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6425: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6427: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6429: \$? = $ac_status" >&5 + echo "$as_me:6431: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8607,7 +8609,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10903: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10905: \$? = $ac_status" >&5 + echo "$as_me:10907: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10958,11 +10960,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10961: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10963: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10965: \$? = $ac_status" >&5 + echo "$as_me:10967: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12319,7 +12321,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13259: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13261: \$? = $ac_status" >&5 + echo "$as_me:13263: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13314,11 +13316,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13317: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13319: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13321: \$? = $ac_status" >&5 + echo "$as_me:13323: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15353,11 +15355,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15356: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15358: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15360: \$? = $ac_status" >&5 + echo "$as_me:15362: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15596,11 +15598,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15599: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15601: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15603: \$? = $ac_status" >&5 + echo "$as_me:15605: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15656,11 +15658,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15659: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15661: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15663: \$? = $ac_status" >&5 + echo "$as_me:15665: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17841,7 +17843,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 -echo $ECHO_N "checking for BZ2_bzCompressInit in -lbz2... $ECHO_C" >&6 -if test "${ac_cv_lib_bz2_BZ2_bzCompressInit+set}" = set; then +echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 +echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_gzopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lbz2 $LIBS" +LIBS="-lz $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -19333,11 +19335,11 @@ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char BZ2_bzCompressInit (); +char gzopen (); int main () { -BZ2_bzCompressInit (); +gzopen (); ; return 0; } @@ -19364,53 +19366,70 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_bz2_BZ2_bzCompressInit=yes + ac_cv_lib_z_gzopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_bz2_BZ2_bzCompressInit=no +ac_cv_lib_z_gzopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_BZ2_bzCompressInit" >&5 -echo "${ECHO_T}$ac_cv_lib_bz2_BZ2_bzCompressInit" >&6 -if test $ac_cv_lib_bz2_BZ2_bzCompressInit = yes; then - bzip2_found=1 +echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 +echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6 +if test $ac_cv_lib_z_gzopen = yes; then + zlib_found=1 else - bzip2_found=0 + zlib_found=0 fi +if test $zlib_found -eq 1; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ZLIB 1 +_ACEOF + + HAVE_ZLIB=1 + +else + HAVE_ZLIB=0 -for ac_header in bzlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +echo "$as_me:$LINENO: checking for BZ2_bzCompressInit in -lbz2" >&5 +echo $ECHO_N "checking for BZ2_bzCompressInit in -lbz2... $ECHO_C" >&6 +if test "${ac_cv_lib_bz2_BZ2_bzCompressInit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbz2 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char BZ2_bzCompressInit (); +int +main () +{ +BZ2_bzCompressInit (); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -19424,124 +19443,51 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_lib_bz2_BZ2_bzCompressInit=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_lib_bz2_BZ2_bzCompressInit=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes +echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_BZ2_bzCompressInit" >&5 +echo "${ECHO_T}$ac_cv_lib_bz2_BZ2_bzCompressInit" >&6 +if test $ac_cv_lib_bz2_BZ2_bzCompressInit = yes; then + bzip2_found=1 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no + bzip2_found=0 fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to llvmbugs at cs.uiuc.edu ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test $bzip2_found -eq 1 ; then -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_BZIP2 1 _ACEOF - bzlib_h_found=1 + + HAVE_BZIP2=1 + else - bzlib_h_found=0 -fi + HAVE_BZIP2=0 -done +fi -echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 -echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6 -if test "${ac_cv_lib_z_gzopen+set}" = set; then +echo "$as_me:$LINENO: checking for library containing lt_dlopen" >&5 +echo $ECHO_N "checking for library containing lt_dlopen... $ECHO_C" >&6 +if test "${ac_cv_search_lt_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" + ac_func_search_save_LIBS=$LIBS +ac_cv_search_lt_dlopen=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -19555,11 +19501,11 @@ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char gzopen (); +char lt_dlopen (); int main () { -gzopen (); +lt_dlopen (); ; return 0; } @@ -19586,53 +19532,42 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_z_gzopen=yes + ac_cv_search_lt_dlopen="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_z_gzopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 -echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6 -if test $ac_cv_lib_z_gzopen = yes; then - zlib_found=1 -else - zlib_found=0 -fi - - -for ac_header in zlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF +if test "$ac_cv_search_lt_dlopen" = no; then + for ac_lib in ltdl; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char lt_dlopen (); +int +main () +{ +lt_dlopen (); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -19646,141 +19581,42 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + ac_cv_search_lt_dlopen="-l$ac_lib" +break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to llvmbugs at cs.uiuc.edu ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - zlib_h_found=1 -else - zlib_h_found=0 +LIBS=$ac_func_search_save_LIBS fi - -done - -if test $zlib_found -eq 1 -a $zlib_h_found -eq 1; then +echo "$as_me:$LINENO: result: $ac_cv_search_lt_dlopen" >&5 +echo "${ECHO_T}$ac_cv_search_lt_dlopen" >&6 +if test "$ac_cv_search_lt_dlopen" != no; then + test "$ac_cv_search_lt_dlopen" = "none required" || LIBS="$ac_cv_search_lt_dlopen $LIBS" cat >>confdefs.h <<\_ACEOF -#define HAVE_ZLIB 1 +#define HAVE_LT_DLOPEN 1 _ACEOF - HAVE_ZLIB=1 - else - HAVE_ZLIB=0 - + { echo "$as_me:$LINENO: WARNING: lt_dlopen() not found - plugin support might + not be available" >&5 +echo "$as_me: WARNING: lt_dlopen() not found - plugin support might + not be available" >&2;} fi -if test $bzip2_found -eq 1 -a $bzlib_h_found -eq 1 ; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_BZIP2 1 -_ACEOF - HAVE_BZIP2=1 -else - HAVE_BZIP2=0 - -fi echo "$as_me:$LINENO: checking for library containing dlopen" >&5 echo $ECHO_N "checking for library containing dlopen... $ECHO_C" >&6 if test "${ac_cv_search_dlopen+set}" = set; then @@ -20426,7 +20262,10 @@ -for ac_header in fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h sys/resource.h dlfcn.h link.h execinfo.h windows.h + + + +for ac_header in fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h sys/resource.h dlfcn.h ltdl.h link.h execinfo.h windows.h bzlib.h zlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then From reid at x10sys.com Thu Nov 18 03:47:48 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 03:47:48 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200411180947.DAA07260@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.128 -> 1.129 --- Log message: Changes for testing presence of ltdl.h and lt_dlopen(), libtool functions for cross-platform dynamic loading of shared objects. --- Diffs of the changes: (+19 -9) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.128 llvm/autoconf/configure.ac:1.129 --- llvm/autoconf/configure.ac:1.128 Sun Nov 7 17:29:39 2004 +++ llvm/autoconf/configure.ac Thu Nov 18 03:47:37 2004 @@ -203,6 +203,7 @@ dnl Checks for other tools AC_PROG_FLEX AC_PROG_BISON +AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL AC_PATH_PROG(TAR,[tar],[gtar]) @@ -252,23 +253,32 @@ dnl libelf is for sparc only; we can ignore it if we don't have it AC_CHECK_LIB(elf, elf_begin) -dnl Check for bzip2 and zlib compression libraries needed for archive reading/writing -AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[bzip2_found=1],[bzip2_found=0]) -AC_CHECK_HEADERS([bzlib.h],[bzlib_h_found=1],[bzlib_h_found=0],[]) +dnl Check for bzip2 and zlib compression libraries needed for archive +dnl and bytecode compression. AC_CHECK_LIB(z,gzopen,[zlib_found=1],[zlib_found=0]) -AC_CHECK_HEADERS([zlib.h],[zlib_h_found=1],[zlib_h_found=0],[]) -if test $zlib_found -eq 1 -a $zlib_h_found -eq 1; then - AC_DEFINE([HAVE_ZLIB],[1],[Define if zlib library is available on this platform.]) +if test $zlib_found -eq 1; then + AC_DEFINE([HAVE_ZLIB],[1], + [Define if zlib library is available on this platform.]) AC_SUBST([HAVE_ZLIB],[1]) else AC_SUBST([HAVE_ZLIB],[0]) fi -if test $bzip2_found -eq 1 -a $bzlib_h_found -eq 1 ; then - AC_DEFINE([HAVE_BZIP2],[1],[Define if bzip2 library is available on this platform.]) + +AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[bzip2_found=1],[bzip2_found=0]) +if test $bzip2_found -eq 1 ; then + AC_DEFINE([HAVE_BZIP2],[1], + [Define if bzip2 library is available on this platform.]) AC_SUBST([HAVE_BZIP2],[1]) else AC_SUBST([HAVE_BZIP2],[0]) fi + +dnl lt_dlopen may be required for plugin support. +AC_SEARCH_LIBS(lt_dlopen,ltdl,AC_DEFINE([HAVE_LT_DLOPEN],[1], + [Define if lt_dlopen() is available on this platform]), + AC_MSG_WARN([lt_dlopen() not found - plugin support might + not be available])) + dnl dlopen() is required for plugin support. AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],[Define if dlopen() is available on this platform.]),AC_MSG_WARN([dlopen() not found - disabling plugin support])) @@ -287,7 +297,7 @@ AC_HEADER_SYS_WAIT dnl Checks for POSIX and other various system-specific header files -AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h sys/resource.h dlfcn.h link.h execinfo.h windows.h) +AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h sys/resource.h dlfcn.h ltdl.h link.h execinfo.h windows.h bzlib.h zlib.h]) dnl Check for things that need to be included in public headers, and so dnl for which we may not have access to a HAVE_* preprocessor #define. From reid at x10sys.com Thu Nov 18 03:49:25 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 03:49:25 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200411180949.DAA07368@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.34 -> 1.35 --- Log message: Add checks for HAVE_LTDL_H and HAVE_LT_DLOPEN --- Diffs of the changes: (+6 -0) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.34 llvm/include/llvm/Config/config.h.in:1.35 --- llvm/include/llvm/Config/config.h.in:1.34 Thu Oct 28 00:06:45 2004 +++ llvm/include/llvm/Config/config.h.in Thu Nov 18 03:49:13 2004 @@ -103,6 +103,12 @@ the current directory to the dynamic linker search path. */ #undef HAVE_LINK_R +/* Define to 1 if you have the header file. */ +#undef HAVE_LTDL_H + +/* Define if lt_dlopen() is available on this platform */ +#undef HAVE_LT_DLOPEN + /* Define if mallinfo() is available on this platform. */ #undef HAVE_MALLINFO From reid at x10sys.com Thu Nov 18 03:50:11 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 03:50:11 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/dlfcn.h Message-ID: <200411180950.DAA07408@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: dlfcn.h updated: 1.5 -> 1.6 --- Log message: Include ltdl.h if we have it. --- Diffs of the changes: (+4 -0) Index: llvm/include/llvm/Config/dlfcn.h diff -u llvm/include/llvm/Config/dlfcn.h:1.5 llvm/include/llvm/Config/dlfcn.h:1.6 --- llvm/include/llvm/Config/dlfcn.h:1.5 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/Config/dlfcn.h Thu Nov 18 03:50:00 2004 @@ -16,6 +16,10 @@ #include "llvm/Config/config.h" +#ifdef HAVE_LTDL_H +#include +#endif + #ifdef HAVE_DLFCN_H #include #endif From reid at x10sys.com Thu Nov 18 04:03:58 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 04:03:58 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200411181003.EAA11855@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.236 -> 1.237 --- Log message: Fix PR456: http://llvm.cs.uiuc.edu/PR456 :\ Tools and libraries will be built into $(BUILD_OBJ_ROOT)/$(BuildMode)/bin and \ $(BUILD_OBJ_ROOT)/$(BuildMode)/lib, respectively. Furthermore, the example \ programs will go in $(BUILD_OBJ_ROOT)/$(BuildMode)/examples to keep them \ separate from the tools and hopefully out of the PATH. Install targets \ have not changed. --- Diffs of the changes: (+24 -8) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.236 llvm/Makefile.rules:1.237 --- llvm/Makefile.rules:1.236 Wed Nov 17 13:08:44 2004 +++ llvm/Makefile.rules Thu Nov 18 04:03:46 2004 @@ -176,10 +176,12 @@ # Directory locations #-------------------------------------------------------------------- ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode) -LibDir := $(BUILD_OBJ_ROOT)/lib/$(BuildMode) -ToolDir := $(BUILD_OBJ_ROOT)/tools/$(BuildMode) -LLVMLibDir := $(LLVM_OBJ_ROOT)/lib/$(BuildMode) -LLVMToolDir := $(LLVM_OBJ_ROOT)/tools/$(BuildMode) +LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib +ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/tools +ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples +LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib +LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/tools +LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples #-------------------------------------------------------------------- # Full Paths To Compiled Tools and Utilities @@ -248,8 +250,12 @@ # Adjust linker flags for building an executable ifdef TOOLNAME +ifdef EXAMPLE_TOOL + LD.Flags += -rpath $(ExmplDir) -export-dynamic +else LD.Flags += -rpath $(ToolDir) -export-dynamic endif +endif #---------------------------------------------------------- # Options To Invoke Tools @@ -337,8 +343,8 @@ $(Verb) $(MKDIR) $* > /dev/null @$(DATE) > $@ -.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(LLVMLibDir)/.dir -.PRECIOUS: $(LLVMToolDir)/.dir +.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir +.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir #--------------------------------------------------------- # Handle the DIRS options for sequential construction @@ -609,7 +615,11 @@ #--------------------------------------------------------- # Set up variables for building a tool. #--------------------------------------------------------- +ifdef EXAMPLE_TOOL +ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT) +else ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT) +endif ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions)) LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS))) @@ -647,8 +657,13 @@ -$(Verb) $(RM) -f $(ToolBuildPath) endif -$(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)\ - $(ToolDir)/.dir +ifdef EXAMPLE_TOOL +$(ToolBuildPath): $(ExmplDir)/.dir +else +$(ToolBuildPath): $(ToolDir)/.dir +endif + +$(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) @@ -1194,6 +1209,7 @@ $(Echo) "ObjDir : " '$(ObjDir)' $(Echo) "LibDir : " '$(LibDir)' $(Echo) "ToolDir : " '$(ToolDir)' + $(Echo) "ExmplDir : " '$(ExmplDir)' $(Echo) "TDFiles : " '$(TDFiles)' $(Echo) "INCFiles : " '$(INCFiles)' $(Echo) "Compile.CXX : " '$(Compile.CXX)' From reid at x10sys.com Thu Nov 18 04:04:06 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 04:04:06 -0600 Subject: [llvm-commits] CVS: llvm/examples/Fibonacci/Makefile Message-ID: <200411181004.EAA11863@zion.cs.uiuc.edu> Changes in directory llvm/examples/Fibonacci: Makefile updated: 1.5 -> 1.6 --- Log message: Fix PR456: http://llvm.cs.uiuc.edu/PR456 :\ Tools and libraries will be built into $(BUILD_OBJ_ROOT)/$(BuildMode)/bin and \ $(BUILD_OBJ_ROOT)/$(BuildMode)/lib, respectively. Furthermore, the example \ programs will go in $(BUILD_OBJ_ROOT)/$(BuildMode)/examples to keep them \ separate from the tools and hopefully out of the PATH. Install targets \ have not changed. --- Diffs of the changes: (+1 -0) Index: llvm/examples/Fibonacci/Makefile diff -u llvm/examples/Fibonacci/Makefile:1.5 llvm/examples/Fibonacci/Makefile:1.6 --- llvm/examples/Fibonacci/Makefile:1.5 Thu Oct 14 14:02:10 2004 +++ llvm/examples/Fibonacci/Makefile Thu Nov 18 04:03:47 2004 @@ -9,6 +9,7 @@ LEVEL = ../.. TOOLNAME = Fibonacci +EXAMPLE_TOOL = 1 # Enable JIT support include $(LEVEL)/tools/Makefile.JIT From reid at x10sys.com Thu Nov 18 04:03:58 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 04:03:58 -0600 Subject: [llvm-commits] CVS: llvm/examples/BFtoLLVM/Makefile Message-ID: <200411181003.EAA11858@zion.cs.uiuc.edu> Changes in directory llvm/examples/BFtoLLVM: Makefile updated: 1.1 -> 1.2 --- Log message: Fix PR456: http://llvm.cs.uiuc.edu/PR456 :\ Tools and libraries will be built into $(BUILD_OBJ_ROOT)/$(BuildMode)/bin and \ $(BUILD_OBJ_ROOT)/$(BuildMode)/lib, respectively. Furthermore, the example \ programs will go in $(BUILD_OBJ_ROOT)/$(BuildMode)/examples to keep them \ separate from the tools and hopefully out of the PATH. Install targets \ have not changed. --- Diffs of the changes: (+1 -0) Index: llvm/examples/BFtoLLVM/Makefile diff -u llvm/examples/BFtoLLVM/Makefile:1.1 llvm/examples/BFtoLLVM/Makefile:1.2 --- llvm/examples/BFtoLLVM/Makefile:1.1 Tue Oct 5 13:05:26 2004 +++ llvm/examples/BFtoLLVM/Makefile Thu Nov 18 04:03:47 2004 @@ -9,4 +9,5 @@ LEVEL = ../.. TOOLNAME = BFtoLLVM +EXAMPLE_TOOL = 1 include $(LEVEL)/Makefile.common From reid at x10sys.com Thu Nov 18 04:04:06 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 04:04:06 -0600 Subject: [llvm-commits] CVS: llvm/examples/ModuleMaker/Makefile Message-ID: <200411181004.EAA11864@zion.cs.uiuc.edu> Changes in directory llvm/examples/ModuleMaker: Makefile updated: 1.6 -> 1.7 --- Log message: Fix PR456: http://llvm.cs.uiuc.edu/PR456 :\ Tools and libraries will be built into $(BUILD_OBJ_ROOT)/$(BuildMode)/bin and \ $(BUILD_OBJ_ROOT)/$(BuildMode)/lib, respectively. Furthermore, the example \ programs will go in $(BUILD_OBJ_ROOT)/$(BuildMode)/examples to keep them \ separate from the tools and hopefully out of the PATH. Install targets \ have not changed. --- Diffs of the changes: (+1 -0) Index: llvm/examples/ModuleMaker/Makefile diff -u llvm/examples/ModuleMaker/Makefile:1.6 llvm/examples/ModuleMaker/Makefile:1.7 --- llvm/examples/ModuleMaker/Makefile:1.6 Wed Oct 27 18:18:44 2004 +++ llvm/examples/ModuleMaker/Makefile Thu Nov 18 04:03:47 2004 @@ -8,6 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL=../.. TOOLNAME=ModuleMaker +EXAMPLE_TOOL = 1 USEDLIBS= LLVMBCWriter LLVMCore LLVMSupport.a LLVMSystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Thu Nov 18 04:04:06 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 04:04:06 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.rules Message-ID: <200411181004.EAA11865@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.rules updated: 1.1 -> 1.2 --- Log message: Fix PR456: http://llvm.cs.uiuc.edu/PR456 :\ Tools and libraries will be built into $(BUILD_OBJ_ROOT)/$(BuildMode)/bin and \ $(BUILD_OBJ_ROOT)/$(BuildMode)/lib, respectively. Furthermore, the example \ programs will go in $(BUILD_OBJ_ROOT)/$(BuildMode)/examples to keep them \ separate from the tools and hopefully out of the PATH. Install targets \ have not changed. --- Diffs of the changes: (+27 -27) Index: llvm-test/Makefile.rules diff -u llvm-test/Makefile.rules:1.1 llvm-test/Makefile.rules:1.2 --- llvm-test/Makefile.rules:1.1 Fri Oct 22 10:58:13 2004 +++ llvm-test/Makefile.rules Thu Nov 18 04:03:47 2004 @@ -165,23 +165,23 @@ ########################################################################### # Libraries that are being built -DESTLIBDEBUG := $(BUILD_OBJ_ROOT)/lib/Debug -DESTLIBRELEASE := $(BUILD_OBJ_ROOT)/lib/Release -DESTLIBPROFILE := $(BUILD_OBJ_ROOT)/lib/Profile -DESTLIBBYTECODE := $(BUILD_OBJ_ROOT)/lib/BytecodeLibs -DESTLIBCURRENT := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) +DESTLIBDEBUG := $(BUILD_OBJ_ROOT)/Debug/lib +DESTLIBRELEASE := $(BUILD_OBJ_ROOT)/Release/lib +DESTLIBPROFILE := $(BUILD_OBJ_ROOT)/Profile/lib +DESTLIBBYTECODE := $(BUILD_OBJ_ROOT)/BytecodeLibs/lib +DESTLIBCURRENT := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/lib # LLVM libraries used for linking -LLVMLIBDEBUGSOURCE := $(LLVM_OBJ_ROOT)/lib/Debug -LLVMLIBRELEASESOURCE := $(LLVM_OBJ_ROOT)/lib/Release -LLVMLIBPROFILESOURCE := $(LLVM_OBJ_ROOT)/lib/Profile -LLVMLIBCURRENTSOURCE := $(LLVM_OBJ_ROOT)/lib/$(CONFIGURATION) +LLVMLIBDEBUGSOURCE := $(LLVM_OBJ_ROOT)/Debug/lib +LLVMLIBRELEASESOURCE := $(LLVM_OBJ_ROOT)/Release/lib +LLVMLIBPROFILESOURCE := $(LLVM_OBJ_ROOT)/Profile/lib +LLVMLIBCURRENTSOURCE := $(LLVM_OBJ_ROOT)/$(CONFIGURATION)/lib # Libraries that were built that will now be used for linking -PROJLIBDEBUGSOURCE := $(BUILD_OBJ_ROOT)/lib/Debug -PROJLIBRELEASESOURCE := $(BUILD_OBJ_ROOT)/lib/Release -PROJLIBPROFILESOURCE := $(BUILD_OBJ_ROOT)/lib/Profile -PROJLIBCURRENTSOURCE := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) +PROJLIBDEBUGSOURCE := $(BUILD_OBJ_ROOT)/Debug/lib +PROJLIBRELEASESOURCE := $(BUILD_OBJ_ROOT)/Release/lib +PROJLIBPROFILESOURCE := $(BUILD_OBJ_ROOT)/Profile/lib +PROJLIBCURRENTSOURCE := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/lib ########################################################################### # Tool Locations @@ -192,20 +192,20 @@ # PROJ* = Location of previously built tools used for linking. ########################################################################### -DESTTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug -DESTTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release -DESTTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile -DESTTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION) - -LLVMTOOLDEBUG := $(LLVM_OBJ_ROOT)/tools/Debug -LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/tools/Release -LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/tools/Profile -LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/tools/$(CONFIGURATION) - -PROJTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug -PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release -PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile -PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION) +DESTTOOLDEBUG := $(BUILD_OBJ_ROOT)/Debug/tools +DESTTOOLRELEASE := $(BUILD_OBJ_ROOT)/Release/tools +DESTTOOLPROFILE := $(BUILD_OBJ_ROOT)/Profile/tools +DESTTOOLCURRENT := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/tools + +LLVMTOOLDEBUG := $(LLVM_OBJ_ROOT)/Debug/tools +LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/Release/tools +LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/Profile/tools +LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/$(CONFIGURATION)/tools + +PROJTOOLDEBUG := $(BUILD_OBJ_ROOT)/Debug/tools +PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/Release/tools +PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/Profile/tools +PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/tools # # Libtool is found in the current directory. From reid at x10sys.com Thu Nov 18 04:04:06 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 04:04:06 -0600 Subject: [llvm-commits] CVS: llvm/examples/HowToUseJIT/Makefile Message-ID: <200411181004.EAA11866@zion.cs.uiuc.edu> Changes in directory llvm/examples/HowToUseJIT: Makefile updated: 1.6 -> 1.7 --- Log message: Fix PR456: http://llvm.cs.uiuc.edu/PR456 :\ Tools and libraries will be built into $(BUILD_OBJ_ROOT)/$(BuildMode)/bin and \ $(BUILD_OBJ_ROOT)/$(BuildMode)/lib, respectively. Furthermore, the example \ programs will go in $(BUILD_OBJ_ROOT)/$(BuildMode)/examples to keep them \ separate from the tools and hopefully out of the PATH. Install targets \ have not changed. --- Diffs of the changes: (+1 -0) Index: llvm/examples/HowToUseJIT/Makefile diff -u llvm/examples/HowToUseJIT/Makefile:1.6 llvm/examples/HowToUseJIT/Makefile:1.7 --- llvm/examples/HowToUseJIT/Makefile:1.6 Thu Oct 14 14:02:13 2004 +++ llvm/examples/HowToUseJIT/Makefile Thu Nov 18 04:03:47 2004 @@ -8,6 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = HowToUseJIT +EXAMPLE_TOOL = 1 # Enable JIT support include $(LEVEL)/tools/Makefile.JIT From reid at x10sys.com Thu Nov 18 11:19:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 11:19:08 -0600 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200411181719.LAA12612@zion.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.31 -> 1.32 --- Log message: Alter path locations for PR456: http://llvm.cs.uiuc.edu/PR456 . --- Diffs of the changes: (+20 -20) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.31 llvm/test/QMTest/llvm.py:1.32 --- llvm/test/QMTest/llvm.py:1.31 Mon Aug 2 17:29:41 2004 +++ llvm/test/QMTest/llvm.py Thu Nov 18 11:18:57 2004 @@ -147,7 +147,7 @@ # # Construct the pathnames to the various utilities. # - as = buildroot + '/tools/' + buildtype + '/llvm-as' + as = buildroot + '/' + buildtype + '/bin/llvm-as' # # Assume we will succeed @@ -222,9 +222,9 @@ # # Construct the pathnames to the various utilities. # - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' - dis = buildroot + '/tools/' + context['buildtype'] + '/llvm-dis' - llc = buildroot + '/tools/' + context['buildtype'] + '/llc' + as = buildroot + '/' + context['buildtype'] + '/bin/llvm-as' + dis = buildroot + '/' + context['buildtype'] + '/bin/llvm-dis' + llc = buildroot + '/' + context['buildtype'] + '/bin/llc' # # Use the LLVM assembler to assemble the program. @@ -304,8 +304,8 @@ # Construct the pathnames to the various utilities. # cc = context['cc'] - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' - dis = buildroot + '/tools/' + context['buildtype'] + '/llvm-dis' + as = buildroot + '/' + context['buildtype'] +'/bin/llvm-as' + dis = buildroot + '/' + context['buildtype'] +'/bin/llvm-dis' # # Construct the command to generate the C source and object @@ -391,8 +391,8 @@ asmfile=bcfile + '.s' # Construct the pathnames to the various utilities. - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' - llc = buildroot + '/tools/' + context['buildtype'] + '/llc' + as = buildroot + '/' + context['buildtype'] + '/bin/llvm-as' + llc = buildroot + '/' + context['buildtype'] + '/bin/llc' # Assemble the bytecode file. if (ExecProgram ((as, srcfile, '-f', '-o', bcfile))): @@ -473,9 +473,9 @@ # # Construct the pathnames to the various utilities. # - self.as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' - self.dis = buildroot + '/tools/' + context['buildtype'] + '/llvm-dis' - self.opt = buildroot + '/tools/' + context['buildtype'] + '/opt' + self.as = buildroot + '/' +context['buildtype']+'/bin/llvm-as' + self.dis = buildroot + '/' +context['buildtype']+'/bin/llvm-dis' + self.opt = buildroot + '/' +context['buildtype']+'/bin/opt' # # Run the optimizer. @@ -600,8 +600,8 @@ # # Determine the path to the assembler and disassembler # - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' - dis = buildroot + '/tools/' + context['buildtype'] + '/llvm-dis' + as = buildroot + '/' + context['buildtype'] + '/bin/llvm-as' + dis = buildroot + '/' + context['buildtype'] + '/bin/llvm-dis' # # Find the name of the file to assemble. @@ -712,7 +712,7 @@ # # Construct the pathnames to the various utilities. # - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' + as = buildroot + '/' + context['buildtype'] + '/bin/llvm-as' # # Use the LLVM assembler to assemble the program. @@ -776,8 +776,8 @@ # # Construct the pathnames to the various utilities. # - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' - lli = buildroot + '/tools/' + context['buildtype'] + '/lli' + as = buildroot + '/' + context['buildtype'] + '/bin/llvm-as' + lli = buildroot + '/' + context['buildtype'] + '/bin/lli' # # Assemble the program. @@ -866,7 +866,7 @@ # Construct a new path that includes the LLVM tools. environment = os.environ oldpath = environment['PATH'] - environment['PATH'] = buildroot + '/tools/' + buildtype + ':' + srcroot + '/test/Scripts:' + environment['PATH'] + environment['PATH'] = buildroot + '/' + buildtype + '/bin:' + srcroot + '/test/Scripts:' + environment['PATH'] environment['QMV_llvmgcc'] = context['llvmgcc'] # Extract the RUN: script (making the following substitutions:) @@ -947,7 +947,7 @@ # Construct the pathnames to the various utilities. # cc = context['llvmgcc'] - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' + as = buildroot + '/' + context['buildtype'] + '/bin/llvm-as' # # Construct the command to generate the LLVM assembly and byte @@ -1035,7 +1035,7 @@ # Construct the pathnames to the various utilities. # cc = context['llvmgxx'] - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' + as = buildroot + '/' + context['buildtype'] + '/bin/llvm-as' # # Construct the command to generate the LLVM assembly and byte @@ -1214,7 +1214,7 @@ # # Find the pathname of the assembler. # - as = self.buildroot + '/tools/' + context['buildtype'] + '/llvm-as' + as = self.buildroot + '/' + context['buildtype'] +'/bin/llvm-as' # # Use the LLVM assembler to create the bytecode file. From lattner at cs.uiuc.edu Thu Nov 18 11:24:34 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 11:24:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerPacked.cpp Message-ID: <200411181724.iAIHOYDn003359@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LowerPacked.cpp updated: 1.2 -> 1.3 --- Log message: Check in hook that I forgot --- Diffs of the changes: (+3 -0) Index: llvm/lib/Transforms/Scalar/LowerPacked.cpp diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.2 llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.3 --- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.2 Wed Sep 1 17:55:36 2004 +++ llvm/lib/Transforms/Scalar/LowerPacked.cpp Thu Nov 18 11:24:20 2004 @@ -98,6 +98,9 @@ } // end namespace +FunctionPass *createLowerPackedPass() { return new LowerPacked(); } + + // This function sets lowered values for a corresponding // packed value. Note, in the case of a forward reference // getValues(Value*) will have already been called for From lattner at cs.uiuc.edu Thu Nov 18 11:47:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 11:47:04 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Message-ID: <200411181747.iAIHl4uv024259@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h updated: 1.8 -> 1.9 --- Log message: Update comments, now that CPR's are gone, inline the methods --- Diffs of the changes: (+10 -9) Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.8 llvm/include/llvm/Instructions.h:1.9 --- llvm/include/llvm/Instructions.h:1.8 Wed Nov 17 15:02:25 2004 +++ llvm/include/llvm/Instructions.h Thu Nov 18 11:46:49 2004 @@ -481,10 +481,12 @@ virtual CallInst *clone() const; bool mayWriteToMemory() const { return true; } - // FIXME: These methods should be inline once we eliminate - // ConstantPointerRefs! - const Function *getCalledFunction() const; - Function *getCalledFunction(); + /// getCalledFunction - Return the function being called by this instruction + /// if it is a direct call. If it is a call through a function pointer, + /// return null. + Function *getCalledFunction() const { + return dyn_cast(Operands[0]); + } // getCalledValue - Get a pointer to a method that is invoked by this inst. inline const Value *getCalledValue() const { return Operands[0]; } @@ -1088,12 +1090,11 @@ bool mayWriteToMemory() const { return true; } /// getCalledFunction - Return the function called, or null if this is an - /// indirect function invocation... - /// - /// FIXME: These should be inlined once we get rid of ConstantPointerRefs! + /// indirect function invocation. /// - const Function *getCalledFunction() const; - Function *getCalledFunction(); + Function *getCalledFunction() const { + return dyn_cast(Operands[0]); + } // getCalledValue - Get a pointer to a function that is invoked by this inst. inline const Value *getCalledValue() const { return Operands[0]; } From lattner at cs.uiuc.edu Thu Nov 18 11:47:10 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 11:47:10 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CallSite.h Message-ID: <200411181747.iAIHlAai024333@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CallSite.h updated: 1.16 -> 1.17 --- Log message: Update comments, now that CPR's are gone, inline the methods --- Diffs of the changes: (+3 -2) Index: llvm/include/llvm/Support/CallSite.h diff -u llvm/include/llvm/Support/CallSite.h:1.16 llvm/include/llvm/Support/CallSite.h:1.17 --- llvm/include/llvm/Support/CallSite.h:1.16 Sat Nov 13 17:28:10 2004 +++ llvm/include/llvm/Support/CallSite.h Thu Nov 18 11:46:57 2004 @@ -74,8 +74,9 @@ /// getCalledFunction - Return the function being called if this is a direct /// call, otherwise return null (if it's an indirect call). /// - /// FIXME: This should be inlined once ConstantPointerRefs are gone. :( - Function *getCalledFunction() const; + Function *getCalledFunction() const { + return dyn_cast(getCalledValue()); + } /// setCalledFunction - Set the callee to the specified value... /// From lattner at cs.uiuc.edu Thu Nov 18 11:47:27 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 11:47:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp Message-ID: <200411181747.iAIHlRvx024450@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.6 -> 1.7 --- Log message: These methods are inlined --- Diffs of the changes: (+0 -30) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.6 llvm/lib/VMCore/Instructions.cpp:1.7 --- llvm/lib/VMCore/Instructions.cpp:1.6 Wed Nov 17 15:02:25 2004 +++ llvm/lib/VMCore/Instructions.cpp Thu Nov 18 11:47:13 2004 @@ -149,17 +149,6 @@ Operands.push_back(Use(CI.Operands[i], this)); } -const Function *CallInst::getCalledFunction() const { - if (const Function *F = dyn_cast(Operands[0])) - return F; - return 0; -} -Function *CallInst::getCalledFunction() { - if (Function *F = dyn_cast(Operands[0])) - return F; - return 0; -} - //===----------------------------------------------------------------------===// // InvokeInst Implementation @@ -210,25 +199,6 @@ Operands.push_back(Use(CI.Operands[i], this)); } -const Function *InvokeInst::getCalledFunction() const { - if (const Function *F = dyn_cast(Operands[0])) - return F; - return 0; -} -Function *InvokeInst::getCalledFunction() { - if (Function *F = dyn_cast(Operands[0])) - return F; - return 0; -} - -// FIXME: Is this supposed to be here? -Function *CallSite::getCalledFunction() const { - Value *Callee = getCalledValue(); - if (Function *F = dyn_cast(Callee)) - return F; - return 0; -} - //===----------------------------------------------------------------------===// // ReturnInst Implementation //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Thu Nov 18 12:06:50 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 12:06:50 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-out.c Message-ID: <200411181806.iAII6op3013821@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-out.c updated: 1.4 -> 1.5 --- Log message: Get the target triple into the .ll file. --- Diffs of the changes: (+1 -1) Index: llvm-gcc/gcc/llvm-out.c diff -u llvm-gcc/gcc/llvm-out.c:1.4 llvm-gcc/gcc/llvm-out.c:1.5 --- llvm-gcc/gcc/llvm-out.c:1.4 Mon Sep 27 22:37:39 2004 +++ llvm-gcc/gcc/llvm-out.c Thu Nov 18 12:06:36 2004 @@ -103,7 +103,7 @@ /* Add a blank line here so it appears in assembler output but not screen output. */ fprintf (llvm_out_file, "\n"); - + fprintf(llvm_out_file, "target triple = \"%s\"\n",DEFAULT_TARGET_MACHINE); fprintf(llvm_out_file, "target pointersize = %d\n", POINTER_SIZE); fprintf(llvm_out_file, "target endian = %s\n", (BYTES_BIG_ENDIAN) ? "big" : "little"); From lattner at cs.uiuc.edu Thu Nov 18 12:07:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 12:07:02 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/Makefile.in Message-ID: <200411181807.iAII723H014325@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: Makefile.in updated: 1.4 -> 1.5 --- Log message: get the target triple into the GCC binary. --- Diffs of the changes: (+1 -1) Index: llvm-gcc/gcc/Makefile.in diff -u llvm-gcc/gcc/Makefile.in:1.4 llvm-gcc/gcc/Makefile.in:1.5 --- llvm-gcc/gcc/Makefile.in:1.4 Mon Aug 9 13:29:24 2004 +++ llvm-gcc/gcc/Makefile.in Thu Nov 18 12:06:18 2004 @@ -677,7 +677,7 @@ # IN_GCC distinguishes between code compiled into GCC itself and other # programs built during a bootstrap. # autoconf inserts -DCROSS_COMPILE if we are building a cross compiler. -INTERNAL_CFLAGS = -DIN_GCC @CROSS@ +INTERNAL_CFLAGS = -DIN_GCC @CROSS@ -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" # This is the variable actually used when we compile. If you change this, # you probably want to update BUILD_CFLAGS in configure.in From tbrethou at cs.uiuc.edu Thu Nov 18 12:38:12 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 18 Nov 2004 12:38:12 -0600 (CST) Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200411181838.MAA14884@kain.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.60 -> 1.61 --- Log message: Adding option to llc for ModuloScheduling. By default it is turned off. --- Diffs of the changes: (+1 -0) Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.60 llvm/tools/llc/Makefile:1.61 --- llvm/tools/llc/Makefile:1.60 Wed Oct 27 18:18:45 2004 +++ llvm/tools/llc/Makefile Thu Nov 18 12:37:55 2004 @@ -10,6 +10,7 @@ LEVEL = ../.. TOOLNAME = llc USEDLIBS = \ + LLVMSparcV9ModuloSched \ LLVMCBackend \ LLVMPowerPC \ LLVMSparcV9 \ From tbrethou at cs.uiuc.edu Thu Nov 18 12:38:15 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 18 Nov 2004 12:38:15 -0600 (CST) Subject: [llvm-commits] CVS: llvm/tools/Makefile.JIT Message-ID: <200411181838.MAA14888@kain.cs.uiuc.edu> Changes in directory llvm/tools: Makefile.JIT updated: 1.4 -> 1.5 --- Log message: Adding option to llc for ModuloScheduling. By default it is turned off. --- Diffs of the changes: (+1 -1) Index: llvm/tools/Makefile.JIT diff -u llvm/tools/Makefile.JIT:1.4 llvm/tools/Makefile.JIT:1.5 --- llvm/tools/Makefile.JIT:1.4 Thu Oct 28 01:39:10 2004 +++ llvm/tools/Makefile.JIT Thu Nov 18 12:38:01 2004 @@ -44,7 +44,7 @@ # What the Sparc JIT requires ifdef ENABLE_SPARCV9_JIT JITLIBS += LLVMSparcV9 - ARCHLIBS += LLVMSparcV9InstrSched LLVMSparcV9LiveVar LLVMInstrumentation.a \ + ARCHLIBS += LLVMSparcV9ModuloSched LLVMSparcV9InstrSched LLVMSparcV9LiveVar LLVMInstrumentation.a \ LLVMProfilePaths LLVMBCWriter LLVMTransforms.a LLVMipo.a \ LLVMipa.a LLVMDataStructure.a LLVMSparcV9RegAlloc endif From tbrethou at cs.uiuc.edu Thu Nov 18 12:38:31 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 18 Nov 2004 12:38:31 -0600 (CST) Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp Message-ID: <200411181838.MAA14921@kain.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9TargetMachine.cpp updated: 1.124 -> 1.125 --- Log message: Adding option to llc for ModuloScheduling. By default it is turned off. --- Diffs of the changes: (+13 -2) Index: llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp diff -u llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.124 llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.125 --- llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.124 Thu Sep 30 15:20:01 2004 +++ llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp Thu Nov 18 12:37:49 2004 @@ -66,6 +66,9 @@ cl::opt DisableStrip("disable-strip", cl::desc("Do not strip the LLVM bytecode in executable")); + + cl::opt EnableModSched("enable-ModSched", cl::desc("Enable modulo scheduling pass instead of local scheduling")); + // Register the target. RegisterTarget X("sparcv9", " SPARC V9"); } @@ -192,9 +195,17 @@ PM.add(createSparcV9BurgInstSelector(*this)); - if (!DisableSched) - PM.add(createInstructionSchedulingWithSSAPass(*this)); + if(PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr, "Before modulo scheduling:\n")); + //Use ModuloScheduling if enabled, otherwise use local scheduling if not disabled. + if(EnableModSched) + PM.add(createModuloSchedulingPass(*this)); + else { + if (!DisableSched) + PM.add(createInstructionSchedulingWithSSAPass(*this)); + } + if (PrintMachineCode) PM.add(createMachineFunctionPrinterPass(&std::cerr, "Before reg alloc:\n")); From reid at x10sys.com Thu Nov 18 12:39:09 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 12:39:09 -0600 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200411181839.MAA14377@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.249 -> 1.250 --- Log message: Add notes about makefile changes and llvm-ar. --- Diffs of the changes: (+20 -6) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.249 llvm/docs/ReleaseNotes.html:1.250 --- llvm/docs/ReleaseNotes.html:1.249 Wed Nov 17 12:19:32 2004 +++ llvm/docs/ReleaseNotes.html Thu Nov 18 12:38:58 2004 @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM 1.4 Release Notes @@ -88,15 +89,22 @@
    1. The test/Programs hierarchy has been moved out of the main LLVM tree into a separate CVS repo and - tarball.
    2. + tarball. This shrinks the distribution size of LLVM itself dramatically. +
    3. LLVM now optimizes global variables significantly more than it did before.
    4. LLVM now includes the new 'undef' value and unreachable instruction, which give the optimizer more information about the behavior of the program.
    5. -
    6. The LLVM makefiles have been improved to build LLVM much faster and - includes new targets (like make dist-check).
    7. +
    8. The LLVM makefiles have been improved to build LLVM much faster (2x) and + includes new targets (like dist-check, uninstall). One important change is + associated with PR456. + The libraries and tools will now be built into + $builddir/Debug/{bin,lib} instead of + $builddir/tools/Debug and $builddir/lib/Debug. Similarly + for Release and Profile builds. +
    9. The LLVM source code is much more compatible with Microsoft Visual C++, including the JIT and runtime-code generation, though the entire system may not work with it.
    10. @@ -113,8 +121,15 @@
        -
      1. JIT interface should support +
      2. JIT interface should support arbitrary calls
      3. +
      4. The llvm-ar tool was previously incomplete and didn't properly + support other ar(1) implementations. This has been corrected. llvm-ar + now fully supports all archive editing functions, table of contents listing, + extraction, and printing. It can also read BSD4.4/MacOSX and SVR4 style + archives. See llvm-ar + for details.
      @@ -274,7 +289,6 @@ -ipmodref, -cee, -branch-combine, -instloops, -paths
    11. The -pre pass is incomplete (there are cases it doesn't handle that it should) and not thoroughly tested.
    12. -
    13. The llvm-ar tool is incomplete and probably buggy.
    14. The llvm-db tool is in a very early stage of development.
    15. @@ -645,7 +659,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/11/17 18:19:32 $ + Last modified: $Date: 2004/11/18 18:38:58 $ From tbrethou at cs.uiuc.edu Thu Nov 18 12:47:45 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 18 Nov 2004 12:47:45 -0600 (CST) Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp Message-ID: <200411181847.MAA21152@kain.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9TargetMachine.cpp updated: 1.125 -> 1.126 --- Log message: Fixed to fit in 80 columns. --- Diffs of the changes: (+2 -1) Index: llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp diff -u llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.125 llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.126 --- llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.125 Thu Nov 18 12:37:49 2004 +++ llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp Thu Nov 18 12:47:29 2004 @@ -67,7 +67,8 @@ cl::desc("Do not strip the LLVM bytecode in executable")); - cl::opt EnableModSched("enable-ModSched", cl::desc("Enable modulo scheduling pass instead of local scheduling")); + cl::opt EnableModSched("enable-ModSched", + cl::desc("Enable modulo scheduling pass instead of local scheduling")); // Register the target. RegisterTarget X("sparcv9", " SPARC V9"); From lattner at cs.uiuc.edu Thu Nov 18 13:40:31 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 13:40:31 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExtractFunction.cpp Message-ID: <200411181940.iAIJeUO2021550@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExtractFunction.cpp updated: 1.40 -> 1.41 --- Log message: remove debugging code --- Diffs of the changes: (+3 -5) Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.40 llvm/tools/bugpoint/ExtractFunction.cpp:1.41 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.40 Tue Nov 16 00:31:37 2004 +++ llvm/tools/bugpoint/ExtractFunction.cpp Thu Nov 18 13:40:13 2004 @@ -142,9 +142,9 @@ } // Check to see if we created any new functions. If not, no loops were - // extracted and we should return null. - static unsigned NumExtracted = 15; - + // extracted and we should return null. Limit the number of loops we extract + // to avoid taking forever. + static unsigned NumExtracted = 32; if (M->size() == NewM->size() || --NumExtracted == 0) { delete NewM; return 0; @@ -153,8 +153,6 @@ Module::iterator MI = NewM->begin(); for (unsigned i = 0, e = M->size(); i != e; ++i) ++MI; - for (; MI != NewM->end(); ++MI) - std::cerr << "NEW FUNCTION: " << *MI; } return NewM; From lattner at cs.uiuc.edu Thu Nov 18 13:43:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 13:43:02 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ListReducer.h Message-ID: <200411181943.iAIJh2fh021675@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ListReducer.h updated: 1.11 -> 1.12 --- Log message: Remove debugging code, unneuter this functionality --- Diffs of the changes: (+4 -1) Index: llvm/tools/bugpoint/ListReducer.h diff -u llvm/tools/bugpoint/ListReducer.h:1.11 llvm/tools/bugpoint/ListReducer.h:1.12 --- llvm/tools/bugpoint/ListReducer.h:1.11 Tue Nov 16 00:31:38 2004 +++ llvm/tools/bugpoint/ListReducer.h Thu Nov 18 13:42:50 2004 @@ -90,7 +90,7 @@ // could. If there is more two elements in the list, try deleting interior // elements and testing that. // - if (0 && TheList.size() > 2) { + if (TheList.size() > 2) { bool Changed = true; std::vector EmptyList; while (Changed) { @@ -107,6 +107,9 @@ Changed = true; } } + // This can take a long time if left uncontrolled. For now, don't + // iterate. + break; } } From reid at x10sys.com Thu Nov 18 14:04:50 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 14:04:50 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200411182004.OAA15022@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.237 -> 1.238 --- Log message: Duh, put tools in *bin* directory, not *tools* directory as per PR456: http://llvm.cs.uiuc.edu/PR456 . --- Diffs of the changes: (+2 -2) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.237 llvm/Makefile.rules:1.238 --- llvm/Makefile.rules:1.237 Thu Nov 18 04:03:46 2004 +++ llvm/Makefile.rules Thu Nov 18 14:04:39 2004 @@ -177,10 +177,10 @@ #-------------------------------------------------------------------- ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode) LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib -ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/tools +ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/bin ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib -LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/tools +LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples #-------------------------------------------------------------------- From tbrethou at cs.uiuc.edu Thu Nov 18 14:39:08 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 18 Nov 2004 14:39:08 -0600 (CST) Subject: [llvm-commits] CVS: reopt/tools/reopt-llc/Makefile reopt-llc.cpp Message-ID: <200411182039.OAA24900@kain.cs.uiuc.edu> Changes in directory reopt/tools/reopt-llc: Makefile updated: 1.4 -> 1.5 reopt-llc.cpp updated: 1.2 -> 1.3 --- Log message: Fixed some changes to function calls and added ModuloSched to the Makefile. --- Diffs of the changes: (+4 -2) Index: reopt/tools/reopt-llc/Makefile diff -u reopt/tools/reopt-llc/Makefile:1.4 reopt/tools/reopt-llc/Makefile:1.5 --- reopt/tools/reopt-llc/Makefile:1.4 Thu Oct 28 12:10:44 2004 +++ reopt/tools/reopt-llc/Makefile Thu Nov 18 14:38:55 2004 @@ -2,6 +2,7 @@ TOOLNAME = reopt-llc # LLVMCBackend LLVMLIBS = \ + LLVMSparcV9ModuloSched \ LLVMSparcV9 \ LLVMSparcV9RegAlloc \ LLVMSparcV9InstrSched \ Index: reopt/tools/reopt-llc/reopt-llc.cpp diff -u reopt/tools/reopt-llc/reopt-llc.cpp:1.2 reopt/tools/reopt-llc/reopt-llc.cpp:1.3 --- reopt/tools/reopt-llc/reopt-llc.cpp:1.2 Thu Sep 30 15:37:17 2004 +++ reopt/tools/reopt-llc/reopt-llc.cpp Thu Nov 18 14:38:56 2004 @@ -27,6 +27,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Instrumentation.h" #include "llvm/Support/PluginLoader.h" +#include "llvm/System/Path.h" #include "llvm/System/Signals.h" #include #include @@ -124,7 +125,7 @@ // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - sys::RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); } else { Out = &std::cout; } @@ -157,7 +158,7 @@ // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - sys::RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); } } From lattner at cs.uiuc.edu Thu Nov 18 14:44:38 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 14:44:38 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c llvm-internals.h llvm-out.c llvm-out.h toplev.c Message-ID: <200411182044.iAIKicqp024276@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.54 -> 1.55 llvm-internals.h updated: 1.1 -> 1.2 llvm-out.c updated: 1.5 -> 1.6 llvm-out.h updated: 1.4 -> 1.5 toplev.c updated: 1.5 -> 1.6 --- Log message: Initial checkin of line number support for llvmgcc and llvmg++. This will be improved a bit in a second, but this basically works. You get line numbers by passing -g to llvmgcc. Now llvm-db is actually useful! :) All of the hard parts of this patch was written by Michael McCracken, I just got C++ to work with it. Thanks Michael! --- Diffs of the changes: (+548 -3) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.54 llvm-gcc/gcc/llvm-expand.c:1.55 --- llvm-gcc/gcc/llvm-expand.c:1.54 Tue Oct 19 23:54:31 2004 +++ llvm-gcc/gcc/llvm-expand.c Thu Nov 18 14:44:23 2004 @@ -64,6 +64,15 @@ extern int isPassedByInvisibleReference(tree Type); + +/* Debugging info emitter functions. */ +static void llvm_emit_dbg_stoppoint(llvm_function *Fn, unsigned lineNo, + unsigned colNo); +static void llvm_emit_dbg_declare(llvm_function *Fn, tree t); +static void llvm_emit_region_end(llvm_function *Fn); +static void llvm_emit_dbg_function_info(struct llvm_function *Fn); +static void llvm_emit_dbg_function_start(llvm_function *Fn); + /*===----------------------------------------------------------------------===** ... Helper functions for Instruction Emission ... *===----------------------------------------------------------------------===*/ @@ -716,6 +725,12 @@ */ llvm_value *IndirectGotoValue; /* The dynamic block id to go to. */ llvm_basicblock *IndirectGotoBlock; + + /* Debug info */ + llvm_instruction *dbg_call_funcstart_inst; + llvm_value *dbg_global_memloc; + llvm_instruction *dbg_entry_alloca; + } llvm_expand_info; /* add_scope_stack - Allocate and add a scope to the top of the scope list, with @@ -2628,6 +2643,17 @@ /* Set up context appropriately for handling this statement. */ int saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p (); prep_stmt (t); + + if(debug_info_level > DINFO_LEVEL_NONE){ + if(TREE_CODE(t) == COMPOUND_STMT){ + /* skip compound statements - we handle their components. + Avoids emitting multiple stop points for a single line. */ + }else if (TREE_CODE(t) == DECL_STMT){ + llvm_emit_dbg_declare(Fn, t); /* FIXME: does nothing */ + }else{ + llvm_emit_dbg_stoppoint(Fn, STMT_LINENO(t), 0); + } + } switch (TREE_CODE (t)) { case FILE_STMT: @@ -5118,6 +5144,11 @@ } +/* Counts the number of string constants. + * moved to file scope to allow for more than one type. + */ +static int StrCounter = 0; + /* llvm_expand_lvalue_expr: generate code for computing the address of EXP. An * llvm_value* for the computed L-value is returned. This is only legal to call @@ -5403,7 +5434,7 @@ } case STRING_CST: { /* Literal string lvalue: "x" expression */ - static int StrCounter = 0; + /* Create a new global variable for the constant string */ char Name[20]; llvm_global *G; @@ -5971,6 +6002,16 @@ break; case EXPR_WITH_FILE_LOCATION: + /* output location note for EXPR_WFL + why does expr.c use a stack? I see the commit from 1998 + in the changelog, but not the explanation in the lists. + + EXPR_WFL doesn't seem to be used in C much. + + */ + if (EXPR_WFL_EMIT_LINE_NOTE (exp)){ + llvm_emit_dbg_stoppoint(Fn, EXPR_WFL_LINENO(exp), EXPR_WFL_COLNO(exp)); + } Result = llvm_expand_expr(Fn, EXPR_WFL_NODE(exp), DestLoc); break; @@ -6824,6 +6865,11 @@ /*assert(!current_function_needs_context && "Case not handled!");*/ TREE_ASM_WRITTEN(subr) = 1; + if (debug_info_level > DINFO_LEVEL_NONE) { + /* emit global with info and prepare call to function start intrinsic. */ + llvm_emit_dbg_function_info(Fn); + } + return Fn; } @@ -6857,6 +6903,13 @@ &DECL_SOURCE_LOCATION (decl), decl); } + /* emit global with info and call to function start intrinsic + * do this after the body is expanded so when we insert at + * the beginning, we don't get bumped later by alloca's. + */ + if (debug_info_level > DINFO_LEVEL_NONE) + llvm_emit_dbg_function_start(Fn); + /* Output the label for the actual return from the function. */ llvm_emit_label(Fn, Fn->ExpandInfo->ReturnBlock); @@ -6917,6 +6970,11 @@ assert(Fn->ExpandInfo->GotoFixupList == 0 && "Goto fixups remain?"); assert(Fn->ExpandInfo->InnermostScope == 0 && "A scope didn't get popped?"); + if(debug_info_level > DINFO_LEVEL_NONE){ + /* emit region end intrinsic to end the function */ + llvm_emit_region_end(Fn); + } + /* Reset the identifier rename table now that we are out of function scope */ ResetIdentifierTableForEndOfFunction(); @@ -7193,3 +7251,463 @@ return V->Name; } + +/* --== Debugging support ==-- */ + +/* Fn Prototypes, where to move them to? */ +static llvm_global *EmitGlobalString(const char *InStr); + +/* debug constants */ + +static unsigned LLVM_DEBUG_VERSION = 0; +static unsigned LLVM_DEBUG_LANG_CODE = 1; + +static llvm_type *stopPtFnTy; +static llvm_type *funcStartFnTy; +static llvm_type *regionEndFnTy; +static llvm_type *regionStartFnTy; +static llvm_type *dbgDeclareFnTy; + +static llvm_function *dbg_declare_fn; +static llvm_function *dbg_region_end_fn; +static llvm_function *dbg_region_start_fn; +static llvm_function *dbg_func_start_fn; +static llvm_function *dbg_stoppoint_fn; + +static llvm_type *dbCompileUnitTy; +static llvm_type *dbGlobalTy; + +static llvm_type *emptyStructTy; +static llvm_type *ptrToEmptyStructTy; + +static llvm_global *dbCompileUnitGlobal; +static llvm_global *dbTranslationUnitsGlobal; +static llvm_global *dbGlobalsGlobal; + +/* used for file name and function names */ +static llvm_global *EmitGlobalString(const char *InStr){ + static char name[20]; + unsigned i = 0; + unsigned CP = 0; + unsigned len = strlen(InStr); + char *Buffer = (char *)alloca(3*len + 6); + llvm_global *G; + llvm_type *sByteArrayTy; + + sprintf(name, ".str_%d", ++StrCounter); + Buffer[CP++] = 'c'; Buffer[CP++] = '"'; + for (i = 0; i != len; ++i) + if (isprint((int)InStr[i]) && InStr[i] != '"' && InStr[i] != '\\') + Buffer[CP++] = InStr[i]; + else { + sprintf(Buffer+CP, "\\%02X", ((unsigned)InStr[i] & 0xFF)); + CP += 3; + } + + Buffer[CP++] = '\\'; + Buffer[CP++] = '0'; + Buffer[CP++] = '0'; + Buffer[CP++] = '\"'; Buffer[CP++] = 0; + + + sByteArrayTy = llvm_type_get_array(SByteTy, len+1); + + G = llvm_global_new(sByteArrayTy, name); + G->isConstant = 1; + G->Linkage = L_Internal; + + G->Init = V2C(llvm_constant_new(sByteArrayTy, Buffer)); + + llvm_ilist_push_back(llvm_global, TheProgram.Globals, G); + + return G; +} + +/* llvm_emit_debug_context_info + emits file level debug info as LLVM globals + */ + +void llvm_emit_debug_context_info(const char *fileName, + const char *path, + const char *producer){ + llvm_constant *CA = 0; + llvm_global *pathStr = EmitGlobalString(fileName); + llvm_global *fileNameStr = EmitGlobalString(path); + llvm_global *producerStr = EmitGlobalString(producer); + llvm_value **Elements = (llvm_value**) xcalloc(7, sizeof(llvm_value*)); + llvm_instruction *gep = 0; + + /* Infer language of file, stolen from dwarf2out.c */ + const char *language_string = lang_hooks.name; + if (strcmp (language_string, "GNU C++") == 0) + LLVM_DEBUG_LANG_CODE = 0x0004; /*DW_LANG_C_plus_plus;*/ + else if (strcmp (language_string, "GNU Ada") == 0) + LLVM_DEBUG_LANG_CODE = 0x000d; /* DW_LANG_Ada95; */ + else if (strcmp (language_string, "GNU F77") == 0) + LLVM_DEBUG_LANG_CODE = 0x0007; /* DW_LANG_Fortran77; */ + else if (strcmp (language_string, "GNU Pascal") == 0) + LLVM_DEBUG_LANG_CODE = 0x0009; /* DW_LANG_Pascal83; */ + else if (strcmp (language_string, "GNU Java") == 0) + LLVM_DEBUG_LANG_CODE = 0x000b; /* DW_LANG_Java; */ + else + LLVM_DEBUG_LANG_CODE = 0x0001; /* DW_LANG_C89; */ + + + /* The constant in Elements[0] is DW_TAG_COMPILE_UNIT */ + Elements[0] = llvm_constant_new_integral(UIntTy, 17); + Elements[1] = llvm_constant_new_integral(UShortTy, LLVM_DEBUG_VERSION); + Elements[2] = llvm_constant_new_integral(UShortTy, LLVM_DEBUG_LANG_CODE); + + gep = create_gep3(G2V(fileNameStr), + llvm_constant_intptr_0, + llvm_constant_intptr_0); + Elements[3] = G2V(llvm_constant_expr_new(gep)); + + gep = create_gep3(G2V(pathStr), + llvm_constant_intptr_0, + llvm_constant_intptr_0); + Elements[4] = G2V(llvm_constant_expr_new(gep)); + + gep = create_gep3(G2V(producerStr), + llvm_constant_intptr_0, + llvm_constant_intptr_0); + Elements[5] = G2V(llvm_constant_expr_new(gep)); + + Elements[6] = G2V(dbTranslationUnitsGlobal); + CA = G2C(llvm_constant_aggregate_new(dbCompileUnitTy, Elements)); + + dbCompileUnitGlobal = llvm_global_new(dbCompileUnitTy, "d.compile_unit"); + dbCompileUnitGlobal->isConstant = 1; + dbCompileUnitGlobal->Linkage = L_Internal; + dbCompileUnitGlobal->Init = CA; + + llvm_ilist_push_back(llvm_global, TheProgram.Globals, dbCompileUnitGlobal); + +} + +/* llvm_emit_dbg_function_info emits a global of type lldb.global + * that describes a function in the program. + * it sets a static variable in this file to allow other emitted + * debug intrinsics to refer to that function. + */ +/* static llvm_instruction *dbg_call_funcstart_inst; */ +/* static llvm_value *dbg_global_memloc = 0; */ +/* static llvm_instruction *dbg_entry_alloca = 0; */ + +static llvm_global *dbg_func_info_global; + +static void llvm_emit_dbg_function_info(llvm_function *Fn) { + char *func_name = G2V(Fn)->Name; + char *gFuncName = 0; + + llvm_constant *CA = 0; + llvm_global *funcNameStr = 0; + llvm_value **Elements = 0; + llvm_instruction *gep = 0; + + funcNameStr = EmitGlobalString(func_name); + Elements = (llvm_value**) xcalloc(7, sizeof(llvm_value*)); + Elements[0] = llvm_constant_new_integral(UIntTy, 46); /* DW_TAG_subprogram */ + Elements[1] = G2V(dbCompileUnitGlobal); + + gep = create_gep3(G2V(funcNameStr), + llvm_constant_intptr_0, + llvm_constant_intptr_0); + Elements[2] = G2V(llvm_constant_expr_new(gep)); + + Elements[3] = G2V(dbGlobalsGlobal); + Elements[4] = llvm_constant_VoidPtr_null; + Elements[5] = llvm_constant_bool_true; + Elements[6] = llvm_constant_bool_false; + CA = G2C(llvm_constant_aggregate_new(dbGlobalTy, Elements)); + + asprintf(&gFuncName,"d.%s", func_name); + dbg_func_info_global = llvm_global_new(dbGlobalTy, gFuncName); + free(gFuncName); + + dbg_func_info_global->Linkage = L_External; + dbg_func_info_global->Init = CA; + + llvm_ilist_push_back(llvm_global, TheProgram.Globals, dbg_func_info_global); + + Fn->ExpandInfo->dbg_entry_alloca = create_alloca_inst("dbg", + ptrToEmptyStructTy, + llvm_constant_uint_1); + Fn->ExpandInfo->dbg_global_memloc = D2V(Fn->ExpandInfo->dbg_entry_alloca); + +} + + +/* + llvm_emit_dbg_function_start + emits the instruction that was built in emit_dbg_function_info + */ +static void llvm_emit_dbg_function_start(llvm_function *Fn) { + /* get start of first basic block. */ + llvm_basicblock *entryBlock = llvm_ilist_front(llvm_basicblock, + Fn->BasicBlocks); + + llvm_instruction *storeFuncCall = 0; + + /* prep function.start call */ + + Fn->ExpandInfo->dbg_call_funcstart_inst = + llvm_instruction_new(ptrToEmptyStructTy, "dbg", O_Call, 2); + + Fn->ExpandInfo->dbg_call_funcstart_inst->Operands[0] = + G2V(dbg_func_start_fn); + Fn->ExpandInfo->dbg_call_funcstart_inst->Operands[1] = + G2V(dbg_func_info_global); + + + /* the 'alloca trick': + store into a memory location to force debug intrinsics to become SSA + during mem2reg. + + Note that the following pushes are onto the front, so this becomes: + alloca + call dbg.func.start + store + */ + storeFuncCall = create_store_inst(Fn->ExpandInfo->dbg_call_funcstart_inst, + Fn->ExpandInfo->dbg_entry_alloca, 0); + + llvm_ilist_push_front(llvm_instruction, entryBlock->Instructions, + storeFuncCall); + llvm_ilist_push_front(llvm_instruction, entryBlock->Instructions, + Fn->ExpandInfo->dbg_call_funcstart_inst); + llvm_ilist_push_front(llvm_instruction, entryBlock->Instructions, + Fn->ExpandInfo->dbg_entry_alloca); +} + + +/* InitDebuggerTypeDecls inits type decls for debugger types, + * declarations for debugger intrinsics + * ^--- (some are currently unused in the generated bytecode) + * and global object anchors. + */ +void InitDebuggerTypeDecls(void){ + + llvm_type *ptrToSByteTy; + unsigned ptrTySz, uIntTySz, uShortTySz, boolTySz; + unsigned dbCompileUnitSz; + unsigned dbGlobalTySz; + llvm_type *ptrToDBCompileUnitTy; + llvm_type *ptrToDBGlobalTy; + unsigned dbLocalTySz; + llvm_type *dbLocalTy; + llvm_type *ptrToDBLocalTy; + llvm_value *emptyStructConst; + + emptyStructTy = llvm_type_create_struct(0, 0); + emptyStructTy = llvm_type_get_cannonical_struct(emptyStructTy); + ptrToEmptyStructTy = llvm_type_get_pointer(emptyStructTy); + ptrToSByteTy = llvm_type_get_pointer(SByteTy); + + ptrTySz = llvm_type_get_size(ptrToEmptyStructTy); + uIntTySz = llvm_type_get_size(UIntTy); + uShortTySz = llvm_type_get_size(UShortTy); + boolTySz = llvm_type_get_size(BoolTy); + + /* setup debugger types */ + dbCompileUnitSz = uIntTySz + 2 * uShortTySz + 4 * ptrTySz; + dbCompileUnitTy = llvm_type_create_struct(7, dbCompileUnitSz); + dbCompileUnitTy->x.Struct.MemberOffsets[0] = 0; + dbCompileUnitTy->Elements[0] = UIntTy; + dbCompileUnitTy->x.Struct.MemberOffsets[1] = uIntTySz; + dbCompileUnitTy->Elements[1] = UShortTy; + dbCompileUnitTy->x.Struct.MemberOffsets[2] = uShortTySz; + dbCompileUnitTy->Elements[2] = UShortTy; + dbCompileUnitTy->x.Struct.MemberOffsets[3] = uShortTySz; + dbCompileUnitTy->Elements[3] = ptrToSByteTy; + dbCompileUnitTy->x.Struct.MemberOffsets[4] = ptrTySz; + dbCompileUnitTy->Elements[4] = ptrToSByteTy; + dbCompileUnitTy->x.Struct.MemberOffsets[5] = ptrTySz; + dbCompileUnitTy->Elements[5] = ptrToSByteTy; + dbCompileUnitTy->x.Struct.MemberOffsets[6] = ptrTySz; + dbCompileUnitTy->Elements[6] = ptrToEmptyStructTy; + dbCompileUnitTy->x.Struct.TypeName = (char *)"lldb.compile_unit"; + + dbCompileUnitTy = llvm_type_get_cannonical_struct(dbCompileUnitTy); + ptrToDBCompileUnitTy = llvm_type_get_pointer(dbCompileUnitTy); + + dbGlobalTySz = uIntTySz + 4 * ptrTySz + 2 * boolTySz; + dbGlobalTy = llvm_type_create_struct(7, dbGlobalTySz); + dbGlobalTy->x.Struct.MemberOffsets[0] = 0; + dbGlobalTy->Elements[0] = UIntTy; + dbGlobalTy->x.Struct.MemberOffsets[1] = uIntTySz; + dbGlobalTy->Elements[1] = ptrToDBCompileUnitTy; + dbGlobalTy->x.Struct.MemberOffsets[2] = ptrTySz; + dbGlobalTy->Elements[2] = ptrToSByteTy; + dbGlobalTy->x.Struct.MemberOffsets[3] = ptrTySz; + dbGlobalTy->Elements[3] = ptrToEmptyStructTy; + dbGlobalTy->x.Struct.MemberOffsets[4] = ptrTySz; + dbGlobalTy->Elements[4] = ptrToSByteTy; + dbGlobalTy->x.Struct.MemberOffsets[5] = ptrTySz; + dbGlobalTy->Elements[5] = BoolTy; + dbGlobalTy->x.Struct.MemberOffsets[6] = boolTySz; + dbGlobalTy->Elements[6] = BoolTy; + dbGlobalTy->x.Struct.TypeName = (char *)"lldb.global"; + + dbGlobalTy = llvm_type_get_cannonical_struct(dbGlobalTy); + ptrToDBGlobalTy = llvm_type_get_pointer(dbGlobalTy); + + + dbLocalTySz = uIntTySz + 3 * ptrTySz + 2 * boolTySz; + dbLocalTy = llvm_type_create_struct(6, dbLocalTySz); + dbLocalTy->x.Struct.MemberOffsets[0] = 0; + dbLocalTy->Elements[0] = UIntTy; + dbLocalTy->x.Struct.MemberOffsets[1] = uIntTySz; + dbLocalTy->Elements[1] = ptrToDBGlobalTy; + dbLocalTy->x.Struct.MemberOffsets[2] = ptrTySz; + dbLocalTy->Elements[2] = ptrToSByteTy; + dbLocalTy->x.Struct.MemberOffsets[3] = ptrTySz; + dbLocalTy->Elements[3] = ptrToSByteTy; + dbLocalTy->x.Struct.MemberOffsets[4] = ptrTySz; + dbLocalTy->Elements[4] = BoolTy; + dbLocalTy->x.Struct.MemberOffsets[5] = boolTySz; + dbLocalTy->Elements[5] = BoolTy; + dbLocalTy->x.Struct.TypeName = (char *)"lldb.local"; + + dbLocalTy = llvm_type_get_cannonical_struct(dbLocalTy); + ptrToDBLocalTy = llvm_type_get_pointer(dbLocalTy); + + /* global object anchors */ + + emptyStructConst = llvm_constant_new(emptyStructTy, "{ }"); + + dbTranslationUnitsGlobal = llvm_global_new(emptyStructTy, + "llvm.dbg.translation_units"); + dbTranslationUnitsGlobal->Init = V2C(emptyStructConst); + dbTranslationUnitsGlobal->Linkage = L_LinkOnce; + llvm_ilist_push_back(llvm_global, TheProgram.Globals, + dbTranslationUnitsGlobal); + + + dbGlobalsGlobal = llvm_global_new(emptyStructTy, "llvm.dbg.globals"); + dbGlobalsGlobal->Init = V2C(emptyStructConst); + dbGlobalsGlobal->Linkage = L_LinkOnce; + llvm_ilist_push_back(llvm_global, TheProgram.Globals, dbGlobalsGlobal); + + + /* intrinsic function declarations */ + + stopPtFnTy = llvm_type_create_function(4, ptrToEmptyStructTy); + stopPtFnTy->Elements[1] = ptrToEmptyStructTy; + stopPtFnTy->Elements[2] = UIntTy; + stopPtFnTy->Elements[3] = UIntTy; + stopPtFnTy->Elements[4] = ptrToDBCompileUnitTy; + dbg_stoppoint_fn = CreateIntrinsicFnWithType("llvm.dbg.stoppoint", + stopPtFnTy); + + funcStartFnTy = llvm_type_create_function(1, ptrToEmptyStructTy); + funcStartFnTy->Elements[1] = ptrToDBGlobalTy; + dbg_func_start_fn = CreateIntrinsicFnWithType("llvm.dbg.func.start", + funcStartFnTy); + + regionStartFnTy = llvm_type_create_function(1, ptrToEmptyStructTy); + regionStartFnTy->Elements[1] = ptrToEmptyStructTy; + dbg_region_start_fn = CreateIntrinsicFnWithType("llvm.dbg.region.start", + regionStartFnTy); + + regionEndFnTy = llvm_type_create_function(1, ptrToEmptyStructTy); + regionEndFnTy->Elements[1] = ptrToEmptyStructTy; + dbg_region_end_fn = CreateIntrinsicFnWithType("llvm.dbg.region.end", + regionEndFnTy); + + dbgDeclareFnTy = llvm_type_create_function(1, ptrToEmptyStructTy); + dbgDeclareFnTy->Elements[1] = ptrToEmptyStructTy; + dbg_declare_fn = CreateIntrinsicFnWithType("llvm.dbg.declare", + dbgDeclareFnTy); + +} + + + +/* llvm_emit_dbg_stoppoint + * appends call to intrinsic llvm.dbg.stoppoint for debug line info. + * + %dbg = alloca {}* ;; In the entry block. + + %tmp = call {}* %llvm.db.func.start(...) + store {}* %tmp, {}** %dbg + + %tmp.1 = load {}** %dbg + %tmp.2 = call {}* %llvm.dbg.stoppoint({}* %tmp.1, ... + store {}* %tmp.2, {}** %dbg + + */ +static void llvm_emit_dbg_stoppoint(llvm_function *Fn, unsigned lineNo, + unsigned colNo) { + llvm_instruction *stoppoint_inst; + llvm_instruction *load_dbg_inst; + llvm_instruction *store_dbg_inst; + + load_dbg_inst = create_load_inst("dbg.tmp", + Fn->ExpandInfo->dbg_global_memloc, 0); + + stoppoint_inst = llvm_instruction_new(ptrToEmptyStructTy, "dbg.tmp", + O_Call, 5); + stoppoint_inst->Operands[0] = G2V(dbg_stoppoint_fn); + stoppoint_inst->Operands[1] = D2V(load_dbg_inst); + + stoppoint_inst->Operands[2] = llvm_constant_new_integral(UIntTy, lineNo); + stoppoint_inst->Operands[3] = llvm_constant_new_integral(UIntTy, colNo); + stoppoint_inst->Operands[4] = G2V(dbCompileUnitGlobal); + + append_inst(Fn, load_dbg_inst); + append_inst(Fn, stoppoint_inst); + + store_dbg_inst = create_store_inst(stoppoint_inst, + Fn->ExpandInfo->dbg_global_memloc, 0); + append_inst(Fn, store_dbg_inst); + +} + +/* + emits region end intrinsic for marking function ends + */ +static void llvm_emit_region_end(llvm_function *Fn){ + llvm_instruction *dbg_call_reg_end_inst; + llvm_instruction *store_dbg_inst; + llvm_instruction *load_dbg_inst; + llvm_basicblock *last_block = llvm_ilist_back(llvm_basicblock, + Fn->BasicBlocks); + + load_dbg_inst = create_load_inst("dbg.tmp", + Fn->ExpandInfo->dbg_global_memloc, 0); + + dbg_call_reg_end_inst = llvm_instruction_new(ptrToEmptyStructTy, + "dbg.tmp", O_Call, 2); + dbg_call_reg_end_inst->Operands[0] = G2V(dbg_region_end_fn); + dbg_call_reg_end_inst->Operands[1] = D2V(load_dbg_inst); + + /* see above for description of the 'alloca trick':*/ + + store_dbg_inst = create_store_inst(dbg_call_reg_end_inst, + Fn->ExpandInfo->dbg_global_memloc, 0); + + llvm_ilist_push_front(llvm_instruction, last_block->Instructions, + store_dbg_inst); + llvm_ilist_push_front(llvm_instruction, last_block->Instructions, + dbg_call_reg_end_inst); + llvm_ilist_push_front(llvm_instruction, last_block->Instructions, + load_dbg_inst); +} + + +/* Emit intrinsics to mark variable declarations */ +static void llvm_emit_dbg_declare(llvm_function *Fn, tree t){ + /* FIXME: need to actually do this. + + See llvm_emit_dbg_stoppoint for an example of how to create a new + debug intrinsic call and chain it to the others. + + To get the type of the declaration from the tree, see + llvm_type_get_from_tree in llvm-types.c (Used several times in this + file) + + */ + +} + Index: llvm-gcc/gcc/llvm-internals.h diff -u llvm-gcc/gcc/llvm-internals.h:1.1 llvm-gcc/gcc/llvm-internals.h:1.2 --- llvm-gcc/gcc/llvm-internals.h:1.1 Thu Jan 8 16:35:32 2004 +++ llvm-gcc/gcc/llvm-internals.h Thu Nov 18 14:44:23 2004 @@ -103,4 +103,8 @@ void llvm_expand_catch_block(struct llvm_function *Fn, union tree_node *Hndlrs); void llvm_expand_eh_spec(struct llvm_function *Fn, union tree_node *TypeList); +/* Debugging info support functions. These are defined in llvm-expand.c */ +void InitDebuggerDecls(void); +void InitDebuggerTypeDecls(void); + #endif /* GCC_LLVM_INTERNALS_H */ Index: llvm-gcc/gcc/llvm-out.c diff -u llvm-gcc/gcc/llvm-out.c:1.5 llvm-gcc/gcc/llvm-out.c:1.6 --- llvm-gcc/gcc/llvm-out.c:1.5 Thu Nov 18 12:06:36 2004 +++ llvm-gcc/gcc/llvm-out.c Thu Nov 18 14:44:23 2004 @@ -60,6 +60,9 @@ llvm_InitializeProgram(); llvm_InitializeTypeSystem(); llvm_InitializeConstants(); + + if (debug_info_level > DINFO_LEVEL_NONE) + InitDebuggerTypeDecls(); } Index: llvm-gcc/gcc/llvm-out.h diff -u llvm-gcc/gcc/llvm-out.h:1.4 llvm-gcc/gcc/llvm-out.h:1.5 --- llvm-gcc/gcc/llvm-out.h:1.4 Fri May 7 14:20:26 2004 +++ llvm-gcc/gcc/llvm-out.h Thu Nov 18 14:44:23 2004 @@ -43,6 +43,10 @@ the command line, possibly NULL. */ void llvm_init_asm_output(const char *Filename); +/* emit global debug info for the file */ +void llvm_emit_debug_context_info(const char *fileName, const char *path, + const char *producer); + /* llvm_assemble_external - This function is called once for each external * function and variable as they are used. */ Index: llvm-gcc/gcc/toplev.c diff -u llvm-gcc/gcc/toplev.c:1.5 llvm-gcc/gcc/toplev.c:1.6 --- llvm-gcc/gcc/toplev.c:1.5 Fri May 7 14:20:26 2004 +++ llvm-gcc/gcc/toplev.c Thu Nov 18 14:44:23 2004 @@ -4304,7 +4304,7 @@ error ("target system does not support the \"%s\" debug format", debug_type_names[write_symbols]); - if (EMIT_LLVM) /* Disable debug output for LLVM output */ + if (EMIT_LLVM) /* LLVM does not use the standard GCC hooks for debug info */ debug_hooks = &do_nothing_debug_hooks; /* If auxiliary info generation is desired, open the output file. @@ -4407,8 +4407,24 @@ if (dump_base_name == 0) dump_base_name = name ? name : "gccdump"; - if (EMIT_LLVM) + if (EMIT_LLVM) { llvm_init_codegen(); + if (debug_info_level > DINFO_LEVEL_NONE) { + char *buf = xstrdup(name); + char *path = buf; + char *fileName = strrchr(buf, '/'); + if(fileName){ + *fileName = '\0'; + fileName++; + }else{ + path = "."; + fileName = buf; + } + + llvm_emit_debug_context_info(path, fileName, "llvm 3.4.x"); + free(buf); + } + } /* Other front-end initialization. */ if ((*lang_hooks.init) () == 0) From lattner at cs.uiuc.edu Thu Nov 18 15:03:18 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:03:18 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200411182103.iAIL3IdC025032@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.55 -> 1.56 --- Log message: Reduce the number of stoppoints emitted by not emitting redundant ones for statements like: X = 1; Y = 1; and for stuff like: void foo() { X = 1; } --- Diffs of the changes: (+13 -1) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.55 llvm-gcc/gcc/llvm-expand.c:1.56 --- llvm-gcc/gcc/llvm-expand.c:1.55 Thu Nov 18 14:44:23 2004 +++ llvm-gcc/gcc/llvm-expand.c Thu Nov 18 15:03:04 2004 @@ -730,6 +730,8 @@ llvm_instruction *dbg_call_funcstart_inst; llvm_value *dbg_global_memloc; llvm_instruction *dbg_entry_alloca; + int LastDebugLine, LastDebugCol; + llvm_basicblock *LastDebugBB; } llvm_expand_info; @@ -7642,6 +7644,17 @@ llvm_instruction *stoppoint_inst; llvm_instruction *load_dbg_inst; llvm_instruction *store_dbg_inst; + llvm_basicblock *CurBB = llvm_ilist_back(llvm_basicblock, Fn->BasicBlocks); + + /* Do not emit two consequtive identical stoppoints. */ + if (lineNo == Fn->ExpandInfo->LastDebugLine && + colNo == Fn->ExpandInfo->LastDebugCol && + CurBB == Fn->ExpandInfo->LastDebugBB) + return; + + Fn->ExpandInfo->LastDebugLine = lineNo; + Fn->ExpandInfo->LastDebugCol = colNo; + Fn->ExpandInfo->LastDebugBB = CurBB; load_dbg_inst = create_load_inst("dbg.tmp", Fn->ExpandInfo->dbg_global_memloc, 0); @@ -7710,4 +7723,3 @@ */ } - From lattner at cs.uiuc.edu Thu Nov 18 15:04:33 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:04:33 -0600 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200411182104.iAIL4XPc025045@apoc.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.33 -> 1.34 --- Log message: Add MMC --- Diffs of the changes: (+4 -0) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.33 llvm/CREDITS.TXT:1.34 --- llvm/CREDITS.TXT:1.33 Wed Oct 27 10:54:23 2004 +++ llvm/CREDITS.TXT Thu Nov 18 15:04:21 2004 @@ -76,6 +76,10 @@ W: http://nondot.org/~sabre/ D: Primary architect of LLVM +N: Michael McCracken +E: michael.mccracken at gmail.com +D: Line number support for llvmgcc + N: Vladimir Merzliakov E: wanderer at rsu.ru D: Test suite fixes for FreeBSD From lattner at cs.uiuc.edu Thu Nov 18 15:21:57 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:21:57 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/contrib/msvctest/README.txt msvctest.dsp msvctest.dsw Message-ID: <200411182121.iAILLvg1025144@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/contrib/msvctest: README.txt (r1.1) removed msvctest.dsp (r1.1) removed msvctest.dsw (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:02 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/contrib/pngminus/README makefile.std makefile.tc3 makevms.com png2pnm.bat png2pnm.c png2pnm.sh pngminus.bat pngminus.sh pnm2png.bat pnm2png.c pnm2png.sh Message-ID: <200411182122.iAILM21w025191@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/contrib/pngminus: README (r1.1) removed makefile.std (r1.1) removed makefile.tc3 (r1.1) removed makevms.com (r1.1) removed png2pnm.bat (r1.1) removed png2pnm.c (r1.1) removed png2pnm.sh (r1.1) removed pngminus.bat (r1.1) removed pngminus.sh (r1.1) removed pnm2png.bat (r1.1) removed pnm2png.c (r1.1) removed pnm2png.sh (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:01 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/projects/msvc/README.txt libpng.dsp libpng.dsw png.rc png32ms.def zlib.def zlib.dsp Message-ID: <200411182122.iAILM1lW025159@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/projects/msvc: README.txt (r1.1) removed libpng.dsp (r1.1) removed libpng.dsw (r1.1) removed png.rc (r1.1) removed png32ms.def (r1.1) removed zlib.def (r1.1) removed zlib.dsp (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:01 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/projects/netware.txt wince.txt Message-ID: <200411182122.iAILM1BE025162@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/projects: netware.txt (r1.1) removed wince.txt (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:02 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/contrib/gregbook/LICENSE Makefile.sgi Makefile.unx Makefile.w32 README makevms.com readpng.c readpng.h readpng2.c readpng2.h rpng-win.c rpng-x.c rpng2-win.c rpng2-x.c toucan.png wpng.c writepng.c writepng.h Message-ID: <200411182122.iAILM2FT025179@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/contrib/gregbook: LICENSE (r1.1) removed Makefile.sgi (r1.1) removed Makefile.unx (r1.1) removed Makefile.w32 (r1.1) removed README (r1.1) removed makevms.com (r1.1) removed readpng.c (r1.1) removed readpng.h (r1.1) removed readpng2.c (r1.1) removed readpng2.h (r1.1) removed rpng-win.c (r1.1) removed rpng-x.c (r1.1) removed rpng2-win.c (r1.1) removed rpng2-x.c (r1.1) removed toucan.png (r1.1) removed wpng.c (r1.1) removed writepng.c (r1.1) removed writepng.h (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:04 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/contrib/visupng/PngFile.c PngFile.h README.txt VisualPng.c VisualPng.dsp VisualPng.dsw VisualPng.ico VisualPng.png VisualPng.rc cexcept.h resource.h Message-ID: <200411182122.iAILM4BD025243@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/contrib/visupng: PngFile.c (r1.1) removed PngFile.h (r1.1) removed README.txt (r1.1) removed VisualPng.c (r1.1) removed VisualPng.dsp (r1.1) removed VisualPng.dsw (r1.1) removed VisualPng.ico (r1.1) removed VisualPng.png (r1.1) removed VisualPng.rc (r1.1) removed cexcept.h (r1.1) removed resource.h (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:03 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:03 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/projects/borland/libpng.bpf libpng.bpg libpng.bpr libpng.cpp libpng.readme.txt libpngstat.bpf libpngstat.bpr zlib+libpng.bpg zlib.bpf zlib.bpg zlib.bpr zlib.cpp zlibstat.bpf zlibstat.bpr Message-ID: <200411182122.iAILM3pX025211@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/projects/borland: libpng.bpf (r1.1) removed libpng.bpg (r1.1) removed libpng.bpr (r1.1) removed libpng.cpp (r1.1) removed libpng.readme.txt (r1.1) removed libpngstat.bpf (r1.1) removed libpngstat.bpr (r1.1) removed zlib+libpng.bpg (r1.1) removed zlib.bpf (r1.1) removed zlib.bpg (r1.1) removed zlib.bpr (r1.1) removed zlib.cpp (r1.1) removed zlibstat.bpf (r1.1) removed zlibstat.bpr (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:03 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:03 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/contrib/pngsuite/README basn0g01.png basn0g02.png basn0g04.png basn0g08.png basn0g16.png basn2c08.png basn2c16.png basn3p01.png basn3p02.png basn3p04.png basn3p08.png basn4a08.png basn4a16.png basn6a08.png basn6a16.png Message-ID: <200411182122.iAILM3Tf025225@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/contrib/pngsuite: README (r1.1) removed basn0g01.png (r1.1) removed basn0g02.png (r1.1) removed basn0g04.png (r1.1) removed basn0g08.png (r1.1) removed basn0g16.png (r1.1) removed basn2c08.png (r1.1) removed basn2c16.png (r1.1) removed basn3p01.png (r1.1) removed basn3p02.png (r1.1) removed basn3p04.png (r1.1) removed basn3p08.png (r1.1) removed basn4a08.png (r1.1) removed basn4a16.png (r1.1) removed basn6a08.png (r1.1) removed basn6a16.png (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:03 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:03 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/projects/beos/x86-shared.proj x86-shared.txt x86-static.proj x86-static.txt Message-ID: <200411182122.iAILM34O025229@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/projects/beos: x86-shared.proj (r1.1) removed x86-shared.txt (r1.1) removed x86-static.proj (r1.1) removed x86-static.txt (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:04 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/scripts/SCOPTIONS.ppc descrip.mms libpng-config-body.in libpng-config-head.in libpng.icc libpng.pc.in makefile.32sunu makefile.64sunu makefile.acorn makefile.aix makefile.amiga makefile.atari makefile.bc32 makefile.bd32 makefile.beos makefile.bor makefile.cygwin makefile.darwin makefile.dec makefile.dj2 makefile.freebsd makefile.gcc makefile.gcmmx makefile.hpgcc makefile.hpux makefile.ibmc makefile.intel makefile.knr makefile.linux makefile.macosx makefile.mips makefile.msc makefile.ne12bsd makefile.netbsd makefile.openbsd makefile.os2 makefile.sco makefile.sggcc makefile.sgi makefile.so9 makefile.solaris makefile.std makefile.sunos makefile.tc3 makefile.vcawin32 makefile.vcwin32 makefile.watcom makevms.com pngdef.pas pngos2.def smakefile.ppc Message-ID: <200411182122.iAILM4ms025336@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng/scripts: SCOPTIONS.ppc (r1.1) removed descrip.mms (r1.1) removed libpng-config-body.in (r1.1) removed libpng-config-head.in (r1.1) removed libpng.icc (r1.1) removed libpng.pc.in (r1.1) removed makefile.32sunu (r1.1) removed makefile.64sunu (r1.1) removed makefile.acorn (r1.1) removed makefile.aix (r1.1) removed makefile.amiga (r1.1) removed makefile.atari (r1.1) removed makefile.bc32 (r1.1) removed makefile.bd32 (r1.1) removed makefile.beos (r1.1) removed makefile.bor (r1.1) removed makefile.cygwin (r1.1) removed makefile.darwin (r1.1) removed makefile.dec (r1.1) removed makefile.dj2 (r1.1) removed makefile.freebsd (r1.1) removed makefile.gcc (r1.1) removed makefile.gcmmx (r1.1) removed makefile.hpgcc (r1.1) removed makefile.hpux (r1.1) removed makefile.ibmc (r1.1) removed makefile.intel (r1.1) removed makefile.knr (r1.1) removed makefile.linux (r1.1) removed makefile.macosx (r1.1) removed makefile.mips (r1.1) removed makefile.msc (r1.1) removed makefile.ne12bsd (r1.1) removed makefile.netbsd (r1.1) removed makefile.openbsd (r1.1) removed makefile.os2 (r1.1) removed makefile.sco (r1.1) removed makefile.sggcc (r1.1) removed makefile.sgi (r1.1) removed makefile.so9 (r1.1) removed makefile.solaris (r1.1) removed makefile.std (r1.1) removed makefile.sunos (r1.1) removed makefile.tc3 (r1.1) removed makefile.vcawin32 (r1.1) removed makefile.vcwin32 (r1.1) removed makefile.watcom (r1.1) removed makevms.com (r1.1) removed pngdef.pas (r1.1) removed pngos2.def (r1.1) removed smakefile.ppc (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:22:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:22:04 -0600 Subject: [llvm-commits] CVS: llvm/runtime/libpng/ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE LICENSE.TXT Makefile README TODO Y2KINFO configure example.c libpng.3 libpng.txt libpngpf.3 png.5 png.c png.h pngasmrd.h pngbar.jpg pngbar.png pngconf.h pngerror.c pnggccrd.c pngget.c pngmem.c pngnow.png pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c pngset.c pngtest.c pngtest.png pngtrans.c pngvcrd.c pngwio.c pngwrite.c pngwtran.c pngwutil.c Message-ID: <200411182122.iAILM4o1025349@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/libpng: ANNOUNCE (r1.1) removed CHANGES (r1.1) removed INSTALL (r1.1) removed KNOWNBUG (r1.1) removed LICENSE (r1.1) removed LICENSE.TXT (r1.1) removed Makefile (r1.3) removed README (r1.1) removed TODO (r1.1) removed Y2KINFO (r1.1) removed configure (r1.1) removed example.c (r1.1) removed libpng.3 (r1.1) removed libpng.txt (r1.1) removed libpngpf.3 (r1.1) removed png.5 (r1.1) removed png.c (r1.1) removed png.h (r1.1) removed pngasmrd.h (r1.1) removed pngbar.jpg (r1.1) removed pngbar.png (r1.1) removed pngconf.h (r1.1) removed pngerror.c (r1.1) removed pnggccrd.c (r1.1) removed pngget.c (r1.1) removed pngmem.c (r1.1) removed pngnow.png (r1.1) removed pngpread.c (r1.1) removed pngread.c (r1.1) removed pngrio.c (r1.1) removed pngrtran.c (r1.1) removed pngrutil.c (r1.1) removed pngset.c (r1.1) removed pngtest.c (r1.1) removed pngtest.png (r1.1) removed pngtrans.c (r1.1) removed pngvcrd.c (r1.1) removed pngwio.c (r1.1) removed pngwrite.c (r1.1) removed pngwtran.c (r1.1) removed pngwutil.c (r1.1) removed --- Log message: libpng is not even used by povray3.1 in the current configuration, just drop it completely. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Thu Nov 18 15:25:25 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:25:25 -0600 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200411182125.iAILPPrD025391@apoc.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.250 -> 1.251 --- Log message: Line numbers are go for 1.4! :) --- Diffs of the changes: (+4 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.250 llvm/docs/ReleaseNotes.html:1.251 --- llvm/docs/ReleaseNotes.html:1.250 Thu Nov 18 12:38:58 2004 +++ llvm/docs/ReleaseNotes.html Thu Nov 18 15:25:11 2004 @@ -108,6 +108,9 @@
    16. The LLVM source code is much more compatible with Microsoft Visual C++, including the JIT and runtime-code generation, though the entire system may not work with it.
    17. +
    18. llvmgcc and llvmg++ now emit source line number information when '-g' is + passed in. This information can be used with llvm-db or other tools and + passes.
    @@ -659,7 +662,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/18 18:38:58 $ + Last modified: $Date: 2004/11/18 21:25:11 $ From reid at x10sys.com Thu Nov 18 15:38:19 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 15:38:19 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.rules Message-ID: <200411182138.PAA16411@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.rules updated: 1.2 -> 1.3 --- Log message: Tools are now in $(BuildMode)/lib not $(BuildMode)/tools --- Diffs of the changes: (+14 -14) Index: llvm-test/Makefile.rules diff -u llvm-test/Makefile.rules:1.2 llvm-test/Makefile.rules:1.3 --- llvm-test/Makefile.rules:1.2 Thu Nov 18 04:03:47 2004 +++ llvm-test/Makefile.rules Thu Nov 18 15:38:09 2004 @@ -192,20 +192,20 @@ # PROJ* = Location of previously built tools used for linking. ########################################################################### -DESTTOOLDEBUG := $(BUILD_OBJ_ROOT)/Debug/tools -DESTTOOLRELEASE := $(BUILD_OBJ_ROOT)/Release/tools -DESTTOOLPROFILE := $(BUILD_OBJ_ROOT)/Profile/tools -DESTTOOLCURRENT := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/tools - -LLVMTOOLDEBUG := $(LLVM_OBJ_ROOT)/Debug/tools -LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/Release/tools -LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/Profile/tools -LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/$(CONFIGURATION)/tools - -PROJTOOLDEBUG := $(BUILD_OBJ_ROOT)/Debug/tools -PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/Release/tools -PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/Profile/tools -PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/tools +DESTTOOLDEBUG := $(BUILD_OBJ_ROOT)/Debug/bin +DESTTOOLRELEASE := $(BUILD_OBJ_ROOT)/Release/bin +DESTTOOLPROFILE := $(BUILD_OBJ_ROOT)/Profile/bin +DESTTOOLCURRENT := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/bin + +LLVMTOOLDEBUG := $(LLVM_OBJ_ROOT)/Debug/bin +LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/Release/bin +LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/Profile/bin +LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/$(CONFIGURATION)/bin + +PROJTOOLDEBUG := $(BUILD_OBJ_ROOT)/Debug/bin +PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/Release/bin +PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/Profile/bin +PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/$(CONFIGURATION)/bin # # Libtool is found in the current directory. From lattner at cs.uiuc.edu Thu Nov 18 15:41:31 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:41:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/IntrinsicInst.h Message-ID: <200411182141.iAILfVVt029239@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: IntrinsicInst.h updated: 1.2 -> 1.3 --- Log message: Add support for llvm.dbg.stoppoint --- Diffs of the changes: (+27 -0) Index: llvm/include/llvm/IntrinsicInst.h diff -u llvm/include/llvm/IntrinsicInst.h:1.2 llvm/include/llvm/IntrinsicInst.h:1.3 --- llvm/include/llvm/IntrinsicInst.h:1.2 Mon Oct 11 23:45:20 2004 +++ llvm/include/llvm/IntrinsicInst.h Thu Nov 18 15:41:16 2004 @@ -42,6 +42,33 @@ static Value *StripPointerCasts(Value *Ptr); }; + /// DbgStopPointInst - This represent llvm.dbg.stoppoint instructions. + /// + struct DbgStopPointInst : public IntrinsicInst { + + Value *getChain() const { return const_cast(getOperand(1)); } + unsigned getLineNo() const { + return cast(getOperand(2))->getRawValue(); + } + unsigned getColNo() const { + return cast(getOperand(3))->getRawValue(); + } + Value *getContext() const { return const_cast(getOperand(4)); } + + + // Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const DbgStopPointInst *) { return true; } + static inline bool classof(const CallInst *I) { + if (const Function *CF = I->getCalledFunction()) + return CF->getIntrinsicID() == Intrinsic::dbg_stoppoint; + return false; + } + static inline bool classof(const Value *V) { + return isa(V) && classof(cast(V)); + } + }; + + /// MemIntrinsic - This is the common base class for memset/memcpy/memmove. /// From lattner at cs.uiuc.edu Thu Nov 18 15:41:51 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 15:41:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200411182141.iAILfpY9029249@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.285 -> 1.286 --- Log message: Delete stoppoints that occur for the same source line. --- Diffs of the changes: (+11 -1) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.285 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.286 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.285 Sun Nov 14 23:54:07 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Nov 18 15:41:39 2004 @@ -182,7 +182,7 @@ assert(I.use_empty() && "Cannot erase instruction that is used!"); AddUsesToWorkList(I); removeFromWorkList(&I); - I.getParent()->getInstList().erase(&I); + I.eraseFromParent(); return 0; // Don't do anything with FI } @@ -3217,6 +3217,16 @@ } if (Changed) return &CI; + } else if (DbgStopPointInst *SPI = dyn_cast(&CI)) { + // If this stoppoint is at the same source location as the previous + // stoppoint in the chain, it is not needed. + if (DbgStopPointInst *PrevSPI = + dyn_cast(SPI->getChain())) + if (SPI->getLineNo() == PrevSPI->getLineNo() && + SPI->getColNo() == PrevSPI->getColNo()) { + SPI->replaceAllUsesWith(PrevSPI); + return EraseInstFromFunction(CI); + } } return visitCallSite(&CI); From tbrethou at cs.uiuc.edu Thu Nov 18 19:25:31 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 18 Nov 2004 19:25:31 -0600 (CST) Subject: [llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html Message-ID: <200411190125.TAA00941@kain.cs.uiuc.edu> Changes in directory llvm/docs: WritingAnLLVMPass.html updated: 1.33 -> 1.34 --- Log message: Added link to information on Statistic which is in the Programmers Manual. --- Diffs of the changes: (+19 -1) Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.33 llvm/docs/WritingAnLLVMPass.html:1.34 --- llvm/docs/WritingAnLLVMPass.html:1.33 Sun Sep 19 23:36:29 2004 +++ llvm/docs/WritingAnLLVMPass.html Thu Nov 18 19:25:14 2004 @@ -77,6 +77,7 @@
  • Analysis Group Concepts
  • Using RegisterAnalysisGroup
  • +
  • Pass Statistics
  • What PassManager does
    • The releaseMemory method
    • @@ -1205,6 +1206,23 @@ + + +
      +

      The file Statistic +class, is designed to be an easy way to expose various success +metrics from passes. These statistics are printed at the end of a +run, when the -stats command line option is enabled on the command +line. See the Statistics section in the Programmers Manual for details. + +

      + + + + @@ -1571,7 +1589,7 @@ Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/09/20 04:36:29 $ + Last modified: $Date: 2004/11/19 01:25:14 $ From tbrethou at cs.uiuc.edu Thu Nov 18 19:26:50 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 18 Nov 2004 19:26:50 -0600 (CST) Subject: [llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html Message-ID: <200411190126.TAA01066@kain.cs.uiuc.edu> Changes in directory llvm/docs: WritingAnLLVMPass.html updated: 1.34 -> 1.35 --- Log message: Fixed a typo. --- Diffs of the changes: (+3 -3) Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.34 llvm/docs/WritingAnLLVMPass.html:1.35 --- llvm/docs/WritingAnLLVMPass.html:1.34 Thu Nov 18 19:25:14 2004 +++ llvm/docs/WritingAnLLVMPass.html Thu Nov 18 19:26:37 2004 @@ -1211,12 +1211,12 @@
      -

      The file The Statistic class, is designed to be an easy way to expose various success metrics from passes. These statistics are printed at the end of a run, when the -stats command line option is enabled on the command -line. See the Statistics section in the Programmers Manual for details. +line. See the Statistics section in the Programmer's Manual for details.

      @@ -1589,7 +1589,7 @@ Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/11/19 01:25:14 $ + Last modified: $Date: 2004/11/19 01:26:37 $ From natebegeman at mac.com Thu Nov 18 20:06:51 2004 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 18 Nov 2004 20:06:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200411190206.UAA21746@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.105 -> 1.106 --- Log message: Generate fewer reg-reg copies for the register allocator to deal with. This eliminates over 2000 in hbd alone. --- Diffs of the changes: (+39 -64) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.105 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.106 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.105 Thu Nov 18 01:22:46 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Thu Nov 18 20:06:40 2004 @@ -1496,16 +1496,7 @@ // If this is a simple constant, just emit a load directly to avoid the copy if (ConstantInt *CI = dyn_cast(Val)) { - int TheVal = CI->getRawValue() & 0xFFFFFFFF; - - if (TheVal < 32768 && TheVal >= -32768) { - BuildMI(BB, PPC::LI, 1, targetReg).addSImm(TheVal); - } else { - unsigned TmpReg = makeAnotherReg(Type::IntTy); - BuildMI(BB, PPC::LIS, 1, TmpReg).addSImm(TheVal >> 16); - BuildMI(BB, PPC::ORI, 2, targetReg).addReg(TmpReg) - .addImm(TheVal & 0xFFFF); - } + copyConstantToRegister(BB, BB->end(), CI, targetReg); return; } } @@ -3330,10 +3321,11 @@ } // Make sure we're dealing with a full 32 bits - unsigned TmpReg = makeAnotherReg(Type::IntTy); - promote32(TmpReg, ValueRecord(SrcReg, SrcTy)); - - SrcReg = TmpReg; + if (SrcClass < cInt) { + unsigned TmpReg = makeAnotherReg(Type::IntTy); + promote32(TmpReg, ValueRecord(SrcReg, SrcTy)); + SrcReg = TmpReg; + } // Spill the integer to memory and reload it from there. // Also spill room for a special conversion constant @@ -3499,15 +3491,9 @@ if (sourceUnsigned && destUnsigned) { // handle long dest class now to keep switch clean if (DestClass == cLong) { - if (SrcClass == cLong) { - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg+1) - .addReg(SrcReg+1); - } else { - BuildMI(*MBB, IP, PPC::LI, 1, DestReg).addSImm(0); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) - .addReg(SrcReg); - } + BuildMI(*MBB, IP, PPC::LI, 1, DestReg).addSImm(0); + BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) + .addReg(SrcReg); return; } @@ -3516,21 +3502,15 @@ switch (SrcClass) { case cByte: case cShort: - if (SrcClass == DestClass) - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); - else - BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg) - .addImm(0).addImm(clearBits).addImm(31); + BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg) + .addImm(0).addImm(clearBits).addImm(31); break; case cLong: ++SrcReg; // Fall through case cInt: - if (DestClass == cInt) - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); - else - BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg) - .addImm(0).addImm(clearBits).addImm(31); + BuildMI(*MBB, IP, PPC::RLWINM, 4, DestReg).addReg(SrcReg) + .addImm(0).addImm(clearBits).addImm(31); break; } return; @@ -3540,15 +3520,9 @@ if (!sourceUnsigned && !destUnsigned) { // handle long dest class now to keep switch clean if (DestClass == cLong) { - if (SrcClass == cLong) { - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg+1) - .addReg(SrcReg+1); - } else { - BuildMI(*MBB, IP, PPC::SRAWI, 2, DestReg).addReg(SrcReg).addImm(31); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) - .addReg(SrcReg); - } + BuildMI(*MBB, IP, PPC::SRAWI, 2, DestReg).addReg(SrcReg).addImm(31); + BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) + .addReg(SrcReg); return; } @@ -3582,15 +3556,9 @@ if (sourceUnsigned && !destUnsigned) { // handle long dest class now to keep switch clean if (DestClass == cLong) { - if (SrcClass == cLong) { - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg+1). - addReg(SrcReg+1); - } else { - BuildMI(*MBB, IP, PPC::LI, 1, DestReg).addSImm(0); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) - .addReg(SrcReg); - } + BuildMI(*MBB, IP, PPC::LI, 1, DestReg).addSImm(0); + BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) + .addReg(SrcReg); return; } @@ -3627,15 +3595,9 @@ if (!sourceUnsigned && destUnsigned) { // handle long dest class now to keep switch clean if (DestClass == cLong) { - if (SrcClass == cLong) { - BuildMI(*MBB, IP, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg+1) - .addReg(SrcReg+1); - } else { - BuildMI(*MBB, IP, PPC::SRAWI, 2, DestReg).addReg(SrcReg).addImm(31); - BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) - .addReg(SrcReg); - } + BuildMI(*MBB, IP, PPC::SRAWI, 2, DestReg).addReg(SrcReg).addImm(31); + BuildMI(*MBB, IP, PPC::OR, 2, DestReg+1).addReg(SrcReg) + .addReg(SrcReg); return; } @@ -3817,10 +3779,23 @@ cgo_e = ops.end(); cgo_i != cgo_e; ++cgo_i) { CollapsedGepOp& cgo = *cgo_i; - unsigned TmpReg1 = makeAnotherReg(Type::IntTy); - unsigned TmpReg2 = makeAnotherReg(Type::IntTy); - doMultiplyConst(MBB, IP, TmpReg1, cgo.index, cgo.size); - emitBinaryConstOperation(MBB, IP, TmpReg1, cgo.offset, 0, TmpReg2); + // Avoid emitting known move instructions here for the register allocator + // to deal with later. val * 1 == val. val + 0 == val. + unsigned TmpReg1; + if (cgo.size->getValue() == 1) { + TmpReg1 = getReg(cgo.index, MBB, IP); + } else { + TmpReg1 = makeAnotherReg(Type::IntTy); + doMultiplyConst(MBB, IP, TmpReg1, cgo.index, cgo.size); + } + + unsigned TmpReg2; + if (cgo.offset->isNullValue()) { + TmpReg2 = TmpReg1; + } else { + TmpReg2 = makeAnotherReg(Type::IntTy); + emitBinaryConstOperation(MBB, IP, TmpReg1, cgo.offset, 0, TmpReg2); + } if (indexReg == 0) indexReg = TmpReg2; From llvm at cs.uiuc.edu Thu Nov 18 20:26:00 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Thu, 18 Nov 2004 20:26:00 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/ Message-ID: <200411190226.UAA21938@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: --- Log message: Directory /var/cvs/llvm/llvm/test/Regression/Archive added to the repository --- Diffs of the changes: (+0 -0) From reid at x10sys.com Thu Nov 18 20:26:46 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 20:26:46 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/dg.exp Message-ID: <200411190226.UAA21970@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: dg.exp added (r1.1) --- Log message: Obligatory DejaGnu/expect file. --- Diffs of the changes: (+3 -0) Index: llvm/test/Regression/Archive/dg.exp diff -c /dev/null llvm/test/Regression/Archive/dg.exp:1.1 *** /dev/null Thu Nov 18 20:26:45 2004 --- llvm/test/Regression/Archive/dg.exp Thu Nov 18 20:26:35 2004 *************** *** 0 **** --- 1,3 ---- + load_lib llvm-dg.exp + + llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From reid at x10sys.com Thu Nov 18 21:13:36 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:13:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp Message-ID: <200411190313.VAA22465@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.36 -> 1.37 --- Log message: Reduce the amount of work in LinkInArchive by not searching the archive for symbols it has already identified as not defining. --- Diffs of the changes: (+36 -10) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.36 llvm/lib/Linker/LinkArchives.cpp:1.37 --- llvm/lib/Linker/LinkArchives.cpp:1.36 Tue Nov 16 00:47:41 2004 +++ llvm/lib/Linker/LinkArchives.cpp Thu Nov 18 21:13:25 2004 @@ -16,6 +16,7 @@ #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" +#include "llvm/ADT/SetOperations.h" #include "llvm/Bytecode/Reader.h" #include "llvm/Bytecode/Archive.h" #include "llvm/Bytecode/WriteBytecodePass.h" @@ -25,6 +26,7 @@ #include "llvm/Config/config.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" +#include "llvm/Support/Timer.h" #include "llvm/System/Signals.h" #include "llvm/Support/SystemUtils.h" #include @@ -106,7 +108,7 @@ llvm::GetAllUndefinedSymbols(Module *M, std::set &UndefinedSymbols) { std::set DefinedSymbols; - UndefinedSymbols.clear(); // Start out empty + UndefinedSymbols.clear(); for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (I->hasName()) { @@ -172,6 +174,7 @@ // no reason to link in any archive files. std::set UndefinedSymbols; GetAllUndefinedSymbols(M, UndefinedSymbols); + if (UndefinedSymbols.empty()) { if (Verbose) std::cerr << " No symbols undefined, don't link library!\n"; return false; // No need to link anything in! @@ -184,35 +187,58 @@ Archive* arch = AutoArch.get(); + // Save a set of symbols that are not defined by the archive. Since we're + // entering a loop, there's no point searching for these multiple times. This + // variable is used to "set_subtract" from the set of undefined symbols. + std::set NotDefinedByArchive; + // While we are linking in object files, loop. while (true) { + + // Find the modules we need to link into the target module std::set Modules; - // Find the modules we need to link arch->findModulesDefiningSymbols(UndefinedSymbols, Modules); - // If we didn't find any more modules to link this time, we are done. + // If we didn't find any more modules to link this time, we are done + // searching this archive. if (Modules.empty()) break; + // Any symbols remaining in UndefinedSymbols after + // findModulesDefiningSymbols are ones that the archive does not define. So + // we add them to the NotDefinedByArchive variable now. + NotDefinedByArchive.insert(UndefinedSymbols.begin(), + UndefinedSymbols.end());; + // Loop over all the ModuleProviders that we got back from the archive for (std::set::iterator I=Modules.begin(), E=Modules.end(); I != E; ++I) { + // Get the module we must link in. std::auto_ptr AutoModule( (*I)->releaseModule() ); - Module* aModule = AutoModule.get(); // Link it in if (LinkModules(M, aModule, ErrorMessage)) - return true; // Couldn't link in the right object file... + return true; // Couldn't link in the module } - // We have linked in a set of modules determined by the archive to satisfy - // our missing symbols. Linking in the new modules will have satisfied some - // symbols but may introduce additional missing symbols. We need to update - // the list of undefined symbols and try again until the archive doesn't - // have any modules that satisfy our symbols. + // Get the undefined symbols from the aggregate module. This recomputes the + // symbols we still need after the new modules have been linked in. GetAllUndefinedSymbols(M, UndefinedSymbols); + + // At this point we have two sets of undefined symbols: UndefinedSymbols + // which holds the undefined symbols from all the modules, and + // NotDefinedByArchive which holds symbols we know the archive doesn't + // define. There's no point searching for symbols that we won't find in the + // archive so we subtract these sets. + set_subtract,std::set >( + UndefinedSymbols,NotDefinedByArchive); + + // If there's no symbols left, no point in continuing to search the + // archive. + if (UndefinedSymbols.empty()) + break; } return false; From reid at x10sys.com Thu Nov 18 21:18:33 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:18:33 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Archive.h Message-ID: <200411190318.VAA22554@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Archive.h updated: 1.6 -> 1.7 --- Log message: Make findModulesDefiningSymbols modify its symbols argument so we can \ eliminate symbols defined by the archive efficiently --- Diffs of the changes: (+6 -3) Index: llvm/include/llvm/Bytecode/Archive.h diff -u llvm/include/llvm/Bytecode/Archive.h:1.6 llvm/include/llvm/Bytecode/Archive.h:1.7 --- llvm/include/llvm/Bytecode/Archive.h:1.6 Tue Nov 16 00:46:55 2004 +++ llvm/include/llvm/Bytecode/Archive.h Thu Nov 18 21:18:22 2004 @@ -396,11 +396,14 @@ /// more than one symbol at a time. If \p symbols contains a list of /// undefined symbols in some module, then calling this method is like /// making one complete pass through the archive to resolve symbols but is - /// more efficient than looking at the individual members. + /// more efficient than looking at the individual members. Note that on + /// exit, the symbols resolved by this method will be removed from \p + /// symbols to ensure they are not re-searched on a subsequent call. If + /// you need to retain the list of symbols, make a copy. /// @brief Look up multiple symbols in the archive. void findModulesDefiningSymbols( - const std::set& symbols, ///< Symbols to be sought - std::set& modules ///< The modules matching \p symbols + std::set& symbols, ///< Symbols to be sought + std::set& modules ///< The modules matching \p symbols ); /// @} From reid at x10sys.com Thu Nov 18 21:18:33 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:18:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp Message-ID: <200411190318.VAA22557@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.27 -> 1.28 --- Log message: Make findModulesDefiningSymbols modify its symbols argument so we can \ eliminate symbols defined by the archive efficiently --- Diffs of the changes: (+14 -3) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.27 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.28 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.27 Wed Nov 17 12:25:21 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Thu Nov 18 21:18:22 2004 @@ -407,7 +407,7 @@ // Look up multiple symbols in the symbol table and return a set of // ModuleProviders that define those symbols. void -Archive::findModulesDefiningSymbols(const std::set& symbols, +Archive::findModulesDefiningSymbols(std::set& symbols, std::set& result) { assert(mapfile && base && "Can't findModulesDefiningSymbols on new archive"); @@ -462,11 +462,22 @@ // At this point we have a valid symbol table (one way or another) so we // just use it to quickly find the symbols requested. - for (std::set::const_iterator I=symbols.begin(), - E=symbols.end(); I != E; ++I) { + for (std::set::iterator I=symbols.begin(), + E=symbols.end(); I != E;) { + // See if this symbol exists ModuleProvider* mp = findModuleDefiningSymbol(*I); if (mp) { + // The symbol exists, insert the ModuleProvider into our result, + // duplicates wil be ignored result.insert(mp); + + // Remove the symbol now that its been resolved, being careful to + // not invalidate our iterator. + std::set::iterator save = I; + ++I; + symbols.erase(save); + } else { + ++I; } } } From reid at x10sys.com Thu Nov 18 21:20:20 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:20:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200411190320.VAA22602@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.31 -> 1.32 --- Log message: Make a cast explicit. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.31 llvm/lib/Support/Timer.cpp:1.32 --- llvm/lib/Support/Timer.cpp:1.31 Wed Sep 1 17:55:35 2004 +++ llvm/lib/Support/Timer.cpp Thu Nov 18 21:20:09 2004 @@ -148,7 +148,7 @@ } TimeRecord Result; - Result.Elapsed = T.tv_sec + T.tv_usec/1000000.0; + Result.Elapsed = double(T.tv_sec) + T.tv_usec/1000000.0; Result.UserTime = RU.ru_utime.tv_sec + RU.ru_utime.tv_usec/1000000.0; Result.SystemTime = RU.ru_stime.tv_sec + RU.ru_stime.tv_usec/1000000.0; Result.MemUsed = MemUsed; From reid at x10sys.com Thu Nov 18 21:24:13 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:24:13 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/IsNAN.o evenlen oddlen very_long_bytecode_file_name.bc Message-ID: <200411190324.VAA22643@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: IsNAN.o added (r1.1) evenlen added (r1.1) oddlen added (r1.1) very_long_bytecode_file_name.bc added (r1.1) --- Log message: A test file that goes into the test archive. --- Diffs of the changes: (+2 -0) Index: llvm/test/Regression/Archive/IsNAN.o Index: llvm/test/Regression/Archive/evenlen diff -c /dev/null llvm/test/Regression/Archive/evenlen:1.1 *** /dev/null Thu Nov 18 21:24:13 2004 --- llvm/test/Regression/Archive/evenlen Thu Nov 18 21:24:02 2004 *************** *** 0 **** --- 1 ---- + evenlen Index: llvm/test/Regression/Archive/oddlen diff -c /dev/null llvm/test/Regression/Archive/oddlen:1.1 *** /dev/null Thu Nov 18 21:24:13 2004 --- llvm/test/Regression/Archive/oddlen Thu Nov 18 21:24:02 2004 *************** *** 0 **** --- 1 ---- + oddlen Index: llvm/test/Regression/Archive/very_long_bytecode_file_name.bc From reid at x10sys.com Thu Nov 18 21:27:16 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:27:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp Message-ID: <200411190327.VAA22702@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.37 -> 1.38 --- Log message: Eliminate unsightly ;; --- Diffs of the changes: (+1 -1) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.37 llvm/lib/Linker/LinkArchives.cpp:1.38 --- llvm/lib/Linker/LinkArchives.cpp:1.37 Thu Nov 18 21:13:25 2004 +++ llvm/lib/Linker/LinkArchives.cpp Thu Nov 18 21:27:05 2004 @@ -208,7 +208,7 @@ // findModulesDefiningSymbols are ones that the archive does not define. So // we add them to the NotDefinedByArchive variable now. NotDefinedByArchive.insert(UndefinedSymbols.begin(), - UndefinedSymbols.end());; + UndefinedSymbols.end()); // Loop over all the ModuleProviders that we got back from the archive for (std::set::iterator I=Modules.begin(), E=Modules.end(); From reid at x10sys.com Thu Nov 18 21:42:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:42:07 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/SVR4.a xpg4.a Message-ID: <200411190342.VAA22901@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: SVR4.a added (r1.1) xpg4.a added (r1.1) --- Log message: Solaris built archives in SVR4 and XPG4 styles. --- Diffs of the changes: (+0 -0) Index: llvm/test/Regression/Archive/SVR4.a Index: llvm/test/Regression/Archive/xpg4.a From reid at x10sys.com Thu Nov 18 21:44:21 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 21:44:21 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp Message-ID: <200411190344.VAA22952@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.28 -> 1.29 --- Log message: Don't save an iterator, just use post-increment. --- Diffs of the changes: (+2 -4) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.28 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.29 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.28 Thu Nov 18 21:18:22 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Thu Nov 18 21:44:10 2004 @@ -472,10 +472,8 @@ result.insert(mp); // Remove the symbol now that its been resolved, being careful to - // not invalidate our iterator. - std::set::iterator save = I; - ++I; - symbols.erase(save); + // post-increment the iterator. + symbols.erase(I++); } else { ++I; } From reid at x10sys.com Thu Nov 18 22:33:24 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 22:33:24 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/SVR4.ll Message-ID: <200411190433.WAA23367@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: SVR4.ll added (r1.1) --- Log message: Test case for reading SVR4 style archives. --- Diffs of the changes: (+7 -0) Index: llvm/test/Regression/Archive/SVR4.ll diff -c /dev/null llvm/test/Regression/Archive/SVR4.ll:1.1 *** /dev/null Thu Nov 18 22:33:23 2004 --- llvm/test/Regression/Archive/SVR4.ll Thu Nov 18 22:33:13 2004 *************** *** 0 **** --- 1,7 ---- + ; This isn't really an assembly file, its just here to + ; run the following test which tests llvm-ar for compatibility + ; reading SVR4 style archives. + + ; RUN: ar t SVR4.a > %t1 + ; RUN: llvm-ar t SVR4.a > %t2 + ; RUN: diff %t1 %t2 From lattner at cs.uiuc.edu Thu Nov 18 22:39:16 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 22:39:16 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200411190439.iAJ4dFIu004036@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.56 -> 1.57 --- Log message: Simplify debugging intrinsic support by inserting the initialization calls into the function when we start the function instead of inserting them after the function is done being processed. This allows us to print out a function before it is finished without triggering assertion failures in the printer. --- Diffs of the changes: (+23 -52) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.56 llvm-gcc/gcc/llvm-expand.c:1.57 --- llvm-gcc/gcc/llvm-expand.c:1.56 Thu Nov 18 15:03:04 2004 +++ llvm-gcc/gcc/llvm-expand.c Thu Nov 18 22:39:01 2004 @@ -71,7 +71,6 @@ static void llvm_emit_dbg_declare(llvm_function *Fn, tree t); static void llvm_emit_region_end(llvm_function *Fn); static void llvm_emit_dbg_function_info(struct llvm_function *Fn); -static void llvm_emit_dbg_function_start(llvm_function *Fn); /*===----------------------------------------------------------------------===** ... Helper functions for Instruction Emission ... @@ -727,9 +726,7 @@ llvm_basicblock *IndirectGotoBlock; /* Debug info */ - llvm_instruction *dbg_call_funcstart_inst; llvm_value *dbg_global_memloc; - llvm_instruction *dbg_entry_alloca; int LastDebugLine, LastDebugCol; llvm_basicblock *LastDebugBB; @@ -6905,13 +6902,6 @@ &DECL_SOURCE_LOCATION (decl), decl); } - /* emit global with info and call to function start intrinsic - * do this after the body is expanded so when we insert at - * the beginning, we don't get bumped later by alloca's. - */ - if (debug_info_level > DINFO_LEVEL_NONE) - llvm_emit_dbg_function_start(Fn); - /* Output the label for the actual return from the function. */ llvm_emit_label(Fn, Fn->ExpandInfo->ReturnBlock); @@ -7342,7 +7332,7 @@ /* Infer language of file, stolen from dwarf2out.c */ const char *language_string = lang_hooks.name; if (strcmp (language_string, "GNU C++") == 0) - LLVM_DEBUG_LANG_CODE = 0x0004; /*DW_LANG_C_plus_plus;*/ + LLVM_DEBUG_LANG_CODE = 0x0004; /*DW_LANG_C_plus_plus;*/ else if (strcmp (language_string, "GNU Ada") == 0) LLVM_DEBUG_LANG_CODE = 0x000d; /* DW_LANG_Ada95; */ else if (strcmp (language_string, "GNU F77") == 0) @@ -7392,9 +7382,6 @@ * it sets a static variable in this file to allow other emitted * debug intrinsics to refer to that function. */ -/* static llvm_instruction *dbg_call_funcstart_inst; */ -/* static llvm_value *dbg_global_memloc = 0; */ -/* static llvm_instruction *dbg_entry_alloca = 0; */ static llvm_global *dbg_func_info_global; @@ -7406,6 +7393,11 @@ llvm_global *funcNameStr = 0; llvm_value **Elements = 0; llvm_instruction *gep = 0; + llvm_instruction *I, *AI; + llvm_basicblock *EntryBB = llvm_ilist_front(llvm_basicblock, Fn->BasicBlocks); + llvm_instruction *InsertPoint = llvm_ilist_begin(EntryBB->Instructions); + llvm_instruction *End = llvm_ilist_end(EntryBB->Instructions); + funcNameStr = EmitGlobalString(func_name); Elements = (llvm_value**) xcalloc(7, sizeof(llvm_value*)); @@ -7429,38 +7421,11 @@ dbg_func_info_global->Linkage = L_External; dbg_func_info_global->Init = CA; - llvm_ilist_push_back(llvm_global, TheProgram.Globals, dbg_func_info_global); - Fn->ExpandInfo->dbg_entry_alloca = create_alloca_inst("dbg", - ptrToEmptyStructTy, - llvm_constant_uint_1); - Fn->ExpandInfo->dbg_global_memloc = D2V(Fn->ExpandInfo->dbg_entry_alloca); - -} - - -/* - llvm_emit_dbg_function_start - emits the instruction that was built in emit_dbg_function_info - */ -static void llvm_emit_dbg_function_start(llvm_function *Fn) { - /* get start of first basic block. */ - llvm_basicblock *entryBlock = llvm_ilist_front(llvm_basicblock, - Fn->BasicBlocks); - - llvm_instruction *storeFuncCall = 0; - - /* prep function.start call */ - - Fn->ExpandInfo->dbg_call_funcstart_inst = - llvm_instruction_new(ptrToEmptyStructTy, "dbg", O_Call, 2); - - Fn->ExpandInfo->dbg_call_funcstart_inst->Operands[0] = - G2V(dbg_func_start_fn); - Fn->ExpandInfo->dbg_call_funcstart_inst->Operands[1] = - G2V(dbg_func_info_global); - + /* Insert the dbg chain start at the end of the allocas in the function. */ + while (InsertPoint != End && InsertPoint->Opcode == O_Alloca) + InsertPoint = InsertPoint->Next; /* the 'alloca trick': store into a memory location to force debug intrinsics to become SSA @@ -7471,18 +7436,24 @@ call dbg.func.start store */ - storeFuncCall = create_store_inst(Fn->ExpandInfo->dbg_call_funcstart_inst, - Fn->ExpandInfo->dbg_entry_alloca, 0); - llvm_ilist_push_front(llvm_instruction, entryBlock->Instructions, - storeFuncCall); - llvm_ilist_push_front(llvm_instruction, entryBlock->Instructions, - Fn->ExpandInfo->dbg_call_funcstart_inst); - llvm_ilist_push_front(llvm_instruction, entryBlock->Instructions, - Fn->ExpandInfo->dbg_entry_alloca); + AI = I = create_alloca_inst("dbg", ptrToEmptyStructTy, llvm_constant_uint_1); + llvm_ilist_insert(llvm_instruction, EntryBB->Instructions, InsertPoint, I); + Fn->ExpandInfo->dbg_global_memloc = D2V(I); + + /* Emit function.start call */ + I = llvm_instruction_new(ptrToEmptyStructTy, "dbg", O_Call, 2); + I->Operands[0] = G2V(dbg_func_start_fn); + I->Operands[1] = G2V(dbg_func_info_global); + llvm_ilist_insert(llvm_instruction, EntryBB->Instructions, InsertPoint, I); + + /* Store the result of the dbg.function.start call into the alloca. */ + I = create_store_inst(D2V(I), D2V(AI), 0); + llvm_ilist_insert(llvm_instruction, EntryBB->Instructions, InsertPoint, I); } + /* InitDebuggerTypeDecls inits type decls for debugger types, * declarations for debugger intrinsics * ^--- (some are currently unused in the generated bytecode) From reid at x10sys.com Thu Nov 18 22:45:29 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 22:45:29 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/SVR4.ll Message-ID: <200411190445.WAA23464@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: SVR4.ll updated: 1.1 -> 1.2 --- Log message: Test reading of SVR4 style archives with llvm-ar --- Diffs of the changes: (+3 -3) Index: llvm/test/Regression/Archive/SVR4.ll diff -u llvm/test/Regression/Archive/SVR4.ll:1.1 llvm/test/Regression/Archive/SVR4.ll:1.2 --- llvm/test/Regression/Archive/SVR4.ll:1.1 Thu Nov 18 22:33:13 2004 +++ llvm/test/Regression/Archive/SVR4.ll Thu Nov 18 22:45:19 2004 @@ -2,6 +2,6 @@ ; run the following test which tests llvm-ar for compatibility ; reading SVR4 style archives. -; RUN: ar t SVR4.a > %t1 -; RUN: llvm-ar t SVR4.a > %t2 -; RUN: diff %t1 %t2 +; RUN: ar t SVR4.a > Output/svr1 +; RUN: llvm-ar t SVR4.a > Output/svr2 +; RUN: diff Output/svr1 Output/svr2 From reid at x10sys.com Thu Nov 18 22:46:20 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 22:46:20 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/xpg4.ll Message-ID: <200411190446.WAA23488@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: xpg4.ll added (r1.1) --- Log message: Test case for xpg4 style archive files. --- Diffs of the changes: (+7 -0) Index: llvm/test/Regression/Archive/xpg4.ll diff -c /dev/null llvm/test/Regression/Archive/xpg4.ll:1.1 *** /dev/null Thu Nov 18 22:46:20 2004 --- llvm/test/Regression/Archive/xpg4.ll Thu Nov 18 22:46:10 2004 *************** *** 0 **** --- 1,7 ---- + ; This isn't really an assembly file, its just here to + ; run the following test which tests llvm-ar for compatibility + ; reading xpg4 style archives. + + ; RUN: ar t xpg4.a > Output/xpg1 + ; RUN: llvm-ar t SVR4.a > Output/xpg2 + ; RUN: diff Output/xpg1 Output/xpg2 From lattner at cs.uiuc.edu Thu Nov 18 22:49:59 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 22:49:59 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200411190449.iAJ4nxlq008451@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.57 -> 1.58 --- Log message: Fix a problem where we could not compile catch blocks with debug info. --- Diffs of the changes: (+11 -4) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.57 llvm-gcc/gcc/llvm-expand.c:1.58 --- llvm-gcc/gcc/llvm-expand.c:1.57 Thu Nov 18 22:39:01 2004 +++ llvm-gcc/gcc/llvm-expand.c Thu Nov 18 22:49:45 2004 @@ -1413,10 +1413,17 @@ llvm_instruction *I = llvm_ilist_front(llvm_instruction, EvalBlock->Instructions); llvm_instruction *Set; - assert(I->Opcode == O_Call && I->Operands[0]->VTy == Function && - !strcmp(I->Operands[0]->Name, - "__llvm_cxxeh_begin_catch_if_isa") && - "Not a call to __llvm_cxxeh_begin_catch_if_isa!"); + + /* Because we have debug information, search for the call to + * __llvm_cxxeh_begin_catch_if_isa, which may be after some debugging + * related stuff. + */ + while (I->Opcode != O_Call || I->Operands[0]->VTy != Function || + strcmp(I->Operands[0]->Name, "__llvm_cxxeh_begin_catch_if_isa")) { + assert(I != llvm_ilist_end(EvalBlock->Instructions) && + "Did not find call to __llvm_cxxeh_begin_catch_if_isa!"); + I = I->Next; + } /* Move the ...isa call into the EvalBlock */ llvm_ilist_splice(llvm_instruction, CondBlock->Instructions, From reid at x10sys.com Thu Nov 18 22:59:18 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 18 Nov 2004 22:59:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200411190459.WAA23632@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.32 -> 1.33 --- Log message: Undo last change as its unnecessary. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.32 llvm/lib/Support/Timer.cpp:1.33 --- llvm/lib/Support/Timer.cpp:1.32 Thu Nov 18 21:20:09 2004 +++ llvm/lib/Support/Timer.cpp Thu Nov 18 22:59:07 2004 @@ -148,7 +148,7 @@ } TimeRecord Result; - Result.Elapsed = double(T.tv_sec) + T.tv_usec/1000000.0; + Result.Elapsed = T.tv_sec + T.tv_usec/1000000.0; Result.UserTime = RU.ru_utime.tv_sec + RU.ru_utime.tv_usec/1000000.0; Result.SystemTime = RU.ru_stime.tv_sec + RU.ru_stime.tv_usec/1000000.0; Result.MemUsed = MemUsed; From lattner at cs.uiuc.edu Thu Nov 18 23:26:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 18 Nov 2004 23:26:01 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c Message-ID: <200411190526.iAJ5Q0oV019499@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-expand.c updated: 1.58 -> 1.59 --- Log message: Function info descriptors should have internal linkage, not external, otherwise inline functions will conflict with each other. --- Diffs of the changes: (+2 -4) Index: llvm-gcc/gcc/llvm-expand.c diff -u llvm-gcc/gcc/llvm-expand.c:1.58 llvm-gcc/gcc/llvm-expand.c:1.59 --- llvm-gcc/gcc/llvm-expand.c:1.58 Thu Nov 18 22:49:45 2004 +++ llvm-gcc/gcc/llvm-expand.c Thu Nov 18 23:25:46 2004 @@ -7390,8 +7390,6 @@ * debug intrinsics to refer to that function. */ -static llvm_global *dbg_func_info_global; - static void llvm_emit_dbg_function_info(llvm_function *Fn) { char *func_name = G2V(Fn)->Name; char *gFuncName = 0; @@ -7404,7 +7402,7 @@ llvm_basicblock *EntryBB = llvm_ilist_front(llvm_basicblock, Fn->BasicBlocks); llvm_instruction *InsertPoint = llvm_ilist_begin(EntryBB->Instructions); llvm_instruction *End = llvm_ilist_end(EntryBB->Instructions); - + llvm_global *dbg_func_info_global; funcNameStr = EmitGlobalString(func_name); Elements = (llvm_value**) xcalloc(7, sizeof(llvm_value*)); @@ -7426,7 +7424,7 @@ dbg_func_info_global = llvm_global_new(dbGlobalTy, gFuncName); free(gFuncName); - dbg_func_info_global->Linkage = L_External; + dbg_func_info_global->Linkage = L_Internal; dbg_func_info_global->Init = CA; llvm_ilist_push_back(llvm_global, TheProgram.Globals, dbg_func_info_global); From lattner at cs.uiuc.edu Fri Nov 19 01:09:56 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 01:09:56 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp Message-ID: <200411190709.iAJ79ucM026203@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Miscompilation.cpp updated: 1.54 -> 1.55 --- Log message: Fix a bug in the checkin where I adjusted this code to work when LinkModules nukes the second module argument. --- Diffs of the changes: (+8 -7) Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.54 llvm/tools/bugpoint/Miscompilation.cpp:1.55 --- llvm/tools/bugpoint/Miscompilation.cpp:1.54 Tue Nov 16 00:31:38 2004 +++ llvm/tools/bugpoint/Miscompilation.cpp Fri Nov 19 01:09:40 2004 @@ -295,8 +295,9 @@ std::vector > MisCompFunctions; for (Module::iterator I = ToOptimizeLoopExtracted->begin(), E = ToOptimizeLoopExtracted->end(); I != E; ++I) - MisCompFunctions.push_back(std::make_pair(I->getName(), - I->getFunctionType())); + if (!I->isExternal()) + MisCompFunctions.push_back(std::make_pair(I->getName(), + I->getFunctionType())); // Okay, great! Now we know that we extracted a loop and that loop // extraction both didn't break the program, and didn't mask the problem. @@ -432,8 +433,9 @@ std::vector > MisCompFunctions; for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E; ++I) - MisCompFunctions.push_back(std::make_pair(I->getName(), - I->getFunctionType())); + if (!I->isExternal()) + MisCompFunctions.push_back(std::make_pair(I->getName(), + I->getFunctionType())); std::string ErrorMsg; if (LinkModules(ProgClone, Extracted, &ErrorMsg)) { @@ -624,11 +626,10 @@ // Call the old main function and return its result BasicBlock *BB = new BasicBlock("entry", newMain); - CallInst *call = new CallInst(oldMainProto, args); - BB->getInstList().push_back(call); + CallInst *call = new CallInst(oldMainProto, args, "", BB); // If the type of old function wasn't void, return value of call - new ReturnInst(oldMain->getReturnType() != Type::VoidTy ? call : 0, BB); + new ReturnInst(call, BB); } // The second nasty issue we must deal with in the JIT is that the Safe From natebegeman at mac.com Fri Nov 19 02:01:26 2004 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 19 Nov 2004 02:01:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200411190801.CAA25619@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.106 -> 1.107 --- Log message: Eliminate another 6k register copies that the register allocator would just coalesce out of hbd. Speeds up compilation by 2% (0.6s) --- Diffs of the changes: (+14 -8) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.106 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.107 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.106 Thu Nov 18 20:06:40 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Fri Nov 19 02:01:16 2004 @@ -3013,7 +3013,8 @@ ConstantSInt *offset = GEPMap[GEPI].offset; if (Class != cLong) { - unsigned TmpReg = makeAnotherReg(I.getType()); + unsigned TmpReg = LoadNeedsSignExtend(I) ? makeAnotherReg(I.getType()) + : DestReg; if (indexReg == 0) BuildMI(BB, ImmOpcode, 2, TmpReg).addSImm(offset->getValue()) .addReg(baseReg); @@ -3021,8 +3022,6 @@ BuildMI(BB, IdxOpcode, 2, TmpReg).addReg(indexReg).addReg(baseReg); if (LoadNeedsSignExtend(I)) BuildMI(BB, PPC::EXTSB, 1, DestReg).addReg(TmpReg); - else - BuildMI(BB, PPC::OR, 2, DestReg).addReg(TmpReg).addReg(TmpReg); } else { indexReg = (indexReg != 0) ? indexReg : getReg(offset); unsigned indexPlus4 = makeAnotherReg(Type::IntTy); @@ -3820,7 +3819,7 @@ indexReg = getReg(remainder, MBB, IP); remainder = 0; } - } else { + } else if (!remainder->isNullValue()) { unsigned TmpReg = makeAnotherReg(Type::IntTy); emitBinaryConstOperation(MBB, IP, indexReg, remainder, 0, TmpReg); indexReg = TmpReg; @@ -3835,12 +3834,19 @@ // destination register. unsigned TargetReg = getReg(GEPI, MBB, IP); unsigned basePtrReg = getReg(Src, MBB, IP); - if (indexReg != 0) { - unsigned TmpReg = makeAnotherReg(Type::IntTy); - BuildMI(*MBB, IP, PPC::ADD, 2, TmpReg).addReg(indexReg).addReg(basePtrReg); + + if ((indexReg == 0) && remainder->isNullValue()) + RegMap[GEPI] = basePtrReg; + + if (!remainder->isNullValue()) { + unsigned TmpReg = (indexReg == 0) ? TargetReg : makeAnotherReg(Type::IntTy); + emitBinaryConstOperation(MBB, IP, basePtrReg, remainder, 0, TmpReg); basePtrReg = TmpReg; } - emitBinaryConstOperation(MBB, IP, basePtrReg, remainder, 0, TargetReg); + if (indexReg != 0) { + BuildMI(*MBB, IP, PPC::ADD, 2, TargetReg).addReg(indexReg) + .addReg(basePtrReg); + } } /// visitAllocaInst - If this is a fixed size alloca, allocate space from the From lattner at cs.uiuc.edu Fri Nov 19 02:40:46 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 02:40:46 -0600 Subject: [llvm-commits] CVS: llvm-www/testresults/index.html Message-ID: <200411190840.iAJ8ekFX006855@apoc.cs.uiuc.edu> Changes in directory llvm-www/testresults: index.html updated: 1.18 -> 1.19 --- Log message: Add Duraid's new tester! --- Diffs of the changes: (+13 -1) Index: llvm-www/testresults/index.html diff -u llvm-www/testresults/index.html:1.18 llvm-www/testresults/index.html:1.19 --- llvm-www/testresults/index.html:1.18 Sun Oct 31 16:25:23 2004 +++ llvm-www/testresults/index.html Fri Nov 19 02:40:35 2004 @@ -12,7 +12,7 @@ break test cases. This is intended to track, over time, the CVS repository, test suite conformance, and performance of code generated by the compiler.

      -

      Platforms:

      +

      X86:

        @@ -22,12 +22,24 @@
      1. X86: Linux (Dual P4 Xeon @ 2.3GHz) -- release build
      2. +
      3. X86: FreeBSD 5.3-RC1 -- debug build
      4. + +
      5. X86: FreeBSD-CURRENT +(Single Pentium M @ 2.3GHz) -- release build
      6. +
      + +

      PowerPC:

      +
      1. PPC: Mac OS X 10.3 "Panther" on PowerPC G5 (dual 1.8Ghz CPU) (CBE and LLC only)
      2. +
      + +

      Sparc V9:

      +
      1. Sparc V9: Solaris (Sun Fire V240, dual 1Ghz CPU)
      From lattner at cs.uiuc.edu Fri Nov 19 02:43:22 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 02:43:22 -0600 Subject: [llvm-commits] CVS: llvm-gcc/libstdc++-v3/include/bits/locale_classes.h Message-ID: <200411190843.iAJ8hMMJ006879@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/libstdc++-v3/include/bits: locale_classes.h updated: 1.1.1.1 -> 1.2 --- Log message: Actually, no NB, this is not true. --- Diffs of the changes: (+1 -1) Index: llvm-gcc/libstdc++-v3/include/bits/locale_classes.h diff -u llvm-gcc/libstdc++-v3/include/bits/locale_classes.h:1.1.1.1 llvm-gcc/libstdc++-v3/include/bits/locale_classes.h:1.2 --- llvm-gcc/libstdc++-v3/include/bits/locale_classes.h:1.1.1.1 Thu Jan 8 15:59:30 2004 +++ llvm-gcc/libstdc++-v3/include/bits/locale_classes.h Fri Nov 19 02:43:08 2004 @@ -268,7 +268,7 @@ public: // NB: This class is always a static data member, and thus can be // counted on to be zero-initialized. - id() { } + id() : _M_index(0) { } inline size_t _M_id() const From lattner at cs.uiuc.edu Fri Nov 19 02:44:19 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 02:44:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200411190844.iAJ8iJ7h007175@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.61 -> 1.62 --- Log message: This is a horrible hack to work around libstdc++ bugs :( --- Diffs of the changes: (+6 -2) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.61 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.62 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.61 Tue Oct 26 00:35:14 2004 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Fri Nov 19 02:44:07 2004 @@ -442,6 +442,9 @@ // void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { if (isa(Init)) { + // FIXME: THIS SHOULD NOT BE NEEDED. + unsigned Size = getTargetData().getTypeSize(Init->getType()); + memset(Addr, 0, Size); return; } else if (Init->getType()->isFirstClassType()) { GenericValue Val = getConstantValue(Init); @@ -524,13 +527,14 @@ DEBUG(std::cerr << "Global '" << GV->getName() << "' -> " << GA << "\n"); const Type *ElTy = GV->getType()->getElementType(); + unsigned GVSize = getTargetData().getTypeSize(ElTy); if (GA == 0) { // If it's not already specified, allocate memory for the global. - GA = new char[getTargetData().getTypeSize(ElTy)]; + GA = new char[GVSize]; addGlobalMapping(GV, GA); } InitializeMemory(GV->getInitializer(), GA); - NumInitBytes += getTargetData().getTypeSize(ElTy); + NumInitBytes += GVSize; ++NumGlobals; } From reid at x10sys.com Fri Nov 19 09:56:39 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 19 Nov 2004 09:56:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Compressor.cpp Message-ID: <200411191556.JAA12965@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Compressor.cpp updated: 1.6 -> 1.7 --- Log message: Allow this to compile even on machines that HAVE the bzlib library but do NOT have the bzlib.h header file. Go figure. --- Diffs of the changes: (+11 -5) Index: llvm/lib/Support/Compressor.cpp diff -u llvm/lib/Support/Compressor.cpp:1.6 llvm/lib/Support/Compressor.cpp:1.7 --- llvm/lib/Support/Compressor.cpp:1.6 Sun Nov 14 16:04:46 2004 +++ llvm/lib/Support/Compressor.cpp Fri Nov 19 09:56:28 2004 @@ -19,11 +19,17 @@ #include #ifdef HAVE_BZIP2 +#ifdef HAVE_BZLIB_H #include -#endif +#define BZIP2_GOOD +#endif +#endif #ifdef HAVE_ZLIB +#ifdef HAVE_ZLIB_H #include +#define ZLIB_GOOD +#endif #endif namespace { @@ -250,7 +256,7 @@ switch (hint) { case COMP_TYPE_BZIP2: { -#if defined(HAVE_BZIP2) +#if defined(BZIP2_GOOD) // Set up the bz_stream bz_stream bzdata; bzdata.bzalloc = 0; @@ -307,7 +313,7 @@ } case COMP_TYPE_ZLIB: { -#if defined(HAVE_ZLIB) +#if defined(ZLIB_GOOD) z_stream zdata; zdata.zalloc = Z_NULL; zdata.zfree = Z_NULL; @@ -414,7 +420,7 @@ switch (*in++) { case COMP_TYPE_BZIP2: { -#if !defined(HAVE_BZIP2) +#if !defined(BZIP2_GOOD) throw std::string("Can't decompress BZIP2 data"); #else // Set up the bz_stream @@ -469,7 +475,7 @@ } case COMP_TYPE_ZLIB: { -#if !defined(HAVE_ZLIB) +#if !defined(ZLIB_GOOD) throw std::string("Can't decompress ZLIB data"); #else z_stream zdata; From lattner at cs.uiuc.edu Fri Nov 19 10:22:38 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 10:22:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraph.cpp Message-ID: <200411191622.iAJGMcaM009258@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: CallGraph.cpp updated: 1.46 -> 1.47 --- Log message: Mission accomplished! --- Diffs of the changes: (+0 -1) Index: llvm/lib/Analysis/IPA/CallGraph.cpp diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.46 llvm/lib/Analysis/IPA/CallGraph.cpp:1.47 --- llvm/lib/Analysis/IPA/CallGraph.cpp:1.46 Sun Sep 19 23:45:09 2004 +++ llvm/lib/Analysis/IPA/CallGraph.cpp Fri Nov 19 10:22:24 2004 @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/CallGraph.h" -#include "llvm/Constants.h" // Remove when ConstantPointerRefs are gone #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/Support/CallSite.h" From lattner at cs.uiuc.edu Fri Nov 19 10:24:21 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 10:24:21 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200411191624.iAJGOLRY013405@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.142 -> 1.143 --- Log message: Add note that this is for old bytecode files. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.142 llvm/lib/Bytecode/Reader/Reader.cpp:1.143 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.142 Mon Nov 15 16:38:52 2004 +++ llvm/lib/Bytecode/Reader/Reader.cpp Fri Nov 19 10:24:05 2004 @@ -1449,7 +1449,7 @@ return Result; } - case Type::PointerTyID: { // ConstantPointerRef value... + case Type::PointerTyID: { // ConstantPointerRef value (backwards compat). const PointerType *PT = cast(Ty); unsigned Slot = read_vbr_uint(); From lattner at cs.uiuc.edu Fri Nov 19 10:25:11 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 10:25:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.h Message-ID: <200411191625.iAJGPBI0015127@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: ProfilingUtils.h updated: 1.3 -> 1.4 --- Log message: CPR is dead. --- Diffs of the changes: (+0 -1) Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.h diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.3 llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.4 --- llvm/lib/Transforms/Instrumentation/ProfilingUtils.h:1.3 Sat Jul 17 19:21:14 2004 +++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.h Fri Nov 19 10:24:57 2004 @@ -20,7 +20,6 @@ namespace llvm { class Function; class GlobalValue; - class ConstantPointerRef; class BasicBlock; void InsertProfilingInitCall(Function *MainFn, const char *FnName, From lattner at cs.uiuc.edu Fri Nov 19 10:25:55 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 10:25:55 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Module.h Message-ID: <200411191625.iAJGPtGD016402@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Module.h updated: 1.54 -> 1.55 --- Log message: These methods are long gone, ConstantPointerRef is dead. --- Diffs of the changes: (+0 -5) Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.54 llvm/include/llvm/Module.h:1.55 --- llvm/include/llvm/Module.h:1.54 Mon Nov 15 13:02:35 2004 +++ llvm/include/llvm/Module.h Fri Nov 19 10:25:42 2004 @@ -27,7 +27,6 @@ class GlobalVariable; class GlobalValueRefMap; // Used by ConstantVals.cpp -class ConstantPointerRef; class FunctionType; class SymbolTable; @@ -81,11 +80,7 @@ Endianness Endian; // True if target is little endian PointerSize PtrSize; // True if target has 32-bit pointers (false = 64-bit) - // Accessor for the underlying GVRefMap... only through the Constant class... friend class Constant; - friend class ConstantPointerRef; - ConstantPointerRef *getConstantPointerRef(GlobalValue *GV); - void destroyConstantPointerRef(ConstantPointerRef *CPR); public: Module(const std::string &ModuleID); From lattner at cs.uiuc.edu Fri Nov 19 10:39:17 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 10:39:17 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h Constant.h Message-ID: <200411191639.iAJGdHCg023782@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.66 -> 1.67 Constant.h updated: 1.18 -> 1.19 --- Log message: Add static functions to clear singleton maps. Patch contributed by Morten Ofstad! --- Diffs of the changes: (+12 -1) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.66 llvm/include/llvm/Type.h:1.67 --- llvm/include/llvm/Type.h:1.66 Tue Oct 12 15:35:04 2004 +++ llvm/include/llvm/Type.h Fri Nov 19 10:39:04 2004 @@ -288,7 +288,7 @@ } void dropRef() const { - assert(isAbstract() && "Cannot drop a refernce to a non-abstract type!"); + assert(isAbstract() && "Cannot drop a reference to a non-abstract type!"); assert(RefCount && "No objects are currently referencing this object!"); // If this is the last PATypeHolder using this object, and there are no @@ -296,6 +296,12 @@ if (--RefCount == 0) RefCountIsZero(); } + + /// clearAllTypeMaps - This method frees all internal memory used by the + /// type subsystem, which can be used in environments where this memory is + /// otherwise reported as a leak. + static void clearAllTypeMaps(); + private: /// isSizedDerivedType - Derived types like structures and arrays are sized /// iff all of the members of the type are sized as well. Since asking for Index: llvm/include/llvm/Constant.h diff -u llvm/include/llvm/Constant.h:1.18 llvm/include/llvm/Constant.h:1.19 --- llvm/include/llvm/Constant.h:1.18 Sat Oct 16 13:05:10 2004 +++ llvm/include/llvm/Constant.h Fri Nov 19 10:39:04 2004 @@ -92,6 +92,11 @@ "implemented for all constants that have operands!"); assert(0 && "Constants that do not have operands cannot be using 'From'!"); } + + /// clearAllValueMaps - This method frees all internal memory used by the + /// constant subsystem, which can be used in environments where this memory + /// is otherwise reported as a leak. + static void clearAllValueMaps(); }; } // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 19 10:39:57 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 10:39:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Constants.cpp Message-ID: <200411191639.iAJGdvHh023797@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.118 -> 1.119 Constants.cpp updated: 1.111 -> 1.112 --- Log message: Add hooks to free all memory allocated by the singleton factories in these files. Patch contributed by Morten Ofstad! --- Diffs of the changes: (+68 -0) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.118 llvm/lib/VMCore/Type.cpp:1.119 --- llvm/lib/VMCore/Type.cpp:1.118 Tue Nov 16 14:39:04 2004 +++ llvm/lib/VMCore/Type.cpp Fri Nov 19 10:39:44 2004 @@ -656,6 +656,17 @@ /// this map. /// std::multimap TypesByHash; + + friend void Type::clearAllTypeMaps(); + +private: + void clear(std::vector &DerivedTypes) { + for (typename std::map::iterator I = Map.begin(), + E = Map.end(); I != E; ++I) + DerivedTypes.push_back(I->second.get()); + TypesByHash.clear(); + Map.clear(); + } public: typedef typename std::map::iterator iterator; ~TypeMap() { print("ON EXIT"); } @@ -1301,4 +1312,25 @@ } } +/// clearAllTypeMaps - This method frees all internal memory used by the +/// type subsystem, which can be used in environments where this memory is +/// otherwise reported as a leak. +void Type::clearAllTypeMaps() { + std::vector DerivedTypes; + + FunctionTypes.clear(DerivedTypes); + PointerTypes.clear(DerivedTypes); + StructTypes.clear(DerivedTypes); + ArrayTypes.clear(DerivedTypes); + PackedTypes.clear(DerivedTypes); + + for(std::vector::iterator I = DerivedTypes.begin(), + E = DerivedTypes.end(); I != E; ++I) + (*I)->ContainedTys.clear(); + for(std::vector::iterator I = DerivedTypes.begin(), + E = DerivedTypes.end(); I != E; ++I) + delete *I; + DerivedTypes.clear(); +} + // vim: sw=2 Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.111 llvm/lib/VMCore/Constants.cpp:1.112 --- llvm/lib/VMCore/Constants.cpp:1.111 Thu Oct 28 01:43:38 2004 +++ llvm/lib/VMCore/Constants.cpp Fri Nov 19 10:39:44 2004 @@ -612,6 +612,16 @@ typedef std::map AbstractTypeMapTy; AbstractTypeMapTy AbstractTypeMap; + + friend void Constant::clearAllValueMaps(); + private: + void clear(std::vector &Constants) { + for(MapIterator I = Map.begin(); I != Map.end(); ++I) + Constants.push_back(I->second); + Map.clear(); + AbstractTypeMap.clear(); + } + public: // getOrCreate - Return the specified constant from the map, creating it if // necessary. @@ -1401,3 +1411,29 @@ return Instruction::getOpcodeName(getOpcode()); } +/// clearAllValueMaps - This method frees all internal memory used by the +/// constant subsystem, which can be used in environments where this memory +/// is otherwise reported as a leak. +void Constant::clearAllValueMaps() { + std::vector Constants; + + DoubleConstants.clear(Constants); + FloatConstants.clear(Constants); + SIntConstants.clear(Constants); + UIntConstants.clear(Constants); + AggZeroConstants.clear(Constants); + ArrayConstants.clear(Constants); + StructConstants.clear(Constants); + PackedConstants.clear(Constants); + NullPtrConstants.clear(Constants); + UndefValueConstants.clear(Constants); + ExprConstants.clear(Constants); + + for (std::vector::iterator I = Constants.begin(), + E = Constants.end(); I != E; ++I) + (*I)->dropAllReferences(); + for (std::vector::iterator I = Constants.begin(), + E = Constants.end(); I != E; ++I) + (*I)->destroyConstantImpl(); + Constants.clear(); +} From lattner at cs.uiuc.edu Fri Nov 19 10:49:48 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 10:49:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerPacked.cpp Message-ID: <200411191649.iAJGnmMH027187@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LowerPacked.cpp updated: 1.3 -> 1.4 --- Log message: Fix the exposed prototype for the lower packed pass, thanks to Morten Ofstad. --- Diffs of the changes: (+2 -1) Index: llvm/lib/Transforms/Scalar/LowerPacked.cpp diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.3 llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.4 --- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.3 Thu Nov 18 11:24:20 2004 +++ llvm/lib/Transforms/Scalar/LowerPacked.cpp Fri Nov 19 10:49:34 2004 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Transforms/Scalar.h" #include "llvm/Argument.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -98,7 +99,7 @@ } // end namespace -FunctionPass *createLowerPackedPass() { return new LowerPacked(); } +FunctionPass *llvm::createLowerPackedPass() { return new LowerPacked(); } // This function sets lowered values for a corresponding From reid at x10sys.com Fri Nov 19 11:08:11 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 19 Nov 2004 11:08:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp ArchiveWriter.cpp Message-ID: <200411191708.LAA07458@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.29 -> 1.30 ArchiveWriter.cpp updated: 1.7 -> 1.8 --- Log message: Correct the computation of when to add the padding. It is not based on the member's size. It is based on the oddness/evenness of the file pointer. This fixes a bug with llvm-ar not being able to read archives produced by llvm-ranlib when there are members with odd long file name lengths. --- Diffs of the changes: (+9 -9) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.29 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.30 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.29 Thu Nov 18 21:44:10 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Fri Nov 19 11:08:00 2004 @@ -227,7 +227,7 @@ // with it. It doesn't count as the "first file". foreignST = mbr; At += mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) At++; } else if (mbr->isStringTable()) { // Simply suck the entire string table into a string @@ -236,7 +236,7 @@ // (SVR4 style long names). strtab.assign(At,mbr->getSize()); At += mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) At++; delete mbr; } else if (mbr->isLLVMSymbolTable()) { @@ -247,7 +247,7 @@ parseSymbolTable(mbr->getData(),mbr->getSize()); seenSymbolTable = true; At += mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) At++; delete mbr; // We don't need this member in the list of members. } else { @@ -259,7 +259,7 @@ } members.push_back(mbr); At += mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) At++; } } @@ -317,7 +317,7 @@ if (mbr->isForeignSymbolTable()) { // Skip the foreign symbol table, we don't do anything with it At += mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) At++; delete mbr; @@ -330,7 +330,7 @@ // Process the string table entry strtab.assign((const char*)mbr->getData(),mbr->getSize()); At += mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) At++; delete mbr; // Get the next one @@ -342,7 +342,7 @@ if (mbr->isLLVMSymbolTable()) { parseSymbolTable(mbr->getData(),mbr->getSize()); FirstFile = At + mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) FirstFile++; } else { // There's no symbol table in the file. We have to rebuild it from scratch @@ -454,7 +454,7 @@ // Go to the next file location At += mbr->getSize(); - if ((mbr->getSize() & 1) == 1) + if ((intptr_t(At) & 1) == 1) At++; } } Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.7 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.8 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.7 Wed Nov 17 12:28:29 2004 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Fri Nov 19 11:08:00 2004 @@ -290,7 +290,7 @@ ARFile.write(data,fSize); // Make sure the member is an even length - if (ARFile.tellp() % 2 != 0) + if (ARFile.tellp() & 1 == 1) ARFile << ARFILE_PAD; // Free the compressed data, if necessary From lattner at cs.uiuc.edu Fri Nov 19 11:08:30 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 11:08:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200411191708.iAJH8Usp000953@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.54 -> 1.55 --- Log message: Patches to avoid "leaking" memory on process exit. Patch contributed by Morten Ofstad! --- Diffs of the changes: (+25 -39) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.54 llvm/lib/Support/CommandLine.cpp:1.55 --- llvm/lib/Support/CommandLine.cpp:1.54 Tue Nov 16 00:50:36 2004 +++ llvm/lib/Support/CommandLine.cpp Fri Nov 19 11:08:15 2004 @@ -33,6 +33,17 @@ static const char *ProgramName = ""; static const char *ProgramOverview = 0; +// This collects additional help to be printed. +static std::vector &MoreHelp() { + static std::vector moreHelp; + return moreHelp; +} + +extrahelp::extrahelp(const char* Help) + : morehelp(Help) { + MoreHelp().push_back(Help); +} + //===----------------------------------------------------------------------===// // Basic, shared command line option processing machinery... // @@ -40,23 +51,19 @@ // Return the global command line option vector. Making it a function scoped // static ensures that it will be initialized correctly before its first use. // -static std::map *CommandLineOptions = 0; static std::map &getOpts() { - if (CommandLineOptions == 0) - CommandLineOptions = new std::map(); - return *CommandLineOptions; + static std::map CommandLineOptions; + return CommandLineOptions; } static Option *getOption(const std::string &Str) { - if (CommandLineOptions == 0) return 0; - std::map::iterator I = CommandLineOptions->find(Str); - return I != CommandLineOptions->end() ? I->second : 0; + std::map::iterator I = getOpts().find(Str); + return I != getOpts().end() ? I->second : 0; } static std::vector &getPositionalOpts() { - static std::vector *Positional = 0; - if (!Positional) Positional = new std::vector(); - return *Positional; + static std::vector Positional; + return Positional; } static void AddArgument(const char *ArgName, Option *Opt) { @@ -73,18 +80,13 @@ // options have already been processed and the map has been deleted! // static void RemoveArgument(const char *ArgName, Option *Opt) { - if (CommandLineOptions == 0) return; #ifndef NDEBUG // This disgusting HACK is brought to you courtesy of GCC 3.3.2, which ICE's // If we pass ArgName directly into getOption here. std::string Tmp = ArgName; assert(getOption(Tmp) == Opt && "Arg not in map!"); #endif - CommandLineOptions->erase(ArgName); - if (CommandLineOptions->empty()) { - delete CommandLineOptions; - CommandLineOptions = 0; - } + getOpts().erase(ArgName); } static inline bool ProvideOption(Option *Handler, const char *ArgName, @@ -565,9 +567,9 @@ // Free all of the memory allocated to the map. Command line options may only // be processed once! - delete CommandLineOptions; - CommandLineOptions = 0; + getOpts().clear(); PositionalOpts.clear(); + MoreHelp().clear(); // If we had an error processing our arguments, don't let the program execute if (ErrorParsing) exit(1); @@ -835,19 +837,6 @@ // --help and --help-hidden option implementation // -// If this variable is set, it is a pointer to a function that the user wants -// us to call after we print out the help info. Basically a hook to allow -// additional help to be printed. -static std::vector* MoreHelp = 0; - -extrahelp::extrahelp(const char* Help) - : morehelp(Help) { - if (!MoreHelp) { - MoreHelp = new std::vector; - } - MoreHelp->push_back(Help); -} - namespace { class HelpPrinter { @@ -921,14 +910,11 @@ for (unsigned i = 0, e = Options.size(); i != e; ++i) Options[i].second->printOptionInfo(MaxArgLen); - // Print any extra help the user has declared. If MoreHelp is not null, - // then the user used at least one cl::extrahelp instance to provide - // additional help. We just print it out now. - if (MoreHelp != 0) { - for (std::vector::iterator I = MoreHelp->begin(), - E = MoreHelp->end(); I != E; ++I) - std::cerr << *I; - } + // Print any extra help the user has declared. + for (std::vector::iterator I = MoreHelp().begin(), + E = MoreHelp().end(); I != E; ++I) + std::cerr << *I; + MoreHelp().clear(); // Halt the program since help information was printed exit(1); From lattner at cs.uiuc.edu Fri Nov 19 11:10:00 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 11:10:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/LeakDetector.cpp Message-ID: <200411191710.iAJHA0Sh000970@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: LeakDetector.cpp updated: 1.11 -> 1.12 --- Log message: Fix memory leaks, patch contributed by Morten Ofstad! --- Diffs of the changes: (+21 -15) Index: llvm/lib/VMCore/LeakDetector.cpp diff -u llvm/lib/VMCore/LeakDetector.cpp:1.11 llvm/lib/VMCore/LeakDetector.cpp:1.12 --- llvm/lib/VMCore/LeakDetector.cpp:1.11 Wed Sep 1 17:55:37 2004 +++ llvm/lib/VMCore/LeakDetector.cpp Fri Nov 19 11:09:48 2004 @@ -68,9 +68,6 @@ } std::cerr << '\n'; - // Clear out results so we don't get duplicate warnings on - // next call... - Ts.clear(); return true; } return false; @@ -82,21 +79,26 @@ const char* const Name; }; - typedef LeakDetectorImpl Objects; - typedef LeakDetectorImpl LLVMObjects; + LeakDetectorImpl *Objects; + LeakDetectorImpl *LLVMObjects; - Objects& getObjects() { - static Objects *o = 0; - if (o == 0) - o = new Objects("GENERIC"); - return *o; + LeakDetectorImpl &getObjects() { + if (Objects == 0) + Objects = new LeakDetectorImpl("GENERIC"); + return *Objects; } - LLVMObjects& getLLVMObjects() { - static LLVMObjects *o = 0; - if (o == 0) - o = new LLVMObjects("LLVM"); - return *o; + LeakDetectorImpl &getLLVMObjects() { + if (LLVMObjects == 0) + LLVMObjects = new LeakDetectorImpl("LLVM"); + return *LLVMObjects; + } + + void clearGarbage() { + delete Objects; + delete LLVMObjects; + Objects = 0; + LLVMObjects = 0; } } @@ -122,4 +124,8 @@ getLLVMObjects().hasGarbage(Message)) std::cerr << "\nThis is probably because you removed an object, but didn't " "delete it. Please check your code for memory leaks.\n"; + + // Clear out results so we don't get duplicate warnings on + // next call... + clearGarbage(); } From lattner at cs.uiuc.edu Fri Nov 19 11:42:28 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 11:42:28 -0600 Subject: [llvm-commits] CVS: llvm-gcc/libstdc++-v3/libsupc++/eh_term_handler.cc Message-ID: <200411191742.iAJHgS5U004507@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/libstdc++-v3/libsupc++: eh_term_handler.cc updated: 1.3 -> 1.4 --- Log message: Change from the default terminate handler to use abort. This makes is so that any program that uses EH will not have to pull in all of the string libraries and demangler and a ton of other stuff from libstdc++. Yaay for link times. :) --- Diffs of the changes: (+2 -2) Index: llvm-gcc/libstdc++-v3/libsupc++/eh_term_handler.cc diff -u llvm-gcc/libstdc++-v3/libsupc++/eh_term_handler.cc:1.3 llvm-gcc/libstdc++-v3/libsupc++/eh_term_handler.cc:1.4 --- llvm-gcc/libstdc++-v3/libsupc++/eh_term_handler.cc:1.3 Thu Feb 5 10:05:49 2004 +++ llvm-gcc/libstdc++-v3/libsupc++/eh_term_handler.cc Fri Nov 19 11:42:14 2004 @@ -37,13 +37,13 @@ to "std::abort", and rebuilding the library. In a freestanding mode, we default to this latter approach. */ -#if ! _GLIBCXX_HOSTED +#if ! _GLIBCXX_HOSTED || __llvm__ # include #endif /* The current installed user handler. */ std::terminate_handler __cxxabiv1::__terminate_handler = -#if _GLIBCXX_HOSTED +#if _GLIBCXX_HOSTED && !__llvm__ __gnu_cxx::__verbose_terminate_handler; #else std::abort; From reid at x10sys.com Fri Nov 19 12:44:42 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 19 Nov 2004 12:44:42 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/SVR4.ll xpg4.ll Message-ID: <200411191844.MAA25055@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: SVR4.ll updated: 1.2 -> 1.3 xpg4.ll updated: 1.1 -> 1.2 --- Log message: Make sure we can read an archive after it has been ranlib'd --- Diffs of the changes: (+7 -1) Index: llvm/test/Regression/Archive/SVR4.ll diff -u llvm/test/Regression/Archive/SVR4.ll:1.2 llvm/test/Regression/Archive/SVR4.ll:1.3 --- llvm/test/Regression/Archive/SVR4.ll:1.2 Thu Nov 18 22:45:19 2004 +++ llvm/test/Regression/Archive/SVR4.ll Fri Nov 19 12:44:31 2004 @@ -5,3 +5,6 @@ ; RUN: ar t SVR4.a > Output/svr1 ; RUN: llvm-ar t SVR4.a > Output/svr2 ; RUN: diff Output/svr1 Output/svr2 +; RUN: cp SVR4.a Output/SVR4_mod.a +; RUN: llvm-ranlib Output/SVR4_mod.a +; RUN: llvm-ar t Output/SVR4_mod.a Index: llvm/test/Regression/Archive/xpg4.ll diff -u llvm/test/Regression/Archive/xpg4.ll:1.1 llvm/test/Regression/Archive/xpg4.ll:1.2 --- llvm/test/Regression/Archive/xpg4.ll:1.1 Thu Nov 18 22:46:10 2004 +++ llvm/test/Regression/Archive/xpg4.ll Fri Nov 19 12:44:31 2004 @@ -3,5 +3,8 @@ ; reading xpg4 style archives. ; RUN: ar t xpg4.a > Output/xpg1 -; RUN: llvm-ar t SVR4.a > Output/xpg2 +; RUN: llvm-ar t xpg4.a > Output/xpg2 ; RUN: diff Output/xpg1 Output/xpg2 +; RUN: cp xpg4.a Output/xpg4_mod.a +; RUN: llvm-ranlib Output/xpg4_mod.a +; RUN: llvm-ar t Output/xpg4_mod.a From lattner at cs.uiuc.edu Fri Nov 19 13:45:58 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 13:45:58 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-db/Commands.cpp Message-ID: <200411191945.iAJJjwGL009457@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llvm-db: Commands.cpp updated: 1.6 -> 1.7 --- Log message: Fix a bug that caused stuff like this: main at ./eh.cpp:1414 -> printf("a\n"); to be printed, instead of this: main at ./eh.cpp:14 14 -> printf("a\n"); --- Diffs of the changes: (+2 -1) Index: llvm/tools/llvm-db/Commands.cpp diff -u llvm/tools/llvm-db/Commands.cpp:1.6 llvm/tools/llvm-db/Commands.cpp:1.7 --- llvm/tools/llvm-db/Commands.cpp:1.6 Tue Oct 26 00:46:17 2004 +++ llvm/tools/llvm-db/Commands.cpp Fri Nov 19 13:45:44 2004 @@ -119,7 +119,8 @@ CurrentFile = &FileDesc->getSourceText(); std::cout << " at " << CurrentFile->getFilename() << ":" << LineNo; - if (ColNo) std::cout << ":" << ColNo << "\n"; + if (ColNo) std::cout << ":" << ColNo; + std::cout << "\n"; } if (printSourceLine(LineNo)) From lattner at cs.uiuc.edu Fri Nov 19 14:46:31 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 14:46:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h MachineInstrBuilder.h Message-ID: <200411192046.iAJKkUvq028276@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.157 -> 1.158 MachineInstrBuilder.h updated: 1.24 -> 1.25 --- Log message: Instead of storing std::string's for ExternalSymbol references, rely on the fact that all ExternalSymbols are actually string literals with static storage. Thus we don't have to do anything special to hold them and we certainly don't have to copy string data around. --- Diffs of the changes: (+9 -19) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.157 llvm/include/llvm/CodeGen/MachineInstr.h:1.158 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.157 Wed Oct 27 11:14:51 2004 +++ llvm/include/llvm/CodeGen/MachineInstr.h Fri Nov 19 14:46:15 2004 @@ -17,7 +17,6 @@ #define LLVM_CODEGEN_MACHINEINSTR_H #include "llvm/ADT/iterator" -#include #include #include @@ -121,7 +120,7 @@ int immedVal; // Constant value for an explicit constant MachineBasicBlock *MBB; // For MO_MachineBasicBlock type - std::string *SymbolName; // For MO_ExternalSymbol type + const char *SymbolName; // For MO_ExternalSymbol type } contents; char flags; // see bit field definitions above @@ -177,10 +176,10 @@ extra.regNum = -1; } - MachineOperand(const std::string &SymName, bool isPCRelative, int Offset) + MachineOperand(const char *SymName, bool isPCRelative, int Offset) : flags(isPCRelative?PCRELATIVE:0), opType(MO_ExternalSymbol) { zeroContents (); - contents.SymbolName = new std::string (SymName); + contents.SymbolName = SymName; extra.offset = Offset; } @@ -190,25 +189,16 @@ zeroContents (); contents = M.contents; extra = M.extra; - if (isExternalSymbol()) - contents.SymbolName = new std::string(M.getSymbolName()); } - ~MachineOperand() { - if (isExternalSymbol()) - delete contents.SymbolName; - } + ~MachineOperand() {} const MachineOperand &operator=(const MachineOperand &MO) { - if (isExternalSymbol()) // if old operand had a symbol name, - delete contents.SymbolName; // release old memory contents = MO.contents; flags = MO.flags; opType = MO.opType; extra = MO.extra; - if (isExternalSymbol()) - contents.SymbolName = new std::string(MO.getSymbolName()); return *this; } @@ -298,9 +288,9 @@ "Wrong MachineOperand accessor"); return extra.offset; } - const std::string &getSymbolName() const { + const char *getSymbolName() const { assert(isExternalSymbol() && "Wrong MachineOperand accessor"); - return *contents.SymbolName; + return contents.SymbolName; } /// MachineOperand methods for testing that work on any kind of @@ -658,7 +648,7 @@ /// addExternalSymbolOperand - Add an external symbol operand to this instr /// - void addExternalSymbolOperand(const std::string &SymName, bool isPCRelative) { + void addExternalSymbolOperand(const char *SymName, bool isPCRelative) { operands.push_back(MachineOperand(SymName, isPCRelative, 0)); } Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.24 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.25 --- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.24 Thu Oct 14 23:38:36 2004 +++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h Fri Nov 19 14:46:15 2004 @@ -129,9 +129,9 @@ return *this; } - const MachineInstrBuilder &addExternalSymbol(const std::string &Name, + const MachineInstrBuilder &addExternalSymbol(const char *FnName, bool isPCRelative = false) const{ - MI->addExternalSymbolOperand(Name, isPCRelative); + MI->addExternalSymbolOperand(FnName, isPCRelative); return *this; } }; From lattner at cs.uiuc.edu Fri Nov 19 14:56:37 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 14:56:37 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeEmitter.h Message-ID: <200411192056.iAJKubvk001434@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeEmitter.h updated: 1.19 -> 1.20 --- Log message: External symbols are const char*'s now, change this to match. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/CodeGen/MachineCodeEmitter.h diff -u llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.19 llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.20 --- llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.19 Wed Oct 27 11:14:51 2004 +++ llvm/include/llvm/CodeGen/MachineCodeEmitter.h Fri Nov 19 14:56:22 2004 @@ -83,7 +83,7 @@ /// handle the situation. /// virtual uint64_t getGlobalValueAddress(GlobalValue *V) = 0; - virtual uint64_t getGlobalValueAddress(const std::string &Name) = 0; + virtual uint64_t getGlobalValueAddress(const char *SymName) = 0; // getConstantPoolEntryAddress - Return the address of the 'Index' entry in // the constant pool that was last emitted with the 'emitConstantPool' method. From lattner at cs.uiuc.edu Fri Nov 19 14:56:52 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 14:56:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200411192056.iAJKuqsw001451@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.47 -> 1.48 --- Log message: Match change in MachineCodeEmitter prototype. --- Diffs of the changes: (+2 -2) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.47 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.48 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.47 Mon Nov 15 17:20:04 2004 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Fri Nov 19 14:56:40 2004 @@ -114,7 +114,7 @@ virtual void emitWordAt(unsigned W, unsigned *Ptr); virtual uint64_t getGlobalValueAddress(GlobalValue *V); - virtual uint64_t getGlobalValueAddress(const std::string &Name); + virtual uint64_t getGlobalValueAddress(const char *Name); virtual uint64_t getConstantPoolEntryAddress(unsigned Entry); virtual uint64_t getCurrentPCValue(); @@ -224,7 +224,7 @@ return (intptr_t)TheJIT->getOrEmitGlobalVariable(cast(V)); } } -uint64_t Emitter::getGlobalValueAddress(const std::string &Name) { +uint64_t Emitter::getGlobalValueAddress(const char *Name) { return (intptr_t)TheJIT->getPointerToNamedFunction(Name); } From lattner at cs.uiuc.edu Fri Nov 19 14:56:59 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 14:56:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineCodeEmitter.cpp Message-ID: <200411192056.iAJKuxeu001461@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineCodeEmitter.cpp updated: 1.17 -> 1.18 --- Log message: Match change in MachineCodeEmitter prototype. --- Diffs of the changes: (+2 -2) Index: llvm/lib/CodeGen/MachineCodeEmitter.cpp diff -u llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.17 llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.18 --- llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.17 Sun Jul 4 07:19:55 2004 +++ llvm/lib/CodeGen/MachineCodeEmitter.cpp Fri Nov 19 14:56:46 2004 @@ -48,7 +48,7 @@ } uint64_t getGlobalValueAddress(GlobalValue *V) { return 0; } - uint64_t getGlobalValueAddress(const std::string &Name) { return 0; } + uint64_t getGlobalValueAddress(const char *Name) { return 0; } uint64_t getConstantPoolEntryAddress(unsigned Num) { return 0; } uint64_t getCurrentPCValue() { return 0; } @@ -148,7 +148,7 @@ uint64_t getGlobalValueAddress(GlobalValue *V) { return MCE.getGlobalValueAddress(V); } - uint64_t getGlobalValueAddress(const std::string &Name) { + uint64_t getGlobalValueAddress(const char *Name) { return MCE.getGlobalValueAddress(Name); } uint64_t getConstantPoolEntryAddress(unsigned Num) { From lattner at cs.uiuc.edu Fri Nov 19 14:57:20 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 14:57:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200411192057.iAJKvK9q001472@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.75 -> 1.76 --- Log message: Dont' forget to switch back to decimal output --- Diffs of the changes: (+2 -1) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.75 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.76 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.75 Tue Nov 16 12:40:52 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Fri Nov 19 14:57:07 2004 @@ -80,7 +80,8 @@ /// unsigned JITResolver::addFunctionReference(unsigned Address, Function *F) { DEBUG(std::cerr << "Emitting lazily resolved reference to function '" - << F->getName() << "' at address " << std::hex << Address << "\n"); + << F->getName() << "' at address " << std::hex << Address + << std::dec << "\n"); LazyCodeGenMap[Address] = F; return (intptr_t)&JITResolver::CompilationCallback; } From reid at x10sys.com Fri Nov 19 15:29:56 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 19 Nov 2004 15:29:56 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/MacOSX.a Message-ID: <200411192129.PAA21707@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: MacOSX.a added (r1.1) --- Log message: MacOSX test archive (buggy). --- Diffs of the changes: (+0 -0) Index: llvm/test/Regression/Archive/MacOSX.a From reid at x10sys.com Fri Nov 19 15:30:25 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 19 Nov 2004 15:30:25 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/MacOSX.ll Message-ID: <200411192130.PAA21738@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: MacOSX.ll added (r1.1) --- Log message: Test case for reading MacOSX archives. --- Diffs of the changes: (+10 -0) Index: llvm/test/Regression/Archive/MacOSX.ll diff -c /dev/null llvm/test/Regression/Archive/MacOSX.ll:1.1 *** /dev/null Fri Nov 19 15:30:25 2004 --- llvm/test/Regression/Archive/MacOSX.ll Fri Nov 19 15:30:15 2004 *************** *** 0 **** --- 1,10 ---- + ; This isn't really an assembly file, its just here to + ; run the following test which tests llvm-ar for compatibility + ; reading MacOSX (BSD4.4) style archives. + + ; RUN: ar t MacOSX.a > Output/osx1 + ; RUN: llvm-ar t MacOSX.a > Output/osx2 + ; RUN: diff Output/osx1 Output/osx2 + ; RUN: cp MacOSX.a Output/MacOSX_mod.a + ; RUN: llvm-ranlib Output/MacOSX_mod.a + ; RUN: llvm-ar t Output/MacOSX_mod.a From brukman at cs.uiuc.edu Fri Nov 19 15:53:32 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 19 Nov 2004 15:53:32 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200411192153.PAA22184@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.76 -> 1.77 --- Log message: * Remove disk space requirements, they vary wildly, depend on the number of tools built, the build type, and we don't keep them up-to-date on all platforms * AIX, Linux on PowerPC aren't fully-supported systems --- Diffs of the changes: (+38 -31) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.76 llvm/docs/GettingStarted.html:1.77 --- llvm/docs/GettingStarted.html:1.76 Mon Nov 15 17:20:51 2004 +++ llvm/docs/GettingStarted.html Fri Nov 19 15:53:22 2004 @@ -193,58 +193,56 @@ OS Arch - Source code - Object code - GCC front end - Total space + Compilers Linux x861 - 57 MB - 2.5 GB - 30 MB - 2.6 GB + GCC Solaris V9 (Ultrasparc) - 57 MB - 2.5 GB - 46 MB - 2.6 GB + GCC FreeBSD x861 - 57 MB - 850 MB - 40 MB - 1 GB + GCC MacOS X2 PowerPC - 57 MB - 1.5 GB - 36 MB - 1.6 GB + GCC - AIX3 + Cygwin/Win32 + x861 + GCC + + + +

      LLVM has partial support for the following platforms:

      + + + + + + + + + + + + + - - - - + - + - - - - +
      OSArchCompilers
      Windowsx861Visual Studio .NET4,5, MinGW
      AIX3,4 PowerPC92 MB2.8 GB123 MB3 GBGCC
      Linux3Linux3,5 PowerPC30 MB1.1 GB--1 GBGCC
      @@ -253,8 +251,17 @@ 1 Code generation supported for Pentium processors and up
      2 Code generation supported for 32-bit ABI only
      3 No native code generation
      +4 Build is not complete: one or more tools don't link
      +5 The GCC-based C/C++ frontend does not build

      +

      Note that you will need about 1-3 GB of space for a full LLVM build in Debug +mode, depending on the system (because of all the debug info), and the libraries +appear in more than one of the tools that get linked, so there is some +duplication. If you do not need many of the tools and you are space-conscious, +you can disable them individually in llvm/tools/Makefile. The Release +build requires considerably less space.

      +

      The LLVM suite may compile on other platforms, but it is not guaranteed to do so. If compilation is successful, the LLVM utilities should be able to assemble, disassemble, analyze, and optimize LLVM bytecode. Code @@ -1430,7 +1437,7 @@ Chris Lattner
      Reid Spencer
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/11/15 23:20:51 $ + Last modified: $Date: 2004/11/19 21:53:22 $ From brukman at cs.uiuc.edu Fri Nov 19 15:54:53 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 19 Nov 2004 15:54:53 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/.cvsignore Message-ID: <200411192154.PAA22335@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: .cvsignore added (r1.1) --- Log message: Ignore files generated by pod2html --- Diffs of the changes: (+1 -0) Index: llvm/docs/CommandGuide/.cvsignore diff -c /dev/null llvm/docs/CommandGuide/.cvsignore:1.1 *** /dev/null Fri Nov 19 15:54:53 2004 --- llvm/docs/CommandGuide/.cvsignore Fri Nov 19 15:54:43 2004 *************** *** 0 **** --- 1 ---- + pod2htm?.tmp From brukman at cs.uiuc.edu Fri Nov 19 16:09:31 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 19 Nov 2004 16:09:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Makefile Message-ID: <200411192209.QAA22648@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: Makefile updated: 1.19 -> 1.20 --- Log message: Fix file comment header --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/Makefile diff -u llvm/lib/Target/Makefile:1.19 llvm/lib/Target/Makefile:1.20 --- llvm/lib/Target/Makefile:1.19 Wed Oct 27 18:18:45 2004 +++ llvm/lib/Target/Makefile Fri Nov 19 16:09:21 2004 @@ -1,4 +1,4 @@ -#===- lib/Target/Makefile ------------------------------*- Makefile -*-===## +#===- lib/Target/Makefile ----------------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:34 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Feature/dg.exp Message-ID: <200411192246.QAA06060@kain.cs.uiuc.edu> Changes in directory llvm/test/Feature: dg.exp updated: 1.2 -> 1.3 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Feature/dg.exp diff -u llvm/test/Feature/dg.exp:1.2 llvm/test/Feature/dg.exp:1.3 --- llvm/test/Feature/dg.exp:1.2 Sun Nov 7 17:24:21 2004 +++ llvm/test/Feature/dg.exp Fri Nov 19 16:42:44 2004 @@ -1,4 +1,4 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:34 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/BugPoint/dg.exp Message-ID: <200411192246.QAA06059@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/BugPoint: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/BugPoint/dg.exp diff -u llvm/test/Regression/BugPoint/dg.exp:1.1 llvm/test/Regression/BugPoint/dg.exp:1.2 --- llvm/test/Regression/BugPoint/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/BugPoint/dg.exp Fri Nov 19 16:43:17 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:45 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:45 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GCSE/dg.exp Message-ID: <200411192246.QAA06090@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GCSE: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/GCSE/dg.exp diff -u llvm/test/Regression/Transforms/GCSE/dg.exp:1.1 llvm/test/Regression/Transforms/GCSE/dg.exp:1.2 --- llvm/test/Regression/Transforms/GCSE/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/GCSE/dg.exp Fri Nov 19 16:44:19 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:54 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:54 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalDCE/dg.exp Message-ID: <200411192246.QAA06115@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GlobalDCE: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/GlobalDCE/dg.exp diff -u llvm/test/Regression/Transforms/GlobalDCE/dg.exp:1.1 llvm/test/Regression/Transforms/GlobalDCE/dg.exp:1.2 --- llvm/test/Regression/Transforms/GlobalDCE/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/GlobalDCE/dg.exp Fri Nov 19 16:44:21 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:56 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:56 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/BasicAA/dg.exp Message-ID: <200411192246.QAA06126@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/BasicAA: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/BasicAA/dg.exp diff -u llvm/test/Regression/Analysis/BasicAA/dg.exp:1.1 llvm/test/Regression/Analysis/BasicAA/dg.exp:1.2 --- llvm/test/Regression/Analysis/BasicAA/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Analysis/BasicAA/dg.exp Fri Nov 19 16:42:53 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:04 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:04 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/TableGen/dg.exp Message-ID: <200411192247.QAA06151@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/TableGen: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/TableGen/dg.exp diff -u llvm/test/Regression/TableGen/dg.exp:1.1 llvm/test/Regression/TableGen/dg.exp:1.2 --- llvm/test/Regression/TableGen/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/TableGen/dg.exp Fri Nov 19 16:43:54 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:48 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:48 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/Andersens/dg.exp Message-ID: <200411192246.QAA06100@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/Andersens: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/Andersens/dg.exp diff -u llvm/test/Regression/Analysis/Andersens/dg.exp:1.1 llvm/test/Regression/Analysis/Andersens/dg.exp:1.2 --- llvm/test/Regression/Analysis/Andersens/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Analysis/Andersens/dg.exp Fri Nov 19 16:42:49 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:31 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:31 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/dg.exp Message-ID: <200411192247.QAA06256@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CodeGen/X86/dg.exp diff -u llvm/test/Regression/CodeGen/X86/dg.exp:1.1 llvm/test/Regression/CodeGen/X86/dg.exp:1.2 --- llvm/test/Regression/CodeGen/X86/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/CodeGen/X86/dg.exp Fri Nov 19 16:43:43 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:59 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:59 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/dg.exp Message-ID: <200411192246.QAA06136@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CFrontend/dg.exp diff -u llvm/test/Regression/CFrontend/dg.exp:1.1 llvm/test/Regression/CFrontend/dg.exp:1.2 --- llvm/test/Regression/CFrontend/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/CFrontend/dg.exp Fri Nov 19 16:43:25 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:25 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:25 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/RaiseAllocations/dg.exp Message-ID: <200411192247.QAA06202@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/RaiseAllocations: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/RaiseAllocations/dg.exp diff -u llvm/test/Regression/Transforms/RaiseAllocations/dg.exp:1.1 llvm/test/Regression/Transforms/RaiseAllocations/dg.exp:1.2 --- llvm/test/Regression/Transforms/RaiseAllocations/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/RaiseAllocations/dg.exp Fri Nov 19 16:45:05 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:35 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:35 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PruneEH/dg.exp Message-ID: <200411192247.QAA06300@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PruneEH: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/PruneEH/dg.exp diff -u llvm/test/Regression/Transforms/PruneEH/dg.exp:1.1 llvm/test/Regression/Transforms/PruneEH/dg.exp:1.2 --- llvm/test/Regression/Transforms/PruneEH/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/PruneEH/dg.exp Fri Nov 19 16:45:01 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:21 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:21 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/LoadVN/dg.exp Message-ID: <200411192247.QAA06189@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/LoadVN: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/LoadVN/dg.exp diff -u llvm/test/Regression/Analysis/LoadVN/dg.exp:1.1 llvm/test/Regression/Analysis/LoadVN/dg.exp:1.2 --- llvm/test/Regression/Analysis/LoadVN/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Analysis/LoadVN/dg.exp Fri Nov 19 16:43:05 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:20 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:20 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/BlockPlacement/dg.exp Message-ID: <200411192247.QAA06186@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/BlockPlacement: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/BlockPlacement/dg.exp diff -u llvm/test/Regression/Transforms/BlockPlacement/dg.exp:1.1 llvm/test/Regression/Transforms/BlockPlacement/dg.exp:1.2 --- llvm/test/Regression/Transforms/BlockPlacement/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/BlockPlacement/dg.exp Fri Nov 19 16:44:00 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:15 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:15 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/dg.exp Message-ID: <200411192247.QAA06171@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/InstCombine/dg.exp diff -u llvm/test/Regression/Transforms/InstCombine/dg.exp:1.1 llvm/test/Regression/Transforms/InstCombine/dg.exp:1.2 --- llvm/test/Regression/Transforms/InstCombine/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/InstCombine/dg.exp Fri Nov 19 16:44:30 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:32 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:32 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/dg.exp Message-ID: <200411192247.QAA06263@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Assembler/dg.exp diff -u llvm/test/Regression/Assembler/dg.exp:1.1 llvm/test/Regression/Assembler/dg.exp:1.2 --- llvm/test/Regression/Assembler/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Assembler/dg.exp Fri Nov 19 16:43:14 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:17 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:17 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/dg.exp Message-ID: <200411192247.QAA06178@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/IndVarsSimplify/dg.exp diff -u llvm/test/Regression/Transforms/IndVarsSimplify/dg.exp:1.1 llvm/test/Regression/Transforms/IndVarsSimplify/dg.exp:1.2 --- llvm/test/Regression/Transforms/IndVarsSimplify/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/IndVarsSimplify/dg.exp Fri Nov 19 16:44:27 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:45 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:45 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/dg.exp Message-ID: <200411192246.QAA06089@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Linker/dg.exp diff -u llvm/test/Regression/Linker/dg.exp:1.1 llvm/test/Regression/Linker/dg.exp:1.2 --- llvm/test/Regression/Linker/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Linker/dg.exp Fri Nov 19 16:43:50 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:24 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:24 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/CodeExtractor/dg.exp Message-ID: <200411192247.QAA06198@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/CodeExtractor: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/CodeExtractor/dg.exp diff -u llvm/test/Regression/Transforms/CodeExtractor/dg.exp:1.1 llvm/test/Regression/Transforms/CodeExtractor/dg.exp:1.2 --- llvm/test/Regression/Transforms/CodeExtractor/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/CodeExtractor/dg.exp Fri Nov 19 16:44:03 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:32 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:32 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DecomposeMultiDimRefs/dg.exp Message-ID: <200411192247.QAA06262@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DecomposeMultiDimRefs: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/DecomposeMultiDimRefs/dg.exp diff -u llvm/test/Regression/Transforms/DecomposeMultiDimRefs/dg.exp:1.1 llvm/test/Regression/Transforms/DecomposeMultiDimRefs/dg.exp:1.2 --- llvm/test/Regression/Transforms/DecomposeMultiDimRefs/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/DecomposeMultiDimRefs/dg.exp Fri Nov 19 16:44:15 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:32 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:32 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LowerInvoke/dg.exp Message-ID: <200411192247.QAA06267@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LowerInvoke: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LowerInvoke/dg.exp diff -u llvm/test/Regression/Transforms/LowerInvoke/dg.exp:1.1 llvm/test/Regression/Transforms/LowerInvoke/dg.exp:1.2 --- llvm/test/Regression/Transforms/LowerInvoke/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LowerInvoke/dg.exp Fri Nov 19 16:44:42 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:25 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:25 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ConstantMerge/dg.exp Message-ID: <200411192247.QAA06199@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ConstantMerge: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ConstantMerge/dg.exp diff -u llvm/test/Regression/Transforms/ConstantMerge/dg.exp:1.1 llvm/test/Regression/Transforms/ConstantMerge/dg.exp:1.2 --- llvm/test/Regression/Transforms/ConstantMerge/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/ConstantMerge/dg.exp Fri Nov 19 16:44:07 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:16 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:16 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/Inline/dg.exp Message-ID: <200411192247.QAA06174@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/Inline: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/Inline/dg.exp diff -u llvm/test/Regression/Transforms/Inline/dg.exp:1.1 llvm/test/Regression/Transforms/Inline/dg.exp:1.2 --- llvm/test/Regression/Transforms/Inline/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/Inline/dg.exp Fri Nov 19 16:44:29 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:23 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:23 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/Dominators/dg.exp Message-ID: <200411192247.QAA06193@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/Dominators: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/Dominators/dg.exp diff -u llvm/test/Regression/Analysis/Dominators/dg.exp:1.1 llvm/test/Regression/Analysis/Dominators/dg.exp:1.2 --- llvm/test/Regression/Analysis/Dominators/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Analysis/Dominators/dg.exp Fri Nov 19 16:42:59 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:34 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/ExecutionEngine/dg.exp Message-ID: <200411192246.QAA06069@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/ExecutionEngine: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/ExecutionEngine/dg.exp diff -u llvm/test/Regression/ExecutionEngine/dg.exp:1.1 llvm/test/Regression/ExecutionEngine/dg.exp:1.2 --- llvm/test/Regression/ExecutionEngine/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/ExecutionEngine/dg.exp Fri Nov 19 16:43:48 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:30 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:30 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Debugger/dg.exp Message-ID: <200411192247.QAA06238@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Debugger: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Debugger/dg.exp diff -u llvm/test/Regression/Debugger/dg.exp:1.1 llvm/test/Regression/Debugger/dg.exp:1.2 --- llvm/test/Regression/Debugger/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Debugger/dg.exp Fri Nov 19 16:43:45 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:30 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:30 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LowerSetJmp/dg.exp Message-ID: <200411192247.QAA06237@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LowerSetJmp: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LowerSetJmp/dg.exp diff -u llvm/test/Regression/Transforms/LowerSetJmp/dg.exp:1.1 llvm/test/Regression/Transforms/LowerSetJmp/dg.exp:1.2 --- llvm/test/Regression/Transforms/LowerSetJmp/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LowerSetJmp/dg.exp Fri Nov 19 16:44:43 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:31 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:31 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LoopUnswitch/dg.exp Message-ID: <200411192247.QAA06255@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LoopUnswitch: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LoopUnswitch/dg.exp diff -u llvm/test/Regression/Transforms/LoopUnswitch/dg.exp:1.1 llvm/test/Regression/Transforms/LoopUnswitch/dg.exp:1.2 --- llvm/test/Regression/Transforms/LoopUnswitch/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LoopUnswitch/dg.exp Fri Nov 19 16:44:40 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:30 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:30 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DeadStoreElimination/dg.exp Message-ID: <200411192247.QAA06246@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DeadStoreElimination: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/DeadStoreElimination/dg.exp diff -u llvm/test/Regression/Transforms/DeadStoreElimination/dg.exp:1.1 llvm/test/Regression/Transforms/DeadStoreElimination/dg.exp:1.2 --- llvm/test/Regression/Transforms/DeadStoreElimination/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/DeadStoreElimination/dg.exp Fri Nov 19 16:44:13 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:22 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:22 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/GlobalsModRef/dg.exp Message-ID: <200411192247.QAA06192@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/GlobalsModRef: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/GlobalsModRef/dg.exp diff -u llvm/test/Regression/Analysis/GlobalsModRef/dg.exp:1.1 llvm/test/Regression/Analysis/GlobalsModRef/dg.exp:1.2 --- llvm/test/Regression/Analysis/GlobalsModRef/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Analysis/GlobalsModRef/dg.exp Fri Nov 19 16:43:02 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:32 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:32 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DSAnalysis/dg.exp Message-ID: <200411192247.QAA06268@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DSAnalysis: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/DSAnalysis/dg.exp diff -u llvm/test/Regression/Transforms/DSAnalysis/dg.exp:1.1 llvm/test/Regression/Transforms/DSAnalysis/dg.exp:1.2 --- llvm/test/Regression/Transforms/DSAnalysis/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/DSAnalysis/dg.exp Fri Nov 19 16:44:10 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:29 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:29 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/SparcV9/dg.exp Message-ID: <200411192247.QAA06222@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/SparcV9: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CodeGen/SparcV9/dg.exp diff -u llvm/test/Regression/CodeGen/SparcV9/dg.exp:1.1 llvm/test/Regression/CodeGen/SparcV9/dg.exp:1.2 --- llvm/test/Regression/CodeGen/SparcV9/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/CodeGen/SparcV9/dg.exp Fri Nov 19 16:43:40 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:32 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:32 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/TailCallElim/dg.exp Message-ID: <200411192247.QAA06261@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/TailCallElim: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/TailCallElim/dg.exp diff -u llvm/test/Regression/Transforms/TailCallElim/dg.exp:1.1 llvm/test/Regression/Transforms/TailCallElim/dg.exp:1.2 --- llvm/test/Regression/Transforms/TailCallElim/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/TailCallElim/dg.exp Fri Nov 19 16:45:18 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:14 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:14 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/DSGraph/dg.exp Message-ID: <200411192247.QAA06168@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/DSGraph: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/DSGraph/dg.exp diff -u llvm/test/Regression/Analysis/DSGraph/dg.exp:1.1 llvm/test/Regression/Analysis/DSGraph/dg.exp:1.2 --- llvm/test/Regression/Analysis/DSGraph/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Analysis/DSGraph/dg.exp Fri Nov 19 16:42:56 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:32 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:32 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LoopSimplify/dg.exp Message-ID: <200411192247.QAA06266@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LoopSimplify: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LoopSimplify/dg.exp diff -u llvm/test/Regression/Transforms/LoopSimplify/dg.exp:1.1 llvm/test/Regression/Transforms/LoopSimplify/dg.exp:1.2 --- llvm/test/Regression/Transforms/LoopSimplify/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LoopSimplify/dg.exp Fri Nov 19 16:44:37 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:29 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:29 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/LoopInfo/dg.exp Message-ID: <200411192247.QAA06225@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/LoopInfo: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/LoopInfo/dg.exp diff -u llvm/test/Regression/Analysis/LoopInfo/dg.exp:1.1 llvm/test/Regression/Analysis/LoopInfo/dg.exp:1.2 --- llvm/test/Regression/Analysis/LoopInfo/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Analysis/LoopInfo/dg.exp Fri Nov 19 16:43:10 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:37 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:37 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/lib/llvm-dg.exp Message-ID: <200411192247.QAA06310@kain.cs.uiuc.edu> Changes in directory llvm/test/lib: llvm-dg.exp updated: 1.8 -> 1.9 --- Log message: Adding srcdir arg. Added ability to specify the path to an input file. This is needed for when srcdir != objdir. --- Diffs of the changes: (+10 -5) Index: llvm/test/lib/llvm-dg.exp diff -u llvm/test/lib/llvm-dg.exp:1.8 llvm/test/lib/llvm-dg.exp:1.9 --- llvm/test/lib/llvm-dg.exp:1.8 Sat Nov 13 17:36:18 2004 +++ llvm/test/lib/llvm-dg.exp Fri Nov 19 16:46:23 2004 @@ -1,4 +1,4 @@ -proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcontext} { +proc llvm-runtest { programs objdir srcdir subdir target_triplet llvmgcc llvmgxx prcontext} { set path [file join $objdir $subdir] @@ -14,7 +14,9 @@ foreach test $programs { - set timeout 40 + #Should figure out best way to set the timeout + #set timeout 40 + set filename [file tail $test] set output [file join Output $filename.out] set script $output.script @@ -46,15 +48,18 @@ #replace %t with temp filenames regsub -all {%t} $new_runline [file join Output $tmpFile] new_runline + #replace %prcontext with prcontext.tcl (Must replace before %p) + regsub -all {%prcontext} $new_runline $prcontext new_runline + + #replace %p with path to source, + regsub -all {%p} $new_runline $srcdir new_runline + #replace %llvmgcc with actual path to llvmgcc regsub -all {%llvmgcc} $new_runline $llvmgcc new_runline #replace %llvmgxx with actual path to llvmg++ regsub -all {%llvmgxx} $new_runline $llvmgxx new_runline - #replace %prcontext with prcontext.tcl (Goes away when we remove qmtest) - regsub -all {%prcontext} $new_runline $prcontext new_runline - puts $scriptFileId $new_runline } elseif {[regexp {XFAIL:[ *](.+)} $line match targets]} { set targets From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:05 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:05 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ADCE/dg.exp Message-ID: <200411192247.QAA06154@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ADCE: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ADCE/dg.exp diff -u llvm/test/Regression/Transforms/ADCE/dg.exp:1.1 llvm/test/Regression/Transforms/ADCE/dg.exp:1.2 --- llvm/test/Regression/Transforms/ADCE/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/ADCE/dg.exp Fri Nov 19 16:43:56 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:13 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:13 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/BranchCombine/dg.exp Message-ID: <200411192247.QAA06161@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/BranchCombine: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/BranchCombine/dg.exp diff -u llvm/test/Regression/Transforms/BranchCombine/dg.exp:1.1 llvm/test/Regression/Transforms/BranchCombine/dg.exp:1.2 --- llvm/test/Regression/Transforms/BranchCombine/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/BranchCombine/dg.exp Fri Nov 19 16:44:02 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:29 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:29 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/Reassociate/dg.exp Message-ID: <200411192247.QAA06228@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/Reassociate: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/Reassociate/dg.exp diff -u llvm/test/Regression/Transforms/Reassociate/dg.exp:1.1 llvm/test/Regression/Transforms/Reassociate/dg.exp:1.2 --- llvm/test/Regression/Transforms/Reassociate/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/Reassociate/dg.exp Fri Nov 19 16:45:09 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:13 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:13 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/dg.exp Message-ID: <200411192247.QAA06162@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/CBackend: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CodeGen/CBackend/dg.exp diff -u llvm/test/Regression/CodeGen/CBackend/dg.exp:1.1 llvm/test/Regression/CodeGen/CBackend/dg.exp:1.2 --- llvm/test/Regression/CodeGen/CBackend/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/CodeGen/CBackend/dg.exp Fri Nov 19 16:43:28 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:30 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:30 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DeadArgElim/dg.exp Message-ID: <200411192247.QAA06234@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DeadArgElim: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/DeadArgElim/dg.exp diff -u llvm/test/Regression/Transforms/DeadArgElim/dg.exp:1.1 llvm/test/Regression/Transforms/DeadArgElim/dg.exp:1.2 --- llvm/test/Regression/Transforms/DeadArgElim/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/DeadArgElim/dg.exp Fri Nov 19 16:44:12 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:26 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:26 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LICM/dg.exp Message-ID: <200411192247.QAA06210@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LICM: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LICM/dg.exp diff -u llvm/test/Regression/Transforms/LICM/dg.exp:1.1 llvm/test/Regression/Transforms/LICM/dg.exp:1.2 --- llvm/test/Regression/Transforms/LICM/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LICM/dg.exp Fri Nov 19 16:44:34 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:33 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:33 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/dg.exp Message-ID: <200411192247.QAA06282@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/SimplifyCFG/dg.exp diff -u llvm/test/Regression/Transforms/SimplifyCFG/dg.exp:1.1 llvm/test/Regression/Transforms/SimplifyCFG/dg.exp:1.2 --- llvm/test/Regression/Transforms/SimplifyCFG/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/SimplifyCFG/dg.exp Fri Nov 19 16:45:16 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:19 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:19 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ArgumentPromotion/dg.exp Message-ID: <200411192247.QAA06183@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ArgumentPromotion: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ArgumentPromotion/dg.exp diff -u llvm/test/Regression/Transforms/ArgumentPromotion/dg.exp:1.1 llvm/test/Regression/Transforms/ArgumentPromotion/dg.exp:1.2 --- llvm/test/Regression/Transforms/ArgumentPromotion/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/ArgumentPromotion/dg.exp Fri Nov 19 16:43:58 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:30 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:30 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/CorrelatedExprs/dg.exp Message-ID: <200411192247.QAA06231@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/CorrelatedExprs: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/CorrelatedExprs/dg.exp diff -u llvm/test/Regression/Transforms/CorrelatedExprs/dg.exp:1.1 llvm/test/Regression/Transforms/CorrelatedExprs/dg.exp:1.2 --- llvm/test/Regression/Transforms/CorrelatedExprs/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/CorrelatedExprs/dg.exp Fri Nov 19 16:44:09 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:31 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:31 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LowerSwitch/dg.exp Message-ID: <200411192247.QAA06247@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LowerSwitch: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LowerSwitch/dg.exp diff -u llvm/test/Regression/Transforms/LowerSwitch/dg.exp:1.1 llvm/test/Regression/Transforms/LowerSwitch/dg.exp:1.2 --- llvm/test/Regression/Transforms/LowerSwitch/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LowerSwitch/dg.exp Fri Nov 19 16:44:45 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:30 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:30 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SCCP/dg.exp Message-ID: <200411192247.QAA06243@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SCCP: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/SCCP/dg.exp diff -u llvm/test/Regression/Transforms/SCCP/dg.exp:1.1 llvm/test/Regression/Transforms/SCCP/dg.exp:1.2 --- llvm/test/Regression/Transforms/SCCP/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/SCCP/dg.exp Fri Nov 19 16:45:12 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:31 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:31 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/dg.exp Message-ID: <200411192247.QAA06250@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ScalarRepl: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ScalarRepl/dg.exp diff -u llvm/test/Regression/Transforms/ScalarRepl/dg.exp:1.1 llvm/test/Regression/Transforms/ScalarRepl/dg.exp:1.2 --- llvm/test/Regression/Transforms/ScalarRepl/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/ScalarRepl/dg.exp Fri Nov 19 16:45:14 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:33 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:33 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/dg.exp Message-ID: <200411192247.QAA06277@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/FunctionResolve/dg.exp diff -u llvm/test/Regression/Transforms/FunctionResolve/dg.exp:1.1 llvm/test/Regression/Transforms/FunctionResolve/dg.exp:1.2 --- llvm/test/Regression/Transforms/FunctionResolve/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/FunctionResolve/dg.exp Fri Nov 19 16:44:17 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:34 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/Mem2Reg/dg.exp Message-ID: <200411192247.QAA06285@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/Mem2Reg: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/Mem2Reg/dg.exp diff -u llvm/test/Regression/Transforms/Mem2Reg/dg.exp:1.1 llvm/test/Regression/Transforms/Mem2Reg/dg.exp:1.2 --- llvm/test/Regression/Transforms/Mem2Reg/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/Mem2Reg/dg.exp Fri Nov 19 16:44:56 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:01 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:01 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Other/dg.exp Message-ID: <200411192247.QAA06142@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Other: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Other/dg.exp diff -u llvm/test/Regression/Other/dg.exp:1.1 llvm/test/Regression/Other/dg.exp:1.2 --- llvm/test/Regression/Other/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Other/dg.exp Fri Nov 19 16:43:52 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:25 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:25 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/dg.exp Message-ID: <200411192247.QAA06207@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CodeGen/PowerPC/dg.exp diff -u llvm/test/Regression/CodeGen/PowerPC/dg.exp:1.1 llvm/test/Regression/CodeGen/PowerPC/dg.exp:1.2 --- llvm/test/Regression/CodeGen/PowerPC/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/CodeGen/PowerPC/dg.exp Fri Nov 19 16:43:37 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:17 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:17 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/dg.exp Message-ID: <200411192247.QAA06177@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CodeGen/Generic/dg.exp diff -u llvm/test/Regression/CodeGen/Generic/dg.exp:1.1 llvm/test/Regression/CodeGen/Generic/dg.exp:1.2 --- llvm/test/Regression/CodeGen/Generic/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/CodeGen/Generic/dg.exp Fri Nov 19 16:43:33 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:53 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:53 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Bytecode/dg.exp Message-ID: <200411192246.QAA06112@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Bytecode: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Bytecode/dg.exp diff -u llvm/test/Regression/Bytecode/dg.exp:1.1 llvm/test/Regression/Bytecode/dg.exp:1.2 --- llvm/test/Regression/Bytecode/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Bytecode/dg.exp Fri Nov 19 16:43:20 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:34 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/TailDup/dg.exp Message-ID: <200411192247.QAA06292@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/TailDup: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/TailDup/dg.exp diff -u llvm/test/Regression/Transforms/TailDup/dg.exp:1.1 llvm/test/Regression/Transforms/TailDup/dg.exp:1.2 --- llvm/test/Regression/Transforms/TailDup/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/TailDup/dg.exp Fri Nov 19 16:45:22 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:01 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:01 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalOpt/dg.exp Message-ID: <200411192247.QAA06141@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GlobalOpt: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/GlobalOpt/dg.exp diff -u llvm/test/Regression/Transforms/GlobalOpt/dg.exp:1.1 llvm/test/Regression/Transforms/GlobalOpt/dg.exp:1.2 --- llvm/test/Regression/Transforms/GlobalOpt/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/GlobalOpt/dg.exp Fri Nov 19 16:44:23 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:34 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PRE/dg.exp Message-ID: <200411192247.QAA06294@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PRE: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/PRE/dg.exp diff -u llvm/test/Regression/Transforms/PRE/dg.exp:1.1 llvm/test/Regression/Transforms/PRE/dg.exp:1.2 --- llvm/test/Regression/Transforms/PRE/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/PRE/dg.exp Fri Nov 19 16:44:57 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:34 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ProfilePaths/dg.exp Message-ID: <200411192247.QAA06287@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ProfilePaths: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ProfilePaths/dg.exp diff -u llvm/test/Regression/Transforms/ProfilePaths/dg.exp:1.1 llvm/test/Regression/Transforms/ProfilePaths/dg.exp:1.2 --- llvm/test/Regression/Transforms/ProfilePaths/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/ProfilePaths/dg.exp Fri Nov 19 16:44:59 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:35 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:35 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Verifier/dg.exp Message-ID: <200411192247.QAA06299@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Verifier: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Verifier/dg.exp diff -u llvm/test/Regression/Verifier/dg.exp:1.1 llvm/test/Regression/Verifier/dg.exp:1.2 --- llvm/test/Regression/Verifier/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Verifier/dg.exp Fri Nov 19 16:45:25 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:27 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:27 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LoopUnroll/dg.exp Message-ID: <200411192247.QAA06211@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LoopUnroll: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LoopUnroll/dg.exp diff -u llvm/test/Regression/Transforms/LoopUnroll/dg.exp:1.1 llvm/test/Regression/Transforms/LoopUnroll/dg.exp:1.2 --- llvm/test/Regression/Transforms/LoopUnroll/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LoopUnroll/dg.exp Fri Nov 19 16:44:39 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:46:54 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:46:54 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/dg.exp Message-ID: <200411192246.QAA06113@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/C++Frontend/dg.exp diff -u llvm/test/Regression/C++Frontend/dg.exp:1.1 llvm/test/Regression/C++Frontend/dg.exp:1.2 --- llvm/test/Regression/C++Frontend/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/C++Frontend/dg.exp Fri Nov 19 16:43:22 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:27 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:27 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ConstProp/dg.exp Message-ID: <200411192247.QAA06212@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ConstProp: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ConstProp/dg.exp diff -u llvm/test/Regression/Transforms/ConstProp/dg.exp:1.1 llvm/test/Regression/Transforms/ConstProp/dg.exp:1.2 --- llvm/test/Regression/Transforms/ConstProp/dg.exp:1.1 Sat Nov 13 17:00:44 2004 +++ llvm/test/Regression/Transforms/ConstProp/dg.exp Fri Nov 19 16:44:05 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:27 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:27 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LevelRaise/dg.exp Message-ID: <200411192247.QAA06217@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LevelRaise: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/LevelRaise/dg.exp diff -u llvm/test/Regression/Transforms/LevelRaise/dg.exp:1.1 llvm/test/Regression/Transforms/LevelRaise/dg.exp:1.2 --- llvm/test/Regression/Transforms/LevelRaise/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/LevelRaise/dg.exp Fri Nov 19 16:44:36 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 16:47:02 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 16:47:02 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/IPConstantProp/dg.exp Message-ID: <200411192247.QAA06143@kain.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/IPConstantProp: dg.exp updated: 1.1 -> 1.2 --- Log message: Adding srcdir arg --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/IPConstantProp/dg.exp diff -u llvm/test/Regression/Transforms/IPConstantProp/dg.exp:1.1 llvm/test/Regression/Transforms/IPConstantProp/dg.exp:1.2 --- llvm/test/Regression/Transforms/IPConstantProp/dg.exp:1.1 Sat Nov 13 17:00:45 2004 +++ llvm/test/Regression/Transforms/IPConstantProp/dg.exp Fri Nov 19 16:44:25 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From tbrethou at cs.uiuc.edu Fri Nov 19 17:00:36 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Fri, 19 Nov 2004 17:00:36 -0600 (CST) Subject: [llvm-commits] CVS: llvm/test/lib/llvm-dg.exp Message-ID: <200411192300.RAA07825@kain.cs.uiuc.edu> Changes in directory llvm/test/lib: llvm-dg.exp updated: 1.9 -> 1.10 --- Log message: Forgot to join srcdir and subdir for complete path for input files. --- Diffs of the changes: (+1 -1) Index: llvm/test/lib/llvm-dg.exp diff -u llvm/test/lib/llvm-dg.exp:1.9 llvm/test/lib/llvm-dg.exp:1.10 --- llvm/test/lib/llvm-dg.exp:1.9 Fri Nov 19 16:46:23 2004 +++ llvm/test/lib/llvm-dg.exp Fri Nov 19 17:00:19 2004 @@ -52,7 +52,7 @@ regsub -all {%prcontext} $new_runline $prcontext new_runline #replace %p with path to source, - regsub -all {%p} $new_runline $srcdir new_runline + regsub -all {%p} $new_runline [file join $srcdir $subdir] new_runline #replace %llvmgcc with actual path to llvmgcc regsub -all {%llvmgcc} $new_runline $llvmgcc new_runline From brukman at cs.uiuc.edu Fri Nov 19 19:27:51 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 19 Nov 2004 19:27:51 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200411200127.TAA27322@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.77 -> 1.78 --- Log message: If we're going to mention mv and cp, clearly, we also need `rm' --- Diffs of the changes: (+2 -1) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.77 llvm/docs/GettingStarted.html:1.78 --- llvm/docs/GettingStarted.html:1.77 Fri Nov 19 15:53:22 2004 +++ llvm/docs/GettingStarted.html Fri Nov 19 19:27:40 2004 @@ -426,6 +426,7 @@

    • mkdir - create a directory
    • mv - move (rename) files
    • ranlib - symbol table builder for archive libraries
    • +
    • rm - remove (delete) files and directories
    • sed - stream editor for transforming output
    • sh - Bourne shell for make build scripts
    • tar - tape archive for distribution generation
    • @@ -1437,7 +1438,7 @@ Chris Lattner
      Reid Spencer
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/11/19 21:53:22 $ + Last modified: $Date: 2004/11/20 01:27:40 $ From lattner at cs.uiuc.edu Fri Nov 19 20:17:18 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 20:17:18 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeEmitter.h Message-ID: <200411200217.iAK2HI2l003203@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeEmitter.h updated: 1.20 -> 1.21 --- Log message: Remove dead #include --- Diffs of the changes: (+2 -2) Index: llvm/include/llvm/CodeGen/MachineCodeEmitter.h diff -u llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.20 llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.21 --- llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.20 Fri Nov 19 14:56:22 2004 +++ llvm/include/llvm/CodeGen/MachineCodeEmitter.h Fri Nov 19 20:17:03 2004 @@ -17,14 +17,14 @@ #ifndef LLVM_CODEGEN_MACHINECODEEMITTER_H #define LLVM_CODEGEN_MACHINECODEEMITTER_H -#include #include "llvm/Support/DataTypes.h" namespace llvm { -class MachineFunction; class MachineBasicBlock; class MachineConstantPool; +class MachineFunction; +class MachineRelocation; class Value; class GlobalValue; class Function; From brukman at cs.uiuc.edu Fri Nov 19 20:20:38 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 19 Nov 2004 20:20:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp Message-ID: <200411200220.UAA02090@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: CodeExtractor.cpp updated: 1.34 -> 1.35 --- Log message: Allow constructor parameter to override aggregating args; fix spacing --- Diffs of the changes: (+2 -2) Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.34 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.35 --- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.34 Fri Nov 12 18:06:45 2004 +++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Fri Nov 19 20:20:27 2004 @@ -49,7 +49,7 @@ const Type *RetTy; public: CodeExtractor(DominatorSet *ds = 0, bool AggArgs = false) - : DS(ds), AggregateArgs(AggregateArgsOpt), NumExitBlocks(~0U) {} + : DS(ds), AggregateArgs(AggArgs||AggregateArgsOpt), NumExitBlocks(~0U) {} Function *ExtractCodeRegion(const std::vector &code); @@ -403,7 +403,7 @@ // Emit the call to the function CallInst *call = new CallInst(newFunction, params, - NumExitBlocks > 1 ? "targetBlock": ""); + NumExitBlocks > 1 ? "targetBlock" : ""); codeReplacer->getInstList().push_back(call); Function::aiterator OutputArgBegin = newFunction->abegin(); From lattner at cs.uiuc.edu Fri Nov 19 21:06:05 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 21:06:05 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineRelocation.h Message-ID: <200411200306.iAK3651L010374@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineRelocation.h added (r1.1) --- Log message: New file --- Diffs of the changes: (+117 -0) Index: llvm/include/llvm/CodeGen/MachineRelocation.h diff -c /dev/null llvm/include/llvm/CodeGen/MachineRelocation.h:1.1 *** /dev/null Fri Nov 19 21:06:01 2004 --- llvm/include/llvm/CodeGen/MachineRelocation.h Fri Nov 19 21:05:50 2004 *************** *** 0 **** --- 1,117 ---- + //===-- llvm/CodeGen/MachineRelocation.h - Target Relocation ----*- 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 MachineRelocation class. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_CODEGEN_MACHINERELOCATION_H + #define LLVM_CODEGEN_MACHINERELOCATION_H + + #include "llvm/Support/DataTypes.h" + + namespace llvm { + class GlobalValue; + + /// MachineRelocation - This represents a target-specific relocation value, + /// produced by the code emitter. This relocation is resolved after the has + /// been emitted, either to an object file or to memory, when the target of the + /// relocation can be resolved. + /// + /// A relocation is made up of the following logical portions: + /// 1. An offset in the machine code buffer, the location to modify. + /// 2. A target specific relocation type (a number from 0 to 127). + /// 3. A symbol being referenced, either as a GlobalValue* or as a string. + /// 4. An optional constant value to be added to the reference. + /// + class MachineRelocation { + /// OffsetTypeExternal - The low 24-bits of this value is the offset from the + /// start of the code buffer of the relocation to perform. Bit 24 of this is + /// set if Target should use ExtSym instead of GV, and the high 7 bits are to + /// hold the relocation type. + unsigned OffsetTypeExternal; + union { + GlobalValue *GV; // If this is a pointer to an LLVM global + const char *ExtSym; // If this is a pointer to a named symbol + void *Result; // If this has been resolved to a resolved pointer + } Target; + intptr_t ConstantVal; + public: + MachineRelocation(unsigned Offset, unsigned RelocationType, GlobalValue *GV, + intptr_t cst = 0) + : OffsetTypeExternal(Offset + (RelocationType << 25)), ConstantVal(cst) { + assert((Offset & ~((1 << 24)-1)) == 0 && "Code offset too large!"); + assert((RelocationType & ~127) == 0 && "Relocation type too large!"); + Target.GV = GV; + } + + MachineRelocation(unsigned Offset, unsigned RelocationType, const char *ES, + intptr_t cst = 0) + : OffsetTypeExternal(Offset + (1 << 24) + (RelocationType << 25)), + ConstantVal(cst) { + assert((Offset & ~((1 << 24)-1)) == 0 && "Code offset too large!"); + assert((RelocationType & ~127) == 0 && "Relocation type too large!"); + Target.ExtSym = ES; + } + + /// getMachineCodeOffset - Return the offset into the code buffer that the + /// relocation should be performed. + unsigned getMachineCodeOffset() const { + return OffsetTypeExternal & ((1 << 24)-1); + } + + /// getConstantVal - Get the constant value associated with this relocation. + /// This is often an offset from the symbol. + /// + intptr_t getConstantVal() const { + return ConstantVal; + } + + /// isGlobalValue - Return true if this relocation is a GlobalValue, as + /// opposed to a constant string. + bool isGlobalValue() const { + return (OffsetTypeExternal & (1 << 24)) == 0; + } + + /// isString - Return true if this is a constant string. + /// + bool isString() const { + return !isGlobalValue(); + } + + /// getGlobalValue - If this is a global value reference, return the + /// referenced global. + GlobalValue *getGlobalValue() const { + assert(isGlobalValue() && "This is not a global value reference!"); + return Target.GV; + } + + /// getString - If this is a string value, return the string reference. + /// + const char *getString() const { + assert(isString() && "This is not a string reference!"); + return Target.ExtSym; + } + + /// getResultPointer - Once this has been resolved to point to an actual + /// address, this returns the pointer. + void *getResultPointer() const { + return Target.Result; + } + + /// setResultPointer - Set the result to the specified pointer value. + /// + void setResultPointer(void *Ptr) { + Target.Result = Ptr; + } + }; + + } + + #endif From lattner at cs.uiuc.edu Fri Nov 19 21:11:19 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 21:11:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.h Message-ID: <200411200311.iAK3BJn1010587@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.h updated: 1.24 -> 1.25 --- Log message: Add accessor --- Diffs of the changes: (+4 -0) Index: llvm/lib/ExecutionEngine/JIT/JIT.h diff -u llvm/lib/ExecutionEngine/JIT/JIT.h:1.24 llvm/lib/ExecutionEngine/JIT/JIT.h:1.25 --- llvm/lib/ExecutionEngine/JIT/JIT.h:1.24 Sun Nov 7 17:58:46 2004 +++ llvm/lib/ExecutionEngine/JIT/JIT.h Fri Nov 19 21:11:07 2004 @@ -43,6 +43,10 @@ public: ~JIT(); + /// getJITInfo - Return the target JIT information structure. + /// + TargetJITInfo &getJITInfo() const { return TJI; } + /// create - Create an return a new JIT compiler if there is one available /// for the current target. Otherwise, return null. If the JIT is created /// successfully, it takes responsibility for deleting the specified From lattner at cs.uiuc.edu Fri Nov 19 21:43:41 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 21:43:41 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetJITInfo.h Message-ID: <200411200343.iAK3hfEr017618@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetJITInfo.h updated: 1.2 -> 1.3 --- Log message: Allow targets to implement relocation support. --- Diffs of the changes: (+11 -0) Index: llvm/include/llvm/Target/TargetJITInfo.h diff -u llvm/include/llvm/Target/TargetJITInfo.h:1.2 llvm/include/llvm/Target/TargetJITInfo.h:1.3 --- llvm/include/llvm/Target/TargetJITInfo.h:1.2 Mon Sep 27 20:59:17 2004 +++ llvm/include/llvm/Target/TargetJITInfo.h Fri Nov 19 21:43:27 2004 @@ -17,10 +17,13 @@ #ifndef LLVM_TARGET_TARGETJITINFO_H #define LLVM_TARGET_TARGETJITINFO_H +#include + namespace llvm { class Function; class FunctionPassManager; class MachineCodeEmitter; + class MachineRelocation; /// TargetJITInfo - Target specific information required by the Just-In-Time /// code generator. @@ -49,6 +52,14 @@ virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE) { return 0; } + + /// relocate - Before the JIT can run a block of code that has been emitted, + /// it must rewrite the code to contain the actual addresses of any + /// referenced global symbols. + virtual void relocate(void *Function, MachineRelocation *MR, + unsigned NumRelocs) { + assert(NumRelocs == 0 && "This target does not have relocations!"); + } }; } // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 19 21:44:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 21:44:02 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineRelocation.h Message-ID: <200411200344.iAK3i2Ga017664@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineRelocation.h updated: 1.1 -> 1.2 --- Log message: Add the getRelocationType method that I forgot --- Diffs of the changes: (+6 -0) Index: llvm/include/llvm/CodeGen/MachineRelocation.h diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.1 llvm/include/llvm/CodeGen/MachineRelocation.h:1.2 --- llvm/include/llvm/CodeGen/MachineRelocation.h:1.1 Fri Nov 19 21:05:50 2004 +++ llvm/include/llvm/CodeGen/MachineRelocation.h Fri Nov 19 21:43:50 2004 @@ -66,6 +66,12 @@ return OffsetTypeExternal & ((1 << 24)-1); } + /// getRelocationType - Return the target-specific relocation ID for this + /// relocation. + unsigned getRelocationType() const { + return OffsetTypeExternal >> 25; + } + /// getConstantVal - Get the constant value associated with this relocation. /// This is often an offset from the symbol. /// From lattner at cs.uiuc.edu Fri Nov 19 21:44:36 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 21:44:36 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeEmitter.h Message-ID: <200411200344.iAK3iaHC017677@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeEmitter.h updated: 1.21 -> 1.22 --- Log message: Add getCurrentPCOffset() and addRelocation() methods. --- Diffs of the changes: (+14 -5) Index: llvm/include/llvm/CodeGen/MachineCodeEmitter.h diff -u llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.21 llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.22 --- llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.21 Fri Nov 19 20:17:03 2004 +++ llvm/include/llvm/CodeGen/MachineCodeEmitter.h Fri Nov 19 21:44:24 2004 @@ -75,6 +75,20 @@ /// virtual void emitWord(unsigned W) = 0; + /// getCurrentPCValue - This returns the address that the next emitted byte + /// will be output to. + /// + virtual uint64_t getCurrentPCValue() = 0; + + + /// getCurrentPCOffset - Return the offset from the start of the emitted + /// buffer that we are currently writing to. + virtual uint64_t getCurrentPCOffset() = 0; + + /// addRelocation - Whenever a relocatable address is needed, it should be + /// noted with this interface. + virtual void addRelocation(const MachineRelocation &MR) = 0; + /// getGlobalValueAddress - This method is used to get the address of the /// specified global value. In some cases, however, the address may not yet /// be known at the point that the method is called (for example, getting the @@ -90,11 +104,6 @@ // virtual uint64_t getConstantPoolEntryAddress(unsigned Index) = 0; - // getCurrentPCValue - This returns the address that the next emitted byte - // will be output to. - // - virtual uint64_t getCurrentPCValue() = 0; - // forceCompilationOf - Force the compilation of the specified function, and // return its address, because we REALLY need the address now. // From lattner at cs.uiuc.edu Fri Nov 19 21:44:52 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 21:44:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineCodeEmitter.cpp Message-ID: <200411200344.iAK3iqv6017691@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineCodeEmitter.cpp updated: 1.18 -> 1.19 --- Log message: Add getCurrentPCOffset() and addRelocation() methods. --- Diffs of the changes: (+12 -0) Index: llvm/lib/CodeGen/MachineCodeEmitter.cpp diff -u llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.18 llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.19 --- llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.18 Fri Nov 19 14:56:46 2004 +++ llvm/lib/CodeGen/MachineCodeEmitter.cpp Fri Nov 19 21:44:39 2004 @@ -47,10 +47,15 @@ << (void*) Ptr << ") "; } + void addRelocation(const MachineRelocation &MR) { + std::cout << " "; + } + uint64_t getGlobalValueAddress(GlobalValue *V) { return 0; } uint64_t getGlobalValueAddress(const char *Name) { return 0; } uint64_t getConstantPoolEntryAddress(unsigned Num) { return 0; } uint64_t getCurrentPCValue() { return 0; } + uint64_t getCurrentPCOffset() { return 0; } // forceCompilationOf - Force the compilation of the specified function, and // return its address, because we REALLY need the address now. @@ -157,6 +162,13 @@ uint64_t getCurrentPCValue() { return MCE.getCurrentPCValue(); } + uint64_t getCurrentPCOffset() { + return MCE.getCurrentPCOffset(); + } + void addRelocation(const MachineRelocation &MR) { + return MCE.addRelocation(MR); + } + // forceCompilationOf - Force the compilation of the specified function, and // return its address, because we REALLY need the address now. // From lattner at cs.uiuc.edu Fri Nov 19 21:46:28 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 21:46:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200411200346.iAK3kSP4017909@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.48 -> 1.49 --- Log message: Add getCurrentPCOffset() and addRelocation() methods. Add stub support for relocations to finishFunction --- Diffs of the changes: (+40 -6) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.48 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.49 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.48 Fri Nov 19 14:56:40 2004 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Fri Nov 19 21:46:14 2004 @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// This file defines a MachineCodeEmitter object that is used by Jello to write -// machine code to memory and remember where relocatable values lie. +// This file defines a MachineCodeEmitter object that is used by the JIT to +// write machine code to memory and remember where relocatable values are. // //===----------------------------------------------------------------------===// @@ -19,7 +19,9 @@ #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineRelocation.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetJITInfo.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" #include "llvm/System/Memory.h" @@ -72,9 +74,9 @@ } unsigned char *JITMemoryManager::startFunctionBody() { - // Round up to an even multiple of 4 bytes, this should eventually be target + // Round up to an even multiple of 8 bytes, this should eventually be target // specific. - return (unsigned char*)(((intptr_t)CurFunctionPtr + 3) & ~3); + return (unsigned char*)(((intptr_t)CurFunctionPtr + 7) & ~7); } void JITMemoryManager::endFunctionBody(unsigned char *FunctionEnd) { @@ -101,6 +103,10 @@ // ConstantPoolAddresses - Contains the location for each entry in the // constant pool. std::vector ConstantPoolAddresses; + + /// Relocations - These are the relocations that the function needs, as + /// emitted. + std::vector Relocations; public: Emitter(JIT &jit) { TheJIT = &jit; } @@ -113,10 +119,15 @@ virtual void emitWord(unsigned W); virtual void emitWordAt(unsigned W, unsigned *Ptr); + virtual void addRelocation(const MachineRelocation &MR) { + Relocations.push_back(MR); + } + + virtual uint64_t getCurrentPCValue(); + virtual uint64_t getCurrentPCOffset(); virtual uint64_t getGlobalValueAddress(GlobalValue *V); virtual uint64_t getGlobalValueAddress(const char *Name); virtual uint64_t getConstantPoolEntryAddress(unsigned Entry); - virtual uint64_t getCurrentPCValue(); // forceCompilationOf - Force the compilation of the specified function, and // return its address, because we REALLY need the address now. @@ -141,9 +152,28 @@ ConstantPoolAddresses.clear(); NumBytes += CurByte-CurBlock; + if (!Relocations.empty()) { + // Resolve the relocations to concrete pointers. + for (unsigned i = 0, e = Relocations.size(); i != e; ++i) { + MachineRelocation &MR = Relocations[i]; + void *ResultPtr; + if (MR.isGlobalValue()) { + assert(0 && "Unimplemented!\n"); + } else { + ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString()); + } + MR.setResultPointer(ResultPtr); + } + + TheJIT->getJITInfo().relocate(CurBlock, &Relocations[0], + Relocations.size()); + } + DEBUG(std::cerr << "Finished CodeGen of [" << (void*)CurBlock << "] Function: " << F.getFunction()->getName() - << ": " << CurByte-CurBlock << " bytes of text\n"); + << ": " << CurByte-CurBlock << " bytes of text, " + << Relocations.size() << " relocations\n"); + Relocations.clear(); } void Emitter::emitConstantPool(MachineConstantPool *MCP) { @@ -245,6 +275,10 @@ return (intptr_t)CurByte; } +uint64_t Emitter::getCurrentPCOffset() { + return (intptr_t)CurByte-(intptr_t)CurBlock; +} + uint64_t Emitter::forceCompilationOf(Function *F) { return (intptr_t)TheJIT->getPointerToFunction(F); } From lattner at cs.uiuc.edu Fri Nov 19 22:14:58 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 22:14:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp PPC32JITInfo.h PPC64CodeEmitter.cpp PPC64JITInfo.h Message-ID: <200411200414.iAK4EwP5027067@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32CodeEmitter.cpp updated: 1.12 -> 1.13 PPC32JITInfo.h updated: 1.2 -> 1.3 PPC64CodeEmitter.cpp updated: 1.2 -> 1.3 PPC64JITInfo.h updated: 1.2 -> 1.3 --- Log message: getJITStubForFunction is optional and unimplemented, just remove it. --- Diffs of the changes: (+0 -23) Index: llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.12 llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.13 --- llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.12 Mon Nov 15 22:47:32 2004 +++ llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp Fri Nov 19 22:14:44 2004 @@ -334,11 +334,6 @@ return rv; } - -void *PPC32JITInfo::getJITStubForFunction(Function *F, MachineCodeEmitter &MCE){ - return (void*)((unsigned long)getResolver(MCE).getLazyResolver(F)); -} - void PPC32JITInfo::replaceMachineCodeForFunction (void *Old, void *New) { std::cerr << "PPC32JITInfo::replaceMachineCodeForFunction not implemented\n"; abort(); Index: llvm/lib/Target/PowerPC/PPC32JITInfo.h diff -u llvm/lib/Target/PowerPC/PPC32JITInfo.h:1.2 llvm/lib/Target/PowerPC/PPC32JITInfo.h:1.3 --- llvm/lib/Target/PowerPC/PPC32JITInfo.h:1.2 Wed Aug 11 02:40:04 2004 +++ llvm/lib/Target/PowerPC/PPC32JITInfo.h Fri Nov 19 22:14:44 2004 @@ -30,12 +30,6 @@ /// code. /// virtual void replaceMachineCodeForFunction(void *Old, void *New); - - /// getJITStubForFunction - Create or return a stub for the specified - /// function. This stub acts just like the specified function, except that - /// it allows the "address" of the function to be taken without having to - /// generate code for it. - virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE); }; } Index: llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp:1.2 llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp:1.3 --- llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp:1.2 Mon Nov 15 22:47:33 2004 +++ llvm/lib/Target/PowerPC/PPC64CodeEmitter.cpp Fri Nov 19 22:14:44 2004 @@ -29,12 +29,6 @@ // PM.add(createMachineCodeDeleter()); } -void *PPC64JITInfo::getJITStubForFunction(Function *F, - MachineCodeEmitter &MCE) { - assert (0 && "PPC64JITInfo::getJITStubForFunction not implemented"); - return 0; -} - void PPC64JITInfo::replaceMachineCodeForFunction (void *Old, void *New) { assert (0 && "PPC64JITInfo::replaceMachineCodeForFunction not implemented"); } Index: llvm/lib/Target/PowerPC/PPC64JITInfo.h diff -u llvm/lib/Target/PowerPC/PPC64JITInfo.h:1.2 llvm/lib/Target/PowerPC/PPC64JITInfo.h:1.3 --- llvm/lib/Target/PowerPC/PPC64JITInfo.h:1.2 Wed Aug 11 02:40:04 2004 +++ llvm/lib/Target/PowerPC/PPC64JITInfo.h Fri Nov 19 22:14:44 2004 @@ -29,12 +29,6 @@ /// code. /// virtual void replaceMachineCodeForFunction(void *Old, void *New); - - /// getJITStubForFunction - Create or return a stub for the specified - /// function. This stub acts just like the specified function, except that - /// it allows the "address" of the function to be taken without having to - /// generate code for it. - virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE); }; } From lattner at cs.uiuc.edu Fri Nov 19 22:15:50 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 22:15:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Skeleton/SkeletonJITInfo.cpp SkeletonJITInfo.h Message-ID: <200411200415.iAK4FoKT029119@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Skeleton: SkeletonJITInfo.cpp updated: 1.1 -> 1.2 SkeletonJITInfo.h updated: 1.1 -> 1.2 --- Log message: getJITStubForFunction is optional and unimplemented, just remove it for now. --- Diffs of the changes: (+0 -12) Index: llvm/lib/Target/Skeleton/SkeletonJITInfo.cpp diff -u llvm/lib/Target/Skeleton/SkeletonJITInfo.cpp:1.1 llvm/lib/Target/Skeleton/SkeletonJITInfo.cpp:1.2 --- llvm/lib/Target/Skeleton/SkeletonJITInfo.cpp:1.1 Fri Jul 16 02:11:11 2004 +++ llvm/lib/Target/Skeleton/SkeletonJITInfo.cpp Fri Nov 19 22:15:38 2004 @@ -25,12 +25,6 @@ return true; // Not implemented yet! } -void *SkeletonJITInfo::getJITStubForFunction(Function *F, - MachineCodeEmitter &MCE) { - assert (0 && "getJITStubForFunction not implemented"); - return 0; -} - void SkeletonJITInfo::replaceMachineCodeForFunction (void *Old, void *New) { assert (0 && "replaceMachineCodeForFunction not implemented"); } Index: llvm/lib/Target/Skeleton/SkeletonJITInfo.h diff -u llvm/lib/Target/Skeleton/SkeletonJITInfo.h:1.1 llvm/lib/Target/Skeleton/SkeletonJITInfo.h:1.2 --- llvm/lib/Target/Skeleton/SkeletonJITInfo.h:1.1 Fri Jul 16 02:11:11 2004 +++ llvm/lib/Target/Skeleton/SkeletonJITInfo.h Fri Nov 19 22:15:38 2004 @@ -37,12 +37,6 @@ /// code. /// virtual void replaceMachineCodeForFunction(void *Old, void *New); - - /// getJITStubForFunction - Create or return a stub for the specified - /// function. This stub acts just like the specified function, except that - /// it allows the "address" of the function to be taken without having to - /// generate code for it. - virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE); }; } From lattner at cs.uiuc.edu Fri Nov 19 22:17:29 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 22:17:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCJITInfo.h PowerPCTargetMachine.cpp Message-ID: <200411200417.iAK4HTnS029137@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PowerPCJITInfo.h updated: 1.2 -> 1.3 PowerPCTargetMachine.cpp updated: 1.36 -> 1.37 --- Log message: Remove this method, it's not clear how it could be implemented indep of 32 or 64-bit mode --- Diffs of the changes: (+0 -12) Index: llvm/lib/Target/PowerPC/PowerPCJITInfo.h diff -u llvm/lib/Target/PowerPC/PowerPCJITInfo.h:1.2 llvm/lib/Target/PowerPC/PowerPCJITInfo.h:1.3 --- llvm/lib/Target/PowerPC/PowerPCJITInfo.h:1.2 Tue Aug 10 19:11:25 2004 +++ llvm/lib/Target/PowerPC/PowerPCJITInfo.h Fri Nov 19 22:17:17 2004 @@ -37,12 +37,6 @@ /// code. /// virtual void replaceMachineCodeForFunction(void *Old, void *New); - - /// getJITStubForFunction - Create or return a stub for the specified - /// function. This stub acts just like the specified function, except that - /// it allows the "address" of the function to be taken without having to - /// generate code for it. - virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE); }; } Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.36 llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.37 --- llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.36 Mon Oct 25 15:53:41 2004 +++ llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp Fri Nov 19 22:17:17 2004 @@ -138,12 +138,6 @@ assert(0 && "Cannot execute PowerPCJITInfo::replaceMachineCodeForFunction()"); } -void *PowerPCJITInfo::getJITStubForFunction(Function *F, - MachineCodeEmitter &MCE) { - assert(0 && "Cannot execute PowerPCJITInfo::getJITStubForFunction()"); - return 0; -} - /// PowerPCTargetMachine ctor - Create an ILP32 architecture model /// PPC32TargetMachine::PPC32TargetMachine(const Module &M, IntrinsicLowering *IL) From lattner at cs.uiuc.edu Fri Nov 19 22:20:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 19 Nov 2004 22:20:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9JITInfo.h Message-ID: <200411200420.iAK4K1eK031809@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9JITInfo.h updated: 1.5 -> 1.6 --- Log message: This method was never implemented --- Diffs of the changes: (+0 -6) Index: llvm/lib/Target/SparcV9/SparcV9JITInfo.h diff -u llvm/lib/Target/SparcV9/SparcV9JITInfo.h:1.5 llvm/lib/Target/SparcV9/SparcV9JITInfo.h:1.6 --- llvm/lib/Target/SparcV9/SparcV9JITInfo.h:1.5 Sun Apr 25 02:04:49 2004 +++ llvm/lib/Target/SparcV9/SparcV9JITInfo.h Fri Nov 19 22:19:47 2004 @@ -38,12 +38,6 @@ /// code. /// virtual void replaceMachineCodeForFunction (void *Old, void *New); - - /// getJITStubForFunction - Create or return a stub for the specified - /// function. This stub acts just like the specified function, except that - /// it allows the "address" of the function to be taken without having to - /// generate code for it. - //virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE); }; } From llvm at cs.uiuc.edu Sat Nov 20 01:24:09 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Sat, 20 Nov 2004 01:24:09 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/MacOSX.ll SVR4.ll xpg4.ll Message-ID: <200411200724.BAA06076@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: MacOSX.ll (r1.1) removed SVR4.ll (r1.3) removed xpg4.ll (r1.2) removed --- Log message: Contents separated into individual tests. --- Diffs of the changes: (+0 -0) From reid at x10sys.com Sat Nov 20 01:24:40 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 01:24:40 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/README.txt Message-ID: <200411200724.BAA06100@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: README.txt added (r1.1) --- Log message: Describe the Archive test suite. --- Diffs of the changes: (+24 -0) Index: llvm/test/Regression/Archive/README.txt diff -c /dev/null llvm/test/Regression/Archive/README.txt:1.1 *** /dev/null Sat Nov 20 01:24:38 2004 --- llvm/test/Regression/Archive/README.txt Sat Nov 20 01:24:28 2004 *************** *** 0 **** --- 1,24 ---- + test/Regression/Archive + ======================= + + This directory contains various tests of llvm-ar and llvm-ranlib to ensure + compatibility reading other ar(1) formats. It also provides a basic + functionality test for these tools. + + There are four archives stored in CVS with these tests: + + GNU.a - constructed on Linux with GNU ar + MacOSX.a - constructed on Mac OS X with its native BSD4.4 ar + SVR4.a - constructed on Solaris with /usr/ccs/bin/ar + xpg4.a - constructed on Solaris with /usr/xpg4/bin/ar + + Each type of test is run on each of these archive files. These archives each + contain four members: + + oddlen - a member with an odd lengthed name and content + evenlen - a member with an even lengthed name and content + IsNAN.o - a Linux native binary + very_long_bytecode_file_name.bc - LLVM bytecode file with really long name + + These files test different aspects of the archiver that should cause failures + in llvm-ar if regressions are introduced. From reid at x10sys.com Sat Nov 20 01:25:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 01:25:52 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/extract_GNU.ll extract_MacOSX.ll extract_SVR4.ll extract_xpg4.ll ranlib_GNU.ll ranlib_MacOSX.ll ranlib_SVR4.ll ranlib_xpg4.ll toc_GNU.ll toc_MacOSX.ll toc_SVR4.ll toc_xpg4.ll Message-ID: <200411200725.BAA06183@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: extract_GNU.ll added (r1.1) extract_MacOSX.ll added (r1.1) extract_SVR4.ll added (r1.1) extract_xpg4.ll added (r1.1) ranlib_GNU.ll added (r1.1) ranlib_MacOSX.ll added (r1.1) ranlib_SVR4.ll added (r1.1) ranlib_xpg4.ll added (r1.1) toc_GNU.ll added (r1.1) toc_MacOSX.ll added (r1.1) toc_SVR4.ll added (r1.1) toc_xpg4.ll added (r1.1) --- Log message: An llvm-ar test. --- Diffs of the changes: (+89 -0) Index: llvm/test/Regression/Archive/extract_GNU.ll diff -c /dev/null llvm/test/Regression/Archive/extract_GNU.ll:1.1 *** /dev/null Sat Nov 20 01:25:51 2004 --- llvm/test/Regression/Archive/extract_GNU.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,5 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can extract bytecode members + ;from GNU style archives + ;RUN: llvm-ar x %p/GNU.a very_long_bytecode_file_name.bc + ;RUN: diff -q %p/very_long_bytecode_file_name.bc very_long_bytecode_file_name.bc Index: llvm/test/Regression/Archive/extract_MacOSX.ll diff -c /dev/null llvm/test/Regression/Archive/extract_MacOSX.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/extract_MacOSX.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,6 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can extract bytecode members + ;from MacOSX style archives + + ;RUN: llvm-ar x %p/MacOSX.a very_long_bytecode_file_name.bc + ;RUN: diff -q %p/very_long_bytecode_file_name.bc very_long_bytecode_file_name.bc Index: llvm/test/Regression/Archive/extract_SVR4.ll diff -c /dev/null llvm/test/Regression/Archive/extract_SVR4.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/extract_SVR4.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,6 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can extract bytecode members + ;from SVR4 style archives + + ;RUN: llvm-ar x %p/SVR4.a very_long_bytecode_file_name.bc + ;RUN: diff -q %p/very_long_bytecode_file_name.bc very_long_bytecode_file_name.bc Index: llvm/test/Regression/Archive/extract_xpg4.ll diff -c /dev/null llvm/test/Regression/Archive/extract_xpg4.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/extract_xpg4.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,6 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can extract bytecode members + ;from xpg4 style archives + + ;RUN: llvm-ar x %p/xpg4.a very_long_bytecode_file_name.bc + ;RUN: diff -q %p/very_long_bytecode_file_name.bc very_long_bytecode_file_name.bc Index: llvm/test/Regression/Archive/ranlib_GNU.ll diff -c /dev/null llvm/test/Regression/Archive/ranlib_GNU.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/ranlib_GNU.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,12 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can generate a symbol table for + ;GNU style archives + ;RUN: cp %p/GNU.a . + ;RUN: llvm-ranlib GNU.a + ;RUN: llvm-ar t GNU.a > %t1 + ;RUN: sed -e '/^;.*/d' %s >%t2 + ;RUN: diff %t2 %t1 + evenlen + oddlen + very_long_bytecode_file_name.bc + IsNAN.o Index: llvm/test/Regression/Archive/ranlib_MacOSX.ll Index: llvm/test/Regression/Archive/ranlib_SVR4.ll diff -c /dev/null llvm/test/Regression/Archive/ranlib_SVR4.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/ranlib_SVR4.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,12 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can generate a symbol table for + ;SVR4 style archives + ;RUN: cp %p/SVR4.a . + ;RUN: llvm-ranlib SVR4.a + ;RUN: llvm-ar t SVR4.a > %t1 + ;RUN: sed -e '/^;.*/d' %s >%t2 + ;RUN: diff %t2 %t1 + evenlen + oddlen + very_long_bytecode_file_name.bc + IsNAN.o Index: llvm/test/Regression/Archive/ranlib_xpg4.ll diff -c /dev/null llvm/test/Regression/Archive/ranlib_xpg4.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/ranlib_xpg4.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,12 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can generate a symbol table for + ;xpg4 style archives + ;RUN: cp %p/xpg4.a . + ;RUN: llvm-ranlib xpg4.a + ;RUN: llvm-ar t xpg4.a > %t1 + ;RUN: sed -e '/^;.*/d' %s >%t2 + ;RUN: diff %t2 %t1 + evenlen + oddlen + very_long_bytecode_file_name.bc + IsNAN.o Index: llvm/test/Regression/Archive/toc_GNU.ll diff -c /dev/null llvm/test/Regression/Archive/toc_GNU.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/toc_GNU.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,10 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can generate a table of contents for + ;GNU style archives + ;RUN: llvm-ar t %p/GNU.a > %t1 + ;RUN: sed -e '/^;.*/d' %s >%t2 + ;RUN: diff %t2 %t1 + evenlen + oddlen + very_long_bytecode_file_name.bc + IsNAN.o Index: llvm/test/Regression/Archive/toc_MacOSX.ll Index: llvm/test/Regression/Archive/toc_SVR4.ll diff -c /dev/null llvm/test/Regression/Archive/toc_SVR4.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/toc_SVR4.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,10 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can generate a table of contents for + ;SVR4 style archives + ;RUN: llvm-ar t %p/SVR4.a > %t1 + ;RUN: sed -e '/^;.*/d' %s >%t2 + ;RUN: diff %t2 %t1 + evenlen + oddlen + very_long_bytecode_file_name.bc + IsNAN.o Index: llvm/test/Regression/Archive/toc_xpg4.ll diff -c /dev/null llvm/test/Regression/Archive/toc_xpg4.ll:1.1 *** /dev/null Sat Nov 20 01:25:52 2004 --- llvm/test/Regression/Archive/toc_xpg4.ll Sat Nov 20 01:25:41 2004 *************** *** 0 **** --- 1,10 ---- + ;This isn't really an assembly file, its just here to run the test. + ;This test just makes sure that llvm-ar can generate a table of contents for + ;xpg4 style archives + ;RUN: llvm-ar t %p/xpg4.a > %t1 + ;RUN: sed -e '/^;.*/d' %s >%t2 + ;RUN: diff %t2 %t1 + evenlen + oddlen + very_long_bytecode_file_name.bc + IsNAN.o From reid at x10sys.com Sat Nov 20 01:25:21 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 01:25:21 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/dg.exp Message-ID: <200411200725.BAA06137@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: dg.exp updated: 1.1 -> 1.2 --- Log message: Provide the srcdir variable. --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Archive/dg.exp diff -u llvm/test/Regression/Archive/dg.exp:1.1 llvm/test/Regression/Archive/dg.exp:1.2 --- llvm/test/Regression/Archive/dg.exp:1.1 Thu Nov 18 20:26:35 2004 +++ llvm/test/Regression/Archive/dg.exp Sat Nov 20 01:25:10 2004 @@ -1,3 +1,3 @@ load_lib llvm-dg.exp -llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From reid at x10sys.com Sat Nov 20 01:29:50 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 01:29:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Archive.h Message-ID: <200411200729.BAA06271@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Archive.h updated: 1.7 -> 1.8 --- Log message: Distinguish between BSD4.4 and SVR4 symbol tables --- Diffs of the changes: (+14 -9) Index: llvm/include/llvm/Bytecode/Archive.h diff -u llvm/include/llvm/Bytecode/Archive.h:1.7 llvm/include/llvm/Bytecode/Archive.h:1.8 --- llvm/include/llvm/Bytecode/Archive.h:1.7 Thu Nov 18 21:18:22 2004 +++ llvm/include/llvm/Bytecode/Archive.h Sat Nov 20 01:29:40 2004 @@ -49,12 +49,13 @@ /// access to the flags. The flags are not user settable. enum Flags { CompressedFlag = 1, ///< Member is a normal compressed file - ForeignSymbolTableFlag = 2, ///< Member is a foreign symbol table - LLVMSymbolTableFlag = 4, ///< Member is an LLVM symbol table - BytecodeFlag = 8, ///< Member is uncompressed bytecode - CompressedBytecodeFlag = 16, ///< Member is compressed bytecode - HasPathFlag = 32, ///< Member has a full or partial path - HasLongFilenameFlag = 64, ///< Member uses the long filename syntax + SVR4SymbolTableFlag = 2, ///< Member is a SVR4 symbol table + BSD4SymbolTableFlag = 4, ///< Member is a BSD4 symbol table + LLVMSymbolTableFlag = 8, ///< Member is an LLVM symbol table + BytecodeFlag = 16, ///< Member is uncompressed bytecode + CompressedBytecodeFlag = 32, ///< Member is compressed bytecode + HasPathFlag = 64, ///< Member has a full or partial path + HasLongFilenameFlag = 128, ///< Member uses the long filename syntax StringTableFlag = 256, ///< Member is an ar(1) format string table }; @@ -117,9 +118,13 @@ /// @brief Determine if the member is a compressed regular file. bool isCompressed() const { return flags&CompressedFlag; } - /// @returns true iff the member is a foreign (non-LLVM) symbol table - /// @brief Determine if this member is a foreign symbol table. - bool isForeignSymbolTable() const { return flags&ForeignSymbolTableFlag; } + /// @returns true iff the member is a SVR4 (non-LLVM) symbol table + /// @brief Determine if this member is a SVR4 symbol table. + bool isSVR4SymbolTable() const { return flags&SVR4SymbolTableFlag; } + + /// @returns true iff the member is a BSD4.4 (non-LLVM) symbol table + /// @brief Determine if this member is a BSD4.4 symbol table. + bool isBSD4SymbolTable() const { return flags&BSD4SymbolTableFlag; } /// @returns true iff the archive member is the LLVM symbol table /// @brief Determine if this member is the LLVM symbol table. From reid at x10sys.com Sat Nov 20 01:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 01:29:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/Archive.cpp ArchiveInternals.h ArchiveReader.cpp ArchiveWriter.cpp Message-ID: <200411200729.BAA06280@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: Archive.cpp updated: 1.3 -> 1.4 ArchiveInternals.h updated: 1.2 -> 1.3 ArchiveReader.cpp updated: 1.30 -> 1.31 ArchiveWriter.cpp updated: 1.8 -> 1.9 --- Log message: Distinguish between BSD4.4 and SVR4 symbol tables --- Diffs of the changes: (+66 -40) Index: llvm/lib/Bytecode/Archive/Archive.cpp diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.3 llvm/lib/Bytecode/Archive/Archive.cpp:1.4 --- llvm/lib/Bytecode/Archive/Archive.cpp:1.3 Tue Nov 16 00:47:07 2004 +++ llvm/lib/Bytecode/Archive/Archive.cpp Sat Nov 20 01:29:40 2004 @@ -65,11 +65,17 @@ data = 0; path = newFile; - // Foreign symbol tables have an empty name - if (path.get() == ARFILE_SYMTAB_NAME) - flags |= ForeignSymbolTableFlag; + // SVR4 symbol tables have an empty name + if (path.get() == ARFILE_SVR4_SYMTAB_NAME) + flags |= SVR4SymbolTableFlag; else - flags &= ~ForeignSymbolTableFlag; + flags &= ~SVR4SymbolTableFlag; + + // BSD4.4 symbol tables have a special name + if (path.get() == ARFILE_BSD4_SYMTAB_NAME) + flags |= BSD4SymbolTableFlag; + else + flags &= ~BSD4SymbolTableFlag; // LLVM symbol tables have a very specific name if (path.get() == ARFILE_LLVM_SYMTAB_NAME) Index: llvm/lib/Bytecode/Archive/ArchiveInternals.h diff -u llvm/lib/Bytecode/Archive/ArchiveInternals.h:1.2 llvm/lib/Bytecode/Archive/ArchiveInternals.h:1.3 --- llvm/lib/Bytecode/Archive/ArchiveInternals.h:1.2 Sun Nov 14 15:57:46 2004 +++ llvm/lib/Bytecode/Archive/ArchiveInternals.h Sat Nov 20 01:29:40 2004 @@ -20,9 +20,10 @@ #define ARFILE_MAGIC "!\n" ///< magic string #define ARFILE_MAGIC_LEN (sizeof(ARFILE_MAGIC)-1) ///< length of magic string -#define ARFILE_SYMTAB_NAME "/ " ///< regular symtab entry -#define ARFILE_STRTAB_NAME "// " ///< Name of string table -#define ARFILE_LLVM_SYMTAB_NAME "#_LLVM_SYM_TAB_#" ///< LLVM's symtab entry +#define ARFILE_SVR4_SYMTAB_NAME "/ " ///< SVR4 symtab entry name +#define ARFILE_LLVM_SYMTAB_NAME "#_LLVM_SYM_TAB_#" ///< LLVM symtab entry name +#define ARFILE_BSD4_SYMTAB_NAME "__.SYMDEF SORTED" ///< BSD4 symtab entry name +#define ARFILE_STRTAB_NAME "// " ///< Name of string table #define ARFILE_PAD "\n" ///< inter-file align padding #define ARFILE_MEMBER_MAGIC "`\n" ///< fmag field magic # Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.30 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.31 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.30 Fri Nov 19 11:08:00 2004 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Sat Nov 20 01:29:40 2004 @@ -41,7 +41,7 @@ if (At + length > End) throw std::string("malformed symbol table"); // we don't care if it can't be inserted (duplicate entry) - symTab.insert(std::make_pair(std::string(At,length),offset)); + symTab.insert(std::make_pair(std::string(At, length), offset)); At += length; } symTabSize = size; @@ -96,14 +96,14 @@ if (Hdr->name[1] == '1' && Hdr->name[2] == '/') { if (isdigit(Hdr->name[3])) { unsigned len = atoi(&Hdr->name[3]); - pathname.assign(At,len); + pathname.assign(At, len); At += len; MemberSize -= len; flags |= ArchiveMember::HasLongFilenameFlag; } else throw std::string("invalid long filename"); } else if (Hdr->name[1] == '_' && - (0==memcmp(Hdr->name,ARFILE_LLVM_SYMTAB_NAME,16))) { + (0 == memcmp(Hdr->name, ARFILE_LLVM_SYMTAB_NAME, 16))) { // The member is using a long file name (>15 chars) format. // This format is standard for 4.4BSD and Mac OSX operating // systems. LLVM uses it similarly. In this format, the @@ -116,18 +116,18 @@ break; case '/': if (Hdr->name[1]== '/') { - if (0==memcmp(Hdr->name,ARFILE_STRTAB_NAME,16)) { + if (0 == memcmp(Hdr->name, ARFILE_STRTAB_NAME, 16)) { pathname.assign(ARFILE_STRTAB_NAME); flags |= ArchiveMember::StringTableFlag; } else { throw std::string("invalid string table name"); } } else if (Hdr->name[1] == ' ') { - if (0==memcmp(Hdr->name,ARFILE_SYMTAB_NAME,16)) { - pathname.assign(ARFILE_SYMTAB_NAME); - flags |= ArchiveMember::ForeignSymbolTableFlag; + if (0 == memcmp(Hdr->name, ARFILE_SVR4_SYMTAB_NAME, 16)) { + pathname.assign(ARFILE_SVR4_SYMTAB_NAME); + flags |= ArchiveMember::SVR4SymbolTableFlag; } else { - throw std::string("invalid foreign symbol table name"); + throw std::string("invalid SVR4 symbol table name"); } } else if (isdigit(Hdr->name[1])) { unsigned index = atoi(&Hdr->name[1]); @@ -138,7 +138,7 @@ const char* last_p = p; while (p < endp) { if (*p == '\n' && *last_p == '/') { - pathname.assign(namep,last_p-namep); + pathname.assign(namep, last_p - namep); flags |= ArchiveMember::HasLongFilenameFlag; break; } @@ -152,17 +152,24 @@ } } break; + case '_': + if (Hdr->name[1] == '_' && + (0 == memcmp(Hdr->name, ARFILE_BSD4_SYMTAB_NAME, 16))) { + pathname.assign(ARFILE_BSD4_SYMTAB_NAME); + flags |= ArchiveMember::BSD4SymbolTableFlag; + } + break; default: - char* slash = (char*) memchr(Hdr->name,'/',16); + char* slash = (char*) memchr(Hdr->name, '/', 16); if (slash == 0) slash = Hdr->name + 16; - pathname.assign(Hdr->name,slash-Hdr->name); + pathname.assign(Hdr->name, slash - Hdr->name); break; } // Determine if this is a bytecode file - switch (sys::IdentifyFileType(At,4)) { + switch (sys::IdentifyFileType(At, 4)) { case sys::BytecodeFileType: flags |= ArchiveMember::BytecodeFlag; break; @@ -183,7 +190,7 @@ member->path.setFile(pathname); member->info.fileSize = MemberSize; member->info.modTime.fromEpochTime(atoi(Hdr->date)); - sscanf(Hdr->mode,"%o",&(member->info.mode)); + sscanf(Hdr->mode, "%o", &(member->info.mode)); member->info.user = atoi(Hdr->uid); member->info.group = atoi(Hdr->gid); member->flags = flags; @@ -195,7 +202,7 @@ void Archive::checkSignature() { // Check the magic string at file's header - if (mapfile->size() < 8 || memcmp(base, ARFILE_MAGIC,8)) + if (mapfile->size() < 8 || memcmp(base, ARFILE_MAGIC, 8)) throw std::string("invalid signature for an archive file"); } @@ -222,9 +229,14 @@ ArchiveMember* mbr = parseMemberHeader(At, End); // check if this is the foreign symbol table - if (mbr->isForeignSymbolTable()) { + if (mbr->isSVR4SymbolTable() || mbr->isBSD4SymbolTable()) { // We just save this but don't do anything special // with it. It doesn't count as the "first file". + if (foreignST) { + // What? Multiple foreign symbol tables? Just chuck it + // and retain the last one found. + delete foreignST; + } foreignST = mbr; At += mbr->getSize(); if ((intptr_t(At) & 1) == 1) @@ -234,7 +246,7 @@ // variable. This will be used to get the names of the // members that use the "/ddd" format for their names // (SVR4 style long names). - strtab.assign(At,mbr->getSize()); + strtab.assign(At, mbr->getSize()); At += mbr->getSize(); if ((intptr_t(At) & 1) == 1) At++; @@ -244,7 +256,7 @@ // already, its an error. Otherwise, parse the symbol table and move on. if (seenSymbolTable) throw std::string("invalid archive: multiple symbol tables"); - parseSymbolTable(mbr->getData(),mbr->getSize()); + parseSymbolTable(mbr->getData(), mbr->getSize()); seenSymbolTable = true; At += mbr->getSize(); if ((intptr_t(At) & 1) == 1) @@ -269,7 +281,7 @@ Archive* Archive::OpenAndLoad(const sys::Path& file) { - Archive* result = new Archive(file,true); + Archive* result = new Archive(file, true); result->loadArchive(); @@ -314,7 +326,7 @@ const char* FirstFile = At; ArchiveMember* mbr = parseMemberHeader(At, End); - if (mbr->isForeignSymbolTable()) { + if (mbr->isSVR4SymbolTable() || mbr->isBSD4SymbolTable()) { // Skip the foreign symbol table, we don't do anything with it At += mbr->getSize(); if ((intptr_t(At) & 1) == 1) @@ -323,24 +335,24 @@ // Read the next one FirstFile = At; - mbr = parseMemberHeader(At,End); + mbr = parseMemberHeader(At, End); } if (mbr->isStringTable()) { // Process the string table entry - strtab.assign((const char*)mbr->getData(),mbr->getSize()); + strtab.assign((const char*)mbr->getData(), mbr->getSize()); At += mbr->getSize(); if ((intptr_t(At) & 1) == 1) At++; delete mbr; // Get the next one FirstFile = At; - mbr = parseMemberHeader(At,End); + mbr = parseMemberHeader(At, End); } // See if its the symbol table if (mbr->isLLVMSymbolTable()) { - parseSymbolTable(mbr->getData(),mbr->getSize()); + parseSymbolTable(mbr->getData(), mbr->getSize()); FirstFile = At + mbr->getSize(); if ((intptr_t(At) & 1) == 1) FirstFile++; @@ -358,7 +370,7 @@ // Open the archive and load just the symbol tables Archive* Archive::OpenAndLoadSymbols(const sys::Path& file) { - Archive* result = new Archive(file,true); + Archive* result = new Archive(file, true); result->loadSymbolTable(); @@ -399,7 +411,7 @@ (const unsigned char*) mbr->getData(), mbr->getSize(), FullMemberName, 0); - modules.insert(std::make_pair(fileOffset,std::make_pair(mp,mbr))); + modules.insert(std::make_pair(fileOffset, std::make_pair(mp, mbr))); return mp; } @@ -441,11 +453,11 @@ // Insert the module's symbols into the symbol table for (std::vector::iterator I = symbols.begin(), E=symbols.end(); I != E; ++I ) { - symTab.insert(std::make_pair(*I,offset)); + symTab.insert(std::make_pair(*I, offset)); } // Insert the ModuleProvider and the ArchiveMember into the table of // modules. - modules.insert(std::make_pair(offset,std::make_pair(MP,mbr))); + modules.insert(std::make_pair(offset, std::make_pair(MP, mbr))); } else { throw std::string("Can't parse bytecode member: ") + mbr->getPath().get(); Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.8 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.9 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.8 Fri Nov 19 11:08:00 2004 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Sat Nov 20 01:29:40 2004 @@ -105,8 +105,10 @@ bool writeLongName = false; if (mbr.isStringTable()) { memcpy(hdr.name,ARFILE_STRTAB_NAME,16); - } else if (mbr.isForeignSymbolTable()) { - memcpy(hdr.name,ARFILE_SYMTAB_NAME,16); + } else if (mbr.isSVR4SymbolTable()) { + memcpy(hdr.name,ARFILE_SVR4_SYMTAB_NAME,16); + } else if (mbr.isBSD4SymbolTable()) { + memcpy(hdr.name,ARFILE_BSD4_SYMTAB_NAME,16); } else if (mbr.isLLVMSymbolTable()) { memcpy(hdr.name,ARFILE_LLVM_SYMTAB_NAME,16); } else if (TruncateNames) { @@ -240,10 +242,11 @@ // Determine if we actually should compress this member bool willCompress = (ShouldCompress && - !member.isForeignSymbolTable() && - !member.isLLVMSymbolTable() && !member.isCompressed() && - !member.isCompressedBytecode()); + !member.isCompressedBytecode() && + !member.isLLVMSymbolTable() && + !member.isSVR4SymbolTable() && + !member.isBSD4SymbolTable()); // Perform the compression. Note that if the file is uncompressed bytecode // then we turn the file into compressed bytecode rather than treating it as @@ -418,7 +421,11 @@ // Write the file magic number FinalFile << ARFILE_MAGIC; - // If there is a foreign symbol table, put it into the file now. + // If there is a foreign symbol table, put it into the file now. Most + // ar(1) implementations require the symbol table to be first but llvm-ar + // can deal with it being after a foreign symbol table. This ensures + // compatibility with other ar(1) implementations as well as allowing the + // archive to store both native .o and LLVM .bc files, both indexed. if (foreignST) { writeMember(*foreignST, FinalFile, false, false, false); } From reid at x10sys.com Sat Nov 20 01:30:02 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 01:30:02 -0600 Subject: [llvm-commits] CVS: llvm/test/Feature/float.ll Message-ID: <200411200730.BAA06311@zion.cs.uiuc.edu> Changes in directory llvm/test/Feature: float.ll added (r1.1) --- Log message: Test floating point constants --- Diffs of the changes: (+6 -0) Index: llvm/test/Feature/float.ll diff -c /dev/null llvm/test/Feature/float.ll:1.1 *** /dev/null Sat Nov 20 01:30:01 2004 --- llvm/test/Feature/float.ll Sat Nov 20 01:29:51 2004 *************** *** 0 **** --- 1,6 ---- + ; RUN: llvm-as %s -o - | llvm-dis > Output/t1.ll + ; RUN: llvm-as Output/t1.ll -o - | llvm-dis > Output/t2.ll + ; RUN: diff Output/t1.ll Output/t2.ll + + %F1 = global float 0x4010000000000000 + %D1 = global double 0x4010000000000000 From reid at x10sys.com Sat Nov 20 12:10:35 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 12:10:35 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200411201810.MAA02589@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.19 -> 1.20 --- Log message: The Archive class now has differentiation for BSD4.4 and SVR4 style archive symbol tables. Adjust our usage to compensate. --- Diffs of the changes: (+2 -6) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.19 llvm/tools/llvm-ar/llvm-ar.cpp:1.20 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.19 Tue Nov 16 00:41:09 2004 +++ llvm/tools/llvm-ar/llvm-ar.cpp Sat Nov 20 12:01:22 2004 @@ -339,8 +339,8 @@ const char* data = reinterpret_cast(I->getData()); // Skip things that don't make sense to print - if (I->isLLVMSymbolTable() || I->isForeignSymbolTable() || - (!DontSkipBytecode && + if (I->isLLVMSymbolTable() || I->isSVR4SymbolTable() || + I->isBSD4SymbolTable() || (!DontSkipBytecode && (I->isBytecode() || I->isCompressedBytecode()))) continue; @@ -396,10 +396,6 @@ std::cout << "b"; else if (I->isCompressedBytecode()) std::cout << "B"; - else if (I->isForeignSymbolTable()) - std::cout << "s"; - else if (I->isLLVMSymbolTable()) - std::cout << "S"; else if (I->isCompressed()) std::cout << "Z"; else From reid at x10sys.com Sat Nov 20 13:58:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 13:58:30 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/Optimize.cpp Message-ID: <200411201958.NAA32404@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: Optimize.cpp added (r1.1) --- Log message: First cut at implementing generic link-time Optimization --- Diffs of the changes: (+194 -0) Index: llvm/tools/llvm-ld/Optimize.cpp diff -c /dev/null llvm/tools/llvm-ld/Optimize.cpp:1.1 *** /dev/null Sat Nov 20 13:49:39 2004 --- llvm/tools/llvm-ld/Optimize.cpp Sat Nov 20 13:43:28 2004 *************** *** 0 **** --- 1,194 ---- + //===- Optimize.cpp - Optimize a complete program -------------------------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements all optimization of the linked module for llvm-ld. + // + //===----------------------------------------------------------------------===// + + #include "llvm/Module.h" + #include "llvm/PassManager.h" + #include "llvm/Analysis/LoadValueNumbering.h" + #include "llvm/Analysis/Passes.h" + #include "llvm/Analysis/Verifier.h" + #include "llvm/Support/CommandLine.h" + #include "llvm/System/DynamicLibrary.h" + #include "llvm/Target/TargetData.h" + #include "llvm/Transforms/IPO.h" + #include "llvm/Transforms/Scalar.h" + using namespace llvm; + + // Optimization Options + + enum OptimizationLevels { + OPT_FAST_COMPILE = 1, + OPT_SIMPLE = 2, + OPT_AGGRESSIVE = 3, + OPT_LINK_TIME = 4, + OPT_AGGRESSIVE_LINK_TIME = 5 + }; + + static cl::opt OptLevel( + cl::desc("Choose level of optimization to apply:"), + cl::init(OPT_FAST_COMPILE), cl::values( + clEnumValN(OPT_FAST_COMPILE,"O0", + "An alias for the -O1 option."), + clEnumValN(OPT_FAST_COMPILE,"O1", + "Optimize for linking speed, not execution speed."), + clEnumValN(OPT_SIMPLE,"O2", + "Perform only required/minimal optimizations"), + clEnumValN(OPT_AGGRESSIVE,"O3", + "An alias for the -O2 option."), + clEnumValN(OPT_LINK_TIME,"O4", + "Perform standard link time optimizations"), + clEnumValN(OPT_AGGRESSIVE_LINK_TIME,"O5", + "Perform aggressive link time optimizations"), + clEnumValEnd + ) + ); + + static cl::opt DisableInline("disable-inlining", + cl::desc("Do not run the inliner pass")); + + static cl::opt + DisableOptimizations("disable-opt", + cl::desc("Do not run any optimization passes")); + + static cl::opt DisableInternalize("disable-internalize", + cl::desc("Do not mark all symbols as internal")); + + static cl::opt Verify("verify", + cl::desc("Verify intermediate results of all passes")); + + static cl::opt Strip("s", + cl::desc("Strip symbol info from executable")); + + static cl::alias ExportDynamic("export-dynamic", + cl::aliasopt(DisableInternalize), + cl::desc("Alias for -disable-internalize")); + + static cl::list LoadableModules("load", + cl::value_desc("path to loadable optimization module"), + cl::desc("Load an optimization module and run it")); + + // A utility function that adds a pass to the pass manager but will also add + // a verifier pass after if we're supposed to verify. + static inline void addPass(PassManager &PM, Pass *P) { + // Add the pass to the pass manager... + PM.add(P); + + // If we are verifying all of the intermediate steps, add the verifier... + if (Verify) + PM.add(createVerifierPass()); + } + + namespace llvm { + + /// Optimize - Perform link time optimizations. This will run the scalar + /// optimizations, any loaded plugin-optimization modules, and then the + /// inter-procedural optimizations if applicable. + void Optimize(Module* M) { + + // Instantiate the pass manager to organize the passes. + PassManager Passes; + + // If we're verifying, start off with a verification pass. + if (Verify) + Passes.add(createVerifierPass()); + + // Add an appropriate TargetData instance for this module... + addPass(Passes, new TargetData("gccld", M)); + + // Often if the programmer does not specify proper prototypes for the + // functions they are calling, they end up calling a vararg version of the + // function that does not get a body filled in (the real function has typed + // arguments). This pass merges the two functions. + addPass(Passes, createFunctionResolvingPass()); + + if (!DisableOptimizations) { + if (!DisableInternalize) { + // Now that composite has been compiled, scan through the module, looking + // for a main function. If main is defined, mark all other functions + // internal. + addPass(Passes, createInternalizePass()); + } + + // Now that we internalized some globals, see if we can hack on them! + addPass(Passes, createGlobalOptimizerPass()); + + // Linking modules together can lead to duplicated global constants, only + // keep one copy of each constant... + addPass(Passes, createConstantMergePass()); + + // If the -s command line option was specified, strip the symbols out of the + // resulting program to make it smaller. -s is a GCC option that we are + // supporting. + if (Strip) + addPass(Passes, createSymbolStrippingPass()); + + // Propagate constants at call sites into the functions they call. + addPass(Passes, createIPConstantPropagationPass()); + + // Remove unused arguments from functions... + addPass(Passes, createDeadArgEliminationPass()); + + if (!DisableInline) + addPass(Passes, createFunctionInliningPass()); // Inline small functions + + addPass(Passes, createPruneEHPass()); // Remove dead EH info + addPass(Passes, createGlobalDCEPass()); // Remove dead functions + + // If we didn't decide to inline a function, check to see if we can + // transform it to pass arguments by value instead of by reference. + addPass(Passes, createArgumentPromotionPass()); + + // The IPO passes may leave cruft around. Clean up after them. + addPass(Passes, createInstructionCombiningPass()); + + addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas + + // Run a few AA driven optimizations here and now, to cleanup the code. + addPass(Passes, createGlobalsModRefPass()); // IP alias analysis + + addPass(Passes, createLICMPass()); // Hoist loop invariants + addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs + addPass(Passes, createGCSEPass()); // Remove common subexprs + addPass(Passes, createDeadStoreEliminationPass()); // Nuke dead stores + + // Cleanup and simplify the code after the scalar optimizations. + addPass(Passes, createInstructionCombiningPass()); + + // Delete basic blocks, which optimization passes may have killed... + addPass(Passes, createCFGSimplificationPass()); + + // Now that we have optimized the program, discard unreachable functions... + addPass(Passes, createGlobalDCEPass()); + } + + std::vector plugins = LoadableModules; + for (std::vector::iterator I = plugins.begin(), + E = plugins.end(); I != E; ++I) { + sys::DynamicLibrary dll(I->c_str()); + typedef void (*OptimizeFunc)(PassManager&,int); + OptimizeFunc OF = OptimizeFunc( + dll.GetAddressOfSymbol("RunOptimizations")); + if (OF == 0) { + throw std::string("Optimization Module '") + *I + + "' is missing the RunOptimizations symbol"; + } + (*OF)(Passes,OptLevel); + } + + // Make sure everything is still good. + Passes.add(createVerifierPass()); + + // Run our queue of passes all at once now, efficiently. + Passes.run(*M); + } + + } From reid at x10sys.com Sat Nov 20 14:12:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 14:12:07 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp Message-ID: <200411202012.OAA09367@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: llvm-ld.cpp updated: 1.4 -> 1.5 --- Log message: Incorporate GenerateCode.cpp. Make static things static. --- Diffs of the changes: (+295 -108) Index: llvm/tools/llvm-ld/llvm-ld.cpp diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.4 llvm/tools/llvm-ld/llvm-ld.cpp:1.5 --- llvm/tools/llvm-ld/llvm-ld.cpp:1.4 Sun Nov 14 17:00:08 2004 +++ llvm/tools/llvm-ld/llvm-ld.cpp Sat Nov 20 14:02:56 2004 @@ -20,109 +20,77 @@ // //===----------------------------------------------------------------------===// -#include "llvm-ld.h" #include "llvm/Linker.h" #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bytecode/Reader.h" -#include "llvm/Bytecode/WriteBytecodePass.h" +#include "llvm/Bytecode/Writer.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachineRegistry.h" -#include "llvm/Transforms/IPO.h" -#include "llvm/Transforms/Scalar.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" -#include "llvm/System/Signals.h" #include "llvm/Support/SystemUtils.h" +#include "llvm/System/Signals.h" #include +#include #include + using namespace llvm; -enum OptimizationLevels { - OPT_FAST_COMPILE, - OPT_SIMPLE, - OPT_AGGRESSIVE, - OPT_LINK_TIME, - OPT_AGGRESSIVE_LINK_TIME -}; - -namespace { - cl::list - InputFilenames(cl::Positional, cl::desc(""), - cl::OneOrMore); - - cl::opt - OutputFilename("o", cl::desc("Override output filename"), cl::init("a.out"), - cl::value_desc("filename")); +// Input/Output Options +static cl::list InputFilenames(cl::Positional, cl::OneOrMore, + cl::desc("")); + +static cl::opt OutputFilename("o", cl::init("a.out"), + cl::desc("Override output filename"), + cl::value_desc("filename")); - cl::opt - Verbose("v", cl::desc("Print information about actions taken")); +static cl::opt Verbose("v", + cl::desc("Print information about actions taken")); - cl::list - LibPaths("L", cl::desc("Specify a library search path"), cl::Prefix, - cl::value_desc("directory")); - - cl::list - Libraries("l", cl::desc("Specify libraries to link to"), cl::Prefix, - cl::value_desc("library prefix")); - - cl::opt - Strip("s", cl::desc("Strip symbol info from executable")); - - cl::opt - NoInternalize("disable-internalize", - cl::desc("Do not mark all symbols as internal")); - cl::alias - ExportDynamic("export-dynamic", cl::desc("Alias for -disable-internalize"), - cl::aliasopt(NoInternalize)); - - cl::opt - LinkAsLibrary("link-as-library", cl::desc("Link the .bc files together as a" - " library, not an executable")); - cl::alias - Relink("r", cl::desc("Alias for -link-as-library"), - cl::aliasopt(LinkAsLibrary)); +static cl::list LibPaths("L", cl::Prefix, + cl::desc("Specify a library search path"), + cl::value_desc("directory")); + +static cl::list Libraries("l", cl::Prefix, + cl::desc("Specify libraries to link to"), + cl::value_desc("library prefix")); + +static cl::opt LinkAsLibrary("link-as-library", + cl::desc("Link the .bc files together as a library, not an executable")); - cl::opt +static cl::alias Relink("r", cl::aliasopt(LinkAsLibrary), + cl::desc("Alias for -link-as-library")); + +static cl::opt MachineArch("march", cl::desc("Architecture to generate assembly for:")); - cl::opt - Native("native", - cl::desc("Generate a native binary instead of a shell script")); - cl::opt - NativeCBE("native-cbe", - cl::desc("Generate a native binary with the C backend and GCC")); +static cl::opt Native("native", + cl::desc("Generate a native binary instead of a shell script")); + +static cl::optNativeCBE("native-cbe", + cl::desc("Generate a native binary with the C backend and GCC")); + +static cl::optDisableCompression("disable-compression",cl::init(false), + cl::desc("Disable writing of compressed bytecode files")); - // Compatibility options that are ignored but supported by LD - cl::opt - CO3("soname", cl::Hidden, cl::desc("Compatibility option: ignored")); - cl::opt - CO4("version-script", cl::Hidden, cl::desc("Compatibility option: ignored")); - cl::opt - CO5("eh-frame-hdr", cl::Hidden, cl::desc("Compatibility option: ignored")); - cl::opt - CO6("h", cl::Hidden, cl::desc("Compatibility option: ignored")); - - cl::opt OptLevel( - cl::desc("Choose level of optimization to apply:"), - cl::init(OPT_FAST_COMPILE), cl::values( - clEnumValN(OPT_FAST_COMPILE,"O0", - "An alias for the -O1 option."), - clEnumValN(OPT_FAST_COMPILE,"O1", - "Optimize for linking speed, not execution speed."), - clEnumValN(OPT_SIMPLE,"O2", - "Perform only required/minimal optimizations"), - clEnumValN(OPT_AGGRESSIVE,"O3", - "An alias for the -O2 option."), - clEnumValN(OPT_LINK_TIME,"O4", - "Perform standard link time optimizations"), - clEnumValN(OPT_AGGRESSIVE_LINK_TIME,"O5", - "Perform aggressive link time optimizations"), - clEnumValEnd - ) - ); -} +// Compatibility options that are ignored but supported by LD +static cl::opt CO3("soname", cl::Hidden, + cl::desc("Compatibility option: ignored")); + +static cl::opt CO4("version-script", cl::Hidden, + cl::desc("Compatibility option: ignored")); + +static cl::opt CO5("eh-frame-hdr", cl::Hidden, + cl::desc("Compatibility option: ignored")); + +static cl::opt CO6("h", cl::Hidden, + cl::desc("Compatibility option: ignored")); + +/// This is just for convenience so it doesn't have to be passed around +/// everywhere. +static const char* progname = 0; /// PrintAndReturn - Prints a message to standard error and returns true. /// @@ -130,11 +98,235 @@ /// progname - The name of the program (i.e. argv[0]). /// Message - The message to print to standard error. /// -static int PrintAndReturn(const char *progname, const std::string &Message) { +static int PrintAndReturn(const std::string &Message) { std::cerr << progname << ": " << Message << "\n"; return 1; } +/// CopyEnv - This function takes an array of environment variables and makes a +/// copy of it. This copy can then be manipulated any way the caller likes +/// without affecting the process's real environment. +/// +/// Inputs: +/// envp - An array of C strings containing an environment. +/// +/// Return value: +/// NULL - An error occurred. +/// +/// Otherwise, a pointer to a new array of C strings is returned. Every string +/// in the array is a duplicate of the one in the original array (i.e. we do +/// not copy the char *'s from one array to another). +/// +static char ** CopyEnv(char ** const envp) { + // Count the number of entries in the old list; + unsigned entries; // The number of entries in the old environment list + for (entries = 0; envp[entries] != NULL; entries++) + /*empty*/; + + // Add one more entry for the NULL pointer that ends the list. + ++entries; + + // If there are no entries at all, just return NULL. + if (entries == 0) + return NULL; + + // Allocate a new environment list. + char **newenv = new char* [entries]; + if ((newenv = new char* [entries]) == NULL) + return NULL; + + // Make a copy of the list. Don't forget the NULL that ends the list. + entries = 0; + while (envp[entries] != NULL) { + newenv[entries] = new char[strlen (envp[entries]) + 1]; + strcpy (newenv[entries], envp[entries]); + ++entries; + } + newenv[entries] = NULL; + + return newenv; +} + + +/// RemoveEnv - Remove the specified environment variable from the environment +/// array. +/// +/// Inputs: +/// name - The name of the variable to remove. It cannot be NULL. +/// envp - The array of environment variables. It cannot be NULL. +/// +/// Notes: +/// This is mainly done because functions to remove items from the environment +/// are not available across all platforms. In particular, Solaris does not +/// seem to have an unsetenv() function or a setenv() function (or they are +/// undocumented if they do exist). +/// +static void RemoveEnv(const char * name, char ** const envp) { + for (unsigned index=0; envp[index] != NULL; index++) { + // Find the first equals sign in the array and make it an EOS character. + char *p = strchr (envp[index], '='); + if (p == NULL) + continue; + else + *p = '\0'; + + // Compare the two strings. If they are equal, zap this string. + // Otherwise, restore it. + if (!strcmp(name, envp[index])) + *envp[index] = '\0'; + else + *p = '='; + } + + return; +} + +/// GenerateBytecode - generates a bytecode file from the module provided +void GenerateBytecode(Module* M, const std::string& FileName) { + + // Create the output file. + std::ofstream Out(FileName.c_str()); + if (!Out.good()) { + PrintAndReturn("error opening '" + FileName + "' for writing!"); + return; + } + + // Ensure that the bytecode file gets removed from the disk if we get a + // terminating signal. + sys::RemoveFileOnSignal(sys::Path(FileName)); + + // Write it out + WriteBytecodeToFile(M, Out, !DisableCompression); + + // Close the bytecode file. + Out.close(); +} + +/// GenerateAssembly - generates a native assembly language source file from the +/// specified bytecode file. +/// +/// Inputs: +/// InputFilename - The name of the output bytecode file. +/// OutputFilename - The name of the file to generate. +/// llc - The pathname to use for LLC. +/// envp - The environment to use when running LLC. +/// +/// Return non-zero value on error. +/// +static int GenerateAssembly(const std::string &OutputFilename, + const std::string &InputFilename, + const std::string &llc, + char ** const envp) { + // Run LLC to convert the bytecode file into assembly code. + const char *cmd[6]; + cmd[0] = llc.c_str(); + cmd[1] = "-f"; + cmd[2] = "-o"; + cmd[3] = OutputFilename.c_str(); + cmd[4] = InputFilename.c_str(); + cmd[5] = 0; + + return ExecWait(cmd, envp); +} + +/// GenerateAssembly - generates a native assembly language source file from the +/// specified bytecode file. +static int GenerateCFile(const std::string &OutputFile, + const std::string &InputFile, + const std::string &llc, char ** const envp) { + // Run LLC to convert the bytecode file into C. + const char *cmd[7]; + + cmd[0] = llc.c_str(); + cmd[1] = "-march=c"; + cmd[2] = "-f"; + cmd[3] = "-o"; + cmd[4] = OutputFile.c_str(); + cmd[5] = InputFile.c_str(); + cmd[6] = 0; + return ExecWait(cmd, envp); +} + +/// GenerateNative - generates a native assembly language source file from the +/// specified assembly source file. +/// +/// Inputs: +/// InputFilename - The name of the output bytecode file. +/// OutputFilename - The name of the file to generate. +/// Libraries - The list of libraries with which to link. +/// LibPaths - The list of directories in which to find libraries. +/// gcc - The pathname to use for GGC. +/// envp - A copy of the process's current environment. +/// +/// Outputs: +/// None. +/// +/// Returns non-zero value on error. +/// +static int GenerateNative(const std::string &OutputFilename, + const std::string &InputFilename, + const std::vector &Libraries, + const std::vector &LibPaths, + const std::string &gcc, char ** const envp) { + // Remove these environment variables from the environment of the + // programs that we will execute. It appears that GCC sets these + // environment variables so that the programs it uses can configure + // themselves identically. + // + // However, when we invoke GCC below, we want it to use its normal + // configuration. Hence, we must sanitize its environment. + char ** clean_env = CopyEnv(envp); + if (clean_env == NULL) + return 1; + RemoveEnv("LIBRARY_PATH", clean_env); + RemoveEnv("COLLECT_GCC_OPTIONS", clean_env); + RemoveEnv("GCC_EXEC_PREFIX", clean_env); + RemoveEnv("COMPILER_PATH", clean_env); + RemoveEnv("COLLECT_GCC", clean_env); + + std::vector cmd; + + // Run GCC to assemble and link the program into native code. + // + // Note: + // We can't just assemble and link the file with the system assembler + // and linker because we don't know where to put the _start symbol. + // GCC mysteriously knows how to do it. + cmd.push_back(gcc.c_str()); + cmd.push_back("-fno-strict-aliasing"); + cmd.push_back("-O3"); + cmd.push_back("-o"); + cmd.push_back(OutputFilename.c_str()); + cmd.push_back(InputFilename.c_str()); + + // Adding the library paths creates a problem for native generation. If we + // include the search paths from llvmgcc, then we'll be telling normal gcc + // to look inside of llvmgcc's library directories for libraries. This is + // bad because those libraries hold only bytecode files (not native object + // files). In the end, we attempt to link the bytecode libgcc into a native + // program. +#if 0 + // Add in the library path options. + for (unsigned index=0; index < LibPaths.size(); index++) { + cmd.push_back("-L"); + cmd.push_back(LibPaths[index].c_str()); + } +#endif + + // Add in the libraries to link. + std::vector Libs(Libraries); + for (unsigned index = 0; index < Libs.size(); index++) { + if (Libs[index] != "crtend") { + Libs[index] = "-l" + Libs[index]; + cmd.push_back(Libs[index].c_str()); + } + } + cmd.push_back(NULL); + + // Run the compiler to assembly and link together the program. + return ExecWait(&(cmd[0]), clean_env); +} + /// EmitShellScript - Output the wrapper file that invokes the JIT on the LLVM /// bytecode file for the program. static void EmitShellScript(char **argv) { @@ -157,8 +349,7 @@ // Output the script to start the program... std::ofstream Out2(OutputFilename.c_str()); if (!Out2.good()) - exit(PrintAndReturn(argv[0], "error opening '" + OutputFilename + - "' for writing!")); + exit(PrintAndReturn("error opening '" + OutputFilename + "' for writing!")); Out2 << "#!/bin/sh\n"; // Allow user to setenv LLVMINTERP if lli is not in their PATH. @@ -185,7 +376,16 @@ Out2.close(); } +// Rightly this should go in a header file but it just seems such a waste. +namespace llvm { +extern void Optimize(Module*); +} + int main(int argc, char **argv, char **envp) { + // Initial global variable above for convenience printing of program name. + progname = argv[0]; + + // Parse the command line options cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n"); sys::PrintStackTraceOnErrorSignal(); @@ -213,26 +413,13 @@ LinkLibraries(argv[0], Composite.get(), Libraries, LibPaths, Verbose, Native); - // Create the output file. + // Optimize the module + Optimize(Composite.get()); + + // Generate the bytecode for the optimized module. std::string RealBytecodeOutput = OutputFilename; if (!LinkAsLibrary) RealBytecodeOutput += ".bc"; - std::ofstream Out(RealBytecodeOutput.c_str()); - if (!Out.good()) - return PrintAndReturn(argv[0], "error opening '" + RealBytecodeOutput + - "' for writing!"); - - // Ensure that the bytecode file gets removed from the disk if we get a - // terminating signal. - sys::RemoveFileOnSignal(sys::Path(RealBytecodeOutput)); - - // Generate the bytecode file. - if (GenerateBytecode(Composite.get(), Strip, !NoInternalize, &Out)) { - Out.close(); - return PrintAndReturn(argv[0], "error generating bytecode"); - } - - // Close the bytecode file. - Out.close(); + GenerateBytecode(Composite.get(), RealBytecodeOutput); // If we are not linking a library, generate either a native executable // or a JIT shell script, depending upon what the user wants. @@ -253,10 +440,10 @@ std::string llc = FindExecutable("llc", argv[0]); std::string gcc = FindExecutable("gcc", argv[0]); if (llc.empty()) - return PrintAndReturn(argv[0], "Failed to find llc"); + return PrintAndReturn("Failed to find llc"); if (gcc.empty()) - return PrintAndReturn(argv[0], "Failed to find gcc"); + return PrintAndReturn("Failed to find gcc"); // Generate an assembly language file for the bytecode. if (Verbose) std::cout << "Generating Assembly Code\n"; @@ -278,9 +465,9 @@ std::string llc = FindExecutable("llc", argv[0]); std::string gcc = FindExecutable("gcc", argv[0]); if (llc.empty()) - return PrintAndReturn(argv[0], "Failed to find llc"); + return PrintAndReturn("Failed to find llc"); if (gcc.empty()) - return PrintAndReturn(argv[0], "Failed to find gcc"); + return PrintAndReturn("Failed to find gcc"); // Generate an assembly language file for the bytecode. if (Verbose) std::cout << "Generating Assembly Code\n"; From llvm at cs.uiuc.edu Sat Nov 20 14:24:19 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Sat, 20 Nov 2004 14:24:19 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/GenerateCode.cpp Message-ID: <200411202024.OAA11208@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: GenerateCode.cpp (r1.3) removed --- Log message: Content moved to llvm-ld.cpp --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Sat Nov 20 14:36:31 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Sat, 20 Nov 2004 14:36:31 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.h Message-ID: <200411202036.OAA11757@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: llvm-ld.h (r1.2) removed --- Log message: Not needed any more. --- Diffs of the changes: (+0 -0) From reid at x10sys.com Sat Nov 20 14:57:34 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 14:57:34 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp llvmc.cpp Message-ID: <200411202057.OAA13567@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: CompilerDriver.cpp updated: 1.17 -> 1.18 llvmc.cpp updated: 1.18 -> 1.19 --- Log message: Get the -o option right --- Diffs of the changes: (+44 -22) Index: llvm/tools/llvmc/CompilerDriver.cpp diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.17 llvm/tools/llvmc/CompilerDriver.cpp:1.18 --- llvm/tools/llvmc/CompilerDriver.cpp:1.17 Fri Nov 5 16:15:36 2004 +++ llvm/tools/llvmc/CompilerDriver.cpp Sat Nov 20 14:39:33 2004 @@ -552,7 +552,8 @@ SetVector LinkageItems; std::vector LibFiles; InputList::const_iterator I = InpList.begin(); - while ( I != InpList.end() ) { + for (InputList::const_iterator I = InpList.begin(), E = InpList.end(); + I != E; ++I ) { // Get the suffix of the file name const std::string& ftype = I->second; @@ -570,7 +571,7 @@ LibFiles.push_back(I->first.get()); else LinkageItems.insert(I->first); - ++I; continue; // short circuit remainder of loop + continue; // short circuit remainder of loop } // At this point, we know its something we need to translate @@ -594,8 +595,12 @@ if (!action.program.isEmpty()) { if (action.isSet(REQUIRED_FLAG) || finalPhase == PREPROCESSING) { if (finalPhase == PREPROCESSING) { - OutFile.appendSuffix("E"); - actions.push_back(GetAction(cd,InFile,OutFile,PREPROCESSING)); + if (Output.isEmpty()) { + OutFile.appendSuffix("E"); + actions.push_back(GetAction(cd,InFile,OutFile,PREPROCESSING)); + } else { + actions.push_back(GetAction(cd,InFile,Output,PREPROCESSING)); + } } else { sys::Path TempFile(MakeTempFile(I->first.getBasename(),"E")); actions.push_back(GetAction(cd,InFile,TempFile, @@ -612,7 +617,7 @@ // Short-circuit remaining actions if all they want is // pre-processing - if (finalPhase == PREPROCESSING) { ++I; continue; }; + if (finalPhase == PREPROCESSING) { continue; }; /// TRANSLATION PHASE action = cd->Translator; @@ -621,8 +626,12 @@ if (!action.program.isEmpty()) { if (action.isSet(REQUIRED_FLAG) || finalPhase == TRANSLATION) { if (finalPhase == TRANSLATION) { - OutFile.appendSuffix("o"); - actions.push_back(GetAction(cd,InFile,OutFile,TRANSLATION)); + if (Output.isEmpty()) { + OutFile.appendSuffix("o"); + actions.push_back(GetAction(cd,InFile,OutFile,TRANSLATION)); + } else { + actions.push_back(GetAction(cd,InFile,Output,TRANSLATION)); + } } else { sys::Path TempFile(MakeTempFile(I->first.getBasename(),"trans")); actions.push_back(GetAction(cd,InFile,TempFile,TRANSLATION)); @@ -650,7 +659,7 @@ } // Short-circuit remaining actions if all they want is translation - if (finalPhase == TRANSLATION) { ++I; continue; } + if (finalPhase == TRANSLATION) { continue; } /// OPTIMIZATION PHASE action = cd->Optimizer; @@ -660,8 +669,12 @@ if (!action.program.isEmpty()) { if (action.isSet(REQUIRED_FLAG) || finalPhase == OPTIMIZATION) { if (finalPhase == OPTIMIZATION) { - OutFile.appendSuffix("o"); - actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION)); + if (Output.isEmpty()) { + OutFile.appendSuffix("o"); + actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION)); + } else { + actions.push_back(GetAction(cd,InFile,Output,OPTIMIZATION)); + } } else { sys::Path TempFile(MakeTempFile(I->first.getBasename(),"opt")); actions.push_back(GetAction(cd,InFile,TempFile,OPTIMIZATION)); @@ -690,43 +703,52 @@ } // Short-circuit remaining actions if all they want is optimization - if (finalPhase == OPTIMIZATION) { ++I; continue; } + if (finalPhase == OPTIMIZATION) { continue; } /// ASSEMBLY PHASE action = cd->Assembler; if (finalPhase == ASSEMBLY) { + + // Build either a native compilation action or a disassembly action + Action* action = new Action(); if (isSet(EMIT_NATIVE_FLAG)) { // Use llc to get the native assembly file - Action* action = new Action(); action->program.setFile("llc"); action->args.push_back(InFile.get()); action->args.push_back("-f"); action->args.push_back("-o"); - OutFile.appendSuffix("s"); - action->args.push_back(OutFile.get()); + if (Output.isEmpty()) { + OutFile.appendSuffix("o"); + action->args.push_back(OutFile.get()); + } else { + action->args.push_back(Output.get()); + } + actions.push_back(action); } else { // Just convert back to llvm assembly with llvm-dis - Action* action = new Action(); action->program.setFile("llvm-dis"); action->args.push_back(InFile.get()); action->args.push_back("-f"); action->args.push_back("-o"); - OutFile.appendSuffix("ll"); - action->args.push_back(OutFile.get()); - actions.push_back(action); + if (Output.isEmpty()) { + OutFile.appendSuffix("ll"); + action->args.push_back(OutFile.get()); + } else { + action->args.push_back(Output.get()); + } } + // Put the action on the list + actions.push_back(action); + // Short circuit the rest of the loop, we don't want to link - ++I; continue; } // Register the result of the actions as a link candidate LinkageItems.insert(InFile); - // Go to next file to be processed - ++I; } // end while loop over each input file /// RUN THE COMPILATION ACTIONS Index: llvm/tools/llvmc/llvmc.cpp diff -u llvm/tools/llvmc/llvmc.cpp:1.18 llvm/tools/llvmc/llvmc.cpp:1.19 --- llvm/tools/llvmc/llvmc.cpp:1.18 Fri Nov 5 16:15:36 2004 +++ llvm/tools/llvmc/llvmc.cpp Sat Nov 20 14:45:33 2004 @@ -121,7 +121,7 @@ cl::list LibPaths("L", cl::Prefix, cl::desc("Specify a library search path"), cl::value_desc("directory")); - + cl::list Libraries("l", cl::Prefix, cl::desc("Specify libraries to link to"), cl::value_desc("library prefix")); From reid at x10sys.com Sat Nov 20 15:15:46 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 15:15:46 -0600 Subject: [llvm-commits] CVS: llvm/projects/Stacker/test/Makefile Message-ID: <200411202115.PAA15526@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/test: Makefile updated: 1.7 -> 1.8 --- Log message: Use llvmc to compile test cases --- Diffs of the changes: (+12 -19) Index: llvm/projects/Stacker/test/Makefile diff -u llvm/projects/Stacker/test/Makefile:1.7 llvm/projects/Stacker/test/Makefile:1.8 --- llvm/projects/Stacker/test/Makefile:1.7 Sat Oct 30 04:25:27 2004 +++ llvm/projects/Stacker/test/Makefile Sat Nov 20 15:03:34 2004 @@ -31,37 +31,30 @@ TESTS = $(LOGIC_TESTS) $(ARITHMETIC_TESTS) $(BITWISE_TESTS) $(STACK_TESTS) \ $(MEMORY_TESTS) $(CONTROL_TESTS) $(IO_TESTS) -STKRC_EXEC = $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)/stkrc +LLVMC = $(LLVMToolDir)/llvmc all :: test_each test_each: $(TESTS) $(Echo) "Running Tests..." - $(Verb) LD_LIBRARY_PATH=$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) $(BUILD_SRC_DIR)/runtests $(BUILD_OBJ_DIR) $(TESTS) + $(Verb) LD_LIBRARY_PATH=$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) \ + $(BUILD_SRC_DIR)/runtests $(BUILD_OBJ_DIR) $(TESTS) -%.bc : %.st Makefile - $(Echo) "Compiling And Optimizing $< to $*.bc" - $(Verb)$(STKRC_EXEC) -f -O4 -s 2048 -o $*.bc $(BUILD_SRC_DIR)/$*.st - -%.s : %.bc testing.bc - $(Echo) "Assembling $< to $*.s" - $(Verb)$(LLINK) $*.bc testing.bc -o $*.bcl - $(Verb)$(LLC) -f -o $*.s $*.bcl - -% : %.s - $(Echo) "Linking $*" - $(Verb)$(CC) -ggdb -L$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) -lstkr_runtime -o $* $*.s - -%.ll : %.bc - $(Echo) "Disassembling $< to $*.ll" - $(Verb)$(LDIS) -dis -o $*.ll $< +% : %.st Makefile testing.bc + $(Echo) "Building $*" + $(Verb)$(LLVMC) -O4 -o $@ $< testing.bc -lstkr_runtime -lcrtend + +testing.bc : testing.st Makefile + $(Echo) "Compiling $*" + $(Verb)$(LLVMC) -O3 -c -o $@ $< TESTS_LL = $(TESTS:%=%.ll) TESTS_BC = $(TESTS:%=%.bc) TESTS_S = $(TESTS:%=%.s) clean :: - $(Verb)rm -f gmon.out $(TESTS_LL) $(TESTS_BC) $(TESTS_S) $(TESTS) testing.bc testing.s testing.ll + $(Verb)rm -f gmon.out $(TESTS_LL) $(TESTS_BC) $(TESTS_S) $(TESTS) \ + testing.bc testing.s testing.ll .SUFFIXES: .st .s .ll .bc .PRECIOUS: %.s %.ll %.bc %.st From tbrethou at cs.uiuc.edu Sat Nov 20 17:35:30 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Sat, 20 Nov 2004 17:35:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200411202335.RAA29462@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.55 -> 1.56 --- Log message: Fixed assertion from triggering. We need to check if the commandline map is empty before checking if an arg exists. --- Diffs of the changes: (+2 -0) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.55 llvm/lib/Support/CommandLine.cpp:1.56 --- llvm/lib/Support/CommandLine.cpp:1.55 Fri Nov 19 11:08:15 2004 +++ llvm/lib/Support/CommandLine.cpp Sat Nov 20 17:35:20 2004 @@ -80,6 +80,8 @@ // options have already been processed and the map has been deleted! // static void RemoveArgument(const char *ArgName, Option *Opt) { + if(getOpts().empty()) return; + #ifndef NDEBUG // This disgusting HACK is brought to you courtesy of GCC 3.3.2, which ICE's // If we pass ArgName directly into getOption here. From tbrethou at cs.uiuc.edu Sat Nov 20 17:36:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Sat, 20 Nov 2004 17:36:34 -0600 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvmdb.py Message-ID: <200411202336.RAA29496@zion.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvmdb.py updated: 1.14 -> 1.15 --- Log message: Added Archive to the list of directories qmtest should ignore. --- Diffs of the changes: (+1 -1) Index: llvm/test/QMTest/llvmdb.py diff -u llvm/test/QMTest/llvmdb.py:1.14 llvm/test/QMTest/llvmdb.py:1.15 --- llvm/test/QMTest/llvmdb.py:1.14 Sat Nov 6 15:02:29 2004 +++ llvm/test/QMTest/llvmdb.py Sat Nov 20 17:36:24 2004 @@ -164,7 +164,7 @@ # # Record names of invalid directories and files. # - invalid_dirs = ['lib', 'Output', 'CVS', 'QMTest', 'QMTestDB', 'Scripts', 'Programs','Fragments', 'Reoptimizer', 'Debugger', 'tmp'] + invalid_dirs = ['lib', 'Output', 'CVS', 'QMTest', 'QMTestDB', 'Scripts', 'Programs','Fragments', 'Reoptimizer', 'Debugger', 'tmp', 'Archive'] invalid_files = ['Makefile', 'README.txt', '.cvsignore', 'opaquetypes.ll', 'constexpr.ll.bc-13','dg.exp','site.exp' ] From lattner at cs.uiuc.edu Sat Nov 20 17:41:09 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:41:09 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineRelocation.h Message-ID: <200411202341.iAKNf9E0008442@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineRelocation.h updated: 1.2 -> 1.3 --- Log message: Add missing #include --- Diffs of the changes: (+1 -0) Index: llvm/include/llvm/CodeGen/MachineRelocation.h diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.2 llvm/include/llvm/CodeGen/MachineRelocation.h:1.3 --- llvm/include/llvm/CodeGen/MachineRelocation.h:1.2 Fri Nov 19 21:43:50 2004 +++ llvm/include/llvm/CodeGen/MachineRelocation.h Sat Nov 20 17:40:54 2004 @@ -15,6 +15,7 @@ #define LLVM_CODEGEN_MACHINERELOCATION_H #include "llvm/Support/DataTypes.h" +#include namespace llvm { class GlobalValue; From tbrethou at cs.uiuc.edu Sat Nov 20 17:47:34 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Sat, 20 Nov 2004 17:47:34 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/ranlib_GNU.ll ranlib_SVR4.ll ranlib_xpg4.ll Message-ID: <200411202347.RAA29628@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: ranlib_GNU.ll updated: 1.1 -> 1.2 ranlib_SVR4.ll updated: 1.1 -> 1.2 ranlib_xpg4.ll updated: 1.1 -> 1.2 --- Log message: Removing unnecessary copies. Use %p to reference them. --- Diffs of the changes: (+6 -9) Index: llvm/test/Regression/Archive/ranlib_GNU.ll diff -u llvm/test/Regression/Archive/ranlib_GNU.ll:1.1 llvm/test/Regression/Archive/ranlib_GNU.ll:1.2 --- llvm/test/Regression/Archive/ranlib_GNU.ll:1.1 Sat Nov 20 01:25:41 2004 +++ llvm/test/Regression/Archive/ranlib_GNU.ll Sat Nov 20 17:47:23 2004 @@ -1,9 +1,8 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;GNU style archives -;RUN: cp %p/GNU.a . -;RUN: llvm-ranlib GNU.a -;RUN: llvm-ar t GNU.a > %t1 +;RUN: llvm-ranlib %p/GNU.a +;RUN: llvm-ar t %p/GNU.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen Index: llvm/test/Regression/Archive/ranlib_SVR4.ll diff -u llvm/test/Regression/Archive/ranlib_SVR4.ll:1.1 llvm/test/Regression/Archive/ranlib_SVR4.ll:1.2 --- llvm/test/Regression/Archive/ranlib_SVR4.ll:1.1 Sat Nov 20 01:25:41 2004 +++ llvm/test/Regression/Archive/ranlib_SVR4.ll Sat Nov 20 17:47:23 2004 @@ -1,9 +1,8 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;SVR4 style archives -;RUN: cp %p/SVR4.a . -;RUN: llvm-ranlib SVR4.a -;RUN: llvm-ar t SVR4.a > %t1 +;RUN: llvm-ranlib %p/SVR4.a +;RUN: llvm-ar t %p/SVR4.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen Index: llvm/test/Regression/Archive/ranlib_xpg4.ll diff -u llvm/test/Regression/Archive/ranlib_xpg4.ll:1.1 llvm/test/Regression/Archive/ranlib_xpg4.ll:1.2 --- llvm/test/Regression/Archive/ranlib_xpg4.ll:1.1 Sat Nov 20 01:25:41 2004 +++ llvm/test/Regression/Archive/ranlib_xpg4.ll Sat Nov 20 17:47:23 2004 @@ -1,9 +1,8 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;xpg4 style archives -;RUN: cp %p/xpg4.a . -;RUN: llvm-ranlib xpg4.a -;RUN: llvm-ar t xpg4.a > %t1 +;RUN: llvm-ranlib %p/xpg4.a +;RUN: llvm-ar t %p/xpg4.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen From reid at x10sys.com Sat Nov 20 17:48:57 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 17:48:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/DynamicLibrary.cpp Message-ID: <200411202348.RAA29639@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: DynamicLibrary.cpp updated: 1.1 -> 1.2 --- Log message: Cast the void* handle data member to HMODULE* to keep the VC++ compiler happy. Thanks to Henrik Bach for pointing this out. --- Diffs of the changes: (+9 -5) Index: llvm/lib/System/Win32/DynamicLibrary.cpp diff -u llvm/lib/System/Win32/DynamicLibrary.cpp:1.1 llvm/lib/System/Win32/DynamicLibrary.cpp:1.2 --- llvm/lib/System/Win32/DynamicLibrary.cpp:1.1 Wed Nov 17 22:33:40 2004 +++ llvm/lib/System/Win32/DynamicLibrary.cpp Sat Nov 20 17:30:55 2004 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "Win32.h" +#include namespace llvm { using namespace sys; @@ -22,9 +23,10 @@ //===----------------------------------------------------------------------===// DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) { - handle = LoadLibrary(filename); + handle = new HMODULE; + *((HMODULE*)handle) = LoadLibrary(filename); - if (handle == 0) { + if (*((HMODULE*)handle) == 0) { char Buffer[100]; // FIXME: This should use FormatMessage sprintf(Buffer, "Windows error code %d\n", GetLastError()); @@ -33,13 +35,15 @@ } DynamicLibrary::~DynamicLibrary() { - if (handle) - FreeLibrary(handle); + assert(handle !=0 && "Invalid DynamicLibrary handle"); + if (*((HMODULE*)handle)) + FreeLibrary(*((HMODULE*)handle)); + delete (HMODULE*)handle; } void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { assert(handle !=0 && "Invalid DynamicLibrary handle"); - return GetProcAddress(handle, symbolName); + return (void*) GetProcAddress(*((HMODULE*)handle), symbolName); } } From lattner at cs.uiuc.edu Sat Nov 20 17:50:16 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:50:16 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetJITInfo.h Message-ID: <200411202350.iAKNoGxC010824@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetJITInfo.h updated: 1.3 -> 1.4 --- Log message: Add new methods that a target should implement --- Diffs of the changes: (+27 -8) Index: llvm/include/llvm/Target/TargetJITInfo.h diff -u llvm/include/llvm/Target/TargetJITInfo.h:1.3 llvm/include/llvm/Target/TargetJITInfo.h:1.4 --- llvm/include/llvm/Target/TargetJITInfo.h:1.3 Fri Nov 19 21:43:27 2004 +++ llvm/include/llvm/Target/TargetJITInfo.h Sat Nov 20 17:50:02 2004 @@ -41,15 +41,34 @@ /// overwriting OLD with a branch to NEW. This is used for self-modifying /// code. /// - virtual void replaceMachineCodeForFunction (void *Old, void *New) = 0; + virtual void replaceMachineCodeForFunction(void *Old, void *New) = 0; - /// getJITStubForFunction - Create or return a stub for the specified - /// function. This stub acts just like the specified function, except that - /// it allows the "address" of the function to be taken without having to - /// generate code for it. Targets do not need to implement this method, but - /// doing so will allow for faster startup of the JIT. - /// - virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE) { + /// emitFunctionStub - Use the specified MachineCodeEmitter object to emit a + /// small native function that simply calls the function at the specified + /// address. Return the address of the resultant function. + virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) { + assert(0 && "This target doesn't implement emitFunctionStub!"); + } + + /// LazyResolverFn - This typedef is used to represent the function that + /// unresolved call points should invoke. This is a target specific + /// function that knows how to walk the stack and find out which stub the + /// call is coming from. + typedef void (*LazyResolverFn)(); + + /// JITCompilerFn - This typedef is used to represent the JIT function that + /// lazily compiles the function corresponding to a stub. The JIT keeps + /// track of the mapping between stubs and LLVM Functions, the target + /// provides the ability to figure out the address of a stub that is called + /// by the LazyResolverFn. + typedef void* (*JITCompilerFn)(void *); + + /// getLazyResolverFunction - This method is used to initialize the JIT, + /// giving the target the function that should be used to compile a + /// function, and giving the JIT the target function used to do the lazy + /// resolving. + virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn) { + assert(0 && "Not implemented for this target!"); return 0; } From lattner at cs.uiuc.edu Sat Nov 20 17:51:15 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:51:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200411202351.iAKNpFYN010845@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.47 -> 1.48 --- Log message: This method does not exist any longer. --- Diffs of the changes: (+0 -4) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.47 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.48 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.47 Mon Nov 15 17:18:09 2004 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Sat Nov 20 17:51:03 2004 @@ -274,10 +274,6 @@ if (void *Addr = getPointerToGlobalIfAvailable(F)) return Addr; - // If the target supports "stubs" for functions, get a stub now. - if (void *Ptr = TJI.getJITStubForFunction(F, *MCE)) - return Ptr; - // Otherwise, if the target doesn't support it, just codegen the function. return getPointerToFunction(F); } From tbrethou at cs.uiuc.edu Sat Nov 20 17:51:49 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Sat, 20 Nov 2004 17:51:49 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/GC/dg.exp Message-ID: <200411202351.RAA29792@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic/GC: dg.exp added (r1.1) --- Log message: Adding missing dg file. --- Diffs of the changes: (+3 -0) Index: llvm/test/Regression/CodeGen/Generic/GC/dg.exp diff -c /dev/null llvm/test/Regression/CodeGen/Generic/GC/dg.exp:1.1 *** /dev/null Sat Nov 20 17:51:48 2004 --- llvm/test/Regression/CodeGen/Generic/GC/dg.exp Sat Nov 20 17:51:38 2004 *************** *** 0 **** --- 1,3 ---- + load_lib llvm-dg.exp + + llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext From lattner at cs.uiuc.edu Sat Nov 20 17:52:58 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:52:58 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeEmitter.h Message-ID: <200411202352.iAKNqwlW010864@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeEmitter.h updated: 1.22 -> 1.23 --- Log message: Change this interface a bit --- Diffs of the changes: (+2 -2) Index: llvm/include/llvm/CodeGen/MachineCodeEmitter.h diff -u llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.22 llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.23 --- llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.22 Fri Nov 19 21:44:24 2004 +++ llvm/include/llvm/CodeGen/MachineCodeEmitter.h Sat Nov 20 17:52:43 2004 @@ -52,12 +52,12 @@ /// specifies the total size required by the stub. Stubs are not allowed to /// have constant pools, the can only use the other emit* methods. /// - virtual void startFunctionStub(const Function &F, unsigned StubSize) {} + virtual void startFunctionStub(unsigned StubSize) {} /// finishFunctionStub - This callback is invoked to terminate a function /// stub. /// - virtual void *finishFunctionStub(const Function &F) { return 0; } + virtual void *finishFunctionStub(const Function *F) { return 0; } /// emitByte - This callback is invoked when a byte needs to be written to the /// output stream. From lattner at cs.uiuc.edu Sat Nov 20 17:53:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:53:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineCodeEmitter.cpp Message-ID: <200411202353.iAKNr4Es010874@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineCodeEmitter.cpp updated: 1.19 -> 1.20 --- Log message: Adjust to changed interfaces --- Diffs of the changes: (+7 -7) Index: llvm/lib/CodeGen/MachineCodeEmitter.cpp diff -u llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.19 llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.20 --- llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.19 Fri Nov 19 21:44:39 2004 +++ llvm/lib/CodeGen/MachineCodeEmitter.cpp Sat Nov 20 17:52:52 2004 @@ -28,11 +28,11 @@ void finishFunction(MachineFunction &F) { std::cout << "\n"; } - void startFunctionStub(const Function &F, unsigned StubSize) { - std::cout << "\n--- Function stub for function: " << F.getName() << "\n"; + void startFunctionStub(unsigned StubSize) { + std::cout << "\n--- Function stub:\n"; } - void *finishFunctionStub(const Function &F) { - std::cout << "\n"; + void *finishFunctionStub(const Function *F) { + std::cout << "\n--- End of stub for Function\n"; return 0; } @@ -105,11 +105,11 @@ MCE.emitConstantPool(MCP); } - void startFunctionStub(const Function &F, unsigned StubSize) { - MCE.startFunctionStub(F, StubSize); + void startFunctionStub(unsigned StubSize) { + MCE.startFunctionStub(StubSize); } - void *finishFunctionStub(const Function &F) { + void *finishFunctionStub(const Function *F) { return MCE.finishFunctionStub(F); } From lattner at cs.uiuc.edu Sat Nov 20 17:53:39 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:53:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp Message-ID: <200411202353.iAKNrdMW010890@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9CodeEmitter.cpp updated: 1.73 -> 1.74 --- Log message: Adjust to changed interfaces --- Diffs of the changes: (+2 -2) Index: llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp diff -u llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp:1.73 llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp:1.74 --- llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp:1.73 Sat Oct 9 16:13:51 2004 +++ llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp Sat Nov 20 17:53:26 2004 @@ -420,7 +420,7 @@ /// directly. /// uint64_t JITResolver::emitStubForFunction(Function *F) { - MCE.startFunctionStub(*F, 44); + MCE.startFunctionStub(44); DEBUG(std::cerr << "Emitting stub at addr: 0x" << std::hex << MCE.getCurrentPCValue() << "\n"); @@ -461,7 +461,7 @@ } SparcV9.emitWord(0xDEADBEEF); // marker so that we know it's really a stub - return (intptr_t)MCE.finishFunctionStub(*F)+4; /* 1 instr past the restore */ + return (intptr_t)MCE.finishFunctionStub(F)+4; /* 1 instr past the restore */ } SparcV9CodeEmitter::SparcV9CodeEmitter(TargetMachine &tm, From lattner at cs.uiuc.edu Sat Nov 20 17:54:08 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:54:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86JITInfo.h Message-ID: <200411202354.iAKNs830010905@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86JITInfo.h updated: 1.3 -> 1.4 --- Log message: We implement these interfaces --- Diffs of the changes: (+13 -5) Index: llvm/lib/Target/X86/X86JITInfo.h diff -u llvm/lib/Target/X86/X86JITInfo.h:1.3 llvm/lib/Target/X86/X86JITInfo.h:1.4 --- llvm/lib/Target/X86/X86JITInfo.h:1.3 Sun Dec 28 15:23:38 2003 +++ llvm/lib/Target/X86/X86JITInfo.h Sat Nov 20 17:53:56 2004 @@ -38,11 +38,19 @@ /// virtual void replaceMachineCodeForFunction(void *Old, void *New); - /// getJITStubForFunction - Create or return a stub for the specified - /// function. This stub acts just like the specified function, except that - /// it allows the "address" of the function to be taken without having to - /// generate code for it. - virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE); + /// emitFunctionStub - Use the specified MachineCodeEmitter object to emit a + /// small native function that simply calls the function at the specified + /// address. + virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE); + + /// getLazyResolverFunction - Expose the lazy resolver to the JIT. + virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); + + /// relocate - Before the JIT can run a block of code that has been emitted, + /// it must rewrite the code to contain the actual addresses of any + /// referenced global symbols. + virtual void relocate(void *Function, MachineRelocation *MR, + unsigned NumRelocs); }; } From lattner at cs.uiuc.edu Sat Nov 20 17:54:45 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:54:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86JITInfo.cpp Message-ID: <200411202354.iAKNsjL3010927@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86JITInfo.cpp added (r1.1) --- Log message: Implement the X86 JIT interfaces --- Diffs of the changes: (+140 -0) Index: llvm/lib/Target/X86/X86JITInfo.cpp diff -c /dev/null llvm/lib/Target/X86/X86JITInfo.cpp:1.1 *** /dev/null Sat Nov 20 17:54:43 2004 --- llvm/lib/Target/X86/X86JITInfo.cpp Sat Nov 20 17:54:33 2004 *************** *** 0 **** --- 1,140 ---- + //===-- X86JITInfo.cpp - Implement the JIT interfaces for the X86 target --===// + // + // 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 JIT interfaces for the X86 target. + // + //===----------------------------------------------------------------------===// + + #define DEBUG_TYPE "jit" + #include "X86JITInfo.h" + #include "X86Relocations.h" + #include "llvm/CodeGen/MachineCodeEmitter.h" + #include "llvm/Config/alloca.h" + using namespace llvm; + + void *X86JITInfo::emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) { + MCE.startFunctionStub(6); + MCE.emitByte(0xE8); // Call with 32 bit pc-rel destination... + + MCE.emitWord((intptr_t)Fn-MCE.getCurrentPCValue()-4); + + MCE.emitByte(0xCD); // Interrupt - Just a marker identifying the stub! + return MCE.finishFunctionStub(0); + } + + void X86JITInfo::replaceMachineCodeForFunction(void *Old, void *New) { + unsigned char *OldByte = (unsigned char *)Old; + *OldByte++ = 0xE9; // Emit JMP opcode. + unsigned *OldWord = (unsigned *)OldByte; + unsigned NewAddr = (intptr_t)New; + unsigned OldAddr = (intptr_t)OldWord; + *OldWord = NewAddr - OldAddr - 4; // Emit PC-relative addr of New code. + } + + + #ifdef _MSC_VER + #pragma optimize("y", off) + #endif + + /// JITCompilerFunction - This contains the address of the JIT function used to + /// compile a function lazily. + static TargetJITInfo::JITCompilerFn JITCompilerFunction; + + /// CompilationCallback - This is the target-specific function invoked by the + /// function stub when we did not know the real target of a call. This function + /// must locate the start of the stub or call site and pass it into the JIT + /// compiler function. + static void CompilationCallback() { + #ifdef _MSC_VER + unsigned *StackPtr, RetAddr; + __asm mov StackPtr, ebp; + __asm mov eax, DWORD PTR [ebp + 4]; + __asm mov RetAddr, eax; + #else + unsigned *StackPtr = (unsigned*)__builtin_frame_address(0); + unsigned RetAddr = (unsigned)(intptr_t)__builtin_return_address(0); + + // NOTE: __builtin_frame_address doesn't work if frame pointer elimination has + // been performed. Having a variable sized alloca disables frame pointer + // elimination currently, even if it's dead. This is a gross hack. + alloca(10+(RetAddr >> 31)); + + #endif + assert(StackPtr[1] == RetAddr && + "Could not find return address on the stack!"); + + // It's a stub if there is an interrupt marker after the call. + bool isStub = ((unsigned char*)(intptr_t)RetAddr)[0] == 0xCD; + + // The call instruction should have pushed the return value onto the stack... + RetAddr -= 4; // Backtrack to the reference itself... + + #if 0 + DEBUG(std::cerr << "In callback! Addr=" << (void*)RetAddr + << " ESP=" << (void*)StackPtr + << ": Resolving call to function: " + << TheVM->getFunctionReferencedName((void*)RetAddr) << "\n"); + #endif + + // Sanity check to make sure this really is a call instruction. + assert(((unsigned char*)(intptr_t)RetAddr)[-1] == 0xE8 &&"Not a call instr!"); + + unsigned NewVal = (intptr_t)JITCompilerFunction((void*)(intptr_t)RetAddr); + + // Rewrite the call target... so that we don't end up here every time we + // execute the call. + *(unsigned*)(intptr_t)RetAddr = NewVal-RetAddr-4; + + if (isStub) { + // If this is a stub, rewrite the call into an unconditional branch + // instruction so that two return addresses are not pushed onto the stack + // when the requested function finally gets called. This also makes the + // 0xCD byte (interrupt) dead, so the marker doesn't effect anything. + ((unsigned char*)(intptr_t)RetAddr)[-1] = 0xE9; + } + + // Change the return address to reexecute the call instruction... + StackPtr[1] -= 5; + } + + #ifdef _MSC_VER + #pragma optimize( "", on ) + #endif + + TargetJITInfo::LazyResolverFn + X86JITInfo::getLazyResolverFunction(JITCompilerFn F) { + JITCompilerFunction = F; + return CompilationCallback; + } + + + /// relocate - Before the JIT can run a block of code that has been emitted, + /// it must rewrite the code to contain the actual addresses of any + /// referenced global symbols. + void X86JITInfo::relocate(void *Function, MachineRelocation *MR, + unsigned NumRelocs) { + for (unsigned i = 0; i != NumRelocs; ++i, ++MR) { + void *RelocPos = (char*)Function + MR->getMachineCodeOffset(); + intptr_t ResultPtr = (intptr_t)MR->getResultPointer(); + switch ((X86::RelocationType)MR->getRelocationType()) { + case X86::reloc_pcrel_word: + // PC relative relocation, add the relocated value to the value already in + // memory, after we adjust it for where the PC is. + ResultPtr = ResultPtr-(intptr_t)RelocPos-4; + *((intptr_t*)RelocPos) += ResultPtr; + break; + case X86::reloc_absolute_word: + // Absolute relocation, just add the relocated value to the value already + // in memory. + *((intptr_t*)RelocPos) += ResultPtr; + break; + } + } + } + From lattner at cs.uiuc.edu Sat Nov 20 17:55:29 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:55:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200411202355.iAKNtT4h010944@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.76 -> 1.77 --- Log message: Remove all JIT specific code and switch the code generator over to emitting relocations for global references. --- Diffs of the changes: (+26 -194) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.76 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.77 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.76 Fri Nov 19 14:57:07 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Sat Nov 20 17:55:15 2004 @@ -8,12 +8,12 @@ //===----------------------------------------------------------------------===// // // This file contains the pass that transforms the X86 machine instructions into -// actual executable machine code. +// relocatable machine code. // //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "jit" #include "X86TargetMachine.h" +#include "X86Relocations.h" #include "X86.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/MachineCodeEmitter.h" @@ -21,170 +21,14 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Function.h" -#include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Config/alloca.h" using namespace llvm; namespace { Statistic<> NumEmitted("x86-emitter", "Number of machine instructions emitted"); - - class JITResolver { - MachineCodeEmitter &MCE; - - // LazyCodeGenMap - Keep track of call sites for functions that are to be - // lazily resolved. - std::map LazyCodeGenMap; - - // LazyResolverMap - Keep track of the lazy resolver created for a - // particular function so that we can reuse them if necessary. - std::map LazyResolverMap; - public: - JITResolver(MachineCodeEmitter &mce) : MCE(mce) {} - unsigned getLazyResolver(Function *F); - unsigned addFunctionReference(unsigned Address, Function *F); - - private: - unsigned emitStubForFunction(Function *F); - static void CompilationCallback(); - unsigned resolveFunctionReference(unsigned RetAddr); - }; - - static JITResolver &getResolver(MachineCodeEmitter &MCE) { - static JITResolver *TheJITResolver = 0; - if (TheJITResolver == 0) - TheJITResolver = new JITResolver(MCE); - return *TheJITResolver; - } -} - - -void *X86JITInfo::getJITStubForFunction(Function *F, MachineCodeEmitter &MCE) { - return (void*)(intptr_t)getResolver(MCE).getLazyResolver(F); -} - -void X86JITInfo::replaceMachineCodeForFunction (void *Old, void *New) { - unsigned char *OldByte = (unsigned char *) Old; - *OldByte++ = 0xE9; // Emit JMP opcode. - int32_t *OldWord = (int32_t *) OldByte; - int32_t NewAddr = (intptr_t) New; - int32_t OldAddr = (intptr_t) OldWord; - *OldWord = NewAddr - OldAddr - 4; // Emit PC-relative addr of New code. -} - -/// addFunctionReference - This method is called when we need to emit the -/// address of a function that has not yet been emitted, so we don't know the -/// address. Instead, we emit a call to the CompilationCallback method, and -/// keep track of where we are. -/// -unsigned JITResolver::addFunctionReference(unsigned Address, Function *F) { - DEBUG(std::cerr << "Emitting lazily resolved reference to function '" - << F->getName() << "' at address " << std::hex << Address - << std::dec << "\n"); - LazyCodeGenMap[Address] = F; - return (intptr_t)&JITResolver::CompilationCallback; -} - -unsigned JITResolver::resolveFunctionReference(unsigned RetAddr) { - std::map::iterator I = LazyCodeGenMap.find(RetAddr); - assert(I != LazyCodeGenMap.end() && "Not in map!"); - Function *F = I->second; - LazyCodeGenMap.erase(I); - return MCE.forceCompilationOf(F); -} - -unsigned JITResolver::getLazyResolver(Function *F) { - std::map::iterator I = LazyResolverMap.lower_bound(F); - if (I != LazyResolverMap.end() && I->first == F) return I->second; - -//std::cerr << "Getting lazy resolver for : " << ((Value*)F)->getName() << "\n"; - - unsigned Stub = emitStubForFunction(F); - LazyResolverMap.insert(I, std::make_pair(F, Stub)); - return Stub; -} - -#ifdef _MSC_VER -#pragma optimize("y", off) -#endif - -void JITResolver::CompilationCallback() { -#ifdef _MSC_VER - unsigned *StackPtr, RetAddr; - __asm mov StackPtr, ebp; - __asm mov eax, DWORD PTR [ebp + 4]; - __asm mov RetAddr, eax; -#else - unsigned *StackPtr = (unsigned*)__builtin_frame_address(0); - unsigned RetAddr = (unsigned)(intptr_t)__builtin_return_address(0); - - // FIXME: __builtin_frame_address doesn't work if frame pointer elimination - // has been performed. Having a variable sized alloca disables frame pointer - // elimination currently, even if it's dead. This is a gross hack. - alloca(10+(RetAddr >> 31)); - -#endif - assert(StackPtr[1] == RetAddr && - "Could not find return address on the stack!"); - - // It's a stub if there is an interrupt marker after the call... - bool isStub = ((unsigned char*)(intptr_t)RetAddr)[0] == 0xCD; - - // The call instruction should have pushed the return value onto the stack... - RetAddr -= 4; // Backtrack to the reference itself... - -#if 0 - DEBUG(std::cerr << "In callback! Addr=0x" << std::hex << RetAddr - << " ESP=0x" << (unsigned)StackPtr << std::dec - << ": Resolving call to function: " - << TheVM->getFunctionReferencedName((void*)RetAddr) << "\n"); -#endif - - // Sanity check to make sure this really is a call instruction... - assert(((unsigned char*)(intptr_t)RetAddr)[-1] == 0xE8 &&"Not a call instr!"); - - JITResolver &JR = getResolver(*(MachineCodeEmitter*)0); - unsigned NewVal = JR.resolveFunctionReference(RetAddr); - - // Rewrite the call target... so that we don't fault every time we execute - // the call. - *(unsigned*)(intptr_t)RetAddr = NewVal-RetAddr-4; - - if (isStub) { - // If this is a stub, rewrite the call into an unconditional branch - // instruction so that two return addresses are not pushed onto the stack - // when the requested function finally gets called. This also makes the - // 0xCD byte (interrupt) dead, so the marker doesn't effect anything. - ((unsigned char*)(intptr_t)RetAddr)[-1] = 0xE9; - } - - // Change the return address to reexecute the call instruction... - StackPtr[1] -= 5; -} - -#ifdef _MSC_VER -#pragma optimize( "", on ) -#endif - -/// emitStubForFunction - This method is used by the JIT when it needs to emit -/// the address of a function for a function whose code has not yet been -/// generated. In order to do this, it generates a stub which jumps to the lazy -/// function compiler, which will eventually get fixed to call the function -/// directly. -/// -unsigned JITResolver::emitStubForFunction(Function *F) { - MCE.startFunctionStub(*F, 6); - MCE.emitByte(0xE8); // Call with 32 bit pc-rel destination... - - unsigned Address = addFunctionReference(MCE.getCurrentPCValue(), F); - MCE.emitWord(Address-MCE.getCurrentPCValue()-4); - - MCE.emitByte(0xCD); // Interrupt - Just a marker identifying the stub! - return (intptr_t)MCE.finishFunctionStub(*F); } - namespace { class Emitter : public MachineFunctionPass { const X86InstrInfo *II; @@ -211,6 +55,7 @@ void emitPCRelativeValue(unsigned Address); void emitGlobalAddressForCall(GlobalValue *GV); void emitGlobalAddressForPtr(GlobalValue *GV, int Disp = 0); + void emitExternalSymbolAddress(const char *ES, bool isPCRelative); void emitRegModRMByte(unsigned ModRMReg, unsigned RegOpcodeField); void emitSIBByte(unsigned SS, unsigned Index, unsigned Base); @@ -265,6 +110,12 @@ emitInstruction(*I); } +/// emitPCRelativeValue - Emit a 32-bit PC relative address. +/// +void Emitter::emitPCRelativeValue(unsigned Address) { + MCE.emitWord(Address-MCE.getCurrentPCValue()-4); +} + /// emitPCRelativeBlockAddress - This method emits the PC relative address of /// the specified basic block, or if the basic block hasn't been emitted yet /// (because this is a forward branch), it keeps track of the information @@ -276,8 +127,7 @@ std::map::iterator I = BasicBlockAddrs.find(MBB); if (I != BasicBlockAddrs.end()) { - unsigned Location = I->second; - MCE.emitWord(Location-MCE.getCurrentPCValue()-4); + emitPCRelativeValue(I->second); } else { // Otherwise, remember where this reference was and where it is to so we can // deal with it later. @@ -286,25 +136,13 @@ } } -/// emitPCRelativeValue - Emit a 32-bit PC relative address. -/// -void Emitter::emitPCRelativeValue(unsigned Address) { - MCE.emitWord(Address-MCE.getCurrentPCValue()-4); -} - /// emitGlobalAddressForCall - Emit the specified address to the code stream /// assuming this is part of a function call, which is PC relative. /// void Emitter::emitGlobalAddressForCall(GlobalValue *GV) { - // Get the address from the backend... - unsigned Address = MCE.getGlobalValueAddress(GV); - - if (Address == 0) { - // FIXME: this is JIT specific! - Address = getResolver(MCE).addFunctionReference(MCE.getCurrentPCValue(), - cast(GV)); - } - emitPCRelativeValue(Address); + MCE.addRelocation(MachineRelocation(MCE.getCurrentPCOffset(), + X86::reloc_pcrel_word, GV)); + MCE.emitWord(0); } /// emitGlobalAddress - Emit the specified address to the code stream assuming @@ -312,21 +150,19 @@ /// PC relative. /// void Emitter::emitGlobalAddressForPtr(GlobalValue *GV, int Disp /* = 0 */) { - // Get the address from the backend... - unsigned Address = MCE.getGlobalValueAddress(GV); - - // If the machine code emitter doesn't know what the address IS yet, we have - // to take special measures. - // - if (Address == 0) { - // FIXME: this is JIT specific! - Address = getResolver(MCE).getLazyResolver((Function*)GV); - } - - MCE.emitWord(Address + Disp); + MCE.addRelocation(MachineRelocation(MCE.getCurrentPCOffset(), + X86::reloc_absolute_word, GV)); + MCE.emitWord(Disp); // The relocated value will be added to the displacement } - +/// emitExternalSymbolAddress - Arrange for the address of an external symbol to +/// be emitted to the current location in the function, and allow it to be PC +/// relative. +void Emitter::emitExternalSymbolAddress(const char *ES, bool isPCRelative) { + MCE.addRelocation(MachineRelocation(MCE.getCurrentPCOffset(), + isPCRelative ? X86::reloc_pcrel_word : X86::reloc_absolute_word, ES)); + MCE.emitWord(0); +} /// N86 namespace - Native X86 Register numbers... used by X86 backend. /// @@ -560,9 +396,7 @@ assert(MO.isPCRelative() && "Call target is not PC Relative?"); emitGlobalAddressForCall(MO.getGlobal()); } else if (MO.isExternalSymbol()) { - unsigned Address = MCE.getGlobalValueAddress(MO.getSymbolName()); - assert(Address && "Unknown external symbol!"); - emitPCRelativeValue(Address); + emitExternalSymbolAddress(MO.getSymbolName(), true); } else if (MO.isImmediate()) { emitConstant(MO.getImmedValue(), sizeOfImm(Desc)); } else { @@ -587,9 +421,7 @@ } else if (MO1.isExternalSymbol()) { assert(sizeOfImm(Desc) == 4 && "Don't know how to emit non-pointer values!"); - unsigned Address = MCE.getGlobalValueAddress(MO1.getSymbolName()); - assert(Address && "Unknown external symbol!"); - MCE.emitWord(Address); + emitExternalSymbolAddress(MO1.getSymbolName(), false); } else { emitConstant(MO1.getImmedValue(), sizeOfImm(Desc)); } From lattner at cs.uiuc.edu Sat Nov 20 17:55:32 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:55:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Relocations.h Message-ID: <200411202355.iAKNtWeP010950@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Relocations.h added (r1.1) --- Log message: Describe the X86 target-specific relocations. --- Diffs of the changes: (+33 -0) Index: llvm/lib/Target/X86/X86Relocations.h diff -c /dev/null llvm/lib/Target/X86/X86Relocations.h:1.1 *** /dev/null Sat Nov 20 17:55:29 2004 --- llvm/lib/Target/X86/X86Relocations.h Sat Nov 20 17:54:19 2004 *************** *** 0 **** --- 1,33 ---- + //===- X86Relocations.h - X86 Code Relocations ------------------*- 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 X86 target-specific relocation types. + // + //===----------------------------------------------------------------------===// + + #ifndef X86RELOCATIONS_H + #define X86RELOCATIONS_H + + #include "llvm/CodeGen/MachineRelocation.h" + + namespace llvm { + namespace X86 { + enum RelocationType { + // reloc_pcrel_word - PC relative relocation, add the relocated value to + // the value already in memory, after we adjust it for where the PC is. + reloc_pcrel_word = 0, + + // reloc_absolute_word - Absolute relocation, just add the relocated value + // to the value already in memory. + reloc_absolute_word = 1, + }; + } + } + + #endif From lattner at cs.uiuc.edu Sat Nov 20 17:57:19 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:57:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200411202357.iAKNvJtO010968@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.49 -> 1.50 --- Log message: Implement relocation support by adding a target independent resolver interface. --- Diffs of the changes: (+133 -12) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.49 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.50 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.49 Fri Nov 19 21:46:14 2004 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Sat Nov 20 17:57:07 2004 @@ -25,13 +25,18 @@ #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" #include "llvm/System/Memory.h" - using namespace llvm; namespace { Statistic<> NumBytes("jit", "Number of bytes of machine code compiled"); JIT *TheJIT = 0; +} + +//===----------------------------------------------------------------------===// +// JITMemoryManager code. +// +namespace { /// JITMemoryManager - Manage memory for the JIT code generation in a logical, /// sane way. This splits a large block of MAP_NORESERVE'd memory into two /// sections, one for function stubs, one for the functions themselves. We @@ -84,8 +89,100 @@ CurFunctionPtr = FunctionEnd; } +//===----------------------------------------------------------------------===// +// JIT lazy compilation code. +// +namespace { + /// JITResolver - Keep track of, and resolve, call sites for functions that + /// have not yet been compiled. + class JITResolver { + /// The MCE to use to emit stubs with. + MachineCodeEmitter &MCE; + + // FunctionToStubMap - Keep track of the stub created for a particular + // function so that we can reuse them if necessary. + std::map FunctionToStubMap; + + // StubToFunctionMap - Keep track of the function that each stub corresponds + // to. + std::map StubToFunctionMap; + + public: + JITResolver(MachineCodeEmitter &mce) : MCE(mce) {} + + /// getFunctionStub - This returns a pointer to a function stub, creating + /// one on demand as needed. + void *getFunctionStub(Function *F); + + /// JITCompilerFn - This function is called to resolve a stub to a compiled + /// address. If the LLVM Function corresponding to the stub has not yet + /// been compiled, this function compiles it first. + static void *JITCompilerFn(void *Stub); + }; +} +/// getJITResolver - This function returns the one instance of the JIT resolver. +/// +static JITResolver &getJITResolver(MachineCodeEmitter *MCE = 0) { + static JITResolver TheJITResolver(*MCE); + return TheJITResolver; +} + +/// getFunctionStub - This returns a pointer to a function stub, creating +/// one on demand as needed. +void *JITResolver::getFunctionStub(Function *F) { + /// Get the target-specific JIT resolver function. + static TargetJITInfo::LazyResolverFn LazyResolverFn = + TheJIT->getJITInfo().getLazyResolverFunction(JITResolver::JITCompilerFn); + + // If we already have a stub for this function, recycle it. + void *&Stub = FunctionToStubMap[F]; + if (Stub) return Stub; + + // Otherwise, codegen a new stub. For now, the stub will call the lazy + // resolver function. + Stub = TheJIT->getJITInfo().emitFunctionStub((void*)LazyResolverFn, MCE); + + // Finally, keep track of the stub-to-Function mapping so that the + // JITCompilerFn knows which function to compile! + StubToFunctionMap[Stub] = F; + return Stub; +} + +/// JITCompilerFn - This function is called when a lazy compilation stub has +/// been entered. It looks up which function this stub corresponds to, compiles +/// it if necessary, then returns the resultant function pointer. +void *JITResolver::JITCompilerFn(void *Stub) { + JITResolver &JR = getJITResolver(); + + // The address given to us for the stub may not be exactly right, it might be + // a little bit after the stub. As such, use upper_bound to find it. + std::map::iterator I = + JR.StubToFunctionMap.upper_bound(Stub); + assert(I != JR.StubToFunctionMap.begin() && "This is not a known stub!"); + Function *F = (--I)->second; + + // The target function will rewrite the stub so that the compilation callback + // function is no longer called from this stub. + JR.StubToFunctionMap.erase(I); + + DEBUG(std::cerr << "Lazily resolving function '" << F->getName() + << "' In stub ptr = " << Stub << " actual ptr = " + << I->first << "\n"); + + void *Result = TheJIT->getPointerToFunction(F); + + // We don't need to reuse this stub in the future, as F is now compiled. + JR.FunctionToStubMap.erase(F); + // FIXME: We could rewrite all references to this stub if we knew them. + return Result; +} + + +//===----------------------------------------------------------------------===// +// JIT MachineCodeEmitter code. +// namespace { /// Emitter - The JIT implementation of the MachineCodeEmitter, which is used /// to output functions to memory for execution. @@ -113,8 +210,8 @@ virtual void startFunction(MachineFunction &F); virtual void finishFunction(MachineFunction &F); virtual void emitConstantPool(MachineConstantPool *MCP); - virtual void startFunctionStub(const Function &F, unsigned StubSize); - virtual void* finishFunctionStub(const Function &F); + virtual void startFunctionStub(unsigned StubSize); + virtual void* finishFunctionStub(const Function *F); virtual void emitByte(unsigned char B); virtual void emitWord(unsigned W); virtual void emitWordAt(unsigned W, unsigned *Ptr); @@ -135,6 +232,9 @@ // FIXME: This is JIT specific! // virtual uint64_t forceCompilationOf(Function *F); + + private: + void *getPointerToGlobal(GlobalValue *GV); }; } @@ -142,6 +242,29 @@ return new Emitter(jit); } +void *Emitter::getPointerToGlobal(GlobalValue *V) { + if (GlobalVariable *GV = dyn_cast(V)) { + /// FIXME: If we straightened things out, this could actually emit the + /// global immediately instead of queuing it for codegen later! + GlobalVariable *GV = cast(V); + return TheJIT->getOrEmitGlobalVariable(GV); + } + + // If we have already compiled the function, return a pointer to its body. + Function *F = cast(V); + void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F); + if (ResultPtr) return ResultPtr; + + if (F->hasExternalLinkage()) { + // If this is an external function pointer, we can force the JIT to + // 'compile' it, which really just adds it to the map. + return TheJIT->getPointerToFunction(F); + } + + // Otherwise, we have to emit a lazy resolving stub. + return getJITResolver(this).getFunctionStub(F); +} + void Emitter::startFunction(MachineFunction &F) { CurByte = CurBlock = MemMgr.startFunctionBody(); TheJIT->addGlobalMapping(F.getFunction(), CurBlock); @@ -157,11 +280,10 @@ for (unsigned i = 0, e = Relocations.size(); i != e; ++i) { MachineRelocation &MR = Relocations[i]; void *ResultPtr; - if (MR.isGlobalValue()) { - assert(0 && "Unimplemented!\n"); - } else { + if (MR.isString()) ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString()); - } + else + ResultPtr = getPointerToGlobal(MR.getGlobalValue()); MR.setResultPointer(ResultPtr); } @@ -209,16 +331,15 @@ } } -void Emitter::startFunctionStub(const Function &F, unsigned StubSize) { +void Emitter::startFunctionStub(unsigned StubSize) { SavedCurBlock = CurBlock; SavedCurByte = CurByte; CurByte = CurBlock = MemMgr.allocateStub(StubSize); } -void *Emitter::finishFunctionStub(const Function &F) { +void *Emitter::finishFunctionStub(const Function *F) { NumBytes += CurByte-CurBlock; - DEBUG(std::cerr << "Finished CodeGen of [0x" << std::hex - << (uintptr_t)CurBlock - << std::dec << "] Function stub for: " << F.getName() + DEBUG(std::cerr << "Finished CodeGen of [0x" << (void*)CurBlock + << "] Function stub for: " << (F ? F->getName() : "") << ": " << CurByte-CurBlock << " bytes of text\n"); std::swap(CurBlock, SavedCurBlock); CurByte = SavedCurByte; From lattner at cs.uiuc.edu Sat Nov 20 17:58:55 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:58:55 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/.cvsignore Message-ID: <200411202358.iAKNwteI010987@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: .cvsignore added (r1.1) --- Log message: Ignore files --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/Config/.cvsignore diff -c /dev/null llvm/include/llvm/Config/.cvsignore:1.1 *** /dev/null Sat Nov 20 17:58:53 2004 --- llvm/include/llvm/Config/.cvsignore Sat Nov 20 17:58:43 2004 *************** *** 0 **** --- 1,2 ---- + config.h + .cvsignore From lattner at cs.uiuc.edu Sat Nov 20 17:59:31 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 17:59:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/.cvsignore Message-ID: <200411202359.iAKNxV7R011002@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: .cvsignore added (r1.1) --- Log message: ignore generated files --- Diffs of the changes: (+4 -0) Index: llvm/include/llvm/ADT/.cvsignore diff -c /dev/null llvm/include/llvm/ADT/.cvsignore:1.1 *** /dev/null Sat Nov 20 17:59:29 2004 --- llvm/include/llvm/ADT/.cvsignore Sat Nov 20 17:59:19 2004 *************** *** 0 **** --- 1,4 ---- + .cvsignore + hash_map + hash_set + iterator From lattner at cs.uiuc.edu Sat Nov 20 18:00:16 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 18:00:16 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/.cvsignore Message-ID: <200411210000.iAL00GoU011024@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: .cvsignore added (r1.1) --- Log message: Ignore generated files --- Diffs of the changes: (+3 -0) Index: llvm/include/llvm/Support/.cvsignore diff -c /dev/null llvm/include/llvm/Support/.cvsignore:1.1 *** /dev/null Sat Nov 20 18:00:14 2004 --- llvm/include/llvm/Support/.cvsignore Sat Nov 20 18:00:04 2004 *************** *** 0 **** --- 1,3 ---- + .cvsignore + DataTypes.h + ThreadSupport.h From lattner at cs.uiuc.edu Sat Nov 20 18:01:07 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 18:01:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/.cvsignore Message-ID: <200411210001.iAL017KA011044@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: .cvsignore added (r1.1) --- Log message: ignore generated files. --- Diffs of the changes: (+2 -0) Index: llvm/lib/Target/PowerPC/.cvsignore diff -c /dev/null llvm/lib/Target/PowerPC/.cvsignore:1.1 *** /dev/null Sat Nov 20 18:01:04 2004 --- llvm/lib/Target/PowerPC/.cvsignore Sat Nov 20 18:00:54 2004 *************** *** 0 **** --- 1,2 ---- + .cvsignore + *.inc From lattner at cs.uiuc.edu Sat Nov 20 18:01:39 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 18:01:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Skeleton/.cvsignore Message-ID: <200411210001.iAL01dGX011196@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Skeleton: .cvsignore added (r1.1) --- Log message: ignore generated files --- Diffs of the changes: (+2 -0) Index: llvm/lib/Target/Skeleton/.cvsignore diff -c /dev/null llvm/lib/Target/Skeleton/.cvsignore:1.1 *** /dev/null Sat Nov 20 18:01:37 2004 --- llvm/lib/Target/Skeleton/.cvsignore Sat Nov 20 18:01:27 2004 *************** *** 0 **** --- 1,2 ---- + .cvsignore + *.inc From lattner at cs.uiuc.edu Sat Nov 20 18:02:07 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 18:02:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/.cvsignore Message-ID: <200411210002.iAL027pR011211@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: .cvsignore updated: 1.1 -> 1.2 --- Log message: ignore generated files --- Diffs of the changes: (+1 -0) Index: llvm/lib/Target/X86/.cvsignore diff -u llvm/lib/Target/X86/.cvsignore:1.1 llvm/lib/Target/X86/.cvsignore:1.2 --- llvm/lib/Target/X86/.cvsignore:1.1 Sun Aug 3 10:50:17 2003 +++ llvm/lib/Target/X86/.cvsignore Sat Nov 20 18:01:54 2004 @@ -1 +1,2 @@ +.cvsignore *.inc From tbrethou at cs.uiuc.edu Sat Nov 20 18:02:51 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Sat, 20 Nov 2004 18:02:51 -0600 Subject: [llvm-commits] CVS: llvm/utils/NightlyTest.pl NightlyTestTemplate.html Message-ID: <200411210002.SAA30076@zion.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTest.pl updated: 1.69 -> 1.70 NightlyTestTemplate.html updated: 1.32 -> 1.33 --- Log message: Added the ability to run Dejagnu tests. --- Diffs of the changes: (+100 -1) Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.69 llvm/utils/NightlyTest.pl:1.70 --- llvm/utils/NightlyTest.pl:1.69 Sun Nov 7 21:28:27 2004 +++ llvm/utils/NightlyTest.pl Sat Nov 20 18:02:40 2004 @@ -21,6 +21,7 @@ # LARGE_PROBLEM_SIZE enabled. # -noexternals Do not run the external tests (for cases where povray # or SPEC are not installed) +# -rundejagnu Runs features and regressions using Dejagnu # -parallel Run two parallel jobs with GNU Make. # -release Build an LLVM Release version # -pedantic Enable additional GCC warnings to detect possible errors. @@ -50,6 +51,7 @@ # to. This is the same as you would have for a normal LLVM build. # use POSIX qw(strftime); +use File::Copy; my $HOME = $ENV{'HOME'}; my $CVSRootDir = $ENV{'CVSROOT'}; @@ -82,6 +84,7 @@ my $DEBUG = 0; my $CONFIGUREARGS = ""; my $NICE = ""; +my $RUNDEJAGNU = 0; sub ReadFile { if (open (FILE, $_[0])) { @@ -145,6 +148,13 @@ chdir($dir) || die "Cannot change directory to: $name ($dir) "; } +sub CopyFile { #filename, newfile + my ($file, $newfile) = @_; + chomp($file); + if ($VERBOSE) { print "Copying $file to $newfile\n"; } + copy($file, $newfile); +} + sub GetDir { my $Suffix = shift; opendir DH, $WebDir; @@ -248,6 +258,52 @@ return "$content\n"; } +sub GetDejagnuTestResults { # (filename, log) + my ($filename, $DejagnuLog) = @_; + my @lines; + my $firstline; + $/ = "\n"; #Make sure we're going line at a time. + if (open SRCHFILE, $filename) { + # Process test results + push(@lines,"

      UNEXPECTED TEST RESULTS

      1. \n"); + my $first_list = 1; + my $should_break = 1; + my $nocopy = 0; + my $readingsum = 0; + while ( ) { + if ( length($_) > 1 ) { + chomp($_); + if ( m/^XPASS:/ || m/^FAIL:/ ) { + $nocopy = 0; + if ( $first_list ) { + $first_list = 0; + $should_break = 1; + push(@lines,"$_
        \n"); + } else { + push(@lines,"
      2. $_
        \n"); + } + } elsif ( m/Summary/ ) { + if ( $first_list ) { push(@lines,"PERFECT!"); } + push(@lines,"

      STATISTICS

      \n");
      +          $should_break = 0;
      +          $nocopy = 0;
      +          $readingsum = 1;
      +        } elsif ( $readingsum ) {
      +          push(@lines,"$_\n");
      +        }
      +      }
      +    }
      +  }
      +  push(@lines, "
      \n"); + close SRCHFILE; + + #add link to complete testing log + push(@lines, "

      A complete log of testing Feature and Regression is available for further analysis.

      \n"); + + my $content = join("", at lines); + return "$content\n"; +} + ##################################################################### ## MAIN PROGRAM @@ -291,6 +347,7 @@ $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next; } if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } + if(/^-runDejagnu$/) { $RUNDEJAGNU = 1; next; } print "Unknown option: $_ : ignoring!\n"; } @@ -321,6 +378,9 @@ my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"; +my $DejagnuLog = "$Prefix-Dejagnu-testrun.log"; +my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum"; +my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt"; if ($VERBOSE) { print "INITIALIZED\n"; @@ -434,7 +494,7 @@ if ($VERBOSE) { print "BUILD ERROR\n"; } } -if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; } +if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; $RUNDEJAGNU=0; } # Get results of feature tests. my $FeatureTestResults; # String containing the results of the feature tests @@ -483,9 +543,37 @@ $RegressionWallTime = "0.0"; } +my $DejangnuTestResults; # String containing the results of the dejagnu +if($RUNDEJAGNU) { + if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; } + + my $dejagnu_output = "$DejagnuTestsLog"; + + #Run the feature and regression tests, results are put into testrun.sum + #Full log in testrun.log + system "time -p gmake $MAKEOPTS check-dejagnu >& $dejagnu_output"; + + #Extract time of dejagnu tests + my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output"; + my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output"; + $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System + $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output"; + + #Copy the testrun.log and testrun.sum to our webdir + CopyFile("test/testrun.log", $DejagnuLog); + CopyFile("test/testrun.sum", $DejagnuSum); + + $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog); +} else { + $DejagnuTestResults = "Skipped by user choice."; + $DejagnuTime = "0.0"; + $DejagnuWallTime = "0.0"; +} + if ($DEBUG) { print $FeatureTestResults; print $RegressionTestResults; + print $DejagnuTestResults; } if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; } Index: llvm/utils/NightlyTestTemplate.html diff -u llvm/utils/NightlyTestTemplate.html:1.32 llvm/utils/NightlyTestTemplate.html:1.33 --- llvm/utils/NightlyTestTemplate.html:1.32 Fri Jul 23 01:50:18 2004 +++ llvm/utils/NightlyTestTemplate.html Sat Nov 20 18:02:40 2004 @@ -18,6 +18,7 @@ Programs
      Feature
      Regression
      +Dejagnu Tests

      @@ -71,6 +72,7 @@ Build CVS Tree$BuildTime$BuildWallTime Run Feature Tests$FeatureTime$FeatureWallTime Run Regression Tests$RegressionTime$RegressionWallTime +Run Dejagnu Tests$DejagnuTime$DejagnuWallTime

    • Number of object files compiled: $NumObjects
    • Number of libraries linked: $NumLibraries
    • @@ -256,4 +258,13 @@
      $RegressionTestResults +

      +
      +
      Dejagnu Test Results +
      +
      +$DejagnuTestResults + + From tbrethou at cs.uiuc.edu Sat Nov 20 18:10:23 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Sat, 20 Nov 2004 18:10:23 -0600 Subject: [llvm-commits] CVS: llvm/utils/NightlyTest.pl Message-ID: <200411210010.SAA30286@zion.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTest.pl updated: 1.70 -> 1.71 --- Log message: Made dejagnu option lower case. --- Diffs of the changes: (+1 -1) Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.70 llvm/utils/NightlyTest.pl:1.71 --- llvm/utils/NightlyTest.pl:1.70 Sat Nov 20 18:02:40 2004 +++ llvm/utils/NightlyTest.pl Sat Nov 20 18:10:12 2004 @@ -347,7 +347,7 @@ $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next; } if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } - if(/^-runDejagnu$/) { $RUNDEJAGNU = 1; next; } + if(/^-rundejagnu$/) { $RUNDEJAGNU = 1; next; } print "Unknown option: $_ : ignoring!\n"; } From reid at x10sys.com Sat Nov 20 19:49:10 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 20 Nov 2004 19:49:10 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/GNU.a Message-ID: <200411210149.TAA30979@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: GNU.a added (r1.1) --- Log message: Test archive built with GNU ar(1). --- Diffs of the changes: (+0 -0) Index: llvm/test/Regression/Archive/GNU.a From lattner at cs.uiuc.edu Sat Nov 20 21:27:27 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 21:27:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineRelocation.h Message-ID: <200411210327.iAL3RRaY027288@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineRelocation.h updated: 1.3 -> 1.4 --- Log message: Add another bit, to make the JIT a bit more efficient. --- Diffs of the changes: (+23 -10) Index: llvm/include/llvm/CodeGen/MachineRelocation.h diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.3 llvm/include/llvm/CodeGen/MachineRelocation.h:1.4 --- llvm/include/llvm/CodeGen/MachineRelocation.h:1.3 Sat Nov 20 17:40:54 2004 +++ llvm/include/llvm/CodeGen/MachineRelocation.h Sat Nov 20 21:27:13 2004 @@ -27,15 +27,17 @@ /// /// A relocation is made up of the following logical portions: /// 1. An offset in the machine code buffer, the location to modify. -/// 2. A target specific relocation type (a number from 0 to 127). +/// 2. A target specific relocation type (a number from 0 to 63). /// 3. A symbol being referenced, either as a GlobalValue* or as a string. /// 4. An optional constant value to be added to the reference. +/// 5. A bit, CanRewrite, which indicates to the JIT that a function stub is +/// not needed for the relocation. /// class MachineRelocation { /// OffsetTypeExternal - The low 24-bits of this value is the offset from the /// start of the code buffer of the relocation to perform. Bit 24 of this is - /// set if Target should use ExtSym instead of GV, and the high 7 bits are to - /// hold the relocation type. + /// set if Target should use ExtSym instead of GV, Bit 25 is the CanRewrite + /// bit, and the high 6 bits hold the relocation type. unsigned OffsetTypeExternal; union { GlobalValue *GV; // If this is a pointer to an LLVM global @@ -45,19 +47,21 @@ intptr_t ConstantVal; public: MachineRelocation(unsigned Offset, unsigned RelocationType, GlobalValue *GV, - intptr_t cst = 0) - : OffsetTypeExternal(Offset + (RelocationType << 25)), ConstantVal(cst) { + intptr_t cst = 0, bool DoesntNeedFunctionStub = 0) + : OffsetTypeExternal(Offset + (RelocationType << 26)), ConstantVal(cst) { assert((Offset & ~((1 << 24)-1)) == 0 && "Code offset too large!"); - assert((RelocationType & ~127) == 0 && "Relocation type too large!"); + assert((RelocationType & ~63) == 0 && "Relocation type too large!"); Target.GV = GV; + if (DoesntNeedFunctionStub) + OffsetTypeExternal |= 1 << 25; } MachineRelocation(unsigned Offset, unsigned RelocationType, const char *ES, - intptr_t cst = 0) - : OffsetTypeExternal(Offset + (1 << 24) + (RelocationType << 25)), + intptr_t cst = 0) + : OffsetTypeExternal(Offset + (1 << 24) + (RelocationType << 26)), ConstantVal(cst) { assert((Offset & ~((1 << 24)-1)) == 0 && "Code offset too large!"); - assert((RelocationType & ~127) == 0 && "Relocation type too large!"); + assert((RelocationType & ~63) == 0 && "Relocation type too large!"); Target.ExtSym = ES; } @@ -70,7 +74,7 @@ /// getRelocationType - Return the target-specific relocation ID for this /// relocation. unsigned getRelocationType() const { - return OffsetTypeExternal >> 25; + return OffsetTypeExternal >> 26; } /// getConstantVal - Get the constant value associated with this relocation. @@ -92,6 +96,15 @@ return !isGlobalValue(); } + /// doesntNeedFunctionStub - This function returns true if the JIT for this + /// target is capable of directly handling the relocated instruction without + /// using a stub function. It is always conservatively correct for this flag + /// to be false, but targets can improve their compilation callback functions + /// to handle more general cases if they want improved performance. + bool doesntNeedFunctionStub() const { + return (OffsetTypeExternal & (1 << 25)) != 0; + } + /// getGlobalValue - If this is a global value reference, return the /// referenced global. GlobalValue *getGlobalValue() const { From lattner at cs.uiuc.edu Sat Nov 20 21:37:56 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 21:37:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200411210337.iAL3buaQ027761@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.50 -> 1.51 --- Log message: Allow targets to avoid emitting a stub for EVERY lazily resolved call. In most cases (e.g. direct calls) no stub is needed. --- Diffs of the changes: (+30 -9) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.50 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.51 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.50 Sat Nov 20 17:57:07 2004 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Sat Nov 20 21:37:42 2004 @@ -96,9 +96,13 @@ /// JITResolver - Keep track of, and resolve, call sites for functions that /// have not yet been compiled. class JITResolver { - /// The MCE to use to emit stubs with. + /// MCE - The MachineCodeEmitter to use to emit stubs with. MachineCodeEmitter &MCE; + /// LazyResolverFn - The target lazy resolver function that we actually + /// rewrite instructions to use. + TargetJITInfo::LazyResolverFn LazyResolverFn; + // FunctionToStubMap - Keep track of the stub created for a particular // function so that we can reuse them if necessary. std::map FunctionToStubMap; @@ -108,12 +112,24 @@ std::map StubToFunctionMap; public: - JITResolver(MachineCodeEmitter &mce) : MCE(mce) {} + JITResolver(MachineCodeEmitter &mce) : MCE(mce) { + LazyResolverFn = + TheJIT->getJITInfo().getLazyResolverFunction(JITCompilerFn); + } /// getFunctionStub - This returns a pointer to a function stub, creating /// one on demand as needed. void *getFunctionStub(Function *F); + /// AddCallbackAtLocation - If the target is capable of rewriting an + /// instruction without the use of a stub, record the location of the use so + /// we know which function is being used at the location. + void *AddCallbackAtLocation(Function *F, void *Location) { + /// Get the target-specific JIT resolver function. + StubToFunctionMap[Location] = F; + return (void*)LazyResolverFn; + } + /// JITCompilerFn - This function is called to resolve a stub to a compiled /// address. If the LLVM Function corresponding to the stub has not yet /// been compiled, this function compiles it first. @@ -131,10 +147,6 @@ /// getFunctionStub - This returns a pointer to a function stub, creating /// one on demand as needed. void *JITResolver::getFunctionStub(Function *F) { - /// Get the target-specific JIT resolver function. - static TargetJITInfo::LazyResolverFn LazyResolverFn = - TheJIT->getJITInfo().getLazyResolverFunction(JITResolver::JITCompilerFn); - // If we already have a stub for this function, recycle it. void *&Stub = FunctionToStubMap[F]; if (Stub) return Stub; @@ -234,7 +246,7 @@ virtual uint64_t forceCompilationOf(Function *F); private: - void *getPointerToGlobal(GlobalValue *GV); + void *getPointerToGlobal(GlobalValue *GV, void *Reference, bool NoNeedStub); }; } @@ -242,7 +254,8 @@ return new Emitter(jit); } -void *Emitter::getPointerToGlobal(GlobalValue *V) { +void *Emitter::getPointerToGlobal(GlobalValue *V, void *Reference, + bool DoesntNeedStub) { if (GlobalVariable *GV = dyn_cast(V)) { /// FIXME: If we straightened things out, this could actually emit the /// global immediately instead of queuing it for codegen later! @@ -261,6 +274,12 @@ return TheJIT->getPointerToFunction(F); } + // Okay, the function has not been compiled yet, if the target callback + // mechanism is capable of rewriting the instruction directly, prefer to do + // that instead of emitting a stub. + if (DoesntNeedStub) + return getJITResolver(this).AddCallbackAtLocation(F, Reference); + // Otherwise, we have to emit a lazy resolving stub. return getJITResolver(this).getFunctionStub(F); } @@ -283,7 +302,9 @@ if (MR.isString()) ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString()); else - ResultPtr = getPointerToGlobal(MR.getGlobalValue()); + ResultPtr = getPointerToGlobal(MR.getGlobalValue(), + CurBlock+MR.getMachineCodeOffset(), + MR.doesntNeedFunctionStub()); MR.setResultPointer(ResultPtr); } From lattner at cs.uiuc.edu Sat Nov 20 21:44:44 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 21:44:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200411210344.iAL3iiaG028334@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.51 -> 1.52 --- Log message: Clean up DEBUG output --- Diffs of the changes: (+5 -5) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.51 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.52 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.51 Sat Nov 20 21:37:42 2004 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Sat Nov 20 21:44:32 2004 @@ -155,6 +155,9 @@ // resolver function. Stub = TheJIT->getJITInfo().emitFunctionStub((void*)LazyResolverFn, MCE); + DEBUG(std::cerr << "JIT: Stub emitted at [" << Stub << "] for function '" + << F->getName() << "\n"); + // Finally, keep track of the stub-to-Function mapping so that the // JITCompilerFn knows which function to compile! StubToFunctionMap[Stub] = F; @@ -178,7 +181,7 @@ // function is no longer called from this stub. JR.StubToFunctionMap.erase(I); - DEBUG(std::cerr << "Lazily resolving function '" << F->getName() + DEBUG(std::cerr << "JIT: Lazily resolving function '" << F->getName() << "' In stub ptr = " << Stub << " actual ptr = " << I->first << "\n"); @@ -312,7 +315,7 @@ Relocations.size()); } - DEBUG(std::cerr << "Finished CodeGen of [" << (void*)CurBlock + DEBUG(std::cerr << "JIT: Finished CodeGen of [" << (void*)CurBlock << "] Function: " << F.getFunction()->getName() << ": " << CurByte-CurBlock << " bytes of text, " << Relocations.size() << " relocations\n"); @@ -359,9 +362,6 @@ void *Emitter::finishFunctionStub(const Function *F) { NumBytes += CurByte-CurBlock; - DEBUG(std::cerr << "Finished CodeGen of [0x" << (void*)CurBlock - << "] Function stub for: " << (F ? F->getName() : "") - << ": " << CurByte-CurBlock << " bytes of text\n"); std::swap(CurBlock, SavedCurBlock); CurByte = SavedCurByte; return SavedCurBlock; From lattner at cs.uiuc.edu Sat Nov 20 21:46:19 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 21:46:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86JITInfo.cpp Message-ID: <200411210346.iAL3kJq2028628@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.77 -> 1.78 X86JITInfo.cpp updated: 1.1 -> 1.2 --- Log message: There is no reason to emit function stubs for direct calls. --- Diffs of the changes: (+1 -2) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.77 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.78 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.77 Sat Nov 20 17:55:15 2004 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Sat Nov 20 21:46:06 2004 @@ -141,7 +141,7 @@ /// void Emitter::emitGlobalAddressForCall(GlobalValue *GV) { MCE.addRelocation(MachineRelocation(MCE.getCurrentPCOffset(), - X86::reloc_pcrel_word, GV)); + X86::reloc_pcrel_word, GV, 0, true)); MCE.emitWord(0); } Index: llvm/lib/Target/X86/X86JITInfo.cpp diff -u llvm/lib/Target/X86/X86JITInfo.cpp:1.1 llvm/lib/Target/X86/X86JITInfo.cpp:1.2 --- llvm/lib/Target/X86/X86JITInfo.cpp:1.1 Sat Nov 20 17:54:33 2004 +++ llvm/lib/Target/X86/X86JITInfo.cpp Sat Nov 20 21:46:06 2004 @@ -137,4 +137,3 @@ } } } - From lattner at cs.uiuc.edu Sat Nov 20 22:42:49 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 20 Nov 2004 22:42:49 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetJITInfo.h Message-ID: <200411210442.iAL4gn4Q028695@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetJITInfo.h updated: 1.4 -> 1.5 --- Log message: Fix a warning --- Diffs of the changes: (+1 -0) Index: llvm/include/llvm/Target/TargetJITInfo.h diff -u llvm/include/llvm/Target/TargetJITInfo.h:1.4 llvm/include/llvm/Target/TargetJITInfo.h:1.5 --- llvm/include/llvm/Target/TargetJITInfo.h:1.4 Sat Nov 20 17:50:02 2004 +++ llvm/include/llvm/Target/TargetJITInfo.h Sat Nov 20 22:42:32 2004 @@ -48,6 +48,7 @@ /// address. Return the address of the resultant function. virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) { assert(0 && "This target doesn't implement emitFunctionStub!"); + return 0; } /// LazyResolverFn - This typedef is used to represent the function that From natebegeman at mac.com Sat Nov 20 23:23:18 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sat, 20 Nov 2004 23:23:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200411210523.XAA00633@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.107 -> 1.108 --- Log message: Fix Shootout-C++/wc, which was broken by my recent changes to emit fewer reg-reg copies. The necessary conditions for this bug are a GEP that is used outside the basic block in which it is defined, whose components other than the pointer are all constant zero, and where the use is selected before the definition (backwards branch to successsor block). --- Diffs of the changes: (+6 -5) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.107 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.108 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.107 Fri Nov 19 02:01:16 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Sat Nov 20 23:14:06 2004 @@ -3835,18 +3835,19 @@ unsigned TargetReg = getReg(GEPI, MBB, IP); unsigned basePtrReg = getReg(Src, MBB, IP); - if ((indexReg == 0) && remainder->isNullValue()) - RegMap[GEPI] = basePtrReg; - + if ((indexReg == 0) && remainder->isNullValue()) { + BuildMI(*MBB, IP, PPC::OR, 2, TargetReg).addReg(basePtrReg) + .addReg(basePtrReg); + return; + } if (!remainder->isNullValue()) { unsigned TmpReg = (indexReg == 0) ? TargetReg : makeAnotherReg(Type::IntTy); emitBinaryConstOperation(MBB, IP, basePtrReg, remainder, 0, TmpReg); basePtrReg = TmpReg; } - if (indexReg != 0) { + if (indexReg != 0) BuildMI(*MBB, IP, PPC::ADD, 2, TargetReg).addReg(indexReg) .addReg(basePtrReg); - } } /// visitAllocaInst - If this is a fixed size alloca, allocate space from the From criswell at cs.uiuc.edu Sun Nov 21 08:34:44 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Sun, 21 Nov 2004 08:34:44 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandLine.html Message-ID: <200411211434.IAA03928@zion.cs.uiuc.edu> Changes in directory llvm/docs: CommandLine.html updated: 1.28 -> 1.29 --- Log message: It looks like I'm fixing a spelling mistake, but I'm really trying to replicate the CVS performance problems that Reid is seeing. --- Diffs of the changes: (+2 -2) Index: llvm/docs/CommandLine.html diff -u llvm/docs/CommandLine.html:1.28 llvm/docs/CommandLine.html:1.29 --- llvm/docs/CommandLine.html:1.28 Tue Nov 16 00:11:52 2004 +++ llvm/docs/CommandLine.html Sun Nov 21 08:34:34 2004 @@ -614,7 +614,7 @@

      Again, the only structural difference between the debug level declaration and -the optimiation level declaration is that the debug level declaration includes +the optimization level declaration is that the debug level declaration includes an option name ("debug_level"), which automatically changes how the library processes the argument. The CommandLine library supports both forms so that you can choose the form most appropriate for your application.

      @@ -1806,7 +1806,7 @@ Chris Lattner
      LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/11/16 06:11:52 $ + Last modified: $Date: 2004/11/21 14:34:34 $ From criswell at cs.uiuc.edu Sun Nov 21 09:00:17 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Sun, 21 Nov 2004 09:00:17 -0600 Subject: [llvm-commits] CVS: llvm/docs/CompilerDriver.html SystemLibrary.html index.html Message-ID: <200411211500.JAA04176@zion.cs.uiuc.edu> Changes in directory llvm/docs: CompilerDriver.html updated: 1.10 -> 1.11 SystemLibrary.html updated: 1.6 -> 1.7 index.html updated: 1.35 -> 1.36 --- Log message: Corrected spelling mistakes. --- Diffs of the changes: (+15 -15) Index: llvm/docs/CompilerDriver.html diff -u llvm/docs/CompilerDriver.html:1.10 llvm/docs/CompilerDriver.html:1.11 --- llvm/docs/CompilerDriver.html:1.10 Mon Nov 1 15:31:39 2004 +++ llvm/docs/CompilerDriver.html Sun Nov 21 08:58:11 2004 @@ -176,7 +176,7 @@ program.

      The following table shows the inputs, outputs, and command line options - applicabe to each phase.

      + applicable to each phase.

      @@ -593,12 +593,12 @@
      -

      On any configruation item that ends in command, you must +

      On any configuration item that ends in command, you must specify substitution tokens. Substitution tokens begin and end with a percent sign (%) and are replaced by the corresponding text. Any substitution token may be given on any command line but some are more useful than others. In particular each command should have both an %in% - and an %out% substittution. The table below provides definitions of + and an %out% substitution. The table below provides definitions of each of the allowed substitution tokens.

      Phase
      @@ -815,7 +815,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">Reid Spencer
      The LLVM Compiler Infrastructure
      -Last modified: $Date: 2004/11/01 21:31:39 $ +Last modified: $Date: 2004/11/21 14:58:11 $ Index: llvm/docs/SystemLibrary.html diff -u llvm/docs/SystemLibrary.html:1.6 llvm/docs/SystemLibrary.html:1.7 --- llvm/docs/SystemLibrary.html:1.6 Thu Aug 26 21:08:04 2004 +++ llvm/docs/SystemLibrary.html Sun Nov 21 08:58:11 2004 @@ -24,7 +24,7 @@
    • No Exposed Data
    • Throw Only std::string
    • No throw() Specifications
    • -
    • No Duplicate Impementations
    • +
    • No Duplicate Implementations
    • System Library Design
        @@ -40,7 +40,7 @@
      1. System Library Details
        1. Tracking Bugzilla Bug: 351
        2. -
        3. Reference Implementatation
        4. +
        5. Reference Implementation
      2. @@ -85,7 +85,7 @@
        -

        The library must sheild LLVM from all system libraries. To obtain +

        The library must shield LLVM from all system libraries. To obtain system level functionality, LLVM must #include "llvm/System/Thing.h" and nothing else. This means that Thing.h cannot expose any system header files. This protects LLVM from accidentally using system specific @@ -154,7 +154,7 @@

        • foo: Unable to open file because it doesn't exist."

        The "foo:" part is the context. The "Unable to open file" part is the error message. The "because it doesn't exist." part is the reason. This message has - no suggestion. Where possible, the imlementation of lib/System should use + no suggestion. Where possible, the implementation of lib/System should use operating system specific facilities for converting the error code returned by a system call into an error message. This will help to make the error message more familiar to users of that type of operating system.

        @@ -171,7 +171,7 @@

        None of the lib/System interface functions may be declared with C++ throw() specifications on them. This requirement makes sure that the - compler does not insert addtional exception handling code into the interface + compiler does not insert additional exception handling code into the interface functions. This is a performance consideration: lib/System functions are at the bottom of the many call chains and as such can be frequently called. We need them to be as efficient as possible.

        @@ -374,7 +374,7 @@

        In order to provide different implementations of the lib/System interface for different platforms, it is necessary for the library to "sense" which operating system is being compiled for and conditionally compile only the - applicabe parts of the library. While several operating system wrapper + applicable parts of the library. While several operating system wrapper libraries (e.g. APR, ACE) choose to use #ifdef preprocessor statements in combination with autoconf variable (HAVE_* family), lib/System chooses an alternate strategy.

        @@ -383,7 +383,7 @@ functions for a particular operating system variant. The functions defined in that file have no #ifdef's to disambiguate the platform since the file is only compiled on one kind of platform. While this leads to the same function being - imlemented differently in different files, it is our contention that this + implemented differently in different files, it is our contention that this leads to better maintenance and easier portability.

        For example, consider a function having different implementations on a variety of platforms. Many wrapper libraries choose to deal with the different @@ -407,7 +407,7 @@ specific flavors and versions of the operating system. In that case you end up with multiple levels of nested #if statements. This is what we mean by "#ifdef hell".

        -

        To avoid the situation above, we've choosen to locate all functions for a +

        To avoid the situation above, we've chosen to locate all functions for a given implementation file for a specific operating system into one place. This has the following advantages:

          @@ -502,7 +502,7 @@ Reid Spencer
          LLVM Compiler Infrastructure
          - Last modified: $Date: 2004/08/27 02:08:04 $ + Last modified: $Date: 2004/11/21 14:58:11 $ Index: llvm/docs/index.html diff -u llvm/docs/index.html:1.35 llvm/docs/index.html:1.36 --- llvm/docs/index.html:1.35 Thu Nov 11 03:30:00 2004 +++ llvm/docs/index.html Sun Nov 21 08:58:12 2004 @@ -171,7 +171,7 @@ on how to write a new alias analysis implementation or how to use existing analyses. -
        • The Stacker Cronicles - This document +
        • The Stacker Chronicles - This document describes both the Stacker language and LLVM frontend, but also some details about LLVM useful for those writing front-ends.
        • @@ -229,6 +229,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
          - Last modified: $Date: 2004/11/11 09:30:00 $ + Last modified: $Date: 2004/11/21 14:58:12 $ From criswell at cs.uiuc.edu Sun Nov 21 09:11:49 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Sun, 21 Nov 2004 09:11:49 -0600 Subject: [llvm-commits] CVS: llvm/docs/MakefileGuide.html Message-ID: <200411211511.JAA04314@zion.cs.uiuc.edu> Changes in directory llvm/docs: MakefileGuide.html updated: 1.12 -> 1.13 --- Log message: Fixed another typo. --- Diffs of the changes: (+2 -2) Index: llvm/docs/MakefileGuide.html diff -u llvm/docs/MakefileGuide.html:1.12 llvm/docs/MakefileGuide.html:1.13 --- llvm/docs/MakefileGuide.html:1.12 Mon Nov 8 11:32:12 2004 +++ llvm/docs/MakefileGuide.html Sun Nov 21 09:11:37 2004 @@ -743,7 +743,7 @@
          Sources
          The complete list of source files.
          sysconfdir
          -
          The directory into which configuration files will ulitmately be +
          The directory into which configuration files will ultimately be installed. This value is derived from the --prefix option given to configure.
          ToolDir
          @@ -853,7 +853,7 @@ Reid Spencer
          The LLVM Compiler Infrastructure
          - Last modified: $Date: 2004/11/08 17:32:12 $ + Last modified: $Date: 2004/11/21 15:11:37 $ From reid at x10sys.com Sun Nov 21 12:35:19 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 21 Nov 2004 12:35:19 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ld.pod Message-ID: <200411211835.MAA07230@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-ld.pod added (r1.1) --- Log message: First version of manual page for llvm-ld. --- Diffs of the changes: (+161 -0) Index: llvm/docs/CommandGuide/llvm-ld.pod diff -c /dev/null llvm/docs/CommandGuide/llvm-ld.pod:1.1 *** /dev/null Sun Nov 21 12:23:26 2004 --- llvm/docs/CommandGuide/llvm-ld.pod Sun Nov 21 12:20:16 2004 *************** *** 0 **** --- 1,161 ---- + =pod + + =head1 NAME + + llvm-ld - LLVM linker + + =head1 SYNOPSIS + + B + + =head1 DESCRIPTION + + The B command is similar to the common Unix utility, C. It + links together bytecode modules to produce an executable program. + + =head1 OPTIONS + + =head2 Input/Output Options + + =over + + =item B<-o> F + + This overrides the default output file and specifies the name of the file that + should be generated by the linker. By default, B generates a file named + F for compatibility with B. The output will be written to + F. + + =item B<-l>F + + This option specifies the F of a library to search when resolving symbols + for the program. Only the base name should be specified as F, without a + F prefix or any suffix. + + =item B<-L>F + + This option tells B to look in F to find any library subsequently + specified with the B<-l> option. The paths will be searched in the order in + which they are specified on the command line. If the library is still not found, + a small set of system specific directories will also be searched. Note that + libraries specified with the B<-l> option that occur I any B<-L> options + will not search the paths given by the B<-L> options following it. + + =item B<-link-as-library> + + Link the bytecode files together as a library, not an executable. In this mode, + undefined symbols will be permitted. + + =item B<-r> + + An alias for -link-as-library. + + =item B<-march=>C + + Specifies the kind of machine for which code or assembly should be generated. + + =item B<-native> + + Generate a native binary instead of a shell script that runs the JIT from + bytecode. + + =item B<-native-cbe> + + Generate a native binary with the C back end and compilation with GCC. + + =item B<-disable-compression> + + Do not compress bytecode files. + + =back + + =head2 Optimization Options + + =over + + =item B<-O0> + + An alias for the -O1 option. + + =item B<-O1> + + Optimize for linking speed, not execution speed. The optimizer will attempt to + reduce the size of the linked program to reduce I/O but will not otherwise + perform any link-time optimizations. + + =item B<-O2> + + Perform only the minimal or required set of scalar optimizations. + + =item B<-03> + + An alias for the -O2 option. + + =item B<-04> + + Perform the standard link time inter-procedural optimizations. This will + attempt to optimize the program taking the entire program into consideration. + + =item B<-O5> + + Perform aggressive link time optimizations. This is the same as -O4 but works + more aggressively to optimize the program. + + =item B<-disable-inlining> + + Do not run the inlining pass. Functions will not be inlined into other + functions. + + =item B<-disable-opt> + + Completely disable optimization. The various B<-On> options will be ignored and + no link time optimization passes will be run. + + =item B<-disable-internalize> + + Do not mark all symbols as internal. + + =item B<-verify> + + Run the verification pass after each of the passes to verify intermediate + results. + + =item B<-s> + + Strip symbol info from the executable to make it smaller. + + =item B<-export-dynamic> + + An alias for -disable-internalize + + =item B<-load> F + + Load an optimization module, F, which is expected to be a dynamic + library that provides the function name C. This function will + be passed the PassManager, and the optimization level (values 0-5 based on the + B<-On> option). This function may add passes to the PassManager that should be + run. This feature allows the optimization passes of B to be extended. + + =back + + =head2 Miscellaneous Options + + =item B<-v> + + Specifies verbose mode. In this mode the linker will print additional + information about the actions it takes, programs it executes, etc. + + =head1 EXIT STATUS + + If B succeeds, it will exit with 0 return code. If an error occurs, + it will exit with a non-zero return code. + + =head1 SEE ALSO + + L + + =head1 AUTHORS + + Maintained by the LLVM Team (L). + + =cut From reid at x10sys.com Sun Nov 21 15:40:57 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 21 Nov 2004 15:40:57 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/ranlib_GNU.ll ranlib_MacOSX.ll ranlib_SVR4.ll ranlib_xpg4.ll Message-ID: <200411212140.PAA09251@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: ranlib_GNU.ll updated: 1.2 -> 1.3 ranlib_MacOSX.ll updated: 1.1 -> 1.2 ranlib_SVR4.ll updated: 1.2 -> 1.3 ranlib_xpg4.ll updated: 1.2 -> 1.3 --- Log message: * Undo previous commit that breaks the test. * Correct the test to work when srcdir == objdir. NOTE: Since multiple tests run from the same source archive and llvm-ranlib changes the archive, these tests MUST work on a copy of the archive or else this test corrupts the archive file subsequent tests or subsequent runs of the test suite. --- Diffs of the changes: (+9 -6) Index: llvm/test/Regression/Archive/ranlib_GNU.ll diff -u llvm/test/Regression/Archive/ranlib_GNU.ll:1.2 llvm/test/Regression/Archive/ranlib_GNU.ll:1.3 --- llvm/test/Regression/Archive/ranlib_GNU.ll:1.2 Sat Nov 20 17:47:23 2004 +++ llvm/test/Regression/Archive/ranlib_GNU.ll Sun Nov 21 15:22:56 2004 @@ -1,8 +1,9 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;GNU style archives -;RUN: llvm-ranlib %p/GNU.a -;RUN: llvm-ar t %p/GNU.a > %t1 +;RUN: cp %p/GNU.a GNU_copy.a +;RUN: llvm-ranlib GNU_copy.a +;RUN: llvm-ar t GNU_copy.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen Index: llvm/test/Regression/Archive/ranlib_MacOSX.ll Index: llvm/test/Regression/Archive/ranlib_SVR4.ll diff -u llvm/test/Regression/Archive/ranlib_SVR4.ll:1.2 llvm/test/Regression/Archive/ranlib_SVR4.ll:1.3 --- llvm/test/Regression/Archive/ranlib_SVR4.ll:1.2 Sat Nov 20 17:47:23 2004 +++ llvm/test/Regression/Archive/ranlib_SVR4.ll Sun Nov 21 15:28:56 2004 @@ -1,8 +1,9 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;SVR4 style archives -;RUN: llvm-ranlib %p/SVR4.a -;RUN: llvm-ar t %p/SVR4.a > %t1 +;RUN: cp %p/SVR4.a SVR4_copy.a +;RUN: llvm-ranlib SVR4_copy.a +;RUN: llvm-ar t SVR4_copy.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen Index: llvm/test/Regression/Archive/ranlib_xpg4.ll diff -u llvm/test/Regression/Archive/ranlib_xpg4.ll:1.2 llvm/test/Regression/Archive/ranlib_xpg4.ll:1.3 --- llvm/test/Regression/Archive/ranlib_xpg4.ll:1.2 Sat Nov 20 17:47:23 2004 +++ llvm/test/Regression/Archive/ranlib_xpg4.ll Sun Nov 21 15:28:56 2004 @@ -1,8 +1,9 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;xpg4 style archives -;RUN: llvm-ranlib %p/xpg4.a -;RUN: llvm-ar t %p/xpg4.a > %t1 +;RUN: cp %p/xpg4.a xpg4_copy.a +;RUN: llvm-ranlib xpg4_copy.a +;RUN: llvm-ar t xpg4_copy.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen From tbrethou at cs.uiuc.edu Sun Nov 21 17:01:19 2004 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Sun, 21 Nov 2004 17:01:19 -0600 (CST) Subject: [llvm-commits] CVS: reopt/lib/TraceJIT/TraceJITEmitter.cpp Message-ID: <200411212301.RAA13369@kain.cs.uiuc.edu> Changes in directory reopt/lib/TraceJIT: TraceJITEmitter.cpp updated: 1.4 -> 1.5 --- Log message: Update to work with changes in JIT interfaces --- Diffs of the changes: (+13 -4) Index: reopt/lib/TraceJIT/TraceJITEmitter.cpp diff -u reopt/lib/TraceJIT/TraceJITEmitter.cpp:1.4 reopt/lib/TraceJIT/TraceJITEmitter.cpp:1.5 --- reopt/lib/TraceJIT/TraceJITEmitter.cpp:1.4 Thu Sep 2 11:55:45 2004 +++ reopt/lib/TraceJIT/TraceJITEmitter.cpp Sun Nov 21 17:01:06 2004 @@ -59,20 +59,25 @@ virtual void startFunction(MachineFunction &F); virtual void finishFunction(MachineFunction &F); virtual void emitConstantPool(MachineConstantPool *MCP); - virtual void startFunctionStub(const Function &F, unsigned StubSize) { + virtual void startFunctionStub(unsigned StubSize) { abort (); } - virtual void* finishFunctionStub(const Function &F) { + virtual void* finishFunctionStub(const Function *F) { abort (); } + virtual void addRelocation(const MachineRelocation &) { + assert(0 && "Relocations not supported!"); + } + virtual void emitByte(unsigned char B); virtual void emitWord(unsigned W); virtual void emitWordAt(unsigned W, unsigned *Ptr); virtual uint64_t getGlobalValueAddress(GlobalValue *V); - virtual uint64_t getGlobalValueAddress(const std::string &Name); + virtual uint64_t getGlobalValueAddress(const char *Name); virtual uint64_t getConstantPoolEntryAddress(unsigned Entry); virtual uint64_t getCurrentPCValue(); + virtual uint64_t getCurrentPCOffset(); // forceCompilationOf - Force the compilation of the specified function, and // return its address, because we REALLY need the address now. @@ -186,7 +191,7 @@ } } -uint64_t TraceJITEmitter::getGlobalValueAddress(const std::string &Name) { +uint64_t TraceJITEmitter::getGlobalValueAddress(const char *Name) { return (uint64_t)TheJIT->getPointerToNamedFunction(Name); } @@ -207,6 +212,10 @@ return CurByte; } +uint64_t TraceJITEmitter::getCurrentPCOffset() { + return CurByte-CurFunctionPtr; +} + uint64_t TraceJITEmitter::forceCompilationOf(Function *F) { return (uint64_t)TheJIT->getPointerToFunction(F); } From lattner at cs.uiuc.edu Sun Nov 21 18:41:07 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 21 Nov 2004 18:41:07 -0600 (CST) Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9Relocations.h Message-ID: <200411220041.SAA16738@kain.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9Relocations.h added (r1.1) --- Log message: Initial checkin of the V9 relocation types --- Diffs of the changes: (+42 -0) Index: llvm/lib/Target/SparcV9/SparcV9Relocations.h diff -c /dev/null llvm/lib/Target/SparcV9/SparcV9Relocations.h:1.1 *** /dev/null Sun Nov 21 18:41:01 2004 --- llvm/lib/Target/SparcV9/SparcV9Relocations.h Sun Nov 21 18:40:51 2004 *************** *** 0 **** --- 1,42 ---- + //===- SparcV9Relocations.h - SparcV9 Code Relocations ----------*- 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 SparcV9 target-specific relocation types. + // + //===----------------------------------------------------------------------===// + + #ifndef SPARCV9RELOCATIONS_H + #define SPARCV9RELOCATIONS_H + + #include "llvm/CodeGen/MachineRelocation.h" + + namespace llvm { + namespace V9 { + enum RelocationType { + // reloc_pcrel_call - PC relative relocation, shifted right by two bits, + // inserted into a 30 bit field. This is used to relocate direct call + // instructions. + reloc_pcrel_call = 0, + + // reloc_sethi_hh - Absolute relocation, for 'sethi %hh(G),reg' operation. + reloc_sethi_hh = 1, + + // reloc_sethi_lm - Absolute relocation, for 'sethi %lm(G),reg' operation. + reloc_sethi_lm = 2, + + // reloc_or_hm - Absolute relocation, for 'or reg,%hm(G),reg' operation. + reloc_or_hm = 3, + + // reloc_or_lo - Absolute relocation, for 'or reg,%lo(G),reg' operation. + reloc_or_lo = 4, + }; + } + } + + #endif From reid at x10sys.com Sun Nov 21 20:46:42 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 21 Nov 2004 20:46:42 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Archive/ranlib_GNU.ll ranlib_MacOSX.ll ranlib_SVR4.ll ranlib_xpg4.ll Message-ID: <200411220246.UAA12634@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Archive: ranlib_GNU.ll updated: 1.3 -> 1.4 ranlib_MacOSX.ll updated: 1.2 -> 1.3 ranlib_SVR4.ll updated: 1.3 -> 1.4 ranlib_xpg4.ll updated: 1.3 -> 1.4 --- Log message: Make sure output goes in the temporary/output directory. --- Diffs of the changes: (+9 -9) Index: llvm/test/Regression/Archive/ranlib_GNU.ll diff -u llvm/test/Regression/Archive/ranlib_GNU.ll:1.3 llvm/test/Regression/Archive/ranlib_GNU.ll:1.4 --- llvm/test/Regression/Archive/ranlib_GNU.ll:1.3 Sun Nov 21 15:22:56 2004 +++ llvm/test/Regression/Archive/ranlib_GNU.ll Sun Nov 21 20:46:31 2004 @@ -1,9 +1,9 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;GNU style archives -;RUN: cp %p/GNU.a GNU_copy.a -;RUN: llvm-ranlib GNU_copy.a -;RUN: llvm-ar t GNU_copy.a > %t1 +;RUN: cp %p/GNU.a %t.GNU.a +;RUN: llvm-ranlib %t.GNU.a +;RUN: llvm-ar t %t.GNU.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen Index: llvm/test/Regression/Archive/ranlib_MacOSX.ll Index: llvm/test/Regression/Archive/ranlib_SVR4.ll diff -u llvm/test/Regression/Archive/ranlib_SVR4.ll:1.3 llvm/test/Regression/Archive/ranlib_SVR4.ll:1.4 --- llvm/test/Regression/Archive/ranlib_SVR4.ll:1.3 Sun Nov 21 15:28:56 2004 +++ llvm/test/Regression/Archive/ranlib_SVR4.ll Sun Nov 21 20:46:31 2004 @@ -1,9 +1,9 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;SVR4 style archives -;RUN: cp %p/SVR4.a SVR4_copy.a -;RUN: llvm-ranlib SVR4_copy.a -;RUN: llvm-ar t SVR4_copy.a > %t1 +;RUN: cp %p/SVR4.a %t.SVR4.a +;RUN: llvm-ranlib %t.SVR4.a +;RUN: llvm-ar t %t.SVR4.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen Index: llvm/test/Regression/Archive/ranlib_xpg4.ll diff -u llvm/test/Regression/Archive/ranlib_xpg4.ll:1.3 llvm/test/Regression/Archive/ranlib_xpg4.ll:1.4 --- llvm/test/Regression/Archive/ranlib_xpg4.ll:1.3 Sun Nov 21 15:28:56 2004 +++ llvm/test/Regression/Archive/ranlib_xpg4.ll Sun Nov 21 20:46:31 2004 @@ -1,9 +1,9 @@ ;This isn't really an assembly file, its just here to run the test. ;This test just makes sure that llvm-ar can generate a symbol table for ;xpg4 style archives -;RUN: cp %p/xpg4.a xpg4_copy.a -;RUN: llvm-ranlib xpg4_copy.a -;RUN: llvm-ar t xpg4_copy.a > %t1 +;RUN: cp %p/xpg4.a %t.xpg4.a +;RUN: llvm-ranlib %t.xpg4.a +;RUN: llvm-ar t %t.xpg4.a > %t1 ;RUN: sed -e '/^;.*/d' %s >%t2 ;RUN: diff %t2 %t1 evenlen From reid at x10sys.com Sun Nov 21 20:58:58 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 21 Nov 2004 20:58:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Message-ID: <200411220258.UAA12829@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ReaderWrappers.cpp updated: 1.36 -> 1.37 --- Log message: Fix a comment to imply the correct semantics. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.36 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.37 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.36 Tue Nov 16 00:41:05 2004 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Sun Nov 21 20:58:47 2004 @@ -412,7 +412,7 @@ return MP; } catch (...) { - // We only delete the ModuleProvider here because its destructor will + // We delete only the ModuleProvider here because its destructor will // also delete the Module (we used materializeModule not releaseModule). delete MP; }