[llvm-commits] CVS: llvm/Makefile
Changes in directory llvm: Makefile updated: 1.67 - 1.68 --- Log message: Don't prevent install target from descending into the utils directory. It prevents make install on a clean directory from working. --- Diffs of the changes: (+0 -7) Makefile |7 --- 1 files changed, 7 deletions(-) Index: llvm/Makefile diff -u llvm/Makefile:1.67 llvm/Makefile:1.68 --- llvm/Makefile:1.67 Thu Nov 16 21:32:33 2006 +++ llvm/Makefile Mon Feb 5 03:43:17 2007 @@ -40,13 +40,6 @@ OPTIONAL_DIRS := endif -# Don't install utils, examples, or projects they are only used to -# build LLVM. -ifeq ($(MAKECMDGOALS),install) - DIRS := $(filter-out utils, $(DIRS)) - OPTIONAL_DIRS := -endif - # Include the main makefile machinery. include $(LLVM_SRC_ROOT)/Makefile.rules ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.317 - 1.318 --- Log message: There is nothing exclamatory about an error message. No other compiler or assembler uses ! at the end of every message. We shouldn't either. --- Diffs of the changes: (+102 -102) llvmAsmParser.y | 204 1 files changed, 102 insertions(+), 102 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.317 llvm/lib/AsmParser/llvmAsmParser.y:1.318 --- llvm/lib/AsmParser/llvmAsmParser.y:1.317Thu Feb 1 20:16:22 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Feb 5 04:16:10 2007 @@ -283,7 +283,7 @@ } break; default: -GenerateError(Internal parser error: Invalid symbol type reference!); +GenerateError(Internal parser error: Invalid symbol type reference); return 0; } @@ -370,7 +370,7 @@ if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError(Signed integral constant ' + itostr(D.ConstPool64) + ' is invalid for type ' + - Ty-getDescription() + '!); + Ty-getDescription() + '); return 0; } return ConstantInt::get(Ty, D.ConstPool64); @@ -379,7 +379,7 @@ if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError(Integral constant ' + utostr(D.UConstPool64) + - ' is invalid or out of range!); + ' is invalid or out of range); return 0; } else { // This is really a signed reference. Transmogrify. return ConstantInt::get(Ty, D.ConstPool64); @@ -390,14 +390,14 @@ case ValID::ConstFPVal:// Is it a floating point const pool reference? if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { - GenerateError(FP constant invalid for type!!); + GenerateError(FP constant invalid for type); return 0; } return ConstantFP::get(Ty, D.ConstPoolFP); case ValID::ConstNullVal: // Is it a null value? if (!isaPointerType(Ty)) { - GenerateError(Cannot create a a non pointer null!); + GenerateError(Cannot create a a non pointer null); return 0; } return ConstantPointerNull::get(castPointerType(Ty)); @@ -410,7 +410,7 @@ case ValID::ConstantVal: // Fully resolved constant? if (D.ConstantValue-getType() != Ty) { - GenerateError(Constant expression type different from required type!); + GenerateError(Constant expression type different from required type); return 0; } return D.ConstantValue; @@ -420,7 +420,7 @@ const FunctionType *FTy = PTy ? dyn_castFunctionType(PTy-getElementType()) : 0; if (!FTy || !InlineAsm::Verify(FTy, D.IAD-Constraints)) { - GenerateError(Invalid type for asm constraint string!); + GenerateError(Invalid type for asm constraint string); return 0; } InlineAsm *IA = InlineAsm::get(FTy, D.IAD-AsmString, D.IAD-Constraints, @@ -429,11 +429,11 @@ return IA; } default: -assert(0 Unhandled case!); +assert(0 Unhandled case); return 0; } // End of switch - assert(0 Unhandled case!); + assert(0 Unhandled case); return 0; } @@ -455,7 +455,7 @@ if (TriggerError) return 0; if (!Ty-isFirstClassType() !isaOpaqueType(Ty)) { -GenerateError(Invalid use of a composite type!); +GenerateError(Invalid use of a composite type); return 0; } @@ -484,7 +484,7 @@ ///or may not be a forward reference. /// static BasicBlock *getBBVal(const ValID ID, bool isDefinition = false) { - assert(inFunctionScope() Can't get basic block at global scope!); + assert(inFunctionScope() Can't get basic block at global scope); std::string Name; BasicBlock *BB = 0; @@ -573,7 +573,7 @@ std::mapValue*, std::pairValID, int ::iterator PHI = CurModule.PlaceHolderInfo.find(V); - assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error!); + assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error); ValID DID = PHI-second.first; @@ -635,15 +635,15 @@ free(NameStr); // Free old string if (V-getType() == Type::VoidTy) { -GenerateError(Can't assign name ' + Name+' to value with void type!); +GenerateError(Can't assign name ' + Name+' to value with void type); return; } - assert(inFunctionScope() Must be in function scope!); + assert(inFunctionScope() Must be in function scope); SymbolTable ST = CurFun.CurrentFunction-getValueSymbolTable(); if (ST.lookup(V-getType(), Name)) { GenerateError(Redefinition of value ' + Name + ' of type ' + - V-getType()-getDescription() + '!); + V-getType()-getDescription() + '); return; } @@ -660,7 +660,7 @@
[llvm-commits] CVS: llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll
Changes in directory llvm/test/Assembler: 2004-11-28-InvalidTypeCrash.ll updated: 1.5 - 1.6 --- Log message: Assembler no longer prints ! at the end of its error messages. --- Diffs of the changes: (+1 -1) 2004-11-28-InvalidTypeCrash.ll |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll diff -u llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll:1.5 llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll:1.6 --- llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll:1.5 Fri Jan 26 02:25:05 2007 +++ llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll Mon Feb 5 04:17:51 2007 @@ -1,4 +1,4 @@ ; RUN: llvm-as 21 %s -o /dev/null -f | \ -; RUN: grep 'Cannot create a null initialized value of this type!' +; RUN: grep 'Cannot create a null initialized value of this type' ; Test for PR463. This program is erroneous, but should not crash llvm-as. @.FOO = internal global %struct.none zeroinitializer ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/overlap-add.ll
Changes in directory llvm/test/CodeGen/X86: overlap-add.ll updated: 1.5 - 1.6 --- Log message: Make the RUN: line readable. --- Diffs of the changes: (+2 -1) overlap-add.ll |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/CodeGen/X86/overlap-add.ll diff -u llvm/test/CodeGen/X86/overlap-add.ll:1.5 llvm/test/CodeGen/X86/overlap-add.ll:1.6 --- llvm/test/CodeGen/X86/overlap-add.ll:1.5Fri Dec 1 22:23:08 2006 +++ llvm/test/CodeGen/X86/overlap-add.llMon Feb 5 04:09:41 2007 @@ -6,7 +6,8 @@ ; Check that the shift gets turned into an LEA. -; RUN: llvm-upgrade %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep 'mov E.X, E.X' +; RUN: llvm-upgrade %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | \ +; RUN: not grep 'mov E.X, E.X' ; FIXME: We need live variable information about flags to do this xform safely. :( ; XFAIL: * ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/ARM/unord.ll
Changes in directory llvm/test/CodeGen/ARM: unord.ll updated: 1.1 - 1.2 --- Log message: Fix unord test. --- Diffs of the changes: (+2 -2) unord.ll |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/CodeGen/ARM/unord.ll diff -u llvm/test/CodeGen/ARM/unord.ll:1.1 llvm/test/CodeGen/ARM/unord.ll:1.2 --- llvm/test/CodeGen/ARM/unord.ll:1.1 Fri Feb 2 18:50:45 2007 +++ llvm/test/CodeGen/ARM/unord.ll Mon Feb 5 10:33:56 2007 @@ -1,6 +1,6 @@ ; RUN: llvm-as %s | llc -march=arm -; RUN: llvm-as %s | llc -march=arm | grep bne | wc -l | grep 1 -; RUN: llvm-as %s | llc -march=arm | grep beq | wc -l | grep 1 +; RUN: llvm-as %s | llc -march=arm | grep movne | wc -l | grep 1 +; RUN: llvm-as %s | llc -march=arm | grep moveq | wc -l | grep 1 ; RUN: llvm-as %s | llc -march=arm -enable-thumb ; RUN: llvm-as %s | llc -march=arm -enable-thumb | grep bne | wc -l | grep 1 ; RUN: llvm-as %s | llc -march=arm -enable-thumb | grep beq | wc -l | grep 1 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.318 - 1.319 --- Log message: ! removal was a little over zealous. Put the ! back in asserts. --- Diffs of the changes: (+9 -9) llvmAsmParser.y | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.318 llvm/lib/AsmParser/llvmAsmParser.y:1.319 --- llvm/lib/AsmParser/llvmAsmParser.y:1.318Mon Feb 5 04:16:10 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Feb 5 11:01:20 2007 @@ -429,11 +429,11 @@ return IA; } default: -assert(0 Unhandled case); +assert(0 Unhandled case!); return 0; } // End of switch - assert(0 Unhandled case); + assert(0 Unhandled case!); return 0; } @@ -484,7 +484,7 @@ ///or may not be a forward reference. /// static BasicBlock *getBBVal(const ValID ID, bool isDefinition = false) { - assert(inFunctionScope() Can't get basic block at global scope); + assert(inFunctionScope() Can't get basic block at global scope!); std::string Name; BasicBlock *BB = 0; @@ -573,7 +573,7 @@ std::mapValue*, std::pairValID, int ::iterator PHI = CurModule.PlaceHolderInfo.find(V); - assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error); + assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error!); ValID DID = PHI-second.first; @@ -639,7 +639,7 @@ return; } - assert(inFunctionScope() Must be in function scope); + assert(inFunctionScope() Must be in function scope!); SymbolTable ST = CurFun.CurrentFunction-getValueSymbolTable(); if (ST.lookup(V-getType(), Name)) { GenerateError(Redefinition of value ' + Name + ' of type ' + @@ -724,7 +724,7 @@ // allowed to be redefined in the specified context. If the name is a new name // for the type plane, it is inserted and false is returned. static bool setTypeName(const Type *T, char *NameStr) { - assert(!inFunctionScope() Can't give types function-local names); + assert(!inFunctionScope() Can't give types function-local names!); if (NameStr == 0) return false; std::string Name(NameStr); // Copy string @@ -741,7 +741,7 @@ if (AlreadyExists) { // Inserting a name that is already defined??? const Type *Existing = CurModule.CurrentModule-getTypeByName(Name); -assert(Existing Conflict but no matching type?); +assert(Existing Conflict but no matching type?!); // There is only one case where this is allowed: when we are refining an // opaque type. In this case, Existing will be an opaque type. @@ -1625,7 +1625,7 @@ // in the future with the right type of variable. // if (V == 0) { - assert(isaPointerType(Ty) Globals may only be used as pointers); + assert(isaPointerType(Ty) Globals may only be used as pointers!); const PointerType *PT = castPointerType(Ty); // First check to see if the forward references value is already created! @@ -2116,7 +2116,7 @@ if ($5) { // Is null if empty... if (isVarArg) { // Nuke the last entry assert($5-back().Ty-get() == Type::VoidTy $5-back().Name == 0 - Not a varargs marker); + Not a varargs marker!); delete $5-back().Ty; $5-pop_back(); // Delete the last entry } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs
Changes in directory llvm/lib/AsmParser: llvmAsmParser.cpp.cvs updated: 1.63 - 1.64 llvmAsmParser.y.cvs updated: 1.64 - 1.65 --- Log message: Regenerate. --- Diffs of the changes: (+18 -18) llvmAsmParser.cpp.cvs | 18 +- llvmAsmParser.y.cvs | 18 +- 2 files changed, 18 insertions(+), 18 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.63 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.64 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.63 Mon Feb 5 04:18:06 2007 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvsMon Feb 5 11:04:00 2007 @@ -749,11 +749,11 @@ return IA; } default: -assert(0 Unhandled case); +assert(0 Unhandled case!); return 0; } // End of switch - assert(0 Unhandled case); + assert(0 Unhandled case!); return 0; } @@ -804,7 +804,7 @@ ///or may not be a forward reference. /// static BasicBlock *getBBVal(const ValID ID, bool isDefinition = false) { - assert(inFunctionScope() Can't get basic block at global scope); + assert(inFunctionScope() Can't get basic block at global scope!); std::string Name; BasicBlock *BB = 0; @@ -893,7 +893,7 @@ std::mapValue*, std::pairValID, int ::iterator PHI = CurModule.PlaceHolderInfo.find(V); - assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error); + assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error!); ValID DID = PHI-second.first; @@ -959,7 +959,7 @@ return; } - assert(inFunctionScope() Must be in function scope); + assert(inFunctionScope() Must be in function scope!); SymbolTable ST = CurFun.CurrentFunction-getValueSymbolTable(); if (ST.lookup(V-getType(), Name)) { GenerateError(Redefinition of value ' + Name + ' of type ' + @@ -1044,7 +1044,7 @@ // allowed to be redefined in the specified context. If the name is a new name // for the type plane, it is inserted and false is returned. static bool setTypeName(const Type *T, char *NameStr) { - assert(!inFunctionScope() Can't give types function-local names); + assert(!inFunctionScope() Can't give types function-local names!); if (NameStr == 0) return false; std::string Name(NameStr); // Copy string @@ -1061,7 +1061,7 @@ if (AlreadyExists) { // Inserting a name that is already defined??? const Type *Existing = CurModule.CurrentModule-getTypeByName(Name); -assert(Existing Conflict but no matching type?); +assert(Existing Conflict but no matching type?!); // There is only one case where this is allowed: when we are refining an // opaque type. In this case, Existing will be an opaque type. @@ -3933,7 +3933,7 @@ // in the future with the right type of variable. // if (V == 0) { - assert(isaPointerType(Ty) Globals may only be used as pointers); + assert(isaPointerType(Ty) Globals may only be used as pointers!); const PointerType *PT = castPointerType(Ty); // First check to see if the forward references value is already created! @@ -4596,7 +4596,7 @@ if ((yyvsp[-4].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry assert((yyvsp[-4].ArgList)-back().Ty-get() == Type::VoidTy (yyvsp[-4].ArgList)-back().Name == 0 - Not a varargs marker); + Not a varargs marker!); delete (yyvsp[-4].ArgList)-back().Ty; (yyvsp[-4].ArgList)-pop_back(); // Delete the last entry } Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.64 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.65 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.64 Mon Feb 5 04:18:06 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Mon Feb 5 11:04:00 2007 @@ -429,11 +429,11 @@ return IA; } default: -assert(0 Unhandled case); +assert(0 Unhandled case!); return 0; } // End of switch - assert(0 Unhandled case); + assert(0 Unhandled case!); return 0; } @@ -484,7 +484,7 @@ ///or may not be a forward reference. /// static BasicBlock *getBBVal(const ValID ID, bool isDefinition = false) { - assert(inFunctionScope() Can't get basic block at global scope); + assert(inFunctionScope() Can't get basic block at global scope!); std::string Name; BasicBlock *BB = 0; @@ -573,7 +573,7 @@ std::mapValue*, std::pairValID, int ::iterator PHI = CurModule.PlaceHolderInfo.find(V); - assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error); + assert(PHI != CurModule.PlaceHolderInfo.end() Placeholder error!); ValID DID = PHI-second.first; @@ -639,7 +639,7 @@ return; } - assert(inFunctionScope() Must be in function scope); + assert(inFunctionScope() Must be in function scope!); SymbolTable ST = CurFun.CurrentFunction-getValueSymbolTable(); if (ST.lookup(V-getType(), Name)) {
[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Changes in directory llvm/include/llvm/ADT: APInt.h added (r1.1) --- Log message: Add a class APInt to represent arbitrary precision constant integral values. It is a functional replacement for common case integer type like unsigned, uint64_t, but also allows non-byte-width integer type and large integer value types such as 3-bits, 15-bits, or more than 64-bits of precision. For more details, see pr1043: http://llvm.org/PR1043 . --- Diffs of the changes: (+489 -0) APInt.h | 489 1 files changed, 489 insertions(+) Index: llvm/include/llvm/ADT/APInt.h diff -c /dev/null llvm/include/llvm/ADT/APInt.h:1.1 *** /dev/null Mon Feb 5 11:29:26 2007 --- llvm/include/llvm/ADT/APInt.h Mon Feb 5 11:29:16 2007 *** *** 0 --- 1,489 + //===-- llvm/Support/APInt.h - For Arbitrary Precision Integer -*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Sheng Zhou and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // This file implements a class to represent arbitrary precision integral + // constant values. + // + //===--===// + + #ifndef LLVM_APINT_H + #define LLVM_APINT_H + + #include llvm/Support/DataTypes.h + #include string + + namespace llvm { + + //===--===// + // APInt Class + //===--===// + + /// APInt - This class represents arbitrary precision constant integral values. + /// It is a functional replacement for common case unsigned integer type like + /// unsigned, unsigned long or uint64_t, but also allows non-byte-width + /// integer type and large integer value types such as 3-bits, 15-bits, or more + /// than 64-bits of precision. APInt provides a variety of arithmetic operators + /// and methods to manipulate integer values of any bit-width. It supports not + /// only all the operations of uint64_t but also bitwise manipulation. + /// + /// @brief Class for arbitrary precision integers. + /// + class APInt { + /// Friend Functions of APInt Declared here. For detailed comments, + /// see bottom of this file. + friend bool isIntN(unsigned N, const APInt APIVal); + friend APInt ByteSwap(const APInt APIVal); + friend APInt LogBase2(const APInt APIVal); + friend double APIntToDouble(const APInt APIVal); + friend float APIntToFloat(const APInt APIVal); + + unsigned bitsnum; /// The number of bits. + bool isSigned; /// The sign flag for this APInt. + + /// This union is used to store the integer value. When the + /// integer bit-width = 64, it is used as an uint64_t; + /// otherwise it uses an uint64_t array. + union { + uint64_t VAL;/// Used to store the = 64 bits integer value. + uint64_t *pVal; /// Used to store the 64 bits integer value. + }; + + /// This enum is just used to hold constant we needed for APInt. + enum { + APINT_BITS_PER_WORD = sizeof(uint64_t) * 8 + }; + + /// @returns the number of words to hold the integer value of this APInt. + /// Here one word's bitwidth equals to that of uint64_t. + /// @brief Get the number of the words. + inline unsigned numWords() const { + return bitsnum 1 ? 0 : (bitsnum + APINT_BITS_PER_WORD - 1) / + APINT_BITS_PER_WORD; + } + + /// @returns true if the number of bits = 64, false otherwise. + /// @brief Determine if this APInt just has one word to store value. + inline bool isSingleWord() const + { return bitsnum = APINT_BITS_PER_WORD; } + + /// @returns the word position for the specified bit position. + /// Note: the bitPosition and the return value are zero-based. + static inline unsigned whichWord(unsigned bitPosition) + { return bitPosition / APINT_BITS_PER_WORD; } + + /// @returns the byte position for the specified bit position. + /// Note: the bitPosition and the return value are zero-based. + static inline unsigned whichByte(unsigned bitPosition); + + /// @returns the bit position in a word for the specified bit position + /// in APInt. + /// Note: the bitPosition and the return value are zero-based. + static inline unsigned whichBit(unsigned bitPosition) + { return bitPosition % APINT_BITS_PER_WORD; } + + /// @returns a uint64_t type integer with just bit position at + /// whichBit(bitPosition) setting, others zero. + /// Note: the bitPosition and the return value are zero-based. + static inline uint64_t maskBit(unsigned bitPosition) + { return (static_castuint64_t(1)) whichBit(bitPosition); } + + inline void TruncToBits() { + if
[llvm-commits] [123438] libtransforms is no more.
Revision: 123438 Author: clattner Date: 2007-02-05 10:18:09 -0800 (Mon, 05 Feb 2007) Log Message: --- libtransforms is no more. Modified Paths: -- apple-local/branches/llvm/gcc/Makefile.in Modified: apple-local/branches/llvm/gcc/Makefile.in === --- apple-local/branches/llvm/gcc/Makefile.in 2007-02-05 16:15:58 UTC (rev 123437) +++ apple-local/branches/llvm/gcc/Makefile.in 2007-02-05 18:18:09 UTC (rev 123438) @@ -1069,7 +1069,7 @@ # We use llvm-config to determine the libraries that we need to link in our # target, optimizations analyses and the bcwriter. -LLVMCOMPONENTS := $(LLVMTARGETOBJ) scalaropts transformutils analysis bcwriter ipo transforms +LLVMCOMPONENTS := $(LLVMTARGETOBJ) scalaropts transformutils analysis bcwriter ipo LLVMLIBFILES := $(shell $(LLVMBINPATH)/llvm-config --libfiles $(LLVMCOMPONENTS)) LLVMLDFLAGS := $(shell $(LLVMBINPATH)/llvm-config --ldflags) LIBS += $(LLVMLDFLAGS) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/Makefile
Don't prevent install target from descending into the utils directory. It prevents make install on a clean directory from working. Does this change what gets installed into PREFIX? -Chris --- Diffs of the changes: (+0 -7) Makefile |7 --- 1 files changed, 7 deletions(-) Index: llvm/Makefile diff -u llvm/Makefile:1.67 llvm/Makefile:1.68 --- llvm/Makefile:1.67Thu Nov 16 21:32:33 2006 +++ llvm/Makefile Mon Feb 5 03:43:17 2007 @@ -40,13 +40,6 @@ OPTIONAL_DIRS := endif -# Don't install utils, examples, or projects they are only used to -# build LLVM. -ifeq ($(MAKECMDGOALS),install) - DIRS := $(filter-out utils, $(DIRS)) - OPTIONAL_DIRS := -endif - # Include the main makefile machinery. include $(LLVM_SRC_ROOT)/Makefile.rules ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Sheng, Some comments for you .. On Mon, 2007-02-05 at 11:29 -0600, Zhou Sheng wrote: Changes in directory llvm/include/llvm/ADT: APInt.h added (r1.1) --- Log message: Add a class APInt to represent arbitrary precision constant integral values. It is a functional replacement for common case integer type like unsigned, uint64_t, but also allows non-byte-width integer type and large integer value types such as 3-bits, 15-bits, or more than 64-bits of precision. For more details, see pr1043: http://llvm.org/PR1043 . --- Diffs of the changes: (+489 -0) APInt.h | 489 1 files changed, 489 insertions(+) Index: llvm/include/llvm/ADT/APInt.h diff -c /dev/null llvm/include/llvm/ADT/APInt.h:1.1 *** /dev/null Mon Feb 5 11:29:26 2007 --- llvm/include/llvm/ADT/APInt.h Mon Feb 5 11:29:16 2007 *** *** 0 --- 1,489 + //===-- llvm/Support/APInt.h - For Arbitrary Precision Integer -*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Sheng Zhou and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // This file implements a class to represent arbitrary precision integral + // constant values. + // + //===--===// + + #ifndef LLVM_APINT_H + #define LLVM_APINT_H + + #include llvm/Support/DataTypes.h + #include string + + namespace llvm { + + //===--===// + // APInt Class + //===--===// + + /// APInt - This class represents arbitrary precision constant integral values. + /// It is a functional replacement for common case unsigned integer type like + /// unsigned, unsigned long or uint64_t, but also allows non-byte-width + /// integer type and large integer value types such as 3-bits, 15-bits, or more + /// than 64-bits of precision. APInt provides a variety of arithmetic operators + /// and methods to manipulate integer values of any bit-width. It supports not + /// only all the operations of uint64_t but also bitwise manipulation. + /// + /// @brief Class for arbitrary precision integers. + /// + class APInt { + /// Friend Functions of APInt Declared here. For detailed comments, Declared - declared + /// see bottom of this file. + friend bool isIntN(unsigned N, const APInt APIVal); + friend APInt ByteSwap(const APInt APIVal); + friend APInt LogBase2(const APInt APIVal); + friend double APIntToDouble(const APInt APIVal); + friend float APIntToFloat(const APInt APIVal); + + unsigned bitsnum; /// The number of bits. + bool isSigned; /// The sign flag for this APInt. + + /// This union is used to store the integer value. When the + /// integer bit-width = 64, it is used as an uint64_t; it is used as an uint64_t - it uses VAL + /// otherwise it uses an uint64_t array. an uint64_t - the PVal + union { + uint64_t VAL;/// Used to store the = 64 bits integer value. + uint64_t *pVal; /// Used to store the 64 bits integer value. + }; + + /// This enum is just used to hold constant we needed for APInt. hold constant - hold a constant + enum { + APINT_BITS_PER_WORD = sizeof(uint64_t) * 8 + }; + + /// @returns the number of words to hold the integer value of this APInt. + /// Here one word's bitwidth equals to that of uint64_t. I think this line needs to go above @returns or else it gets included in @returns. + /// @brief Get the number of the words. of the words - of words + inline unsigned numWords() const { + return bitsnum 1 ? 0 : (bitsnum + APINT_BITS_PER_WORD - 1) / + APINT_BITS_PER_WORD; + } + + /// @returns true if the number of bits = 64, false otherwise. + /// @brief Determine if this APInt just has one word to store value. + inline bool isSingleWord() const + { return bitsnum = APINT_BITS_PER_WORD; } + + /// @returns the word position for the specified bit position. + /// Note: the bitPosition and the return value are zero-based. + static inline unsigned whichWord(unsigned bitPosition) + { return bitPosition / APINT_BITS_PER_WORD; } + + /// @returns the byte position for the specified bit position. + /// Note: the bitPosition and the return value are zero-based. + static inline unsigned whichByte(unsigned bitPosition); + + /// @returns the bit position in a word for the specified bit position + /// in APInt. + /// Note: the bitPosition and the return value are zero-based. + static inline
Re: [llvm-commits] CVS: llvm/Makefile
On Mon, 2007-02-05 at 10:27 -0800, Chris Lattner wrote: Don't prevent install target from descending into the utils directory. It prevents make install on a clean directory from working. Does this change what gets installed into PREFIX? Perhaps. It might cause tblgen to be installed when previously it wasn't. Thing is, make install must be able to build everything from scratch and it currently doesn't. If we don't want tblgen installed then we need to modify the llvm/utils/TableGen/Makefile not completely avoid descending into utils from llvm/Makefile. -Chris --- Diffs of the changes: (+0 -7) Makefile |7 --- 1 files changed, 7 deletions(-) Index: llvm/Makefile diff -u llvm/Makefile:1.67 llvm/Makefile:1.68 --- llvm/Makefile:1.67 Thu Nov 16 21:32:33 2006 +++ llvm/Makefile Mon Feb 5 03:43:17 2007 @@ -40,13 +40,6 @@ OPTIONAL_DIRS := endif -# Don't install utils, examples, or projects they are only used to -# build LLVM. -ifeq ($(MAKECMDGOALS),install) - DIRS := $(filter-out utils, $(DIRS)) - OPTIONAL_DIRS := -endif - # Include the main makefile machinery. include $(LLVM_SRC_ROOT)/Makefile.rules ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Hi Sheng/Reid, Some comments about the approach, on top of what Reid already sent. The most significant is that isSigned should go away: + class APInt { + /// Friend Functions of APInt Declared here. For detailed comments, + /// see bottom of this file. + friend bool isIntN(unsigned N, const APInt APIVal); + friend APInt ByteSwap(const APInt APIVal); + friend APInt LogBase2(const APInt APIVal); + friend double APIntToDouble(const APInt APIVal); + friend float APIntToFloat(const APInt APIVal); Instead of making these things friends, why not just add accessors for whatever they need? + unsigned bitsnum; /// The number of bits. Please name this 'NumBits' or something like that. + bool isSigned; /// The sign flag for this APInt. Why do you need isSigned? This seems very strange. It would be better to keep the value in 2s complement form and add an accessor to get the sign-bit if needed. Having the sign bit be explicit makes sizeof(APInt) = 16 instead of 12. + /// @returns the number of words to hold the integer value of this APInt. + /// Here one word's bitwidth equals to that of uint64_t. + /// @brief Get the number of the words. + inline unsigned numWords() const { getNumWords() + return bitsnum 1 ? 0 : (bitsnum + APINT_BITS_PER_WORD - 1) / + APINT_BITS_PER_WORD; You don't need the special case for bitsnum 1. + /// Create a new APInt by translating the string represented integer value. + APInt(std::string Val, uint8_t radix = 10, bool sign = false); the string should be 'const'. It would also be useful to have a version that takes a character range: APInt(const char *StrStart, const char *StrEnd, uint8_t radix = 10); which would allow construction of an APInt without copying the string data. + /// @brief Postfix increment operator. Increments the APInt by one. + const APInt operator++(int); + /// @brief Postfix decrement operator. Decrements the APInt by one. + const APInt operator--(int); Postfix ++/-- operations are typically declared inline, as trivial wrappers around the prefix version. + /// @brief Equality operator. Compare this APInt with the given APInt RHS + /// for the validity of the equality relationship. + bool operator==(const APInt RHS) const; == and != are often used to compare against specific values. We should have specialized versions that take 'uint64_t', do you agree? We don't want to bloat the API and do this for every method, but I think equality comparisons are worthwhile. + /// @brief Inequality operator. Compare this APInt with the given APInt RHS + /// for the validity of the inequality relationship. + bool operator!=(const APInt RHS) const; This should be an inline wrapper that calls !operator==. + /// @returns a uint64_t value from this APInt. If this APInt contains a single + /// word, just returns VAL, otherwise pVal[0]. + inline uint64_t getValue() { + if (isSingleWord()) + return isSigned ? ((int64_t(VAL) (APINT_BITS_PER_WORD - bitsnum)) + (APINT_BITS_PER_WORD - bitsnum)) : + VAL; + else + return pVal[0]; + } This should assert if there are more than 64 bits. Not doing so will make client errors very difficult to track down. + + /// @returns the largest value for an APInt of the specified bit-width and + /// if isSign == true, it should be largest signed value, otherwise largest + /// unsigned value. + /// @brief Gets max value of the APInt with bitwidth = 64. + static APInt getMaxValue(unsigned numBits, bool isSign); + static APInt getMinValue(unsigned numBits, bool isSign); It makes sense for these to have 'isSign' but not for APInt itself. + /// @returns the all-ones value for an APInt of the specified bit-width. + /// @brief Get the all-ones value. + static APInt getAllOnesValue(unsigned numBits); + + /// @brief Set every bit to 1. + APInt set(); + /// @brief Set every bit to 0. + APInt clear(); These seems extraneous. + /// @brief Toggle every bit to its opposite value. + APInt flip(); Isn't this just operator~ ? + /// @brief Check if the specified APInt has a N-bits integer value. + inline bool isIntN(unsigned N, const APInt APIVal) { Please eliminate this and just allow operator== to take a uint64_t operand. + /// @returns true if the argument APInt value is a sequence of ones + /// starting at the least significant bit with the remainder zero. + inline const bool isMask(unsigned numBits, const APInt APIVal) { + return APIVal ((APIVal + 1) APIVal) == 0; + } I'm not sure what this does. + /// @returns the bit equivalent double. + /// If the APInt numBits 64, truncated first and then convert to double. + inline double APIntToDouble(const APInt APIVal) { + uint64_t value =
[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.133 - 1.134 --- Log message: Fix PR1158: http://llvm.org/PR1158 Do not insert Analysis pass, if it is already available. --- Diffs of the changes: (+5 -0) PassManager.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.133 llvm/lib/VMCore/PassManager.cpp:1.134 --- llvm/lib/VMCore/PassManager.cpp:1.133 Thu Feb 1 16:08:25 2007 +++ llvm/lib/VMCore/PassManager.cpp Mon Feb 5 13:34:17 2007 @@ -377,6 +377,11 @@ // TODO : Allocate function manager for this pass, other wise required set // may be inserted into previous function manager + // If this Analysis is already requested by one of the previous pass + // and it is still available then do not insert new pass in the queue again. + if (findAnalysisPass(P-getPassInfo())) + return; + AnalysisUsage AnUsage; P-getAnalysisUsage(AnUsage); const std::vectorAnalysisID RequiredSet = AnUsage.getRequiredSet(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp
Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp (r1.66) removed --- Log message: For PR411: http://llvm.org/PR411 : This pass is no longer needed. --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Transforms/IPO.h
Changes in directory llvm/include/llvm/Transforms: IPO.h updated: 1.48 - 1.49 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+11 -20) IPO.h | 31 +++ 1 files changed, 11 insertions(+), 20 deletions(-) Index: llvm/include/llvm/Transforms/IPO.h diff -u llvm/include/llvm/Transforms/IPO.h:1.48 llvm/include/llvm/Transforms/IPO.h:1.49 --- llvm/include/llvm/Transforms/IPO.h:1.48 Sun Jan 28 07:31:35 2007 +++ llvm/include/llvm/Transforms/IPO.h Mon Feb 5 14:47:19 2007 @@ -87,19 +87,6 @@ //===--===// -/// FunctionResolvingPass - Go over the functions that are in the module and -/// look for functions that have the same name. More often than not, there will -/// be things like: -///void foo(...) -///void foo(int, int) -/// because of the way things are declared in C. If this is the case, patch -/// things up. -/// -/// This is an interprocedural pass. -/// -ModulePass *createFunctionResolvingPass(); - -//===--===// /// createFunctionInliningPass - Return a new pass object that uses a heuristic /// to inline direct function calls to small functions. /// @@ -163,20 +150,24 @@ /// FunctionPass *createSingleLoopExtractorPass(); -// createBlockExtractorPass - This pass extracts all blocks (except those -// specified in the argument list) from the functions in the module. -// +/// createBlockExtractorPass - This pass extracts all blocks (except those +/// specified in the argument list) from the functions in the module. +/// ModulePass *createBlockExtractorPass(std::vectorBasicBlock* BTNE); -// createOptimizeWellKnownCallsPass - This pass optimizes specific calls to -// specific well-known (library) functions. +/// createOptimizeWellKnownCallsPass - This pass optimizes specific calls to +/// specific well-known (library) functions. ModulePass *createSimplifyLibCallsPass(); -// createIndMemRemPass - This pass removes potential indirect calls of -// malloc and free +/// createIndMemRemPass - This pass removes potential indirect calls of +/// malloc and free ModulePass *createIndMemRemPass(); +/// createStripDeadPrototypesPass - This pass removes any function declarations +/// (prototypes) that are not used. +ModulePass *createStripDeadPrototypesPass(); + } // End llvm namespace #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bytecode/BytecodeHandler.h
Changes in directory llvm/include/llvm/Bytecode: BytecodeHandler.h updated: 1.11 - 1.12 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+12 -10) BytecodeHandler.h | 22 -- 1 files changed, 12 insertions(+), 10 deletions(-) Index: llvm/include/llvm/Bytecode/BytecodeHandler.h diff -u llvm/include/llvm/Bytecode/BytecodeHandler.h:1.11 llvm/include/llvm/Bytecode/BytecodeHandler.h:1.12 --- llvm/include/llvm/Bytecode/BytecodeHandler.h:1.11 Fri Jan 26 02:09:01 2007 +++ llvm/include/llvm/Bytecode/BytecodeHandler.hMon Feb 5 14:47:19 2007 @@ -181,16 +181,14 @@ virtual void handleCompactionTableEnd() {} /// @brief Handle start of a symbol table - virtual void handleSymbolTableBegin( -Function* Func, /// The function to which the ST belongs -SymbolTable* ST /// The symbol table being filled + virtual void handleTypeSymbolTableBegin( +TypeSymbolTable* ST /// The symbol table being filled ) {} - /// @brief Handle start of a symbol table plane - virtual void handleSymbolTablePlane( -unsigned TySlot, /// The slotnum of the type plane -unsigned NumEntries, /// Number of entries in the plane -const Type* Typ /// The type of this type plane + /// @brief Handle start of a symbol table + virtual void handleValueSymbolTableBegin( +Function* Func, /// The function to which the ST belongs or 0 for Mod +ValueSymbolTable* ST /// The symbol table being filled ) {} /// @brief Handle a named type in the symbol table @@ -207,8 +205,11 @@ const std::string name /// Name of the value. ) {} - /// @brief Handle the end of a symbol table - virtual void handleSymbolTableEnd() {} + /// @brief Handle the end of a value symbol table + virtual void handleTypeSymbolTableEnd() {} + + /// @brief Handle the end of a type symbol table + virtual void handleValueSymbolTableEnd() {} /// @brief Handle the beginning of a function body virtual void handleFunctionBegin( @@ -233,6 +234,7 @@ unsigned Opcode, /// Opcode of the instruction const Type* iType, /// Instruction type std::vectorunsigned Operands, /// Vector of slot # operands +Instruction *Inst, /// The resulting instruction unsigned Length /// Length of instruction in bc bytes ) { return false; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/lto/lto.cpp
Changes in directory llvm/tools/lto: lto.cpp updated: 1.33 - 1.34 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -7) lto.cpp |7 --- 1 files changed, 7 deletions(-) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.33 llvm/tools/lto/lto.cpp:1.34 --- llvm/tools/lto/lto.cpp:1.33 Wed Jan 31 19:46:06 2007 +++ llvm/tools/lto/lto.cpp Mon Feb 5 14:47:21 2007 @@ -17,7 +17,6 @@ #include llvm/Linker.h #include llvm/Constants.h #include llvm/DerivedTypes.h -#include llvm/SymbolTable.h #include llvm/Bytecode/Reader.h #include llvm/Bytecode/Writer.h #include llvm/Support/CommandLine.h @@ -248,12 +247,6 @@ // Add an appropriate TargetData instance for this module... Passes.add(new TargetData(*Target-getTargetData())); - // 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. - Passes.add(createFunctionResolvingPass()); - // Internalize symbols if export list is nonemty if (!exportList.empty()) Passes.add(createInternalizePass(exportList)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.36 - 1.37 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -1) CppWriter.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.36 llvm/tools/llvm2cpp/CppWriter.cpp:1.37 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.36 Tue Jan 30 14:08:39 2007 +++ llvm/tools/llvm2cpp/CppWriter.cpp Mon Feb 5 14:47:21 2007 @@ -19,7 +19,6 @@ #include llvm/Instruction.h #include llvm/Instructions.h #include llvm/Module.h -#include llvm/SymbolTable.h #include llvm/TypeSymbolTable.h #include llvm/ADT/StringExtras.h #include llvm/ADT/STLExtras.h ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h Writer.cpp WriterInternals.h
Changes in directory llvm/lib/Bytecode/Writer: SlotCalculator.cpp updated: 1.81 - 1.82 SlotCalculator.h updated: 1.26 - 1.27 Writer.cpp updated: 1.155 - 1.156 WriterInternals.h updated: 1.28 - 1.29 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+35 -28) SlotCalculator.cpp | 29 - SlotCalculator.h |5 +++-- Writer.cpp | 26 ++ WriterInternals.h |3 ++- 4 files changed, 35 insertions(+), 28 deletions(-) Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.81 llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.82 --- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.81Tue Jan 30 13:36:46 2007 +++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Mon Feb 5 14:47:20 2007 @@ -21,9 +21,9 @@ #include llvm/InlineAsm.h #include llvm/Instructions.h #include llvm/Module.h -#include llvm/SymbolTable.h #include llvm/TypeSymbolTable.h #include llvm/Type.h +#include llvm/ValueSymbolTable.h #include llvm/Analysis/ConstantsScanner.h #include llvm/ADT/PostOrderIterator.h #include llvm/ADT/STLExtras.h @@ -218,8 +218,8 @@ // processTypeSymbolTable - Insert all of the type sin the specified symbol // table. -void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *ST) { - for (TypeSymbolTable::const_iterator TI = ST-begin(), TE = ST-end(); +void SlotCalculator::processTypeSymbolTable(const TypeSymbolTable *TST) { + for (TypeSymbolTable::const_iterator TI = TST-begin(), TE = TST-end(); TI != TE; ++TI ) getOrCreateSlot(TI-second); } @@ -227,23 +227,18 @@ // processSymbolTable - Insert all of the values in the specified symbol table // into the values table... // -void SlotCalculator::processValueSymbolTable(const SymbolTable *ST) { - for (SymbolTable::plane_const_iterator PI = ST-plane_begin(), - PE = ST-plane_end(); PI != PE; ++PI) -for (SymbolTable::value_const_iterator VI = PI-second.begin(), - VE = PI-second.end(); VI != VE; ++VI) - getOrCreateSlot(VI-second); +void SlotCalculator::processValueSymbolTable(const ValueSymbolTable *VST) { + for (ValueSymbolTable::const_iterator VI = VST-begin(), VE = VST-end(); + VI != VE; ++VI) +getOrCreateSlot(VI-second); } -void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) { +void SlotCalculator::processSymbolTableConstants(const ValueSymbolTable *VST) { // Now do the constant values in all planes - for (SymbolTable::plane_const_iterator PI = ST-plane_begin(), - PE = ST-plane_end(); PI != PE; ++PI) -for (SymbolTable::value_const_iterator VI = PI-second.begin(), - VE = PI-second.end(); VI != VE; ++VI) - if (isaConstant(VI-second) - !isaGlobalValue(VI-second)) -getOrCreateSlot(VI-second); + for (ValueSymbolTable::const_iterator VI = VST-begin(), VE = VST-end(); + VI != VE; ++VI) +if (isaConstant(VI-second) !isaGlobalValue(VI-second)) + getOrCreateSlot(VI-second); } Index: llvm/lib/Bytecode/Writer/SlotCalculator.h diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.26 llvm/lib/Bytecode/Writer/SlotCalculator.h:1.27 --- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.26 Tue Jan 30 13:36:46 2007 +++ llvm/lib/Bytecode/Writer/SlotCalculator.h Mon Feb 5 14:47:20 2007 @@ -31,6 +31,7 @@ class Function; class SymbolTable; class TypeSymbolTable; +class ValueSymbolTable; class ConstantArray; class SlotCalculator { @@ -130,8 +131,8 @@ // into the values table... // void processTypeSymbolTable(const TypeSymbolTable *ST); - void processValueSymbolTable(const SymbolTable *ST); - void processSymbolTableConstants(const SymbolTable *ST); + void processValueSymbolTable(const ValueSymbolTable *ST); + void processSymbolTableConstants(const ValueSymbolTable *ST); // insertPrimitives - helper for constructors to insert primitive types. void insertPrimitives(); Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.155 llvm/lib/Bytecode/Writer/Writer.cpp:1.156 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.155 Tue Jan 30 14:08:37 2007 +++ llvm/lib/Bytecode/Writer/Writer.cpp Mon Feb 5 14:47:20 2007 @@ -26,8 +26,8 @@ #include llvm/InlineAsm.h #include llvm/Instructions.h #include llvm/Module.h -#include llvm/SymbolTable.h #include llvm/TypeSymbolTable.h +#include llvm/ValueSymbolTable.h #include llvm/Support/GetElementPtrTypeIterator.h #include llvm/Support/Compressor.h #include llvm/Support/MathExtras.h @@ -1144,21 +1144,31 @@ } } -void
[llvm-commits] CVS: llvm/include/llvm/Function.h LinkAllPasses.h Module.h Value.h ValueSymbolTable.h SymbolTable.h
Changes in directory llvm/include/llvm: Function.h updated: 1.71 - 1.72 LinkAllPasses.h updated: 1.8 - 1.9 Module.h updated: 1.81 - 1.82 Value.h updated: 1.90 - 1.91 ValueSymbolTable.h updated: 1.3 - 1.4 SymbolTable.h (r1.54) removed --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+27 -19) Function.h |6 +++--- LinkAllPasses.h|1 - Module.h | 24 +--- Value.h|3 ++- ValueSymbolTable.h | 12 +--- 5 files changed, 27 insertions(+), 19 deletions(-) Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.71 llvm/include/llvm/Function.h:1.72 --- llvm/include/llvm/Function.h:1.71 Tue Jan 30 14:08:38 2007 +++ llvm/include/llvm/Function.hMon Feb 5 14:47:19 2007 @@ -63,7 +63,7 @@ BasicBlockListType BasicBlocks; // The basic blocks ArgumentListType ArgumentList;// The formal arguments - SymbolTable *SymTab; + ValueSymbolTable *SymTab; unsigned CallingConvention; friend class SymbolTableListTraitsFunction, Module, Module; @@ -156,8 +156,8 @@ /// getSymbolTable() - Return the symbol table... /// - inline SymbolTable getValueSymbolTable() { return *SymTab; } - inline const SymbolTable getValueSymbolTable() const { return *SymTab; } + inline ValueSymbolTable getValueSymbolTable() { return *SymTab; } + inline const ValueSymbolTable getValueSymbolTable() const { return *SymTab; } //======// Index: llvm/include/llvm/LinkAllPasses.h diff -u llvm/include/llvm/LinkAllPasses.h:1.8 llvm/include/llvm/LinkAllPasses.h:1.9 --- llvm/include/llvm/LinkAllPasses.h:1.8 Sat Feb 3 17:15:56 2007 +++ llvm/include/llvm/LinkAllPasses.h Mon Feb 5 14:47:19 2007 @@ -64,7 +64,6 @@ (void) llvm::createEmitFunctionTablePass(); (void) llvm::createFunctionInliningPass(); (void) llvm::createFunctionProfilerPass(); - (void) llvm::createFunctionResolvingPass(); (void) llvm::createGCSEPass(); (void) llvm::createGlobalDCEPass(); (void) llvm::createGlobalOptimizerPass(); Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.81 llvm/include/llvm/Module.h:1.82 --- llvm/include/llvm/Module.h:1.81 Sat Feb 3 18:40:41 2007 +++ llvm/include/llvm/Module.h Mon Feb 5 14:47:19 2007 @@ -23,8 +23,6 @@ class GlobalVariable; class GlobalValueRefMap; // Used by ConstantVals.cpp class FunctionType; -class SymbolTable; -class TypeSymbolTable; template struct ilist_traitsFunction : public SymbolTableListTraitsFunction, Module, Module { @@ -91,7 +89,7 @@ FunctionListType FunctionList; /// The Functions in the module LibraryListType LibraryList; /// The Libraries needed by the module std::string GlobalScopeAsm;/// Inline Asm at global scope. - SymbolTable *ValSymTab;/// Symbol table for values + ValueSymbolTable *ValSymTab; /// Symbol table for values TypeSymbolTable *TypeSymTab; /// Symbol table for types std::string ModuleID; /// Human readable identifier for the module std::string TargetTriple; /// Platform target triple Module compiled on @@ -178,17 +176,19 @@ /// getFunction - Look up the specified function in the module symbol table. /// If it does not exist, return null. - Function *getFunction(const std::string Name, const FunctionType *Ty); + Function *getFunction(const std::string Name) const; /// getMainFunction - This function looks up main efficiently. This is such a /// common case, that it is a method in Module. If main cannot be found, a /// null pointer is returned. - Function *getMainFunction(); + Function *getMainFunction() { return getFunction(main); } /// getNamedFunction - Return the first function in the module with the /// specified name, of arbitrary type. This method returns null if a function /// with the specified name is not found. - Function *getNamedFunction(const std::string Name) const; + Function *getNamedFunction(const std::string Name) const { +return getFunction(Name); + } /// @} /// @name Global Variable Accessors @@ -200,13 +200,15 @@ /// the top-level PointerType, which represents the address of the global. /// If AllowInternal is set to true, this function will return types that /// have InternalLinkage. By default, these types are not returned. - GlobalVariable *getGlobalVariable(const std::string Name, const Type *Ty, -bool AllowInternal = false); +
[llvm-commits] CVS: llvm/tools/llvm-extract/llvm-extract.cpp
Changes in directory llvm/tools/llvm-extract: llvm-extract.cpp updated: 1.34 - 1.35 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -1) llvm-extract.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/tools/llvm-extract/llvm-extract.cpp diff -u llvm/tools/llvm-extract/llvm-extract.cpp:1.34 llvm/tools/llvm-extract/llvm-extract.cpp:1.35 --- llvm/tools/llvm-extract/llvm-extract.cpp:1.34 Sun Jan 28 07:31:35 2007 +++ llvm/tools/llvm-extract/llvm-extract.cppMon Feb 5 14:47:21 2007 @@ -79,7 +79,6 @@ Passes.add(createFunctionExtractionPass(F, DeleteFn, Relink)); if (!DeleteFn) Passes.add(createGlobalDCEPass()); // Delete unreachable globals -Passes.add(createFunctionResolvingPass()); // Delete prototypes Passes.add(createDeadTypeEliminationPass()); // Remove dead types... std::ostream *Out = 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-ld/Optimize.cpp
Changes in directory llvm/tools/llvm-ld: Optimize.cpp updated: 1.15 - 1.16 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -6) Optimize.cpp |6 -- 1 files changed, 6 deletions(-) Index: llvm/tools/llvm-ld/Optimize.cpp diff -u llvm/tools/llvm-ld/Optimize.cpp:1.15 llvm/tools/llvm-ld/Optimize.cpp:1.16 --- llvm/tools/llvm-ld/Optimize.cpp:1.15Fri Dec 1 15:59:37 2006 +++ llvm/tools/llvm-ld/Optimize.cpp Mon Feb 5 14:47:21 2007 @@ -108,12 +108,6 @@ // Add an appropriate TargetData instance for this module... addPass(Passes, new TargetData(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) { // Now that composite has been compiled, scan through the module, looking // for a main function. If main is defined, mark all other functions ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Linker/redefinition.ll
Changes in directory llvm/test/Linker: redefinition.ll added (r1.1) --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+10 -0) redefinition.ll | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/test/Linker/redefinition.ll diff -c /dev/null llvm/test/Linker/redefinition.ll:1.1 *** /dev/null Mon Feb 5 14:47:31 2007 --- llvm/test/Linker/redefinition.llMon Feb 5 14:47:21 2007 *** *** 0 --- 1,10 + ; Test linking two functions with different prototypes and two globals + ; in different modules. + ; RUN: llvm-as %s -o %t.foo1.bc -f + ; RUN: llvm-as %s -o %t.foo2.bc -f + ; RUN: echo define void @foo(i32 %x) { ret void } | llvm-as -o %t.foo3.bc -f + ; RUN: llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc 21 | \ + ; RUN: grep Function is already defined + ; RUN: llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc 21 | \ + ; RUN: grep Function 'foo' defined as both + define void @foo() { ret void } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp ExtractFunction.cpp Miscompilation.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.55 - 1.56 ExtractFunction.cpp updated: 1.57 - 1.58 Miscompilation.cpp updated: 1.85 - 1.86 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+21 -17) CrashDebugger.cpp | 17 + ExtractFunction.cpp | 10 +- Miscompilation.cpp | 11 +++ 3 files changed, 21 insertions(+), 17 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.55 llvm/tools/bugpoint/CrashDebugger.cpp:1.56 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.55 Tue Jan 30 14:08:38 2007 +++ llvm/tools/bugpoint/CrashDebugger.cpp Mon Feb 5 14:47:21 2007 @@ -20,7 +20,7 @@ #include llvm/Module.h #include llvm/Pass.h #include llvm/PassManager.h -#include llvm/SymbolTable.h +#include llvm/ValueSymbolTable.h #include llvm/Analysis/Verifier.h #include llvm/Bytecode/Writer.h #include llvm/Support/CFG.h @@ -206,9 +206,9 @@ // FIXME: bugpoint should add names to all stripped symbols. assert(!Funcs[i]-getName().empty() Bugpoint doesn't work on stripped modules yet PR718!); -Function *CMF = M-getFunction(Funcs[i]-getName(), - Funcs[i]-getFunctionType()); +Function *CMF = M-getFunction(Funcs[i]-getName()); assert(CMF Function not in module?!); +assert(CMF-getFunctionType() == Funcs[i]-getFunctionType() wrong ty); Functions.insert(CMF); } @@ -271,8 +271,9 @@ for (unsigned i = 0, e = BBs.size(); i != e; ++i) { // Convert the basic block from the original module to the new module... const Function *F = BBs[i]-getParent(); -Function *CMF = M-getFunction(F-getName(), F-getFunctionType()); +Function *CMF = M-getFunction(F-getName()); assert(CMF Function not in module?!); +assert(CMF-getFunctionType() == F-getFunctionType() wrong type?); // Get the mapped basic block... Function::iterator CBI = CMF-begin(); @@ -337,10 +338,10 @@ // module, and that they don't include any deleted blocks. BBs.clear(); for (unsigned i = 0, e = BlockInfo.size(); i != e; ++i) { - SymbolTable ST = BlockInfo[i].first-getValueSymbolTable(); - SymbolTable::plane_iterator PI = ST.find(Type::LabelTy); - if (PI != ST.plane_end() PI-second.count(BlockInfo[i].second)) -BBs.push_back(castBasicBlock(PI-second[BlockInfo[i].second])); + ValueSymbolTable ST = BlockInfo[i].first-getValueSymbolTable(); + Value* V = ST.lookup(BlockInfo[i].second); + if (V V-getType() == Type::LabelTy) +BBs.push_back(castBasicBlock(V)); } return true; } Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.57 llvm/tools/bugpoint/ExtractFunction.cpp:1.58 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.57Tue Jan 30 14:08:38 2007 +++ llvm/tools/bugpoint/ExtractFunction.cpp Mon Feb 5 14:47:21 2007 @@ -110,7 +110,6 @@ I-setLinkage(GlobalValue::ExternalLinkage); std::vectorconst PassInfo* CleanupPasses; - CleanupPasses.push_back(getPI(createFunctionResolvingPass())); CleanupPasses.push_back(getPI(createGlobalDCEPass())); CleanupPasses.push_back(getPI(createDeadTypeEliminationPass())); @@ -221,7 +220,7 @@ M1Tors.push_back(std::make_pair(F, Priority)); else { // Map to M2's version of the function. - F = M2-getFunction(F-getName(), F-getFunctionType()); + F = M2-getFunction(F-getName()); M2Tors.push_back(std::make_pair(F, Priority)); } } @@ -272,9 +271,10 @@ std::setstd::pairstd::string, const PointerType* TestFunctions; for (unsigned i = 0, e = F.size(); i != e; ++i) { TestFunctions.insert(std::make_pair(F[i]-getName(), F[i]-getType())); -Function *TNOF = M-getFunction(F[i]-getName(), F[i]-getFunctionType()); -DEBUG(std::cerr Removing function F[i]-getName() \n); +Function *TNOF = M-getFunction(F[i]-getName()); assert(TNOF Function doesn't exist in module!); +assert(TNOF-getFunctionType() == F[i]-getFunctionType() wrong type?); +DEBUG(std::cerr Removing function F[i]-getName() \n); DeleteFunctionBody(TNOF); // Function is now external in this module! } @@ -317,7 +317,7 @@ Function *F = BB-getParent(); // Map the corresponding function in this module. -Function *MF = M.getFunction(F-getName(), F-getFunctionType()); +Function *MF = M.getFunction(F-getName()); // Figure out which index the basic block is in its function.
[llvm-commits] CVS: llvm/lib/Transforms/Utils/CloneModule.cpp
Changes in directory llvm/lib/Transforms/Utils: CloneModule.cpp updated: 1.22 - 1.23 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -1) CloneModule.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Transforms/Utils/CloneModule.cpp diff -u llvm/lib/Transforms/Utils/CloneModule.cpp:1.22 llvm/lib/Transforms/Utils/CloneModule.cpp:1.23 --- llvm/lib/Transforms/Utils/CloneModule.cpp:1.22 Fri Feb 2 18:08:31 2007 +++ llvm/lib/Transforms/Utils/CloneModule.cpp Mon Feb 5 14:47:20 2007 @@ -15,7 +15,6 @@ #include llvm/Transforms/Utils/Cloning.h #include llvm/Module.h #include llvm/DerivedTypes.h -#include llvm/SymbolTable.h #include llvm/TypeSymbolTable.h #include llvm/Constant.h #include ValueMapper.h ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp
Changes in directory llvm/lib/Target/CBackend: CBackend.cpp updated: 1.324 - 1.325 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -1) CBackend.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/CBackend/CBackend.cpp diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.324 llvm/lib/Target/CBackend/CBackend.cpp:1.325 --- llvm/lib/Target/CBackend/CBackend.cpp:1.324 Thu Feb 1 20:16:22 2007 +++ llvm/lib/Target/CBackend/CBackend.cpp Mon Feb 5 14:47:20 2007 @@ -20,7 +20,6 @@ #include llvm/Instructions.h #include llvm/Pass.h #include llvm/PassManager.h -#include llvm/SymbolTable.h #include llvm/TypeSymbolTable.h #include llvm/Intrinsics.h #include llvm/IntrinsicInst.h ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp
Changes in directory llvm/tools/gccld: GenerateCode.cpp updated: 1.69 - 1.70 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -6) GenerateCode.cpp |6 -- 1 files changed, 6 deletions(-) Index: llvm/tools/gccld/GenerateCode.cpp diff -u llvm/tools/gccld/GenerateCode.cpp:1.69 llvm/tools/gccld/GenerateCode.cpp:1.70 --- llvm/tools/gccld/GenerateCode.cpp:1.69 Sat Feb 3 17:06:03 2007 +++ llvm/tools/gccld/GenerateCode.cpp Mon Feb 5 14:47:21 2007 @@ -212,12 +212,6 @@ // Add an appropriate TargetData instance for this module... addPass(Passes, new TargetData(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) { // Now that composite has been compiled, scan through the module, looking // for a main function. If main is defined, mark all other functions ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Integer/calltest_bt.ll
Changes in directory llvm/test/Integer: calltest_bt.ll updated: 1.2 - 1.3 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+4 -5) calltest_bt.ll |9 - 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/test/Integer/calltest_bt.ll diff -u llvm/test/Integer/calltest_bt.ll:1.2 llvm/test/Integer/calltest_bt.ll:1.3 --- llvm/test/Integer/calltest_bt.ll:1.2Fri Jan 26 02:25:06 2007 +++ llvm/test/Integer/calltest_bt.llMon Feb 5 14:47:21 2007 @@ -5,7 +5,6 @@ %FunTy = type i28(i28) declare i28 @test(...) ; Test differences of prototype -declare i28 @test() ; Differ only by vararg implementation @@ -17,18 +16,18 @@ define i28 @main(i28 %argc) ; TODO: , sbyte **argv, sbyte **envp) begin -%retval = call i28 (i28) [EMAIL PROTECTED](i28 %argc) +%retval = call i28 (i28) [EMAIL PROTECTED](i28 %argc) %two= add i28 %retval, %retval - %retval2 = invoke i28 @test(i28 %argc) + %retval2 = invoke i28 @test2(i28 %argc) to label %Next unwind label %Error Next: %two2 = add i28 %two, %retval2 - call void @invoke (%FunTy* @test) + call void @invoke (%FunTy* @test2) ret i28 %two2 Error: ret i28 -1 end -define i28 @test(i28 %i0) { +define i28 @test2(i28 %i0) { ret i28 %i0 } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp
Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.135 - 1.136 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+99 -87) LinkModules.cpp | 186 +--- 1 files changed, 99 insertions(+), 87 deletions(-) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.135 llvm/lib/Linker/LinkModules.cpp:1.136 --- llvm/lib/Linker/LinkModules.cpp:1.135 Sat Feb 3 22:43:17 2007 +++ llvm/lib/Linker/LinkModules.cpp Mon Feb 5 14:47:20 2007 @@ -20,8 +20,8 @@ #include llvm/Constants.h #include llvm/DerivedTypes.h #include llvm/Module.h -#include llvm/SymbolTable.h #include llvm/TypeSymbolTable.h +#include llvm/ValueSymbolTable.h #include llvm/Instructions.h #include llvm/Assembly/Writer.h #include llvm/Support/Streams.h @@ -273,7 +273,8 @@ static Value *RemapOperand(const Value *In, std::mapconst Value*, Value* ValueMap) { std::mapconst Value*,Value*::const_iterator I = ValueMap.find(In); - if (I != ValueMap.end()) return I-second; + if (I != ValueMap.end()) +return I-second; // Check to see if it's a constant that we are interested in transforming. Value *Result = 0; @@ -333,20 +334,34 @@ /// through the trouble to force this back. static void ForceRenaming(GlobalValue *GV, const std::string Name) { assert(GV-getName() != Name Can't force rename to self); - SymbolTable ST = GV-getParent()-getValueSymbolTable(); + ValueSymbolTable ST = GV-getParent()-getValueSymbolTable(); // If there is a conflict, rename the conflict. - Value *ConflictVal = ST.lookup(GV-getType(), Name); - assert(ConflictValWhy do we have to force rename if there is no conflic?); - GlobalValue *ConflictGV = castGlobalValue(ConflictVal); - assert(ConflictGV-hasInternalLinkage() - Not conflicting with a static global, should link instead!); - - ConflictGV-setName(); // Eliminate the conflict - GV-setName(Name);// Force the name back - ConflictGV-setName(Name);// This will cause ConflictGV to get renamed - assert(GV-getName() == Name ConflictGV-getName() != Name - ForceRenaming didn't work); + GlobalValue *ConflictGV = cast_or_nullGlobalValue(ST.lookup(Name)); + if (ConflictGV) { +assert(ConflictGV-hasInternalLinkage() + Not conflicting with a static global, should link instead!); +ConflictGV-setName();// Eliminate the conflict + } + GV-setName(Name); // Force the name back + if (ConflictGV) { +ConflictGV-setName(Name); // This will cause ConflictGV to get renamed +assert(ConflictGV-getName() != Name ForceRenaming didn't work); + } + assert(GV-getName() == Name ForceRenaming didn't work); +} + +/// CopyGVAttributes - copy additional attributes (those not needed to construct +/// a GlobalValue) from the SrcGV to the DestGV. +static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) { + // Propagate alignment, visibility and section info. + DestGV-setAlignment(std::max(DestGV-getAlignment(), SrcGV-getAlignment())); + DestGV-setSection(SrcGV-getSection()); + DestGV-setVisibility(SrcGV-getVisibility()); + if (const Function *SrcF = dyn_castFunction(SrcGV)) { +Function *DestF = castFunction(DestGV); +DestF-setCallingConv(SrcF-getCallingConv()); + } } /// GetLinkageResult - This analyzes the two global values and determines what @@ -431,29 +446,20 @@ static bool LinkGlobals(Module *Dest, Module *Src, std::mapconst Value*, Value* ValueMap, std::multimapstd::string, GlobalVariable * AppendingVars, -std::mapstd::string, GlobalValue* GlobalsByName, std::string *Err) { - // We will need a module level symbol table if the src module has a module - // level symbol table... - TypeSymbolTable *TST = Dest-getTypeSymbolTable(); - // Loop over all of the globals in the src module, mapping them over as we go for (Module::global_iterator I = Src-global_begin(), E = Src-global_end(); I != E; ++I) { GlobalVariable *SGV = I; GlobalVariable *DGV = 0; // Check to see if may have to link the global. -if (SGV-hasName() !SGV-hasInternalLinkage()) - if (!(DGV = Dest-getGlobalVariable(SGV-getName(), - SGV-getType()-getElementType( { -std::mapstd::string, GlobalValue*::iterator EGV = - GlobalsByName.find(SGV-getName()); -if (EGV != GlobalsByName.end()) - DGV =
[llvm-commits] CVS: llvm/tools/opt/opt.cpp
Changes in directory llvm/tools/opt: opt.cpp updated: 1.129 - 1.130 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -1) opt.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.129 llvm/tools/opt/opt.cpp:1.130 --- llvm/tools/opt/opt.cpp:1.129Sat Feb 3 17:15:56 2007 +++ llvm/tools/opt/opt.cpp Mon Feb 5 14:47:22 2007 @@ -178,7 +178,6 @@ PM.add(createVerifierPass()); // Verify that input is correct addPass(PM, createLowerSetJmpPass()); // Lower llvm.setjmp/.longjmp - addPass(PM, createFunctionResolvingPass());// Resolve (...) functions // If the -strip-debug command line option was specified, do it. if (StripDebug) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Constants.cpp Function.cpp Globals.cpp Instruction.cpp Module.cpp SymbolTableListTraitsImpl.h Type.cpp Value.cpp ValueSymbolTable.cpp Verifier.cpp Sym
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.259 - 1.260 Constants.cpp updated: 1.207 - 1.208 Function.cpp updated: 1.110 - 1.111 Globals.cpp updated: 1.14 - 1.15 Instruction.cpp updated: 1.62 - 1.63 Module.cpp updated: 1.75 - 1.76 SymbolTableListTraitsImpl.h updated: 1.8 - 1.9 Type.cpp updated: 1.167 - 1.168 Value.cpp updated: 1.60 - 1.61 ValueSymbolTable.cpp updated: 1.3 - 1.4 Verifier.cpp updated: 1.189 - 1.190 SymbolTable.cpp (r1.66) removed --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+57 -144) AsmWriter.cpp |2 Constants.cpp |2 Function.cpp|6 -- Globals.cpp |1 Instruction.cpp |1 Module.cpp | 112 +++- SymbolTableListTraitsImpl.h |6 +- Type.cpp|1 Value.cpp | 15 +++-- ValueSymbolTable.cpp| 27 +++--- Verifier.cpp| 28 +-- 11 files changed, 57 insertions(+), 144 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.259 llvm/lib/VMCore/AsmWriter.cpp:1.260 --- llvm/lib/VMCore/AsmWriter.cpp:1.259 Fri Feb 2 07:54:55 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Feb 5 14:47:20 2007 @@ -24,7 +24,7 @@ #include llvm/Instruction.h #include llvm/Instructions.h #include llvm/Module.h -#include llvm/SymbolTable.h +#include llvm/ValueSymbolTable.h #include llvm/TypeSymbolTable.h #include llvm/ADT/StringExtras.h #include llvm/ADT/STLExtras.h Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.207 llvm/lib/VMCore/Constants.cpp:1.208 --- llvm/lib/VMCore/Constants.cpp:1.207 Thu Feb 1 20:16:22 2007 +++ llvm/lib/VMCore/Constants.cpp Mon Feb 5 14:47:20 2007 @@ -16,7 +16,6 @@ #include llvm/DerivedTypes.h #include llvm/GlobalValue.h #include llvm/Instructions.h -#include llvm/SymbolTable.h #include llvm/Module.h #include llvm/ADT/StringExtras.h #include llvm/Support/Compiler.h @@ -24,6 +23,7 @@ #include llvm/Support/ManagedStatic.h #include llvm/Support/MathExtras.h #include algorithm +#include map using namespace llvm; //===--===// Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.110 llvm/lib/VMCore/Function.cpp:1.111 --- llvm/lib/VMCore/Function.cpp:1.110 Fri Jan 26 02:01:30 2007 +++ llvm/lib/VMCore/Function.cppMon Feb 5 14:47:20 2007 @@ -7,8 +7,7 @@ // //===--===// // -// This file implements the Function GlobalVariable classes for the VMCore -// library. +// This file implements the Function class for the VMCore library. // //===--===// @@ -82,7 +81,7 @@ BasicBlocks.setParent(this); ArgumentList.setItemParent(this); ArgumentList.setParent(this); - SymTab = new SymbolTable(); + SymTab = new ValueSymbolTable(); assert((getReturnType()-isFirstClassType() ||getReturnType() == Type::VoidTy) LLVM functions cannot return aggregate values!); @@ -138,7 +137,6 @@ getParent()-getFunctionList().erase(this); } - // dropAllReferences() - This function causes all the subinstructions to let // go of all references that they are maintaining. This allows one to // 'delete' a whole class at a time, even though there may be circular Index: llvm/lib/VMCore/Globals.cpp diff -u llvm/lib/VMCore/Globals.cpp:1.14 llvm/lib/VMCore/Globals.cpp:1.15 --- llvm/lib/VMCore/Globals.cpp:1.14Sat Sep 30 16:31:26 2006 +++ llvm/lib/VMCore/Globals.cpp Mon Feb 5 14:47:20 2007 @@ -15,7 +15,6 @@ #include llvm/GlobalVariable.h #include llvm/DerivedTypes.h #include llvm/Module.h -#include llvm/SymbolTable.h #include llvm/Support/LeakDetector.h using namespace llvm; Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.62 llvm/lib/VMCore/Instruction.cpp:1.63 --- llvm/lib/VMCore/Instruction.cpp:1.62Wed Jan 3 20:15:37 2007 +++ llvm/lib/VMCore/Instruction.cpp Mon Feb 5 14:47:20 2007 @@ -14,7 +14,6 @@ #include llvm/Type.h #include llvm/Instructions.h #include llvm/Function.h -#include llvm/SymbolTable.h #include llvm/Support/LeakDetector.h using namespace llvm; Index: llvm/lib/VMCore/Module.cpp diff -u llvm/lib/VMCore/Module.cpp:1.75 llvm/lib/VMCore/Module.cpp:1.76 --- llvm/lib/VMCore/Module.cpp:1.75 Sat Feb 3 18:40:42 2007 +++ llvm/lib/VMCore/Module.cpp Mon Feb 5
[llvm-commits] CVS: llvm/test/Transforms/FunctionResolve/.cvsignore 2002-08-19-ResolveGlobalVars.ll 2002-08-19-ResolveGlobalVarsEasier.ll 2002-11-07-RetMismatch.ll 2002-11-09-ExternFn.ll 2003-04-18-Fo
Changes in directory llvm/test/Transforms/FunctionResolve: .cvsignore (r1.1) removed 2002-08-19-ResolveGlobalVars.ll (r1.8) removed 2002-08-19-ResolveGlobalVarsEasier.ll (r1.6) removed 2002-11-07-RetMismatch.ll (r1.5) removed 2002-11-09-ExternFn.ll (r1.6) removed 2003-04-18-ForwardDeclGlobal.ll (r1.5) removed 2003-05-21-MissingArguments.ll (r1.3) removed 2003-05-31-AllInternalDecls.ll (r1.2) removed 2003-05-31-FuncPointerResolve.ll (r1.5) removed 2003-05-31-InternalDecl.ll (r1.5) removed 2003-06-18-TypePromotion.ll (r1.2) removed 2003-07-23-CPR-Reference.ll (r1.3) removed 2003-08-23-ArgumentWarning.ll (r1.5) removed 2003-10-21-GlobalResolveHack.ll (r1.4) removed 2003-11-20-BogusResolveWarning.ll (r1.2) removed basictest.ll (r1.5) removed dg.exp (r1.3) removed retmismatch1.ll (r1.6) removed retmismatch2.ll (r1.6) removed retmismatch3.ll (r1.4) removed --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/IPO/StripDeadPrototypes.cpp
Create a pass to strip dead function declarations (prototypes). This is for use by llvm-extract and bugpoint. Nice, thanks! + namespace { + + /// @brief Pass to remove unused function declarations. + class StripDeadPrototypesPass : public ModulePass { Please use the horrible VISIBILITY_HIDDEN annotation thing. + public: + StripDeadPrototypesPass() { } + virtual bool runOnModule(Module M); + }; + RegisterPassStripDeadPrototypesPass X(strip-dead-prototypes, + Strip Unused Function Prototypes); + + bool StripDeadPrototypesPass::runOnModule(Module M) { Pedantic: Please end the anonymous namespace before the out of line method. It doesn't need to be nested in the namespace, and this reduces the lexical size of the namespace. Thanks Reid! -Chris + // Collect all the functions we want to erase + std::vectorFunction* FuncsToErase; + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (I-isDeclaration() // Function must be only a prototype + I-use_empty()) { // Function must not be used + FuncsToErase.push_back((*I)); + } + + // Erase the functions + for (std::vectorFunction*::iterator I = FuncsToErase.begin(), +E = FuncsToErase.end(); I != E; ++I ) + (*I)-eraseFromParent(); + + // Increment the statistic + NumDeadPrototypes += FuncsToErase.size(); + + // Return an indication of whether we changed anything or not. + return !FuncsToErase.empty(); + } + + } // end anonymous namespace + + ModulePass *llvm::createStripDeadPrototypesPass() { + return new StripDeadPrototypesPass(); + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc4: nested function support (w/o trampolines)
This patch adds support for nested subroutines, but not for trampolines (used for taking pointers to nested subroutines; implementing support for trampolines is more tricky since it needs help from the code generators). There are no changes to LLVM itself. The patch is quite simple because gcc already does the heavy lifting - all that's needed is to emit the static chains when converting to LLVM. The static chain is passed in a register as an additional parameter. For example, consider int nest(int n) { int a; void z(void) { a = 1; } z(); return a; } gcc turns z into void z(struct frame* chain) { chain-a = 1; } and nest into int nest(int n) { struct frame FRAME; int a; z(FRAME); return FRAME.a; } where struct frame is a record with one integer field called a. gcc introduces struct frame to hold all the local variables in the parent nest that are accessed by the child z. It rewrites all references to these variables to refer to the corresponding FRAME fields instead, in both the parent and child. It leaves the old variable declarations on the stack (which is why int a; is still present), but since they are no longer used, the optimizers will remove them. This patch only touches emission of nested function bodies and calls to nested functions. It emits z as define internal void @z(%struct.frame* inreg %chain) {...} and the call becomes call void @z( %struct.frame* %FRAME inreg ) It doesn't try to teach ConvertType to correctly emit local function types, since gcc doesn't put enough information in the function type to do this, and it's not needed anyway since llvm-convert has enough fix up dud prototypes code to handle this situation too. There are a bunch of gcc testcases for nested functions. They all worked as expected [1], except for those involving variable sized objects (which blew up LLVM), and some twisted examples which blew up the gcc nested function code (i.e. long before reaching llvm-convert and this patch). The variable sized object problems don't seem to have anything to do with nested functions. Enjoy! Duncan. [1] For example, the tests using trampolines and/or non-local gotos failed: they are not yet supported. Index: gcc.llvm.master/gcc/llvm-backend.cpp === --- gcc.llvm.master.orig/gcc/llvm-backend.cpp 2007-02-02 09:15:31.0 +0100 +++ gcc.llvm.master/gcc/llvm-backend.cpp 2007-02-04 09:39:30.0 +0100 @@ -414,9 +414,9 @@ // llvm_emit_code_for_current_function - Top level interface for emitting a // function to the .s file. void llvm_emit_code_for_current_function(tree fndecl) { - if (cfun-static_chain_decl || cfun-nonlocal_goto_save_area) -sorry(%Jnested functions not supported by LLVM, fndecl); - + if (cfun-nonlocal_goto_save_area) +sorry(%Jnon-local gotos not supported by LLVM, fndecl); + if (errorcount || sorrycount) { TREE_ASM_WRITTEN(fndecl) = 1; return; // Do not process broken code. @@ -690,7 +690,7 @@ if (FnEntry == 0) { unsigned CC; const FunctionType *Ty = -TheTypeConverter-ConvertFunctionType(TREE_TYPE(decl), CC); +TheTypeConverter-ConvertFunctionType(TREE_TYPE(decl), NULL, CC); FnEntry = new Function(Ty, Function::ExternalLinkage, Name, TheModule); FnEntry-setCallingConv(CC); Index: gcc.llvm.master/gcc/llvm-convert.cpp === --- gcc.llvm.master.orig/gcc/llvm-convert.cpp 2007-02-02 09:19:08.0 +0100 +++ gcc.llvm.master/gcc/llvm-convert.cpp 2007-02-04 18:37:57.0 +0100 @@ -259,6 +259,7 @@ Name = IDENTIFIER_POINTER(ID); // Determine the FunctionType and calling convention for this function. + tree static_chain = cfun-static_chain_decl; const FunctionType *FTy; unsigned CallingConv; @@ -270,16 +271,19 @@ if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0) { FTy = TheTypeConverter-ConvertArgListToFnType(TREE_TYPE(TREE_TYPE(FnDecl)), DECL_ARGUMENTS(FnDecl), + static_chain, CallingConv); #ifdef TARGET_ADJUST_LLVM_CC TARGET_ADJUST_LLVM_CC(CallingConv, TREE_TYPE(FnDecl)); #endif } else { // Otherwise, just get the type from the function itself. -FTy = TheTypeConverter-ConvertFunctionType(TREE_TYPE(FnDecl), CallingConv); +FTy = TheTypeConverter-ConvertFunctionType(TREE_TYPE(FnDecl), + static_chain, + CallingConv); } - // If we've already see this function and created a prototype, and if the + // If we've already seen this function and created a prototype, and if the // proto has the right LLVM type, just use it. if (DECL_LLVM_SET_P(FnDecl) castPointerType(DECL_LLVM(FnDecl)-getType())-getElementType() == FTy){ @@ -370,8 +374,11 @@ // Handle the DECL_RESULT.
[llvm-commits] CVS: llvm/tools/llvm-extract/llvm-extract.cpp
Changes in directory llvm/tools/llvm-extract: llvm-extract.cpp updated: 1.35 - 1.36 --- Log message: For PR411: http://llvm.org/PR411 : Change getNamedFunction - getFunction Make llvm-extract run the StripDeadPrototypes pass. --- Diffs of the changes: (+2 -1) llvm-extract.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/tools/llvm-extract/llvm-extract.cpp diff -u llvm/tools/llvm-extract/llvm-extract.cpp:1.35 llvm/tools/llvm-extract/llvm-extract.cpp:1.36 --- llvm/tools/llvm-extract/llvm-extract.cpp:1.35 Mon Feb 5 14:47:21 2007 +++ llvm/tools/llvm-extract/llvm-extract.cppMon Feb 5 15:17:53 2007 @@ -64,7 +64,7 @@ } // Figure out which function we should extract -Function *F = M.get()-getNamedFunction(ExtractFunc); +Function *F = M.get()-getFunction(ExtractFunc); if (F == 0) { cerr argv[0] : program doesn't contain function named ' ExtractFunc '!\n; @@ -80,6 +80,7 @@ if (!DeleteFn) Passes.add(createGlobalDCEPass()); // Delete unreachable globals Passes.add(createDeadTypeEliminationPass()); // Remove dead types... +Passes.add(createStripDeadPrototypesPass()); // Remove dead func decls std::ostream *Out = 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.37 - 1.38 --- Log message: For PR411: http://llvm.org/PR411 : Adjust to changes in Module interface: getMainFunction() - getFunction(main) getNamedFunction(X) - getFunction(X) --- Diffs of the changes: (+2 -2) CppWriter.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.37 llvm/tools/llvm2cpp/CppWriter.cpp:1.38 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.37 Mon Feb 5 14:47:21 2007 +++ llvm/tools/llvm2cpp/CppWriter.cpp Mon Feb 5 15:19:13 2007 @@ -1544,7 +1544,7 @@ } void CppWriter::printInline(const std::string fname, const std::string func) { - const Function* F = TheModule-getNamedFunction(func); + const Function* F = TheModule-getFunction(func); if (!F) { error(std::string(Function ') + func + ' not found in input module); return; @@ -1719,7 +1719,7 @@ const std::string fname, // Name of generated function const std::string funcName // Name of function to generate ) { - const Function* F = TheModule-getNamedFunction(funcName); + const Function* F = TheModule-getFunction(funcName); if (!F) { error(std::string(Function ') + funcName + ' not found in input module); return; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp
Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.55 - 1.56 --- Log message: For PR411: http://llvm.org/PR411 : Adjust to changes in Module interface: getMainFunction() - getFunction(main) getNamedFunction(X) - getFunction(X) --- Diffs of the changes: (+1 -1) LinkArchives.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.55 llvm/lib/Linker/LinkArchives.cpp:1.56 --- llvm/lib/Linker/LinkArchives.cpp:1.55 Tue Jan 30 14:08:37 2007 +++ llvm/lib/Linker/LinkArchives.cppMon Feb 5 15:19:13 2007 @@ -43,7 +43,7 @@ // If the program doesn't define a main, try pulling one in from a .a file. // This is needed for programs where the main function is defined in an // archive, such f2c'd programs. - Function *Main = M-getMainFunction(); + Function *Main = M-getFunction(main); if (Main == 0 || Main-isDeclaration()) UndefinedSymbols.insert(main); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs UpgradeParser.y UpgradeParser.y.cvs
Changes in directory llvm/tools/llvm-upgrade: UpgradeParser.cpp.cvs updated: 1.56 - 1.57 UpgradeParser.y updated: 1.57 - 1.58 UpgradeParser.y.cvs updated: 1.55 - 1.56 --- Log message: For PR411: http://llvm.org/PR411 : Adjust to changes in Module interface: getMainFunction() - getFunction(main) getNamedFunction(X) - getFunction(X) --- Diffs of the changes: (+18 -18) UpgradeParser.cpp.cvs | 12 ++-- UpgradeParser.y | 12 ++-- UpgradeParser.y.cvs | 12 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.56 llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.57 --- llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.56 Mon Feb 5 14:47:21 2007 +++ llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs Mon Feb 5 15:19:13 2007 @@ -929,7 +929,7 @@ if (const FunctionType *FTy = dyn_castFunctionType(PTy-getElementType())) if (Function *OtherF = -CurModule.CurrentModule-getNamedFunction(DID.getName())) +CurModule.CurrentModule-getFunction(DID.getName())) if (FuncTysDifferOnlyBySRet(FTy,OtherF-getFunctionType())) { V-replaceAllUsesWith(ConstantExpr::getBitCast(OtherF, PTy)); fixed = true; @@ -1677,10 +1677,10 @@ //Not all functions use vaarg, so make a second check for ObsoleteVarArgs { Function* F; -if ((F = Result-getNamedFunction(llvm.va_start)) +if ((F = Result-getFunction(llvm.va_start)) F-getFunctionType()-getNumParams() == 0) ObsoleteVarArgs = true; -if((F = Result-getNamedFunction(llvm.va_copy)) +if((F = Result-getFunction(llvm.va_copy)) F-getFunctionType()-getNumParams() == 1) ObsoleteVarArgs = true; } @@ -1691,7 +1691,7 @@ } if(ObsoleteVarArgs) { -if(Function* F = Result-getNamedFunction(llvm.va_start)) { +if(Function* F = Result-getFunction(llvm.va_start)) { if (F-arg_size() != 0) { error(Obsolete va_start takes 0 argument); return 0; @@ -1720,7 +1720,7 @@ Result-getFunctionList().erase(F); } -if(Function* F = Result-getNamedFunction(llvm.va_end)) { +if(Function* F = Result-getFunction(llvm.va_end)) { if(F-arg_size() != 1) { error(Obsolete va_end takes 1 argument); return 0; @@ -1746,7 +1746,7 @@ Result-getFunctionList().erase(F); } -if(Function* F = Result-getNamedFunction(llvm.va_copy)) { +if(Function* F = Result-getFunction(llvm.va_copy)) { if(F-arg_size() != 1) { error(Obsolete va_copy takes 1 argument); return 0; Index: llvm/tools/llvm-upgrade/UpgradeParser.y diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.57 llvm/tools/llvm-upgrade/UpgradeParser.y:1.58 --- llvm/tools/llvm-upgrade/UpgradeParser.y:1.57Mon Feb 5 14:47:21 2007 +++ llvm/tools/llvm-upgrade/UpgradeParser.y Mon Feb 5 15:19:13 2007 @@ -569,7 +569,7 @@ if (const FunctionType *FTy = dyn_castFunctionType(PTy-getElementType())) if (Function *OtherF = -CurModule.CurrentModule-getNamedFunction(DID.getName())) +CurModule.CurrentModule-getFunction(DID.getName())) if (FuncTysDifferOnlyBySRet(FTy,OtherF-getFunctionType())) { V-replaceAllUsesWith(ConstantExpr::getBitCast(OtherF, PTy)); fixed = true; @@ -1317,10 +1317,10 @@ //Not all functions use vaarg, so make a second check for ObsoleteVarArgs { Function* F; -if ((F = Result-getNamedFunction(llvm.va_start)) +if ((F = Result-getFunction(llvm.va_start)) F-getFunctionType()-getNumParams() == 0) ObsoleteVarArgs = true; -if((F = Result-getNamedFunction(llvm.va_copy)) +if((F = Result-getFunction(llvm.va_copy)) F-getFunctionType()-getNumParams() == 1) ObsoleteVarArgs = true; } @@ -1331,7 +1331,7 @@ } if(ObsoleteVarArgs) { -if(Function* F = Result-getNamedFunction(llvm.va_start)) { +if(Function* F = Result-getFunction(llvm.va_start)) { if (F-arg_size() != 0) { error(Obsolete va_start takes 0 argument); return 0; @@ -1360,7 +1360,7 @@ Result-getFunctionList().erase(F); } -if(Function* F = Result-getNamedFunction(llvm.va_end)) { +if(Function* F = Result-getFunction(llvm.va_end)) { if(F-arg_size() != 1) { error(Obsolete va_end takes 1 argument); return 0; @@ -1386,7 +1386,7 @@ Result-getFunctionList().erase(F); } -if(Function* F = Result-getNamedFunction(llvm.va_copy)) { +if(Function* F = Result-getFunction(llvm.va_copy)) { if(F-arg_size() != 1) { error(Obsolete va_copy takes 1 argument); return 0; Index: llvm/tools/llvm-upgrade/UpgradeParser.y.cvs diff -u
[llvm-commits] CVS: llvm/tools/lli/lli.cpp
Changes in directory llvm/tools/lli: lli.cpp updated: 1.65 - 1.66 --- Log message: For PR411: http://llvm.org/PR411 : Adjust to changes in Module interface: getMainFunction() - getFunction(main) getNamedFunction(X) - getFunction(X) --- Diffs of the changes: (+1 -1) lli.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/lli/lli.cpp diff -u llvm/tools/lli/lli.cpp:1.65 llvm/tools/lli/lli.cpp:1.66 --- llvm/tools/lli/lli.cpp:1.65 Mon Jan 8 01:36:34 2007 +++ llvm/tools/lli/lli.cpp Mon Feb 5 15:19:13 2007 @@ -103,7 +103,7 @@ // using the contents of Args to determine argc argv, and the contents of // EnvVars to determine envp. // -Function *Fn = MP-getModule()-getMainFunction(); +Function *Fn = MP-getModule()-getFunction(main); if (!Fn) { std::cerr 'main' function not found in module.\n; return -1; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/SmallPtrSet.cpp
Changes in directory llvm/lib/Support: SmallPtrSet.cpp updated: 1.3 - 1.4 --- Log message: Fix a bug in smallptrset::erase: in the small case, return true if the element was in the set. --- Diffs of the changes: (+1 -1) SmallPtrSet.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/SmallPtrSet.cpp diff -u llvm/lib/Support/SmallPtrSet.cpp:1.3 llvm/lib/Support/SmallPtrSet.cpp:1.4 --- llvm/lib/Support/SmallPtrSet.cpp:1.3Sat Jan 27 01:59:10 2007 +++ llvm/lib/Support/SmallPtrSet.cppMon Feb 5 17:10:31 2007 @@ -56,7 +56,7 @@ // Clear the end element. E[-1] = getEmptyMarker(); --NumElements; -return false; +return true; } return false; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Changes in directory llvm/lib/Transforms/Utils: PromoteMemoryToRegister.cpp updated: 1.89 - 1.90 --- Log message: Switch InsertedPHINodes back to SmallPtrSet now that the SmallPtrSet::erase bug is fixed. --- Diffs of the changes: (+6 -6) PromoteMemoryToRegister.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp diff -u llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.89 llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.90 --- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.89 Mon Feb 5 16:28:52 2007 +++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Feb 5 17:11:37 2007 @@ -115,7 +115,7 @@ private: void MarkDominatingPHILive(BasicBlock *BB, unsigned AllocaNum, - std::setPHINode* DeadPHINodes); + SmallPtrSetPHINode*, 16 DeadPHINodes); bool PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI); void PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vectorAllocaInst* AIs); @@ -123,7 +123,7 @@ void RenamePass(BasicBlock *BB, BasicBlock *Pred, std::vectorValue* IncVals); bool QueuePhiNode(BasicBlock *BB, unsigned AllocaIdx, unsigned Version, - std::setPHINode* InsertedPHINodes); + SmallPtrSetPHINode*, 16 InsertedPHINodes); }; } // end of anonymous namespace @@ -271,7 +271,7 @@ // dominance frontier of EACH basic-block we have a write in. // unsigned CurrentVersion = 0; -std::setPHINode* InsertedPHINodes; +SmallPtrSetPHINode*, 16 InsertedPHINodes; std::vectorunsigned DFBlocks; while (!DefiningBlocks.empty()) { BasicBlock *BB = DefiningBlocks.back(); @@ -315,7 +315,7 @@ UsingBlocks.clear(); // If there are any PHI nodes which are now known to be dead, remove them! -for (std::setPHINode*::iterator I = InsertedPHINodes.begin(), +for (SmallPtrSetPHINode*, 16::iterator I = InsertedPHINodes.begin(), E = InsertedPHINodes.end(); I != E; ++I) { PHINode *PN = *I; std::vectorPHINode* BBPNs = NewPhiNodes[PN-getParent()]; @@ -489,7 +489,7 @@ // DeadPHINodes set are removed. // void PromoteMem2Reg::MarkDominatingPHILive(BasicBlock *BB, unsigned AllocaNum, - std::setPHINode* DeadPHINodes) { + SmallPtrSetPHINode*, 16 DeadPHINodes) { // Scan the immediate dominators of this block looking for a block which has a // PHI node for Alloca num. If we find it, mark the PHI node as being alive! for (DominatorTree::Node *N = DT[BB]; N; N = N-getIDom()) { @@ -630,7 +630,7 @@ // bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB, unsigned AllocaNo, unsigned Version, - std::setPHINode* InsertedPHINodes) { + SmallPtrSetPHINode*, 16 InsertedPHINodes) { // Look up the basic-block in question. std::vectorPHINode* BBPNs = NewPhiNodes[BB]; if (BBPNs.empty()) BBPNs.resize(Allocas.size()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/Makefile
Changes in directory llvm: Makefile updated: 1.68 - 1.69 --- Log message: Add a show-footprint target to run du a few times to show how much disk space a build tree's objects are consuming. --- Diffs of the changes: (+6 -0) Makefile |6 ++ 1 files changed, 6 insertions(+) Index: llvm/Makefile diff -u llvm/Makefile:1.68 llvm/Makefile:1.69 --- llvm/Makefile:1.68 Mon Feb 5 03:43:17 2007 +++ llvm/Makefile Mon Feb 5 17:18:58 2007 @@ -110,4 +110,10 @@ rpm: $(LLVM_OBJ_ROOT)/llvm.spec rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec +show-footprint: + $(Verb) du -sk $(LibDir) + $(Verb) du -sk $(ToolDir) + $(Verb) du -sk $(ExmplDir) + $(Verb) du -sk $(ObjDir) + .PHONY: srpm rpm ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Support/StableBasicBlockNumbering.h
Changes in directory llvm/include/llvm/Support: StableBasicBlockNumbering.h updated: 1.2 - 1.3 --- Log message: StableBasicBlockNumbering is conceptually just a wrapper around UniqueVector, so we should actually use a UniqueVector to implement it. --- Diffs of the changes: (+11 -22) StableBasicBlockNumbering.h | 33 +++-- 1 files changed, 11 insertions(+), 22 deletions(-) Index: llvm/include/llvm/Support/StableBasicBlockNumbering.h diff -u llvm/include/llvm/Support/StableBasicBlockNumbering.h:1.2 llvm/include/llvm/Support/StableBasicBlockNumbering.h:1.3 --- llvm/include/llvm/Support/StableBasicBlockNumbering.h:1.2 Thu Apr 21 15:44:59 2005 +++ llvm/include/llvm/Support/StableBasicBlockNumbering.h Mon Feb 5 17:19:24 2007 @@ -18,18 +18,13 @@ #define LLVM_SUPPORT_STABLEBASICBLOCKNUMBERING_H #include llvm/Function.h -#include map +#include llvm/ADT/UniqueVector.h namespace llvm { class StableBasicBlockNumbering { -// BasicBlockNumbering - Holds a numbering of the basic blocks in the -// function in a stable order that does not depend on their address. -std::mapBasicBlock*, unsigned BasicBlockNumbering; - -// NumberedBasicBlock - Holds the inverse mapping of BasicBlockNumbering. -std::vectorBasicBlock* NumberedBasicBlock; +// BBNumbering - Holds the numbering. +UniqueVectorBasicBlock* BBNumbering; public: - StableBasicBlockNumbering(Function *F = 0) { if (F) compute(*F); } @@ -37,33 +32,27 @@ /// compute - If we have not computed a numbering for the function yet, do /// so. void compute(Function F) { - if (NumberedBasicBlock.empty()) { -unsigned n = 0; -for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I, ++n) { - NumberedBasicBlock.push_back(I); - BasicBlockNumbering[I] = n; -} + if (BBNumbering.empty()) { +for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) + BBNumbering.insert(I); } } /// getNumber - Return the ID number for the specified BasicBlock. /// unsigned getNumber(BasicBlock *BB) const { - std::mapBasicBlock*, unsigned::const_iterator I = -BasicBlockNumbering.find(BB); - assert(I != BasicBlockNumbering.end() - Invalid basic block or numbering not computed!); - return I-second; + unsigned Idx = BBNumbering.idFor(BB); + assert(Idx Invalid basic block or numbering not computed!); + return Idx-1; } /// getBlock - Return the BasicBlock corresponding to a particular ID. /// BasicBlock *getBlock(unsigned N) const { - assert(N NumberedBasicBlock.size() + assert(N BBNumbering.size() Block ID out of range or numbering not computed!); - return NumberedBasicBlock[N]; + return BBNumbering[N+1]; } - }; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp EdgeProfiling.cpp EmitFunctions.cpp RSProfiling.cpp TraceBasicBlocks.cpp
Changes in directory llvm/lib/Transforms/Instrumentation: BlockProfiling.cpp updated: 1.21 - 1.22 EdgeProfiling.cpp updated: 1.11 - 1.12 EmitFunctions.cpp updated: 1.28 - 1.29 RSProfiling.cpp updated: 1.18 - 1.19 TraceBasicBlocks.cpp updated: 1.22 - 1.23 --- Log message: Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in the Transforms library. This reduces debug library size by 132 KB, debug binary size by 376 KB, and reduces link time for llvm tools slightly. --- Diffs of the changes: (+15 -10) BlockProfiling.cpp |3 ++- EdgeProfiling.cpp|3 ++- EmitFunctions.cpp|3 ++- RSProfiling.cpp | 13 +++-- TraceBasicBlocks.cpp |3 ++- 5 files changed, 15 insertions(+), 10 deletions(-) Index: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.21 llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.22 --- llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.21 Mon Feb 5 15:19:13 2007 +++ llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp Mon Feb 5 17:32:05 2007 @@ -23,6 +23,7 @@ #include llvm/DerivedTypes.h #include llvm/Module.h #include llvm/Pass.h +#include llvm/Support/Compiler.h #include llvm/Support/Streams.h #include llvm/Transforms/Instrumentation.h #include RSProfiling.h @@ -30,7 +31,7 @@ using namespace llvm; namespace { - class FunctionProfiler : public RSProfilers_std { + class VISIBILITY_HIDDEN FunctionProfiler : public RSProfilers_std { bool runOnModule(Module M); }; Index: llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.11 llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.12 --- llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.11 Mon Feb 5 15:19:13 2007 +++ llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp Mon Feb 5 17:32:05 2007 @@ -22,6 +22,7 @@ #include llvm/DerivedTypes.h #include llvm/Module.h #include llvm/Pass.h +#include llvm/Support/Compiler.h #include llvm/Support/Streams.h #include llvm/Transforms/Utils/BasicBlockUtils.h #include llvm/Transforms/Instrumentation.h @@ -29,7 +30,7 @@ using namespace llvm; namespace { - class EdgeProfiler : public ModulePass { + class VISIBILITY_HIDDEN EdgeProfiler : public ModulePass { bool runOnModule(Module M); }; Index: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp diff -u llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.28 llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.29 --- llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.28 Tue Jan 30 14:08:38 2007 +++ llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp Mon Feb 5 17:32:05 2007 @@ -24,6 +24,7 @@ #include llvm/Module.h #include llvm/Pass.h #include llvm/Support/CFG.h +#include llvm/Support/Compiler.h #include llvm/Transforms/Instrumentation.h using namespace llvm; @@ -36,7 +37,7 @@ BLACK }; - struct EmitFunctionTable : public ModulePass { + struct VISIBILITY_HIDDEN EmitFunctionTable : public ModulePass { bool runOnModule(Module M); }; Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.18 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.19 --- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.18Tue Jan 30 14:08:38 2007 +++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Mon Feb 5 17:32:05 2007 @@ -40,6 +40,7 @@ #include llvm/Transforms/Scalar.h #include llvm/Transforms/Utils/BasicBlockUtils.h #include llvm/Support/CommandLine.h +#include llvm/Support/Compiler.h #include llvm/Support/Debug.h #include llvm/Transforms/Instrumentation.h #include RSProfiling.h @@ -66,7 +67,7 @@ /// NullProfilerRS - The basic profiler that does nothing. It is the default /// profiler and thus terminates RSProfiler chains. It is useful for /// measuring framework overhead - class NullProfilerRS : public RSProfilers { + class VISIBILITY_HIDDEN NullProfilerRS : public RSProfilers { public: bool isProfiling(Value* v) { return false; @@ -85,7 +86,7 @@ static RegisterAnalysisGroupRSProfilers, true NPT(NP); /// Chooser - Something that chooses when to make a sample of the profiled code - class Chooser { + class VISIBILITY_HIDDEN Chooser { public: /// ProcessChoicePoint - is called for each basic block inserted to choose /// between normal and sample code @@ -99,7 +100,7 @@ //Things that implement sampling policies //A global value that is read-mod-stored to choose when to sample. //A sample is taken when the global counter hits 0 - class GlobalRandomCounter : public Chooser { + class VISIBILITY_HIDDEN GlobalRandomCounter : public Chooser { GlobalVariable* Counter; Value* ResetValue; const Type* T; @@ -111,7 +112,7 @@ }; //Same is GRC, but allow register allocation of the
[llvm-commits] CVS: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Changes in directory llvm/lib/Transforms/Utils: PromoteMemoryToRegister.cpp updated: 1.91 - 1.92 --- Log message: With the last change, we no longer need both directions of mapping from BBNumbers. Instead of using a bi-directional mapping, just use a single densemap. This speeds up mem2reg on 176.gcc by 8%, from 1.3489 to 1.2485s. --- Diffs of the changes: (+8 -4) PromoteMemoryToRegister.cpp | 12 1 files changed, 8 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp diff -u llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.91 llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.92 --- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.91 Mon Feb 5 17:31:26 2007 +++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Feb 5 17:37:20 2007 @@ -23,11 +23,11 @@ #include llvm/Instructions.h #include llvm/Analysis/Dominators.h #include llvm/Analysis/AliasSetTracker.h +#include llvm/ADT/DenseMap.h #include llvm/ADT/SmallPtrSet.h #include llvm/ADT/SmallVector.h #include llvm/ADT/StringExtras.h #include llvm/Support/CFG.h -#include llvm/Support/StableBasicBlockNumbering.h #include llvm/Support/Compiler.h #include algorithm using namespace llvm; @@ -88,7 +88,7 @@ /// BBNumbers - Contains a stable numbering of basic blocks to avoid /// non-determinstic behavior. -StableBasicBlockNumbering BBNumbers; +DenseMapBasicBlock*, unsigned BBNumbers; public: PromoteMem2Reg(const std::vectorAllocaInst* A, @@ -265,7 +265,11 @@ // If we haven't computed a numbering for the BB's in the function, do so // now. -BBNumbers.compute(F); +if (BBNumbers.empty()) { + unsigned ID = 0; + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) +BBNumbers[I] = ID++; +} // Compute the locations where PhiNodes need to be inserted. Look at the // dominance frontier of EACH basic-block we have a write in. @@ -289,7 +293,7 @@ // processing blocks in order of the occurance in the function. for (DominanceFrontier::DomSetType::const_iterator P = S.begin(), PE = S.end(); P != PE; ++P) - DFBlocks.push_back(std::make_pair(BBNumbers.getNumber(*P), *P)); + DFBlocks.push_back(std::make_pair(BBNumbers[*P], *P)); // Sort by which the block ordering in the function. std::sort(DFBlocks.begin(), DFBlocks.end()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp CallGraph.cpp GlobalsModRef.cpp
Changes in directory llvm/lib/Analysis/IPA: Andersens.cpp updated: 1.44 - 1.45 CallGraph.cpp updated: 1.64 - 1.65 GlobalsModRef.cpp updated: 1.28 - 1.29 --- Log message: Make classes in anonymous namespaces use VISIBILITY_HIDDEN to help reduce LLVM's footprint and speed up linking. --- Diffs of the changes: (+10 -6) Andersens.cpp |5 +++-- CallGraph.cpp |3 ++- GlobalsModRef.cpp |8 +--- 3 files changed, 10 insertions(+), 6 deletions(-) Index: llvm/lib/Analysis/IPA/Andersens.cpp diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.44 llvm/lib/Analysis/IPA/Andersens.cpp:1.45 --- llvm/lib/Analysis/IPA/Andersens.cpp:1.44Thu Feb 1 20:16:22 2007 +++ llvm/lib/Analysis/IPA/Andersens.cpp Mon Feb 5 17:42:17 2007 @@ -55,6 +55,7 @@ #include llvm/Instructions.h #include llvm/Module.h #include llvm/Pass.h +#include llvm/Support/Compiler.h #include llvm/Support/InstIterator.h #include llvm/Support/InstVisitor.h #include llvm/Analysis/AliasAnalysis.h @@ -71,8 +72,8 @@ STATISTIC(NumIndirectCallees , Number of indirect callees found); namespace { - class Andersens : public ModulePass, public AliasAnalysis, -private InstVisitorAndersens { + class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis, + private InstVisitorAndersens { /// Node class - This class is used to represent a memory object in the /// program, and is the primitive used to build the points-to graph. class Node { Index: llvm/lib/Analysis/IPA/CallGraph.cpp diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.64 llvm/lib/Analysis/IPA/CallGraph.cpp:1.65 --- llvm/lib/Analysis/IPA/CallGraph.cpp:1.64Tue Jan 30 14:08:37 2007 +++ llvm/lib/Analysis/IPA/CallGraph.cpp Mon Feb 5 17:42:17 2007 @@ -16,6 +16,7 @@ #include llvm/Module.h #include llvm/Instructions.h #include llvm/Support/CallSite.h +#include llvm/Support/Compiler.h #include llvm/Support/Streams.h #include ostream using namespace llvm; @@ -35,7 +36,7 @@ //===--===// // BasicCallGraph class definition // -class BasicCallGraph : public CallGraph, public ModulePass { +class VISIBILITY_HIDDEN BasicCallGraph : public CallGraph, public ModulePass { // Root is root of the call graph, or the external node if a 'main' function // couldn't be found. // Index: llvm/lib/Analysis/IPA/GlobalsModRef.cpp diff -u llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.28 llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.29 --- llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.28Tue Jan 30 14:08:37 2007 +++ llvm/lib/Analysis/IPA/GlobalsModRef.cpp Mon Feb 5 17:42:17 2007 @@ -23,8 +23,9 @@ #include llvm/DerivedTypes.h #include llvm/Analysis/AliasAnalysis.h #include llvm/Analysis/CallGraph.h -#include llvm/Support/InstIterator.h +#include llvm/Support/Compiler.h #include llvm/Support/CommandLine.h +#include llvm/Support/InstIterator.h #include llvm/ADT/Statistic.h #include llvm/ADT/SCCIterator.h #include set @@ -42,7 +43,7 @@ /// function in the program. Later, the entries for these functions are /// removed if the function is found to call an external function (in which /// case we know nothing about it. - struct FunctionRecord { + struct VISIBILITY_HIDDEN FunctionRecord { /// GlobalInfo - Maintain mod/ref info for all of the globals without /// addresses taken that are read or written (transitively) by this /// function. @@ -63,7 +64,8 @@ }; /// GlobalsModRef - The actual analysis pass. - class GlobalsModRef : public ModulePass, public AliasAnalysis { + class VISIBILITY_HIDDEN GlobalsModRef + : public ModulePass, public AliasAnalysis { /// NonAddressTakenGlobals - The globals that do not have their addresses /// taken. std::setGlobalValue* NonAddressTakenGlobals; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysisCounter.cpp AliasAnalysisEvaluator.cpp AliasDebugger.cpp AliasSetTracker.cpp BasicAliasAnalysis.cpp CFGPrinter.cpp InstCount.cpp LoadValueNumbering.c
Changes in directory llvm/lib/Analysis: AliasAnalysisCounter.cpp updated: 1.19 - 1.20 AliasAnalysisEvaluator.cpp updated: 1.32 - 1.33 AliasDebugger.cpp updated: 1.2 - 1.3 AliasSetTracker.cpp updated: 1.45 - 1.46 BasicAliasAnalysis.cpp updated: 1.102 - 1.103 CFGPrinter.cpp updated: 1.21 - 1.22 InstCount.cpp updated: 1.19 - 1.20 LoadValueNumbering.cpp updated: 1.36 - 1.37 ProfileInfo.cpp updated: 1.9 - 1.10 ProfileInfoLoaderPass.cpp updated: 1.17 - 1.18 ValueNumbering.cpp updated: 1.24 - 1.25 --- Log message: Make classes in anonymous namespaces use VISIBILITY_HIDDEN to help reduce LLVM's footprint and speed up linking. --- Diffs of the changes: (+28 -13) AliasAnalysisCounter.cpp |4 +++- AliasAnalysisEvaluator.cpp |3 ++- AliasDebugger.cpp |4 +++- AliasSetTracker.cpp|3 ++- BasicAliasAnalysis.cpp |2 +- CFGPrinter.cpp |5 +++-- InstCount.cpp |4 +++- LoadValueNumbering.cpp |3 ++- ProfileInfo.cpp|4 +++- ProfileInfoLoaderPass.cpp |3 ++- ValueNumbering.cpp |6 -- 11 files changed, 28 insertions(+), 13 deletions(-) Index: llvm/lib/Analysis/AliasAnalysisCounter.cpp diff -u llvm/lib/Analysis/AliasAnalysisCounter.cpp:1.19 llvm/lib/Analysis/AliasAnalysisCounter.cpp:1.20 --- llvm/lib/Analysis/AliasAnalysisCounter.cpp:1.19 Thu Dec 7 14:28:15 2006 +++ llvm/lib/Analysis/AliasAnalysisCounter.cpp Mon Feb 5 17:42:17 2007 @@ -17,6 +17,7 @@ #include llvm/Analysis/AliasAnalysis.h #include llvm/Assembly/Writer.h #include llvm/Support/CommandLine.h +#include llvm/Support/Compiler.h #include llvm/Support/Streams.h using namespace llvm; @@ -26,7 +27,8 @@ cl::optbool PrintAllFailures(count-aa-print-all-failed-queries, cl::ReallyHidden); - class AliasAnalysisCounter : public ModulePass, public AliasAnalysis { + class VISIBILITY_HIDDEN AliasAnalysisCounter + : public ModulePass, public AliasAnalysis { unsigned No, May, Must; unsigned NoMR, JustRef, JustMod, MR; const char *Name; Index: llvm/lib/Analysis/AliasAnalysisEvaluator.cpp diff -u llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.32 llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.33 --- llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.32 Thu Dec 7 14:28:15 2006 +++ llvm/lib/Analysis/AliasAnalysisEvaluator.cppMon Feb 5 17:42:17 2007 @@ -28,6 +28,7 @@ #include llvm/Target/TargetData.h #include llvm/Support/InstIterator.h #include llvm/Support/CommandLine.h +#include llvm/Support/Compiler.h #include llvm/Support/Streams.h #include set using namespace llvm; @@ -44,7 +45,7 @@ cl::optbool PrintRef(print-ref, cl::ReallyHidden); cl::optbool PrintModRef(print-modref, cl::ReallyHidden); - class AAEval : public FunctionPass { + class VISIBILITY_HIDDEN AAEval : public FunctionPass { unsigned NoAlias, MayAlias, MustAlias; unsigned NoModRef, Mod, Ref, ModRef; Index: llvm/lib/Analysis/AliasDebugger.cpp diff -u llvm/lib/Analysis/AliasDebugger.cpp:1.2 llvm/lib/Analysis/AliasDebugger.cpp:1.3 --- llvm/lib/Analysis/AliasDebugger.cpp:1.2 Tue Jan 30 14:08:36 2007 +++ llvm/lib/Analysis/AliasDebugger.cpp Mon Feb 5 17:42:17 2007 @@ -23,12 +23,14 @@ #include llvm/Constants.h #include llvm/DerivedTypes.h #include llvm/Analysis/AliasAnalysis.h +#include llvm/Support/Compiler.h #include set using namespace llvm; namespace { - class AliasDebugger : public ModulePass, public AliasAnalysis { + class VISIBILITY_HIDDEN AliasDebugger + : public ModulePass, public AliasAnalysis { //What we do is simple. Keep track of every value the AA could //know about, and verify that queries are one of those. Index: llvm/lib/Analysis/AliasSetTracker.cpp diff -u llvm/lib/Analysis/AliasSetTracker.cpp:1.45 llvm/lib/Analysis/AliasSetTracker.cpp:1.46 --- llvm/lib/Analysis/AliasSetTracker.cpp:1.45 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/AliasSetTracker.cpp Mon Feb 5 17:42:17 2007 @@ -18,6 +18,7 @@ #include llvm/Type.h #include llvm/Target/TargetData.h #include llvm/Assembly/Writer.h +#include llvm/Support/Compiler.h #include llvm/Support/InstIterator.h #include llvm/Support/Streams.h using namespace llvm; @@ -551,7 +552,7 @@ //===--===// namespace { - class AliasSetPrinter : public FunctionPass { + class VISIBILITY_HIDDEN AliasSetPrinter : public FunctionPass { AliasSetTracker *Tracker; public: virtual void getAnalysisUsage(AnalysisUsage AU) const { Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.102 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.103 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.102 Tue Jan 30 14:08:36 2007 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppMon Feb 5 17:42:17 2007 @@ -745,7 +745,7 @@ } namespace { - struct StringCompare { + struct VISIBILITY_HIDDEN StringCompare {
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.208 - 1.209 --- Log message: A value of 64 or fewer bits is valid if the ConstantInt has more then 64 bits. --- Diffs of the changes: (+2 -4) Constants.cpp |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.208 llvm/lib/VMCore/Constants.cpp:1.209 --- llvm/lib/VMCore/Constants.cpp:1.208 Mon Feb 5 14:47:20 2007 +++ llvm/lib/VMCore/Constants.cpp Mon Feb 5 17:47:56 2007 @@ -554,10 +554,9 @@ bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) { unsigned NumBits = castIntegerType(Ty)-getBitWidth(); // assert okay - assert(NumBits = 64 Not implemented: integers 64-bits); if (Ty == Type::Int1Ty) return Val == 0 || Val == 1; - if (NumBits == 64) + if (NumBits = 64) return true; // always true, has to fit in largest type uint64_t Max = (1ll NumBits) - 1; return Val = Max; @@ -565,10 +564,9 @@ bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) { unsigned NumBits = castIntegerType(Ty)-getBitWidth(); // assert okay - assert(NumBits = 64 Not implemented: integers 64-bits); if (Ty == Type::Int1Ty) return Val == 0 || Val == 1 || Val == -1; - if (NumBits == 64) + if (NumBits = 64) return true; // always true, has to fit in largest type int64_t Min = -(1ll (NumBits-1)); int64_t Max = (1ll (NumBits-1)) - 1; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp
Changes in directory llvm/lib/Target: TargetData.cpp updated: 1.84 - 1.85 --- Log message: Although targets are not required to support integers 64bits, TargetData must in order for backends that do want to support large integer types to be able to function. Consequently, don't assert if the bitwidth 64 bits when computing the size and alignment. Instead, compute the size by rounding up to the next even number of bytes for the size. Compute the alignment as the same as the LongABIAlignment. These provide reasonable defaults that the target can override. --- Diffs of the changes: (+4 -2) TargetData.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/TargetData.cpp diff -u llvm/lib/Target/TargetData.cpp:1.84 llvm/lib/Target/TargetData.cpp:1.85 --- llvm/lib/Target/TargetData.cpp:1.84 Wed Jan 31 15:31:25 2007 +++ llvm/lib/Target/TargetData.cpp Mon Feb 5 17:51:43 2007 @@ -295,8 +295,10 @@ Size = 4; Alignment = TD-getIntABIAlignment(); } else if (BitWidth = 64) { Size = 8; Alignment = TD-getLongABIAlignment(); -} else - assert(0 Integer types 64 bits not supported.); +} else { + Size = ((BitWidth + 7) / 8) ~1; + Alignment = TD-getLongABIAlignment(); +} return; } case Type::VoidTyID: Size = 1; Alignment = TD-getByteABIAlignment(); return; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.104 - 1.105 --- Log message: - Store val, [sp, c] must be selected to tSTRsp. - If c does not fit in the offset field, materialize sp + c into a register using tADDhirr. --- Diffs of the changes: (+34 -4) ARMISelDAGToDAG.cpp | 38 ++ 1 files changed, 34 insertions(+), 4 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.104 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.105 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.104 Mon Jan 29 20:35:32 2007 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Feb 5 18:22:06 2007 @@ -392,6 +392,17 @@ return true; } + // Thumb does not have [sp, r] address mode. + RegisterSDNode *LHSR = dyn_castRegisterSDNode(N.getOperand(0)); + RegisterSDNode *RHSR = dyn_castRegisterSDNode(N.getOperand(1)); + if ((LHSR LHSR-getReg() == ARM::SP) || + (RHSR RHSR-getReg() == ARM::SP)) { +Base = N; +Offset = CurDAG-getRegister(0, MVT::i32); +OffImm = CurDAG-getTargetConstant(0, MVT::i32); +return true; + } + // If the RHS is + imm5 * scale, fold into addr mode. if (ConstantSDNode *RHS = dyn_castConstantSDNode(N.getOperand(1))) { int RHSC = (int)RHS-getValue(); @@ -439,16 +450,18 @@ return true; } - if (N.getOpcode() == ISD::ADD - N.getOperand(0).getOpcode() == ISD::FrameIndex) { + if (N.getOpcode() != ISD::ADD) +return false; + + RegisterSDNode *LHSR = dyn_castRegisterSDNode(N.getOperand(0)); + if (LHSR LHSR-getReg() == ARM::SP) { // If the RHS is + imm8 * scale, fold into addr mode. if (ConstantSDNode *RHS = dyn_castConstantSDNode(N.getOperand(1))) { int RHSC = (int)RHS-getValue(); if ((RHSC 3) == 0) { // The constant is implicitly multiplied. RHSC = 2; if (RHSC = 0 RHSC 256) { - int FI = castFrameIndexSDNode(N.getOperand(0))-getIndex(); - Base = CurDAG-getTargetFrameIndex(FI, TLI.getPointerTy()); + Base = N.getOperand(0); OffImm = CurDAG-getTargetConstant(RHSC, MVT::i32); return true; } @@ -537,6 +550,23 @@ return CurDAG-SelectNodeTo(N, Opc, MVT::i32, TFI, CurDAG-getTargetConstant(0, MVT::i32)); } + case ISD::ADD: { +// Select add sp, c to tADDhirr. +SDOperand N0 = Op.getOperand(0); +SDOperand N1 = Op.getOperand(1); +RegisterSDNode *LHSR = dyn_castRegisterSDNode(Op.getOperand(0)); +RegisterSDNode *RHSR = dyn_castRegisterSDNode(Op.getOperand(1)); +if (LHSR LHSR-getReg() == ARM::SP) { + std::swap(N0, N1); + std::swap(LHSR, RHSR); +} +if (RHSR RHSR-getReg() == ARM::SP) { + AddToISelQueue(N0); + AddToISelQueue(N1); + return CurDAG-SelectNodeTo(N, ARM::tADDhirr, Op.getValueType(), N0, N1); +} +break; + } case ISD::MUL: if (Subtarget-isThumb()) break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp added (r1.1) --- Log message: Add a class APInt to represent arbitrary precision constant integral values. It is a functional replacement for common case integer type like unsigned, uint64_t, but also allows non-byte-width integer type and large integer value types such as 3-bits, 15-bits, or more than 64-bits of precision. For more details, see pr1043: http://llvm.org/PR1043 . --- Diffs of the changes: (+1113 -0) APInt.cpp | 1113 ++ 1 files changed, 1113 insertions(+) Index: llvm/lib/Support/APInt.cpp diff -c /dev/null llvm/lib/Support/APInt.cpp:1.1 *** /dev/null Mon Feb 5 21:00:27 2007 --- llvm/lib/Support/APInt.cpp Mon Feb 5 21:00:16 2007 *** *** 0 --- 1,1113 + //===-- APInt.cpp - Implement APInt class -===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Sheng Zhou and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // This file implements a class to represent arbitrary precision integral + // constant values. + // + //===--===// + + #include llvm/ADT/APInt.h + #include llvm/DerivedTypes.h + #include llvm/Support/MathExtras.h + #include strings.h + #include iostream + #include sstream + #include iomanip + #include cstdlib + using namespace llvm; + + APInt::APInt(uint64_t val, unsigned numBits, bool sign) + : bitsnum(numBits), isSigned(sign) { + assert(bitsnum = IntegerType::MIN_INT_BITS bitwidth too small); + assert(bitsnum = IntegerType::MAX_INT_BITS bitwidth too large); + if (isSingleWord()) + VAL = val (~uint64_t(0ULL) (APINT_BITS_PER_WORD - bitsnum)); + else { + // Memory allocation and check if successful. + assert((pVal = new uint64_t[numWords()]) + APInt memory allocation fails!); + bzero(pVal, numWords() * 8); + pVal[0] = val; + } + } + + APInt::APInt(unsigned numBits, uint64_t bigVal[], bool sign) + : bitsnum(numBits), isSigned(sign) { + assert(bitsnum = IntegerType::MIN_INT_BITS bitwidth too small); + assert(bitsnum = IntegerType::MAX_INT_BITS bitwidth too large); + assert(bigVal Null pointer detected!); + if (isSingleWord()) + VAL = bigVal[0] (~uint64_t(0ULL) (APINT_BITS_PER_WORD - bitsnum)); + else { + // Memory allocation and check if successful. + assert((pVal = new uint64_t[numWords()]) +APInt memory allocation fails!); + // Calculate the actual length of bigVal[]. + unsigned n = sizeof(*bigVal) / sizeof(bigVal[0]); + unsigned maxN = std::maxunsigned(n, numWords()); + unsigned minN = std::minunsigned(n, numWords()); + memcpy(pVal, bigVal, (minN - 1) * 8); + pVal[minN-1] = bigVal[minN-1] (~uint64_t(0ULL) (64 - bitsnum % 64)); + if (maxN == numWords()) + bzero(pVal+n, (numWords() - n) * 8); + } + } + + APInt::APInt(std::string Val, uint8_t radix, bool sign) + : isSigned(sign) { + assert((radix == 10 || radix == 8 || radix == 16 || radix == 2) + Radix should be 2, 8, 10, or 16!); + assert(!Val.empty() String empty?); + unsigned slen = Val.size(); + unsigned size = 0; + // If the radix is a power of 2, read the input + // from most significant to least significant. + if ((radix (radix - 1)) == 0) { + unsigned nextBitPos = 0, bits_per_digit = radix / 8 + 2; + uint64_t resDigit = 0; + bitsnum = slen * bits_per_digit; + if (numWords() 1) + assert((pVal = new uint64_t[numWords()]) + APInt memory allocation fails!); + for (int i = slen - 1; i = 0; --i) { + uint64_t digit = Val[i] - 48; // '0' == 48. + resDigit |= digit nextBitPos; + nextBitPos += bits_per_digit; + if (nextBitPos = 64) { + if (isSingleWord()) { + VAL = resDigit; +break; + } + pVal[size++] = resDigit; + nextBitPos -= 64; + resDigit = digit (bits_per_digit - nextBitPos); + } + } + if (!isSingleWord() size = numWords()) + pVal[size] = resDigit; + } else { // General case. The radix is not a power of 2. + // For 10-radix, the max value of 64-bit integer is 18446744073709551615, + // and its digits number is 14. + const unsigned chars_per_word = 20; + if (slen chars_per_word || + (Val = 18446744073709551615 + slen == chars_per_word)) { // In case Val = 2^64 - 1 + bitsnum = 64; + VAL = strtoull(Val.c_str(), 0, 10); + } else { // In case Val 2^64 - 1 + bitsnum = (slen / chars_per_word + 1) * 64; + assert((pVal = new uint64_t[numWords()]) + APInt memory allocation fails!); +
[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Changes in directory llvm/lib/Support: APInt.cpp updated: 1.1 - 1.2 --- Log message: Disable this for now. --- Diffs of the changes: (+5 -0) APInt.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/Support/APInt.cpp diff -u llvm/lib/Support/APInt.cpp:1.1 llvm/lib/Support/APInt.cpp:1.2 --- llvm/lib/Support/APInt.cpp:1.1 Mon Feb 5 21:00:16 2007 +++ llvm/lib/Support/APInt.cpp Mon Feb 5 23:38:37 2007 @@ -13,6 +13,8 @@ //===--===// #include llvm/ADT/APInt.h + +#if 0 #include llvm/DerivedTypes.h #include llvm/Support/MathExtras.h #include strings.h @@ -,3 +1113,6 @@ } return A; } + +#endif + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Support/APInt.cpp
+ #include llvm/ADT/APInt.h + #include llvm/DerivedTypes.h + #include llvm/Support/MathExtras.h + #include strings.h strings.h is not portable. Please use cstring, and memcpy/memset/ etc instead of bzero and friends. I've #ifdef'd this file out temporarily until this is resolved. + #include iostream You are not allowed to include this header: http://llvm.org/docs/CodingStandards.html#ll_iostream + #include sstream + #include iomanip Please eliminate your single use of ostringstream. It is definitely overkill for what you're using it for. Thanks, -Chris + #include cstdlib + using namespace llvm; + + APInt::APInt(uint64_t val, unsigned numBits, bool sign) + : bitsnum(numBits), isSigned(sign) { + assert(bitsnum = IntegerType::MIN_INT_BITS bitwidth too small); + assert(bitsnum = IntegerType::MAX_INT_BITS bitwidth too large); + if (isSingleWord()) + VAL = val (~uint64_t(0ULL) (APINT_BITS_PER_WORD - bitsnum)); + else { + // Memory allocation and check if successful. + assert((pVal = new uint64_t[numWords()]) + APInt memory allocation fails!); + bzero(pVal, numWords() * 8); + pVal[0] = val; + } + } + + APInt::APInt(unsigned numBits, uint64_t bigVal[], bool sign) + : bitsnum(numBits), isSigned(sign) { + assert(bitsnum = IntegerType::MIN_INT_BITS bitwidth too small); + assert(bitsnum = IntegerType::MAX_INT_BITS bitwidth too large); + assert(bigVal Null pointer detected!); + if (isSingleWord()) + VAL = bigVal[0] (~uint64_t(0ULL) (APINT_BITS_PER_WORD - bitsnum)); + else { + // Memory allocation and check if successful. + assert((pVal = new uint64_t[numWords()]) +APInt memory allocation fails!); + // Calculate the actual length of bigVal[]. + unsigned n = sizeof(*bigVal) / sizeof(bigVal[0]); + unsigned maxN = std::maxunsigned(n, numWords()); + unsigned minN = std::minunsigned(n, numWords()); + memcpy(pVal, bigVal, (minN - 1) * 8); + pVal[minN-1] = bigVal[minN-1] (~uint64_t(0ULL) (64 - bitsnum % 64)); + if (maxN == numWords()) + bzero(pVal+n, (numWords() - n) * 8); + } + } + + APInt::APInt(std::string Val, uint8_t radix, bool sign) + : isSigned(sign) { + assert((radix == 10 || radix == 8 || radix == 16 || radix == 2) + Radix should be 2, 8, 10, or 16!); + assert(!Val.empty() String empty?); + unsigned slen = Val.size(); + unsigned size = 0; + // If the radix is a power of 2, read the input + // from most significant to least significant. + if ((radix (radix - 1)) == 0) { + unsigned nextBitPos = 0, bits_per_digit = radix / 8 + 2; + uint64_t resDigit = 0; + bitsnum = slen * bits_per_digit; + if (numWords() 1) + assert((pVal = new uint64_t[numWords()]) + APInt memory allocation fails!); + for (int i = slen - 1; i = 0; --i) { + uint64_t digit = Val[i] - 48; // '0' == 48. + resDigit |= digit nextBitPos; + nextBitPos += bits_per_digit; + if (nextBitPos = 64) { + if (isSingleWord()) { + VAL = resDigit; +break; + } + pVal[size++] = resDigit; + nextBitPos -= 64; + resDigit = digit (bits_per_digit - nextBitPos); + } + } + if (!isSingleWord() size = numWords()) + pVal[size] = resDigit; + } else { // General case. The radix is not a power of 2. + // For 10-radix, the max value of 64-bit integer is 18446744073709551615, + // and its digits number is 14. + const unsigned chars_per_word = 20; + if (slen chars_per_word || + (Val = 18446744073709551615 + slen == chars_per_word)) { // In case Val = 2^64 - 1 + bitsnum = 64; + VAL = strtoull(Val.c_str(), 0, 10); + } else { // In case Val 2^64 - 1 + bitsnum = (slen / chars_per_word + 1) * 64; + assert((pVal = new uint64_t[numWords()]) + APInt memory allocation fails!); + bzero(pVal, numWords() * 8); + unsigned str_pos = 0; + while (str_pos slen) { + unsigned chunk = slen - str_pos; + if (chunk chars_per_word - 1) + chunk = chars_per_word - 1; + uint64_t resDigit = Val[str_pos++] - 48; // 48 == '0'. + uint64_t big_base = radix; + while (--chunk 0) { + resDigit = resDigit * radix + Val[str_pos++] - 48; + big_base *= radix; + } + + uint64_t carry; + if (!size) + carry = resDigit; + else { + carry = mul_1(pVal, pVal, size, big_base); + carry += add_1(pVal, pVal, size, resDigit); + } + + if (carry) pVal[size++] = carry; + } + } + } + } + + APInt::APInt(const APInt APIVal) + : bitsnum(APIVal.bitsnum), isSigned(APIVal.isSigned) { + if (isSingleWord()) VAL =
[llvm-commits] CVS: llvm/test/CodeGen/ARM/dyn-stackalloc.ll
Changes in directory llvm/test/CodeGen/ARM: dyn-stackalloc.ll added (r1.1) --- Log message: Add a DYNAMIC_STACKALLOC test case. --- Diffs of the changes: (+30 -0) dyn-stackalloc.ll | 30 ++ 1 files changed, 30 insertions(+) Index: llvm/test/CodeGen/ARM/dyn-stackalloc.ll diff -c /dev/null llvm/test/CodeGen/ARM/dyn-stackalloc.ll:1.1 *** /dev/null Tue Feb 6 01:18:37 2007 --- llvm/test/CodeGen/ARM/dyn-stackalloc.ll Tue Feb 6 01:18:27 2007 *** *** 0 --- 1,30 + ; RUN: llvm-as %s | llc -march=arm + ; RUN: llvm-as %s | llc -march=arm -enable-thumb + ; RUN: llvm-as %s | llc -march=arm -enable-thumb | not grep ldr sp + + %struct.state = type { i32, %struct.info*, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* } + %struct.info = type { i32, i32, i32, i32, i32, i32, i32, i8* } + + define void @f1(%struct.state* %v) { + %tmp6 = load i32* null + %tmp8 = alloca float, i32 %tmp6 + store i32 1, i32* null + br i1 false, label %bb123.preheader, label %return + + bb123.preheader: + br i1 false, label %bb43, label %return + + bb43: + call fastcc void @f2( float* %tmp8, float* null, i32 0 ) + %tmp70 = load i32* null + %tmp85 = getelementptr float* %tmp8, i32 0 + call fastcc void @f3( float* null, float* null, float* %tmp85, i32 %tmp70 ) + ret void + + return: + ret void + } + + declare fastcc void @f2(float*, float*, i32) + + declare fastcc void @f3(float*, float*, float*, i32) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits