From gaeke at cs.uiuc.edu Mon Nov 17 01:03:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Nov 17 01:03:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311170702.BAA04664@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.15 -> 1.16 --- Log message: We're really making progress on ed. --- Diffs of the changes: (+13 -16) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.15 llvm-www/status/index.html:1.16 --- llvm-www/status/index.html:1.15 Fri Nov 14 12:38:01 2003 +++ llvm-www/status/index.html Mon Nov 17 01:02:36 2003 @@ -46,6 +46,18 @@ Notes + + + ed + 0.2 + 17 Nov 2003 + FAILS + With CBE, LLC: passes its own regression test suite. + With JIT: 'H' command prints garbage. With all backends: + "Ed is the standard text + editor." - Unix Seventh Edition manual, Bell Telephone Laboratories, + 1979. + xemacs @@ -132,21 +144,6 @@
lli -load=/usr/lib/libncurses.so mutt.bc
Sometimes suspend and resume act funny. - - - ed - 0.2 - 12 Nov 2003 - FAILS - Example session: -
-% ./ed
-e /etc/hosts
-[ ed should print # of lines in file, but doesn't ]
-
- Ed is the standard Unix editor! - Misha Brukman The LLVM Compiler Infrastructure
- Last modified: $Date: 2003/11/14 18:38:01 $ + Last modified: $Date: 2003/11/17 07:02:36 $ From lattner at cs.uiuc.edu Mon Nov 17 11:29:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 11:29:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/ConstantWriter.cpp Message-ID: <200311171728.LAA06462@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: ConstantWriter.cpp updated: 1.27 -> 1.28 --- Log message: Remove usage of ConstantPointer --- Diffs of the changes: (+1 -3) Index: llvm/lib/Bytecode/Writer/ConstantWriter.cpp diff -u llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.27 llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.28 --- llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.27 Tue Nov 11 16:41:32 2003 +++ llvm/lib/Bytecode/Writer/ConstantWriter.cpp Mon Nov 17 11:28:29 2003 @@ -175,9 +175,7 @@ } case Type::PointerTyID: { - const ConstantPointer *CPP = cast(CPV); - assert(!isa(CPP) && "Null should be already emitted!"); - const ConstantPointerRef *CPR = cast(CPP); + const ConstantPointerRef *CPR = cast(CPV); int Slot = Table.getSlot((Value*)CPR->getValue()); assert(Slot != -1 && "Global used but not available!!"); output_vbr((unsigned)Slot, Out); From lattner at cs.uiuc.edu Mon Nov 17 13:06:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 13:06:00 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantHandling.cpp Message-ID: <200311171905.NAA02824@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantHandling.cpp updated: 1.37 -> 1.38 --- Log message: Constant folding shalt not be built on annotations --- Diffs of the changes: (+49 -62) Index: llvm/lib/VMCore/ConstantHandling.cpp diff -u llvm/lib/VMCore/ConstantHandling.cpp:1.37 llvm/lib/VMCore/ConstantHandling.cpp:1.38 --- llvm/lib/VMCore/ConstantHandling.cpp:1.37 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/ConstantHandling.cpp Mon Nov 17 13:05:17 2003 @@ -16,16 +16,12 @@ #include "llvm/InstrTypes.h" #include "llvm/DerivedTypes.h" #include - -namespace llvm { - -AnnotationID ConstRules::AID(AnnotationManager::getID("opt::ConstRules", - &ConstRules::find)); +using namespace llvm; // ConstantFoldInstruction - Attempt to constant fold the specified instruction. // If successful, the constant result is returned, if not, null is returned. // -Constant *ConstantFoldInstruction(Instruction *I) { +Constant *llvm::ConstantFoldInstruction(Instruction *I) { if (PHINode *PN = dyn_cast(I)) { if (PN->getNumIncomingValues() == 0) return Constant::getNullValue(PN->getType()); @@ -85,7 +81,8 @@ return S ? S : 8; // Treat pointers at 8 bytes } -Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy) { +Constant *llvm::ConstantFoldCastInstruction(const Constant *V, + const Type *DestTy) { if (V->getType() == DestTy) return (Constant*)V; if (const ConstantExpr *CE = dyn_cast(V)) @@ -117,11 +114,12 @@ return ConstantExpr::getCast(CE->getOperand(0), DestTy); } - return ConstRules::get(*V, *V)->castTo(V, DestTy); + return ConstRules::get(*V, *V).castTo(V, DestTy); } -Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1, - const Constant *V2) { +Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, + const Constant *V1, + const Constant *V2) { switch (Opcode) { case Instruction::Add: return *V1 + *V2; case Instruction::Sub: return *V1 - *V2; @@ -142,8 +140,9 @@ return 0; } -Constant *ConstantFoldShiftInstruction(unsigned Opcode, const Constant *V1, - const Constant *V2) { +Constant *llvm::ConstantFoldShiftInstruction(unsigned Opcode, + const Constant *V1, + const Constant *V2) { switch (Opcode) { case Instruction::Shl: return *V1 << *V2; case Instruction::Shr: return *V1 >> *V2; @@ -151,8 +150,8 @@ } } -Constant *ConstantFoldGetElementPtr(const Constant *C, - const std::vector &IdxList) { +Constant *llvm::ConstantFoldGetElementPtr(const Constant *C, + const std::vector &IdxList) { if (IdxList.size() == 0 || (IdxList.size() == 1 && IdxList[0]->isNullValue())) return const_cast(C); @@ -592,53 +591,41 @@ } }; -//===----------------------------------------------------------------------===// -// DirectRules Subclasses -//===----------------------------------------------------------------------===// -// -// Given the DirectRules class we can now implement lots of types with little -// code. Thank goodness C++ compilers are great at stomping out layers of -// templates... can you imagine having to do this all by hand? (/me is lazy :) -// - -// ConstRules::find - Return the constant rules that take care of the specified -// type. -// -Annotation *ConstRules::find(AnnotationID AID, const Annotable *TyA, void *) { - assert(AID == ConstRules::AID && "Bad annotation for factory!"); - const Type *Ty = cast((const Value*)TyA); - - switch (Ty->getPrimitiveID()) { - case Type::BoolTyID: return new BoolRules(); - case Type::PointerTyID: return new PointerRules(); - case Type::SByteTyID: - return new DirectIntRules(); - case Type::UByteTyID: - return new DirectIntRules(); - case Type::ShortTyID: - return new DirectIntRules(); - case Type::UShortTyID: - return new DirectIntRules(); - case Type::IntTyID: - return new DirectIntRules(); - case Type::UIntTyID: - return new DirectIntRules(); - case Type::LongTyID: - return new DirectIntRules(); - case Type::ULongTyID: - return new DirectIntRules(); - case Type::FloatTyID: - return new DirectFPRules(); - case Type::DoubleTyID: - return new DirectFPRules(); - default: - return new EmptyRules(); +ConstRules &ConstRules::get(const Constant &V1, const Constant &V2) { + static EmptyRules EmptyR; + static BoolRules BoolR; + static PointerRules PointerR; + static DirectIntRules SByteR; + static DirectIntRules UByteR; + static DirectIntRules ShortR; + static DirectIntRules UShortR; + static DirectIntRules IntR; + static DirectIntRules UIntR; + static DirectIntRules LongR; + static DirectIntRules ULongR; + static DirectFPRules FloatR; + static DirectFPRules DoubleR; + + if (isa(V1) || isa(V2)) + return EmptyR; + + // FIXME: This assert doesn't work because shifts pass both operands in to + // check for constant exprs. :( + //assert(V1.getType() == V2.getType() &&"Nonequal types to constant folder?"); + + switch (V1.getType()->getPrimitiveID()) { + default: assert(0 && "Unknown value type for constant folding!"); + case Type::BoolTyID: return BoolR; + case Type::PointerTyID: return PointerR; + case Type::SByteTyID: return SByteR; + case Type::UByteTyID: return UByteR; + case Type::ShortTyID: return ShortR; + case Type::UShortTyID: return UShortR; + case Type::IntTyID: return IntR; + case Type::UIntTyID: return UIntR; + case Type::LongTyID: return LongR; + case Type::ULongTyID: return ULongR; + case Type::FloatTyID: return FloatR; + case Type::DoubleTyID: return DoubleR; } } - -ConstRules *ConstRules::getConstantExprRules() { - static EmptyRules CERules; - return &CERules; -} - -} // End llvm namespace From lattner at cs.uiuc.edu Mon Nov 17 13:06:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 13:06:04 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/ConstantHandling.h Message-ID: <200311171905.NAA02813@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: ConstantHandling.h updated: 1.33 -> 1.34 --- Log message: Constant folding shalt not be built on annotations --- Diffs of the changes: (+18 -29) Index: llvm/include/llvm/ConstantHandling.h diff -u llvm/include/llvm/ConstantHandling.h:1.33 llvm/include/llvm/ConstantHandling.h:1.34 --- llvm/include/llvm/ConstantHandling.h:1.33 Sun Nov 16 14:21:15 2003 +++ llvm/include/llvm/ConstantHandling.h Mon Nov 17 13:05:03 2003 @@ -64,11 +64,8 @@ // Implement all other operators indirectly through TypeRules system //===----------------------------------------------------------------------===// -class ConstRules : public Annotation { -protected: - inline ConstRules() : Annotation(AID) {} // Can only be subclassed... -public: - static AnnotationID AID; // AnnotationID for this class +struct ConstRules { + ConstRules() {} // Binary Operators... virtual Constant *add(const Constant *V1, const Constant *V2) const = 0; @@ -119,19 +116,11 @@ } } - // ConstRules::get - A type will cache its own type rules if one is needed... - // we just want to make sure to hit the cache instead of doing it indirectly, - // if possible... + // ConstRules::get - Return an instance of ConstRules for the specified + // constant operands. // - static inline ConstRules *get(const Constant &V1, const Constant &V2) { - if (isa(V1) || isa(V2)) - return getConstantExprRules(); - return static_cast(V1.getType()->getOrCreateAnnotation(AID)); - } + static ConstRules &get(const Constant &V1, const Constant &V2); private: - static ConstRules *getConstantExprRules(); - static Annotation *find(AnnotationID AID, const Annotable *Ty, void *); - ConstRules(const ConstRules &); // Do not implement ConstRules &operator=(const ConstRules &); // Do not implement }; @@ -139,71 +128,71 @@ // Unary operators... inline Constant *operator~(const Constant &V) { assert(V.getType()->isIntegral() && "Cannot invert non-integral constant!"); - return ConstRules::get(V, V)->op_xor(&V, + return ConstRules::get(V, V).op_xor(&V, ConstantInt::getAllOnesValue(V.getType())); } inline Constant *operator-(const Constant &V) { - return ConstRules::get(V, V)->sub(Constant::getNullValue(V.getType()), &V); + return ConstRules::get(V, V).sub(Constant::getNullValue(V.getType()), &V); } // Standard binary operators... inline Constant *operator+(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->add(&V1, &V2); + return ConstRules::get(V1, V2).add(&V1, &V2); } inline Constant *operator-(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->sub(&V1, &V2); + return ConstRules::get(V1, V2).sub(&V1, &V2); } inline Constant *operator*(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->mul(&V1, &V2); + return ConstRules::get(V1, V2).mul(&V1, &V2); } inline Constant *operator/(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->div(&V1, &V2); + return ConstRules::get(V1, V2).div(&V1, &V2); } inline Constant *operator%(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->rem(&V1, &V2); + return ConstRules::get(V1, V2).rem(&V1, &V2); } // Logical Operators... inline Constant *operator&(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->op_and(&V1, &V2); + return ConstRules::get(V1, V2).op_and(&V1, &V2); } inline Constant *operator|(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->op_or(&V1, &V2); + return ConstRules::get(V1, V2).op_or(&V1, &V2); } inline Constant *operator^(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->op_xor(&V1, &V2); + return ConstRules::get(V1, V2).op_xor(&V1, &V2); } // Shift Instructions... inline Constant *operator<<(const Constant &V1, const Constant &V2) { assert(V1.getType()->isInteger() && V2.getType() == Type::UByteTy); - return ConstRules::get(V1, V2)->shl(&V1, &V2); + return ConstRules::get(V1, V2).shl(&V1, &V2); } inline Constant *operator>>(const Constant &V1, const Constant &V2) { assert(V1.getType()->isInteger() && V2.getType() == Type::UByteTy); - return ConstRules::get(V1, V2)->shr(&V1, &V2); + return ConstRules::get(V1, V2).shr(&V1, &V2); } inline ConstantBool *operator<(const Constant &V1, const Constant &V2) { assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstRules::get(V1, V2)->lessthan(&V1, &V2); + return ConstRules::get(V1, V2).lessthan(&V1, &V2); } From lattner at cs.uiuc.edu Mon Nov 17 13:20:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 13:20:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantHandling.cpp Message-ID: <200311171919.NAA09177@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantHandling.cpp updated: 1.38 -> 1.39 --- Log message: Eliminate use of the ConstantPointer class --- Diffs of the changes: (+23 -35) Index: llvm/lib/VMCore/ConstantHandling.cpp diff -u llvm/lib/VMCore/ConstantHandling.cpp:1.38 llvm/lib/VMCore/ConstantHandling.cpp:1.39 --- llvm/lib/VMCore/ConstantHandling.cpp:1.38 Mon Nov 17 13:05:17 2003 +++ llvm/lib/VMCore/ConstantHandling.cpp Mon Nov 17 13:19:32 2003 @@ -389,64 +389,51 @@ //===----------------------------------------------------------------------===// -// PointerRules Class +// NullPointerRules Class //===----------------------------------------------------------------------===// // -// PointerRules provides a concrete base class of ConstRules for pointer types +// NullPointerRules provides a concrete base class of ConstRules for null +// pointers. // -struct PointerRules : public TemplateRules { +struct NullPointerRules : public TemplateRules { static ConstantBool *CastToBool (const Constant *V) { - if (V->isNullValue()) return ConstantBool::False; - return 0; // Can't const prop other types of pointers + return ConstantBool::False; } static ConstantSInt *CastToSByte (const Constant *V) { - if (V->isNullValue()) return ConstantSInt::get(Type::SByteTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantSInt::get(Type::SByteTy, 0); } static ConstantUInt *CastToUByte (const Constant *V) { - if (V->isNullValue()) return ConstantUInt::get(Type::UByteTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantUInt::get(Type::UByteTy, 0); } static ConstantSInt *CastToShort (const Constant *V) { - if (V->isNullValue()) return ConstantSInt::get(Type::ShortTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantSInt::get(Type::ShortTy, 0); } static ConstantUInt *CastToUShort(const Constant *V) { - if (V->isNullValue()) return ConstantUInt::get(Type::UShortTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantUInt::get(Type::UShortTy, 0); } static ConstantSInt *CastToInt (const Constant *V) { - if (V->isNullValue()) return ConstantSInt::get(Type::IntTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantSInt::get(Type::IntTy, 0); } static ConstantUInt *CastToUInt (const Constant *V) { - if (V->isNullValue()) return ConstantUInt::get(Type::UIntTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantUInt::get(Type::UIntTy, 0); } static ConstantSInt *CastToLong (const Constant *V) { - if (V->isNullValue()) return ConstantSInt::get(Type::LongTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantSInt::get(Type::LongTy, 0); } static ConstantUInt *CastToULong (const Constant *V) { - if (V->isNullValue()) return ConstantUInt::get(Type::ULongTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantUInt::get(Type::ULongTy, 0); } static ConstantFP *CastToFloat (const Constant *V) { - if (V->isNullValue()) return ConstantFP::get(Type::FloatTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantFP::get(Type::FloatTy, 0); } static ConstantFP *CastToDouble(const Constant *V) { - if (V->isNullValue()) return ConstantFP::get(Type::DoubleTy, 0); - return 0; // Can't const prop other types of pointers + return ConstantFP::get(Type::DoubleTy, 0); } static Constant *CastToPointer(const ConstantPointer *V, const PointerType *PTy) { - if (V->getType() == PTy) - return const_cast(V); // Allow cast %PTy %ptr to %PTy - if (V->isNullValue()) - return ConstantPointerNull::get(PTy); - return 0; // Can't const prop other types of pointers + return ConstantPointerNull::get(PTy); } }; @@ -592,9 +579,9 @@ }; ConstRules &ConstRules::get(const Constant &V1, const Constant &V2) { - static EmptyRules EmptyR; - static BoolRules BoolR; - static PointerRules PointerR; + static EmptyRules EmptyR; + static BoolRules BoolR; + static NullPointerRules NullPointerR; static DirectIntRules SByteR; static DirectIntRules UByteR; static DirectIntRules ShortR; @@ -606,7 +593,8 @@ static DirectFPRules FloatR; static DirectFPRules DoubleR; - if (isa(V1) || isa(V2)) + if (isa(V1) || isa(V2) || + isa(V1) || isa(V2)) return EmptyR; // FIXME: This assert doesn't work because shifts pass both operands in to @@ -616,7 +604,7 @@ switch (V1.getType()->getPrimitiveID()) { default: assert(0 && "Unknown value type for constant folding!"); case Type::BoolTyID: return BoolR; - case Type::PointerTyID: return PointerR; + case Type::PointerTyID: return NullPointerR; case Type::SByteTyID: return SByteR; case Type::UByteTyID: return UByteR; case Type::ShortTyID: return ShortR; From lattner at cs.uiuc.edu Mon Nov 17 13:24:22 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 13:24:22 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantHandling.cpp Message-ID: <200311171921.NAA09417@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantHandling.cpp updated: 1.39 -> 1.40 --- Log message: No REALLY, get rid of ConstantPointer references --- Diffs of the changes: (+2 -2) Index: llvm/lib/VMCore/ConstantHandling.cpp diff -u llvm/lib/VMCore/ConstantHandling.cpp:1.39 llvm/lib/VMCore/ConstantHandling.cpp:1.40 --- llvm/lib/VMCore/ConstantHandling.cpp:1.39 Mon Nov 17 13:19:32 2003 +++ llvm/lib/VMCore/ConstantHandling.cpp Mon Nov 17 13:21:04 2003 @@ -395,7 +395,7 @@ // NullPointerRules provides a concrete base class of ConstRules for null // pointers. // -struct NullPointerRules : public TemplateRules { static ConstantBool *CastToBool (const Constant *V) { return ConstantBool::False; @@ -431,7 +431,7 @@ return ConstantFP::get(Type::DoubleTy, 0); } - static Constant *CastToPointer(const ConstantPointer *V, + static Constant *CastToPointer(const ConstantPointerNull *V, const PointerType *PTy) { return ConstantPointerNull::get(PTy); } From brukman at cs.uiuc.edu Mon Nov 17 13:36:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Nov 17 13:36:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ExtractFunction.cpp Message-ID: <200311171935.NAA10726@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: ExtractFunction.cpp updated: 1.5 -> 1.6 --- Log message: This file was somehow missing a top-level comment line. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.5 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.6 --- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.5 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/ExtractFunction.cpp Mon Nov 17 13:35:17 2003 @@ -1,4 +1,4 @@ - +//===-- ExtractFunction.cpp - Function extraction pass --------------------===// // // The LLVM Compiler Infrastructure // From criswell at cs.uiuc.edu Mon Nov 17 13:47:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon Nov 17 13:47:01 2003 Subject: [llvm-commits] CVS: llvm/autoconf/aclocal.m4 configure.ac Message-ID: <200311171946.NAA10788@choi.cs.uiuc.edu> Changes in directory llvm/autoconf: aclocal.m4 updated: 1.8 -> 1.9 configure.ac updated: 1.55 -> 1.56 --- Log message: Added a check for the -R linker option. --- Diffs of the changes: (+20 -1) Index: llvm/autoconf/aclocal.m4 diff -u llvm/autoconf/aclocal.m4:1.8 llvm/autoconf/aclocal.m4:1.9 --- llvm/autoconf/aclocal.m4:1.8 Sun Nov 9 21:06:07 2003 +++ llvm/autoconf/aclocal.m4 Mon Nov 17 13:46:01 2003 @@ -6244,4 +6244,20 @@ fi ]) - +# +# Determine if the system can handle the -R option being passed to the linker. +# +AC_DEFUN([AC_LINK_USE_R], +[ + AC_LANG_SAVE + AC_LANG_C + oldcflags=${CFLAGS} + CFLAGS="${CFLAGS} -Wl,-R." + AC_LINK_IFELSE([int main() { return 0;}],[ac_cv_link_use_r=yes],[ac_cv_link_se_r=no]) + CFLAGS=${oldcflags} + AC_LANG_RESTORE + if test "$ac_cv_link_use_r = yes" + then + AC_DEFINE([HAVE_LINK_R],[1]) + fi +]) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.55 llvm/autoconf/configure.ac:1.56 --- llvm/autoconf/configure.ac:1.55 Sun Nov 16 18:30:48 2003 +++ llvm/autoconf/configure.ac Mon Nov 17 13:46:02 2003 @@ -523,6 +523,9 @@ AC_CHECK_FUNC(mmap,,AC_MSG_ERROR([Function mmap() required but not found])) AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found])) +dnl Determine if the linker supports the -R option. +AC_LINK_USE_R() + dnl ************************************************************************** dnl * Enable various compile-time options dnl ************************************************************************** From criswell at cs.uiuc.edu Mon Nov 17 13:47:04 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon Nov 17 13:47:04 2003 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200311171946.NAA10779@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.54 -> 1.55 --- Log message: Added a check for the -R linker option. --- Diffs of the changes: (+50 -0) Index: llvm/configure diff -u llvm/configure:1.54 llvm/configure:1.55 --- llvm/configure:1.54 Sun Nov 16 18:31:43 2003 +++ llvm/configure Mon Nov 17 13:45:57 2003 @@ -22980,6 +22980,56 @@ + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + oldcflags=${CFLAGS} + CFLAGS="${CFLAGS} -Wl,-R." + cat >conftest.$ac_ext <<_ACEOF +int main() { return 0;} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_link_use_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_link_se_r=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + CFLAGS=${oldcflags} + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test "$ac_cv_link_use_r = yes" + then + cat >>confdefs.h <<\_ACEOF +#define HAVE_LINK_R 1 +_ACEOF + + fi + + + # Check whether --enable-purify or --disable-purify was given. if test "${enable_purify+set}" = set; then enableval="$enable_purify" From lattner at cs.uiuc.edu Mon Nov 17 13:48:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 13:48:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200311171947.NAA24856@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.62 -> 1.63 --- Log message: The ConstantPointer class is now gone. --- Diffs of the changes: (+10 -3) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.62 llvm/lib/VMCore/Constants.cpp:1.63 --- llvm/lib/VMCore/Constants.cpp:1.62 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Constants.cpp Mon Nov 17 13:47:21 2003 @@ -278,7 +278,7 @@ } ConstantPointerRef::ConstantPointerRef(GlobalValue *GV) - : ConstantPointer(GV->getType()) { + : Constant(GV->getType()) { Operands.push_back(Use(GV, this)); } @@ -337,8 +337,15 @@ bool ConstantStruct::classof(const Constant *CPV) { return isa(CPV->getType()) && !isa(CPV); } -bool ConstantPointer::classof(const Constant *CPV) { - return (isa(CPV->getType()) && !isa(CPV)); + +bool ConstantPointerNull::classof(const Constant *CPV) { + return isa(CPV->getType()) && !isa(CPV) && + CPV->getNumOperands() == 0; +} + +bool ConstantPointerRef::classof(const Constant *CPV) { + return isa(CPV->getType()) && !isa(CPV) && + CPV->getNumOperands() == 1; } From lattner at cs.uiuc.edu Mon Nov 17 13:48:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 13:48:02 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200311171947.NAA24625@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.35 -> 1.36 --- Log message: The ConstantPointer class is now gone. --- Diffs of the changes: (+13 -46) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.35 llvm/include/llvm/Constants.h:1.36 --- llvm/include/llvm/Constants.h:1.35 Sun Nov 16 14:21:15 2003 +++ llvm/include/llvm/Constants.h Mon Nov 17 13:47:15 2003 @@ -385,41 +385,14 @@ }; //===--------------------------------------------------------------------------- -/// ConstantPointer - Constant Pointer Declarations -/// -/// The ConstantPointer class represents a null pointer of a specific type. For -/// a more specific/useful instance, a subclass of ConstantPointer should be -/// used. -/// -class ConstantPointer : public Constant { - ConstantPointer(const ConstantPointer &); // DO NOT IMPLEMENT -protected: - inline ConstantPointer(const PointerType *T) - : Constant(reinterpret_cast(T)) { } -public: - inline const PointerType *getType() const { - return reinterpret_cast(Value::getType()); - } - - /// isNullValue - Return true if this is the value that would be returned by - /// getNullValue. - virtual bool isNullValue() const { return false; } - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ConstantPointer *) { return true; } - static bool classof(const Constant *CPV); // defined in Constants.cpp - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } -}; - /// ConstantPointerNull - a constant pointer value that points to null /// -class ConstantPointerNull : public ConstantPointer { +class ConstantPointerNull : public Constant { friend struct ConstantCreator; ConstantPointerNull(const ConstantPointerNull &); // DO NOT IMPLEMENT protected: - ConstantPointerNull(const PointerType *T) : ConstantPointer(T) {} + ConstantPointerNull(const PointerType *T) + : Constant(reinterpret_cast(T)) {} public: @@ -434,22 +407,18 @@ /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ConstantPointerNull *) { return true; } - static inline bool classof(const ConstantPointer *P) { - return (P->getNumOperands() == 0 && P->isNullValue()); - } - static inline bool classof(const Constant *CPV) { - return isa(CPV) && classof(cast(CPV)); - } + static bool classof(const Constant *CPV); static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; +//===--------------------------------------------------------------------------- /// ConstantPointerRef - a constant pointer value that is initialized to /// point to a global value, which lies at a constant, fixed address. /// -class ConstantPointerRef : public ConstantPointer { +class ConstantPointerRef : public Constant { friend class Module; // Modules maintain these references ConstantPointerRef(const ConstantPointerRef &); // DNI! @@ -467,21 +436,19 @@ return cast(Operands[0].get()); } + /// isNullValue - Return true if this is the value that would be returned by + /// getNullValue. + virtual bool isNullValue() const { return false; } + virtual void destroyConstant(); virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, bool DisableChecking = false); /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ConstantPointerRef *) { return true; } - static inline bool classof(const ConstantPointer *CPV) { - // check for a single operand (the target value) - return (CPV->getNumOperands() == 1); - } - static inline bool classof(const Constant *CPV) { - return isa(CPV) && classof(cast(CPV)); - } + static bool classof(const Constant *CPV); static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; From lattner at cs.uiuc.edu Mon Nov 17 14:20:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 14:20:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantHandling.cpp Message-ID: <200311172019.OAA30752@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantHandling.cpp updated: 1.40 -> 1.41 --- Log message: Implement == and != correctly. Before they would incorrectly return != for some constant exprs when they could really be the same value --- Diffs of the changes: (+24 -0) Index: llvm/lib/VMCore/ConstantHandling.cpp diff -u llvm/lib/VMCore/ConstantHandling.cpp:1.40 llvm/lib/VMCore/ConstantHandling.cpp:1.41 --- llvm/lib/VMCore/ConstantHandling.cpp:1.40 Mon Nov 17 13:21:04 2003 +++ llvm/lib/VMCore/ConstantHandling.cpp Mon Nov 17 14:19:35 2003 @@ -256,6 +256,10 @@ const Constant *V2) const { return SubClassName::LessThan((const ArgType *)V1, (const ArgType *)V2); } + virtual ConstantBool *equalto(const Constant *V1, + const Constant *V2) const { + return SubClassName::EqualTo((const ArgType *)V1, (const ArgType *)V2); + } // Casting operators. ick virtual ConstantBool *castToBool(const Constant *V) const { @@ -313,6 +317,9 @@ static ConstantBool *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } + static ConstantBool *EqualTo(const ArgType *V1, const ArgType *V2) { + return 0; + } // Casting operators. ick static ConstantBool *CastToBool (const Constant *V) { return 0; } @@ -339,6 +346,10 @@ // EmptyRules provides a concrete base class of ConstRules that does nothing // struct EmptyRules : public TemplateRules { + static ConstantBool *EqualTo(const Constant *V1, const Constant *V2) { + if (V1 == V2) return ConstantBool::True; + return 0; + } }; @@ -355,6 +366,10 @@ return ConstantBool::get(V1->getValue() < V2->getValue()); } + static ConstantBool *EqualTo(const Constant *V1, const Constant *V2) { + return ConstantBool::get(V1 == V2); + } + static Constant *And(const ConstantBool *V1, const ConstantBool *V2) { return ConstantBool::get(V1->getValue() & V2->getValue()); } @@ -397,6 +412,9 @@ // struct NullPointerRules : public TemplateRules { + static ConstantBool *EqualTo(const Constant *V1, const Constant *V2) { + return ConstantBool::True; // Null pointers are always equal + } static ConstantBool *CastToBool (const Constant *V) { return ConstantBool::False; } @@ -474,6 +492,12 @@ bool R = (BuiltinType)V1->getValue() < (BuiltinType)V2->getValue(); return ConstantBool::get(R); } + + static ConstantBool *EqualTo(const ConstantClass *V1, + const ConstantClass *V2) { + bool R = (BuiltinType)V1->getValue() == (BuiltinType)V2->getValue(); + return ConstantBool::get(R); + } static Constant *CastToPointer(const ConstantClass *V, const PointerType *PTy) { From lattner at cs.uiuc.edu Mon Nov 17 14:20:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 17 14:20:04 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/ConstantHandling.h Message-ID: <200311172019.OAA30319@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: ConstantHandling.h updated: 1.34 -> 1.35 --- Log message: Implement == and != correctly. Before they would incorrectly return != for some constant exprs when they could really be the same value --- Diffs of the changes: (+12 -13) Index: llvm/include/llvm/ConstantHandling.h diff -u llvm/include/llvm/ConstantHandling.h:1.34 llvm/include/llvm/ConstantHandling.h:1.35 --- llvm/include/llvm/ConstantHandling.h:1.34 Mon Nov 17 13:05:03 2003 +++ llvm/include/llvm/ConstantHandling.h Mon Nov 17 14:19:26 2003 @@ -48,19 +48,6 @@ class PointerType; //===----------------------------------------------------------------------===// -// Implement == and != directly... -//===----------------------------------------------------------------------===// - -inline ConstantBool *operator==(const Constant &V1, const Constant &V2) { - assert(V1.getType() == V2.getType() && "Constant types must be identical!"); - return ConstantBool::get(&V1 == &V2); -} - -inline ConstantBool *operator!=(const Constant &V1, const Constant &V2) { - return ConstantBool::get(&V1 != &V2); -} - -//===----------------------------------------------------------------------===// // Implement all other operators indirectly through TypeRules system //===----------------------------------------------------------------------===// @@ -81,6 +68,8 @@ virtual ConstantBool *lessthan(const Constant *V1, const Constant *V2) const = 0; + virtual ConstantBool *equalto(const Constant *V1, + const Constant *V2) const = 0; // Casting operators. ick virtual ConstantBool *castToBool (const Constant *V) const = 0; @@ -195,10 +184,20 @@ return ConstRules::get(V1, V2).lessthan(&V1, &V2); } +inline ConstantBool *operator==(const Constant &V1, const Constant &V2) { + assert(V1.getType() == V2.getType() && "Constant types must be identical!"); + return ConstRules::get(V1, V2).equalto(&V1, &V2); +} //===----------------------------------------------------------------------===// // Implement 'derived' operators based on what we already have... //===----------------------------------------------------------------------===// + +inline ConstantBool *operator!=(const Constant &V1, const Constant &V2) { + if (ConstantBool *V = (V1 == V2)) + return V->inverted(); // !(V1 == V2) + return 0; +} inline ConstantBool *operator>(const Constant &V1, const Constant &V2) { From brukman at cs.uiuc.edu Mon Nov 17 14:38:03 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Nov 17 14:38:03 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/VM.cpp Message-ID: <200311172037.OAA03206@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: VM.cpp updated: 1.13 -> 1.14 --- Log message: * Order #includes as per style guide * Delete blank comment lines * Eliminate space between function name and open-paren ( to be consistent --- Diffs of the changes: (+7 -8) Index: llvm/lib/ExecutionEngine/JIT/VM.cpp diff -u llvm/lib/ExecutionEngine/JIT/VM.cpp:1.13 llvm/lib/ExecutionEngine/JIT/VM.cpp:1.14 --- llvm/lib/ExecutionEngine/JIT/VM.cpp:1.13 Tue Nov 11 16:41:33 2003 +++ llvm/lib/ExecutionEngine/JIT/VM.cpp Mon Nov 17 14:37:02 2003 @@ -15,8 +15,8 @@ #include "VM.h" #include "llvm/Function.h" #include "llvm/ModuleProvider.h" -#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineCodeEmitter.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/Target/TargetMachine.h" namespace llvm { @@ -39,7 +39,6 @@ // Turn the machine code intermediate representation into bytes in memory that // may be executed. - // if (TM.addPassesToEmitMachineCode(PM, *MCE)) { std::cerr << "lli: target '" << TM.getName() << "' doesn't support machine code emission!\n"; @@ -51,9 +50,9 @@ /// just-in-time compilation passes on F, hopefully filling in /// GlobalAddress[F] with the address of F's machine code. /// -void VM::runJITOnFunction (Function *F) { +void VM::runJITOnFunction(Function *F) { static bool isAlreadyCodeGenerating = false; - assert(!isAlreadyCodeGenerating && "ERROR: RECURSIVE COMPILATION DETECTED!"); + assert(!isAlreadyCodeGenerating && "Error: Recursive compilation detected!"); // JIT the function isAlreadyCodeGenerating = true; @@ -74,7 +73,7 @@ if (F->isExternal()) return Addr = getPointerToNamedFunction(F->getName()); - runJITOnFunction (F); + runJITOnFunction(F); assert(Addr && "Code generation didn't add function to GlobalAddress table!"); return Addr; } @@ -94,10 +93,10 @@ void *OldAddr = Addr; Addr = 0; - MachineFunction::destruct (F); - runJITOnFunction (F); + MachineFunction::destruct(F); + runJITOnFunction(F); assert(Addr && "Code generation didn't add function to GlobalAddress table!"); - TM.replaceMachineCodeForFunction (OldAddr, Addr); + TM.replaceMachineCodeForFunction(OldAddr, Addr); return Addr; } From brukman at cs.uiuc.edu Mon Nov 17 14:41:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Nov 17 14:41:01 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200311172040.OAA03251@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.32 -> 1.33 --- Log message: Emit the MachineConstantPool constants in one contiguous memory `pool'. --- Diffs of the changes: (+20 -5) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.32 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.33 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.32 Tue Nov 11 16:41:33 2003 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Mon Nov 17 14:40:07 2003 @@ -187,13 +187,28 @@ void Emitter::emitConstantPool(MachineConstantPool *MCP) { const std::vector &Constants = MCP->getConstants(); + if (Constants.size() == 0) return; + + std::vector ConstantSizes; + unsigned TotalSize = 0; + // Calculate how much space we will need for all the constants for (unsigned i = 0, e = Constants.size(); i != e; ++i) { - // For now we just allocate some memory on the heap, this can be - // dramatically improved. const Type *Ty = ((Value*)Constants[i])->getType(); - void *Addr = malloc(TheVM->getTargetData().getTypeSize(Ty)); - TheVM->InitializeMemory(Constants[i], Addr); - ConstantPoolAddresses.push_back(Addr); + unsigned TySize = TheVM->getTargetData().getTypeSize(Ty); + ConstantSizes.push_back(TySize); + TotalSize += TySize; + } + // Allocate a 'pool' of memory just once + void *ConstPool = malloc(TotalSize); + if (!ConstPool) { + perror("malloc"); + abort(); + } + // Initialize each slot in the 'pool' appropriately + for (unsigned i = 0, e = Constants.size(); i != e; ++i) { + TheVM->InitializeMemory(Constants[i], ConstPool); + ConstantPoolAddresses.push_back(ConstPool); + ConstPool = (void*) ((intptr_t)ConstPool + ConstantSizes[i]); } } From brukman at cs.uiuc.edu Mon Nov 17 14:43:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Nov 17 14:43:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311172042.OAA08072@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.16 -> 1.17 --- Log message: Fix grammar. --- Diffs of the changes: (+2 -2) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.16 llvm-www/status/index.html:1.17 --- llvm-www/status/index.html:1.16 Mon Nov 17 01:02:36 2003 +++ llvm-www/status/index.html Mon Nov 17 14:42:09 2003 @@ -89,7 +89,7 @@ 6.12.00 13 Nov 2003 FAILS - Inexplicably crashes in the JIT immediately soon start-up. Not yet + Inexplicably crashes in the JIT soon after start-up. Not yet investigated. @@ -399,7 +399,7 @@
Misha Brukman
The LLVM Compiler Infrastructure
- Last modified: $Date: 2003/11/17 07:02:36 $ + Last modified: $Date: 2003/11/17 20:42:09 $ From gaeke at cs.uiuc.edu Tue Nov 18 00:19:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Nov 18 00:19:01 2003 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-nm.html Message-ID: <200311180618.AAA20371@gally.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-nm.html updated: 1.2 -> 1.3 --- Log message: Update to reflect the fact that llvm-nm can read archives now. --- Diffs of the changes: (+6 -6) Index: llvm/docs/CommandGuide/llvm-nm.html diff -u llvm/docs/CommandGuide/llvm-nm.html:1.2 llvm/docs/CommandGuide/llvm-nm.html:1.3 --- llvm/docs/CommandGuide/llvm-nm.html:1.2 Thu Oct 16 18:39:10 2003 +++ llvm/docs/CommandGuide/llvm-nm.html Tue Nov 18 00:18:09 2003 @@ -17,10 +17,11 @@

DESCRIPTION

The llvm-nm utility lists the names of symbols from the -LLVM bytecode files named on the command line, along with some -ancillary information about each symbol. If no filename is specified, -or - is used as a filename, llvm-nm reads its input from standard -input.

+LLVM bytecode files, or ar(1) archives containing LLVM +bytecode files, named on the command line. Each symbol is listed along +with some simple information about its provenance. If no filename is specified, +or - is used as a filename, llvm-nm will process a bytecode file +on its standard input stream.

llvm-nm's default output format is the traditional BSD nm(1) output format. Each such output record consists of an @@ -97,8 +98,7 @@

BUGS

-llvm-nm cannot currently see inside ar(1) library -archive files, like nm(1) can. It cannot demangle C++ mangled +llvm-nm cannot demangle C++ mangled names, like GNU nm(1) can.

EXIT STATUS

From gaeke at cs.uiuc.edu Tue Nov 18 00:20:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Nov 18 00:20:01 2003 Subject: [llvm-commits] CVS: llvm/autoconf/aclocal.m4 Message-ID: <200311180619.AAA22184@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: aclocal.m4 updated: 1.9 -> 1.10 --- Log message: Fix breakage caused by typos. Use 3-arg form of AC_DEFINE. --- Diffs of the changes: (+6 -6) Index: llvm/autoconf/aclocal.m4 diff -u llvm/autoconf/aclocal.m4:1.9 llvm/autoconf/aclocal.m4:1.10 --- llvm/autoconf/aclocal.m4:1.9 Mon Nov 17 13:46:01 2003 +++ llvm/autoconf/aclocal.m4 Tue Nov 18 00:19:27 2003 @@ -6251,13 +6251,13 @@ [ AC_LANG_SAVE AC_LANG_C - oldcflags=${CFLAGS} - CFLAGS="${CFLAGS} -Wl,-R." - AC_LINK_IFELSE([int main() { return 0;}],[ac_cv_link_use_r=yes],[ac_cv_link_se_r=no]) - CFLAGS=${oldcflags} + oldcflags="$CFLAGS" + CFLAGS="$CFLAGS -Wl,-R." + AC_LINK_IFELSE([int main() { return 0; }],[ac_cv_link_use_r=yes],[ac_cv_link_use_r=no]) + CFLAGS="$oldcflags" AC_LANG_RESTORE - if test "$ac_cv_link_use_r = yes" + if test "$ac_cv_link_use_r" = yes then - AC_DEFINE([HAVE_LINK_R],[1]) + AC_DEFINE([HAVE_LINK_R],[1],[Define if you can use -Wl,-R. to pass -R. to the linker, in order to add the current directory to the dynamic linker search path.]) fi ]) From gaeke at cs.uiuc.edu Tue Nov 18 00:21:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Nov 18 00:21:01 2003 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200311180620.AAA22261@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.55 -> 1.56 --- Log message: Regenerated using autoconf-2.57 --- Diffs of the changes: (+8 -7) Index: llvm/configure diff -u llvm/configure:1.55 llvm/configure:1.56 --- llvm/configure:1.55 Mon Nov 17 13:45:57 2003 +++ llvm/configure Tue Nov 18 00:20:41 2003 @@ -22988,10 +22988,10 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - oldcflags=${CFLAGS} - CFLAGS="${CFLAGS} -Wl,-R." + oldcflags="$CFLAGS" + CFLAGS="$CFLAGS -Wl,-R." cat >conftest.$ac_ext <<_ACEOF -int main() { return 0;} +int main() { return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 @@ -23010,19 +23010,20 @@ echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_link_se_r=no +ac_cv_link_use_r=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - CFLAGS=${oldcflags} + CFLAGS="$oldcflags" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "$ac_cv_link_use_r = yes" + if test "$ac_cv_link_use_r" = yes then - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LINK_R 1 _ACEOF From gaeke at cs.uiuc.edu Tue Nov 18 00:22:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Nov 18 00:22:01 2003 Subject: [llvm-commits] CVS: llvm/include/Config/config.h.in Message-ID: <200311180621.AAA22327@zion.cs.uiuc.edu> Changes in directory llvm/include/Config: config.h.in updated: 1.6 -> 1.7 --- Log message: Regenerated using autoheader-2.57 --- Diffs of the changes: (+4 -0) Index: llvm/include/Config/config.h.in diff -u llvm/include/Config/config.h.in:1.6 llvm/include/Config/config.h.in:1.7 --- llvm/include/Config/config.h.in:1.6 Sun Nov 9 21:06:28 2003 +++ llvm/include/Config/config.h.in Tue Nov 18 00:21:24 2003 @@ -85,6 +85,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINK_H +/* Define if you can use -Wl,-R. to pass -R. to the linker, in order to add + the current directory to the dynamic linker search path. */ +#undef HAVE_LINK_R + /* Define if mallinfo() is available on this platform. */ #undef HAVE_MALLINFO From lattner at cs.uiuc.edu Tue Nov 18 00:26:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 00:26:01 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311180625.AAA22658@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.35 -> 1.36 --- Log message: Add new bug fixed in the CFE --- Diffs of the changes: (+2 -0) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.35 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.36 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.35 Sun Nov 16 17:53:01 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Tue Nov 18 00:25:22 2003 @@ -256,6 +256,8 @@
  • Casting a string constant to void crashes llvm-gcc
  • +

  • C front-end miscompiles unsigned enums whose LLVM types are signed
  • + Notes:

      From lattner at cs.uiuc.edu Tue Nov 18 00:26:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 00:26:04 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311180625.AAA22507@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.49 -> 1.50 --- Log message: Add new bug fixed in the CFE --- Diffs of the changes: (+1 -0) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.49 llvm/docs/ReleaseNotes.html:1.50 --- llvm/docs/ReleaseNotes.html:1.49 Sun Nov 16 17:49:26 2003 +++ llvm/docs/ReleaseNotes.html Tue Nov 18 00:25:05 2003 @@ -151,6 +151,7 @@

    • [bcreader] Incorrect cast causes misread forward constant references
    • Casting a string constant to void crashes llvm-gcc
    • [adce] ADCE considers blocks without postdominators to be unreachable
    • +
    • C front-end miscompiles unsigned enums whose LLVM types are signed
    • At this time, LLVM is known to work properly with SPEC CPU 2000, the Olden From gaeke at cs.uiuc.edu Tue Nov 18 00:32:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Nov 18 00:32:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/ToolRunner.cpp Message-ID: <200311180631.AAA22795@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: ToolRunner.cpp updated: 1.11 -> 1.12 --- Log message: Only use -Wl,-R. if HAVE_LINK_R. --- Diffs of the changes: (+3 -0) Index: llvm/lib/Support/ToolRunner.cpp diff -u llvm/lib/Support/ToolRunner.cpp:1.11 llvm/lib/Support/ToolRunner.cpp:1.12 --- llvm/lib/Support/ToolRunner.cpp:1.11 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Support/ToolRunner.cpp Tue Nov 18 00:31:17 2003 @@ -13,6 +13,7 @@ #define DEBUG_TYPE "toolrunner" #include "llvm/Support/ToolRunner.h" +#include "Config/config.h" // for HAVE_LINK_R #include "Support/Debug.h" #include "Support/FileUtilities.h" #include @@ -299,7 +300,9 @@ GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file... GCCArgs.push_back("-lm"); // Hard-code the math library... GCCArgs.push_back("-O2"); // Optimize the program a bit... +#if defined (HAVE_LINK_R) GCCArgs.push_back("-Wl,-R."); // Search this dir for .so files +#endif GCCArgs.push_back(0); // NULL terminator std::cout << "" << std::flush; From lattner at cs.uiuc.edu Tue Nov 18 00:55:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 00:55:01 2003 Subject: [llvm-commits] CVS: llvm-www/.htaccess Message-ID: <200311180654.AAA23196@zion.cs.uiuc.edu> Changes in directory llvm-www: .htaccess added (r1.1) --- Log message: Tell the server to allow SSIs in html docs in this directory --- Diffs of the changes: (+2 -0) Index: llvm-www/.htaccess diff -c /dev/null llvm-www/.htaccess:1.1 *** /dev/null Tue Nov 18 00:54:07 2003 --- llvm-www/.htaccess Tue Nov 18 00:53:57 2003 *************** *** 0 **** --- 1,2 ---- + AddOutputFilter INCLUDES html + From lattner at cs.uiuc.edu Tue Nov 18 02:01:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 02:01:01 2003 Subject: [llvm-commits] CVS: llvm-www/img/lines.gif Message-ID: <200311180800.CAA23806@zion.cs.uiuc.edu> Changes in directory llvm-www/img: lines.gif added (r1.1) --- Log message: add new image --- Diffs of the changes: (+0 -0) Index: llvm-www/img/lines.gif From alkis at cs.uiuc.edu Tue Nov 18 03:45:01 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue Nov 18 03:45:01 2003 Subject: [llvm-commits] [regalloc_linearscan] CVS: llvm/include/llvm/CodeGen/LiveIntervals.h Message-ID: <200311180944.DAA23113@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervals.h updated: 1.1.2.9 -> 1.1.2.10 --- Log message: LiveIntervals: - delete unneeded member functions - computer intervals for all registers (physical and virtual) RegAllocLinearScan (major rewrite): - two registers from each register class are reserved for loading virtual registers from the stack. - register allocation happens in two passes: in the first pass registers are allocated for each virtual register interval and in the second the machine code is rewritten using the generated mapping. - live interval holes are still not used for better register allocation. - allocator was tested on test/Programs/SingleSource/Benchmarks/Shootout and it works with all but the heapsort benchmark. --- Diffs of the changes: (+1 -7) Index: llvm/include/llvm/CodeGen/LiveIntervals.h diff -u llvm/include/llvm/CodeGen/LiveIntervals.h:1.1.2.9 llvm/include/llvm/CodeGen/LiveIntervals.h:1.1.2.10 --- llvm/include/llvm/CodeGen/LiveIntervals.h:1.1.2.9 Thu Nov 13 03:48:53 2003 +++ llvm/include/llvm/CodeGen/LiveIntervals.h Tue Nov 18 03:44:33 2003 @@ -123,8 +123,6 @@ }; typedef std::vector Intervals; - typedef std::map MiIndex2MbbMap; - typedef std::map Mbb2MiIndexMap; typedef std::vector MachineBasicBlockPtrs; private: @@ -147,14 +145,10 @@ Reg2IntervalMap r2iMap_; Intervals intervals_; - MiIndex2MbbMap mii2mbbMap_; - Mbb2MiIndexMap mbb2miiMap_; public: virtual void getAnalysisUsage(AnalysisUsage &AU) const; - const Intervals& getIntervals() const { return intervals_; } - MiIndex2MbbMap& getMiIndex2MbbMap() { return mii2mbbMap_; } - Mbb2MiIndexMap& getMbb2MiIndexMap() { return mbb2miiMap_; } + Intervals& getIntervals() { return intervals_; } MachineBasicBlockPtrs getOrderedMachineBasicBlockPtrs() const { MachineBasicBlockPtrs result; for (MbbIndex2MbbMap::const_iterator From alkis at cs.uiuc.edu Tue Nov 18 03:45:04 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue Nov 18 03:45:04 2003 Subject: [llvm-commits] [regalloc_linearscan] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp LiveIntervals.cpp Message-ID: <200311180944.DAA23104@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.1.2.13 -> 1.1.2.14 LiveIntervals.cpp updated: 1.1.2.10 -> 1.1.2.11 --- Log message: LiveIntervals: - delete unneeded member functions - computer intervals for all registers (physical and virtual) RegAllocLinearScan (major rewrite): - two registers from each register class are reserved for loading virtual registers from the stack. - register allocation happens in two passes: in the first pass registers are allocated for each virtual register interval and in the second the machine code is rewritten using the generated mapping. - live interval holes are still not used for better register allocation. - allocator was tested on test/Programs/SingleSource/Benchmarks/Shootout and it works with all but the heapsort benchmark. --- Diffs of the changes: (+378 -269) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.1.2.13 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.1.2.14 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.1.2.13 Sat Nov 15 12:33:33 2003 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Nov 18 03:44:28 2003 @@ -46,28 +46,19 @@ const MRegisterInfo* mri_; MachineBasicBlock* currentMbb_; MachineBasicBlock::iterator currentInstr_; - LiveVariables* lv_; typedef LiveIntervals::Intervals Intervals; const Intervals* li_; - Intervals::const_iterator currentInterval_; IntervalPtrs active_, inactive_; typedef std::vector Regs; Regs tempUseOperands_; Regs tempDefOperands_; - typedef LiveIntervals::MiIndex2MbbMap MiIndex2MbbMap; - MiIndex2MbbMap* mii2mbbMap_; - - typedef LiveIntervals::Mbb2MiIndexMap Mbb2MiIndexMap; - Mbb2MiIndexMap* mbb2miiMap_; + Regs reserved_; typedef LiveIntervals::MachineBasicBlockPtrs MachineBasicBlockPtrs; MachineBasicBlockPtrs mbbs_; - typedef std::map Instr2IndexMap; - Instr2IndexMap i2iMap_; - typedef std::vector Phys2VirtMap; Phys2VirtMap p2vMap_; @@ -94,22 +85,19 @@ /// runOnMachineFunction - register allocate the whole function bool runOnMachineFunction(MachineFunction&); - /// processInterval - inspect current interval and add it to - /// the active list if required - void processInterval(unsigned curIndex); - /// processActiveIntervals - expire old intervals and move /// non-overlapping ones to the incative list - void processActiveIntervals(unsigned curIndex); + void processActiveIntervals(Intervals::const_iterator cur); /// processInactiveIntervals - expire old intervals and move /// overlapping ones to the active list - void processInactiveIntervals(unsigned curIndex); + void processInactiveIntervals(Intervals::const_iterator cur); - /// spillInterval - choose and spill interval. Currently we - /// spill the interval with the last end point in the active - /// and inactive lists - void spillInterval(); + /// assignStackSlotAtInterval - choose and spill + /// interval. Currently we spill the interval with the last + /// end point in the active and inactive lists and the current + /// interval + void assignStackSlotAtInterval(Intervals::const_iterator cur); /// /// register handling helpers @@ -131,15 +119,38 @@ /// virtual register if we have one, otherwise return 0 unsigned getFreePhysReg(unsigned virtReg); - /// allocateVirt2PhysReg - allocates the free physical - /// register to the virtual register passed as arguments - void allocateVirt2PhysReg(unsigned virtReg, unsigned physReg); + + /// tempPhysRegAvailable - returns true if the specifed + /// temporary physical register is available + bool tempPhysRegAvailable(unsigned physReg); + + /// getFreeTempPhysReg - return a free temprorary physical + /// register for this register class if we have one (should + /// never return 0) + unsigned getFreeTempPhysReg(const TargetRegisterClass* rc); + + /// getFreeTempPhysReg - return a free temprorary physical + /// register for this virtual register if we have one (should + /// never return 0) + unsigned getFreeTempPhysReg(unsigned virtReg) { + const TargetRegisterClass* rc = + mf_->getSSARegMap()->getRegClass(virtReg); + return getFreeTempPhysReg(rc); + } + + /// assignVirt2PhysReg - assigns the free physical register to + /// the virtual register passed as arguments + void assignVirt2PhysReg(unsigned virtReg, unsigned physReg); /// clearVirtReg - free the physical register associated with this /// virtual register and disassociate virtual->physical and /// physical->virtual mappings void clearVirtReg(unsigned virtReg); + /// assignVirt2StackSlot - assigns this virtual register to a + /// stack slot + void assignVirt2StackSlot(unsigned virtReg); + /// findOrCreateStackSlot - returns the offset of the /// specified register on the stack allocating space if /// necessary @@ -153,17 +164,12 @@ /// an assigned stack slot void loadVirt2PhysReg(unsigned virtReg, unsigned physReg); - /// getInstructionIndex() - returns the instruction index as - /// it was computed by the live interval analysis (adjusts for - /// inserted instructions. - unsigned getInstructionIndex() const; - void printVirt2PhysMap() const { - std::cerr << "\tallocated registers: "; + std::cerr << "allocated registers:\n"; for (Virt2PhysMap::const_iterator i = v2pMap_.begin(), e = v2pMap_.end(); i != e; ++i) { std::cerr << '[' << i->first << ',' - << mri_->getName(i->second) << "] "; + << mri_->getName(i->second) << "]\n"; } std::cerr << '\n'; } @@ -172,7 +178,14 @@ RA::IntervalPtrs::const_iterator e) const { if (str) std::cerr << str << " intervals:\n"; for (; i != e; ++i) { - std::cerr << "\t\t" << **i << '\n'; + std::cerr << "\t\t" << **i << " -> "; + if ((*i)->reg < MRegisterInfo::FirstVirtualRegister) { + std::cerr << mri_->getName((*i)->reg); + } + else { + std::cerr << mri_->getName(v2pMap_.find((*i)->reg)->second); + } + std::cerr << '\n'; } } }; @@ -182,190 +195,169 @@ mf_ = &fn; tm_ = &fn.getTarget(); mri_ = tm_->getRegisterInfo(); - lv_ = &getAnalysis(); li_ = &getAnalysis().getIntervals(); - currentInterval_ = li_->begin(); active_.clear(); inactive_.clear(); - mii2mbbMap_ = &getAnalysis().getMiIndex2MbbMap(); - mbb2miiMap_ = &getAnalysis().getMbb2MiIndexMap(); mbbs_ = getAnalysis().getOrderedMachineBasicBlockPtrs(); p2vMap_.resize(MRegisterInfo::FirstVirtualRegister-1); p2vMap_.clear(); v2pMap_.clear(); v2ssMap_.clear(); + // FIXME: this will work only for the X86 backend. I need to + // device an algorthm to select the minimal (considering register + // aliasing) number of temp registers to reserve so that we have 2 + // registers for each register class available. + + // reserve R32: EDI, EBX, + // R16: DI, BX, + // R8: DH, BH, + // RFP: FP5, FP6 + reserved_.push_back(19); /* EDI */ + reserved_.push_back(17); /* EBX */ + reserved_.push_back(12); /* DI */ + reserved_.push_back( 7); /* BX */ + reserved_.push_back(11); /* DH */ + reserved_.push_back( 4); /* BH */ + reserved_.push_back(28); /* FP5 */ + reserved_.push_back(29); /* FP6 */ + + // liner scan algorithm + for (Intervals::const_iterator + i = li_->begin(), e = li_->end(); i != e; ++i) { + DEBUG(std::cerr << "processing current interval: " << *i << '\n'); + + DEBUG(printIntervals("\tactive", active_.begin(), active_.end())); + DEBUG(printIntervals("\tinactive", inactive_.begin(), inactive_.end())); + + processActiveIntervals(i); + // processInactiveIntervals(i); + + // if this register is preallocated, look for an interval that + // overlaps with it and assign it to a memory location + if (i->reg < MRegisterInfo::FirstVirtualRegister) { + for (IntervalPtrs::iterator + ai = active_.begin(), ae = active_.end(); ai != ae; ++ai) { + unsigned virtReg = (*ai)->reg; + Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg); + if (it != v2pMap_.end() && it->second == i->reg) { + active_.erase(ai); + clearVirtReg(virtReg); + break; + } + } + reservePhysReg(i->reg); + active_.push_back(&*i); + } + // otherwise we are allocating a virtual register. try to find + // a free physical register or spill an interval in order to + // assign it one (we could spill the current though). + else { + unsigned physReg = getFreePhysReg(i->reg); + if (!physReg) { + assignStackSlotAtInterval(i); + } + else { + assignVirt2PhysReg(i->reg, physReg); + active_.push_back(&*i); + } + } + } + DEBUG(std::cerr << "finished register allocation\n"); + DEBUG(printVirt2PhysMap()); + + DEBUG(std::cerr << "Rewrite machine code:\n"); for (MachineBasicBlockPtrs::iterator mbbi = mbbs_.begin(), mbbe = mbbs_.end(); mbbi != mbbe; ++mbbi) { instrAdded_ = 0; currentMbb_ = *mbbi; + for (currentInstr_ = currentMbb_->begin(); currentInstr_ != currentMbb_->end(); ++currentInstr_) { - // virtual registers that were brought in just for the - // computation of the value generated by this - // instruction. they will need to be cleared at the end - tempUseOperands_.clear(); - tempDefOperands_.clear(); - assert(currentInstr_ >= currentMbb_->begin() && - currentInstr_ < currentMbb_->end() && - "current instruction/machine basic block mismatch"); - unsigned curIndex = getInstructionIndex(); - DEBUG(std::cerr << "instruction[" << curIndex << "]: "; - (*currentInstr_)->print(std::cerr, *tm_)); - DEBUG(std::cerr << "\tcurrent interval: "; - if (currentInterval_ == li_->end()) std::cerr << "NONE\n"; - else std::cerr << *currentInterval_ << '\n'); - DEBUG(printIntervals("\tactive", active_.begin(), active_.end())); - DEBUG(printIntervals("\tinactive", - inactive_.begin(), - inactive_.end())); - DEBUG(printVirt2PhysMap()); - - // FIXME: holes are completely ignored for now - // processInactiveIntervals(curIndex); - - // loop over implicit defs spilling them - DEBUG(std::cerr << "\t\tprocessing implicit defs:\n"); - const TargetInstrDescriptor& tid = - tm_->getInstrInfo().get((*currentInstr_)->getOpcode()); - for (const unsigned* id = tid.ImplicitDefs; *id; ++id) { - unsigned physReg = *id; - reservePhysReg(physReg); + DEBUG(std::cerr << "\tinstruction: "; + (*currentInstr_)->print(std::cerr, *tm_);); + DEBUG(std::cerr << "\t\tspilling temporarily defined operands " + "of previous instruction:\n"); + for (unsigned i = 0, e = tempDefOperands_.size(); i != e; ++i) { + spillVirtReg(tempDefOperands_[i]); } + tempDefOperands_.clear(); - // assign physical registers to used operands - DEBUG(std::cerr << "\t\tprocessing used operands:\n"); + // use our current mapping and actually replace and + // virtual register with its allocated physical registers + DEBUG(std::cerr << "\t\treplacing virtual registers with mapped " + "physical registers:\n"); for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); i != e; ++i) { MachineOperand& op = (*currentInstr_)->getOperand(i); - if (op.opIsUse() && op.isVirtualRegister()) { + if (op.isVirtualRegister()) { unsigned virtReg = op.getAllocatedRegNum(); - Virt2PhysMap::iterator it = v2pMap_.find(virtReg); - // virtual register is used but it is not - // allocated. it must be in a stack slot - if (it == v2pMap_.end()) { - unsigned physReg = getFreePhysReg(virtReg); - if (!physReg) { - spillInterval(); - physReg = getFreePhysReg(virtReg); - } - assert(physReg && "no available physical register?!"); - loadVirt2PhysReg(virtReg, physReg); - tempUseOperands_.push_back(virtReg); + unsigned physReg = v2pMap_[virtReg]; + // if this virtual registers lives on the stack, + // load it to a temporary physical register + if (physReg) { + DEBUG(std::cerr << "\t\t\t%reg" << virtReg + << " -> " << mri_->getName(physReg) << '\n'); + (*currentInstr_)->SetMachineOperandReg(i, physReg); } - (*currentInstr_)->SetMachineOperandReg(i, v2pMap_[virtReg]); - } - } - - // loop over killed physical registers and clear them - DEBUG(std::cerr << "\t\tprocessing killed physical registers:\n"); - for (LiveVariables::killed_iterator - ki = lv_->killed_begin(*currentInstr_), - ke = lv_->killed_end(*currentInstr_); - ki != ke; ++ki) { - unsigned reg = ki->second; - if (reg < MRegisterInfo::FirstVirtualRegister) { - clearReservedPhysReg(reg); - } - } - - // loop over dead physical registers and clear them - DEBUG(std::cerr << "\t\tprocessing dead physical registers:\n"); - for (LiveVariables::killed_iterator - ki = lv_->dead_begin(*currentInstr_), - ke = lv_->dead_end(*currentInstr_); - ki != ke; ++ki) { - unsigned reg = ki->second; - if (reg < MRegisterInfo::FirstVirtualRegister) { - clearReservedPhysReg(reg); } } - - DEBUG(std::cerr << "\t\tclearing temporarily used operands:\n"); - for (unsigned i = 0, e = tempUseOperands_.size(); i != e; ++i) { - clearVirtReg(tempUseOperands_[i]); - } - - // this will expire intervals that are dead right after - // the execution of this instruction - processActiveIntervals(curIndex + 1); - - processInterval(curIndex); - - // loop over operands and spill all already defined - // physical registers - DEBUG(std::cerr << "\t\tprocessing already allocated physical " + DEBUG(std::cerr << "\t\tloading temporarily used operands to " "registers:\n"); for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); i != e; ++i) { MachineOperand& op = (*currentInstr_)->getOperand(i); - if (op.isPhysicalRegister() && - (op.opIsDefOnly() || op.opIsDefAndUse())) { - unsigned physReg = op.getAllocatedRegNum(); - reservePhysReg(physReg); - } - } - - // assign physical registers to not allocated defined operands - DEBUG(std::cerr << "\t\tprocessing not allocated defined " - "operands:\n"); - for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); - i != e; ++i) { - MachineOperand& op = (*currentInstr_)->getOperand(i); - if ((op.opIsDefOnly() || op.opIsDefAndUse()) && - op.isVirtualRegister()) { + if (op.isVirtualRegister() && op.opIsUse()) { unsigned virtReg = op.getAllocatedRegNum(); - Virt2PhysMap::iterator it = v2pMap_.find(virtReg); - // virtual register is defined but it is not - // allocated. it must be in a stack slot - if (it == v2pMap_.end()) { - unsigned physReg = getFreePhysReg(virtReg); - if (!physReg) { - spillInterval(); - physReg = getFreePhysReg(virtReg); - } - assert(physReg && "no available physical register?!"); - // load from stack only if we are going to use the value - if (op.opIsDefAndUse()) { - loadVirt2PhysReg(virtReg, physReg); - } - // otherwise just assign the mapping - else { - allocateVirt2PhysReg(virtReg, physReg); - } - tempDefOperands_.push_back(virtReg); + unsigned physReg = v2pMap_[virtReg]; + if (!physReg) { + physReg = getFreeTempPhysReg(virtReg); } - (*currentInstr_)->SetMachineOperandReg(i, v2pMap_[virtReg]); + loadVirt2PhysReg(virtReg, physReg); + tempUseOperands_.push_back(virtReg); + (*currentInstr_)->SetMachineOperandReg(i, physReg); } } - // interval maybe spilled so we need to pull in any defs - // temporarily and spill them after the instruction is - // done + DEBUG(std::cerr << "\t\tclearing temporarily used operands:\n"); + for (unsigned i = 0, e = tempUseOperands_.size(); i != e; ++i) { + clearVirtReg(tempUseOperands_[i]); + } + tempUseOperands_.clear(); - // use our current mapping and actually replace and - // virtual register with its allocated physical registers + DEBUG(std::cerr << "\t\tassigning temporarily defined operands to " + "registers:\n"); for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); i != e; ++i) { MachineOperand& op = (*currentInstr_)->getOperand(i); - if (op.isVirtualRegister()) { + if (op.isVirtualRegister() && !op.opIsUse()) { unsigned virtReg = op.getAllocatedRegNum(); unsigned physReg = v2pMap_[virtReg]; - assert(physReg && "should not have virtual registers here"); + if (!physReg) { + physReg = getFreeTempPhysReg(virtReg); + } + if (op.opIsDefAndUse()) { + loadVirt2PhysReg(virtReg, physReg); + } + else { + assignVirt2PhysReg(virtReg, physReg); + } + tempDefOperands_.push_back(virtReg); (*currentInstr_)->SetMachineOperandReg(i, physReg); } } - // if the instructions is a two address instruction: - // - //"a = b + c" but a and b must be the same register, - //insert "a = b" before it and make the original - //instruction "a = a + c") - if (tm_->getInstrInfo().isTwoAddrInstr( - (*currentInstr_)->getOpcode())) { + // if the instruction is a two address instruction and the + // source operands are not identical we need to insert + // extra instructions. + + unsigned opcode = (*currentInstr_)->getOpcode(); + if (tm_->getInstrInfo().isTwoAddrInstr(opcode) && + (*currentInstr_)->getOperand(0).getAllocatedRegNum() != + (*currentInstr_)->getOperand(1).getAllocatedRegNum()) { assert((*currentInstr_)->getOperand(1).isRegister() && (*currentInstr_)->getOperand(1).getAllocatedRegNum() && (*currentInstr_)->getOperand(1).opIsUse() && @@ -375,26 +367,62 @@ (*currentInstr_)->getOperand(0).getAllocatedRegNum(); unsigned regB = (*currentInstr_)->getOperand(1).getAllocatedRegNum(); + unsigned regC = + ((*currentInstr_)->getNumOperands() > 2 && + (*currentInstr_)->getOperand(2).isRegister()) ? + (*currentInstr_)->getOperand(2).getAllocatedRegNum() : + 0; + const TargetRegisterClass* rc = mri_->getRegClass(regA); - instrAdded_ += mri_->copyRegToReg(*currentMbb_, - currentInstr_, - regA, - regB, - rc); - tempUseOperands_.erase(remove(tempUseOperands_.begin(), - tempUseOperands_.end(), - regB), - tempUseOperands_.end()); - (*currentInstr_)->SetMachineOperandReg(1, regA); - } - DEBUG(std::cerr << "\t\tspilling temporarily defined operands:\n"); - for (unsigned i = 0, e = tempDefOperands_.size(); i != e; ++i) { - spillVirtReg(tempDefOperands_[i]); + // special case: "a = b op a". If b is a temporary + // reserved register rewrite as: "b = b op a; a = b" + // otherwise use a temporary reserved register t and + // rewrite as: "t = b; t = t op a; a = t" + if (regC && regA == regC) { + // b is a temp reserved register + if (find(reserved_.begin(), reserved_.end(), + regB) != reserved_.end()) { + (*currentInstr_)->SetMachineOperandReg(0, regB); + ++currentInstr_; + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + regA, + regB, + rc); + --currentInstr_; + } + // b is just a normal register + else { + unsigned tempReg = getFreeTempPhysReg(rc); + assert (tempReg && + "no free temp reserved physical register?"); + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + tempReg, + regB, + rc); + (*currentInstr_)->SetMachineOperandReg(0, tempReg); + (*currentInstr_)->SetMachineOperandReg(1, tempReg); + ++currentInstr_; + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + regA, + tempReg, + rc); + --currentInstr_; + } + } + // "a = b op c" gets rewritten to "a = b; a = a op c" + else { + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + regA, + regB, + rc); + (*currentInstr_)->SetMachineOperandReg(1, regA); + } } - - DEBUG(std::cerr << "instruction[" << curIndex << "]: "; - (*currentInstr_)->print(std::cerr, *tm_)); } for (unsigned i = 0, e = p2vMap_.size(); i != e; ++i) { @@ -406,38 +434,23 @@ return true; } -void RA::processInterval(unsigned curIndex) +void RA::processActiveIntervals(Intervals::const_iterator cur) { - // liner scan algorithm - assert((currentInterval_ == li_->end() || - currentInterval_->start() >= curIndex) - && "skipping intervals?"); - - if (currentInterval_ != li_->end() && - currentInterval_->start() == curIndex) { - DEBUG(std::cerr << "\t\tprocessing current interval:\n"); - unsigned virtReg = currentInterval_->reg; - unsigned physReg = getFreePhysReg(virtReg); - - if (!physReg) { - spillInterval(); - physReg = getFreePhysReg(virtReg); - } - allocateVirt2PhysReg(virtReg, physReg); - active_.push_back(&*currentInterval_); - ++currentInterval_; - } -} - -void RA::processActiveIntervals(unsigned curIndex) -{ - DEBUG(std::cerr << "\t\tprocessing active intervals:\n"); + DEBUG(std::cerr << "\tprocessing active intervals:\n"); for (IntervalPtrs::iterator i = active_.begin(); i != active_.end();) { - unsigned virtReg = (*i)->reg; - // remove expired intervals - if ((*i)->expired(curIndex)) { - DEBUG(std::cerr << "\t\t\tinterval " << **i << " expired\n"); - clearVirtReg(virtReg); + unsigned reg = (*i)->reg; + // remove expired intervals. we expire earlier because this if + // an interval expires this is going to be the last use. in + // this case we can reuse the register for a def in the same + // instruction + if ((*i)->expired(cur->start() + 1)) { + DEBUG(std::cerr << "\t\tinterval " << **i << " expired\n"); + if (reg < MRegisterInfo::FirstVirtualRegister) { + clearReservedPhysReg(reg); + } + else { + p2vMap_[v2pMap_[reg]] = 0; + } // remove interval from active i = active_.erase(i); } @@ -456,9 +469,9 @@ } } -void RA::processInactiveIntervals(unsigned curIndex) +void RA::processInactiveIntervals(Intervals::const_iterator cur) { -// DEBUG(std::cerr << "\t\tprocessing inactive intervals:\n"); +// DEBUG(std::cerr << "\tprocessing inactive intervals:\n"); // for (IntervalPtrs::iterator i = inactive_.begin(); i != inactive_.end();) { // unsigned virtReg = (*i)->reg; // // remove expired intervals @@ -483,36 +496,94 @@ // } } -void RA::spillInterval() +void RA::assignStackSlotAtInterval(Intervals::const_iterator cur) { - DEBUG(std::cerr << "\t\tspilling at interval "<< *currentInterval_<< ":\n"); + DEBUG(std::cerr << "\t\tassigning stack slot at interval " + << *cur << ":\n"); assert(!active_.empty() && "active set cannot be empty when choosing a register to spill"); - IntervalPtrs::iterator lastEnd = active_.begin(); - for (IntervalPtrs::iterator i = lastEnd + 1, e = active_.end(); + const TargetRegisterClass* rcCur = + mf_->getSSARegMap()->getRegClass(cur->reg); + + // find the interval for a virtual register that ends last in + // active and belongs to the same register class as the current + // interval + IntervalPtrs::iterator lastEndActive = active_.begin(); + for (IntervalPtrs::iterator e = active_.end(); + lastEndActive != e; ++lastEndActive) { + if ((*lastEndActive)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*lastEndActive)->reg]); + if (rcCur == rc) { + break; + } + } + } + for (IntervalPtrs::iterator i = lastEndActive, e = active_.end(); i != e; ++i) { - if ((*lastEnd)->end() < (*i)->end()) { - lastEnd = i; + if ((*i)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*i)->reg]); + if (rcCur == rc && + (*lastEndActive)->end() < (*i)->end()) { + lastEndActive = i; + } + } + } + + // find the interval for a virtual register that ends last in + // inactive and belongs to the same register class as the current + // interval + IntervalPtrs::iterator lastEndInactive = inactive_.begin(); + for (IntervalPtrs::iterator e = inactive_.end(); + lastEndInactive != e; ++lastEndInactive) { + if ((*lastEndInactive)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*lastEndInactive)->reg]); + if (rcCur == rc) { + break; + } } } - bool inInactive = false; - for (IntervalPtrs::iterator i = inactive_.begin(), e = inactive_.end(); + for (IntervalPtrs::iterator i = lastEndInactive, e = inactive_.end(); i != e; ++i) { - if ((*lastEnd)->end() < (*i)->end()) { - lastEnd = i; - inInactive = true; + if ((*i)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*i)->reg]); + if (rcCur == rc && + (*lastEndInactive)->end() < (*i)->end()) { + lastEndInactive = i; + } } } - DEBUG(std::cerr << "\t\t\tspilling interval " << **lastEnd << "\n"); - // spill last in active and inactive - unsigned virtReg = (*lastEnd)->reg; - spillVirtReg(virtReg); - if (inInactive) { - inactive_.erase(lastEnd); + unsigned lastEndActiveInactive = 0; + if (lastEndActive != active_.end() && + lastEndActiveInactive < (*lastEndActive)->end()) { + lastEndActiveInactive = (*lastEndActive)->end(); + } + if (lastEndInactive != inactive_.end() && + lastEndActiveInactive < (*lastEndInactive)->end()) { + lastEndActiveInactive = (*lastEndInactive)->end(); + } + + if (lastEndActiveInactive > cur->end()) { + if (lastEndInactive == inactive_.end() || + (*lastEndActive)->end() > (*lastEndInactive)->end()) { + assignVirt2StackSlot((*lastEndActive)->reg); + active_.erase(lastEndActive); + } + else { + assignVirt2StackSlot((*lastEndInactive)->reg); + inactive_.erase(lastEndInactive); + } + unsigned physReg = getFreePhysReg(cur->reg); + assert(physReg && "no free physical register after spill?"); + assignVirt2PhysReg(cur->reg, physReg); + active_.push_back(&*cur); } else { - active_.erase(lastEnd); + assignVirt2StackSlot(cur->reg); } } @@ -559,12 +630,17 @@ } } + // if it is one of the reserved registers it is still not free + if (find(reserved_.begin(), reserved_.end(), physReg) != reserved_.end()) { + return false; + } + return true; } unsigned RA::getFreePhysReg(unsigned virtReg) { - DEBUG(std::cerr << "\t\t\tgetting free physical register: "); + DEBUG(std::cerr << "\t\tgetting free physical register: "); const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg); TargetRegisterClass::iterator reg = rc->allocation_order_begin(*mf_); TargetRegisterClass::iterator regEnd = rc->allocation_order_end(*mf_); @@ -581,17 +657,51 @@ return 0; } -void RA::allocateVirt2PhysReg(unsigned virtReg, unsigned physReg) +bool RA::tempPhysRegAvailable(unsigned physReg) { - assert(physRegAvailable(physReg) && + assert(find(reserved_.begin(), reserved_.end(), physReg) != reserved_.end() + && "cannot call this method with a non reserved temp register"); + + if (p2vMap_[physReg]) { + return false; + } + + // if it aliases other registers it is still not free + for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as) { + if (p2vMap_[*as]) { + return false; + } + } + + return true; +} + +unsigned RA::getFreeTempPhysReg(const TargetRegisterClass* rc) +{ + DEBUG(std::cerr << "\t\tgetting free temporary physical register: "); + + for (Regs::const_iterator + reg = reserved_.begin(), regEnd = reserved_.end(); + reg != regEnd; ++reg) { + if (rc == mri_->getRegClass(*reg) && tempPhysRegAvailable(*reg)) { + assert(*reg != 0 && "Cannot use register!"); + DEBUG(std::cerr << mri_->getName(*reg) << '\n'); + return *reg; // Found an unused register! + } + } + assert(0 && "no free temporary physical register?"); + return 0; +} + +void RA::assignVirt2PhysReg(unsigned virtReg, unsigned physReg) +{ + assert((physRegAvailable(physReg) || + find(reserved_.begin(), + reserved_.end(), + physReg) != reserved_.end()) && "attempt to allocate to a not available physical register"); - Virt2PhysMap::iterator it = v2pMap_.find(virtReg); - bool inserted = v2pMap_.insert(std::make_pair(virtReg, physReg)).second; - assert(inserted && - "attempt to allocate an already allocated virtual register"); + v2pMap_[virtReg] = physReg; p2vMap_[physReg] = virtReg; - DEBUG(std::cerr << "\t\t\t\tallocated register " << virtReg << " to " - << mri_->getName(physReg) << '\n'); } void RA::clearVirtReg(unsigned virtReg) @@ -600,14 +710,28 @@ assert(it != v2pMap_.end() && "attempting to clear a not allocated virtual register"); unsigned physReg = it->second; - assert(p2vMap_[physReg] == virtReg && - "virt2physMap and phys2virtMap mismatch"); p2vMap_[physReg] = 0; - v2pMap_.erase(it); - DEBUG(std::cerr << "\t\t\t\tcleared register " << mri_->getName(physReg) + v2pMap_[virtReg] = 0; // this marks that this virtual register + // lives on the stack + DEBUG(std::cerr << "\t\t\tcleared register " << mri_->getName(physReg) << "\n"); } +void RA::assignVirt2StackSlot(unsigned virtReg) +{ + const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg); + int frameIndex = mf_->getFrameInfo()->CreateStackObject(rc); + + bool inserted = v2ssMap_.insert(std::make_pair(virtReg, frameIndex)).second; + assert(inserted && + "attempt to assign stack slot to already assigned register?"); + // if the virtual register was previously assigned clear the mapping + // and free the virtual register + if (v2pMap_.find(virtReg) != v2pMap_.end()) { + clearVirtReg(virtReg); + } +} + int RA::findOrCreateStackSlot(unsigned virtReg) { // use lower_bound so that we can do a possibly O(1) insert later @@ -645,15 +769,7 @@ ++numReloaded; instrAdded_ += mri_->loadRegFromStackSlot(*currentMbb_, currentInstr_, physReg, frameIndex, rc); - allocateVirt2PhysReg(virtReg, physReg); -} - -unsigned RA::getInstructionIndex() const -{ - Mbb2MiIndexMap::const_iterator it = mbb2miiMap_->find(currentMbb_); - assert(it != mbb2miiMap_->end() && - "no MachineInstruction index for basic block?"); - return it->second + (currentInstr_ - currentMbb_->begin()) - instrAdded_; + assignVirt2PhysReg(virtReg, physReg); } FunctionPass* llvm::createLinearScanRegisterAllocator() { Index: llvm/lib/CodeGen/LiveIntervals.cpp diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.1.2.10 llvm/lib/CodeGen/LiveIntervals.cpp:1.1.2.11 --- llvm/lib/CodeGen/LiveIntervals.cpp:1.1.2.10 Thu Nov 13 03:48:51 2003 +++ llvm/lib/CodeGen/LiveIntervals.cpp Tue Nov 18 03:44:30 2003 @@ -65,8 +65,6 @@ r2iMap_.clear(); r2iMap_.clear(); intervals_.clear(); - mii2mbbMap_.clear(); - mbb2miiMap_.clear(); // mark allocatable registers allocatableRegisters_.resize(MRegisterInfo::FirstVirtualRegister); @@ -91,16 +89,11 @@ bool inserted = mbbi2mbbMap_.insert(std::make_pair(entry.second, entry.first)).second; assert(inserted && "multiple index -> MachineBasicBlock"); - inserted = mbb2miiMap_.insert(std::make_pair(&*mbb, miIndex)).second; - assert(inserted && "multiple MachineBasicBlock -> index mappings"); for (MachineBasicBlock::iterator mi = mbb->begin(), miEnd = mbb->end(); mi != miEnd; ++mi) { inserted = mi2iMap_.insert(std::make_pair(*mi, miIndex)).second; assert(inserted && "multiple MachineInstr -> index mappings"); - inserted = - mii2mbbMap_.insert(std::make_pair(miIndex, &*mbb)).second; - assert(inserted && "multiple index -> MachineBasicBlock mappings"); ++miIndex; } } @@ -284,10 +277,10 @@ instr->print(std::cerr, *tm_);); // handle implicit defs -// for (const unsigned* id = tid.ImplicitDefs; *id; ++id) { -// unsigned physReg = *id; -// handlePhysicalRegisterDef(mbb, mi, physReg); -// } + for (const unsigned* id = tid.ImplicitDefs; *id; ++id) { + unsigned physReg = *id; + handlePhysicalRegisterDef(mbb, mi, physReg); + } // handle explicit defs for (int i = instr->getNumOperands() - 1; i >= 0; --i) { From criswell at cs.uiuc.edu Tue Nov 18 10:06:00 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Nov 18 10:06:00 2003 Subject: [llvm-commits] CVS: llvm/docs/FAQ.html Message-ID: <200311181605.KAA26810@choi.cs.uiuc.edu> Changes in directory llvm/docs: FAQ.html updated: 1.10 -> 1.11 --- Log message: Added information on the GCC front end. --- Diffs of the changes: (+64 -1) Index: llvm/docs/FAQ.html diff -u llvm/docs/FAQ.html:1.10 llvm/docs/FAQ.html:1.11 --- llvm/docs/FAQ.html:1.10 Thu Nov 6 15:55:44 2003 +++ llvm/docs/FAQ.html Tue Nov 18 10:05:23 2003 @@ -306,12 +306,75 @@ +

      + +
      +

      +When I compile software that uses a configure script, the configure script +thinks my system has all of the header files and libraries it is testing for. +How do I get configure to work correctly? +

      +
      + +
      +

      +The configure script is getting things wrong because the LLVM linker allows +symbols to be undefined at link time (so that they can be resolved during JIT +or translation to the C back end). That is why configure thinks your system +"has everything." +

      +

      +To work around this, perform the following steps: +

      + +
        +
      1. + Make sure the CC and CXX environment variables contains the full path to the + LLVM GCC front end. +
      2. + +
      3. + Make sure that the regular C compiler is first in your PATH. +
      4. + +
      5. + Add the string "-Wl,-native" to your CFLAGS environment variable. +
      6. +
      + +

      +This will allow the gccld linker to create a native code executable instead of +a shell script that runs the JIT. Creating native code requires standard +linkage, which in turn will allow the configure script to find out if code is +not linking on your system because the feature isn't available on your system. +

      +
      + +
      +When I compile code using the LLVM GCC front end, it complains that it cannot +find crtend.o. +

      +
      + +
      +In order to find crtend.o, you must have the directory in which it lives in +your LLVM_LIB_SEARCH_PATH environment variable. For the binary distribution of +the LLVM GCC front end, this will be the full path of the bytecode-libs +directory inside of the LLVM GCC distribution. +

      +
      + +
      From criswell at cs.uiuc.edu Tue Nov 18 10:10:04 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Nov 18 10:10:04 2003 Subject: [llvm-commits] CVS: llvm/docs/FAQ.html Message-ID: <200311181609.KAA26864@choi.cs.uiuc.edu> Changes in directory llvm/docs: FAQ.html updated: 1.11 -> 1.12 --- Log message: Added the new GCC front end section to the table of contents. --- Diffs of the changes: (+16 -1) Index: llvm/docs/FAQ.html diff -u llvm/docs/FAQ.html:1.11 llvm/docs/FAQ.html:1.12 --- llvm/docs/FAQ.html:1.11 Tue Nov 18 10:05:23 2003 +++ llvm/docs/FAQ.html Tue Nov 18 10:08:49 2003 @@ -49,6 +49,21 @@
    • I've built LLVM and am testing it, but the tests freeze.
    • Why do test results differ when I perform different types of builds?
    • + +
    • GCC Front End +
        +
      1. + When I compile software that uses a configure script, the configure script + thinks my system has all of the header files and libraries it is testing + for. How do I get configure to work correctly? +
      2. + +
      3. + When I compile code using the LLVM GCC front end, it complains that it + cannot find crtend.o. +
      4. +
      +
    • @@ -374,7 +389,7 @@ From lattner at cs.uiuc.edu Tue Nov 18 11:05:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 11:05:04 2003 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200311181704.LAA09559@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.87 -> 1.88 --- Log message: Add new status update --- Diffs of the changes: (+1 -0) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.87 llvm-www/www-index.html:1.88 --- llvm-www/www-index.html:1.87 Wed Nov 12 22:28:01 2003 +++ llvm-www/www-index.html Tue Nov 18 11:03:51 2003 @@ -274,6 +274,7 @@ Status Updates:
        +
      • November 18, 2003
      • October 7, 2003
      • September 10, 2003
      • August 15, 2003 From lattner at cs.uiuc.edu Tue Nov 18 11:48:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 11:48:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp Message-ID: <200311181747.LAA11033@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectSimple.cpp updated: 1.139 -> 1.140 --- Log message: Fix PR123 --- Diffs of the changes: (+7 -7) Index: llvm/lib/Target/X86/InstSelectSimple.cpp diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.139 llvm/lib/Target/X86/InstSelectSimple.cpp:1.140 --- llvm/lib/Target/X86/InstSelectSimple.cpp:1.139 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Target/X86/InstSelectSimple.cpp Tue Nov 18 11:47:05 2003 @@ -1375,7 +1375,7 @@ switch (Class) { case cFP: // Floating point divide if (isDiv) { - BuildMI(BB, X86::FpDIV, 2, ResultReg).addReg(Op0Reg).addReg(Op1Reg); + BMI(BB, IP, X86::FpDIV, 2, ResultReg).addReg(Op0Reg).addReg(Op1Reg); } else { // Floating point remainder... MachineInstr *TheCall = BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("fmod", true); @@ -1420,26 +1420,26 @@ unsigned ExtReg = ExtRegs[Class]; // Put the first operand into one of the A registers... - BuildMI(BB, MovOpcode[Class], 1, Reg).addReg(Op0Reg); + BMI(BB, IP, MovOpcode[Class], 1, Reg).addReg(Op0Reg); if (isSigned) { // Emit a sign extension instruction... unsigned ShiftResult = makeAnotherReg(Ty); - BuildMI(BB, SarOpcode[Class], 2, ShiftResult).addReg(Op0Reg).addZImm(31); - BuildMI(BB, MovOpcode[Class], 1, ExtReg).addReg(ShiftResult); + BMI(BB, IP, SarOpcode[Class], 2, ShiftResult).addReg(Op0Reg).addZImm(31); + BMI(BB, IP, MovOpcode[Class], 1, ExtReg).addReg(ShiftResult); } else { // If unsigned, emit a zeroing instruction... (reg = xor reg, reg) - BuildMI(BB, ClrOpcode[Class], 2, ExtReg).addReg(ExtReg).addReg(ExtReg); + BMI(BB, IP, ClrOpcode[Class], 2, ExtReg).addReg(ExtReg).addReg(ExtReg); } // Emit the appropriate divide or remainder instruction... - BuildMI(BB, DivOpcode[isSigned][Class], 1).addReg(Op1Reg); + BMI(BB, IP, DivOpcode[isSigned][Class], 1).addReg(Op1Reg); // Figure out which register we want to pick the result out of... unsigned DestReg = isDiv ? Reg : ExtReg; // Put the result into the destination register... - BuildMI(BB, MovOpcode[Class], 1, ResultReg).addReg(DestReg); + BMI(BB, IP, MovOpcode[Class], 1, ResultReg).addReg(DestReg); } From lattner at cs.uiuc.edu Tue Nov 18 14:25:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 14:25:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2003-11-18-PtrMemConstantInitializer.cpp Message-ID: <200311182024.OAA06334@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2003-11-18-PtrMemConstantInitializer.cpp added (r1.1) --- Log message: Testcase for PR128 --- Diffs of the changes: (+12 -0) Index: llvm/test/Regression/C++Frontend/2003-11-18-PtrMemConstantInitializer.cpp diff -c /dev/null llvm/test/Regression/C++Frontend/2003-11-18-PtrMemConstantInitializer.cpp:1.1 *** /dev/null Tue Nov 18 14:24:56 2003 --- llvm/test/Regression/C++Frontend/2003-11-18-PtrMemConstantInitializer.cpp Tue Nov 18 14:24:46 2003 *************** *** 0 **** --- 1,12 ---- + struct Gfx { + void opMoveSetShowText(); + }; + + struct Operator { + void (Gfx::*func)(); + }; + + Operator opTab[] = { + {&Gfx::opMoveSetShowText}, + }; + From lattner at cs.uiuc.edu Tue Nov 18 14:31:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 14:31:02 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2003-11-18-EnumArray.cpp Message-ID: <200311182030.OAA11994@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2003-11-18-EnumArray.cpp added (r1.1) --- Log message: New testcase for PR125 --- Diffs of the changes: (+12 -0) Index: llvm/test/Regression/C++Frontend/2003-11-18-EnumArray.cpp diff -c /dev/null llvm/test/Regression/C++Frontend/2003-11-18-EnumArray.cpp:1.1 *** /dev/null Tue Nov 18 14:30:10 2003 --- llvm/test/Regression/C++Frontend/2003-11-18-EnumArray.cpp Tue Nov 18 14:30:00 2003 *************** *** 0 **** --- 1,12 ---- + enum TchkType { + tchkNum, tchkString, tchkSCN, tchkNone + }; + + struct Operator { + enum TchkType tchk[8]; + }; + + struct Operator opTab[] = { + {{tchkNum, tchkNum, tchkString} } + }; + From lattner at cs.uiuc.edu Tue Nov 18 15:07:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 15:07:05 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr Message-ID: <200311182106.PAA21810@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2003-11-18-MemberInitializationCasting.cpp.tr added (r1.1) --- Log message: new testcase for PR126 --- Diffs of the changes: (+13 -0) Index: llvm/test/Regression/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr diff -c /dev/null llvm/test/Regression/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr:1.1 *** /dev/null Tue Nov 18 15:06:05 2003 --- llvm/test/Regression/C++Frontend/2003-11-18-MemberInitializationCasting.cpp.tr Tue Nov 18 15:05:55 2003 *************** *** 0 **** --- 1,13 ---- + // RUN: %llvmgcc -xc++ -S -o - %s | not grep ' cast ' + + struct A { + A() : i(0) {} + int getI() {return i;} + int i; + }; + + int f(int j) + { + A a; + return j+a.getI(); + } From brukman at cs.uiuc.edu Tue Nov 18 16:30:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Nov 18 16:30:02 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311182229.QAA28346@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.17 -> 1.18 --- Log message: Added the latest flurry of bugs and fixes. --- Diffs of the changes: (+26 -2) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.17 llvm-www/status/index.html:1.18 --- llvm-www/status/index.html:1.17 Mon Nov 17 14:42:09 2003 +++ llvm-www/status/index.html Tue Nov 18 16:29:35 2003 @@ -45,7 +45,31 @@ Status Notes - + + + xpdf + ?? + 18 Nov 2003 + ??? + At least one bug fixed: bug 125. + + + + webcpp + 0.8 + 18 Nov 2003 + FAILS + Segfaults before exit on x86 JIT, see bug 124. + + + + kimwitu++ + 2.3.8 + 18 Nov 2003 + ??? + At least one bug fixed: bug 123. Still looking for + the inefficiency: bug 127. + ed @@ -399,7 +423,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/17 20:42:09 $ + Last modified: $Date: 2003/11/18 22:29:35 $ From lattner at cs.uiuc.edu Tue Nov 18 17:04:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:04:02 2003 Subject: [llvm-commits] CVS: llvm-www/llvm.css Message-ID: <200311182303.RAA02381@zion.cs.uiuc.edu> Changes in directory llvm-www: llvm.css updated: 1.6 -> 1.7 --- Log message: Add some new stuff. Squish the title a bit --- Diffs of the changes: (+22 -2) Index: llvm-www/llvm.css diff -u llvm-www/llvm.css:1.6 llvm-www/llvm.css:1.7 --- llvm-www/llvm.css:1.6 Tue Oct 28 13:04:39 2003 +++ llvm-www/llvm.css Tue Nov 18 17:03:14 2003 @@ -14,8 +14,28 @@ /* Main website */ .www_title { font-family: "Georgia,Palatino,Times,Roman"; font-size: 33pt; - text-align: center; - margin-top: 0.5em; margin-bottom: 0.3em; } + text-align: center;} + +.www_sidebar { text-align: center; + font-family: "Georgia,Palatino,Times,Roman"; + font-size: 12pt; + margin-left: 0em; margin-right: 0em; + padding: 0.15em 0.15em 0.15em .15em; + width: 100%; + background: url("img/lines.gif"); + border: 2px solid #cccccc } + +.www_sectiontitle { + border-width: 1px; + border-style: solid none solid none; + text-align: center; + vertical-align: middle; + font-family: "Georgia,Palatino,Times,Roman"; + font-weight: bold; font-size: 18pt; + background: url("img/lines.gif"); + padding: 0.1em 0.1em 0.1em .1em; + width: 100%; + margin-bottom: 0.3em; } /* Publications */ .pub_title { font-family: "Georgia,Palatino,Times,Roman"; From lattner at cs.uiuc.edu Tue Nov 18 17:04:06 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:04:06 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311182303.RAA02222@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.2 -> 1.3 --- Log message: Convert to look more like an LLVM page. Clarify some of the prose --- Diffs of the changes: (+53 -29) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.2 llvm-www/demo/index.cgi:1.3 --- llvm-www/demo/index.cgi:1.2 Wed Nov 12 15:10:24 2003 +++ llvm-www/demo/index.cgi Tue Nov 18 17:02:55 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/12 21:10:24 $ +# Last modified $Date: 2003/11/18 23:02:55 $ # use CGI; @@ -17,17 +17,10 @@ if (! -d "/tmp/webcompile") { mkdir ("/tmp/webcompile", 0777); } $LOGFILE = '/tmp/webcompile/log.txt'; -$FORM_TITLE = 'Try out LLVM in your Browser!'; $FORM_URL = 'http://llvm.cs.uiuc.edu/demo/index.cgi'; $CONTACT_ADDRESS = 'gaeke -at- uiuc.edu'; $LOGO_IMAGE_URL = 'cathead.png'; $EXPLAIN_PARAGRAPH = <-save-temps or - -E options to gcc) first. END @PREPENDPATHDIRS = ( '/home/vadve/gaeke/llvm/tools/Debug', '/home/vadve/gaeke/bin' ); @@ -108,26 +101,48 @@ } $c = new CGI; -print $c->header, - $c->start_html( - -title => $FORM_TITLE, - -BGCOLOR => '#99bbff' - ), - $c->h3($FORM_TITLE); -if ($LOGO_IMAGE_URL) { print ""; } +print $c->header; -print "

        $EXPLAIN_PARAGRAPH

        ", - $c->start_multipart_form( 'POST', $FORM_URL ); +print < + + + Try out LLVM in your browser! + + + + +
        + The LLVM Compiler Infrastructure +

        + +
        + Try out LLVM in your browser! +
        +EOF + + +if ($LOGO_IMAGE_URL) { + print ""; +} + +print <Bitter Melon the cat says, paste a C/C++ program in the text box or upload + one from your computer, and you can see the equivalent LLVM code, meow!!

        + +

        If you want to upload a file from a program with header files, you should + preprocess it (e.g., with the -save-temps or -E options to + gcc) first.

        + +END + + +print $c->start_multipart_form( 'POST', $FORM_URL ); print "Upload a file: "; print $c->filefield( -name => 'uploaded_file', -default => '' ); -print "

        Or type your "; -print $c->radio_group( - -name => 'language', - -values => [ 'C', 'C++' ], - -default => 'C' -); -print " source text below:

        "; +print "

        Or type your source code in below:

        \n"; $source = $c->param('source'); print $c->textarea( @@ -137,12 +152,21 @@ -default => $source ); -print "

        "; -print $c->checkbox( - -name => 'cxxdemangle', - -label => -'Demangle C++ names in output using c++filt (warning: may produce asyntactic output)' +print "

        \n"; + +print "

        By the way, what language is this code in?: ", $c->radio_group( + -name => 'language', + -values => [ 'C', 'C++' ], + -default => 'C' ); +print "

        \n"; + + +print "

        Click here if you want Bitter Melon to run the resulting code through c++filt. Warning, the LLVM code produced will probably not be lexically valid, but it will be easier to read.

          ", + $c->checkbox( + -name => 'cxxdemangle', + -label => 'Demangle C++ names with c++filt' +), "
        "; print "

        ", $c->submit, "\n", $c->endform; From lattner at cs.uiuc.edu Tue Nov 18 17:05:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:05:02 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311182304.RAA02727@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.36 -> 1.37 --- Log message: new bugs --- Diffs of the changes: (+7 -1) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.36 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.37 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.36 Tue Nov 18 00:25:22 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Tue Nov 18 17:04:44 2003 @@ -407,6 +407,10 @@

      • [c++] C++ Frontend lays out superclasses like anonymous bitfields!
      • +

      • [llvmg++] Enum types are incorrectly shrunk to smaller than 'int' size
      • + +

      • [llvmg++] Cannot use pointer to member to initialize global
      • +

      Notes:


      Known problems with the Sparc back-end

        @@ -512,6 +518,6 @@ Maintained By: The LLVM Team
        -Last modified: Sun Nov 16 17:51:47 CST 2003 +Last modified: Tue Nov 18 14:56:15 CST 2003 From lattner at cs.uiuc.edu Tue Nov 18 17:05:06 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:05:06 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311182304.RAA02547@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.50 -> 1.51 --- Log message: Add a few new bugs --- Diffs of the changes: (+4 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.50 llvm/docs/ReleaseNotes.html:1.51 --- llvm/docs/ReleaseNotes.html:1.50 Tue Nov 18 00:25:05 2003 +++ llvm/docs/ReleaseNotes.html Tue Nov 18 17:04:02 2003 @@ -152,6 +152,9 @@
      • Casting a string constant to void crashes llvm-gcc
      • [adce] ADCE considers blocks without postdominators to be unreachable
      • C front-end miscompiles unsigned enums whose LLVM types are signed
      • +
      • [X86] div and rem constant exprs invalidate iterators!
      • +
      • [llvmg++] Enum types are incorrectly shrunk to smaller than 'int' size
      • +
      • [llvmg++] Cannot use pointer to member to initialize global
      • At this time, LLVM is known to work properly with SPEC CPU 2000, the Olden @@ -454,6 +457,6 @@ Maintained By: The LLVM Team
        -Last modified: Sun Nov 16 17:46:25 CST 2003 +Last modified: Tue Nov 18 14:56:05 CST 2003 From lattner at cs.uiuc.edu Tue Nov 18 17:06:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:06:03 2003 Subject: [llvm-commits] CVS: llvm-www/CurrentWork.html Documentation.html OldNews.html Publications.html footer.incl header.incl www-index.html oldnews.html Message-ID: <200311182305.RAA02896@zion.cs.uiuc.edu> Changes in directory llvm-www: CurrentWork.html added (r1.1) Documentation.html added (r1.1) OldNews.html added (r1.1) Publications.html added (r1.1) footer.incl added (r1.1) header.incl added (r1.1) www-index.html updated: 1.88 -> 1.89 oldnews.html (r1.2) removed --- Log message: Upload new LLVM page --- Diffs of the changes: (+523 -406) Index: llvm-www/CurrentWork.html diff -c /dev/null llvm-www/CurrentWork.html:1.1 *** /dev/null Tue Nov 18 17:05:03 2003 --- llvm-www/CurrentWork.html Tue Nov 18 17:04:53 2003 *************** *** 0 **** --- 1,81 ---- + +

        Near-term LLVM Development
        + + The LLVM infrastructure underlies many ongoing + research projects in our group. Some key additional + components of the system that are being developed in these + projects include: +
          +
        • Automatic Pool Allocation: + A fully automatic program transformation that introduces + region-based memory management in a novel manner: + it partitions the heap into separate regions for distinct + instances of logical data structures (such as a tree or + a hash table). +
        • +
        • A Software Scheme for Online + Tracing: We have developed a tracing scheme that + identifies frequently executed program paths at runtime, + and optionally extracts these paths into a software-managed + trace cache. This currently only works for Sparc code. +
        • +
        • Transparent runtime optimization on + general-purpose processors: + We are developing a transparent trace-based runtime + optimization system that operates on LLVM traces at runtime, + using the software tracing mechanism and trace cache above. +
        • +
        + +
        Longer term research
        + + Our group is participating in several ongoing research + projects, all of which are based on LLVM: +
          +
        • + Low Level Virtual Architecture (LLVA): + A Virtual Instruction Set Computer (VISC) architecture + decouples the external instruction set (V-ISA) seen by + all external software from the (possibly + implementation-specific) hardware ISA used by a + particular processor implementation (I-ISA). We + believe that a variant of LLVM (which we call Low + Level Virtual Architecture, or LLVA) could be a + powerful design choice for a V-ISA in such processor + designs. + We are exploring the architecture, compiler, + and operating system benefits of processor designs + based on LLVA as the virtual ISA.
        • +
        • + SAFECode: SAFECode is a + compiler-based system for enforcing program + safety. SAFECode uses LLVM as its code + representation.
        • +
        • Macroscopic data structure + analysis and transformations: + Analyzing and optimizing entire linked + data structures, based on two supporting techniques: + Data Structure Analysis (DSA) and + Automatic Pool Allocation. + DSA gives compilers extensive + static information about the structure, instances, + and lifetime of entire logical data structures. + Pool Allocation gives compilers detailed control over + the layout of such data structures in the heap. + The DSA pass is included in Release 1.0. +
        • +
        • Runtime optimization on + general-purpose processors: + We are developing techniques for optimizing ordinary + at runtime, by exploiting the LLVM instruction + set and compiler architecture in ways that would not + be possible with ordinary static compilation. + Our tracing and optimization strategy are described + in the section titled + Current Development. +
        • +
        + + + + Index: llvm-www/Documentation.html diff -c /dev/null llvm-www/Documentation.html:1.1 *** /dev/null Tue Nov 18 17:05:03 2003 --- llvm-www/Documentation.html Tue Nov 18 17:04:53 2003 *************** *** 0 **** --- 1,125 ---- + +
        LLVM Documentation
        + + LLVM Design: + + + + LLVM User Guides: + +
          +
        • + The LLVM Getting Started Guide + + - Discusses how to get up and running + quickly with the LLVM infrastructure. + Everything from unpacking and + compilation of the distribution to + execution of some tools.
        • + +
        • LLVM Command Guide + - A reference manual for the LLVM command line + utilities ("man" pages for LLVM tools).
        • + +
        • LLVM Project Guide + - How-to guide and templates for new + projects that use the LLVM infrastructure. + The templates (directory organization, Makefiles, + and test tree) allow the project code to be located + outside (or inside) the llvm/ tree, + while using LLVM header files and libraries.
        • + +
        • How to Submit A Bug + Report - Instructions for properly submitting information + about any bugs you run into in the LLVM system.
        • + +
        • LLVM Test Suite Guide + - A reference manual for using the LLVM test suite.
        • + +
        • How to build the C/C++ + front-end - Instructions for building the front-end + from source.
        • +
        + + Programming Documentation: + + + + + + +
        LLVM Support
        + +

        + + + \ No newline at end of file Index: llvm-www/OldNews.html diff -c /dev/null llvm-www/OldNews.html:1.1 *** /dev/null Tue Nov 18 17:05:03 2003 --- llvm-www/OldNews.html Tue Nov 18 17:04:53 2003 *************** *** 0 **** --- 1,117 ---- + + + +
        + Older News +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        May 21, 2003-Added some new documents to the + publications section.
        May 8, 2003-Switched over to the rewritten C front-end which supports variable argument functions and has no known miscompilation bugs.
        Mar 4, 2003-Added a new + Alias Analysis + document, describing Alias Analysis in LLVM.
        Feb 6, 2003-Added a new + open projects + page, listing some desired improvements to LLVM.
        Jan 22, 2003-Implemented a new + automated nightly testing + framework.
        Dec 14, 2002-Added Chris Lattner's Master's + Thesis to the publications list.
        Oct 28, 2002-A new mailing + list has been added for LLVM bug reports and patch + submissions.
        Sep 5, 2002-An initial draft of the LLVM + Programmer's Manual is up. It will continue to + evolve, but it is at least started now.
        Sep 3, 2002-A new LLVM + Developer's mailing list is available. This is a + good place to post questions to, or monitor to find out + about major changes to the LLVM source-base.
        Aug 8, 2002-Published the Writing + An LLVM Pass document.
        Jul 24, 2002-Published the LLVM + Getting Started Guide.
        Jul 1, 2002-Finished providing + initial information about LLVM, we now + consider the site to have "gone public".
        Jun 28, 2002-Added The + LLVM Instruction Set and Compilation + Strategy document.
        Jun 13, 2002-Web page first published.

        + + + Index: llvm-www/Publications.html diff -c /dev/null llvm-www/Publications.html:1.1 *** /dev/null Tue Nov 18 17:05:03 2003 --- llvm-www/Publications.html Tue Nov 18 17:04:53 2003 *************** *** 0 **** --- 1,80 ---- + +

        LLVM Related Publications
        + +
          +
        1. " + LLVA: A Low-level Virtual Instruction Set + Architecture"
          Vikram Adve, Chris Lattner, + Michael Brukman, Anand Shukla, and Brian Gaeke. + Proc. + of the 36th annual ACM/IEEE international symposium on + Microarchitecture (MICRO-36), San Diego, CA, + December 2003. + +
        2. " + LLVM: A Compilation Framework for Lifelong Program + Analysis & Transformation", + Chris Lattner & Vikram Adve.
          + Technical Report #UIUCDCS-R-2003-2380, Computer Science + Dept., Univ. of Illinois, Sep. 2003. +
        3. " + Memory Safety Without Runtime Checks or Garbage + Collection"
          + Dinakar Dhurjati, Sumant Kowshik, Vikram Adve and + Chris Lattner. + Proc. Languages Compilers and Tools for + Embedded Systems 2003 (LCTES 03), San Diego, + CA, June 2003.
        4. +
        5. "Architecture + For a Next-Generation GCC"
          + Chris Lattner & Vikram Adve, + First + Annual GCC Developers' Summit, + Ottawa, Canada, May 2003.
          +
        6. +
        7. "Data + Structure Analysis: An Efficient Context-Sensitive + Heap Analysis"
          + Chris Lattner & Vikram Adve, Technical + Report #UIUCDCS-R-2003-2340, Computer + Science Dept., Univ. of Illinois, + Apr. 2003.
          +
        8. +
        9. "LLVM: + An Infrastructure for Multi-Stage + Optimization"
          + Chris Lattner. Masters Thesis, Dec. 2002
        10. +
        11. " + Ensuring + Code Safety Without Runtime Checks for + Real-Time Control Systems"
          + Sumant Kowshik, Dinakar Dhurjati, and + Vikram Adve. Proc. Int'l Conf. on + Compilers, Architecture and Synthesis for + Embedded Systems (CASES02), Grenoble, + France, Oct. 2002.
        12. +
        13. "The + LLVM Instruction Set and Compilation + Strategy"
          + Chris Lattner & Vikram Adve, Technical + Report #UIUCDCS-R-2002-2292, Computer + Science Dept., Univ. of Illinois, + Aug. 2002.
          +
        14. +
        15. "Automatic + Pool Allocation for Disjoint Data + Structures,"
          + Chris Lattner & Vikram Adve, ACM + SIGPLAN Workshop on Memory System + Performance (MSP), + Berlin, Germany, June 2002.
          +
        16. +

        + + + Index: llvm-www/footer.incl diff -c /dev/null llvm-www/footer.incl:1.1 *** /dev/null Tue Nov 18 17:05:03 2003 --- llvm-www/footer.incl Tue Nov 18 17:04:53 2003 *************** *** 0 **** --- 1,5 ---- + + + + + Index: llvm-www/header.incl diff -c /dev/null llvm-www/header.incl:1.1 *** /dev/null Tue Nov 18 17:05:03 2003 --- llvm-www/header.incl Tue Nov 18 17:04:53 2003 *************** *** 0 **** --- 1,66 ---- + + + + The LLVM Compiler Infrastructure Project + + + + + +

        + The LLVM Compiler Infrastructure +
        + + + + + + + + + + + + + + + + + + + + + @@ -243,15 +260,6 @@ - - - - - - - - @@ -323,15 +331,6 @@ - - - - - - - - @@ -423,7 +422,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/18 22:29:35 $ + Last modified: $Date: 2003/11/18 23:39:58 $ From lattner at cs.uiuc.edu Tue Nov 18 17:47:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:47:00 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-11-18-CondExprLValue.c Message-ID: <200311182346.RAA13861@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-11-18-CondExprLValue.c added (r1.1) --- Log message: Testcase for PR131 --- Diffs of the changes: (+7 -0) Index: llvm/test/Regression/CFrontend/2003-11-18-CondExprLValue.c diff -c /dev/null llvm/test/Regression/CFrontend/2003-11-18-CondExprLValue.c:1.1 *** /dev/null Tue Nov 18 17:46:17 2003 --- llvm/test/Regression/CFrontend/2003-11-18-CondExprLValue.c Tue Nov 18 17:46:07 2003 *************** *** 0 **** --- 1,7 ---- + typedef struct { unsigned long pgprot; } pgprot_t; + + void split_large_page(unsigned long addr, pgprot_t prot) + { + (addr ? prot : ((pgprot_t) { 0x001 } )).pgprot; + } + From lattner at cs.uiuc.edu Tue Nov 18 19:04:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 19:04:02 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/2003-11-18-TypeResolution.ll Message-ID: <200311190103.TAA12582@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: 2003-11-18-TypeResolution.ll added (r1.1) --- Log message: New testcase for PR 130 --- Diffs of the changes: (+23 -0) Index: llvm/test/Regression/Linker/2003-11-18-TypeResolution.ll diff -c /dev/null llvm/test/Regression/Linker/2003-11-18-TypeResolution.ll:1.1 *** /dev/null Tue Nov 18 19:03:26 2003 --- llvm/test/Regression/Linker/2003-11-18-TypeResolution.ll Tue Nov 18 19:03:16 2003 *************** *** 0 **** --- 1,23 ---- + ; Linking these two translation units causes there to be two LLVM values in the + ; symbol table with the same name and same type. When this occurs, the symbol + ; table class is DROPPING one of the values, instead of renaming it like a nice + ; little symbol table. This is causing llvm-link to die, at no fault of its + ; own. + + ; RUN: llvm-as < %s > %t.out2.bc + ; RUN: echo "%T1 = type opaque %GVar = external global %T1*" | llvm-as > %t.out1.bc + ; RUN: llvm-link %t.out[12].bc + + %T1 = type opaque + %T2 = type int + + %GVar = global %T2 * null + + implementation + + void %foo(%T2 * %X) { + %X = cast %T2* %X to %T1 * + ret void + } + + From lattner at cs.uiuc.edu Tue Nov 18 19:04:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 19:04:05 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/SymbolTable.cpp Message-ID: <200311190103.TAA12566@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: SymbolTable.cpp updated: 1.39 -> 1.40 --- Log message: Fix PR130, and testcase test/Regression/Linker/2003-11-18-TypeResolution.ll --- Diffs of the changes: (+7 -0) Index: llvm/lib/VMCore/SymbolTable.cpp diff -u llvm/lib/VMCore/SymbolTable.cpp:1.39 llvm/lib/VMCore/SymbolTable.cpp:1.40 --- llvm/lib/VMCore/SymbolTable.cpp:1.39 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/SymbolTable.cpp Tue Nov 18 19:02:52 2003 @@ -271,6 +271,13 @@ else M->getGlobalList().remove(cast(NewGV)); delete NewGV; + } else { + // If they are not global values, they must be just random values who + // happen to conflict now that types have been resolved. If this is + // the case, reinsert the value into the new plane, allowing it to get + // renamed. + assert(V.second->getType() == NewType &&"Type resolution is broken!"); + insert(V.second); } } else { insertEntry(V.first, NewType, V.second); From lattner at cs.uiuc.edu Tue Nov 18 19:09:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 19:09:01 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311190108.TAA21634@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.37 -> 1.38 --- Log message: more bugs --- Diffs of the changes: (+6 -1) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.37 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.38 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.37 Tue Nov 18 17:04:44 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Tue Nov 18 19:08:37 2003 @@ -220,6 +220,9 @@
      • [adce] ADCE considers blocks without postdominators to be unreachable
      • +

      • [vmcore] Symbol table doesn't rename colliding variables during type resolution
      • + +


        Known problems with the C front-end

        Notes:

          @@ -518,6 +523,6 @@ Maintained By: The LLVM Team
          -Last modified: Tue Nov 18 14:56:15 CST 2003 +Last modified: Tue Nov 18 19:06:52 CST 2003 From lattner at cs.uiuc.edu Tue Nov 18 19:09:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 19:09:05 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311190108.TAA21467@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.51 -> 1.52 --- Log message: More bugz --- Diffs of the changes: (+3 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.51 llvm/docs/ReleaseNotes.html:1.52 --- llvm/docs/ReleaseNotes.html:1.51 Tue Nov 18 17:04:02 2003 +++ llvm/docs/ReleaseNotes.html Tue Nov 18 19:08:24 2003 @@ -155,6 +155,8 @@

        • [X86] div and rem constant exprs invalidate iterators!
        • [llvmg++] Enum types are incorrectly shrunk to smaller than 'int' size
        • [llvmg++] Cannot use pointer to member to initialize global
        • +
        • [vmcore] Symbol table doesn't rename colliding variables during type resolution
        • +
        • [llvm-gcc] ?: operator as lvalue not implemented
        • At this time, LLVM is known to work properly with SPEC CPU 2000, the Olden @@ -457,6 +459,6 @@ Maintained By: The LLVM Team
          -Last modified: Tue Nov 18 14:56:05 CST 2003 +Last modified: Tue Nov 18 19:06:34 CST 2003 From lattner at cs.uiuc.edu Tue Nov 18 23:54:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 23:54:01 2003 Subject: [llvm-commits] CVS: llvm/docs/FAQ.html Message-ID: <200311190553.XAA26388@zion.cs.uiuc.edu> Changes in directory llvm/docs: FAQ.html updated: 1.12 -> 1.13 --- Log message: add new FAQ entry --- Diffs of the changes: (+44 -5) Index: llvm/docs/FAQ.html diff -u llvm/docs/FAQ.html:1.12 llvm/docs/FAQ.html:1.13 --- llvm/docs/FAQ.html:1.12 Tue Nov 18 10:08:49 2003 +++ llvm/docs/FAQ.html Tue Nov 18 23:53:12 2003 @@ -50,7 +50,7 @@

        • Why do test results differ when I perform different types of builds?
        • -
        • GCC Front End +
        • Using the GCC Front End
          1. When I compile software that uses a configure script, the configure script @@ -64,6 +64,13 @@
        • + +
        • Questions about code generated by the GCC front-end +
            +
          1. What is this __main() call that gets inserted into + main()?
          2. +
          +
        • @@ -322,7 +329,7 @@
          @@ -367,14 +374,14 @@

          -

          When I compile code using the LLVM GCC front end, it complains that it cannot find crtend.o.

          -

          In order to find crtend.o, you must have the directory in which it lives in your LLVM_LIB_SEARCH_PATH environment variable. For the binary distribution of @@ -382,6 +389,38 @@ directory inside of the LLVM GCC distribution.

          + + + + + +
          +

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

          +
          + +
          +

          +The __main call is inserted by the C/C++ compiler in order to guarantee +that static constructors and destructors are called when the program starts up +and shuts down. In C, you can create static constructors and destructors by +using GCC extensions, and in C++ you can do so by creating a global variable +whose class has a ctor or dtor. +

          + +

          +The actual implementation of __main lives in the +llvm/runtime/GCCLibraries/crtend/ directory in the source-base, and is +linked in automatically when you link the program. +

          + +
          + + + @@ -389,7 +428,7 @@ From lattner at cs.uiuc.edu Tue Nov 18 23:58:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 23:58:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311190557.XAA26604@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.3 -> 1.4 --- Log message: Add a link to the FAQ --- Diffs of the changes: (+3 -1) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.3 llvm-www/demo/index.cgi:1.4 --- llvm-www/demo/index.cgi:1.3 Tue Nov 18 17:02:55 2003 +++ llvm-www/demo/index.cgi Tue Nov 18 23:56:54 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/18 23:02:55 $ +# Last modified $Date: 2003/11/19 05:56:54 $ # use CGI; @@ -169,6 +169,8 @@ ), "
        "; print "

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

        If you have questions about the LLVM code generated by the front-end, please check the FAQ, your question just might be answered (e.g., what is this __main thing?).

        \n"; $ENV{'PATH'} = ( join ( ':', @PREPENDPATHDIRS ) ) . ":" . $ENV{'PATH'}; From lattner at cs.uiuc.edu Wed Nov 19 00:02:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 00:02:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp Reader.cpp ReaderInternals.h Message-ID: <200311190601.AAA27191@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ConstantReader.cpp updated: 1.62 -> 1.63 Reader.cpp updated: 1.88 -> 1.89 ReaderInternals.h updated: 1.66 -> 1.67 --- Log message: Minor speedup to do less linear time searches of information we already have. speeds up disassembly of kc++ by .6s --- Diffs of the changes: (+12 -10) Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.62 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.63 --- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.62 Tue Nov 11 16:41:32 2003 +++ llvm/lib/Bytecode/Reader/ConstantReader.cpp Wed Nov 19 00:01:12 2003 @@ -168,13 +168,11 @@ unsigned ArgValSlot, ArgTypeSlot; if (read_vbr(Buf, EndBuf, ArgValSlot)) throw Error_readvbr; if (read_vbr(Buf, EndBuf, ArgTypeSlot)) throw Error_readvbr; - const Type *ArgTy = getType(ArgTypeSlot); - - BCR_TRACE(4, "CE Arg " << i << ": Type: '" << *ArgTy << "' slot: " - << ArgValSlot << "\n"); + BCR_TRACE(4, "CE Arg " << i << ": Type: '" << *getType(ArgTypeSlot) + << "' slot: " << ArgValSlot << "\n"); // Get the arg value from its slot if it exists, otherwise a placeholder - ArgVec.push_back(getConstantValue(ArgTy, ArgValSlot)); + ArgVec.push_back(getConstantValue(ArgTypeSlot, ArgValSlot)); } // Construct a ConstantExpr of the appropriate kind @@ -245,12 +243,12 @@ case Type::ArrayTyID: { const ArrayType *AT = cast(Ty); unsigned NumElements = AT->getNumElements(); - + unsigned TypeSlot = getTypeSlot(AT->getElementType()); std::vector Elements; while (NumElements--) { // Read all of the elements of the constant. unsigned Slot; if (read_vbr(Buf, EndBuf, Slot)) throw Error_readvbr; - Elements.push_back(getConstantValue(AT->getElementType(), Slot)); + Elements.push_back(getConstantValue(TypeSlot, Slot)); } return ConstantArray::get(AT, Elements); } Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.88 llvm/lib/Bytecode/Reader/Reader.cpp:1.89 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.88 Tue Nov 11 16:41:32 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Nov 19 00:01:12 2003 @@ -172,13 +172,14 @@ /// constant hasn't been parsed yet, a placeholder is defined and used. Later, /// after the real value is parsed, the placeholder is eliminated. /// -Constant *BytecodeParser::getConstantValue(const Type *Ty, unsigned Slot) { - if (Value *V = getValue(Ty, Slot, false)) +Constant *BytecodeParser::getConstantValue(unsigned TypeSlot, unsigned Slot) { + if (Value *V = getValue(TypeSlot, Slot, false)) if (Constant *C = dyn_cast(V)) return C; // If we already have the value parsed, just return it else throw std::string("Reference of a value is expected to be a constant!"); + const Type *Ty = getType(TypeSlot); std::pair Key(Ty, Slot); GlobalRefsType::iterator I = GlobalRefs.lower_bound(Key); Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.66 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.67 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.66 Fri Nov 14 10:34:25 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Wed Nov 19 00:01:12 2003 @@ -180,7 +180,10 @@ Value *getValue(unsigned TypeID, unsigned num, bool Create = true); const Type *getType(unsigned ID); BasicBlock *getBasicBlock(unsigned ID); - Constant *getConstantValue(const Type *Ty, unsigned num); + Constant *getConstantValue(unsigned TypeID, unsigned num); + Constant *getConstantValue(const Type *Ty, unsigned num) { + return getConstantValue(getTypeSlot(Ty), num); + } unsigned insertValue(Value *V, ValueTable &Table); unsigned insertValue(Value *V, unsigned Type, ValueTable &Table); From lattner at cs.uiuc.edu Wed Nov 19 00:15:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 00:15:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200311190614.AAA28072@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.80 -> 1.81 --- Log message: Finegrainify namespacification --- Diffs of the changes: (+13 -6) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.80 llvm/lib/VMCore/Type.cpp:1.81 --- llvm/lib/VMCore/Type.cpp:1.80 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Type.cpp Wed Nov 19 00:14:38 2003 @@ -18,7 +18,7 @@ #include "Support/STLExtras.h" #include -namespace llvm { +using namespace llvm; // DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are // created and later destroyed, all in an effort to make sure that there is only @@ -560,6 +560,7 @@ // created on any given run of the compiler... note that this involves updating // our map if an abstract type gets refined somehow... // +namespace llvm { template class TypeMap { typedef std::map MapTy; @@ -647,7 +648,7 @@ void dump() const { print("dump output"); } }; - +} //===----------------------------------------------------------------------===// @@ -656,6 +657,7 @@ // FunctionValType - Define a class to hold the key that goes into the TypeMap // +namespace llvm { class FunctionValType { const Type *RetTy; std::vector ArgTypes; @@ -684,6 +686,7 @@ return ArgTypes == MTV.ArgTypes && isVarArg < MTV.isVarArg; } }; +} // Define the actual map itself now... static TypeMap FunctionTypes; @@ -717,6 +720,7 @@ //===----------------------------------------------------------------------===// // Array Type Factory... // +namespace llvm { class ArrayValType { const Type *ValTy; unsigned Size; @@ -738,7 +742,7 @@ return Size == MTV.Size && ValTy < MTV.ValTy; } }; - +} static TypeMap ArrayTypes; @@ -762,6 +766,7 @@ // Struct Type Factory... // +namespace llvm { // StructValType - Define a class to hold the key that goes into the TypeMap // class StructValType { @@ -788,6 +793,7 @@ return ElTypes < STV.ElTypes; } }; +} static TypeMap StructTypes; @@ -813,6 +819,7 @@ // PointerValType - Define a class to hold the key that goes into the TypeMap // +namespace llvm { class PointerValType { const Type *ValTy; public: @@ -832,6 +839,7 @@ return ValTy < MTV.ValTy; } }; +} static TypeMap PointerTypes; @@ -851,13 +859,14 @@ return PT; } +namespace llvm { void debug_type_tables() { FunctionTypes.dump(); ArrayTypes.dump(); StructTypes.dump(); PointerTypes.dump(); } - +} //===----------------------------------------------------------------------===// // Derived Type Refinement Functions @@ -1115,5 +1124,3 @@ void PointerType::typeBecameConcrete(const DerivedType *AbsTy) { refineAbstractType(AbsTy, AbsTy); } - -} // End llvm namespace From lattner at cs.uiuc.edu Wed Nov 19 10:08:07 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 10:08:07 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Message-ID: <200311191607.KAA20633@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ReaderWrappers.cpp updated: 1.17 -> 1.18 --- Log message: Fine grainify namespacification, #include file that defines the interface! --- Diffs of the changes: (+11 -9) Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.17 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.18 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.17 Tue Nov 11 16:41:32 2003 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Wed Nov 19 10:06:55 2003 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Bytecode/Reader.h" #include "ReaderInternals.h" #include "llvm/Module.h" #include "llvm/Instructions.h" @@ -20,8 +21,7 @@ #include #include "Config/unistd.h" #include "Config/sys/mman.h" - -namespace llvm { +using namespace llvm; //===----------------------------------------------------------------------===// // BytecodeFileReader - Read from an mmap'able file descriptor. @@ -258,15 +258,17 @@ /// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a /// buffer ModuleProvider* -getBytecodeBufferModuleProvider(const unsigned char *Buffer, unsigned Length, - const std::string &ModuleID) { +llvm::getBytecodeBufferModuleProvider(const unsigned char *Buffer, + unsigned Length, + const std::string &ModuleID) { return CheckVarargs(new BytecodeBufferReader(Buffer, Length, ModuleID)); } /// ParseBytecodeBuffer - Parse a given bytecode buffer /// -Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned Length, - const std::string &ModuleID, std::string *ErrorStr){ +Module *llvm::ParseBytecodeBuffer(const unsigned char *Buffer, unsigned Length, + const std::string &ModuleID, + std::string *ErrorStr){ try { std::auto_ptr AMP(getBytecodeBufferModuleProvider(Buffer, Length, ModuleID)); @@ -279,7 +281,7 @@ /// getBytecodeModuleProvider - lazy function-at-a-time loading from a file /// -ModuleProvider *getBytecodeModuleProvider(const std::string &Filename) { +ModuleProvider *llvm::getBytecodeModuleProvider(const std::string &Filename) { if (Filename != std::string("-")) // Read from a file... return CheckVarargs(new BytecodeFileReader(Filename)); else // Read from stdin @@ -288,7 +290,8 @@ /// ParseBytecodeFile - Parse the given bytecode file /// -Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr) { +Module *llvm::ParseBytecodeFile(const std::string &Filename, + std::string *ErrorStr) { try { std::auto_ptr AMP(getBytecodeModuleProvider(Filename)); return AMP->releaseModule(); @@ -298,4 +301,3 @@ } } -} // End llvm namespace From lattner at cs.uiuc.edu Wed Nov 19 11:18:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 11:18:03 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp Message-ID: <200311191717.LAA31465@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ConstantReader.cpp updated: 1.63 -> 1.64 --- Log message: Minor efficiency improvements all over. Finegrainify Namespacification --- Diffs of the changes: (+14 -37) Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.63 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.64 --- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.63 Wed Nov 19 00:01:12 2003 +++ llvm/lib/Bytecode/Reader/ConstantReader.cpp Wed Nov 19 11:17:36 2003 @@ -19,8 +19,7 @@ #include "llvm/Module.h" #include "llvm/Constants.h" #include - -namespace llvm { +using namespace llvm; const Type *BytecodeParser::parseTypeConstant(const unsigned char *&Buf, const unsigned char *EndBuf) { @@ -104,7 +103,7 @@ // something and when we reread the type later, we can replace the opaque type // with a new resolved concrete type. // -void debug_type_tables(); +namespace llvm { void debug_type_tables(); } void BytecodeParser::parseTypeConstants(const unsigned char *&Buf, const unsigned char *EndBuf, TypeValuesListTy &Tab, @@ -112,6 +111,8 @@ assert(Tab.size() == 0 && "should not have read type constants in before!"); // Insert a bunch of opaque types to be resolved later... + // FIXME: this is dumb + Tab.reserve(NumEntries); for (unsigned i = 0; i < NumEntries; ++i) Tab.push_back(OpaqueType::get()); @@ -149,7 +150,7 @@ Constant *BytecodeParser::parseConstantValue(const unsigned char *&Buf, const unsigned char *EndBuf, - const Type *Ty) { + unsigned TypeID) { // We must check for a ConstantExpr before switching by type because // a ConstantExpr can be of any type, and has no explicit value. @@ -178,7 +179,7 @@ // Construct a ConstantExpr of the appropriate kind if (isExprNumArgs == 1) { // All one-operand expressions assert(Opcode == Instruction::Cast); - return ConstantExpr::getCast(ArgVec[0], Ty); + return ConstantExpr::getCast(ArgVec[0], getType(TypeID)); } else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr std::vector IdxList(ArgVec.begin()+1, ArgVec.end()); return ConstantExpr::getGetElementPtr(ArgVec[0], IdxList); @@ -190,6 +191,7 @@ } // Ok, not an ConstantExpr. We now know how to read the given type... + const Type *Ty = getType(TypeID); switch (Ty->getPrimitiveID()) { case Type::BoolTyID: { unsigned Val; @@ -274,37 +276,14 @@ BCR_TRACE(4, "CPR: Type: '" << Ty << "' slot: " << Slot << "\n"); // Check to see if we have already read this global variable... - Value *Val = getValue(PT, Slot, false); + Value *Val = getValue(TypeID, Slot, false); GlobalValue *GV; if (Val) { if (!(GV = dyn_cast(Val))) throw std::string("Value of ConstantPointerRef not in ValueTable!"); BCR_TRACE(5, "Value Found in ValueTable!\n"); - } else if (RevisionNum > 0) { - // Revision #0 could have forward references to globals that were weird. - // We got rid of this in subsequent revs. - throw std::string("Forward references to globals not allowed."); - } else { // Nope... find or create a forward ref. for it - GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PT, Slot)); - - if (I != GlobalRefs.end()) { - BCR_TRACE(5, "Previous forward ref found!\n"); - GV = cast(I->second); - } else { - BCR_TRACE(5, "Creating new forward ref to a global variable!\n"); - - // Create a placeholder for the global variable reference... - GlobalVariable *GVar = - new GlobalVariable(PT->getElementType(), false, - GlobalValue::InternalLinkage); - - // Keep track of the fact that we have a forward ref to recycle it - GlobalRefs.insert(std::make_pair(std::make_pair(PT, Slot), GVar)); - - // Must temporarily push this value into the module table... - TheModule->getGlobalList().push_back(GVar); - GV = GVar; - } + } else { + throw std::string("Forward references are not allowed here."); } return ConstantPointerRef::get(GV); @@ -335,11 +314,11 @@ BCR_TRACE(3, "Type: 'type' NumEntries: " << NumEntries << "\n"); parseTypeConstants(Buf, EndBuf, TypeTab, NumEntries); } else { - const Type *Ty = getType(Typ); - BCR_TRACE(3, "Type: '" << *Ty << "' NumEntries: " << NumEntries << "\n"); + BCR_TRACE(3, "Type: '" << *getType(Typ) << "' NumEntries: " + << NumEntries << "\n"); for (unsigned i = 0; i < NumEntries; ++i) { - Constant *C = parseConstantValue(Buf, EndBuf, Ty); + Constant *C = parseConstantValue(Buf, EndBuf, Typ); assert(C && "parseConstantValue returned NULL!"); BCR_TRACE(4, "Read Constant: '" << *C << "'\n"); unsigned Slot = insertValue(C, Typ, Tab); @@ -349,12 +328,10 @@ // if (&Tab != &ModuleValues && Typ < ModuleValues.size()) Slot += ModuleValues[Typ]->size(); - ResolveReferencesToValue(C, Slot); + ResolveReferencesToConstant(C, Slot); } } } if (Buf > EndBuf) throw std::string("Read past end of buffer."); } - -} // End llvm namespace From lattner at cs.uiuc.edu Wed Nov 19 11:21:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 11:21:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp Message-ID: <200311191720.LAA32055@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ConstantReader.cpp updated: 1.64 -> 1.65 --- Log message: In the future, these slabs can be null... --- Diffs of the changes: (+2 -1) Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.64 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.65 --- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.64 Wed Nov 19 11:17:36 2003 +++ llvm/lib/Bytecode/Reader/ConstantReader.cpp Wed Nov 19 11:20:42 2003 @@ -326,7 +326,8 @@ // If we are reading a function constant table, make sure that we adjust // the slot number to be the real global constant number. // - if (&Tab != &ModuleValues && Typ < ModuleValues.size()) + if (&Tab != &ModuleValues && Typ < ModuleValues.size() && + ModuleValues[Typ]) Slot += ModuleValues[Typ]->size(); ResolveReferencesToConstant(C, Slot); } From lattner at cs.uiuc.edu Wed Nov 19 11:22:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 11:22:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Message-ID: <200311191721.LAA32072@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: InstructionReader.cpp updated: 1.63 -> 1.64 --- Log message: Minor efficiency improvements, finegrainify namespacification --- Diffs of the changes: (+16 -11) Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.63 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.64 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.63 Tue Nov 11 16:41:32 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Wed Nov 19 11:21:11 2003 @@ -21,8 +21,7 @@ #include "llvm/iPHINode.h" #include "llvm/iOther.h" #include "llvm/Module.h" - -namespace llvm { +using namespace llvm; namespace { struct RawInst { // The raw fields out of the bytecode stream... @@ -234,7 +233,7 @@ for (unsigned i = 1, e = Args.size(); i != e; ++i) { if (It == PL.end()) throw std::string("Invalid call instruction!"); - Params.push_back(getValue(*It++, Args[i])); + Params.push_back(getValue(getTypeSlot(*It++), Args[i])); } if (It != PL.end()) throw std::string("Invalid call instruction!"); } else { @@ -247,7 +246,7 @@ // Read all of the fixed arguments for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) - Params.push_back(getValue(FTy->getParamType(i), Args[i])); + Params.push_back(getValue(getTypeSlot(FTy->getParamType(i)),Args[i])); FirstVariableOperand = FTy->getNumParams(); } else { @@ -286,7 +285,7 @@ FunctionType::ParamTypes::const_iterator It = PL.begin(); for (unsigned i = 3, e = Args.size(); i != e; ++i) { if (It == PL.end()) throw std::string("Invalid invoke instruction!"); - Params.push_back(getValue(*It++, Args[i])); + Params.push_back(getValue(getTypeSlot(*It++), Args[i])); } if (It != PL.end()) throw std::string("Invalid invoke instruction!"); } else { @@ -299,7 +298,8 @@ FirstVariableArgument = FTy->getNumParams()+2; for (unsigned i = 2; i != FirstVariableArgument; ++i) - Params.push_back(getValue(FTy->getParamType(i-2), Args[i])); + Params.push_back(getValue(getTypeSlot(FTy->getParamType(i-2)), + Args[i])); } else { if (Args.size() < 4) throw std::string("Invalid invoke instruction!"); @@ -354,7 +354,7 @@ for (unsigned i = 1, e = Args.size(); i != e; ++i) { const CompositeType *TopTy = dyn_cast_or_null(NextTy); if (!TopTy) throw std::string("Invalid getelementptr instruction!"); - Idx.push_back(getValue(TopTy->getIndexType(), Args[i])); + Idx.push_back(getValue(TopTy->getIndexType()->getPrimitiveID(), Args[i])); NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); } @@ -376,7 +376,8 @@ Value *Ptr = getValue(RI.Type, Args[1]); const Type *ValTy = cast(Ptr->getType())->getElementType(); - Result = new StoreInst(getValue(ValTy, Args[0]), Ptr, RI.Opcode == 63); + Result = new StoreInst(getValue(getTypeSlot(ValTy), Args[0]), Ptr, + RI.Opcode == 63); break; } case Instruction::Unwind: @@ -385,9 +386,13 @@ break; } // end switch(RI.Opcode) - insertValue(Result, Values); + unsigned TypeSlot; + if (Result->getType() == InstTy) + TypeSlot = RI.Type; + else + TypeSlot = getTypeSlot(Result->getType()); + + insertValue(Result, TypeSlot, Values); BB->getInstList().push_back(Result); BCR_TRACE(4, *Result); } - -} // End llvm namespace From lattner at cs.uiuc.edu Wed Nov 19 11:28:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 11:28:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderInternals.h Message-ID: <200311191727.LAA32459@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.89 -> 1.90 ReaderInternals.h updated: 1.67 -> 1.68 --- Log message: * Finegrainify namespacification * Strength reduce several data structures which were left over from the "bad old days" * Minor efficiency improvements * Major efficiency improvement: In BytecodeParser::insertValue, do not allocate a new ValueTab entry just because some value exists with a large type. This dramatically reduces the number of allocations/deallocations performed by the bytecode reader, and speeds up parsing of Kimwitu++ from 34s to 17s. This is to help address PR127 --- Diffs of the changes: (+47 -73) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.89 llvm/lib/Bytecode/Reader/Reader.cpp:1.90 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.89 Wed Nov 19 00:01:12 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Nov 19 11:27:18 2003 @@ -12,7 +12,6 @@ // Note that this library should be as fast as possible, reentrant, and // threadsafe!! // -// TODO: Return error messages to caller instead of printing them out directly. // TODO: Allow passing in an option to ignore the symbol table // //===----------------------------------------------------------------------===// @@ -31,8 +30,7 @@ #include "Config/sys/types.h" #include #include - -namespace llvm { +using namespace llvm; static inline void ALIGN32(const unsigned char *&begin, const unsigned char *end) { @@ -83,24 +81,20 @@ throw std::string("Illegal type reference!"); } -unsigned BytecodeParser::insertValue(Value *Val, ValueTable &ValueTab) { - return insertValue(Val, getTypeSlot(Val->getType()), ValueTab); -} - unsigned BytecodeParser::insertValue(Value *Val, unsigned type, ValueTable &ValueTab) { assert((!isa(Val) || Val->getType()->isPrimitiveType() || !cast(Val)->isNullValue()) && "Cannot read null values from bytecode!"); assert(type != Type::TypeTyID && "Types should never be insertValue'd!"); - + if (ValueTab.size() <= type) { unsigned OldSize = ValueTab.size(); ValueTab.resize(type+1); - while (OldSize != type+1) - ValueTab[OldSize++] = new ValueList(); } + if (!ValueTab[type]) ValueTab[type] = new ValueList(); + //cerr << "insertValue Values[" << type << "][" << ValueTab[type].size() // << "] = " << Val << "\n"; ValueTab[type]->push_back(Val); @@ -110,10 +104,6 @@ } -Value *BytecodeParser::getValue(const Type *Ty, unsigned oNum, bool Create) { - return getValue(getTypeSlot(Ty), oNum, Create); -} - Value *BytecodeParser::getValue(unsigned type, unsigned oNum, bool Create) { assert(type != Type::TypeTyID && "getValue() cannot get types!"); assert(type != Type::LabelTyID && "getValue() cannot get blocks!"); @@ -125,13 +115,13 @@ --Num; } - if (type < ModuleValues.size()) { + if (type < ModuleValues.size() && ModuleValues[type]) { if (Num < ModuleValues[type]->size()) return ModuleValues[type]->getOperand(Num); Num -= ModuleValues[type]->size(); } - if (Values.size() > type && Values[type]->size() > Num) + if (Values.size() > type && Values[type] && Num < Values[type]->size()) return Values[type]->getOperand(Num); if (!Create) return 0; // Do not create a placeholder? @@ -181,11 +171,11 @@ const Type *Ty = getType(TypeSlot); std::pair Key(Ty, Slot); - GlobalRefsType::iterator I = GlobalRefs.lower_bound(Key); + ConstantRefsType::iterator I = ConstantFwdRefs.lower_bound(Key); - if (I != GlobalRefs.end() && I->first == Key) { + if (I != ConstantFwdRefs.end() && I->first == Key) { BCR_TRACE(5, "Previous forward ref found!\n"); - return cast(I->second); + return I->second; } else { // Create a placeholder for the constant reference and // keep track of the fact that we have a forward ref to recycle it @@ -193,7 +183,7 @@ Constant *C = new ConstPHolder(Ty, Slot); // Keep track of the fact that we have a forward ref to recycle it - GlobalRefs.insert(I, std::make_pair(Key, C)); + ConstantFwdRefs.insert(I, std::make_pair(Key, C)); return C; } } @@ -265,22 +255,16 @@ if (Buf > EndBuf) throw std::string("Tried to read past end of buffer."); } -void BytecodeParser::ResolveReferencesToValue(Value *NewV, unsigned Slot) { - GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(NewV->getType(), - Slot)); - if (I == GlobalRefs.end()) return; // Never forward referenced? +void BytecodeParser::ResolveReferencesToConstant(Constant *NewV, unsigned Slot){ + ConstantRefsType::iterator I = + ConstantFwdRefs.find(std::make_pair(NewV->getType(), Slot)); + if (I == ConstantFwdRefs.end()) return; // Never forward referenced? BCR_TRACE(3, "Mutating forward refs!\n"); - Value *VPH = I->second; // Get the placeholder... - VPH->replaceAllUsesWith(NewV); - - // If this is a global variable being resolved, remove the placeholder from - // the module... - if (GlobalValue* GVal = dyn_cast(NewV)) - GVal->getParent()->getGlobalList().remove(cast(VPH)); - - delete VPH; // Delete the old placeholder - GlobalRefs.erase(I); // Remove the map entry for it + Value *PH = I->second; // Get the placeholder... + PH->replaceAllUsesWith(NewV); + delete PH; // Delete the old placeholder + ConstantFwdRefs.erase(I); // Remove the map entry for it } void BytecodeParser::ParseFunction(const unsigned char *&Buf, @@ -288,30 +272,24 @@ if (FunctionSignatureList.empty()) throw std::string("FunctionSignatureList empty!"); - Function *F = FunctionSignatureList.back().first; - unsigned FunctionSlot = FunctionSignatureList.back().second; + Function *F = FunctionSignatureList.back(); FunctionSignatureList.pop_back(); // Save the information for future reading of the function - LazyFunctionInfo *LFI = new LazyFunctionInfo(); - LFI->Buf = Buf; LFI->EndBuf = EndBuf; LFI->FunctionSlot = FunctionSlot; - LazyFunctionLoadMap[F] = LFI; + LazyFunctionLoadMap[F] = LazyFunctionInfo(Buf, EndBuf); // Pretend we've `parsed' this function Buf = EndBuf; } void BytecodeParser::materializeFunction(Function* F) { // Find {start, end} pointers and slot in the map. If not there, we're done. - std::map::iterator Fi = + std::map::iterator Fi = LazyFunctionLoadMap.find(F); if (Fi == LazyFunctionLoadMap.end()) return; - - LazyFunctionInfo *LFI = Fi->second; - const unsigned char *Buf = LFI->Buf; - const unsigned char *EndBuf = LFI->EndBuf; - unsigned FunctionSlot = LFI->FunctionSlot; + + const unsigned char *Buf = Fi->second.Buf; + const unsigned char *EndBuf = Fi->second.EndBuf; LazyFunctionLoadMap.erase(Fi); - delete LFI; GlobalValue::LinkageTypes Linkage = GlobalValue::ExternalLinkage; @@ -344,7 +322,7 @@ Function::aiterator AI = F->abegin(); for (FunctionType::ParamTypes::const_iterator It = Params.begin(); It != Params.end(); ++It, ++AI) - insertValue(AI, Values); + insertValue(AI, getTypeSlot(AI->getType()), Values); // Keep track of how many basic blocks we have read in... unsigned BlockNum = 0; @@ -355,11 +333,10 @@ readBlock(Buf, EndBuf, Type, Size); switch (Type) { - case BytecodeFormat::ConstantPool: { + case BytecodeFormat::ConstantPool: BCR_TRACE(2, "BLOCK BytecodeFormat::ConstantPool: {\n"); ParseConstantPool(Buf, Buf+Size, Values, FunctionTypeValues); break; - } case BytecodeFormat::BasicBlock: { BCR_TRACE(2, "BLOCK BytecodeFormat::BasicBlock: {\n"); @@ -368,11 +345,10 @@ break; } - case BytecodeFormat::SymbolTable: { + case BytecodeFormat::SymbolTable: BCR_TRACE(2, "BLOCK BytecodeFormat::SymbolTable: {\n"); ParseSymbolTable(Buf, Buf+Size, &F->getSymbolTable(), F); break; - } default: BCR_TRACE(2, "BLOCK :ignored! {\n"); @@ -392,6 +368,7 @@ throw std::string("Illegal basic block operand reference"); ParsedBasicBlocks.clear(); + // Resolve forward references. Replace any uses of a forward reference value // with the real value. @@ -483,7 +460,7 @@ GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, Linkage, 0, "", TheModule); BCR_TRACE(2, "Global Variable of type: " << *Ty << "\n"); - ResolveReferencesToValue(GV, insertValue(GV, SlotNo, ModuleValues)); + insertValue(GV, SlotNo, ModuleValues); if (VarType & 2) { // Does it have an initializer? unsigned InitSlot; @@ -514,13 +491,12 @@ // Insert the placeholder... Function *Func = new Function(cast(Ty), GlobalValue::InternalLinkage, "", TheModule); - unsigned DestSlot = insertValue(Func, FnSignature, ModuleValues); - ResolveReferencesToValue(Func, DestSlot); + insertValue(Func, FnSignature, ModuleValues); // Keep track of this information in a list that is emptied as functions are // loaded... // - FunctionSignatureList.push_back(std::make_pair(Func, DestSlot)); + FunctionSignatureList.push_back(Func); if (read_vbr(Buf, End, FnSignature)) throw Error_readvbr; BCR_TRACE(2, "Function of type: " << Ty << "\n"); @@ -642,7 +618,6 @@ BCR_TRACE(1, "BLOCK BytecodeFormat::SymbolTable: {\n"); ParseSymbolTable(Buf, Buf+Size, &TheModule->getSymbolTable(), 0); break; - default: Buf += Size; if (OldBuf > Buf) throw std::string("Expected Module Block!"); @@ -660,7 +635,9 @@ GlobalInits.pop_back(); // Look up the initializer value... - if (Value *V = getValue(GV->getType()->getElementType(), Slot, false)) { + // FIXME: Preserve this type ID! + unsigned TypeSlot = getTypeSlot(GV->getType()->getElementType()); + if (Value *V = getValue(TypeSlot, Slot, false)) { if (GV->hasInitializer()) throw std::string("Global *already* has an initializer?!"); GV->setInitializer(cast(V)); @@ -696,5 +673,3 @@ throw; } } - -} // End llvm namespace Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.67 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.68 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.67 Wed Nov 19 00:01:12 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Wed Nov 19 11:27:18 2003 @@ -37,7 +37,8 @@ struct LazyFunctionInfo { const unsigned char *Buf, *EndBuf; - unsigned FunctionSlot; + LazyFunctionInfo(const unsigned char *B = 0, const unsigned char *EB = 0) + : Buf(B), EndBuf(EB) {} }; class BytecodeParser : public ModuleProvider { @@ -104,13 +105,13 @@ std::vector ParsedBasicBlocks; - // GlobalRefs - This maintains a mapping between 's and forward - // references to global values or constants. Such values may be referenced - // before they are defined, and if so, the temporary object that they - // represent is held here. + // ConstantFwdRefs - This maintains a mapping between 's and + // forward references to constants. Such values may be referenced before they + // are defined, and if so, the temporary object that they represent is held + // here. // - typedef std::map, Value*> GlobalRefsType; - GlobalRefsType GlobalRefs; + typedef std::map, Constant*> ConstantRefsType; + ConstantRefsType ConstantFwdRefs; // TypesLoaded - This vector mirrors the Values[TypeTyID] plane. It is used // to deal with forward references to types. @@ -123,7 +124,7 @@ // each function in the module. When the function is loaded, this function is // filled in. // - std::vector > FunctionSignatureList; + std::vector FunctionSignatureList; // Constant values are read in after global variables. Because of this, we // must defer setting the initializers on global variables until after module @@ -136,7 +137,7 @@ // information about each function: its begin and end pointer in the buffer // and its FunctionSlot. // - std::map LazyFunctionLoadMap; + std::map LazyFunctionLoadMap; private: void freeTable(ValueTable &Tab) { @@ -169,14 +170,13 @@ ValueTable &Tab, TypeValuesListTy &TypeTab); Constant *parseConstantValue(const unsigned char *&Buf, const unsigned char *End, - const Type *Ty); + unsigned TypeID); void parseTypeConstants(const unsigned char *&Buf, const unsigned char *EndBuf, TypeValuesListTy &Tab, unsigned NumEntries); const Type *parseTypeConstant(const unsigned char *&Buf, const unsigned char *EndBuf); - Value *getValue(const Type *Ty, unsigned num, bool Create = true); Value *getValue(unsigned TypeID, unsigned num, bool Create = true); const Type *getType(unsigned ID); BasicBlock *getBasicBlock(unsigned ID); @@ -185,13 +185,12 @@ return getConstantValue(getTypeSlot(Ty), num); } - unsigned insertValue(Value *V, ValueTable &Table); unsigned insertValue(Value *V, unsigned Type, ValueTable &Table); unsigned getTypeSlot(const Type *Ty); - // resolve all references to the placeholder (if any) for the given value - void ResolveReferencesToValue(Value *Val, unsigned Slot); + // resolve all references to the placeholder (if any) for the given constant + void ResolveReferencesToConstant(Constant *C, unsigned Slot); }; template From lattner at cs.uiuc.edu Wed Nov 19 12:35:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 12:35:00 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ConstProp/logicaltest.ll Message-ID: <200311191834.MAA04427@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ConstProp: logicaltest.ll updated: 1.3 -> 1.4 --- Log message: Fix testcase. This should no longer be XFAIL'd --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ConstProp/logicaltest.ll diff -u llvm/test/Regression/Transforms/ConstProp/logicaltest.ll:1.3 llvm/test/Regression/Transforms/ConstProp/logicaltest.ll:1.4 --- llvm/test/Regression/Transforms/ConstProp/logicaltest.ll:1.3 Tue Sep 16 10:29:18 2003 +++ llvm/test/Regression/Transforms/ConstProp/logicaltest.ll Wed Nov 19 12:34:44 2003 @@ -1,6 +1,6 @@ ; Ensure constant propogation of logical instructions is working correctly. -; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not ggrep -E 'and|or|xor' +; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not egrep 'and|or|xor' int "test1"() { %R = and int 4,1234 ret int %R } From lattner at cs.uiuc.edu Wed Nov 19 12:38:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 12:38:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll Message-ID: <200311191837.MAA04471@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ConstantMerge: 2003-10-28-MergeExternalConstants.ll updated: 1.1 -> 1.2 --- Log message: Improve test portability --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll diff -u llvm/test/Regression/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll:1.1 llvm/test/Regression/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll:1.2 --- llvm/test/Regression/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll:1.1 Tue Oct 28 23:51:03 2003 +++ llvm/test/Regression/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll Wed Nov 19 12:37:06 2003 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -constmerge | llvm-dis | grep -C 2 foo | grep bar +; RUN: llvm-as < %s | opt -constmerge | llvm-dis | grep -C2 foo | grep bar %foo = constant int 6 %bar = constant int 6 From lattner at cs.uiuc.edu Wed Nov 19 13:11:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:11:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200311191910.NAA06587@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.81 -> 1.82 --- Log message: *** Significantly speed up type resultion This change speeds up type resolution by checking to see if a type is recursive, and if it's not, using a more efficient algorithm. This dramatically reduces bytecode loading time of kc++, reducing time-to-jit kc++ --version to 17s from 33s --- Diffs of the changes: (+47 -9) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.81 llvm/lib/VMCore/Type.cpp:1.82 --- llvm/lib/VMCore/Type.cpp:1.81 Wed Nov 19 00:14:38 2003 +++ llvm/lib/VMCore/Type.cpp Wed Nov 19 13:10:23 2003 @@ -14,6 +14,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/SymbolTable.h" #include "llvm/Constants.h" +#include "Support/DepthFirstIterator.h" #include "Support/StringExtras.h" #include "Support/STLExtras.h" #include @@ -495,7 +496,6 @@ std::map &EqTypes) { if (Ty == Ty2) return true; if (Ty->getPrimitiveID() != Ty2->getPrimitiveID()) return false; - if (Ty->isPrimitiveType()) return true; if (isa(Ty)) return false; // Two unequal opaque types are never equal @@ -595,23 +595,61 @@ // updated. Remove the obsolete entry from the map. Map.erase(TyIt); - // Now we check to see if there is an existing entry in the table which is - // structurally identical to the newly refined type. If so, this type gets - // refined to the pre-existing type. - // - for (iterator I = Map.begin(), E = Map.end(); I != E; ++I) - if (TypesEqual(Ty, I->second)) { + // Determine whether there is a cycle through the type graph which passes + // back through this type. Other cycles are ok, + bool HasTypeCycle = false; + { + std::set VisitedTypes; + for (Type::subtype_iterator I = Ty->subtype_begin(), + E = Ty->subtype_end(); I != E; ++I) { + for (df_ext_iterator > + DFI = df_ext_begin(*I, VisitedTypes), + E = df_ext_end(*I, VisitedTypes); DFI != E; ++DFI) + if (*DFI == Ty) { + HasTypeCycle = true; + goto FoundCycle; + } + } + } + FoundCycle: + + ValType Key = ValType::get(Ty); + + // If there are no cycles going through this node, we can do a simple, + // efficient lookup in the map, instead of an inefficient nasty linear + // lookup. + if (!HasTypeCycle) { + iterator I = Map.find(ValType::get(Ty)); + if (I != Map.end()) { + // We already have this type in the table. Get rid of the newly refined + // type. assert(Ty->isAbstract() && "Replacing a non-abstract type?"); TypeClass *NewTy = I->second; - + // Refined to a different type altogether? Ty->refineAbstractTypeTo(NewTy); return; } + + } else { + // Now we check to see if there is an existing entry in the table which is + // structurally identical to the newly refined type. If so, this type + // gets refined to the pre-existing type. + // + for (iterator I = Map.begin(), E = Map.end(); I != E; ++I) + if (TypesEqual(Ty, I->second)) { + assert(Ty->isAbstract() && "Replacing a non-abstract type?"); + TypeClass *NewTy = I->second; + + // Refined to a different type altogether? + Ty->refineAbstractTypeTo(NewTy); + return; + } + } // If there is no existing type of the same structure, we reinsert an // updated record into the map. - Map.insert(std::make_pair(ValType::get(Ty), Ty)); + Map.insert(std::make_pair(Key, Ty)); // If the type is currently thought to be abstract, rescan all of our // subtypes to see if the type has just become concrete! From lattner at cs.uiuc.edu Wed Nov 19 13:21:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:21:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200311191920.NAA06883@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.82 -> 1.83 --- Log message: Really, there was a reason for me factoring that out --- Diffs of the changes: (+1 -1) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.82 llvm/lib/VMCore/Type.cpp:1.83 --- llvm/lib/VMCore/Type.cpp:1.82 Wed Nov 19 13:10:23 2003 +++ llvm/lib/VMCore/Type.cpp Wed Nov 19 13:20:20 2003 @@ -619,7 +619,7 @@ // efficient lookup in the map, instead of an inefficient nasty linear // lookup. if (!HasTypeCycle) { - iterator I = Map.find(ValType::get(Ty)); + iterator I = Map.find(Key); if (I != Map.end()) { // We already have this type in the table. Get rid of the newly refined // type. From lattner at cs.uiuc.edu Wed Nov 19 13:41:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:41:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ Message-ID: <200311191940.NAA27556@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm/test/Regression/CodeGen added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Nov 19 13:41:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:41:05 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/ Message-ID: <200311191940.NAA27562@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm/test/Regression/CodeGen/X86 added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Nov 19 13:43:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:43:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Jello/2003-08-21-EnvironmentTest.ll Message-ID: <200311191942.NAA29279@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Jello: 2003-08-21-EnvironmentTest.ll updated: 1.2 -> 1.3 --- Log message: Cleanup test --- Diffs of the changes: (+2 -5) Index: llvm/test/Regression/Jello/2003-08-21-EnvironmentTest.ll diff -u llvm/test/Regression/Jello/2003-08-21-EnvironmentTest.ll:1.2 llvm/test/Regression/Jello/2003-08-21-EnvironmentTest.ll:1.3 --- llvm/test/Regression/Jello/2003-08-21-EnvironmentTest.ll:1.2 Thu Aug 21 16:33:19 2003 +++ llvm/test/Regression/Jello/2003-08-21-EnvironmentTest.ll Wed Nov 19 13:42:12 2003 @@ -6,16 +6,13 @@ ; environment to the main() function. ; -target endian = little -target pointersize = 32 - implementation declare uint %strlen(sbyte*) int %main(int %argc.1, sbyte** %argv.1, sbyte** %envp.1) { - %tmp.2 = load sbyte** %envp.1 ; [#uses=2] - %tmp.3 = call uint %strlen( sbyte* %tmp.2 ) ; [#uses=1] + %tmp.2 = load sbyte** %envp.1 + %tmp.3 = call uint %strlen( sbyte* %tmp.2 ) %T = seteq uint %tmp.3, 0 %R = cast bool %T to int ret int %R From lattner at cs.uiuc.edu Wed Nov 19 13:45:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:45:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Jello/2003-01-04-PhiTest.ll 2003-05-06-LivenessClobber.llx 2003-05-07-ArgumentTest.llx 2003-08-04-PhysRegLiveFailure.llx Message-ID: <200311191944.NAA31146@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Jello: 2003-01-04-PhiTest.ll updated: 1.2 -> 1.3 2003-05-06-LivenessClobber.llx updated: 1.3 -> 1.4 2003-05-07-ArgumentTest.llx updated: 1.2 -> 1.3 2003-08-04-PhysRegLiveFailure.llx (r1.2) removed --- Log message: Genericize tests --- Diffs of the changes: (+2 -10) Index: llvm/test/Regression/Jello/2003-01-04-PhiTest.ll diff -u llvm/test/Regression/Jello/2003-01-04-PhiTest.ll:1.2 llvm/test/Regression/Jello/2003-01-04-PhiTest.ll:1.3 --- llvm/test/Regression/Jello/2003-01-04-PhiTest.ll:1.2 Mon Sep 15 15:02:53 2003 +++ llvm/test/Regression/Jello/2003-01-04-PhiTest.ll Wed Nov 19 13:44:28 2003 @@ -1,5 +1,3 @@ -; RUN: llvm-as < %s | lli -force-interpreter=false - int %main() { br label %Loop Loop: Index: llvm/test/Regression/Jello/2003-05-06-LivenessClobber.llx diff -u llvm/test/Regression/Jello/2003-05-06-LivenessClobber.llx:1.3 llvm/test/Regression/Jello/2003-05-06-LivenessClobber.llx:1.4 --- llvm/test/Regression/Jello/2003-05-06-LivenessClobber.llx:1.3 Mon Sep 15 15:02:53 2003 +++ llvm/test/Regression/Jello/2003-05-06-LivenessClobber.llx Wed Nov 19 13:44:28 2003 @@ -1,9 +1,6 @@ ; This testcase shoudl return with an exit code of 1. ; -; RUN: llvm-as < %s | not lli -force-interpreter=false - -target endian = little -target pointersize = 32 +; RUN: llvm-as < %s | not lli %test = global long 0 implementation Index: llvm/test/Regression/Jello/2003-05-07-ArgumentTest.llx diff -u llvm/test/Regression/Jello/2003-05-07-ArgumentTest.llx:1.2 llvm/test/Regression/Jello/2003-05-07-ArgumentTest.llx:1.3 --- llvm/test/Regression/Jello/2003-05-07-ArgumentTest.llx:1.2 Mon Sep 15 15:02:53 2003 +++ llvm/test/Regression/Jello/2003-05-07-ArgumentTest.llx Wed Nov 19 13:44:28 2003 @@ -1,7 +1,4 @@ -; RUN: llvm-as < %s | lli -force-interpreter=false - test - -target endian = little -target pointersize = 32 +; RUN: llvm-as < %s | lli - test implementation From lattner at cs.uiuc.edu Wed Nov 19 13:48:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:48:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll Message-ID: <200311191947.NAA01944@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/ExecutionEngine: 2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll updated: 1.1 -> 1.2 --- Log message: update test --- Diffs of the changes: (+0 -2) Index: llvm/test/Regression/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll diff -u llvm/test/Regression/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll:1.1 llvm/test/Regression/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll:1.2 --- llvm/test/Regression/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll:1.1 Sat Oct 18 18:54:45 2003 +++ llvm/test/Regression/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll Wed Nov 19 13:47:36 2003 @@ -1,5 +1,3 @@ -; RUN: llvm-as < %s | lli -force-interpreter=false - %A = global int 0 int %main() { From lattner at cs.uiuc.edu Wed Nov 19 13:48:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 13:48:05 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/ExecutionEngine/ Message-ID: <200311191947.NAA01348@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/ExecutionEngine: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm/test/Regression/ExecutionEngine added to the repository --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Wed Nov 19 14:11:04 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Nov 19 14:11:04 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.qmr Message-ID: <200311192010.OAA03779@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.qmr updated: 1.6 -> 1.7 --- Log message: Attempting to update it for the new JIT test changes. --- Diffs of the changes: (+1 -1) Index: llvm/test/QMTest/expectations.qmr diff -u llvm/test/QMTest/expectations.qmr:1.6 llvm/test/QMTest/expectations.qmr:1.7 --- llvm/test/QMTest/expectations.qmr:1.6 Mon Nov 3 10:12:18 2003 +++ llvm/test/QMTest/expectations.qmr Wed Nov 19 14:10:21 2003 @@ -3,13 +3,13 @@ qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq U_Result__contextq (cqm.test.context Context -q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U(Regression.Transforms.PruneEH.simpletestqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhUFAILqh}h U.Regression.Transforms.CorrelatedExprs.looptestqh (h o}q (h}h}ubub.(hoq!}q"(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-PredecessorProblemq3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-! VarArgCallInfLoopq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U-Regression.C++Frontend.2003-08-28-SaveExprBugqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Transforms.Reassociate.subtestqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq_h (h o}q`(h}h}ubub.(! hoqa}qb(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10- 07-DominatorProblemqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U(hhhhh}h U Regression.Reoptimizer.ticm.ticmq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U)Regression.Transforms.Reassociate.subtestqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemq_! h (h o}q`(h}h}ubub.(hoqa}qb(hhhhh}h U3Regression.Transforms.Pi NodeInserter.substitutetestqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U-Regression.CFrontend.2002-02-18-64bitConstantqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U(Regression.Reoptimizer.BinInterface.testqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U Changes in directory llvm/test/QMTest: llvmdb.py updated: 1.9 -> 1.10 --- Log message: Removed the Jello tests and replaced with the ExecutionEngine and CodeGen tests. --- Diffs of the changes: (+2 -1) Index: llvm/test/QMTest/llvmdb.py diff -u llvm/test/QMTest/llvmdb.py:1.9 llvm/test/QMTest/llvmdb.py:1.10 --- llvm/test/QMTest/llvmdb.py:1.9 Wed Oct 22 12:27:40 2003 +++ llvm/test/QMTest/llvmdb.py Wed Nov 19 14:22:09 2003 @@ -37,7 +37,8 @@ 'C++Frontend':'llvm.CXXTest', 'CBackend':'llvm.LLToCTest', 'CFrontend':'llvm.CTest', - 'Jello':'llvm.LLITest', + 'ExecutionEngine':'llvm.LLITest', + 'CodeGen':'llvm.TestRunner', 'LLC':'llvm.MachineCodeTest', 'Linker':'llvm.TestRunner', 'Other':'llvm.TestRunner', From criswell at cs.uiuc.edu Wed Nov 19 14:36:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Nov 19 14:36:02 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.qmr Message-ID: <200311192035.OAA20800@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.qmr updated: 1.7 -> 1.8 --- Log message: Made the following tests pass: Regression.CFrontend.2003-08-17-DeadCodeShortCircuit Regression.Transforms.FunctionResolve.2003-04-18-ForwardDeclGlobal Regression.Transforms.ConstProp.logicaltest --- Diffs of the changes: (+1 -1) Index: llvm/test/QMTest/expectations.qmr diff -u llvm/test/QMTest/expectations.qmr:1.7 llvm/test/QMTest/expectations.qmr:1.8 --- llvm/test/QMTest/expectations.qmr:1.7 Wed Nov 19 14:10:21 2003 +++ llvm/test/QMTest/expectations.qmr Wed Nov 19 14:35:08 2003 @@ -3,13 +3,13 @@ qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq U_Result__contextq (cqm.test.context Context -q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U(Regression.Transforms.PruneEH.simpletestqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U9Regression.Transforms.Mem2Reg.2003-10-05-DeadPHIInsertionqh (h o}q(h}h}ubub.(hoq }q!(hhhUFAILq"h}h U.Regression.Transforms.CorrelatedExprs.looptestq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhh"h}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-Prede! cessorProblemq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-VarArgCallInfLoopq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U Regression.Reoptimizer.ticm.ticmq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U)Regression.Transforms.Reassociate.subtestqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemq_! h (h o}q`(h}h}ubub.(hoqa}qb(hhhhh}h U3Regression.Transforms.Pi NodeInserter.substitutetestqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U-Regression.CFrontend.2002-02-18-64bitConstantqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U(Regression.Reoptimizer.BinInterface.testqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U-Regression.C++Frontend.2003-08-28-SaveExprBugqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Transforms.Reassociate.subtestq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq_h (h o}q`(h}h}ubub.(hoqa}qb(h! hhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSub Moveqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U>Regression.Transforms.InstCombine.2003-06-22-ConstantExprCrashqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2q{h (h o}q|(h}h}ubub.(hoq}}q~(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqh (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U Changes in directory reopt/lib/Inst/lib: ElfReader.cpp updated: 1.14 -> 1.15 InstManip.cpp updated: 1.15 -> 1.16 InstManip.h updated: 1.18 -> 1.19 PhaseInfo.h updated: 1.10 -> 1.11 Phases.cpp updated: 1.38 -> 1.39 SparcInstManip.cpp updated: 1.21 -> 1.22 SparcInstManip.h updated: 1.16 -> 1.17 --- Log message: Cleanups: file headers, using declarations, namespacification, removing #if 0'd-out code, wrapping at 80 columns, sorting headers, not using endl, doxygenifying comments, renaming header guard macros, etc. (There is still more to do, but at least it compiles again now...) --- Diffs of the changes: (+488 -388) Index: reopt/lib/Inst/lib/ElfReader.cpp diff -u reopt/lib/Inst/lib/ElfReader.cpp:1.14 reopt/lib/Inst/lib/ElfReader.cpp:1.15 --- reopt/lib/Inst/lib/ElfReader.cpp:1.14 Fri Oct 10 13:45:21 2003 +++ reopt/lib/Inst/lib/ElfReader.cpp Wed Nov 19 14:49:52 2003 @@ -1,13 +1,20 @@ -//////////////// -// programmer: Joel Stanley -// date: Fri Mar 21 16:11:07 CST 2003 -// fileid: ElfReader.cpp -// purpose: Implementation of ELF reader interface as described in ElfReader.h. Note -// that special care is taken to ensure that archive files are treated the same as -// single object files. +//===- ElfReader.cpp - ELF object file reader implementation --------------===// +// +// The LLVM Compiler Infrastructure // -// [] +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 21-Mar-2003. Implementation +// of ELF reader interface as described in ElfReader.h. Note that +// special care is taken to ensure that archive files are treated the +// same as single object files. +// +//===----------------------------------------------------------------------===// +#include "reopt/Inst/ElfReader.h" #include #include #include @@ -19,14 +26,12 @@ #include #include -#include "reopt/Inst/ElfReader.h" - -using std::cerr; -using std::endl; - -// Symbol binding values that don't occur in the ELF spec, but that are recognized as WEAK -// and GLOB by the elfdump command-line utility. For matching output. +using namespace llvm; +/// Symbol binding values that don't occur in the ELF spec, but that +/// are recognized as WEAK and GLOB by the elfdump command-line +/// utility. For matching output. +/// #define ELFDUMP_GLOB 0x10 #define ELFDUMP_WEAK 0x20 @@ -49,7 +54,7 @@ assert(m_fd != -1 && "Failed to open executable image"); if(elf_version(EV_CURRENT) == EV_NONE) { - cerr << "ELF library version mismatch" << endl; + std::cerr << "ELF library version mismatch\n"; exit(1); } @@ -57,13 +62,9 @@ m_pPrimaryElf = elf_begin(m_fd, m_currCmd, 0); assert(m_pPrimaryElf && "Failed to obtain primary ELF descriptor"); - // Advance to the first file in the archive (essentially a no-op if only one file) + // Advance to the first file in the archive (essentially a no-op + // if only one file) m_pCurrElf = elf_begin(m_fd, m_currCmd, m_pPrimaryElf); - -#if 0 - if(Elf_Arhdr* arhdr = elf_getarhdr(m_pCurrElf)) - cerr << "AR member name: " << arhdr->ar_name << endl; -#endif } ElfReader::~ElfReader() @@ -72,12 +73,13 @@ close(m_fd); } +/// Print the given symbol table entry. Output format is similar to +/// that of the elfdump command line utility. +/// void ElfReader::printSymTableEntry(Elf64_Sym* sym, std::ostream& ostr) { - // Print this symbol table entry. Output format is similar to that of the elfdump - // command line utility. - - ostr << std::setw(16) << std::hex << std::setfill('0') << sym->st_value << " " + ostr << std::setw(16) << std::hex << std::setfill('0') << sym->st_value + << " " << std::setw(16) << std::hex << std::setfill('0') << sym->st_size; int type = sym->st_info & 0xf; @@ -98,7 +100,7 @@ ostr << "OTHR"; break; default: - //ostr << "(" << type << ")" << endl; + ostr << "Offending type: (" << type << ")\n"; assert(0 && "Symbol table entry has unknown type"); break; } @@ -122,7 +124,7 @@ ostr << "OTHR"; break; default: - //ostr << "(" << binding << ")" << endl; + ostr << "Offending type: (" << binding << ")\n"; assert(0 && "Unknown binding type"); break; } @@ -151,7 +153,7 @@ } // Output symbol name - ostr << " " << (m_pStrTab + sym->st_name) << endl; + ostr << " " << (m_pStrTab + sym->st_name) << "\n"; } void ElfReader::nextFile() @@ -159,17 +161,10 @@ // Advance to the next file in the archive. m_currCmd = elf_next(m_pCurrElf); - // Dispose of the old ELF descriptor and get a new one that corresponds to the new - // file in the archive. - + // Dispose of the old ELF descriptor and get a new one that + // corresponds to the new file in the archive. elf_end(m_pCurrElf); m_pCurrElf = elf_begin(m_fd, m_currCmd, m_pPrimaryElf); - -#if 0 - if(Elf_Arhdr* arhdr = elf_getarhdr(m_pCurrElf)) - cerr << "AR member name: " << arhdr->ar_name << endl; -#endif - m_pElfHdr = 0; m_pSymHdr = 0; m_pSymSec = 0; @@ -189,8 +184,10 @@ return false; // Obtain pointer to the string table of section names - Elf_Data* strTabHand = elf_getdata(elf_getscn(m_pCurrElf, m_pElfHdr->e_shstrndx), 0); - assert(strTabHand && "Couldn't obtain ELF data handle to section-name string table"); + Elf_Data* strTabHand = + elf_getdata(elf_getscn(m_pCurrElf, m_pElfHdr->e_shstrndx), 0); + assert(strTabHand + && "Couldn't obtain ELF data handle to section-name string table"); m_pSecNameTab = (char*) strTabHand->d_buf; // Find symbol table(s), etc. @@ -198,7 +195,8 @@ // Obtain pointer to string table associated with the symbol table strTabHand = elf_getdata(elf_getscn(m_pCurrElf, m_pSymHdr->sh_link), 0); - assert(strTabHand && "Couldn't obtain ELF data handle to symbol-name string table"); + assert(strTabHand + && "Couldn't obtain ELF data handle to symbol-name string table"); m_pStrTab = (char*) strTabHand->d_buf; assert(m_pSymHdr->sh_entsize == sizeof(Elf64_Sym) && @@ -206,14 +204,17 @@ // Determine the number of entries in the table Elf64_Xword numEntries = m_pSymHdr->sh_size / sizeof(Elf64_Sym); - assert(m_pSymHdr->sh_size % sizeof(Elf64_Sym) == 0 && "Symtable size must be multiple of entry size"); + assert(m_pSymHdr->sh_size % sizeof(Elf64_Sym) == 0 + && "Symtable size must be multiple of entry size"); assert(m_pSymHdr->sh_size > 0 && "Empty symbol table encountered"); // Obtain the symbol table data Elf_Data* data = elf_getdata(m_pSymSec, 0); assert(data && "Could not obtain symtable data"); - assert(data->d_size == m_pSymHdr->sh_size && "Size in data and size in header do not correspond"); - assert(data->d_type == ELF_T_SYM && "Unexpected data type found in symtable"); + assert(data->d_size == m_pSymHdr->sh_size + && "Size in data and size in header do not correspond"); + assert(data->d_type == ELF_T_SYM + && "Unexpected data type found in symtable"); assert(!elf_getdata(m_pSymSec, data) && "No more data expected in section"); // Set current entry pointer and pointer to end of table @@ -233,10 +234,10 @@ } if(!m_pElfHdr) { - // No ELF header? Must be about to process a new file in the archive. Perform the - // necessary setup that must occur before processing. If handling the current - // new file fails, try the next one. - + // No ELF header? Must be about to process a new file in the + // archive. Perform the necessary setup that must occur before + // processing. If handling the current new file fails, try the + // next one. if(!handleNewFile()) { nextFile(); return findNextSymbol(fname, range, instWidth); @@ -245,25 +246,23 @@ assert(m_pCurrSym && m_pSymEnd && "Invalid symtable pointers"); - // Locate next function (skipping non-function entries) in the symbol table that is - // marked as being in the code segment. If found, return true, yielding name & extents - // by reference. If we are done scanning the symbol table, advance to the next file in + // Locate next function (skipping non-function entries) in the + // symbol table that is marked as being in the code segment. If + // found, return true, yielding name & extents by reference. If we + // are done scanning the symbol table, advance to the next file in // the archive and continue searching recursively. - bool foundSym = false; for( ; !foundSym && m_pCurrSym != m_pSymEnd; ++m_pCurrSym) { - unsigned info = m_pCurrSym->st_info & 0xf; // Symbol type is lower 4 bits - + unsigned info = m_pCurrSym->st_info & 0xf; // Sym. type is lower 4 bits if(STT_FUNC == info && m_pCurrSym->st_shndx == m_codeSecIdx) { - //printSymTableEntry(m_pCurrSym); - fname = m_pStrTab + m_pCurrSym->st_name; - // NB: Address range contains the (closed) memory interval [start,end] of - // the memory addresses of function with symbol fname. - + // NB: Address range contains the (closed) memory interval + // [start,end] of the memory addresses of function with + // symbol fname. range.first = m_pCurrSym->st_value; - range.second = m_pCurrSym->st_value + m_pCurrSym->st_size - instWidth; + range.second = m_pCurrSym->st_value + m_pCurrSym->st_size + - instWidth; foundSym = true; } } @@ -276,12 +275,13 @@ return findNextSymbol(fname, range, instWidth); } +/// Examine the section header of each section, looking for the symbol +/// table (which must be unique, otherwise a runtime error occurs) and +/// the code segment, i.e., the segment which has the spec-defined +/// name ".text". +/// void ElfReader::locateSections() { - // Examine the section header of each section, looking for: - // a) The symbol table. When found ensure that it is unique, otherwise, assert out. - // b) The code segment (i.e. the segment which has the spec-defined name ".text" - bool codeSegmentFound = false; Elf64_Shdr* secHdr; for(Elf_Scn* currScn = 0; (currScn = elf_nextscn(m_pCurrElf, currScn)); ) { @@ -290,13 +290,15 @@ if(SHT_SYMTAB == secHdr->sh_type) { // Found section marked as a symbol table - assert(!m_pSymHdr && !m_pSymSec && "Should only be one symbol table in the image"); + assert(!m_pSymHdr && !m_pSymSec + && "Should only be one symbol table in the image"); m_pSymHdr = secHdr; m_pSymSec = currScn; } else if(SHT_PROGBITS == secHdr->sh_type && !codeSegmentFound) { - // Found section marked as "program-defined". Obtain section name and see - // if it matches the name of the code segment. + // Found section marked as "program-defined". Obtain + // section name and see if it matches the name of the code + // segment. char* sectionName = m_pSecNameTab + secHdr->sh_name; if(sm_codeSegmentName == sectionName) { m_codeSecIdx = elf_ndxscn(currScn); @@ -308,6 +310,5 @@ assert(m_pSymHdr && m_pSymSec && "Couldn't locate symbol table (stripped executable?)"); - assert(codeSegmentFound && "Couldn't locate code segment"); } Index: reopt/lib/Inst/lib/InstManip.cpp diff -u reopt/lib/Inst/lib/InstManip.cpp:1.15 reopt/lib/Inst/lib/InstManip.cpp:1.16 --- reopt/lib/Inst/lib/InstManip.cpp:1.15 Sat Sep 13 16:12:07 2003 +++ reopt/lib/Inst/lib/InstManip.cpp Wed Nov 19 14:49:52 2003 @@ -1,20 +1,25 @@ -//////////////// -// programmer: Joel Stanley -// date: Tue Apr 8 22:45:53 CDT 2003 -// fileid: InstManip.cpp -// purpose: Implements the InstManip class as described in InstManip.h. - -#include -#include -#include +//===- InstManip.cpp - InstManip class implementation ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 8-Apr-2003. Implements the +// InstManip class as described in InstManip.h. +// +//===----------------------------------------------------------------------===// #include "reopt/TraceCache.h" #include "reopt/VirtualMem.h" #include "InstManip.h" +#include +#include +#include -using std::cout; -using std::cerr; -using std::endl; +namespace llvm { std::ostream& operator<<(std::ostream& ostr, const InstCandidate& cand) @@ -25,17 +30,17 @@ void InstCandidate::print(std::ostream& ostr) const { - ostr << "InstCandidate {" << endl; - ostr << " type = " - << (m_type == DIRECT ? "DIRECT" : "STACK XFER") - << endl; - ostr << " Instruction dump (address, inst):" << endl; + ostr << "InstCandidate {\n" + << " type = " + << (m_type == DIRECT ? "DIRECT" : "STACK XFER") + << "\n" + << " Instruction dump (address, inst):\n"; for(std::vector >::const_iterator i = m_insts.begin(), e = m_insts.end(); i != e; ++i) { ostr << std::hex << " (" << i->first << ", " << std::flush; m_pIM->printInst(i->second); - ostr << ")" << endl; + ostr << ")\n"; } ostr << "}"; } @@ -60,17 +65,19 @@ delete [] m_pPhase3SpillRegion; } +/// Heap-allocate a region of memory in which to spill shared +/// registers before phase3 invocations. We allocate one unit of +/// space (given by getSharedSize()) for each function that must be +/// transformed. +/// void InstManip::makePhase3SpillRegion(unsigned numFuncs) { - // Heap-allocate a region of memory in which to spill shared registers before phase3 - // invocations. We allocate one unit of space (given by getSharedSize()) for each - // function that must be transformed. - m_pPhase3SpillRegion = new uint64_t[getSharedSize() * numFuncs]; m_pCurrSpill = m_pPhase3SpillRegion; } -void InstManip::copySnippetToSlot(std::vector& snippet, uint64_t slotBase) +void InstManip::copySnippetToSlot(std::vector& snippet, + uint64_t slotBase) { uint64_t currAddr = slotBase; for(std::vector::iterator i = snippet.begin(), @@ -79,3 +86,5 @@ currAddr += getInstWidth(); } } + +} // end namespace llvm Index: reopt/lib/Inst/lib/InstManip.h diff -u reopt/lib/Inst/lib/InstManip.h:1.18 reopt/lib/Inst/lib/InstManip.h:1.19 --- reopt/lib/Inst/lib/InstManip.h:1.18 Sun May 18 12:45:25 2003 +++ reopt/lib/Inst/lib/InstManip.h Wed Nov 19 14:49:53 2003 @@ -1,32 +1,43 @@ -//////////////// -// programmer: Joel Stanley -// date: Tue Apr 8 22:42:14 CDT 2003 -// fileid: InstManip.h -// purpose: InstManip is a (pure virtual) class that hdies platform-specific -// instruction manipulation behind a common interface, and provides clients with -// various instruction manipulation utilities. Since the structure of the TraceCache -// "slots" for the various phases of the binary editing for performance -// instrumentation have structure and content that is platform-dependent, this class -// also hides the platform-specific details of the slot construction as well. Only -// two relevant assumptions are made: +//===- InstManip.cpp - InstManip class interface --------------------------===// +// +// The LLVM Compiler Infrastructure // -// * The TraceCache objects (TraceCache, MemoryManager, VirtualMem, etc) from the -// Reoptimizer library work in an appropriate manner on the given platform. +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// // -// * uint64_t is used for addresses, and unsigned is used for instruction words. +// Originally written by Joel Stanley on 8-Apr-2003. InstManip is a (pure +// virtual) class that hides platform-specific instruction manipulation behind a +// common interface, and provides clients with various instruction manipulation +// utilities. Since the structure of the TraceCache "slots" for the various +// phases of the binary editing for performance instrumentation have structure +// and content that is platform-dependent, this class also hides the +// platform-specific details of the slot construction as well. Only two +// relevant assumptions are made: // -// Better parameterization of type attributes (perhaps by making it a template class?) -// is on the TODO list. This is currently difficult because the aforementioned -// Reoptimizer classes are not parameterized. +// * The TraceCache objects (TraceCache, MemoryManager, VirtualMem, etc) from +// the Reoptimizer library work in an appropriate manner on the given +// platform. +// +// * uint64_t is used for addresses, and unsigned is used for instruction +// words. +// +// Better parameterization of type attributes (perhaps by making it a template +// class?) is on the TODO list. This is currently difficult because the +// aforementioned Reoptimizer classes are not parameterized. +// +//===----------------------------------------------------------------------===// -#ifndef _INCLUDED_INSTMANIP_H -#define _INCLUDED_INSTMANIP_H +#ifndef INSTMANIP_H +#define INSTMANIP_H +#include "Phase1/Intraphase.h" #include #include #include -#include "Phase1/Intraphase.h" +namespace llvm { class TraceCache; class Phase2; @@ -49,8 +60,9 @@ typedef std::pair AddressRange; - // Logical registers used by clients of this class, mapped to machine-specific IDs - // by the logical -> actual register map. + /// Logical registers used by clients of this class, mapped to + /// machine-specific IDs by the logical -> actual register map. + /// enum LogicalRegister { REG_0, REG_1, @@ -58,10 +70,12 @@ REG_7 }; - // buildSlot - Fill the provided vector with the instructions that go into the slot - // given by the Phase{3,4}Info instance. The proper function is distinguished by type - // in this manner because there are not really enough phases to warrant building the - // slot-building behavior into the Phase{3,4}Info classes themselves. + /// buildSlot - Fill the provided vector with the instructions that go into + /// the slot given by the Phase{3,4}Info instance. The proper function is + /// distinguished by type in this manner because there are not really enough + /// phases to warrant building the slot-building behavior into the + /// Phase{3,4}Info classes themselves. + /// // For the phase 3 slot virtual void buildSlot(Phase3Info* p3info, @@ -82,30 +96,30 @@ virtual unsigned getSlotSize(Phase3* p3, InstCandidate& cand) const = 0; virtual unsigned getSlotSize(Phase4* p4) const = 0; - // findCandidates - Build the vector of instruction candidates that occur in the - // region defined by the given addresses. This is necessarily a platform-dependent - // action. - + /// findCandidates - Build the vector of instruction candidates that occur + /// in the region defined by the given addresses. This is necessarily a + /// platform-dependent action. + /// virtual void findCandidates(const std::pair& range, std::vector& candidates) = 0; - // getStartAddr - return the desired starting position in the function body. This is - // useful for skipping standard prologue code that occurs at the start of the function - // body. - + /// getStartAddr - return the desired starting position in the function + /// body. This is useful for skipping standard prologue code that occurs at + /// the start of the function body. + /// virtual uint64_t getStartAddr(uint64_t funcStartAddr) const = 0; - virtual unsigned getBranchAlways(uint64_t dest, uint64_t pc, bool annulHigh = true) const = 0; + virtual unsigned getBranchAlways(uint64_t dest, uint64_t pc, + bool annulHigh = true) const = 0; virtual bool isBranch(unsigned inst) const = 0; virtual void printRange(unsigned* start, unsigned* end) const = 0; virtual void printInst(unsigned inst) const = 0; - //// - void makePhase3SpillRegion(unsigned numFuncs); uint64_t* getCurrentSpill() { return m_pCurrSpill; } void advanceSpill() { m_pCurrSpill += getSharedSize(); } - void copySnippetToSlot(std::vector& snippet, uint64_t slotBase); + void copySnippetToSlot(std::vector& snippet, + uint64_t slotBase); inline void printRange(uint64_t start, uint64_t end) const; @@ -118,15 +132,19 @@ typedef std::map LogicalToActualRegMap; - LogicalToActualRegMap m_logicalToActualReg; // Maps logical -> actual register + // Maps logical -> actual register + LogicalToActualRegMap m_logicalToActualReg; TraceCache* m_pTC; - - uint64_t* m_pPhase3SpillRegion; // Base pointer to spill region for phase 3 invocations - uint64_t* m_pCurrSpill; // Current location in the phase 3 spill region - - unsigned m_sharedSize; // # of shared registers that must be spilled - unsigned m_instWidth; // instruction width, in bytes - unsigned m_nopInst; // NOP instruction word + // Base pointer to spill region for phase 3 invocations + uint64_t* m_pPhase3SpillRegion; + // Current location in the phase 3 spill region + uint64_t* m_pCurrSpill; + // # of shared registers that must be spilled + unsigned m_sharedSize; + // instruction width, in bytes + unsigned m_instWidth; + // NOP instruction word + unsigned m_nopInst; }; void InstManip::printRange(uint64_t start, uint64_t end) const @@ -134,14 +152,13 @@ printRange((unsigned*) start, (unsigned*) end); } -//////////////// - -// InstCandidate is a class that represents a location in the code that is determined to -// be a candidate for instrumentation. Because the transformation action required for a -// particular candidate requires auxiliary information (such as other instructions found -// within the region of the primary candidate instruction), these are encapsulated in the -// InstCandidate as well. - +/// InstCandidate is a class that represents a location in the code that is +/// determined to be a candidate for instrumentation. Because the +/// transformation action required for a particular candidate requires auxiliary +/// information (such as other instructions found within the region of the +/// primary candidate instruction), these are encapsulated in the InstCandidate +/// as well. +/// class InstCandidate { public: @@ -186,12 +203,14 @@ InstManip* m_pIM; CandType m_type; - // Each element of this vector holds a (address, inst) pair. + /// Each element of this vector holds a (address, inst) pair. + /// std::vector > m_insts; - }; std::ostream& operator<<(std::ostream& ostr, const InstCandidate& cand); -#endif // _INCLUDED_INSTMANIP_H +}; // end namespace llvm + +#endif // INSTMANIP_H Index: reopt/lib/Inst/lib/PhaseInfo.h diff -u reopt/lib/Inst/lib/PhaseInfo.h:1.10 reopt/lib/Inst/lib/PhaseInfo.h:1.11 --- reopt/lib/Inst/lib/PhaseInfo.h:1.10 Tue Jun 24 10:39:52 2003 +++ reopt/lib/Inst/lib/PhaseInfo.h Wed Nov 19 14:49:53 2003 @@ -1,14 +1,24 @@ -//////////////// -// programmer: Joel Stanley -// date: Tue Apr 29 23:02:12 CDT 2003 -// fileid: PhaseInfo.h -// purpose: Describes the classes that are used to carry information between -// phases. +//===- PhaseInfo.h - Classes carrying info between phases -----------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 29-Apr-2003. Describes the +// classes that are used to carry information between phases. +// +//===----------------------------------------------------------------------===// -#ifndef _INCLUDED_PHASEINFO_H -#define _INCLUDED_PHASEINFO_H +#ifndef PHASEINFO_H +#define PHASEINFO_H #include "InstManip.h" +#include + +namespace llvm { class TraceCache; class InstManip; @@ -54,12 +64,12 @@ void print(std::ostream& ostr) { - ostr << std::hex << "Phase3Info instance: {" << std::endl + ostr << std::hex << "Phase3Info instance: {\n" << " Function address range: [" << m_range.first << ", " - << m_range.second << "]" << std::endl + << m_range.second << "]\n" << " To replace: [" << m_origInst << " @ " - << m_replaceAddr << "]" << std::endl - << "}" << std::endl; + << m_replaceAddr << "]\n" + << "}\n"; } const AddressRange& getRange() const { return m_range; } @@ -79,7 +89,7 @@ uint64_t m_slotDescriptor; // Slot created by phase 2 unsigned m_slotSize; // Size of slot created by phase 2 TraceCache* m_pTC; // TraceCache instance used by phase 2 - InstManip* m_pIM; // The InstManip instance to pass to the next phase + InstManip* m_pIM; // InstManip instance passed to next phase }; class Phase4Info @@ -101,7 +111,7 @@ } const InstCandidate& getCandidate() const { return m_candidate; } - const AddressRange& getRange() const { return m_range; } + const AddressRange& getRange() const { return m_range; } uint64_t getSlot() const { return m_slotDescriptor; } uint64_t getSlotSize() const { return m_slotSize; } TraceCache* getTraceCache() { return m_pTC; } @@ -110,12 +120,25 @@ private: Phase4Info() {} - InstCandidate m_candidate; // Candidate responsible for this instance's creation - AddressRange m_range; // Start address of enclosing function - uint64_t m_slotDescriptor; // Slot created by phase 3 - unsigned m_slotSize; // Size of slot created by phase 3 - TraceCache* m_pTC; // TraceCache instance used by phases 2 and 3 - InstManip* m_pIM; // The InstManip instance to pass to the next phase + // Candidate responsible for this instance's creation + InstCandidate m_candidate; + + // Start address of enclosing function + AddressRange m_range; + + // Slot created by phase 3 + uint64_t m_slotDescriptor; + + // Size of slot created by phase 3 + unsigned m_slotSize; + + // TraceCache instance used by phases 2 and 3 + TraceCache* m_pTC; + + // The InstManip instance to pass to the next phase + InstManip* m_pIM; }; -#endif // _INCLUDED_PHASEINFO_H +} // end namespace llvm + +#endif // PHASEINFO_H Index: reopt/lib/Inst/lib/Phases.cpp diff -u reopt/lib/Inst/lib/Phases.cpp:1.38 reopt/lib/Inst/lib/Phases.cpp:1.39 --- reopt/lib/Inst/lib/Phases.cpp:1.38 Sat Sep 13 16:12:07 2003 +++ reopt/lib/Inst/lib/Phases.cpp Wed Nov 19 14:49:53 2003 @@ -1,58 +1,64 @@ -//////////////// -// programmer: Joel Stanley -// date: Fri Apr 4 16:59:48 CST 2003 -// fileid: Phases.cpp -// purpose: Implements runtime phases 2-5 of the peformance-oriented language -// extensions. -// -// PHASE 2: -// On program startup ("phase 2" function called from main()): -// -// 1. Read the neccessary ELF data associated with the executable image. -// -// 2. For each function F (in section labelled ".text"), write code to call phase 3. -// -// 2a. Replace the first (replacable) instruction in F with a branch to a new -// slot (annulling bit should specify *not* to execute the branch delay slot) in -// the dummy function. -// -// 2b. In the new slot, write the contents of the phase 3 slot (see appropriate -// InstManip instance for detailed information about slot contents). -// -// PHASE 3: -// -// - Deallocate the parameter structure whenever it is convenient to do so. -// -// 1. Replace the original (replaced) instruction at the proper location in the -// original code. -// -// 2. Analyze the function and determine the load-volatile candidates. -// -// 3. For each load-volatile candidate, -// 3a. Obtain a new slot in the dummy function. -// 3b. Replace the load candidate with branch to slot. -// 3c. In the new slot, write the contents of the phase 4 slot (see appropriate -// InstManip instance for detailed information about slot contents). -// -// 4. Deallocate the slot that originated this invocation of phase3(). +//===- Phases.cpp - Implements phases 2-5 of performance-oriented extensions =// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 4-Apr-2003. Implements runtime phases +// 2-5 of the peformance-oriented language extensions, described below: +// +// PHASE 2: On program startup ("phase 2" function called from main()): +// 1. Read the necessary ELF data associated with the executable image. +// 2. For each function F (in section labelled ".text"), write code to call +// phase 3. +// 2a. Replace the first (replacable) instruction in F with a branch to a new +// slot (annulling bit should specify *not* to execute the branch delay +// slot) in the dummy function. +// 2b. In the new slot, write the contents of the phase 3 slot (see +// appropriate InstManip instance for detailed information about slot +// contents). +// +// PHASE 3: +// 0. Deallocate the parameter structure whenever it is convenient to do so. +// 1. Replace the original (replaced) instruction at the proper location in the +// original code. +// 2. Analyze the function and determine the load-volatile candidates. +// 3. For each load-volatile candidate, +// 3a. Obtain a new slot in the dummy function. +// 3b. Replace the load candidate with branch to slot. +// 3c. In the new slot, write the contents of the phase 4 slot (see +// appropriate InstManip instance for detailed information about slot +// contents). +// 4. Deallocate the slot that originated this invocation of phase3(). // // PHASE 4: -// -// 1. Examine the tag (i.e. load-src addr) passed by phase 3 -// 1a. If tag is in GBT, we have a valid candidate, so do step 2. -// 1b. If tag is not in GBT, our candidate is invalid, so restore original program state and -// go to step 3. -// -// 2. Change the branch to the phase 4 slot to branch to a (new) phase 5 slot. See -// appropriate InstManip instance for detailed information about phase 5 slot -// contents. If there is no registered instrumentation for the phase 5 slot, leave a -// nop in place of the branch to reduce runtime overhead. -// -// 3. Deallocate the slot that originated this invocation of phase4(). +// 1. Examine the tag (i.e. load-src addr) passed by phase 3: +// 1a. If tag is in GBT, we have a valid candidate, so do step 2. +// 1b. If tag is not in GBT, our candidate is invalid, so restore original +// program state and go to step 3. +// 2. Change the branch to the phase 4 slot to branch to a (new) phase 5 +// slot. See appropriate InstManip instance for detailed information about +// phase 5 slot contents. If there is no registered instrumentation for the +// phase 5 slot, leave a nop in place of the branch to reduce runtime +// overhead. +// 3. Deallocate the slot that originated this invocation of Phase 4. // // PHASE 5: Phase 5 isn't like the other phases; rather, it simply invokes all -// registered instrumentation functions for a particular site. +// registered instrumentation functions for a particular site. +// +//===----------------------------------------------------------------------===// +#include "InstManip.h" +#include "PhaseInfo.h" +#include "SparcInstManip.h" +#include "reopt/Inst/ElfReader.h" +#include "reopt/MemoryManager.h" +#include "reopt/TraceCache.h" +#include "reopt/VirtualMem.h" +#include "reopt/InstrUtils.h" #include #include #include @@ -62,37 +68,32 @@ #include #include -#include "reopt/Inst/ElfReader.h" -#include "reopt/MemoryManager.h" -#include "reopt/TraceCache.h" -#include "reopt/VirtualMem.h" -#include "reopt/InstrUtils.h" - -#include "InstManip.h" -#include "PhaseInfo.h" -#include "SparcInstManip.h" - using std::vector; using std::cerr; using std::endl; -// The function generated at compile-time by the 'mkexcl' command line utility; the -// command line utility must be run on any object/archive files containing symbols that -// must be excluded, and the generated file compiled and linked in. -void makeExcludedSymbolSet(std::set& set); +namespace llvm { -// Description of GBT contents emitted by phase 1. The extern reference to the GBT will be -// resolved at link-time, and will point to the GBT itself. The size of the GBT is -// obtained in the same manner. +/// The function generated at compile-time by the 'mkexcl' command line utility; +/// the command line utility must be run on any object/archive files containing +/// symbols that must be excluded, and the generated file compiled and linked +/// in. +/// +void makeExcludedSymbolSet(std::set& set); +/// Description of GBT contents emitted by phase 1. The extern reference to the +/// GBT will be resolved at link-time, and will point to the GBT itself. The +/// size of the GBT is obtained in the same manner. +/// extern unsigned ppGBTSize; extern GBTElem ppGBT[]; typedef std::pair AddressRange; -// Phase2 is the class that is responsible for effecting the core of the phase 2 -// transformation; the global function phase2() is simply an C-linkage interface. - +/// Phase2 is the class that is responsible for effecting the core of the phase +/// 2 transformation; the global function phase2() is simply an C-linkage +/// interface. +/// class Phase2 { public: @@ -108,10 +109,10 @@ InstManip* m_pIM; }; -// Phase3 is the class that is responsible for making the "phase 3" transformation; the -// global function phase3() is responsible for constructing one Phase3 instance per -// invocation and invoking transform on it. - +/// Phase3 is the class that is responsible for making the "phase 3" +/// transformation; the global function phase3() is responsible for constructing +/// one Phase3 instance per invocation and invoking transform on it. +/// class Phase3 { public: @@ -130,10 +131,10 @@ InstManip* m_pIM; }; -// Phase4 is the class that is responsible for making the "phase 4" transformation; the -// global function phase4() is responsible for constructing one Phase4 instance per -// invocation and invoking transform on it. - +/// Phase4 is the class that is responsible for making the "phase 4" +/// transformation; the global function phase4() is responsible for constructing +/// one Phase4 instance per invocation and invoking transform on it. +/// class Phase4 { public: @@ -151,12 +152,13 @@ uint64_t m_tag; // Entry to look for in the GBT }; -// InstFunctionInfo is the class used to represent information (e.g., address of return -// value, pointer-to-instrumentation function) about particular registered instrumentation -// functions. In the case of end-interval functions, the link 'm_pStart' is filled in to -// refer to the InstFunctionInfo instance that contains information about the -// corresponding start-interval function. - +/// InstFunctionInfo is the class used to represent information (e.g., address +/// of return value, pointer-to-instrumentation function) about particular +/// registered instrumentation functions. In the case of end-interval +/// functions, the link 'm_pStart' is filled in to refer to the InstFunctionInfo +/// instance that contains information about the corresponding start-interval +/// function. +/// class InstFunctionInfo { public: @@ -187,12 +189,12 @@ bool m_invoked; // Has this function been invoked yet? }; -// InstSiteInfo instances contain information about the state of particular -// instrumentation sites. More specifically, it holds the instrumentation -// status (e.g. whether or not the site has been handled by phase 4 yet) of the -// sites as well as the list of (pointers to) the InstFunctionInfo instances -// registered with a particular site. - +/// InstSiteInfo instances contain information about the state of particular +/// instrumentation sites. More specifically, it holds the instrumentation +/// status (e.g. whether or not the site has been handled by phase 4 yet) of the +/// sites as well as the list of (pointers to) the InstFunctionInfo instances +/// registered with a particular site. +/// class InstSiteInfo { public: @@ -202,19 +204,19 @@ { } - // For start-interval sites only -- allocates memory for the return value of - // the instrumentation function (size of allocated memory is retValBytes). - // Returns a pointer to the InstFunctionInfo* that corresponds to the - // instrumentation function, or null if the function has already been - // registered. - + /// For start-interval sites only -- allocates memory for the return value + /// of the instrumentation function (size of allocated memory is + /// retValBytes). Returns a pointer to the InstFunctionInfo* that + /// corresponds to the instrumentation function, or null if the function has + /// already been registered. + /// InstFunctionInfo* push_back(unsigned retValBytes, void* func); - // For end-interval sites (w/ optional link to corresponding start); other - // site types should use this routine as well. The provided retVal ptr is - // used as the return-value parameter of the instrumentation function. - + /// For end-interval sites (w/ optional link to corresponding start); other + /// site types should use this routine as well. The provided retVal ptr is + /// used as the return-value parameter of the instrumentation function. + /// void push_back(void* retVal, void* func, InstFunctionInfo* startInfo = 0); @@ -222,12 +224,12 @@ void invokeFunctions(); protected: - bool m_branchInstalled; // Installed branch to slot yet? - bool m_instrumented; // Has phase 4 instrumented site? - uint64_t m_brInstallAddr; // Address to install branch inst - unsigned m_branchInst; // The branch inst to install - std::set m_registeredFuncs; // Set of func-ptrs registered here - vector m_instFuncInfos; // Info for all registered funcs + bool m_branchInstalled; // Installed branch to slot yet? + bool m_instrumented; // Has phase 4 instrumented site? + uint64_t m_brInstallAddr; // Address to install branch inst + unsigned m_branchInst; // The branch inst to install + std::set m_registeredFuncs; // Set of func-ptrs registered here + vector m_instFuncInfos; // Info for all registered funcs friend void Phase4::transform(); @@ -247,18 +249,18 @@ } }; -// InstInfo is the class that holds data about the instrumentation that gets -// bound to instrumentation sites and intervals at runtime. There should only -// be on instance of this class (i.e., it is a singleton class). The -// implementation hides an STL map that maps the unique identifier associated -// with an instrumentation interval/site to a pair of InstSiteInfo instances, -// which contains the information about the instrumentations registered for the -// given interval or point site. In the case of intervals, the first element of -// the pair is the InstSiteInfo instance that contains data about the start -// site, whereas the second element of the pair contains data about the end -// site. For point sites, only the first element of the pair contains valid -// data. - +/// InstInfo is the class that holds data about the instrumentation that gets +/// bound to instrumentation sites and intervals at runtime. There should only +/// be on instance of this class (i.e., it is a singleton class). The +/// implementation hides an STL map that maps the unique identifier associated +/// with an instrumentation interval/site to a pair of InstSiteInfo instances, +/// which contains the information about the instrumentations registered for the +/// given interval or point site. In the case of intervals, the first element +/// of the pair is the InstSiteInfo instance that contains data about the start +/// site, whereas the second element of the pair contains data about the end +/// site. For point sites, only the first element of the pair contains valid +/// data. +/// class InstInfo { public: @@ -312,7 +314,9 @@ InstInfo* InstInfo::m_pInstance = 0; -//////////////// Phase 2 implementation //////////////// +//===----------------------------------------------------------------------===// +// Phase 2 Implementation +//===----------------------------------------------------------------------===// extern "C" void phase2() { @@ -381,7 +385,7 @@ vm->writeInstToVM(currAddr, *i); currAddr += im->getInstWidth(); } - ::doFlush(slotBase, slotBase + im->getInstWidth() * snippet.size()); + doFlush(slotBase, slotBase + im->getInstWidth() * snippet.size()); } static uint64_t makeNewSlot(uint64_t srcAddr, @@ -408,7 +412,7 @@ // Replace instruction at srcAddr with branch to start of new slot tc->getVM()->writeInstToVM(srcAddr, branchInst); - ::doFlush(srcAddr, srcAddr + im->getInstWidth()); + doFlush(srcAddr, srcAddr + im->getInstWidth()); return slotBase; } @@ -493,24 +497,25 @@ << HEX(m_pPhase3Info->getRange().second) << "] ================\n"); - // 1. Replace the original (replaced) instruction at the proper location in the - // original code (thus effectively removing the branch to the slot created by phase 2 - // as well). + // 1. Replace the original (replaced) instruction at the proper location in + // the original code (thus effectively removing the branch to the slot + // created by phase 2 as well). m_pTC->getVM()->writeInstToVM(p3info->getReplaceAddr(), p3info->getOrigInst()); - ::doFlush(m_pPhase3Info->getReplaceAddr(), - m_pPhase3Info->getReplaceAddr() + m_pIM->getInstWidth()); + doFlush(m_pPhase3Info->getReplaceAddr(), + m_pPhase3Info->getReplaceAddr() + m_pIM->getInstWidth()); } Phase3::~Phase3() { // Deallocate the originating slot (i.e. the slot that invoked us). // - // NB: Yes, we are, in fact, deallocating a memory segment (i.e., the slot obtained by - // the TraceCache's MemoryManager instance) before returning to it. This is not a - // problem for single-threaded codes, because no threads may claim that memory and - // write to it. However, it does indeed pose a problem for multi-threaded codes. A - // modification to the general mechanism itself is required to achieve thread-safety. + // NB: Yes, we are, in fact, deallocating a memory segment (i.e., the slot + // obtained by the TraceCache's MemoryManager instance) before returning to + // it. This is not a problem for single-threaded codes, because no threads + // may claim that memory and write to it. However, it does indeed pose a + // problem for multi-threaded codes. A modification to the general + // mechanism itself is required to achieve thread-safety. uint64_t slotBase = m_pPhase3Info->getSlot(); unsigned slotSize = m_pPhase3Info->getSlotSize(); @@ -522,8 +527,8 @@ void Phase3::processCandidates(vector& candidates) { - // For each load candidate, obtain a new slot and write the phase 4 slot region - // contents into it. + // For each load candidate, obtain a new slot and write the phase 4 slot + // region contents into it. DEBUG_MSG(1, "There are " << candidates.size() << " candidates to process\n"); @@ -531,7 +536,8 @@ DEBUG_MSG(2, "Transforming " << candidates[i] << endl); unsigned slotSize = m_pIM->getSlotSize(this, candidates[i]); - // Replace load candidate instruction with a branch to the start of a new slot. + // Replace load candidate instruction with a branch to the start of a + // new slot. uint64_t slotBase = replaceInstWithBrToSlot(candidates[i].front().first, slotSize, m_pTC, m_pIM); @@ -589,11 +595,12 @@ { // Deallocate the originating slot (i.e. the slot that invoked us). // - // NB: Yes, we are, in fact, deallocating a memory segment (i.e., the slot obtained by - // the TraceCache's MemoryManager instance) before returning to it. This is not a - // problem for single-threaded codes, because no threads may claim that memory and - // write to it. However, it does indeed pose a problem for multi-threaded codes. A - // modification to the general mechanism itself is required to achieve thread-safety. + // NB: Yes, we are, in fact, deallocating a memory segment (i.e., the slot + // obtained by the TraceCache's MemoryManager instance) before returning to + // it. This is not a problem for single-threaded codes, because no threads + // may claim that memory and write to it. However, it does indeed pose a + // problem for multi-threaded codes. A modification to the general + // mechanism itself is required to achieve thread-safety. uint64_t slotBase = m_pPhase4Info->getSlot(); unsigned slotSize = m_pPhase4Info->getSlotSize(); @@ -639,8 +646,8 @@ assert(cand.getInsts().size() >= 2 && "Unexpected number of instructions in candidate"); - // Write NOPs over the original instructions that were associated with the elected - // candidate. + // Write NOPs over the original instructions that were associated with + // the elected candidate. VirtualMem* vm = m_pTC->getVM(); for(vector >::const_iterator i = cand.getInsts().begin(), @@ -681,9 +688,9 @@ } else { DEBUG_MSG(1, "does not match\n"); - // The candidate failed to get elected, so pack up and go home. Restore the - // replaced instruction (i.e. the branch that invoked this code) with the original - // instruction at that location. + // The candidate failed to get elected, so pack up and go home. Restore + // the replaced instruction (i.e. the branch that invoked this code) + // with the original instruction at that location. VirtualMem* vm = m_pPhase4Info->getTraceCache()->getVM(); vm->writeInstToVM(m_pPhase4Info->getCandidate().front().first, @@ -771,13 +778,14 @@ void InstFunctionInfo::invoke() { - // In the case of start-interval functions, the boolean m_invoked is set to true upon - // completion of the invocation. This same boolean (i.e, the one associated with the - // start-interval InstFunctionInfo instance) is cleared by the corresponding - // end-interval function invocation. This is to ensure that no end-interval - // instrumentation function is ever invoked unless its corresponding start-interval - // instrumentation function has been invoked (which implies that the start-interval - // site has been handled properly and all of the registration mechanisms). + // In the case of start-interval functions, the boolean m_invoked is set to + // true upon completion of the invocation. This same boolean (i.e, the one + // associated with the start-interval InstFunctionInfo instance) is cleared + // by the corresponding end-interval function invocation. This is to ensure + // that no end-interval instrumentation function is ever invoked unless its + // corresponding start-interval instrumentation function has been invoked + // (which implies that the start-interval site has been handled properly and + // all of the registration mechanisms). DEBUG_MSG(3, "(InstFunctionInfo::invoke) retVal address is: " << HEX(m_pRetVal) << endl); if(m_pStart) { @@ -825,3 +833,5 @@ else DEBUG_MSG(3, "WARNING: Register-start-function returned 0, which implies redundant registration"); } + +}; // end namespace llvm Index: reopt/lib/Inst/lib/SparcInstManip.cpp diff -u reopt/lib/Inst/lib/SparcInstManip.cpp:1.21 reopt/lib/Inst/lib/SparcInstManip.cpp:1.22 --- reopt/lib/Inst/lib/SparcInstManip.cpp:1.21 Fri Oct 10 13:45:30 2003 +++ reopt/lib/Inst/lib/SparcInstManip.cpp Wed Nov 19 14:49:53 2003 @@ -1,14 +1,22 @@ -//////////////// -// programmer: Joel Stanley -// date: Tue Apr 29 21:21:50 CDT 2003 -// fileid: SparcInstManip.cpp -// purpose: Implements the SparcInstManip class as described in SparcInstManip.h -// -// SparcInstManip implements behavior that constructs the contents of "slots" -- regions -// of memory allocated by a MemoryManager instance and/or off of the heap that will be -// branched to at runtime. A phase n slot is written by phase n-1, and is when executed, -// invokes the appropriate function for phase n. The notable exception is the last phase, -// which will end up invoking the proper instrumentation function. +//===- SparcInstManip.cpp - SparcInstManip class implementation -----------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 29-Apr-2003. Implements the +// SparcInstManip class as described in SparcInstManip.h. SparcInstManip +// implements behavior that constructs the contents of "slots" -- regions of +// memory allocated by a MemoryManager instance and/or off of the heap that will +// be branched to at runtime. A phase n slot is written by phase n-1, and is +// when executed, invokes the appropriate function for phase n. The notable +// exception is the last phase, which will end up invoking the proper +// instrumentation function. +// +//===----------------------------------------------------------------------===// // // Phase 3 slot: // +------------------------------------+ @@ -56,7 +64,8 @@ // | return to phase 5 jump slot | // | nop | // +-------------------------------------------------+ -// [] +// +//===----------------------------------------------------------------------===// #include "reopt/TraceCache.h" #include "reopt/VirtualMem.h" @@ -74,7 +83,10 @@ #include #include // valloc() -// These are exported due to some inline methods in SparcInstManip.h +using namespace llvm; + +/// These are exported due to some inline methods in SparcInstManip.h +/// uint64_t SparcInstManip::sm_phase4SpillRegion[SparcInstManip::SHARED_SIZE]; const unsigned SparcInstManip::BRANCH_ALWAYS_BASE = 0x10480000; const unsigned SparcInstManip::BRANCH_ALWAYS_BASE_ANNUL = 0x30480000; Index: reopt/lib/Inst/lib/SparcInstManip.h diff -u reopt/lib/Inst/lib/SparcInstManip.h:1.16 reopt/lib/Inst/lib/SparcInstManip.h:1.17 --- reopt/lib/Inst/lib/SparcInstManip.h:1.16 Fri Aug 22 12:43:40 2003 +++ reopt/lib/Inst/lib/SparcInstManip.h Wed Nov 19 14:49:53 2003 @@ -1,21 +1,28 @@ -//////////////// -// programmer: Joel Stanley -// date: Tue Apr 29 21:17:33 CDT 2003 -// fileid: SparcInstManip.h -// purpose: Provides description SparcV9-specifc InstManip class. In particular, -// SparcInstManip wraps the BinInterface/TraceCache macros and utilities. +//===- SparcInstManip.h - Wrappers for BinInterface/TraceCache --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure // +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 29-Apr-2003. Provides +// SparcV9-specific InstManip class. In particular, SparcInstManip wraps the +// BinInterface/TraceCache macros and utilities. +// +//===----------------------------------------------------------------------===// -#ifndef _INCLUDED_SPARCINSTMANIP_H -#define _INCLUDED_SPARCINSTMANIP_H +#ifndef SPARCINSTMANIP_H +#define SPARCINSTMANIP_H #include "reopt/BinInterface/sparcdis.h" #include "reopt/InstrUtils.h" // getCallInstr, getUndepJumpInstr, etc. - #include "InstManip.h" - #include +namespace llvm { + class SparcInstManip : public InstManip { public: @@ -41,7 +48,8 @@ std::vector& candidates); virtual uint64_t getStartAddr(uint64_t funcStartAddr) const; - inline unsigned getBranchAlways(uint64_t dest, uint64_t pc, bool annulHigh = true) const; + inline unsigned getBranchAlways(uint64_t dest, uint64_t pc, + bool annulHigh = true) const; inline bool isBranch(unsigned inst) const; virtual void printRange(unsigned* start, unsigned* end) const; virtual void printInst(unsigned inst) const; @@ -57,8 +65,10 @@ unsigned getPhase5HeapSize() const; - void startCode(std::vector& snippet) { m_pCurrSnippet = &snippet; } - void endCode() { m_pCurrSnippet = 0; } + void startCode(std::vector& snippet) { + m_pCurrSnippet = &snippet; + } + void endCode() { m_pCurrSnippet = 0; } void generateAddressCopy(unsigned loadInst, LogicalRegister dest, @@ -85,8 +95,10 @@ LogicalRegister dest, LogicalRegister tmp); - void generateStackStore(LogicalRegister src, unsigned stkOffset); - void generateStackLoad(LogicalRegister dest, unsigned stkOffset); + void generateStackStore(LogicalRegister src, + unsigned stkOffset); + void generateStackLoad(LogicalRegister dest, + unsigned stkOffset); void generateRestore(); void generateSave(unsigned offset = STKFRM_MIN); @@ -128,30 +140,37 @@ unsigned align = STACK_ALIGN); std::vector* m_pCurrSnippet; - GBTStackMap m_gbtStackMap; // Maps GBTElem* -> param address stack - OutputToInputRegMap m_outputToInputReg; // Maps input register -> output register + // Maps GBTElem* -> param address stack + GBTStackMap m_gbtStackMap; + // Maps input register -> output register + OutputToInputRegMap m_outputToInputReg; // Size (in number of 64-bit words) required for storing shared registers + // static const unsigned SHARED_SIZE = 7; - // The memory region into which to spill shared registers when executing a phase 4 - // slot (i.e., the slot that invokes the phase4 function, the slot written by phase 3 - // invocations). NB: One region is sufficient and we do not need stack semantics - // because only one activation of a phase 4 slot ever occurs at a given time (assuming - // single-threaded execution). - + // The memory region into which to spill shared registers when executing a + // phase 4 slot (i.e., the slot that invokes the phase4 function, the slot + // written by phase 3 invocations). NB: One region is sufficient and we do + // not need stack semantics because only one activation of a phase 4 slot + // ever occurs at a given time (assuming single-threaded execution). + // static uint64_t sm_phase4SpillRegion[SHARED_SIZE]; - // Branch-always (annul bit high) instruction base (address not filled in yet) + // Branch-always (annul bit high) instruction base (address not filled in + // yet) + // static const unsigned BRANCH_ALWAYS_BASE_ANNUL; - // Branch-always (annul bit low) instruction base (address not filled in yet) + // Branch-always (annul bit low) instruction base (address not filled in + // yet) + // static const unsigned BRANCH_ALWAYS_BASE; static const unsigned INST_WIDTH = 4; // In bytes static const unsigned NOP_INST = 0x01000000; static const unsigned BIAS = 2047; - static const unsigned STKFRM_MIN = 176; // Smallest allowable stack frm size + static const unsigned STKFRM_MIN = 176; // Smallest allowed stack frm size static const unsigned STACK_ALIGN = 16; static const unsigned SEARCH_DELTA = 20; static const unsigned WORD_WIDTH = 8; @@ -167,51 +186,58 @@ static const unsigned GEN_STKSTORE_SIZE = 1; static const unsigned GEN_STKLOAD_SIZE = 1; static const unsigned GEN_RESTORE_SIZE = 1; - static const unsigned GEN_SPL_SIZE = GEN_LOAD_SIZE + SHARED_SIZE; - static const unsigned GEN_SPL_STK_SIZE = SHARED_SIZE; - static const unsigned GEN_UNSPL_SIZE = GEN_SPL_SIZE; - static const unsigned GEN_UNSPL_STK_SIZE = GEN_SPL_STK_SIZE; - static const unsigned GEN_SPSUB_SIZE = 1; - static const unsigned GEN_SPOFFSET_SIZE = 1; - static const unsigned GEN_JMPL_SIZE = 2; - static const unsigned GEN_LDJMPL_SIZE = GEN_LOAD_SIZE + GEN_JMPL_SIZE; - static const unsigned GEN_MOV_SIZE = 1; + static const unsigned GEN_SPL_SIZE = GEN_LOAD_SIZE + SHARED_SIZE; + static const unsigned GEN_SPL_STK_SIZE = SHARED_SIZE; + static const unsigned GEN_UNSPL_SIZE = GEN_SPL_SIZE; + static const unsigned GEN_UNSPL_STK_SIZE = GEN_SPL_STK_SIZE; + static const unsigned GEN_SPSUB_SIZE = 1; + static const unsigned GEN_SPOFFSET_SIZE = 1; + static const unsigned GEN_JMPL_SIZE = 2; + static const unsigned GEN_LDJMPL_SIZE = GEN_LOAD_SIZE + GEN_JMPL_SIZE; + static const unsigned GEN_MOV_SIZE = 1; }; -unsigned SparcInstManip::getBranchAlways(uint64_t dest, uint64_t pc, bool annul) const +/// Return a branch always instruction. dest is the destination address, pc is +/// the value of the program counter when the branch instruction is executed +/// (i.e., the address of the branch instruction). NB: Only handles +/// branch-always-annul-high at the moment. +/// +unsigned SparcInstManip::getBranchAlways(uint64_t dest, uint64_t pc, + bool annul) const { - // dest is the destination address, pc is the value of the program counter when the - // branch instruction is executed (i.e., the address of the branch instruction). NB: - // Only handles branch-always-annul-high at the moment - - return getUndepJumpInstr(annul ? BRANCH_ALWAYS_BASE_ANNUL : BRANCH_ALWAYS_BASE, - dest, - pc); + return + getUndepJumpInstr(annul ? BRANCH_ALWAYS_BASE_ANNUL : BRANCH_ALWAYS_BASE, + dest, pc); } +/// Returns a call instruction. dest is the destination address to call, pc is +/// the value of the program counter when the call instruction is executed +/// (i.e., the address of the branch instruction). +/// unsigned SparcInstManip::getCallInst(uint64_t dest, uint64_t pc) const { - // dest is the destination address to call, pc is the value of the program counter - // when the call instruction is executed (i.e., the address of the branch - // instruction). - return getCallInstr(dest, pc); } +/// Returns true IFF inst is a branch instruction. +/// bool SparcInstManip::isBranch(unsigned inst) const { - return ::isBranchInstr(inst); + return isBranchInstr(inst); } +/// Determine the number of instructions required to load the address value used +/// by the load instruction into some register. +/// unsigned SparcInstManip::getGenAddressCopySize(unsigned loadInst) const { - // Determine the number of instructions required to load the address value used by the - // load instruction into some register. - - // Case 1: load is immediate-valued --> add-immediate instruction needed, size is 1 inst - // Case 2: load is register-valued --> add-registers instruction needed, size is 1 inst - + // Case 1: load is immediate-valued --> add-immediate instruction needed, + // size is 1 inst. + // Case 2: load is register-valued --> add-registers instruction needed, + // size is 1 inst. return 1; } -#endif // _INCLUDED_SPARCINSTMANIP_H +} // end namespace llvm + +#endif // SPARCINSTMANIP_H From gaeke at cs.uiuc.edu Wed Nov 19 14:51:09 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 14:51:09 2003 Subject: [llvm-commits] CVS: reopt/lib/Inst/lib/Phase1/Intraphase.h Phase1.cpp PrimInfo.cpp PrimInfo.h Message-ID: <200311192050.OAA11776@kain.cs.uiuc.edu> Changes in directory reopt/lib/Inst/lib/Phase1: Intraphase.h updated: 1.1 -> 1.2 Phase1.cpp updated: 1.29 -> 1.30 PrimInfo.cpp updated: 1.17 -> 1.18 PrimInfo.h updated: 1.11 -> 1.12 --- Log message: Cleanups: file headers, using declarations, namespacification, removing #if 0'd-out code, wrapping at 80 columns, sorting headers, not using endl, doxygenifying comments, renaming header guard macros, etc. (There is still more to do, but at least it compiles again now...) --- Diffs of the changes: (+188 -165) Index: reopt/lib/Inst/lib/Phase1/Intraphase.h diff -u reopt/lib/Inst/lib/Phase1/Intraphase.h:1.1 reopt/lib/Inst/lib/Phase1/Intraphase.h:1.2 --- reopt/lib/Inst/lib/Phase1/Intraphase.h:1.1 Tue May 13 12:29:50 2003 +++ reopt/lib/Inst/lib/Phase1/Intraphase.h Wed Nov 19 14:49:53 2003 @@ -1,15 +1,23 @@ -//////////////// -// programmer: Joel Stanley -// date: Sun May 11 00:02:14 CDT 2003 -// fileid: Intraphase.h -// purpose: Provides declarations of types that must be shared between Phase1 and the -// other (runtime) phases. +//===- Intraphase.h - Shared declarations between pp phases ---------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 11-May-2003. Provides +// declarations of types that must be shared between Phase1 and the +// other (runtime) phases. +// +//===----------------------------------------------------------------------===// -#ifndef _INCLUDED_INTRAPHASE_H -#define _INCLUDED_INTRAPHASE_H +#ifndef INTRAPHASE_H +#define INTRAPHASE_H -namespace pp -{ +namespace llvm { +namespace pp { enum GBTEntryType { GBT_COUNTER, @@ -18,6 +26,7 @@ GBT_POINT }; -}; // end namespace pp +} // end namespace pp +} // end namespace llvm -#endif // _INCLUDED_INTRAPHASE_H +#endif // INTRAPHASE_H Index: reopt/lib/Inst/lib/Phase1/Phase1.cpp diff -u reopt/lib/Inst/lib/Phase1/Phase1.cpp:1.29 reopt/lib/Inst/lib/Phase1/Phase1.cpp:1.30 --- reopt/lib/Inst/lib/Phase1/Phase1.cpp:1.29 Sat Sep 13 16:12:09 2003 +++ reopt/lib/Inst/lib/Phase1/Phase1.cpp Wed Nov 19 14:49:53 2003 @@ -1,19 +1,16 @@ -//////////////// -// programmer: Joel Stanley -// date: Sun Jan 5 11:17:21 EST 2003 -// fileid: Phase1.cpp -// purpose: Implements the first phase of the performance primitives -// transformation. +//===- Phase1.cpp - First phase of performance primitives transformation --===// +// +// The LLVM Compiler Infrastructure // -// [] - -#include -#include -#include -#include -#include -#include -#include +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 5-Jan-2003. Implements the +// first phase of the performance primitives transformation. +// +//===----------------------------------------------------------------------===// #include "llvm/Pass.h" #include "llvm/Module.h" @@ -28,15 +25,19 @@ #include "Support/STLExtras.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Target/TargetData.h" - #include "PrimInfo.h" +#include +#include +#include +#include +#include +#include +#include -using std::cerr; -using std::endl; using std::vector; -namespace pp -{ +namespace llvm { +namespace pp { static void PurgeInst(Instruction* inst) { @@ -58,11 +59,16 @@ // placeholder pairs holds: glob volatile ptr, glob temporary variable ptr typedef std::pair PlaceholderPair; - void transformSites(); // Transform all metric sites - void transformSites(Function* pointSigFun); // Transform all point sites - void transformSites(std::pair& rpair); // Transform all region-pair sites - void transformSite(CallInst* pointSigFun); // Transform single point site - void transformSite(CallInst* startCall, CallInst* endCall); // Transform single region-pair site + // Transform all metric sites + void transformSites(); + // Transform all point sites + void transformSites(Function* pointSigFun); + // Transform all region-pair sites + void transformSites(std::pair& rpair); + // Transform single point site + void transformSite(CallInst* pointSigFun); + // Transform single region-pair site + void transformSite(CallInst* startCall, CallInst* endCall); void generatePlaceholder(CallInst* ci, PlaceholderPair& placeholder); void findRegionPairs(vector >& rpairs); @@ -87,8 +93,6 @@ static const unsigned POINTCALL_ID_OPIDX = 1; }; -//////////////// Phase1 implementation //////////////// - Phase1::Phase1(): m_targetData("PerfInst Phase 1", this) { } @@ -100,16 +104,22 @@ vector params; // Signature for unsigned pp_counterPrim() - m_counterPrimFunc = m.getOrInsertFunction("pp_counterPrim", FunctionType::get(Type::UIntTy, params, false)); + m_counterPrimFunc = + m.getOrInsertFunction("pp_counterPrim", + FunctionType::get(Type::UIntTy, params, false)); // Signature for void pp_regionPair(void*,void*) params.push_back(PointerType::get(Type::SByteTy)); params.push_back(PointerType::get(Type::SByteTy)); - m_regionPairDeclFunc = m.getOrInsertFunction("pp_regionPair", FunctionType::get(Type::VoidTy, params, false)); + m_regionPairDeclFunc = + m.getOrInsertFunction("pp_regionPair", + FunctionType::get(Type::VoidTy, params, false)); // Signature for void pp_metricSpec(void*) params.pop_back(); - m_metricSpecDeclFunc = m.getOrInsertFunction("pp_metricSpec", FunctionType::get(Type::VoidTy, params, false)); + m_metricSpecDeclFunc = + m.getOrInsertFunction("pp_metricSpec", + FunctionType::get(Type::VoidTy, params, false)); // Global variable to hold the address of the inserted alloca's m_allocAddr = new GlobalVariable(PointerType::get(Type::UByteTy), false, @@ -120,10 +130,6 @@ // Invoke PrimInfo's static initializer PrimInfo::buildStructTypes(&m); - - // - //////////////// - } static Function* extractFunctionArg(Value* rpairParam) @@ -180,39 +186,41 @@ void Phase1::transformSites() { - //////////////// // Build list of region pair sigfuns vector > rpairs; vector params; // Populate with builtins - - // The new approach: pp_declareInterval{Start,End} are the only sigfuns used to - // declare an interval, instead of the interval being implicit by the given locations - // of the calls to (registered) region sigfuns. For now, we will still use the old - // code for processing the contents of 'rpairs', but the only element of rpairs will - // be the pair of interval-declaration sigfuns. TODO: Clean up this approach, and do - // the same for point-site declarations. + + // The new approach: pp_declareInterval{Start,End} are the only + // sigfuns used to declare an interval, instead of the interval + // being implicit by the given locations of the calls to + // (registered) region sigfuns. For now, we will still use the + // old code for processing the contents of 'rpairs', but the only + // element of rpairs will be the pair of interval-declaration + // sigfuns. TODO: Clean up this approach, and do the same for + // point-site declarations. params.push_back(PointerType::get(Type::DoubleTy)); params.push_back(Type::UIntTy); - //Function* intervalStartDeclFunc = m_module->getNamedFunction("pp_declareIntervalStart"); Function* intervalStartDeclFunc = m_module->getOrInsertFunction("pp_declareIntervalStart", - FunctionType::get(Type::VoidTy, params, false)); + FunctionType::get(Type::VoidTy, + params, false)); params.clear(); params.push_back(Type::UIntTy); params.push_back(PointerType::get(Type::DoubleTy)); Function* intervalEndDeclFunc = m_module->getOrInsertFunction("pp_declareIntervalEnd", - FunctionType::get(Type::VoidTy, params, false)); + FunctionType::get(Type::VoidTy, + params, false)); - rpairs.push_back(std::make_pair(intervalStartDeclFunc, intervalEndDeclFunc)); + rpairs.push_back(std::make_pair(intervalStartDeclFunc, + intervalEndDeclFunc)); - //////////////// // Build list of point metric spec sigfuns, finding ppMetricSpec will yield // user-defined instances of them. vector metricSpecs; @@ -220,7 +228,8 @@ // counter builtin params.clear(); FunctionType* ftype = FunctionType::get(Type::UIntTy, params, false); - metricSpecs.push_back(m_module->getOrInsertFunction("pp_counterPrim", ftype)); + metricSpecs.push_back(m_module->getOrInsertFunction("pp_counterPrim", + ftype)); // timestamp builtin params.clear(); @@ -230,25 +239,23 @@ // Find user-declared point sigfuns and add them to the list findMetricSpecs(metricSpecs); - //////////////// // Transform point sites - for(unsigned i = 0, e = metricSpecs.size(); i < e; ++i) transformSites(metricSpecs[i]); - //////////////// // Transform region sites - for(unsigned i = 0, e = rpairs.size(); i < e; ++i) transformSites(rpairs[i]); // Build the global bookkeeping table (GBT) contents vector gbtElems; - for(vector::iterator i = m_primInfos.begin(), e = m_primInfos.end(); i != e; ++i) + for(vector::iterator i = m_primInfos.begin(), + e = m_primInfos.end(); i != e; ++i) i->buildStructInstances(gbtElems); // Make the GBT itself, and the corresponding global variable. - ArrayType* gbtType = ArrayType::get(PrimInfo::getStructType(), gbtElems.size()); + ArrayType* gbtType = ArrayType::get(PrimInfo::getStructType(), + gbtElems.size()); ConstantArray* gbtContents = ConstantArray::get(gbtType, gbtElems); GlobalVariable* gbt = new GlobalVariable(gbtType, true, GlobalVariable::ExternalLinkage, @@ -256,15 +263,15 @@ // Record the GBT size ConstantUInt* size = ConstantUInt::get(Type::UIntTy, gbtElems.size()); - GlobalVariable* gbtSize = new GlobalVariable(Type::UIntTy, true, - GlobalVariable::ExternalLinkage, - size, "ppGBTSize", m_module); + GlobalVariable* gbtSize = + new GlobalVariable(Type::UIntTy, true, GlobalVariable::ExternalLinkage, + size, "ppGBTSize", m_module); } static void DumpUses(Value* v) { for(Value::use_iterator u = v->use_begin(), ue = v->use_end(); u != ue; ++u) - cerr << "Use is: " << *u << endl; + std::cerr << "Use is: " << *u << "\n"; } void Phase1::transformSites(Function* pointSigFun) @@ -292,8 +299,8 @@ if(startFunc->use_empty() && endFunc->use_empty()) return; - // Transform each region, where a region is defined by a call to startFunc and endFunc - // within the same scope. + // Transform each region, where a region is defined by a call to + // startFunc and endFunc within the same scope. for(Value::use_iterator u = startFunc->use_begin(), ue = startFunc->use_end(); u != ue; ++u) { @@ -305,24 +312,27 @@ CallInst* startCall = dyn_cast(*u); assert(startCall && "Use of a registered pp sigfun not in a call"); - // Find call to endpoint: The first operand of the start function is used in only - // two places: the call to the start function, and the call to the end - // function. Find the call to the end function. + // Find call to endpoint: The first operand of the start + // function is used in only two places: the call to the start + // function, and the call to the end function. Find the call + // to the end function. assert(startCall->getNumOperands() == NUM_START_OPDS && "Start-region call inst has unexpected number of operands"); Value* stOpd = startCall->getOperand(1); - assert(isa(stOpd) && "Unexpected first operand of start call"); + assert(isa(stOpd) + && "Unexpected first operand of start call"); assert(stOpd->use_size() == NUM_STOPD_USES && - "Unexpected number of uses of of start-region (\"connector\") operand"); + "Unexpected # uses of of start-region (\"connector\") operand"); CallInst* endCall; if((endCall = dyn_cast(stOpd->use_back()))) { if(endCall->getCalledFunction() != endFunc) { endCall = dyn_cast(*stOpd->use_begin()); - assert(endCall && "Use of start call's first opd in non-call inst"); + assert(endCall + && "Use of start call's first opd in non-call inst"); } } else @@ -339,20 +349,18 @@ static GlobalVariable* GetLHSGlobal(CallInst* ci) { - // Assumes ci is an "end call" with two pointer parameters, the first of which is the - // address of the global variable. - - assert(ci->getNumOperands() == 3 && isa(ci->getOperand(1)) && - "Call inst does not have expected format"); - + // Assumes ci is an "end call" with two pointer parameters, the + // first of which is the address of the global variable. + assert(ci->getNumOperands() == 3 + && isa(ci->getOperand(1)) + && "Call inst does not have expected format"); return cast(ci->getOperand(1)); } static unsigned extractUnsignedValue(CallInst* ci, unsigned nth) { - // extract the literal value of the nth actual of ci, which must be of type + // Extract the literal value of the nth actual of ci, which must be of type // unsigned. - if(ConstantUInt* ui = dyn_cast(ci->getOperand(nth))) return ui->getValue(); @@ -368,7 +376,6 @@ generatePlaceholder(endCall, endPair); // Create info about this site for later documentation - unsigned siteID = extractUnsignedValue(endCall, ENDCALL_ID_OPIDX); m_primInfos.push_back(PrimInfo(PrimInfo::REGION, siteID, startPair.first, endPair.first, m_module, @@ -385,13 +392,16 @@ // A placeholder is a "load half-word", "store byte" pair. This is done in // order to make a placeholder sequence that has a relatively small chance // of appearing in the original target code. - placeholder.first = - new GlobalVariable(Type::UShortTy, false, GlobalVariable::InternalLinkage, - Constant::getNullValue(Type::UShortTy), "gv", m_module); + new GlobalVariable(Type::UShortTy, false, + GlobalVariable::InternalLinkage, + Constant::getNullValue(Type::UShortTy), "gv", + m_module); placeholder.second = - new GlobalVariable(Type::UByteTy, false, GlobalVariable::InternalLinkage, - Constant::getNullValue(Type::UByteTy), "tmp", m_module); + new GlobalVariable(Type::UByteTy, false, + GlobalVariable::InternalLinkage, + Constant::getNullValue(Type::UByteTy), "tmp", + m_module); // Build load/store sequence buildGuardedGVRead(ci, placeholder.first, placeholder.second); @@ -403,11 +413,12 @@ PlaceholderPair php; generatePlaceholder(pointCall, php); - // Create info about this site for later documentation - - // If a call to the counter primitive, mark as counter instead of generic point. - PrimInfo::PrimType type = pointCall->getCalledFunction() == m_counterPrimFunc ? - PrimInfo::COUNTER : PrimInfo::POINT; + // Create info about this site for later documentation. + // If a call to the counter primitive, mark as counter instead of + // generic point. + PrimInfo::PrimType type = + pointCall->getCalledFunction() == m_counterPrimFunc ? + PrimInfo::COUNTER : PrimInfo::POINT; unsigned siteID = extractUnsignedValue(pointCall, POINTCALL_ID_OPIDX); m_primInfos.push_back(PrimInfo(type, siteID, php.first, m_module, @@ -421,23 +432,24 @@ GlobalVariable* newGV, GlobalVariable* newTmp) { - // Generate a small alloca and store its address to the global variable represented by - // m_allocAddr. This is so that the proper stack offset can be found at runtime by - // the later phases. - + // Generate a small alloca and store its address to the global + // variable represented by m_allocAddr. This is so that the + // proper stack offset can be found at runtime by the later + // phases. AllocaInst* ai = new AllocaInst(Type::UByteTy, 0, "marker", ci); new StoreInst(ai, m_allocAddr, ci); // tmp modification for doing experiments: remove boolean guard // and just do a straight read of the global volatile - assert(newGV->getType() == PointerType::get(Type::UShortTy) && newTmp->getType() == PointerType::get(Type::UByteTy) && "Encountered unexpected types volatile variables"); BasicBlock* gvAssignBlk = ci->getParent(); LoadInst* deref = new LoadInst(newGV, "deref", ci); - CastInst* toTmpType = new CastInst(deref, newTmp->getType()->getElementType(), "castToTmpType", ci); + CastInst* toTmpType = + new CastInst(deref, newTmp->getType()->getElementType(), "castToTmpType", + ci); new StoreInst(toTmpType, newTmp, ci); } @@ -454,3 +466,4 @@ RegisterOpt pass1("pp1", "PerfPrim Phase 1"); }; // end namespace pp +}; // end namespace llvm Index: reopt/lib/Inst/lib/Phase1/PrimInfo.cpp diff -u reopt/lib/Inst/lib/Phase1/PrimInfo.cpp:1.17 reopt/lib/Inst/lib/Phase1/PrimInfo.cpp:1.18 --- reopt/lib/Inst/lib/Phase1/PrimInfo.cpp:1.17 Sat Sep 13 16:12:09 2003 +++ reopt/lib/Inst/lib/Phase1/PrimInfo.cpp Wed Nov 19 14:49:53 2003 @@ -1,11 +1,18 @@ -//////////////// -// programmer: Joel Stanley -// date: Tue Jan 28 14:07:05 CST 2003 -// fileid: PrimInfo.cpp -// purpose: Captures information about an instance of a performance primitive "marker" -// in the code. +//===- PrimInfo.cpp - Performance primitive marker implementation ---------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 28-Jan-2003. Captures +// information about an instance of a performance primitive "marker" +// in the code. +// +//===----------------------------------------------------------------------===// -#include #include "llvm/Module.h" #include "llvm/Type.h" #include "llvm/DerivedTypes.h" @@ -14,17 +21,12 @@ #include "llvm/GlobalVariable.h" #include "llvm/Constant.h" #include "Support/VectorExtras.h" - #include "PrimInfo.h" #include "Intraphase.h" +#include -using std::cerr; -using std::endl; - -namespace pp -{ - -//////////////// PrimInfo implementation //////////////// +namespace llvm { +namespace pp { StructType* PrimInfo::sm_structType = 0; @@ -56,7 +58,8 @@ m_module(module), m_startFunc(calledFunc) { - assert(type != POINT || calledFunc && "point type --> non-null called function"); + assert(type != POINT || calledFunc + && "point type --> non-null called function"); } void PrimInfo::buildStructTypes(Module* module) @@ -66,20 +69,6 @@ assert(!init && "Expect only one invocation of this function"); init = true; - // {{{ struct PrimInfo - // { - // // Site ID for this site (one value identifies one entire interval as well) - // unsigned siteID; - // - // // Type of GBT entry type (i.e., member of enum GBTEntryType) - // unsigned gbtType; - // - // // Address of global variable corresponding to this primitive. - // unsigned short* loadVar; - // - // }; - // }}} - PointerType* uspt = PointerType::get(Type::UShortTy); sm_structType = @@ -103,25 +92,21 @@ void PrimInfo::buildStructInstances(std::vector& gbtElems) { - StructType* st = getStructType(); - - switch(m_type) { - case REGION: { - - // Create the struct for the start of the region - assert(m_startFunc->asize() == 2 && "Unexpected # args for start func"); - gbtElems.push_back(makeConstStruct(st, m_siteID, GBT_INTERVAL_START, m_globVol)); - - // Create the struct for the end of the region - assert(m_endFunc->asize() == 2 && "Unexpected # args for end func"); - gbtElems.push_back(makeConstStruct(st, m_siteID, GBT_INTERVAL_END, m_globVolEnd)); - - break; - } - - default: - assert(0 && "(BuildStructInstances) Unsupported PrimInfo type"); - } + StructType* st = getStructType(); + assert ((m_type == REGION) + && "(BuildStructInstances) Unsupported PrimInfo type"); + + // Create the struct for the start of the region + assert(m_startFunc->asize() == 2 + && "Unexpected # args for start func"); + gbtElems.push_back(makeConstStruct(st, m_siteID, + GBT_INTERVAL_START, m_globVol)); + + // Create the struct for the end of the region + assert(m_endFunc->asize() == 2 && "Unexpected # args for end func"); + gbtElems.push_back(makeConstStruct(st, m_siteID, + GBT_INTERVAL_END, m_globVolEnd)); } -}; // end namespace pp +} // end namespace pp +} // end namespace llvm Index: reopt/lib/Inst/lib/Phase1/PrimInfo.h diff -u reopt/lib/Inst/lib/Phase1/PrimInfo.h:1.11 reopt/lib/Inst/lib/Phase1/PrimInfo.h:1.12 --- reopt/lib/Inst/lib/Phase1/PrimInfo.h:1.11 Tue Jun 24 10:39:54 2003 +++ reopt/lib/Inst/lib/Phase1/PrimInfo.h Wed Nov 19 14:49:53 2003 @@ -1,8 +1,24 @@ -//////////////// -// programmer: Joel Stanley -// date: Tue Jan 28 14:12:56 CST 2003 -// fileid: PrimInfo.h -// purpose: See PrimInfo.cpp +//===- PrimInfo.h - Performance primitive marker interface ----------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 28-Jan-2003. Captures +// information about an instance of a performance primitive "marker" +// in the code. +// +//===----------------------------------------------------------------------===// + +#ifndef PRIMINFO_H +#define PRIMINFO_H + +#include + +namespace llvm { class Module; class StructType; @@ -11,10 +27,7 @@ class Function; class CastInst; -#include - -namespace pp -{ +namespace pp { class PrimInfo { @@ -63,8 +76,8 @@ private: - // For a particular primitive, we need to know its type, its specifier, and any - // supplied configuration parameters. + // For a particular primitive, we need to know its type, its + // specifier, and any supplied configuration parameters. PrimType m_type; unsigned m_siteID; @@ -77,4 +90,7 @@ static StructType* sm_structType; }; -}; // end namespace pp +} // end namespace pp +} // end namespace llvm + +#endif // PRIMINFO_H From lattner at cs.uiuc.edu Wed Nov 19 15:10:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 15:10:04 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200311192109.PAA05721@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.37 -> 1.38 --- Log message: Fine grainify namespaceification --- Diffs of the changes: (+4 -5) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.37 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.38 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.37 Tue Nov 11 16:41:33 2003 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Wed Nov 19 15:08:57 2003 @@ -26,10 +26,11 @@ #include "Support/Statistic.h" #include "Support/DynamicLinker.h" #include "Config/dlfcn.h" +using namespace llvm; -namespace llvm { - -Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized"); +namespace { + Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized"); +} ExecutionEngine::ExecutionEngine(ModuleProvider *P) : CurMod(*P->getModule()), MP(P) { @@ -391,5 +392,3 @@ if (!I->isExternal()) InitializeMemory(I->getInitializer(), GlobalAddress[I]); } - -} // End llvm namespace From criswell at cs.uiuc.edu Wed Nov 19 15:14:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Nov 19 15:14:02 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.linux.qmr expectations.sunos.qmr expectations.qmr Message-ID: <200311192113.PAA24996@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.linux.qmr added (r1.1) expectations.sunos.qmr added (r1.1) expectations.qmr (r1.8) removed --- Log message: We now support different expectations for different OS's/architectures. --- Diffs of the changes: (+12 -0) Index: llvm/test/QMTest/expectations.linux.qmr diff -c /dev/null llvm/test/QMTest/expectations.linux.qmr:1.1 *** /dev/null Wed Nov 19 15:13:37 2003 --- llvm/test/QMTest/expectations.linux.qmr Wed Nov 19 15:13:26 2003 *************** *** 0 **** --- 1,15 ---- + (cqm.test.result + Result + qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq + U_Result__contextq (cqm.test.context + Context + q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U(Regression.Transforms.PruneEH.simpletestqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhUFAILqh}h U.Regression.Transforms.CorrelatedExprs.looptestqh (h o}q (h}h}ubub.(hoq!}q"(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U2Regression.Assembler.2002-01-24-ValueRefineAbsTypeq3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-Predecessor! Problemq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-VarArgCallInfLoopq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U-Regression.C++Frontend.2003-08-28-SaveExprBugqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Transforms.Reassociate.subtestq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq_h (h o}q`(h}h}ubub.(hoqa}qb(h! hhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSu bMoveqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U>Regression.Transforms.InstCombine.2003-06-22-ConstantExprCrashqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2q{h (h o}q|(h}h}ubub.(hoq}}q~(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqh (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U-Regression.C++Frontend.2003-08-28-SaveExprBugqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Transforms.Reassociate.subtestq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq_h (h o}q`(h}h}ubub.(hoqa}qb(h! hhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSu bMoveqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U>Regression.Transforms.InstCombine.2003-06-22-ConstantExprCrashqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2q{h (h o}q|(h}h}ubub.(hoq}}q~(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqh (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U Changes in directory llvm/test: Makefile updated: 1.48 -> 1.49 --- Log message: We now support different expectations for different OS's/architectures. --- Diffs of the changes: (+14 -2) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.48 llvm/test/Makefile:1.49 --- llvm/test/Makefile:1.48 Mon Oct 27 11:46:40 2003 +++ llvm/test/Makefile Wed Nov 19 15:13:25 2003 @@ -23,6 +23,18 @@ QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest # +# Determine which expectations file we will use +# +QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.unknown.qmr +ifeq ($(OS),Linux) +QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.linux.qmr +endif + +ifeq ($(OS),SunOS) +QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.sunos.qmr +endif + +# # This is configuration information used by the test suite. In QM Test, it's # called a 'context.' # @@ -47,10 +59,10 @@ # Execute the tests # qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register - -$(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) + -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) %.t:: $(LLVM_OBJ_ROOT)/test/tmp register - -$(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) $* + -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) $* # # Create the temporary directory used by the test suite. From criswell at cs.uiuc.edu Wed Nov 19 15:15:00 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Nov 19 15:15:00 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.unknown.qmr Message-ID: <200311192114.PAA25010@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.unknown.qmr added (r1.1) --- Log message: Expectations for unknown operating systems. --- Diffs of the changes: (+6 -0) Index: llvm/test/QMTest/expectations.unknown.qmr diff -c /dev/null llvm/test/QMTest/expectations.unknown.qmr:1.1 *** /dev/null Wed Nov 19 15:14:03 2003 --- llvm/test/QMTest/expectations.unknown.qmr Wed Nov 19 15:13:53 2003 *************** *** 0 **** --- 1,15 ---- + (cqm.test.result + Result + qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq + U_Result__contextq (cqm.test.context + Context + q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U(Regression.Transforms.PruneEH.simpletestqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhUFAILqh}h U.Regression.Transforms.CorrelatedExprs.looptestqh (h o}q (h}h}ubub.(hoq!}q"(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U2Regression.Assembler.2002-01-24-ValueRefineAbsTypeq3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-Predecessor! Problemq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-VarArgCallInfLoopq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U-Regression.C++Frontend.2003-08-28-SaveExprBugqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Transforms.Reassociate.subtestq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq_h (h o}q`(h}h}ubub.(hoqa}qb(h! hhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSu bMoveqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U>Regression.Transforms.InstCombine.2003-06-22-ConstantExprCrashqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2q{h (h o}q|(h}h}ubub.(hoq}}q~(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqh (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U Changes in directory llvm/test/Regression/CFrontend: 2003-11-19-AddressOfRegister.c.tr added (r1.1) --- Log message: New testcase for PR133 --- Diffs of the changes: (+12 -0) Index: llvm/test/Regression/CFrontend/2003-11-19-AddressOfRegister.c.tr diff -c /dev/null llvm/test/Regression/CFrontend/2003-11-19-AddressOfRegister.c.tr:1.1 *** /dev/null Wed Nov 19 15:38:02 2003 --- llvm/test/Regression/CFrontend/2003-11-19-AddressOfRegister.c.tr Wed Nov 19 15:37:52 2003 *************** *** 0 **** --- 1,12 ---- + // RUN: %llvmgcc -xc %s -S -o /dev/null 2>&1 | not grep 'warning' + + struct item { + short delta[4]; + }; + + int TEST(int nt) { + register struct item *aa; + aa[nt].delta; + return 1; + } + From gaeke at cs.uiuc.edu Wed Nov 19 15:53:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 15:53:02 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/llvm-nm.cpp Message-ID: <200311192152.PAA13923@kain.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: llvm-nm.cpp updated: 1.8 -> 1.9 --- Log message: Fix PR134, by checking FileOpenable() on each input file before analyzing its type. --- Diffs of the changes: (+10 -1) Index: llvm/tools/llvm-nm/llvm-nm.cpp diff -u llvm/tools/llvm-nm/llvm-nm.cpp:1.8 llvm/tools/llvm-nm/llvm-nm.cpp:1.9 --- llvm/tools/llvm-nm/llvm-nm.cpp:1.8 Sun Nov 16 17:34:13 2003 +++ llvm/tools/llvm-nm/llvm-nm.cpp Wed Nov 19 15:52:09 2003 @@ -21,6 +21,7 @@ #include "Support/CommandLine.h" #include "Support/FileUtilities.h" #include +#include using namespace llvm; @@ -113,18 +114,26 @@ void DumpSymbolNamesFromFile (std::string &Filename) { std::string ErrorMessage; + if (!FileOpenable (Filename)) { + std::cerr << ToolName << ": " << Filename << ": " << strerror (errno) + << "\n"; + return; + } if (IsBytecode (Filename)) { Module *Result = ParseBytecodeFile(Filename, &ErrorMessage); if (Result) { DumpSymbolNamesFromModule (Result); } else { std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n"; + return; } } else if (IsArchive (Filename)) { std::vector Modules; - if (ReadArchiveFile (Filename, Modules, &ErrorMessage)) + if (ReadArchiveFile (Filename, Modules, &ErrorMessage)) { std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n"; + return; + } MultipleFiles = true; std::for_each (Modules.begin (), Modules.end (), DumpSymbolNamesFromModule); } From gaeke at cs.uiuc.edu Wed Nov 19 15:58:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 15:58:01 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/llvm-nm.cpp Message-ID: <200311192157.PAA14081@kain.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: llvm-nm.cpp updated: 1.9 -> 1.10 --- Log message: Also print an error msg. for files we cannot currently deal with. --- Diffs of the changes: (+4 -0) Index: llvm/tools/llvm-nm/llvm-nm.cpp diff -u llvm/tools/llvm-nm/llvm-nm.cpp:1.9 llvm/tools/llvm-nm/llvm-nm.cpp:1.10 --- llvm/tools/llvm-nm/llvm-nm.cpp:1.9 Wed Nov 19 15:52:09 2003 +++ llvm/tools/llvm-nm/llvm-nm.cpp Wed Nov 19 15:57:30 2003 @@ -136,6 +136,10 @@ } MultipleFiles = true; std::for_each (Modules.begin (), Modules.end (), DumpSymbolNamesFromModule); + } else { + std::cerr << ToolName << ": " << Filename << ": " + << "unrecognizable file type\n"; + return; } } From lattner at cs.uiuc.edu Wed Nov 19 16:06:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 16:06:01 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311192205.QAA12171@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.52 -> 1.53 --- Log message: bugz --- Diffs of the changes: (+21 -12) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.52 llvm/docs/ReleaseNotes.html:1.53 --- llvm/docs/ReleaseNotes.html:1.52 Tue Nov 18 19:08:24 2003 +++ llvm/docs/ReleaseNotes.html Wed Nov 19 16:05:38 2003 @@ -65,19 +65,20 @@ release implements the following new features:

          -
        1. A new LLVM profiler, similar to gprof is available
        2. +

        3. A new +LLVM profiler, similar to gprof is available
        4. + +

        5. LLVM and the C/C++ front-end now compile on Mac OSX! Mac OSX users can +now explore the LLVM optimizer with the C backend (note that LLVM requires GCC +3.3 on Mac OSX).
        6. -
        7. LLVM and the C/C++ front-end now compile on Mac OSX! Mac OSX users can now -explore the LLVM optimizer with the C backend (note that LLVM requires GCC 3.3 -on Mac OSX).
        8. - -

        9. LLVM has been
        10. LLVM has been moved into an 'llvm' C++ namespace, for easier integration with third-party code. Note that due to a bug in GDB 5.x, to debug namespacified LLVM code, -you will need to upgrade to GDB 6.
        11. - -

        +you will need to upgrade to GDB 6.

        + In this release, the following missing features were implemented:

        @@ -86,10 +87,10 @@ invoke or unwind

      • Interpreter does not support the -vaarg instruction
      • +vaarg instruction

      • llvm-nm cannot read archive -files
      • +files

        @@ -108,6 +109,11 @@

      • LLVM header files should be -Wold-style-cast clean
      • + +
      • The LLVM bytecode reader has been sped up a lot (up to 4x in some +cases).
      • +

        @@ -157,6 +163,9 @@

      • [llvmg++] Cannot use pointer to member to initialize global
      • [vmcore] Symbol table doesn't rename colliding variables during type resolution
      • [llvm-gcc] ?: operator as lvalue not implemented
      • +
      • [C/C++] Bogus warning about taking the address of 'register' variable
      • +
      • bugpoint must not pass -R to Mach-O linker
      • +

        At this time, LLVM is known to work properly with SPEC CPU 2000, the Olden @@ -459,6 +468,6 @@ Maintained By: The LLVM Team
        -Last modified: Tue Nov 18 19:06:34 CST 2003 +Last modified: Wed Nov 19 15:42:00 CST 2003 From lattner at cs.uiuc.edu Wed Nov 19 16:07:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 16:07:03 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311192206.QAA12338@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.38 -> 1.39 --- Log message: bugz --- Diffs of the changes: (+3 -1) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.38 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.39 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.38 Tue Nov 18 19:08:37 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Wed Nov 19 16:05:53 2003 @@ -222,6 +222,7 @@

      • [vmcore] Symbol table doesn't rename colliding variables during type resolution
      • +

      • bugpoint must not pass -R to Mach-O linker

      • Known problems with the C front-end

        Notes:

          @@ -523,6 +525,6 @@ Maintained By: The LLVM Team
          -Last modified: Tue Nov 18 19:06:52 CST 2003 +Last modified: Wed Nov 19 15:42:40 CST 2003 From gaeke at cs.uiuc.edu Wed Nov 19 16:17:03 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:17:03 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/llvm-nm.cpp Message-ID: <200311192215.QAA14403@kain.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: llvm-nm.cpp updated: 1.10 -> 1.11 --- Log message: Unbreak the "-" as filename hack. --- Diffs of the changes: (+3 -2) Index: llvm/tools/llvm-nm/llvm-nm.cpp diff -u llvm/tools/llvm-nm/llvm-nm.cpp:1.10 llvm/tools/llvm-nm/llvm-nm.cpp:1.11 --- llvm/tools/llvm-nm/llvm-nm.cpp:1.10 Wed Nov 19 15:57:30 2003 +++ llvm/tools/llvm-nm/llvm-nm.cpp Wed Nov 19 16:15:00 2003 @@ -114,12 +114,13 @@ void DumpSymbolNamesFromFile (std::string &Filename) { std::string ErrorMessage; - if (!FileOpenable (Filename)) { + if (Filename != "-" && !FileOpenable (Filename)) { std::cerr << ToolName << ": " << Filename << ": " << strerror (errno) << "\n"; return; } - if (IsBytecode (Filename)) { + // Note: Currently we do not support reading an archive from stdin. + if (Filename == "-" || IsBytecode (Filename)) { Module *Result = ParseBytecodeFile(Filename, &ErrorMessage); if (Result) { DumpSymbolNamesFromModule (Result); From gaeke at cs.uiuc.edu Wed Nov 19 16:52:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:52:01 2003 Subject: [llvm-commits] CVS: reopt/lib/BinInterface/LLVMTrace.cpp analyze.cpp construct.cpp emit.cpp select.cpp sparc9.cpp sparcbin.cpp sparcdis.cpp Message-ID: <200311192251.QAA18808@kain.cs.uiuc.edu> Changes in directory reopt/lib/BinInterface: LLVMTrace.cpp updated: 1.4 -> 1.5 analyze.cpp updated: 1.15 -> 1.16 construct.cpp updated: 1.10 -> 1.11 emit.cpp updated: 1.10 -> 1.11 select.cpp updated: 1.11 -> 1.12 sparc9.cpp updated: 1.8 -> 1.9 sparcbin.cpp updated: 1.14 -> 1.15 sparcdis.cpp updated: 1.17 -> 1.18 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+37 -142) Index: reopt/lib/BinInterface/LLVMTrace.cpp diff -u reopt/lib/BinInterface/LLVMTrace.cpp:1.4 reopt/lib/BinInterface/LLVMTrace.cpp:1.5 --- reopt/lib/BinInterface/LLVMTrace.cpp:1.4 Fri Aug 22 12:43:37 2003 +++ reopt/lib/BinInterface/LLVMTrace.cpp Wed Nov 19 16:51:46 2003 @@ -18,13 +18,13 @@ using std::map; using std::cerr; using std::vector; +using namespace llvm; LLVMTrace::LLVMTrace(BinInterface *b,VirtualMem *v, TraceCache *t){ bb = b; tr = t; vm = v; } - void LLVMTrace::addTrace(map &bbToCid, map &bbToSec, Index: reopt/lib/BinInterface/analyze.cpp diff -u reopt/lib/BinInterface/analyze.cpp:1.15 reopt/lib/BinInterface/analyze.cpp:1.16 --- reopt/lib/BinInterface/analyze.cpp:1.15 Fri Oct 10 13:44:43 2003 +++ reopt/lib/BinInterface/analyze.cpp Wed Nov 19 16:51:46 2003 @@ -18,17 +18,7 @@ #include #include -//***************************************************************************** -// unsigned sparc_analyzebr(unsigned instr) -// -// Analyze instructions with OP field set to OP_BRANCH -// (note not all of these instructions are branches!) -// -// -// Returns a mask stating which parameters (RS1/RS2/etc) are present -// and whether we write to CC, etc. See analyze.h -// -//***************************************************************************** +using namespace llvm; bool isFloatingPoint(unsigned instr){ if(RD_FLD(instr,INSTR_OP)==OP_2 && RD_FLD(instr, INSTR_OP3) == OP3_FPU){ @@ -83,6 +73,12 @@ return false; } +// unsigned sparc_analyzebr(unsigned instr) +// Analyze instructions with OP field set to OP_BRANCH +// (note not all of these instructions are branches!) +// Returns a mask stating which parameters (RS1/RS2/etc) are present +// and whether we write to CC, etc. See analyze.h +// unsigned sparc_analyzebr(unsigned instr) { if(RD_FLD(instr, INSTR_OP)==OP_CALL) @@ -129,13 +125,9 @@ return 0; } -//***************************************************************************** // unsigned sparc_analyze_c2(unsigned instr) -// // Analyze instructions with OP field set to OP_2 // -//***************************************************************************** - unsigned sparc_analyze_c2(unsigned instr) { switch(RD_FLD(instr, INSTR_OP3)) @@ -191,8 +183,6 @@ else return IF_RD| IF_RS1 | IF_RCC | IF_W_RD | IF_R_RS1; - - case OP3_XNORcc: case OP3_ANDNcc: case OP3_ANDcc: @@ -239,13 +229,9 @@ return 0; } -//***************************************************************************** // unsigned sparc_analyze3(unsigned instr) -// // Analyze instructions with OP field set to OP_3 // -//***************************************************************************** - unsigned sparc_analyze3(unsigned instr) { switch(RD_FLD(instr, INSTR_OP3)) @@ -303,13 +289,9 @@ return 0; } -//***************************************************************************** // unsigned sparc_analyze_full(unsigned instr) -// // Analyze general instructions. // -//***************************************************************************** - unsigned sparc_analyze_full(unsigned instr) { if (RD_FLD(instr,INSTR_OP)==OP_2) @@ -327,17 +309,13 @@ return 0; } -//***************************************************************************** // unsigned sparc_analyze(unsigned instr) -// // Certain registers namely G0 (since writes don't take) // must be ignored during dataflow analysis. Thus after // running the full analysis pass we read all parameters // that are marked as present - if the register is one of the // banned ones we pretend that field isn't read. // -//***************************************************************************** - unsigned sparc_analyze(unsigned instr) { unsigned flags = sparc_analyze_full(instr); @@ -359,15 +337,11 @@ return flags; } -//***************************************************************************** // unsigned sparc_getwrites(unsigned mask, unsigned instr) -// // Mask is the result from sparc_analyze. -// // Returns a mask describing which registers were written to // CC0 isn't in here. // -//***************************************************************************** unsigned sparc_getwrites(unsigned mask, unsigned instr) { if (mask & IF_W_RD) @@ -376,14 +350,10 @@ return 0; } -//***************************************************************************** // unsigned sparc_getreads(unsigned mask, unsigned instr) -// // Mask is the result from sparc_analyze. -// // Returns a mask describing which registers were read from // -//***************************************************************************** unsigned sparc_getreads (unsigned mask, unsigned instr) { unsigned m = 0; @@ -400,26 +370,18 @@ return m; } -//***************************************************************************** // unsigned sparc_getcc(unsigned mask, unsigned instr) -// // Mask is the result from sparc_analyze. -// // Returns the part of the mask strictly dealing with WCC or RCC // -//***************************************************************************** - -unsigned sparc_getcc (unsigned mask, unsigned instr) +unsigned sparc_getcc (unsigned mask, unsigned instr) { return (mask & (IF_WCC | IF_RCC)); } -//***************************************************************************** // unsigned sparc_getbrdest(unsigned instr) -// // Returns the relative offset for the branch (in instruction words) // eg 1 means 1 instruction forward. -// // Complete list of instructions that require relocation: // BPr -> D16LO/D16HI field // FBfcc -> DISP22 field (deprecated) @@ -427,8 +389,7 @@ // Bicc -> DISP22 field (deprecated) // BPcc -> DISP19 field // CALL -> DISP30 field -//***************************************************************************** - +// signed sparc_getbrdest(unsigned instr) { if (RD_FLD(instr, INSTR_OP)==OP_CALL) @@ -453,16 +414,11 @@ return 0; } -//***************************************************************************** // unsigned sparc_setbrdest(unsigned instr, signed reladdr) -// // Modifies the relative destination of a given branch // -//***************************************************************************** - unsigned sparc_setbrdest(unsigned instr, signed reladdr) { - if (RD_FLD(instr,INSTR_OP)==OP_CALL) return MK_FLD(INSTR_OP, OP_CALL) | MK_FLD(INSTR_DISP30, unsigned(reladdr) & 0x3FFFFFFF); Index: reopt/lib/BinInterface/construct.cpp diff -u reopt/lib/BinInterface/construct.cpp:1.10 reopt/lib/BinInterface/construct.cpp:1.11 --- reopt/lib/BinInterface/construct.cpp:1.10 Fri Oct 10 13:44:27 2003 +++ reopt/lib/BinInterface/construct.cpp Wed Nov 19 16:51:46 2003 @@ -18,6 +18,7 @@ using std::pair; // use STL pair class using std::vector; +using namespace llvm; //for every liveout, create a livein node //this makes sure a PHI node is created for every such node Index: reopt/lib/BinInterface/emit.cpp diff -u reopt/lib/BinInterface/emit.cpp:1.10 reopt/lib/BinInterface/emit.cpp:1.11 --- reopt/lib/BinInterface/emit.cpp:1.10 Fri Oct 10 13:44:27 2003 +++ reopt/lib/BinInterface/emit.cpp Wed Nov 19 16:51:46 2003 @@ -16,6 +16,7 @@ using std::pair; using std::vector; +using namespace llvm; //***************************************************************************** // prepare_exit(regalloc & regalloc, Index: reopt/lib/BinInterface/select.cpp diff -u reopt/lib/BinInterface/select.cpp:1.11 reopt/lib/BinInterface/select.cpp:1.12 --- reopt/lib/BinInterface/select.cpp:1.11 Fri Oct 10 13:44:55 2003 +++ reopt/lib/BinInterface/select.cpp Wed Nov 19 16:51:46 2003 @@ -16,6 +16,7 @@ #include using std::vector; +using namespace llvm; //***************************************************************************** // select(regalloc & regs) Index: reopt/lib/BinInterface/sparc9.cpp diff -u reopt/lib/BinInterface/sparc9.cpp:1.8 reopt/lib/BinInterface/sparc9.cpp:1.9 --- reopt/lib/BinInterface/sparc9.cpp:1.8 Fri Aug 22 12:43:38 2003 +++ reopt/lib/BinInterface/sparc9.cpp Wed Nov 19 16:51:47 2003 @@ -6,6 +6,8 @@ #include "reopt/BinInterface/sparc9.h" +namespace llvm { + const char * cc_names[] = { "fcc0", "fcc1", "fcc2", "fcc3", "icc", "c101", "xcc", "c111"}; @@ -29,3 +31,4 @@ "O7", "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7", "I0", "I1", "I2", "I3", "I4", "I5", "I6(FP)", "I7"}; +} // end namespace llvm Index: reopt/lib/BinInterface/sparcbin.cpp diff -u reopt/lib/BinInterface/sparcbin.cpp:1.14 reopt/lib/BinInterface/sparcbin.cpp:1.15 --- reopt/lib/BinInterface/sparcbin.cpp:1.14 Fri Oct 10 13:44:55 2003 +++ reopt/lib/BinInterface/sparcbin.cpp Wed Nov 19 16:51:47 2003 @@ -20,35 +20,27 @@ #include using std::vector; +using namespace llvm; -//***************************************************************************** // liveout(unsigned instr) -// // Marks an instruction liveout. Can only be called AFTER // complete() and before reduce(). // Only values marked liveout will be in the original/correct // register by end of epilog! // -//***************************************************************************** void BinInterface::liveout(unsigned instr){ itable[instr]->flags |= IF_LIVEOUT; } - -//***************************************************************************** // emit(unsigned char * out) -// // Do register selection and emit the code // The user supplies the buffer // (user knows "max" size through a call to predict) // -//***************************************************************************** - unsigned BinInterface::emit(unsigned char * out){ // This structure receives the register allocation // and spill register information to be passed // on to the emitter. - // regalloc regs; // Fill structure @@ -58,26 +50,17 @@ return emit_gen(out, regs); } -//***************************************************************************** // predict() -// // This function will correctly guess the largest size // the buffer needs to be. // -//***************************************************************************** - unsigned BinInterface::predict(){ return (4 * itable.size() + 32*4) * sizeof(unsigned); } - -//***************************************************************************** // allocphi() -// // Allocate a PHI node from the user heap and link it in. // -//***************************************************************************** - instruction * BinInterface::allocphi(){ instruction * phi = new instruction(); phi->flags = IF_PHI; @@ -88,21 +71,16 @@ return phi; } -//***************************************************************************** // process_branch( -// // brdest[section] - the original address of the first instruction // in that section // scns - number of sections // insertion i - the queued insertion command, contains the list // of instructions -// // This function inserts the insertion into partial SSA instructions // the only SSA fields that will be valid after this are the branch // destinations // -//***************************************************************************** - void BinInterface::process_branch(const insertion & i, unsigned ** brdest, int scns){ unsigned cid = i.idstart; @@ -194,15 +172,11 @@ } } -//***************************************************************************** // complete() -// // Since insertions into sections are queued (for branch resolution) // this function is responsible for emptying the queues and inserting // the instructions // -//***************************************************************************** - void BinInterface::complete(){ unsigned int p; assert(sections.size() <= MAX_SECTIONS); @@ -233,16 +207,11 @@ epToRetAddr.clear(); } -//***************************************************************************** // print(unsigned section) -// // For debug purposes only. Prints out a *SINGLE* section and its // instructions in SSA form. Shows livein/liveout nodes as well -// // (must be called after reduce) // -//***************************************************************************** - void BinInterface::print(unsigned section){ unsigned u = begin(section); @@ -295,13 +264,9 @@ } } -//***************************************************************************** // print() -// // Prints all sections in SSA form // -//***************************************************************************** - void BinInterface::print(){ for (unsigned int p = 0; p< sections.size(); p++){ printf("Section %d\n",p); @@ -309,30 +274,19 @@ } } - -//***************************************************************************** // newepilog() -// // Allocates a new epilog node and returns the instruction ID // -//***************************************************************************** - - unsigned BinInterface::newepilog(){ unsigned v = sections.size(); push_section(); return v; } - -//***************************************************************************** // insert_instr(unsigned instr_id, instruction *instr) -// // Links instr into the linked list of instruction AFTER instr_id. // instr->self must have been previously initialized // -//***************************************************************************** - void BinInterface::insert_instr(unsigned instr_id, instruction * instr){ unsigned a = instr_id; unsigned c = itable[a]->next; @@ -345,6 +299,7 @@ } //remove an instruction cid +// void BinInterface::remove(unsigned cid){ instruction *instr = itable[cid]; @@ -362,6 +317,7 @@ } //Move an instruction to after another instr +// void BinInterface::move_instr(unsigned instr_id, unsigned after_this){ instruction *instr = itable[instr_id]; //make sure it is not the ONLY instruction @@ -380,6 +336,7 @@ } //Move an instruction before another instr +// void BinInterface::move_instr_before(unsigned instr_id, unsigned before_this){ instruction *instr = itable[instr_id]; //make sure it is not the ONLY instruction @@ -399,17 +356,15 @@ //Move an instruction to end the end of a section +// void BinInterface::moveToEnd(unsigned instr_id, unsigned section){ unsigned after_this = itable[end(section)]->prev; move_instr(instr_id, after_this); } -//***************************************************************************** // push_section() -// // Adds a new section. Initialized empty. // -//***************************************************************************** void BinInterface::push_section(){ // create header node instruction * instr = new instruction(); @@ -421,26 +376,20 @@ itable.push_back(instr); } -//***************************************************************************** // BinInterface(unsigned heapsize) // This constructor is used if code is to be read from, and is output into // a buffer in the data region // -//***************************************************************************** - BinInterface::BinInterface(unsigned heapsize){ // create prolog and trace link nodes push_section(); push_section(); } -//***************************************************************************** // BinInterface(unsigned heapsize) // This constructor must be used if BinInterface // must read and write into code region of executing program // -//***************************************************************************** - BinInterface::BinInterface(unsigned heapsize, VirtualMem *vmem, TraceCache *trc){ // create prolog and trace link nodes @@ -451,14 +400,10 @@ tr = trc; } -//***************************************************************************** // allocnodelivein(int s, int reg) -// // Allocates a livein node and links it into the start of section 's'. // the node is livein for given register. Instruction ID Is returned // -//***************************************************************************** - unsigned BinInterface::allocnodelivein(unsigned int s, unsigned int reg){ //check if livein doesn't already exist for this reg for(vector::iterator VI = livein.begin(), VE = livein.end(); @@ -477,16 +422,12 @@ return idx; } -//***************************************************************************** // allocnodeshuffles(int s, fvector * shuffles) -// // Allocates a shuffle node and links it into the start of section 's'. // The shuffle node arranges for a set of SSA values to be in specific // registers (used for liveout). Shuffles is a list of pairs of // registers/instruction IDs. // -//***************************************************************************** - unsigned BinInterface::allocnodeshuffles(int s, vector * shuffles){ int idx = itable.size(); @@ -500,16 +441,11 @@ return idx; } -//***************************************************************************** // insert(unsigned section, unsigned *ibegin, unsigned *iend) -// // Queues an contiguous series of instructions for insertion upon // completion of the complete() function -// // NOTE: just like iterations iend is the first address NOT to insert. // -//***************************************************************************** - unsigned BinInterface::insert(unsigned section, unsigned *ibegin, unsigned * iend){ // you're not allowed to have machine instructions @@ -530,14 +466,10 @@ return i.idstart; } -//***************************************************************************** // clear() -// // Reset the state of the binary interface so that we may compile a new // trace (Very fast) // -//***************************************************************************** - void BinInterface::clear(){ itable.clear(); sections.clear(); @@ -549,20 +481,17 @@ push_section(); } -//***************************************************************************** // ~BinInterface() -// // The only memory that we don't manage in our allocator is the heap block // itself. Thus the only object that needs destroyed // -//***************************************************************************** - BinInterface::~BinInterface() { //TODO } // Move instruction id to just after after_this +// void BinInterface::move(unsigned id, unsigned after_this){ instruction *instr = itable[id]; insert_instr(after_this, instr); @@ -575,9 +504,10 @@ //INSTR_OP3 or INSTR_OP2: corresponding OPCODE //INSTR_I = 0 (no immediate) //Do not set rs1 or rs2, or the correspoding flags - +// //We don't have to read RD_W because it'll get set automatically //in select(). +// unsigned BinInterface::newalu(unsigned op, unsigned rs1, unsigned rs2){ instruction *instr = new instruction(); //do not set the flags IF_R_RSx, and instead assign SSA values to @@ -624,8 +554,8 @@ return cid; } - //Create a NOP +// unsigned BinInterface::newnop(){ instruction *instr = new instruction(); instr->flags = (IF_ALUOP); @@ -641,6 +571,7 @@ // New relative branch, destination is a section ID (returns // branch instruction ID) //rs1 is SSAid of register value on which branch condition is determined +// unsigned BinInterface::newbranch(unsigned op, unsigned rs1, unsigned dest){ instruction *instr = new instruction(); @@ -660,6 +591,7 @@ // New relative branch, destination is a section ID (returns // branch instruction ID) // NO rs1 +// unsigned BinInterface::newbranch(unsigned op, unsigned dest){ instruction *instr = new instruction(); @@ -677,6 +609,7 @@ // New relative branch, destination is a absolute address (returns // branch instruction ID) // rs1 is SSAid of register value on which branch condition is determined +// unsigned BinInterface::newabsbranch(unsigned op, unsigned rs1, unsigned *dest){ instruction *instr = new instruction(); @@ -695,6 +628,7 @@ // New relative branch, destination is a section ID (returns // branch instruction ID) // NO rs1 +// unsigned BinInterface::newabsbranch(unsigned op, unsigned *dest){ instruction *instr = new instruction(); @@ -709,10 +643,9 @@ return cid; } - - //set the branch as internal //dest is the desctination section +// void BinInterface::setBranchAsInternal(unsigned cid, unsigned dest){ instruction *instr = itable[cid]; assert(instr->flags & IF_BR && "Not a branch\n"); @@ -720,8 +653,8 @@ instr->ibranch.dest = dest; } - //reverse the branch condition +// void BinInterface::reverseBranch(unsigned cid){ instruction *instr = itable[cid]; assert(instr->flags & IF_BR && "Not a branch\n"); @@ -730,6 +663,7 @@ //change the branch destination //should be called ONLY AFTER complete() +// void BinInterface::setBranchDest(unsigned cid, unsigned int *dest){ instruction *instr = itable[cid]; assert(instr->flags & IF_BR && "Not a branch\n"); @@ -738,6 +672,7 @@ } //assign return addr to epilog +// void BinInterface::assignRetAdress(unsigned int sec, unsigned int *addr){ assert(sec > 1 && "Not a trace section or a prolog"); epToRetAddr[sec] = addr; @@ -748,6 +683,7 @@ //for a given instruction is preserved: the instruction //pinned down writes into the same register it originally wrote into //however, the incoming registers might still be changed +// void BinInterface::pinDown(unsigned int pin){ if(itable[pin]->flags & IF_W_RD) pinned.push_back(pin); Index: reopt/lib/BinInterface/sparcdis.cpp diff -u reopt/lib/BinInterface/sparcdis.cpp:1.17 reopt/lib/BinInterface/sparcdis.cpp:1.18 --- reopt/lib/BinInterface/sparcdis.cpp:1.17 Fri Oct 10 13:44:43 2003 +++ reopt/lib/BinInterface/sparcdis.cpp Wed Nov 19 16:51:47 2003 @@ -24,6 +24,8 @@ #include #include +using namespace llvm; + void sparc_printop_rs1(unsigned instr, int labelrs1) { if (labelrs1) @@ -270,7 +272,6 @@ return; } - case OP3_ADD: sparc_printalu("ADD", instr, labels, labelrs1, labelrs2, labelrd, labelccf); @@ -563,6 +564,7 @@ printf("+%d", SIGN_EXTEND13(RD_FLD(instr, INSTR_SIMM13))); } } + void sparc_print3(unsigned instr, bool labels, int labelrs1, int labelrs2, int labelrd, int labelccf) { @@ -699,8 +701,6 @@ assert(0); } - - void sparc_print_pseudo(unsigned instr, int labelrs1, int labelrs2, int labelrd, int labelccf) { if (RD_FLD(instr,INSTR_OP)==OP_CALL) @@ -724,6 +724,3 @@ else if (RD_FLD(instr,INSTR_OP)==OP_3) sparc_print3(instr,false,0, 0, 0, 0 ); } - - - From gaeke at cs.uiuc.edu Wed Nov 19 16:52:07 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:52:07 2003 Subject: [llvm-commits] CVS: reopt/include/reopt/Inst/ElfReader.h Message-ID: <200311192251.QAA18787@kain.cs.uiuc.edu> Changes in directory reopt/include/reopt/Inst: ElfReader.h updated: 1.9 -> 1.10 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+31 -14) Index: reopt/include/reopt/Inst/ElfReader.h diff -u reopt/include/reopt/Inst/ElfReader.h:1.9 reopt/include/reopt/Inst/ElfReader.h:1.10 --- reopt/include/reopt/Inst/ElfReader.h:1.9 Mon Sep 15 00:28:00 2003 +++ reopt/include/reopt/Inst/ElfReader.h Wed Nov 19 16:51:45 2003 @@ -1,18 +1,30 @@ -//////////////// -// programmer: Joel Stanley -// date: Fri Mar 21 16:11:07 CST 2003 -// fileid: ElfReader.h -// purpose: Clients may provide a filename to the constructor (must be either an ELF -// object file or an archive of ELF object files) and make subsequent calls to -// findNextSymbol() to iterate over ELF symbol table contents. -// [] +//===- ElfReader.h - ELF object file reader interface -----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Originally written by Joel Stanley on 21-Mar-2003. Interface to ELF +// object file reader in lib/Inst. Clients may provide a filename to +// the constructor (must be either an ELF object file or an archive of +// ELF object files) and make subsequent calls to findNextSymbol() to +// iterate over ELF symbol table contents. +// +//===----------------------------------------------------------------------===// -#ifndef _INCLUDED_ELFREADER_H -#define _INCLUDED_ELFREADER_H +#ifndef ELFREADER_H +#define ELFREADER_H #include "Support/DataTypes.h" +#include +#include #include +namespace llvm { + class ElfReader { public: @@ -38,13 +50,18 @@ Elf64_Ehdr* m_pElfHdr; // Current ELF header Elf64_Shdr* m_pSymHdr; // Section header of current symtable Elf_Scn* m_pSymSec; // Section descriptor for current symtable - char* m_pStrTab; // String table of symbol names for current symtable - char* m_pSecNameTab; // String table of section names for current file + // String table of symbol names for current symtable + char* m_pStrTab; + // String table of section names for current file + char* m_pSecNameTab; Elf64_Sym* m_pCurrSym; // The current symtable entry Elf64_Sym* m_pSymEnd; // The end of the current symtable - unsigned m_codeSecIdx; // Section index of code section in current object file + // Section index of code section in current object file + unsigned m_codeSecIdx; static const std::string sm_codeSegmentName; }; -#endif // _INCLUDED_ELFREADER_H +} // end namespace llvm + +#endif // ELFREADER_H From gaeke at cs.uiuc.edu Wed Nov 19 16:53:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:53:00 2003 Subject: [llvm-commits] CVS: reopt/tools/Makefile Message-ID: <200311192252.QAA18883@kain.cs.uiuc.edu> Changes in directory reopt/tools: Makefile updated: 1.2 -> 1.3 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+3 -0) Index: reopt/tools/Makefile diff -u reopt/tools/Makefile:1.2 reopt/tools/Makefile:1.3 --- reopt/tools/Makefile:1.2 Mon Sep 15 00:27:32 2003 +++ reopt/tools/Makefile Wed Nov 19 16:51:54 2003 @@ -1,6 +1,9 @@ LEVEL := .. DIRS := + +include $(LEVEL)/Makefile.config + ifeq ($(ARCH),Sparc) DIRS := $(DIRS) mkexcl endif From gaeke at cs.uiuc.edu Wed Nov 19 16:53:05 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:53:05 2003 Subject: [llvm-commits] CVS: reopt/lib/Trigger/RuntimeOptimizations.cpp Trigger.cpp TriggerAuxillary.cpp TriggerAuxillary.h Message-ID: <200311192252.QAA18876@kain.cs.uiuc.edu> Changes in directory reopt/lib/Trigger: RuntimeOptimizations.cpp updated: 1.3 -> 1.4 Trigger.cpp updated: 1.22 -> 1.23 TriggerAuxillary.cpp updated: 1.8 -> 1.9 TriggerAuxillary.h updated: 1.4 -> 1.5 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+17 -1) Index: reopt/lib/Trigger/RuntimeOptimizations.cpp diff -u reopt/lib/Trigger/RuntimeOptimizations.cpp:1.3 reopt/lib/Trigger/RuntimeOptimizations.cpp:1.4 --- reopt/lib/Trigger/RuntimeOptimizations.cpp:1.3 Fri Aug 22 12:43:43 2003 +++ reopt/lib/Trigger/RuntimeOptimizations.cpp Wed Nov 19 16:51:53 2003 @@ -15,6 +15,8 @@ #include "llvm/Function.h" #include "TriggerAuxillary.h" +namespace llvm { + //remove all Trigger instrumentation code void removeInstrumentation(Function *F, LLVMTrace <race, BinInterface &bin, unsigned int secId, unsigned int cidOffset){ @@ -114,3 +116,5 @@ //removeInstrumentation(F, ltrace, bin, totalSections, totalInstructions); } + +} // end namespace llvm Index: reopt/lib/Trigger/Trigger.cpp diff -u reopt/lib/Trigger/Trigger.cpp:1.22 reopt/lib/Trigger/Trigger.cpp:1.23 --- reopt/lib/Trigger/Trigger.cpp:1.22 Sat Sep 13 16:12:16 2003 +++ reopt/lib/Trigger/Trigger.cpp Wed Nov 19 16:51:53 2003 @@ -37,6 +37,8 @@ using std::map; using std::pair; +namespace llvm { + extern int llvm_length; extern const unsigned char LLVMBytecode[]; extern void** llvmFunctionTable[]; @@ -502,3 +504,5 @@ std::cerr<<"-----------\n"; //#endif } + +} // end namespace llvm Index: reopt/lib/Trigger/TriggerAuxillary.cpp diff -u reopt/lib/Trigger/TriggerAuxillary.cpp:1.8 reopt/lib/Trigger/TriggerAuxillary.cpp:1.9 --- reopt/lib/Trigger/TriggerAuxillary.cpp:1.8 Sat Sep 13 16:12:16 2003 +++ reopt/lib/Trigger/TriggerAuxillary.cpp Wed Nov 19 16:51:53 2003 @@ -40,6 +40,8 @@ using std::list; using std::pair; +namespace llvm { + extern int llvm_length; extern const unsigned char LLVMBytecode[]; extern void** llvmFunctionTable[]; @@ -628,3 +630,5 @@ } return false; } + +} // end namespace llvm Index: reopt/lib/Trigger/TriggerAuxillary.h diff -u reopt/lib/Trigger/TriggerAuxillary.h:1.4 reopt/lib/Trigger/TriggerAuxillary.h:1.5 --- reopt/lib/Trigger/TriggerAuxillary.h:1.4 Fri Aug 22 12:43:43 2003 +++ reopt/lib/Trigger/TriggerAuxillary.h Wed Nov 19 16:51:53 2003 @@ -13,6 +13,8 @@ #include #include +namespace llvm { + #define CONDBR 4 #define UNCOND_BR 5 #define UNROLL_FACTOR 1 //unroll ALL loops UNROLL_FACTOR times @@ -25,7 +27,7 @@ using std::vector; using std::map; - + void getBBtrace(vector &vBB, int pathNo, Function *M); void addToBinInterface(TraceCache *tr, VirtualMem *vm, @@ -76,5 +78,7 @@ bool isWellFormedLoop(vector &vBB, Function *f); bool hasCall(vector &vBB); + +} // end namespace llvm #endif From gaeke at cs.uiuc.edu Wed Nov 19 16:53:11 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:53:11 2003 Subject: [llvm-commits] CVS: reopt/lib/TraceCache/InstrUtils.cpp MemoryManager.cpp TraceCache.cpp VirtualMem.cpp Message-ID: <200311192252.QAA18863@kain.cs.uiuc.edu> Changes in directory reopt/lib/TraceCache: InstrUtils.cpp updated: 1.14 -> 1.15 MemoryManager.cpp updated: 1.12 -> 1.13 TraceCache.cpp updated: 1.18 -> 1.19 VirtualMem.cpp updated: 1.13 -> 1.14 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+16 -34) Index: reopt/lib/TraceCache/InstrUtils.cpp diff -u reopt/lib/TraceCache/InstrUtils.cpp:1.14 reopt/lib/TraceCache/InstrUtils.cpp:1.15 --- reopt/lib/TraceCache/InstrUtils.cpp:1.14 Mon Oct 20 12:36:55 2003 +++ reopt/lib/TraceCache/InstrUtils.cpp Wed Nov 19 16:51:51 2003 @@ -9,6 +9,8 @@ #include #include +namespace llvm { + uint64_t getBranchTarget(unsigned br, uint64_t pc){ if(isNonDepJump(br)) return getNonDepJmpTarget(br, pc); @@ -202,3 +204,5 @@ ((inst & 0xffffffff) == 0x81c7e008) || ((inst & 0xffffffff) == 0x81c3e008)); } + +} // end namespace llvm Index: reopt/lib/TraceCache/MemoryManager.cpp diff -u reopt/lib/TraceCache/MemoryManager.cpp:1.12 reopt/lib/TraceCache/MemoryManager.cpp:1.13 --- reopt/lib/TraceCache/MemoryManager.cpp:1.12 Mon Oct 27 13:00:29 2003 +++ reopt/lib/TraceCache/MemoryManager.cpp Wed Nov 19 16:51:51 2003 @@ -28,7 +28,7 @@ #include #include -using std::cerr; +using namespace llvm; MemoryManager::MemoryManager(){ uint64_t memAlign = (uint64_t)(intptr_t)&FirstTraceFunction; @@ -45,7 +45,6 @@ freeMemList.push_back(std::make_pair(memStart, memEnd)); } - MemoryManager::MemoryManager(unsigned int memSize){ uint64_t memAlign = (uint64_t)(intptr_t)&FirstTraceFunction; if(memAlign % 32){ @@ -74,9 +73,9 @@ freeMemList.push_back(std::make_pair(memStart, memEnd)); } - //allocate the first free memory //returns 0 if no memory can be assigned +// uint64_t MemoryManager::getMemory(int sz){ //find a pair in freeMemList whose range>sz Index: reopt/lib/TraceCache/TraceCache.cpp diff -u reopt/lib/TraceCache/TraceCache.cpp:1.18 reopt/lib/TraceCache/TraceCache.cpp:1.19 --- reopt/lib/TraceCache/TraceCache.cpp:1.18 Fri Aug 22 12:43:42 2003 +++ reopt/lib/TraceCache/TraceCache.cpp Wed Nov 19 16:51:52 2003 @@ -19,6 +19,7 @@ //#define GET_ALL_INFO using std::cerr; +using namespace llvm; TraceCache::TraceCache(int limitSize){ mm = new MemoryManager(); @@ -32,7 +33,6 @@ vm = new VirtualMem(); } - TraceCache::TraceCache(){ mm = new MemoryManager(); @@ -63,7 +63,6 @@ vm = vmem; } - TraceCache::TraceCache(void (*dfunc)(), unsigned int memSize, VirtualMem *vmem){ mm = new MemoryManager(dfunc, memSize); @@ -93,7 +92,6 @@ return 0; } - unsigned int TraceCache::getAddr(uint64_t addr){ if(hasTraceInstructions(addr)) return traceInstructions[addr][0]; @@ -118,10 +116,11 @@ //has address instrAddr in the original program //size of array is sz (number of instructions) // returns false if cannot assign space to trace - -////USING THIS +// +//USING THIS //Do the following: //1. Insert a jump at location instrAddr with target as new trace +// bool TraceCache::addTrace(uint64_t &instAddr, uint64_t &endAddr, std::vector &trace, @@ -360,7 +359,6 @@ return true; } - //#undef GET_TRACE_TIME @@ -432,6 +430,7 @@ //USING THIS //Do the following: //1. Insert a jump at location instrAddr with target as new trace +// bool TraceCache::addTrace(uint64_t instAddr, uint64_t endAddr, std::vector &trace, Index: reopt/lib/TraceCache/VirtualMem.cpp diff -u reopt/lib/TraceCache/VirtualMem.cpp:1.13 reopt/lib/TraceCache/VirtualMem.cpp:1.14 --- reopt/lib/TraceCache/VirtualMem.cpp:1.13 Sat Sep 13 16:12:14 2003 +++ reopt/lib/TraceCache/VirtualMem.cpp Wed Nov 19 16:51:52 2003 @@ -11,6 +11,8 @@ #include "reopt/GetTraceTime.h" #include +using namespace llvm; + VirtualMem::VirtualMem(){ //open file pointer char ctr[25]; @@ -52,21 +54,6 @@ return instr; } -/* -unsigned int VirtualMem::readInstrFrmVm(uint64_t frm, TraceCache *tr){ - unsigned int instr=0; - - instr = tr->getAddr(frm); - if(instr) - return instr; - - lseek(fp, frm, SEEK_SET); - - read(fp, &instr, 4); - return instr; -} -*/ - unsigned int VirtualMem::readInstrFrmVm(uint64_t frm, TraceCache *tr, TraceCache *tr2){ unsigned int instr=0; @@ -93,7 +80,7 @@ //two kinds of branches being handled for now //BIcc, and BPcc instructions //(sparcV9 manual, pg 146-150) - +// void VirtualMem::changeBranchTarget(uint64_t frm, uint64_t to){ unsigned int instr = readInstrFrmVm(frm); //std::cerr<<"Instruction at: "<<(void *)frm<<" Is:"<<(void *)instr<<"\n"; @@ -122,7 +109,6 @@ } } - uint64_t VirtualMem::getBranchTarget(const std::pair &n){ unsigned int instr = readInstrFrmVm(n.second); @@ -142,6 +128,7 @@ } //write branch inst, followed by a null inst in delay slot +// void VirtualMem::writeBranchInstruction(uint64_t location, uint64_t target){ //uint64_t instToWrite = getDepJumpInstr(0x10800000, target, location); //create branch will annul bit set @@ -152,6 +139,7 @@ #ifdef GET_TRACE_TIME //write call instruction to llvm_start_time, followed by nop +// void VirtualMem::writeCallLLVMTime(uint64_t instAddr){ unsigned int callInst = getCallInstr((uint64_t)(intptr_t)&llvm_time_start, instAddr); writeInstToVM(instAddr, callInst); @@ -161,7 +149,6 @@ void VirtualMem::setBranches(std::map &branchMap, uint64_t startAddr){ - for(std::map::iterator MI = branchMap.begin(), ME = branchMap.end(); MI != ME; ++MI){ @@ -172,16 +159,13 @@ //check if instr is a branch assert(isBranchInstr(instr) && "Not a jump instruction"); - unsigned int newInstr = getBranchInst(instr, to , frm); - writeInstToVM(frm, newInstr); } } void VirtualMem::setBranches(std::map &branchMap, uint64_t startAddr){ - //std::cerr<<"In branch map!\n"; for(std::map::iterator MI = branchMap.begin(), ME = branchMap.end(); MI != ME; ++MI){ @@ -194,16 +178,13 @@ //check if instr is a branch assert(isBranchInstr(instr) && "Not a jump instruction"); - unsigned int newInstr = getBranchInst(instr, to , frm); - writeInstToVM(frm, newInstr); } } void VirtualMem::setCalls(std::map &callMap, uint64_t startAddr){ - for(std::map::iterator MI = callMap.begin(), ME = callMap.end(); MI != ME; ++MI){ @@ -223,7 +204,6 @@ } unsigned int VirtualMem::getInvertedBranch(unsigned int br1){ - assert(isBranchInstr(br1) && "Not a branch!"); unsigned int cond = 0; From gaeke at cs.uiuc.edu Wed Nov 19 16:53:16 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:53:16 2003 Subject: [llvm-commits] CVS: reopt/lib/Mapping/getLLVMinfo.cpp Message-ID: <200311192252.QAA18850@kain.cs.uiuc.edu> Changes in directory reopt/lib/Mapping: getLLVMinfo.cpp updated: 1.22 -> 1.23 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+2 -0) Index: reopt/lib/Mapping/getLLVMinfo.cpp diff -u reopt/lib/Mapping/getLLVMinfo.cpp:1.22 reopt/lib/Mapping/getLLVMinfo.cpp:1.23 --- reopt/lib/Mapping/getLLVMinfo.cpp:1.22 Sat Nov 8 12:24:47 2003 +++ reopt/lib/Mapping/getLLVMinfo.cpp Wed Nov 19 16:51:50 2003 @@ -12,8 +12,10 @@ #include "llvm/Module.h" #include #include + using std::map; using std::vector; +using namespace llvm; // Global symbols added to the program by the opt -emitfuncs pass: extern void **llvmFunctionTable[]; From gaeke at cs.uiuc.edu Wed Nov 19 16:53:21 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:53:21 2003 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/FirstTrigger.cpp Globals.h Initialization.cpp RuntimeOptimizations.cpp SLI.cpp SLI.h SecondTrigger.cpp SecondTrigger.h Timer.cpp Trace.cpp Trace.h TraceToFunction.cpp TraceToFunction.h UnpackTraceFunction.cpp scheduler.cpp Message-ID: <200311192252.QAA18843@kain.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: FirstTrigger.cpp updated: 1.15 -> 1.16 Globals.h updated: 1.5 -> 1.6 Initialization.cpp updated: 1.10 -> 1.11 RuntimeOptimizations.cpp updated: 1.10 -> 1.11 SLI.cpp updated: 1.10 -> 1.11 SLI.h updated: 1.1 -> 1.2 SecondTrigger.cpp updated: 1.23 -> 1.24 SecondTrigger.h updated: 1.3 -> 1.4 Timer.cpp updated: 1.3 -> 1.4 Trace.cpp updated: 1.2 -> 1.3 Trace.h updated: 1.6 -> 1.7 TraceToFunction.cpp updated: 1.15 -> 1.16 TraceToFunction.h updated: 1.1 -> 1.2 UnpackTraceFunction.cpp updated: 1.21 -> 1.22 scheduler.cpp updated: 1.3 -> 1.4 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+65 -20) Index: reopt/lib/LightWtProfiling/FirstTrigger.cpp diff -u reopt/lib/LightWtProfiling/FirstTrigger.cpp:1.15 reopt/lib/LightWtProfiling/FirstTrigger.cpp:1.16 --- reopt/lib/LightWtProfiling/FirstTrigger.cpp:1.15 Sat Sep 13 16:12:11 2003 +++ reopt/lib/LightWtProfiling/FirstTrigger.cpp Wed Nov 19 16:51:48 2003 @@ -8,7 +8,6 @@ // //===----------------------------------------------------------------------===// -#include #include "GetTimer.h" #include "Globals.h" #include "SecondTrigger.h" @@ -20,6 +19,9 @@ #include "reopt/VirtualMem.h" #include "reopt/InstrUtils.h" #include "reopt/TraceCache.h" +#include + +namespace llvm { /// This is the function that performs first-level profiling. A call /// to this function from most back-edges is inserted by the InstLoops @@ -109,3 +111,5 @@ LOAD_FD_REGS(fd_reg_save); LOAD_FSR_REG(fsr_reg); } + +} // end namespace llvm Index: reopt/lib/LightWtProfiling/Globals.h diff -u reopt/lib/LightWtProfiling/Globals.h:1.5 reopt/lib/LightWtProfiling/Globals.h:1.6 --- reopt/lib/LightWtProfiling/Globals.h:1.5 Fri Aug 22 12:43:40 2003 +++ reopt/lib/LightWtProfiling/Globals.h Wed Nov 19 16:51:48 2003 @@ -16,6 +16,8 @@ #include "reopt/VirtualMem.h" #include "llvm/Module.h" +namespace llvm { + /// Threshold against which back-edge counters are compared in first-level /// instrumentation. If a back-edge's counter exceeds this threshold, we /// may generate second-level instrumentation (SLI) for the loop. @@ -69,5 +71,7 @@ /// extern const unsigned char LLVMBytecode[]; extern int llvm_length; + +} #endif // GLOBALS_H Index: reopt/lib/LightWtProfiling/Initialization.cpp diff -u reopt/lib/LightWtProfiling/Initialization.cpp:1.10 reopt/lib/LightWtProfiling/Initialization.cpp:1.11 --- reopt/lib/LightWtProfiling/Initialization.cpp:1.10 Mon Oct 27 13:00:41 2003 +++ reopt/lib/LightWtProfiling/Initialization.cpp Wed Nov 19 16:51:48 2003 @@ -14,6 +14,8 @@ #include "llvm/Bytecode/Reader.h" #include "reopt/ScratchMemory.h" +namespace llvm { + // Definitions of globals declared extern in Globals.h int32_t reopt_threshold; int32_t THRESHOLD_LEVEL_2; @@ -75,3 +77,5 @@ M = ParseBytecodeBuffer(LLVMBytecode, llvm_length, "NOFILENAME", &err); assert(M && "Module parsing failed!"); } + +} // end namespace llvm Index: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp diff -u reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.10 reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.11 --- reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.10 Mon Nov 3 01:03:30 2003 +++ reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp Wed Nov 19 16:51:48 2003 @@ -17,6 +17,8 @@ #include "llvm/Analysis/Verifier.h" #include +namespace llvm { + // From Initialization.cpp extern void initModules (); @@ -67,3 +69,5 @@ void (*p)() = EE->getPointerToFunction (TF); #endif } + +} // end namespace llvm Index: reopt/lib/LightWtProfiling/SLI.cpp diff -u reopt/lib/LightWtProfiling/SLI.cpp:1.10 reopt/lib/LightWtProfiling/SLI.cpp:1.11 --- reopt/lib/LightWtProfiling/SLI.cpp:1.10 Thu Oct 30 14:48:39 2003 +++ reopt/lib/LightWtProfiling/SLI.cpp Wed Nov 19 16:51:48 2003 @@ -18,6 +18,8 @@ #include #include +namespace llvm { + extern "C" void llvm_time_end(); extern "C" void llvm_first_trigger(); extern void initModules (); @@ -590,3 +592,5 @@ doInlining(MI->first, stack, vm); } } + +} // end namespace llvm Index: reopt/lib/LightWtProfiling/SLI.h diff -u reopt/lib/LightWtProfiling/SLI.h:1.1 reopt/lib/LightWtProfiling/SLI.h:1.2 --- reopt/lib/LightWtProfiling/SLI.h:1.1 Wed Aug 6 16:48:30 2003 +++ reopt/lib/LightWtProfiling/SLI.h Wed Nov 19 16:51:48 2003 @@ -2,8 +2,12 @@ #define SLI_H #include "Support/DataTypes.h" -class VirtualMem; +namespace llvm { + +class VirtualMem; void doInstrumentation(uint64_t addr1, uint64_t addr2, VirtualMem *vm); + +} // end namespace llvm #endif // SLI_H Index: reopt/lib/LightWtProfiling/SecondTrigger.cpp diff -u reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.23 reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.24 --- reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.23 Mon Nov 3 01:05:59 2003 +++ reopt/lib/LightWtProfiling/SecondTrigger.cpp Wed Nov 19 16:51:48 2003 @@ -24,6 +24,8 @@ #include #include +namespace llvm { + // Keeps a pointer to a map from branch histories to the number of // times we reached countPath for that particular branch history: static std::map *> pathCounter; @@ -920,3 +922,5 @@ index += 6; } + +} // end namespace llvm Index: reopt/lib/LightWtProfiling/SecondTrigger.h diff -u reopt/lib/LightWtProfiling/SecondTrigger.h:1.3 reopt/lib/LightWtProfiling/SecondTrigger.h:1.4 --- reopt/lib/LightWtProfiling/SecondTrigger.h:1.3 Thu Oct 30 23:36:09 2003 +++ reopt/lib/LightWtProfiling/SecondTrigger.h Wed Nov 19 16:51:48 2003 @@ -7,9 +7,11 @@ #ifndef SECONDTRIGGER_H #define SECONDTRIGGER_H +#include "Support/DataTypes.h" #include #include -#include "Support/DataTypes.h" + +namespace llvm { extern std::map firstTriggerAddr; @@ -29,5 +31,7 @@ uint32_t scanForBranch (const uint64_t startAddr, uint64_t &foundAddr); void countPath (); + +} // end namespace llvm #endif // SECONDTRIGGER_H Index: reopt/lib/LightWtProfiling/Timer.cpp diff -u reopt/lib/LightWtProfiling/Timer.cpp:1.3 reopt/lib/LightWtProfiling/Timer.cpp:1.4 --- reopt/lib/LightWtProfiling/Timer.cpp:1.3 Wed Sep 10 13:47:14 2003 +++ reopt/lib/LightWtProfiling/Timer.cpp Wed Nov 19 16:51:49 2003 @@ -6,6 +6,8 @@ #include #include +namespace llvm { + extern "C" void do_timer_interval(); uint64_t llvm_interval_counter; @@ -79,21 +81,10 @@ //set timer timer_settime(timer_id, 0, &timer_spec, &old_timer_spec); - - //nvec = (struct sigaction*)malloc(sizeof(struct sigaction)); - //ovec = (struct sigaction*)malloc(sizeof(struct sigaction)); - - // stuct sigvec nvec = new sigvec; - //sigvec ovec = new sigvec; + + // Set up signal handler for SIGUSR2. signal(SIGUSR2, &timer_handler); - /* - nvec->sa_handler = timer_handler; - - sigaction(SIGUSR2, nvec, ovec); - sigemptyset(&sig_usr2); - sigemptyset(&sig_old); - sigfillset(&sig_all); - sigaddset(&sig_usr2, SIGUSR2); - */ return 1; } + +} // end namespace llvm Index: reopt/lib/LightWtProfiling/Trace.cpp diff -u reopt/lib/LightWtProfiling/Trace.cpp:1.2 reopt/lib/LightWtProfiling/Trace.cpp:1.3 --- reopt/lib/LightWtProfiling/Trace.cpp:1.2 Tue Aug 19 14:23:10 2003 +++ reopt/lib/LightWtProfiling/Trace.cpp Wed Nov 19 16:51:49 2003 @@ -10,6 +10,8 @@ #include "llvm/Assembly/Writer.h" #include +using namespace llvm; + /// print - Write trace to output stream. /// void Trace::print (std::ostream &O) const { Index: reopt/lib/LightWtProfiling/Trace.h diff -u reopt/lib/LightWtProfiling/Trace.h:1.6 reopt/lib/LightWtProfiling/Trace.h:1.7 --- reopt/lib/LightWtProfiling/Trace.h:1.6 Mon Oct 13 12:59:09 2003 +++ reopt/lib/LightWtProfiling/Trace.h Wed Nov 19 16:51:49 2003 @@ -11,6 +11,8 @@ #include "llvm/Function.h" #include +namespace llvm { + class Trace { typedef std::vector BasicBlockListType; BasicBlockListType BasicBlocks; @@ -85,5 +87,7 @@ bool dominates (const BasicBlock *B1, const BasicBlock *B2, const BasicBlock *start = 0); }; + +} // end namespace llvm #endif // TRACE_H Index: reopt/lib/LightWtProfiling/TraceToFunction.cpp diff -u reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.15 reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.16 --- reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.15 Sun Nov 9 17:48:22 2003 +++ reopt/lib/LightWtProfiling/TraceToFunction.cpp Wed Nov 19 16:51:49 2003 @@ -35,6 +35,8 @@ #include "Support/Debug.h" // for DEBUG() #include +namespace llvm { + typedef std::vector TypeVector; typedef std::map ValueToIntMap; typedef std::map ValueMap; @@ -536,9 +538,10 @@ // branches. DEBUG(if (BranchInst *BrI = dyn_cast (&I)) { for (unsigned i = 0; i < BrI->getNumSuccessors (); ++i) { - assert (BrI->getSuccessor (i)->getParent () == F + BasicBlock *succ = BrI->getSuccessor (i); + assert (succ->getParent () == F && "Branch out of function missed by copyTraceToFunction"); - assert (!O2CMap[BrI->getSuccessor (i)] + assert (O2CMap.find (succ) == O2CMap.end () && "Branch's clone found as key in original-->clone map; " "no one told me today was opposite day!"); } @@ -574,3 +577,4 @@ return TTF.traceToFunction (T); } +} // end namespace llvm Index: reopt/lib/LightWtProfiling/TraceToFunction.h diff -u reopt/lib/LightWtProfiling/TraceToFunction.h:1.1 reopt/lib/LightWtProfiling/TraceToFunction.h:1.2 --- reopt/lib/LightWtProfiling/TraceToFunction.h:1.1 Mon Nov 3 00:56:37 2003 +++ reopt/lib/LightWtProfiling/TraceToFunction.h Wed Nov 19 16:51:49 2003 @@ -11,6 +11,9 @@ #include "llvm/Function.h" #include #include + +namespace llvm { + class Trace; typedef std::set LiveVariableSet; @@ -21,5 +24,7 @@ /// runTraceToFunction - Entry point for TraceToFunction transformation. /// Function *runTraceToFunction (Trace &T); + +} // end namespace llvm #endif // TRACETOFUNCTION_H Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.21 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.22 --- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.21 Sun Nov 9 17:48:50 2003 +++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Wed Nov 19 16:51:49 2003 @@ -15,6 +15,8 @@ #include "llvm/Module.h" #include "reopt/MappingInfo.h" +namespace llvm { + /// Insert the appropriate machine instruction(s) that copies the value in /// Source to the location specified by Target, at the beginning of B. Note /// that the current implementation is SPARC-specific. @@ -261,3 +263,4 @@ } } +} // end namespace llvm Index: reopt/lib/LightWtProfiling/scheduler.cpp diff -u reopt/lib/LightWtProfiling/scheduler.cpp:1.3 reopt/lib/LightWtProfiling/scheduler.cpp:1.4 --- reopt/lib/LightWtProfiling/scheduler.cpp:1.3 Wed Sep 10 15:35:55 2003 +++ reopt/lib/LightWtProfiling/scheduler.cpp Wed Nov 19 16:51:49 2003 @@ -4,6 +4,8 @@ #include "reopt/InstrUtils.h" #include +namespace llvm { + class priority_queue_entry { public: @@ -85,3 +87,5 @@ unmask_interrupt(); return 0; } + +} // end namespace llvm From gaeke at cs.uiuc.edu Wed Nov 19 16:53:26 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:53:26 2003 Subject: [llvm-commits] CVS: reopt/include/reopt/BinInterface/LLVMTrace.h analyze.h bitmath.h regmask.h sparc9.h sparcbin.h sparcdis.h sparcpriv.h Message-ID: <200311192252.QAA18919@kain.cs.uiuc.edu> Changes in directory reopt/include/reopt/BinInterface: LLVMTrace.h updated: 1.3 -> 1.4 analyze.h updated: 1.2 -> 1.3 bitmath.h updated: 1.12 -> 1.13 regmask.h updated: 1.5 -> 1.6 sparc9.h updated: 1.16 -> 1.17 sparcbin.h updated: 1.7 -> 1.8 sparcdis.h updated: 1.8 -> 1.9 sparcpriv.h updated: 1.4 -> 1.5 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+39 -17) Index: reopt/include/reopt/BinInterface/LLVMTrace.h diff -u reopt/include/reopt/BinInterface/LLVMTrace.h:1.3 reopt/include/reopt/BinInterface/LLVMTrace.h:1.4 --- reopt/include/reopt/BinInterface/LLVMTrace.h:1.3 Fri Aug 22 12:43:35 2003 +++ reopt/include/reopt/BinInterface/LLVMTrace.h Wed Nov 19 16:51:43 2003 @@ -10,13 +10,15 @@ #include #include +namespace llvm { + class BinInterface; class TraceCache; class VirtualMem; class Instruction; class BasicBlock; -class LLVMTrace{ +class LLVMTrace { private: //LLVM instr to cids std::map > InstrToCid; @@ -87,5 +89,7 @@ void moveInstrBefore(Instruction *I, unsigned int cid); }; + +} // end namespace llvm #endif // REOPT_BININTERFACE_LLVMTRACE_H Index: reopt/include/reopt/BinInterface/analyze.h diff -u reopt/include/reopt/BinInterface/analyze.h:1.2 reopt/include/reopt/BinInterface/analyze.h:1.3 --- reopt/include/reopt/BinInterface/analyze.h:1.2 Fri Aug 22 12:43:35 2003 +++ reopt/include/reopt/BinInterface/analyze.h Wed Nov 19 16:51:43 2003 @@ -15,7 +15,9 @@ #ifndef REOPT_BININTERFACE_ANALYZE_H #define REOPT_BININTERFACE_ANALYZE_H -#include "sparcpriv.h" +#include "reopt/BinInterface/sparcpriv.h" + +namespace llvm { #define IF_RS1 0x001 // Presence of RS1 field in instruction #define IF_RS2 0x002 // Presence of RS2 field in instruction @@ -34,9 +36,6 @@ #define IF_RS1_RS2_DEFINED IF_USR //for adding one ALU instruction - - - /* Important NOTE! @@ -45,7 +44,6 @@ analysis. IF_RS1, IF_RS2, and IF_RD are set independantly of whether their respective register is 0 HOWEVER the read/write flags before are turned off if their respective register is 0. - */ //check if its a floating point instruction @@ -66,5 +64,6 @@ unsigned sparc_setbrdest(unsigned instr, signed reladdr); signed sparc_getbrdest(unsigned instr); -#endif // REOPT_BININTERFACE_ANALYZE_H +} // end namespace llvm +#endif // REOPT_BININTERFACE_ANALYZE_H Index: reopt/include/reopt/BinInterface/bitmath.h diff -u reopt/include/reopt/BinInterface/bitmath.h:1.12 reopt/include/reopt/BinInterface/bitmath.h:1.13 --- reopt/include/reopt/BinInterface/bitmath.h:1.12 Fri Aug 22 12:43:35 2003 +++ reopt/include/reopt/BinInterface/bitmath.h Wed Nov 19 16:51:43 2003 @@ -18,6 +18,8 @@ #include "Support/DataTypes.h" +namespace llvm { + //********************************* // Misc functions //********************************* @@ -135,5 +137,7 @@ static unsigned HIGH22(unsigned value) { return value >> 10; } static unsigned HIGHWORD(uint64_t value) { return (unsigned) (value >> 32); } static unsigned LOWWORD(uint64_t value) { return (unsigned) value; } + +} // end namespace llvm #endif // REOPT_BININTERFACE_BITMATH_H Index: reopt/include/reopt/BinInterface/regmask.h diff -u reopt/include/reopt/BinInterface/regmask.h:1.5 reopt/include/reopt/BinInterface/regmask.h:1.6 --- reopt/include/reopt/BinInterface/regmask.h:1.5 Sat Sep 13 16:12:02 2003 +++ reopt/include/reopt/BinInterface/regmask.h Wed Nov 19 16:51:43 2003 @@ -13,12 +13,14 @@ #include #include +using std::vector; + +namespace llvm { + #define VREG_ISMEM(x) (x >= 32) #define VREG_ISREG(x) (x < 32) #define VREG_GETMEM(x) ((x-32) * 8) -using std::vector; - class regmask32 { private: @@ -159,5 +161,6 @@ } }; -#endif // REOPT_BININTERFACE_REGMASK_H +} // end namespace llvm +#endif // REOPT_BININTERFACE_REGMASK_H Index: reopt/include/reopt/BinInterface/sparc9.h diff -u reopt/include/reopt/BinInterface/sparc9.h:1.16 reopt/include/reopt/BinInterface/sparc9.h:1.17 --- reopt/include/reopt/BinInterface/sparc9.h:1.16 Fri Aug 22 12:43:36 2003 +++ reopt/include/reopt/BinInterface/sparc9.h Wed Nov 19 16:51:43 2003 @@ -7,6 +7,8 @@ #ifndef REOPT_BININTERFACE_SPARC9_H #define REOPT_BININTERFACE_SPARC9_H +namespace llvm { + //***************************************************************************** // Register Names //***************************************************************************** @@ -541,5 +543,7 @@ MK_FLD(INSTR_RS1, sreg) | \ MK_FLD(INSTR_I, 1) | \ MK_FLD(INSTR_SIMM13, imm)) + +} // end namespace llvm #endif // REOPT_BININTERFACE_SPARC9_H Index: reopt/include/reopt/BinInterface/sparcbin.h diff -u reopt/include/reopt/BinInterface/sparcbin.h:1.7 reopt/include/reopt/BinInterface/sparcbin.h:1.8 --- reopt/include/reopt/BinInterface/sparcbin.h:1.7 Sat Sep 13 16:12:02 2003 +++ reopt/include/reopt/BinInterface/sparcbin.h Wed Nov 19 16:51:44 2003 @@ -14,14 +14,16 @@ #include "reopt/VirtualMem.h" #include "reopt/TraceCache.h" #include "reopt/InstrUtils.h" -#include "analyze.h" -#include "sparcpriv.h" +#include "reopt/BinInterface/analyze.h" +#include "reopt/BinInterface/sparcpriv.h" #include #include #include using std::vector; +namespace llvm { + struct vreginfo; struct regmask; struct regmask32; @@ -29,7 +31,6 @@ struct regalloc; struct shufflepair; - static const unsigned SECTION_PROLOG =0; static const unsigned SECTION_TRACE =1; @@ -275,5 +276,8 @@ BinInterface(unsigned heapsize, VirtualMem *vmem, TraceCache *trc); ~BinInterface(); }; + +} // end namespace llvm + #endif // REOPT_BININTERFACE_SPARCBIN_H Index: reopt/include/reopt/BinInterface/sparcdis.h diff -u reopt/include/reopt/BinInterface/sparcdis.h:1.8 reopt/include/reopt/BinInterface/sparcdis.h:1.9 --- reopt/include/reopt/BinInterface/sparcdis.h:1.8 Fri Aug 22 12:43:36 2003 +++ reopt/include/reopt/BinInterface/sparcdis.h Wed Nov 19 16:51:44 2003 @@ -20,6 +20,8 @@ #ifndef REOPT_BININTERFACE_SPARCDIS_H #define REOPT_BININTERFACE_SPARCDIS_H +namespace llvm { + // Conventional Disassembly. Prints instruction (no newline) void sparc_print(unsigned instr); @@ -28,5 +30,7 @@ // gen labels for the parameter sources // instead of printing rxx for rs1, it will print l__labelrs1__ void sparc_print_pseudo(unsigned instr, int labelrs1, int labelrs2, int labelrd, int labelccf); + +} // end namespace llvm #endif // REOPT_BININTERFACE_SPARCDIS_H Index: reopt/include/reopt/BinInterface/sparcpriv.h diff -u reopt/include/reopt/BinInterface/sparcpriv.h:1.4 reopt/include/reopt/BinInterface/sparcpriv.h:1.5 --- reopt/include/reopt/BinInterface/sparcpriv.h:1.4 Fri Aug 22 12:43:36 2003 +++ reopt/include/reopt/BinInterface/sparcpriv.h Wed Nov 19 16:51:44 2003 @@ -10,6 +10,8 @@ #include using std::vector; +namespace llvm { + // // Instruction flag definitions // @@ -20,12 +22,9 @@ #define IF_BRINTERNAL (IF_USR << 6) // is this an INTERNAL branch #define IF_LIVEOUT (IF_USR << 7) // this instruction is liveout? - - // a call instruction will spill all the outgoing registers O0->O7 (R8-R15) #define R_CALLSPILLS 0x0000FF00 - // a mask of registers that if a trace // reads/writes to we IGNORE dataflow // implications (stack register and null register) @@ -44,7 +43,6 @@ int mreg; // mreg mapped to (use VREG_ISMEM/VREG_ISREG) }; - // This is the data passed back from the register allocator struct regalloc { @@ -111,5 +109,7 @@ } regshuffle; }; }; + +} // end namespace llvm #endif // REOPT_BININTERFACE_SPARCPRIV_H From gaeke at cs.uiuc.edu Wed Nov 19 16:53:32 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 16:53:32 2003 Subject: [llvm-commits] CVS: reopt/include/reopt/CFG.h GetTraceTime.h InstrUtils.h MappingInfo.h MemoryManager.h TraceCache.h VirtualMem.h Message-ID: <200311192252.QAA18900@kain.cs.uiuc.edu> Changes in directory reopt/include/reopt: CFG.h updated: 1.2 -> 1.3 GetTraceTime.h updated: 1.5 -> 1.6 InstrUtils.h updated: 1.9 -> 1.10 MappingInfo.h updated: 1.10 -> 1.11 MemoryManager.h updated: 1.5 -> 1.6 TraceCache.h updated: 1.16 -> 1.17 VirtualMem.h updated: 1.11 -> 1.12 --- Log message: Put reoptimizer code into 'llvm' namespace. Other minor cleanups. --- Diffs of the changes: (+31 -5) Index: reopt/include/reopt/CFG.h diff -u reopt/include/reopt/CFG.h:1.2 reopt/include/reopt/CFG.h:1.3 --- reopt/include/reopt/CFG.h:1.2 Fri Aug 22 12:43:33 2003 +++ reopt/include/reopt/CFG.h Wed Nov 19 16:51:41 2003 @@ -11,6 +11,8 @@ #include #include +namespace llvm { + struct CFG_Node{ uint64_t start; uint64_t end; @@ -33,5 +35,7 @@ std::set allNodes; //for efficient lookup std::vector nodes; }; + +} // end namespace llvm #endif Index: reopt/include/reopt/GetTraceTime.h diff -u reopt/include/reopt/GetTraceTime.h:1.5 reopt/include/reopt/GetTraceTime.h:1.6 --- reopt/include/reopt/GetTraceTime.h:1.5 Fri Aug 22 12:43:33 2003 +++ reopt/include/reopt/GetTraceTime.h Wed Nov 19 16:51:41 2003 @@ -10,10 +10,11 @@ #ifndef LLVM_REOPTIMIZER_TRACECACHE_GETTRACETIME_H #define LLVM_REOPTIMIZER_TRACECACHE_GETTRACETIME_H +namespace llvm { + #ifdef __sparc //#define EXIT_CHECK - //#define GET_TRACE_TIME //#define MAP_TIME //#define READER_TIME @@ -25,12 +26,13 @@ extern "C" void llvm_time_end(); #endif - #ifdef GET_TRIGGER_TIME void llvm_trigger_time_start(); void llvm_trigger_time_end(); #endif #endif + +} // end namespace llvm #endif Index: reopt/include/reopt/InstrUtils.h diff -u reopt/include/reopt/InstrUtils.h:1.9 reopt/include/reopt/InstrUtils.h:1.10 --- reopt/include/reopt/InstrUtils.h:1.9 Mon Oct 27 13:00:59 2003 +++ reopt/include/reopt/InstrUtils.h Wed Nov 19 16:51:41 2003 @@ -12,6 +12,8 @@ #include "Support/DataTypes.h" #include +namespace llvm { + #define BRANCH_ALWAYS 0x10800000 #define CALL 0x40000000 #define NOP 0x01000000 @@ -27,10 +29,9 @@ uint64_t getDepJmpTarget(unsigned int y, uint64_t oldAdd); unsigned int getDepJumpInstr(unsigned int a, uint64_t to, uint64_t pc); - bool isCallInstr(unsigned int a); uint64_t getCallTarget(unsigned int y, uint64_t oldAdd); -unsigned int getCallInstr(uint64_t to , uint64_t pc); +unsigned int getCallInstr(uint64_t to, uint64_t pc); bool isBranchAlways(unsigned int b); bool isBranchNever(unsigned int b); @@ -38,7 +39,6 @@ //BPR: (b&(2^22+2^23+2^24) == (2^22+2^23) bool isBPR(unsigned int b); uint64_t getBPRTarget(unsigned int b, uint64_t oldAdd); - unsigned int getBPRInstr(unsigned int b, uint64_t to, uint64_t frm); bool isBranchInstr(unsigned int y); @@ -50,4 +50,7 @@ bool isIndirectCall(unsigned instr); bool isReturn(unsigned int inst); + +} // end namespace llvm + #endif Index: reopt/include/reopt/MappingInfo.h diff -u reopt/include/reopt/MappingInfo.h:1.10 reopt/include/reopt/MappingInfo.h:1.11 --- reopt/include/reopt/MappingInfo.h:1.10 Sat Nov 8 12:14:13 2003 +++ reopt/include/reopt/MappingInfo.h Wed Nov 19 16:51:42 2003 @@ -12,6 +12,9 @@ #include "Support/DataTypes.h" #include + +namespace llvm { + class Instruction; class BasicBlock; class Module; @@ -56,5 +59,7 @@ /// function. /// Function *getRevFunction(Module *M, uint64_t addr); + +} // end namespace llvm #endif // REOPT_MAPPINGINFO_H Index: reopt/include/reopt/MemoryManager.h diff -u reopt/include/reopt/MemoryManager.h:1.5 reopt/include/reopt/MemoryManager.h:1.6 --- reopt/include/reopt/MemoryManager.h:1.5 Fri Aug 22 12:43:34 2003 +++ reopt/include/reopt/MemoryManager.h Wed Nov 19 16:51:42 2003 @@ -29,6 +29,8 @@ #include "Support/DataTypes.h" #include +namespace llvm { + static const int globalMemSize = 10000; class MemoryManager{ @@ -52,5 +54,7 @@ uint64_t getMemory(int sz); //return a pointer to memory of size sz void freeTraceMemory(uint64_t toRemove, int size);//size is no if instructions }; + +} // end namespace llvm #endif // REOPT_MEMORYMANAGER_H Index: reopt/include/reopt/TraceCache.h diff -u reopt/include/reopt/TraceCache.h:1.16 reopt/include/reopt/TraceCache.h:1.17 --- reopt/include/reopt/TraceCache.h:1.16 Mon Oct 27 13:01:07 2003 +++ reopt/include/reopt/TraceCache.h Wed Nov 19 16:51:42 2003 @@ -14,6 +14,8 @@ #include #include +namespace llvm { + class VirtualMem; class MemoryManager; @@ -139,5 +141,7 @@ VirtualMem *vm; MemoryManager *mm; }; + +} // end namespace llvm #endif // REOPT_TRACECACHE_H Index: reopt/include/reopt/VirtualMem.h diff -u reopt/include/reopt/VirtualMem.h:1.11 reopt/include/reopt/VirtualMem.h:1.12 --- reopt/include/reopt/VirtualMem.h:1.11 Fri Oct 10 14:12:34 2003 +++ reopt/include/reopt/VirtualMem.h Wed Nov 19 16:51:42 2003 @@ -16,6 +16,8 @@ #include #include "reopt/GetTraceTime.h" +namespace llvm { + class TraceCache; class VirtualMem { @@ -50,5 +52,7 @@ unsigned int getInvertedBranch(unsigned int br1); }; + +} // end namespace llvm #endif // REOPT_VIRTUALMEM_H From lattner at cs.uiuc.edu Wed Nov 19 18:10:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 18:10:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200311200009.SAA29899@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.111 -> 1.112 --- Log message: Don't crash if we are printing an orphaned basic block! --- Diffs of the changes: (+17 -13) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.111 llvm/lib/VMCore/AsmWriter.cpp:1.112 --- llvm/lib/VMCore/AsmWriter.cpp:1.111 Sun Nov 16 19:17:04 2003 +++ llvm/lib/VMCore/AsmWriter.cpp Wed Nov 19 18:09:43 2003 @@ -750,20 +750,24 @@ else Out << ""; } - - if (BB != &BB->getParent()->front()) { // Not the entry block? - // Output predecessors for the block... - Out << "\t\t;"; - pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB); - - if (PI == PE) { - Out << " No predecessors!"; - } else { - Out << " preds ="; - writeOperand(*PI, false, true); - for (++PI; PI != PE; ++PI) { - Out << ","; + + if (BB->getParent() == 0) + Out << "\t\t; Error: Block without parent!"; + else { + if (BB != &BB->getParent()->front()) { // Not the entry block? + // Output predecessors for the block... + Out << "\t\t;"; + pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB); + + if (PI == PE) { + Out << " No predecessors!"; + } else { + Out << " preds ="; writeOperand(*PI, false, true); + for (++PI; PI != PE; ++PI) { + Out << ","; + writeOperand(*PI, false, true); + } } } } From lattner at cs.uiuc.edu Wed Nov 19 18:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 18:34:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-11-19-BitFieldArray.c Message-ID: <200311200033.SAA06195@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-11-19-BitFieldArray.c added (r1.1) --- Log message: Testcase for PR113 --- Diffs of the changes: (+10 -0) Index: llvm/test/Regression/CFrontend/2003-11-19-BitFieldArray.c diff -c /dev/null llvm/test/Regression/CFrontend/2003-11-19-BitFieldArray.c:1.1 *** /dev/null Wed Nov 19 18:33:07 2003 --- llvm/test/Regression/CFrontend/2003-11-19-BitFieldArray.c Wed Nov 19 18:32:57 2003 *************** *** 0 **** --- 1,10 ---- + struct _GIOChannel { + int write_buf; + char partial_write_buf[6]; + int d :1; + }; + + void g_io_channel_init (struct _GIOChannel *channel) { + channel->partial_write_buf[0]; + } + From lattner at cs.uiuc.edu Wed Nov 19 18:53:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 18:53:02 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311200052.SAA11415@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.19 -> 1.20 --- Log message: Some bugs get fixed occasionally --- Diffs of the changes: (+6 -6) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.19 llvm-www/status/index.html:1.20 --- llvm-www/status/index.html:1.19 Tue Nov 18 17:39:58 2003 +++ llvm-www/status/index.html Wed Nov 19 18:51:49 2003 @@ -68,7 +68,7 @@

        - + @@ -84,8 +84,8 @@ - + @@ -105,7 +105,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -422,7 +422,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/18 23:39:58 $ + Last modified: $Date: 2003/11/20 00:51:49 $ From lattner at cs.uiuc.edu Wed Nov 19 19:05:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 19:05:00 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311200104.TAA12882@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.20 -> 1.21 --- Log message: Another bug fixed --- Diffs of the changes: (+3 -3) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.20 llvm-www/status/index.html:1.21 --- llvm-www/status/index.html:1.20 Wed Nov 19 18:51:49 2003 +++ llvm-www/status/index.html Wed Nov 19 19:04:30 2003 @@ -114,7 +114,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -422,7 +422,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 00:51:49 $ + Last modified: $Date: 2003/11/20 01:04:30 $ From lattner at cs.uiuc.edu Wed Nov 19 19:08:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 19 19:08:01 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311200107.TAA15272@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.39 -> 1.40 --- Log message: One new bug fixed, one old bug fixed. --- Diffs of the changes: (+6 -3) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.39 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.40 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.39 Wed Nov 19 16:05:53 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Wed Nov 19 19:07:47 2003 @@ -229,8 +229,6 @@ Bugs:Notes:Bugs:

          -

        • Oversized integer bitfields cause crash.

          -

        • C99 Variable sized arrays do not release stack memory when they go out of scope. Thus, the following program may run out of stack space:
          @@ -468,6 +468,6 @@
           Maintained By: The LLVM Team
          -Last modified: Wed Nov 19 15:42:00 CST 2003 +Last modified: Wed Nov 19 19:06:03 CST 2003 From brukman at cs.uiuc.edu Wed Nov 19 20:03:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Nov 19 20:03:02 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311200202.UAA26680@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.21 -> 1.22 --- Log message: Nano still works, pine failes due to a different bug now (and I think it did all along, it was my incorrect understanding of the issue). --- Diffs of the changes: (+19 -19) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.21 llvm-www/status/index.html:1.22 --- llvm-www/status/index.html:1.21 Wed Nov 19 19:04:30 2003 +++ llvm-www/status/index.html Wed Nov 19 20:01:58 2003 @@ -45,6 +45,24 @@
        + + + + + + + + + + + + + + + + @@ -133,14 +151,6 @@ - - - - - - - - @@ -348,16 +358,6 @@ - - - - - - - - @@ -422,7 +422,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 01:04:30 $ + Last modified: $Date: 2003/11/20 02:01:58 $ From brukman at cs.uiuc.edu Wed Nov 19 20:05:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Nov 19 20:05:02 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311200204.UAA31491@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.22 -> 1.23 --- Log message: Emacs still failes, but for a different reason. --- Diffs of the changes: (+11 -10) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.22 llvm-www/status/index.html:1.23 --- llvm-www/status/index.html:1.22 Wed Nov 19 20:01:58 2003 +++ llvm-www/status/index.html Wed Nov 19 20:04:25 2003 @@ -45,6 +45,16 @@ + + + + + + + + @@ -125,15 +135,6 @@ - - - - - - - - @@ -422,7 +423,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 02:01:58 $ + Last modified: $Date: 2003/11/20 02:04:25 $ From alkis at cs.uiuc.edu Wed Nov 19 21:33:01 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed Nov 19 21:33:01 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp RegAllocLinearScan.cpp Passes.cpp Message-ID: <200311200332.VAA28158@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervals.cpp updated: 1.1 -> 1.2 RegAllocLinearScan.cpp updated: 1.1 -> 1.2 Passes.cpp updated: 1.3 -> 1.4 --- Log message: Merging the linear scan register allocator in trunk. It currently passes most tests under test/Programs/SingleSource/Benchmarks/Shootout so development will continue on trunk. The allocator is not enabled by default. You will need to pass -regallo=linearscan to lli or llc to use it. --- Diffs of the changes: (+1085 -3) Index: llvm/lib/CodeGen/LiveIntervals.cpp diff -u /dev/null llvm/lib/CodeGen/LiveIntervals.cpp:1.2 --- /dev/null Wed Nov 19 21:32:36 2003 +++ llvm/lib/CodeGen/LiveIntervals.cpp Wed Nov 19 21:32:25 2003 @@ -0,0 +1,302 @@ +//===-- LiveIntervals.cpp - Live Interval Analysis ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the LiveInterval analysis pass which is used +// by the Linear Scan Register allocator. This pass linearizes the +// basic blocks of the function in DFS order and uses the +// LiveVariables pass to conservatively compute live intervals for +// each virtual and physical register. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "liveintervals" +#include "llvm/CodeGen/LiveIntervals.h" +#include "llvm/Function.h" +#include "llvm/CodeGen/LiveVariables.h" +#include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/SSARegMap.h" +#include "llvm/Target/MRegisterInfo.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetRegInfo.h" +#include "llvm/Support/CFG.h" +#include "Support/Debug.h" +#include "Support/DepthFirstIterator.h" +#include "Support/Statistic.h" +#include + +using namespace llvm; + +namespace { + RegisterAnalysis X("liveintervals", + "Live Interval Analysis"); + + Statistic<> numIntervals("liveintervals", "Number of intervals"); +}; + +void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const +{ + AU.setPreservesAll(); + AU.addRequired(); + AU.addRequiredID(PHIEliminationID); + MachineFunctionPass::getAnalysisUsage(AU); +} + +/// runOnMachineFunction - Register allocate the whole function +/// +bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) { + DEBUG(std::cerr << "Machine Function\n"); + mf_ = &fn; + tm_ = &fn.getTarget(); + mri_ = tm_->getRegisterInfo(); + lv_ = &getAnalysis(); + allocatableRegisters_.clear(); + mbbi2mbbMap_.clear(); + mi2iMap_.clear(); + r2iMap_.clear(); + r2iMap_.clear(); + intervals_.clear(); + + // mark allocatable registers + allocatableRegisters_.resize(MRegisterInfo::FirstVirtualRegister); + // Loop over all of the register classes... + for (MRegisterInfo::regclass_iterator + rci = mri_->regclass_begin(), rce = mri_->regclass_end(); + rci != rce; ++rci) { + // Loop over all of the allocatable registers in the function... + for (TargetRegisterClass::iterator + i = (*rci)->allocation_order_begin(*mf_), + e = (*rci)->allocation_order_end(*mf_); i != e; ++i) { + allocatableRegisters_[*i] = true; // The reg is allocatable! + } + } + + // number MachineInstrs + unsigned miIndex = 0; + for (MachineFunction::iterator mbb = mf_->begin(), mbbEnd = mf_->end(); + mbb != mbbEnd; ++mbb) { + const std::pair& entry = + lv_->getMachineBasicBlockInfo(&*mbb); + bool inserted = mbbi2mbbMap_.insert(std::make_pair(entry.second, + entry.first)).second; + assert(inserted && "multiple index -> MachineBasicBlock"); + + for (MachineBasicBlock::iterator mi = mbb->begin(), miEnd = mbb->end(); + mi != miEnd; ++mi) { + inserted = mi2iMap_.insert(std::make_pair(*mi, miIndex)).second; + assert(inserted && "multiple MachineInstr -> index mappings"); + ++miIndex; + } + } + + computeIntervals(); + + return true; +} + +void LiveIntervals::printRegName(unsigned reg) const +{ + if (reg < MRegisterInfo::FirstVirtualRegister) + std::cerr << mri_->getName(reg); + else + std::cerr << '%' << reg; +} + +void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb, + MachineBasicBlock::iterator mi, + unsigned reg) +{ + DEBUG(std::cerr << "\t\t\tregister: ";printRegName(reg); std::cerr << '\n'); + + unsigned instrIndex = getInstructionIndex(*mi); + + LiveVariables::VarInfo& vi = lv_->getVarInfo(reg); + + Reg2IntervalMap::iterator r2iit = r2iMap_.find(reg); + // handle multiple definition case (machine instructions violating + // ssa after phi-elimination + if (r2iit != r2iMap_.end()) { + unsigned ii = r2iit->second; + Interval& interval = intervals_[ii]; + unsigned end = getInstructionIndex(mbb->back()) + 1; + DEBUG(std::cerr << "\t\t\t\tadding range: [" + << instrIndex << ',' << end << "]\n"); + interval.addRange(instrIndex, end); + DEBUG(std::cerr << "\t\t\t\t" << interval << '\n'); + } + else { + // add new interval + intervals_.push_back(Interval(reg)); + Interval& interval = intervals_.back(); + // update interval index for this register + r2iMap_[reg] = intervals_.size() - 1; + + for (MbbIndex2MbbMap::iterator + it = mbbi2mbbMap_.begin(), itEnd = mbbi2mbbMap_.end(); + it != itEnd; ++it) { + unsigned liveBlockIndex = it->first; + MachineBasicBlock* liveBlock = it->second; + if (liveBlockIndex < vi.AliveBlocks.size() && + vi.AliveBlocks[liveBlockIndex]) { + unsigned start = getInstructionIndex(liveBlock->front()); + unsigned end = getInstructionIndex(liveBlock->back()) + 1; + DEBUG(std::cerr << "\t\t\t\tadding range: [" + << start << ',' << end << "]\n"); + interval.addRange(start, end); + } + } + + bool killedInDefiningBasicBlock = false; + for (int i = 0, e = vi.Kills.size(); i != e; ++i) { + MachineBasicBlock* killerBlock = vi.Kills[i].first; + MachineInstr* killerInstr = vi.Kills[i].second; + killedInDefiningBasicBlock |= mbb == killerBlock; + unsigned start = (mbb == killerBlock ? + instrIndex : + getInstructionIndex(killerBlock->front())); + unsigned end = getInstructionIndex(killerInstr) + 1; + DEBUG(std::cerr << "\t\t\t\tadding range: [" + << start << ',' << end << "]\n"); + interval.addRange(start, end); + } + + if (!killedInDefiningBasicBlock) { + unsigned end = getInstructionIndex(mbb->back()) + 1; + interval.addRange(instrIndex, end); + } + + DEBUG(std::cerr << "\t\t\t\t" << interval << '\n'); + } +} + +void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock* mbb, + MachineBasicBlock::iterator mi, + unsigned reg) +{ + DEBUG(std::cerr << "\t\t\tregister: ";printRegName(reg); std::cerr << '\n'); + + unsigned start = getInstructionIndex(*mi); + unsigned end = start; + + for (MachineBasicBlock::iterator e = mbb->end(); mi != e; ++mi) { + for (LiveVariables::killed_iterator + ki = lv_->dead_begin(*mi), + ke = lv_->dead_end(*mi); + ki != ke; ++ki) { + if (reg == ki->second) { + end = getInstructionIndex(ki->first) + 1; + goto exit; + } + } + + for (LiveVariables::killed_iterator + ki = lv_->killed_begin(*mi), + ke = lv_->killed_end(*mi); + ki != ke; ++ki) { + if (reg == ki->second) { + end = getInstructionIndex(ki->first) + 1; + goto exit; + } + } + } +exit: + assert(start < end && "did not find end of interval?"); + + Reg2IntervalMap::iterator r2iit = r2iMap_.find(reg); + if (r2iit != r2iMap_.end()) { + unsigned ii = r2iit->second; + Interval& interval = intervals_[ii]; + DEBUG(std::cerr << "\t\t\t\tadding range: [" + << start << ',' << end << "]\n"); + interval.addRange(start, end); + DEBUG(std::cerr << "\t\t\t\t" << interval << '\n'); + } + else { + intervals_.push_back(Interval(reg)); + Interval& interval = intervals_.back(); + // update interval index for this register + r2iMap_[reg] = intervals_.size() - 1; + DEBUG(std::cerr << "\t\t\t\tadding range: [" + << start << ',' << end << "]\n"); + interval.addRange(start, end); + DEBUG(std::cerr << "\t\t\t\t" << interval << '\n'); + } +} + +void LiveIntervals::handleRegisterDef(MachineBasicBlock* mbb, + MachineBasicBlock::iterator mi, + unsigned reg) +{ + if (reg < MRegisterInfo::FirstVirtualRegister) { + if (allocatableRegisters_[reg]) { + handlePhysicalRegisterDef(mbb, mi, reg); + } + } + else { + handleVirtualRegisterDef(mbb, mi, reg); + } +} + +unsigned LiveIntervals::getInstructionIndex(MachineInstr* instr) const +{ + assert(mi2iMap_.find(instr) != mi2iMap_.end() && + "instruction not assigned a number"); + return mi2iMap_.find(instr)->second; +} + +/// computeIntervals - computes the live intervals for virtual +/// registers. for some ordering of the machine instructions [1,N] a +/// live interval is an interval [i, j] where 1 <= i <= j <= N for +/// which a variable is live +void LiveIntervals::computeIntervals() +{ + DEBUG(std::cerr << "computing live intervals:\n"); + + for (MbbIndex2MbbMap::iterator + it = mbbi2mbbMap_.begin(), itEnd = mbbi2mbbMap_.end(); + it != itEnd; ++it) { + MachineBasicBlock* mbb = it->second; + DEBUG(std::cerr << "machine basic block: " + << mbb->getBasicBlock()->getName() << "\n"); + for (MachineBasicBlock::iterator mi = mbb->begin(), miEnd = mbb->end(); + mi != miEnd; ++mi) { + MachineInstr* instr = *mi; + const TargetInstrDescriptor& tid = + tm_->getInstrInfo().get(instr->getOpcode()); + DEBUG(std::cerr << "\t\tinstruction[" + << getInstructionIndex(instr) << "]: "; + instr->print(std::cerr, *tm_);); + + // handle implicit defs + for (const unsigned* id = tid.ImplicitDefs; *id; ++id) { + unsigned physReg = *id; + handlePhysicalRegisterDef(mbb, mi, physReg); + } + + // handle explicit defs + for (int i = instr->getNumOperands() - 1; i >= 0; --i) { + MachineOperand& mop = instr->getOperand(i); + + if (!mop.isVirtualRegister()) + continue; + + if (mop.opIsDefOnly() || mop.opIsDefAndUse()) { + unsigned reg = mop.getAllocatedRegNum(); + handleVirtualRegisterDef(mbb, mi, reg); + } + } + } + } + + DEBUG(std::copy(intervals_.begin(), intervals_.end(), + std::ostream_iterator(std::cerr, "\n"))); +} Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u /dev/null llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.2 --- /dev/null Wed Nov 19 21:32:36 2003 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 19 21:32:25 2003 @@ -0,0 +1,777 @@ +//===-- RegAllocLinearScan.cpp - Linear Scan register allocator -----------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements a linear scan register allocator. +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "regalloc" +#include "llvm/Function.h" +#include "llvm/CodeGen/LiveIntervals.h" +#include "llvm/CodeGen/LiveVariables.h" +#include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/SSARegMap.h" +#include "llvm/Target/MRegisterInfo.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetRegInfo.h" +#include "llvm/Support/CFG.h" +#include "Support/Debug.h" +#include "Support/DepthFirstIterator.h" +#include "Support/Statistic.h" +#include "Support/STLExtras.h" +#include + +using namespace llvm; + +namespace { + Statistic<> numSpilled ("ra-linearscan", "Number of registers spilled"); + Statistic<> numReloaded("ra-linearscan", "Number of registers reloaded"); + + class RA : public MachineFunctionPass { + public: + typedef std::vector IntervalPtrs; + + private: + MachineFunction* mf_; + const TargetMachine* tm_; + const MRegisterInfo* mri_; + MachineBasicBlock* currentMbb_; + MachineBasicBlock::iterator currentInstr_; + typedef LiveIntervals::Intervals Intervals; + const Intervals* li_; + IntervalPtrs active_, inactive_; + + typedef std::vector Regs; + Regs tempUseOperands_; + Regs tempDefOperands_; + + Regs reserved_; + + typedef LiveIntervals::MachineBasicBlockPtrs MachineBasicBlockPtrs; + MachineBasicBlockPtrs mbbs_; + + typedef std::vector Phys2VirtMap; + Phys2VirtMap p2vMap_; + + typedef std::map Virt2PhysMap; + Virt2PhysMap v2pMap_; + + typedef std::map Virt2StackSlotMap; + Virt2StackSlotMap v2ssMap_; + + int instrAdded_; + + public: + virtual const char* getPassName() const { + return "Linear Scan Register Allocator"; + } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + AU.addRequired(); + MachineFunctionPass::getAnalysisUsage(AU); + } + + private: + /// runOnMachineFunction - register allocate the whole function + bool runOnMachineFunction(MachineFunction&); + + /// processActiveIntervals - expire old intervals and move + /// non-overlapping ones to the incative list + void processActiveIntervals(Intervals::const_iterator cur); + + /// processInactiveIntervals - expire old intervals and move + /// overlapping ones to the active list + void processInactiveIntervals(Intervals::const_iterator cur); + + /// assignStackSlotAtInterval - choose and spill + /// interval. Currently we spill the interval with the last + /// end point in the active and inactive lists and the current + /// interval + void assignStackSlotAtInterval(Intervals::const_iterator cur); + + /// + /// register handling helpers + /// + + /// reservePhysReg - reserves a physical register and spills + /// any value assigned to it if any + void reservePhysReg(unsigned reg); + + /// clearReservedPhysReg - marks pysical register as free for + /// use + void clearReservedPhysReg(unsigned reg); + + /// physRegAvailable - returns true if the specifed physical + /// register is available + bool physRegAvailable(unsigned physReg); + + /// getFreePhysReg - return a free physical register for this + /// virtual register if we have one, otherwise return 0 + unsigned getFreePhysReg(unsigned virtReg); + + + /// tempPhysRegAvailable - returns true if the specifed + /// temporary physical register is available + bool tempPhysRegAvailable(unsigned physReg); + + /// getFreeTempPhysReg - return a free temprorary physical + /// register for this register class if we have one (should + /// never return 0) + unsigned getFreeTempPhysReg(const TargetRegisterClass* rc); + + /// getFreeTempPhysReg - return a free temprorary physical + /// register for this virtual register if we have one (should + /// never return 0) + unsigned getFreeTempPhysReg(unsigned virtReg) { + const TargetRegisterClass* rc = + mf_->getSSARegMap()->getRegClass(virtReg); + return getFreeTempPhysReg(rc); + } + + /// assignVirt2PhysReg - assigns the free physical register to + /// the virtual register passed as arguments + void assignVirt2PhysReg(unsigned virtReg, unsigned physReg); + + /// clearVirtReg - free the physical register associated with this + /// virtual register and disassociate virtual->physical and + /// physical->virtual mappings + void clearVirtReg(unsigned virtReg); + + /// assignVirt2StackSlot - assigns this virtual register to a + /// stack slot + void assignVirt2StackSlot(unsigned virtReg); + + /// findOrCreateStackSlot - returns the offset of the + /// specified register on the stack allocating space if + /// necessary + int findOrCreateStackSlot(unsigned virtReg); + + /// spillVirtReg - spills the virtual register + void spillVirtReg(unsigned virtReg); + + /// loadPhysReg - loads to the physical register the value of + /// the virtual register specifed. Virtual register must have + /// an assigned stack slot + void loadVirt2PhysReg(unsigned virtReg, unsigned physReg); + + void printVirt2PhysMap() const { + std::cerr << "allocated registers:\n"; + for (Virt2PhysMap::const_iterator + i = v2pMap_.begin(), e = v2pMap_.end(); i != e; ++i) { + std::cerr << '[' << i->first << ',' + << mri_->getName(i->second) << "]\n"; + } + std::cerr << '\n'; + } + void printIntervals(const char* const str, + RA::IntervalPtrs::const_iterator i, + RA::IntervalPtrs::const_iterator e) const { + if (str) std::cerr << str << " intervals:\n"; + for (; i != e; ++i) { + std::cerr << "\t\t" << **i << " -> "; + if ((*i)->reg < MRegisterInfo::FirstVirtualRegister) { + std::cerr << mri_->getName((*i)->reg); + } + else { + std::cerr << mri_->getName(v2pMap_.find((*i)->reg)->second); + } + std::cerr << '\n'; + } + } + }; +} + +bool RA::runOnMachineFunction(MachineFunction &fn) { + mf_ = &fn; + tm_ = &fn.getTarget(); + mri_ = tm_->getRegisterInfo(); + li_ = &getAnalysis().getIntervals(); + active_.clear(); + inactive_.clear(); + mbbs_ = getAnalysis().getOrderedMachineBasicBlockPtrs(); + p2vMap_.resize(MRegisterInfo::FirstVirtualRegister-1); + p2vMap_.clear(); + v2pMap_.clear(); + v2ssMap_.clear(); + + // FIXME: this will work only for the X86 backend. I need to + // device an algorthm to select the minimal (considering register + // aliasing) number of temp registers to reserve so that we have 2 + // registers for each register class available. + + // reserve R32: EDI, EBX, + // R16: DI, BX, + // R8: DH, BH, + // RFP: FP5, FP6 + reserved_.push_back(19); /* EDI */ + reserved_.push_back(17); /* EBX */ + reserved_.push_back(12); /* DI */ + reserved_.push_back( 7); /* BX */ + reserved_.push_back(11); /* DH */ + reserved_.push_back( 4); /* BH */ + reserved_.push_back(28); /* FP5 */ + reserved_.push_back(29); /* FP6 */ + + // liner scan algorithm + for (Intervals::const_iterator + i = li_->begin(), e = li_->end(); i != e; ++i) { + DEBUG(std::cerr << "processing current interval: " << *i << '\n'); + + DEBUG(printIntervals("\tactive", active_.begin(), active_.end())); + DEBUG(printIntervals("\tinactive", inactive_.begin(), inactive_.end())); + + processActiveIntervals(i); + // processInactiveIntervals(i); + + // if this register is preallocated, look for an interval that + // overlaps with it and assign it to a memory location + if (i->reg < MRegisterInfo::FirstVirtualRegister) { + for (IntervalPtrs::iterator + ai = active_.begin(), ae = active_.end(); ai != ae; ++ai) { + unsigned virtReg = (*ai)->reg; + Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg); + if (it != v2pMap_.end() && it->second == i->reg) { + active_.erase(ai); + clearVirtReg(virtReg); + break; + } + } + reservePhysReg(i->reg); + active_.push_back(&*i); + } + // otherwise we are allocating a virtual register. try to find + // a free physical register or spill an interval in order to + // assign it one (we could spill the current though). + else { + unsigned physReg = getFreePhysReg(i->reg); + if (!physReg) { + assignStackSlotAtInterval(i); + } + else { + assignVirt2PhysReg(i->reg, physReg); + active_.push_back(&*i); + } + } + } + DEBUG(std::cerr << "finished register allocation\n"); + DEBUG(printVirt2PhysMap()); + + DEBUG(std::cerr << "Rewrite machine code:\n"); + for (MachineBasicBlockPtrs::iterator + mbbi = mbbs_.begin(), mbbe = mbbs_.end(); mbbi != mbbe; ++mbbi) { + instrAdded_ = 0; + currentMbb_ = *mbbi; + + for (currentInstr_ = currentMbb_->begin(); + currentInstr_ != currentMbb_->end(); ++currentInstr_) { + + DEBUG(std::cerr << "\tinstruction: "; + (*currentInstr_)->print(std::cerr, *tm_);); + DEBUG(std::cerr << "\t\tspilling temporarily defined operands " + "of previous instruction:\n"); + for (unsigned i = 0, e = tempDefOperands_.size(); i != e; ++i) { + spillVirtReg(tempDefOperands_[i]); + } + tempDefOperands_.clear(); + + // use our current mapping and actually replace and + // virtual register with its allocated physical registers + DEBUG(std::cerr << "\t\treplacing virtual registers with mapped " + "physical registers:\n"); + for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); + i != e; ++i) { + MachineOperand& op = (*currentInstr_)->getOperand(i); + if (op.isVirtualRegister()) { + unsigned virtReg = op.getAllocatedRegNum(); + unsigned physReg = v2pMap_[virtReg]; + // if this virtual registers lives on the stack, + // load it to a temporary physical register + if (physReg) { + DEBUG(std::cerr << "\t\t\t%reg" << virtReg + << " -> " << mri_->getName(physReg) << '\n'); + (*currentInstr_)->SetMachineOperandReg(i, physReg); + } + } + } + + DEBUG(std::cerr << "\t\tloading temporarily used operands to " + "registers:\n"); + for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); + i != e; ++i) { + MachineOperand& op = (*currentInstr_)->getOperand(i); + if (op.isVirtualRegister() && op.opIsUse()) { + unsigned virtReg = op.getAllocatedRegNum(); + unsigned physReg = v2pMap_[virtReg]; + if (!physReg) { + physReg = getFreeTempPhysReg(virtReg); + } + loadVirt2PhysReg(virtReg, physReg); + tempUseOperands_.push_back(virtReg); + (*currentInstr_)->SetMachineOperandReg(i, physReg); + } + } + + DEBUG(std::cerr << "\t\tclearing temporarily used operands:\n"); + for (unsigned i = 0, e = tempUseOperands_.size(); i != e; ++i) { + clearVirtReg(tempUseOperands_[i]); + } + tempUseOperands_.clear(); + + DEBUG(std::cerr << "\t\tassigning temporarily defined operands to " + "registers:\n"); + for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); + i != e; ++i) { + MachineOperand& op = (*currentInstr_)->getOperand(i); + if (op.isVirtualRegister() && !op.opIsUse()) { + unsigned virtReg = op.getAllocatedRegNum(); + unsigned physReg = v2pMap_[virtReg]; + if (!physReg) { + physReg = getFreeTempPhysReg(virtReg); + } + if (op.opIsDefAndUse()) { + loadVirt2PhysReg(virtReg, physReg); + } + else { + assignVirt2PhysReg(virtReg, physReg); + } + tempDefOperands_.push_back(virtReg); + (*currentInstr_)->SetMachineOperandReg(i, physReg); + } + } + + + // if the instruction is a two address instruction and the + // source operands are not identical we need to insert + // extra instructions. + + unsigned opcode = (*currentInstr_)->getOpcode(); + if (tm_->getInstrInfo().isTwoAddrInstr(opcode) && + (*currentInstr_)->getOperand(0).getAllocatedRegNum() != + (*currentInstr_)->getOperand(1).getAllocatedRegNum()) { + assert((*currentInstr_)->getOperand(1).isRegister() && + (*currentInstr_)->getOperand(1).getAllocatedRegNum() && + (*currentInstr_)->getOperand(1).opIsUse() && + "Two address instruction invalid"); + + unsigned regA = + (*currentInstr_)->getOperand(0).getAllocatedRegNum(); + unsigned regB = + (*currentInstr_)->getOperand(1).getAllocatedRegNum(); + unsigned regC = + ((*currentInstr_)->getNumOperands() > 2 && + (*currentInstr_)->getOperand(2).isRegister()) ? + (*currentInstr_)->getOperand(2).getAllocatedRegNum() : + 0; + + const TargetRegisterClass* rc = mri_->getRegClass(regA); + + // special case: "a = b op a". If b is a temporary + // reserved register rewrite as: "b = b op a; a = b" + // otherwise use a temporary reserved register t and + // rewrite as: "t = b; t = t op a; a = t" + if (regC && regA == regC) { + // b is a temp reserved register + if (find(reserved_.begin(), reserved_.end(), + regB) != reserved_.end()) { + (*currentInstr_)->SetMachineOperandReg(0, regB); + ++currentInstr_; + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + regA, + regB, + rc); + --currentInstr_; + } + // b is just a normal register + else { + unsigned tempReg = getFreeTempPhysReg(rc); + assert (tempReg && + "no free temp reserved physical register?"); + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + tempReg, + regB, + rc); + (*currentInstr_)->SetMachineOperandReg(0, tempReg); + (*currentInstr_)->SetMachineOperandReg(1, tempReg); + ++currentInstr_; + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + regA, + tempReg, + rc); + --currentInstr_; + } + } + // "a = b op c" gets rewritten to "a = b; a = a op c" + else { + instrAdded_ += mri_->copyRegToReg(*currentMbb_, + currentInstr_, + regA, + regB, + rc); + (*currentInstr_)->SetMachineOperandReg(1, regA); + } + } + } + + for (unsigned i = 0, e = p2vMap_.size(); i != e; ++i) { + assert(p2vMap_[i] != i && + "reserved physical registers at end of basic block?"); + } + } + + return true; +} + +void RA::processActiveIntervals(Intervals::const_iterator cur) +{ + DEBUG(std::cerr << "\tprocessing active intervals:\n"); + for (IntervalPtrs::iterator i = active_.begin(); i != active_.end();) { + unsigned reg = (*i)->reg; + // remove expired intervals. we expire earlier because this if + // an interval expires this is going to be the last use. in + // this case we can reuse the register for a def in the same + // instruction + if ((*i)->expired(cur->start() + 1)) { + DEBUG(std::cerr << "\t\tinterval " << **i << " expired\n"); + if (reg < MRegisterInfo::FirstVirtualRegister) { + clearReservedPhysReg(reg); + } + else { + p2vMap_[v2pMap_[reg]] = 0; + } + // remove interval from active + i = active_.erase(i); + } + // move not active intervals to inactive list +// else if (!(*i)->overlaps(curIndex)) { +// DEBUG(std::cerr << "\t\t\tinterval " << **i << " inactive\n"); +// unmarkReg(virtReg); +// // add interval to inactive +// inactive_.push_back(*i); +// // remove interval from active +// i = active_.erase(i); +// } + else { + ++i; + } + } +} + +void RA::processInactiveIntervals(Intervals::const_iterator cur) +{ +// DEBUG(std::cerr << "\tprocessing inactive intervals:\n"); +// for (IntervalPtrs::iterator i = inactive_.begin(); i != inactive_.end();) { +// unsigned virtReg = (*i)->reg; +// // remove expired intervals +// if ((*i)->expired(curIndex)) { +// DEBUG(std::cerr << "\t\t\tinterval " << **i << " expired\n"); +// freePhysReg(virtReg); +// // remove from inactive +// i = inactive_.erase(i); +// } +// // move re-activated intervals in active list +// else if ((*i)->overlaps(curIndex)) { +// DEBUG(std::cerr << "\t\t\tinterval " << **i << " active\n"); +// markReg(virtReg); +// // add to active +// active_.push_back(*i); +// // remove from inactive +// i = inactive_.erase(i); +// } +// else { +// ++i; +// } +// } +} + +void RA::assignStackSlotAtInterval(Intervals::const_iterator cur) +{ + DEBUG(std::cerr << "\t\tassigning stack slot at interval " + << *cur << ":\n"); + assert(!active_.empty() && + "active set cannot be empty when choosing a register to spill"); + const TargetRegisterClass* rcCur = + mf_->getSSARegMap()->getRegClass(cur->reg); + + // find the interval for a virtual register that ends last in + // active and belongs to the same register class as the current + // interval + IntervalPtrs::iterator lastEndActive = active_.begin(); + for (IntervalPtrs::iterator e = active_.end(); + lastEndActive != e; ++lastEndActive) { + if ((*lastEndActive)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*lastEndActive)->reg]); + if (rcCur == rc) { + break; + } + } + } + for (IntervalPtrs::iterator i = lastEndActive, e = active_.end(); + i != e; ++i) { + if ((*i)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*i)->reg]); + if (rcCur == rc && + (*lastEndActive)->end() < (*i)->end()) { + lastEndActive = i; + } + } + } + + // find the interval for a virtual register that ends last in + // inactive and belongs to the same register class as the current + // interval + IntervalPtrs::iterator lastEndInactive = inactive_.begin(); + for (IntervalPtrs::iterator e = inactive_.end(); + lastEndInactive != e; ++lastEndInactive) { + if ((*lastEndInactive)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*lastEndInactive)->reg]); + if (rcCur == rc) { + break; + } + } + } + for (IntervalPtrs::iterator i = lastEndInactive, e = inactive_.end(); + i != e; ++i) { + if ((*i)->reg >= MRegisterInfo::FirstVirtualRegister) { + const TargetRegisterClass* rc = + mri_->getRegClass(v2pMap_[(*i)->reg]); + if (rcCur == rc && + (*lastEndInactive)->end() < (*i)->end()) { + lastEndInactive = i; + } + } + } + + unsigned lastEndActiveInactive = 0; + if (lastEndActive != active_.end() && + lastEndActiveInactive < (*lastEndActive)->end()) { + lastEndActiveInactive = (*lastEndActive)->end(); + } + if (lastEndInactive != inactive_.end() && + lastEndActiveInactive < (*lastEndInactive)->end()) { + lastEndActiveInactive = (*lastEndInactive)->end(); + } + + if (lastEndActiveInactive > cur->end()) { + if (lastEndInactive == inactive_.end() || + (*lastEndActive)->end() > (*lastEndInactive)->end()) { + assignVirt2StackSlot((*lastEndActive)->reg); + active_.erase(lastEndActive); + } + else { + assignVirt2StackSlot((*lastEndInactive)->reg); + inactive_.erase(lastEndInactive); + } + unsigned physReg = getFreePhysReg(cur->reg); + assert(physReg && "no free physical register after spill?"); + assignVirt2PhysReg(cur->reg, physReg); + active_.push_back(&*cur); + } + else { + assignVirt2StackSlot(cur->reg); + } +} + +void RA::reservePhysReg(unsigned physReg) +{ + DEBUG(std::cerr << "\t\t\treserving physical physical register: " + << mri_->getName(physReg) << '\n'); + // if this register holds a value spill it + unsigned virtReg = p2vMap_[physReg]; + if (virtReg != 0) { + assert(virtReg != physReg && "reserving an already reserved phus reg?"); + // remove interval from active + for (IntervalPtrs::iterator i = active_.begin(), e = active_.end(); + i != e; ++i) { + if ((*i)->reg == virtReg) { + active_.erase(i); + break; + } + } + spillVirtReg(virtReg); + } + p2vMap_[physReg] = physReg; // this denotes a reserved physical register +} + +void RA::clearReservedPhysReg(unsigned physReg) +{ + DEBUG(std::cerr << "\t\t\tclearing reserved physical physical register: " + << mri_->getName(physReg) << '\n'); + assert(p2vMap_[physReg] == physReg && + "attempt to clear a non reserved physical register"); + p2vMap_[physReg] = 0; +} + +bool RA::physRegAvailable(unsigned physReg) +{ + if (p2vMap_[physReg]) { + return false; + } + + // if it aliases other registers it is still not free + for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as) { + if (p2vMap_[*as]) { + return false; + } + } + + // if it is one of the reserved registers it is still not free + if (find(reserved_.begin(), reserved_.end(), physReg) != reserved_.end()) { + return false; + } + + return true; +} + +unsigned RA::getFreePhysReg(unsigned virtReg) +{ + DEBUG(std::cerr << "\t\tgetting free physical register: "); + const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg); + TargetRegisterClass::iterator reg = rc->allocation_order_begin(*mf_); + TargetRegisterClass::iterator regEnd = rc->allocation_order_end(*mf_); + + for (; reg != regEnd; ++reg) { + if (physRegAvailable(*reg)) { + assert(*reg != 0 && "Cannot use register!"); + DEBUG(std::cerr << mri_->getName(*reg) << '\n'); + return *reg; // Found an unused register! + } + } + + DEBUG(std::cerr << "no free register\n"); + return 0; +} + +bool RA::tempPhysRegAvailable(unsigned physReg) +{ + assert(find(reserved_.begin(), reserved_.end(), physReg) != reserved_.end() + && "cannot call this method with a non reserved temp register"); + + if (p2vMap_[physReg]) { + return false; + } + + // if it aliases other registers it is still not free + for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as) { + if (p2vMap_[*as]) { + return false; + } + } + + return true; +} + +unsigned RA::getFreeTempPhysReg(const TargetRegisterClass* rc) +{ + DEBUG(std::cerr << "\t\tgetting free temporary physical register: "); + + for (Regs::const_iterator + reg = reserved_.begin(), regEnd = reserved_.end(); + reg != regEnd; ++reg) { + if (rc == mri_->getRegClass(*reg) && tempPhysRegAvailable(*reg)) { + assert(*reg != 0 && "Cannot use register!"); + DEBUG(std::cerr << mri_->getName(*reg) << '\n'); + return *reg; // Found an unused register! + } + } + assert(0 && "no free temporary physical register?"); + return 0; +} + +void RA::assignVirt2PhysReg(unsigned virtReg, unsigned physReg) +{ + assert((physRegAvailable(physReg) || + find(reserved_.begin(), + reserved_.end(), + physReg) != reserved_.end()) && + "attempt to allocate to a not available physical register"); + v2pMap_[virtReg] = physReg; + p2vMap_[physReg] = virtReg; +} + +void RA::clearVirtReg(unsigned virtReg) +{ + Virt2PhysMap::iterator it = v2pMap_.find(virtReg); + assert(it != v2pMap_.end() && + "attempting to clear a not allocated virtual register"); + unsigned physReg = it->second; + p2vMap_[physReg] = 0; + v2pMap_[virtReg] = 0; // this marks that this virtual register + // lives on the stack + DEBUG(std::cerr << "\t\t\tcleared register " << mri_->getName(physReg) + << "\n"); +} + +void RA::assignVirt2StackSlot(unsigned virtReg) +{ + const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg); + int frameIndex = mf_->getFrameInfo()->CreateStackObject(rc); + + bool inserted = v2ssMap_.insert(std::make_pair(virtReg, frameIndex)).second; + assert(inserted && + "attempt to assign stack slot to already assigned register?"); + // if the virtual register was previously assigned clear the mapping + // and free the virtual register + if (v2pMap_.find(virtReg) != v2pMap_.end()) { + clearVirtReg(virtReg); + } +} + +int RA::findOrCreateStackSlot(unsigned virtReg) +{ + // use lower_bound so that we can do a possibly O(1) insert later + // if necessary + Virt2StackSlotMap::iterator it = v2ssMap_.lower_bound(virtReg); + if (it != v2ssMap_.end() && it->first == virtReg) { + return it->second; + } + const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg); + int frameIndex = mf_->getFrameInfo()->CreateStackObject(rc); + + v2ssMap_.insert(it, std::make_pair(virtReg, frameIndex)); + + return frameIndex; +} + +void RA::spillVirtReg(unsigned virtReg) +{ + DEBUG(std::cerr << "\t\t\tspilling register: " << virtReg); + const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg); + int frameIndex = findOrCreateStackSlot(virtReg); + DEBUG(std::cerr << " to stack slot #" << frameIndex << '\n'); + ++numSpilled; + instrAdded_ += mri_->storeRegToStackSlot(*currentMbb_, currentInstr_, + v2pMap_[virtReg], frameIndex, rc); + clearVirtReg(virtReg); +} + +void RA::loadVirt2PhysReg(unsigned virtReg, unsigned physReg) +{ + DEBUG(std::cerr << "\t\t\tloading register: " << virtReg); + const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(virtReg); + int frameIndex = findOrCreateStackSlot(virtReg); + DEBUG(std::cerr << " from stack slot #" << frameIndex << '\n'); + ++numReloaded; + instrAdded_ += mri_->loadRegFromStackSlot(*currentMbb_, currentInstr_, + physReg, frameIndex, rc); + assignVirt2PhysReg(virtReg, physReg); +} + +FunctionPass* llvm::createLinearScanRegisterAllocator() { + return new RA(); +} Index: llvm/lib/CodeGen/Passes.cpp diff -u llvm/lib/CodeGen/Passes.cpp:1.3 llvm/lib/CodeGen/Passes.cpp:1.4 --- llvm/lib/CodeGen/Passes.cpp:1.3 Tue Nov 11 16:41:32 2003 +++ llvm/lib/CodeGen/Passes.cpp Wed Nov 19 21:32:25 2003 @@ -18,14 +18,15 @@ namespace llvm { namespace { - enum RegAllocName { simple, local }; + enum RegAllocName { simple, local, linearscan }; cl::opt RegAlloc("regalloc", cl::desc("Register allocator to use: (default = simple)"), cl::Prefix, - cl::values(clEnumVal(simple, " simple register allocator"), - clEnumVal(local, " local register allocator"), + cl::values(clEnumVal(simple, " simple register allocator"), + clEnumVal(local, " local register allocator"), + clEnumVal(linearscan, " linear-scan global register allocator"), 0), cl::init(local)); } @@ -37,6 +38,8 @@ return createSimpleRegisterAllocator(); case local: return createLocalRegisterAllocator(); + case linearscan: + return createLinearScanRegisterAllocator(); default: assert(0 && "no register allocator selected"); return 0; // not reached From alkis at cs.uiuc.edu Wed Nov 19 21:33:09 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed Nov 19 21:33:09 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervals.h Passes.h Message-ID: <200311200332.VAA28145@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervals.h updated: 1.1 -> 1.2 Passes.h updated: 1.9 -> 1.10 --- Log message: Merging the linear scan register allocator in trunk. It currently passes most tests under test/Programs/SingleSource/Benchmarks/Shootout so development will continue on trunk. The allocator is not enabled by default. You will need to pass -regallo=linearscan to lli or llc to use it. --- Diffs of the changes: (+217 -1) Index: llvm/include/llvm/CodeGen/LiveIntervals.h diff -u /dev/null llvm/include/llvm/CodeGen/LiveIntervals.h:1.2 --- /dev/null Wed Nov 19 21:32:35 2003 +++ llvm/include/llvm/CodeGen/LiveIntervals.h Wed Nov 19 21:32:25 2003 @@ -0,0 +1,211 @@ +//===-- llvm/CodeGen/LiveInterval.h - Live Interval Analysis ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the LiveInterval analysis pass. Given some +// numbering of each the machine instructions (in this implemention +// depth-first order) an interval [i, j] is said to be a live interval +// for register v if there is no instruction with number j' > j such +// that v is live at j' abd there is no instruction with number i' < i +// such that v is live at i'. In this implementation intervals can +// have holes, i.e. an interval might look like [1,20], [50,65], +// [1000,1001] +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_LIVEINTERVALS_H +#define LLVM_CODEGEN_LIVEINTERVALS_H + +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include +#include + +namespace llvm { + + class LiveVariables; + class MRegisterInfo; + + class LiveIntervals : public MachineFunctionPass + { + public: + struct Interval { + typedef std::pair Range; + typedef std::vector Ranges; + unsigned reg; // the register of this interval + Ranges ranges; // the ranges this register is valid + + Interval(unsigned r) + : reg(r) { + + } + + unsigned start() const { + assert(!ranges.empty() && "empty interval for register"); + return ranges.front().first; + } + + unsigned end() const { + assert(!ranges.empty() && "empty interval for register"); + return ranges.back().second; + } + + bool expired(unsigned index) const { + return end() <= index; + } + + bool overlaps(unsigned index) const { + for (Ranges::const_iterator + i = ranges.begin(), e = ranges.end(); i != e; ++i) { + if (index >= i->first && index < i->second) { + return true; + } + } + return false; + } + + void addRange(unsigned start, unsigned end) { + Range range = std::make_pair(start, end); + Ranges::iterator it = + std::lower_bound(ranges.begin(), ranges.end(), range); + + if (it == ranges.end()) { + it = ranges.insert(it, range); + goto exit; + } + + assert(range.first <= it->first && "got wrong iterator?"); + // merge ranges if necesary + if (range.first < it->first) { + if (range.second >= it->first) { + it->first = range.first; + } + else { + it = ranges.insert(it, range); + assert(it != ranges.end() && "wtf?"); + goto exit; + } + } + + exit: + mergeRangesIfNecessary(it); + } + + private: + void mergeRangesIfNecessary(Ranges::iterator it) { + while (it != ranges.begin()) { + Ranges::iterator prev = it - 1; + if (prev->second < it->first) { + break; + } + prev->second = it->second; + ranges.erase(it); + it = prev; + } + } + }; + + struct StartPointComp { + bool operator()(const Interval& lhs, const Interval& rhs) { + return lhs.ranges.front().first < rhs.ranges.front().first; + } + }; + + struct EndPointComp { + bool operator()(const Interval& lhs, const Interval& rhs) { + return lhs.ranges.back().second < rhs.ranges.back().second; + } + }; + + typedef std::vector Intervals; + typedef std::vector MachineBasicBlockPtrs; + + private: + MachineFunction* mf_; + const TargetMachine* tm_; + const MRegisterInfo* mri_; + MachineBasicBlock* currentMbb_; + MachineBasicBlock::iterator currentInstr_; + LiveVariables* lv_; + + std::vector allocatableRegisters_; + + typedef std::map MbbIndex2MbbMap; + MbbIndex2MbbMap mbbi2mbbMap_; + + typedef std::map Mi2IndexMap; + Mi2IndexMap mi2iMap_; + + typedef std::map Reg2IntervalMap; + Reg2IntervalMap r2iMap_; + + Intervals intervals_; + + public: + virtual void getAnalysisUsage(AnalysisUsage &AU) const; + Intervals& getIntervals() { return intervals_; } + MachineBasicBlockPtrs getOrderedMachineBasicBlockPtrs() const { + MachineBasicBlockPtrs result; + for (MbbIndex2MbbMap::const_iterator + it = mbbi2mbbMap_.begin(), itEnd = mbbi2mbbMap_.end(); + it != itEnd; ++it) { + result.push_back(it->second); + } + return result; + } + + private: + /// runOnMachineFunction - pass entry point + bool runOnMachineFunction(MachineFunction&); + + /// computeIntervals - compute live intervals + void computeIntervals(); + + + /// handleRegisterDef - update intervals for a register def + /// (calls handlePhysicalRegisterDef and + /// handleVirtualRegisterDef) + void handleRegisterDef(MachineBasicBlock* mbb, + MachineBasicBlock::iterator mi, + unsigned reg); + + /// handleVirtualRegisterDef - update intervals for a virtual + /// register def + void handleVirtualRegisterDef(MachineBasicBlock* mbb, + MachineBasicBlock::iterator mi, + unsigned reg); + + /// handlePhysicalRegisterDef - update intervals for a + /// physical register def + void handlePhysicalRegisterDef(MachineBasicBlock* mbb, + MachineBasicBlock::iterator mi, + unsigned reg); + + unsigned getInstructionIndex(MachineInstr* instr) const; + + void printRegName(unsigned reg) const; + }; + + inline bool operator==(const LiveIntervals::Interval& lhs, + const LiveIntervals::Interval& rhs) { + return lhs.reg == rhs.reg; + } + + inline std::ostream& operator<<(std::ostream& os, + const LiveIntervals::Interval& li) { + os << "%reg" << li.reg << " = "; + for (LiveIntervals::Interval::Ranges::const_iterator + i = li.ranges.begin(), e = li.ranges.end(); i != e; ++i) { + os << "[" << i->first << ", " << i->second << "]"; + } + return os; + } + +} // End llvm namespace + +#endif Index: llvm/include/llvm/CodeGen/Passes.h diff -u llvm/include/llvm/CodeGen/Passes.h:1.9 llvm/include/llvm/CodeGen/Passes.h:1.10 --- llvm/include/llvm/CodeGen/Passes.h:1.9 Tue Nov 11 16:41:31 2003 +++ llvm/include/llvm/CodeGen/Passes.h Wed Nov 19 21:32:25 2003 @@ -44,11 +44,16 @@ /// FunctionPass *createLocalRegisterAllocator(); +/// LinearScanRegisterAllocation Pass - This pass implements the +/// linear scan register allocation algorithm, a global register +/// allocator. +/// +FunctionPass *createLinearScanRegisterAllocator(); + /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code, /// and eliminates abstract frame references. /// FunctionPass *createPrologEpilogCodeInserter(); - /// getRegisterAllocator - This creates an instance of the register allocator /// for the Sparc. From brukman at cs.uiuc.edu Wed Nov 19 22:27:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Nov 19 22:27:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311200426.WAA04363@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.23 -> 1.24 --- Log message: Add notes on building pine. --- Diffs of the changes: (+7 -2) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.23 llvm-www/status/index.html:1.24 --- llvm-www/status/index.html:1.23 Wed Nov 19 20:04:25 2003 +++ llvm-www/status/index.html Wed Nov 19 22:26:22 2003 @@ -61,7 +61,12 @@ - + @@ -423,7 +428,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 02:04:25 $ + Last modified: $Date: 2003/11/20 04:26:22 $ From brukman at cs.uiuc.edu Wed Nov 19 23:08:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Nov 19 23:08:02 2003 Subject: [llvm-commits] CVS: CVSROOT/loginfo Message-ID: <200311200507.XAA12531@zion.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.3 -> 1.4 --- Log message: Send updates to llva-emu to us, with diffs. --- Diffs of the changes: (+1 -0) Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.3 CVSROOT/loginfo:1.4 --- CVSROOT/loginfo:1.3 Thu Oct 16 15:41:10 2003 +++ CVSROOT/loginfo Wed Nov 19 23:07:10 2003 @@ -28,4 +28,5 @@ # Automatically update the webpages ^llvm-www (/home/vadve/shared/InternalCVS/CVSROOT/update-www.sh &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu ^reopt /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu +^llva-emu /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-emu at nondot.org ^CVSROOT /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu From gaeke at cs.uiuc.edu Wed Nov 19 23:28:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 23:28:01 2003 Subject: [llvm-commits] CVS: reopt/Makefile.config.in Message-ID: <200311200527.XAA25258@zion.cs.uiuc.edu> Changes in directory reopt: Makefile.config.in updated: 1.2 -> 1.3 --- Log message: Re-added. --- Diffs of the changes: (+16 -0) Index: reopt/Makefile.config.in diff -u /dev/null reopt/Makefile.config.in:1.3 --- /dev/null Wed Nov 19 23:27:25 2003 +++ reopt/Makefile.config.in Wed Nov 19 23:27:15 2003 @@ -0,0 +1,16 @@ +# +# Set this variable to the top of the LLVM source tree. +# +LLVM_SRC_ROOT = @LLVM_SRC@ + +# +# Set this variable to the top level directory where LLVM was built +# (i.e. where all of the object files are located). +# +LLVM_OBJ_ROOT = @LLVM_OBJ@ + +# +# Include LLVM's Makefile Makefile. +# +include $(LLVM_SRC_ROOT)/Makefile.config + From gaeke at cs.uiuc.edu Wed Nov 19 23:29:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Nov 19 23:29:01 2003 Subject: [llvm-commits] CVS: reopt/autoconf/configure.ac Message-ID: <200311200528.XAA25271@zion.cs.uiuc.edu> Changes in directory reopt/autoconf: configure.ac updated: 1.4 -> 1.5 --- Log message: re-add Makefile.config. --- Diffs of the changes: (+1 -0) Index: reopt/autoconf/configure.ac diff -u reopt/autoconf/configure.ac:1.4 reopt/autoconf/configure.ac:1.5 --- reopt/autoconf/configure.ac:1.4 Tue Sep 30 11:17:48 2003 +++ reopt/autoconf/configure.ac Wed Nov 19 23:28:07 2003 @@ -92,3 +92,4 @@ dnl * Create the output files dnl ************************************************************************** AC_OUTPUT(Makefile.common) +AC_OUTPUT(Makefile.config) From brukman at cs.uiuc.edu Thu Nov 20 00:23:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 00:23:02 2003 Subject: [llvm-commits] CVS: llvm/tools/gccld/gccld.cpp Message-ID: <200311200622.AAA09318@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: gccld.cpp updated: 1.62 -> 1.63 --- Log message: * Doxygenified comments, simplifying them and shortening in the process * Eliminated extra space --- Diffs of the changes: (+43 -67) Index: llvm/tools/gccld/gccld.cpp diff -u llvm/tools/gccld/gccld.cpp:1.62 llvm/tools/gccld/gccld.cpp:1.63 --- llvm/tools/gccld/gccld.cpp:1.62 Tue Nov 11 16:41:34 2003 +++ llvm/tools/gccld/gccld.cpp Thu Nov 20 00:21:54 2003 @@ -90,56 +90,41 @@ namespace llvm { -// -// Function: PrintAndReturn () -// -// Description: -// Prints a message (usually error message) to standard error (stderr) and -// returns a value usable for an exit status. -// -// Inputs: -// progname - The name of the program (i.e. argv[0]). -// Message - The message to print to standard error. -// Extra - Extra information to print between the program name and thei -// message. It is optional. -// -// Outputs: -// None. -// -// Return value: -// Returns a value that can be used as the exit status (i.e. for exit()). -// +/// PrintAndReturn - Prints a message to standard error and returns a value +/// usable for an exit status. +/// +/// Inputs: +/// progname - The name of the program (i.e. argv[0]). +/// Message - The message to print to standard error. +/// Extra - Extra information to print between the program name and thei +/// message. It is optional. +/// +/// Return value: +/// Returns a value that can be used as the exit status (i.e. for exit()). +/// int -PrintAndReturn (const char *progname, - const std::string &Message, - const std::string &Extra) +PrintAndReturn(const char *progname, + const std::string &Message, + const std::string &Extra) { std::cerr << progname << Extra << ": " << Message << "\n"; return 1; } -// -// -// Function: CopyEnv() -// -// Description: -// This function takes an array of environment variables and makes a -// copy of it. This copy can then be manipulated any way the caller likes -// without affecting the process's real environment. -// -// Inputs: -// envp - An array of C strings containing an environment. -// -// Outputs: -// None. -// -// Return value: -// NULL - An error occurred. -// -// Otherwise, a pointer to a new array of C strings is returned. Every string -// in the array is a duplicate of the one in the original array (i.e. we do -// not copy the char *'s from one array to another). -// +/// CopyEnv - This function takes an array of environment variables and makes a +/// copy of it. This copy can then be manipulated any way the caller likes +/// without affecting the process's real environment. +/// +/// Inputs: +/// envp - An array of C strings containing an environment. +/// +/// Return value: +/// NULL - An error occurred. +/// +/// Otherwise, a pointer to a new array of C strings is returned. Every string +/// in the array is a duplicate of the one in the original array (i.e. we do +/// not copy the char *'s from one array to another). +/// char ** CopyEnv(char ** const envp) { // Count the number of entries in the old list; unsigned entries; // The number of entries in the old environment list @@ -173,28 +158,19 @@ } -// -// Function: RemoveEnv() -// -// Description: -// Remove the specified environment variable from the environment array. -// -// Inputs: -// name - The name of the variable to remove. It cannot be NULL. -// envp - The array of environment variables. It cannot be NULL. -// -// Outputs: -// envp - The pointer to the specified variable name is removed. -// -// Return value: -// None. -// -// Notes: -// This is mainly done because functions to remove items from the environment -// are not available across all platforms. In particular, Solaris does not -// seem to have an unsetenv() function or a setenv() function (or they are -// undocumented if they do exist). -// +/// RemoveEnv - Remove the specified environment variable from the environment +/// array. +/// +/// Inputs: +/// name - The name of the variable to remove. It cannot be NULL. +/// envp - The array of environment variables. It cannot be NULL. +/// +/// Notes: +/// This is mainly done because functions to remove items from the environment +/// are not available across all platforms. In particular, Solaris does not +/// seem to have an unsetenv() function or a setenv() function (or they are +/// undocumented if they do exist). +/// void RemoveEnv(const char * name, char ** const envp) { for (unsigned index=0; envp[index] != NULL; index++) { // Find the first equals sign in the array and make it an EOS character. @@ -220,7 +196,7 @@ int main(int argc, char **argv, char **envp) { cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n"); - std::string ModuleID ("gccld-output"); + std::string ModuleID("gccld-output"); std::auto_ptr Composite(new Module(ModuleID)); // We always look first in the current directory when searching for libraries. From brukman at cs.uiuc.edu Thu Nov 20 00:27:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 00:27:01 2003 Subject: [llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp Message-ID: <200311200626.AAA09366@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: GenerateCode.cpp updated: 1.14 -> 1.15 --- Log message: For consistency, removed space between function name and left paren in function call, i.e. [ addPass (...) ] => [ addPass(...) ] --- Diffs of the changes: (+15 -15) Index: llvm/tools/gccld/GenerateCode.cpp diff -u llvm/tools/gccld/GenerateCode.cpp:1.14 llvm/tools/gccld/GenerateCode.cpp:1.15 --- llvm/tools/gccld/GenerateCode.cpp:1.14 Sun Nov 16 17:07:28 2003 +++ llvm/tools/gccld/GenerateCode.cpp Thu Nov 20 00:26:15 2003 @@ -72,61 +72,61 @@ if (Verify) Passes.add(createVerifierPass()); // Add an appropriate TargetData instance for this module... - addPass (Passes, new TargetData("gccld", M)); + addPass(Passes, new TargetData("gccld", M)); if (!DisableOptimizations) { // Linking modules together can lead to duplicated global constants, only // keep one copy of each constant... - addPass (Passes, createConstantMergePass()); + addPass(Passes, createConstantMergePass()); // If the -s command line option was specified, strip the symbols out of the // resulting program to make it smaller. -s is a GCC option that we are // supporting. if (Strip) - addPass (Passes, createSymbolStrippingPass()); + addPass(Passes, createSymbolStrippingPass()); // 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()); + addPass(Passes, createFunctionResolvingPass()); if (Internalize) { // Now that composite has been compiled, scan through the module, looking // for a main function. If main is defined, mark all other functions // internal. - addPass (Passes, createInternalizePass()); + addPass(Passes, createInternalizePass()); } // Propagate constants at call sites into the functions they call. - addPass (Passes, createIPConstantPropagationPass()); + addPass(Passes, createIPConstantPropagationPass()); // Remove unused arguments from functions... - addPass (Passes, createDeadArgEliminationPass()); + addPass(Passes, createDeadArgEliminationPass()); if (!DisableInline) - addPass (Passes, createFunctionInliningPass()); // Inline small functions + addPass(Passes, createFunctionInliningPass()); // Inline small functions // Run a few AA driven optimizations here and now, to cleanup the code. // Eventually we should put an IP AA in place here. - addPass (Passes, createLICMPass()); // Hoist loop invariants - addPass (Passes, createLoadValueNumberingPass()); // GVN for load instrs - addPass (Passes, createGCSEPass()); // Remove common subexprs + addPass(Passes, createLICMPass()); // Hoist loop invariants + addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs + addPass(Passes, createGCSEPass()); // Remove common subexprs // The FuncResolve pass may leave cruft around if functions were prototyped // differently than they were defined. Remove this cruft. - addPass (Passes, createInstructionCombiningPass()); + addPass(Passes, createInstructionCombiningPass()); // Delete basic blocks, which optimization passes may have killed... - addPass (Passes, createCFGSimplificationPass()); + addPass(Passes, createCFGSimplificationPass()); // Now that we have optimized the program, discard unreachable functions... - addPass (Passes, createGlobalDCEPass()); + addPass(Passes, createGlobalDCEPass()); } // Add the pass that writes bytecode to the output file... - addPass (Passes, new WriteBytecodePass(Out)); + addPass(Passes, new WriteBytecodePass(Out)); // Run our queue of passes all at once now, efficiently. Passes.run(*M); From brukman at cs.uiuc.edu Thu Nov 20 01:14:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 01:14:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311200713.BAA16550@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.24 -> 1.25 --- Log message: Those two libraries are useless to be loaded by LLI, how'd they even get there? --- Diffs of the changes: (+1 -3) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.24 llvm-www/status/index.html:1.25 --- llvm-www/status/index.html:1.24 Wed Nov 19 22:26:22 2003 +++ llvm-www/status/index.html Thu Nov 20 01:12:57 2003 @@ -248,8 +248,6 @@ lli -load=/lib/libssl.so.2 \ -load=/lib/libcrypto.so.2 \ -load=/lib/libdl.so.2 \ - -load=/lib/i686/libc.so.6 \ - -load=/lib/ld-linux.so.2 \ wget.bc [wget options] @@ -428,7 +426,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 04:26:22 $ + Last modified: $Date: 2003/11/20 07:12:57 $ From gaeke at cs.uiuc.edu Thu Nov 20 10:27:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 10:27:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311201626.KAA26089@gally.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.4 -> 1.5 --- Log message: Remove unused EXPLAIN_PARAGRAPH variable. Enrich the email message sent to Chris. --- Diffs of the changes: (+12 -5) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.4 llvm-www/demo/index.cgi:1.5 --- llvm-www/demo/index.cgi:1.4 Tue Nov 18 23:56:54 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 10:26:00 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/19 05:56:54 $ +# Last modified $Date: 2003/11/20 16:26:00 $ # use CGI; @@ -20,8 +20,6 @@ $FORM_URL = 'http://llvm.cs.uiuc.edu/demo/index.cgi'; $CONTACT_ADDRESS = 'gaeke -at- uiuc.edu'; $LOGO_IMAGE_URL = 'cathead.png'; -$EXPLAIN_PARAGRAPH = <Hmm, that's weird, llvm-dis didn't produce any output.

        \n"; - unlink( $inputFile, $bytecodeFile, $outputFile, $disassemblyFile ); } addlog( $source, $pid, $UnhilightedResult ); + + my ($ip, $host, $lg, $lines); + chomp ($lines = `wc -l < $inputFile`); + $lg = $c->param('language'); + $ip = $c->remote_addr(); + chomp ($host = `host $ip`) if $ip; mailto( 'lattner at cs.uiuc.edu', - "--- Source: ---\n$source\n--- Result: ---\n$UnhilightedResult\n" ); + "--- Query: ---\nFrom: ($ip) $host\nInput: $lines lines of $lg\n" + . "--- Source: ---\n$source\n" + . "--- Result: ---\n$UnhilightedResult\n" ); + + unlink( $inputFile, $bytecodeFile, $outputFile, $disassemblyFile ); } print $c->hr, "
        $CONTACT_ADDRESS
        ", $c->end_html; From lattner at cs.uiuc.edu Thu Nov 20 10:51:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 10:51:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/cathead.png Message-ID: <200311201650.KAA07731@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: cathead.png updated: 1.1 -> 1.2 --- Log message: Fix a critical bug in the demo scripts --- Diffs of the changes: (+0 -0) Index: llvm-www/demo/cathead.png From brukman at cs.uiuc.edu Thu Nov 20 11:05:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 11:05:02 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311201704.LAA19968@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.25 -> 1.26 --- Log message: XEmacs still fails: bug 141. --- Diffs of the changes: (+10 -10) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.25 llvm-www/status/index.html:1.26 --- llvm-www/status/index.html:1.25 Thu Nov 20 01:12:57 2003 +++ llvm-www/status/index.html Thu Nov 20 11:03:58 2003 @@ -45,6 +45,14 @@
        + + + + + + + + + Compile fails: see bug 141 for details. @@ -132,14 +140,6 @@ editor." - Unix Seventh Edition manual, Bell Telephone Laboratories, 1979. - - - - - - - - @@ -426,7 +426,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 07:12:57 $ + Last modified: $Date: 2003/11/20 17:03:58 $ From lattner at cs.uiuc.edu Thu Nov 20 11:45:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 11:45:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/InstrTypes.h iTerminators.h Message-ID: <200311201744.LAA24823@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: InstrTypes.h updated: 1.35 -> 1.36 iTerminators.h updated: 1.35 -> 1.36 --- Log message: * Add new constructors to allow insertion of terminator instructions at the end of basic blocks. * Document some confusing constructor combinations * Move a ReturnInst method out-of-line, so that the vtable and type info don't need to be emitted to every translation unit that uses the class. --- Diffs of the changes: (+32 -6) Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.35 llvm/include/llvm/InstrTypes.h:1.36 --- llvm/include/llvm/InstrTypes.h:1.35 Sun Nov 16 14:21:15 2003 +++ llvm/include/llvm/InstrTypes.h Thu Nov 20 11:44:37 2003 @@ -34,6 +34,7 @@ const std::string &Name = "", Instruction *InsertBefore = 0) : Instruction(Ty, iType, Name, InsertBefore) { } + TerminatorInst(Instruction::TermOps iType, BasicBlock *InsertAtEnd); public: /// Terminators must implement the methods required by Instruction... Index: llvm/include/llvm/iTerminators.h diff -u llvm/include/llvm/iTerminators.h:1.35 llvm/include/llvm/iTerminators.h:1.36 --- llvm/include/llvm/iTerminators.h:1.35 Sun Nov 16 14:21:15 2003 +++ llvm/include/llvm/iTerminators.h Thu Nov 20 11:44:37 2003 @@ -33,6 +33,13 @@ } } public: + // ReturnInst constructors: + // ReturnInst() - 'ret void' instruction + // ReturnInst(Value* X) - 'ret X' instruction + // ReturnInst( null, Inst *) - 'ret void' instruction, insert before I + // ReturnInst(Value* X, Inst *I) - 'ret X' instruction, insert before I + // ReturnInst( null, BB *B) - 'ret void' instruction, insert @ end of BB + // ReturnInst(Value* X, BB *B) - 'ret X' instruction, insert @ end of BB ReturnInst(Value *RetVal = 0, Instruction *InsertBefore = 0) : TerminatorInst(Instruction::Ret, InsertBefore) { if (RetVal) { @@ -40,6 +47,13 @@ Operands.push_back(Use(RetVal, this)); } } + ReturnInst(Value *RetVal, BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Ret, InsertAtEnd) { + if (RetVal) { + Operands.reserve(1); + Operands.push_back(Use(RetVal, this)); + } + } virtual Instruction *clone() const { return new ReturnInst(*this); } @@ -55,9 +69,7 @@ abort(); return 0; } - virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) { - assert(0 && "ReturnInst has no successors!"); - } + virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc); virtual unsigned getNumSuccessors() const { return 0; } // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -76,10 +88,19 @@ class BranchInst : public TerminatorInst { BranchInst(const BranchInst &BI); public: - // If cond = null, then is an unconditional br... - BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *cond = 0, - Instruction *InsertBefore = 0); + // BranchInst constructors (where {B, T, F} are blocks, and C is a condition): + // BranchInst(BB *B) - 'br B' + // BranchInst(BB* T, BB *F, Value *C) - 'br C, T, F' + // BranchInst(BB* B, Inst *I) - 'br B' insert before I + // BranchInst(BB* T, BB *F, Value *C, Inst *I) - 'br C, T, F', insert before I + // BranchInst(BB* B, BB *I) - 'br B' insert at end + // BranchInst(BB* T, BB *F, Value *C, BB *I) - 'br C, T, F', insert at end BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = 0); + BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *cond, + Instruction *InsertBefore = 0); + BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd); + BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *cond, + BasicBlock *InsertAtEnd); virtual Instruction *clone() const { return new BranchInst(*this); } @@ -142,6 +163,7 @@ SwitchInst(const SwitchInst &RI); public: SwitchInst(Value *Value, BasicBlock *Default, Instruction *InsertBefore = 0); + SwitchInst(Value *Value, BasicBlock *Default, BasicBlock *InsertAtEnd); virtual Instruction *clone() const { return new SwitchInst(*this); } @@ -212,6 +234,9 @@ InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, const std::vector &Params, const std::string &Name = "", Instruction *InsertBefore = 0); + InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, + const std::vector &Params, const std::string &Name, + BasicBlock *InsertAtEnd); virtual Instruction *clone() const { return new InvokeInst(*this); } From lattner at cs.uiuc.edu Thu Nov 20 11:46:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 11:46:05 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/InstrTypes.cpp Instruction.cpp iBranch.cpp iCall.cpp iOperators.cpp iSwitch.cpp Message-ID: <200311201745.LAA25136@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: InstrTypes.cpp updated: 1.23 -> 1.24 Instruction.cpp updated: 1.31 -> 1.32 iBranch.cpp updated: 1.10 -> 1.11 iCall.cpp updated: 1.21 -> 1.22 iOperators.cpp updated: 1.24 -> 1.25 iSwitch.cpp updated: 1.10 -> 1.11 --- Log message: * Finegrainify namespacification * Add new constructors to allow insertion of terminator instructions at the end of basic blocks. * Move a ReturnInst method out-of-line, so that the vtable and type info don't need to be emitted to every translation unit that uses the class. --- Diffs of the changes: (+79 -29) Index: llvm/lib/VMCore/InstrTypes.cpp diff -u llvm/lib/VMCore/InstrTypes.cpp:1.23 llvm/lib/VMCore/InstrTypes.cpp:1.24 --- llvm/lib/VMCore/InstrTypes.cpp:1.23 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/InstrTypes.cpp Thu Nov 20 11:45:12 2003 @@ -18,8 +18,7 @@ #include "llvm/Constant.h" #include "llvm/Type.h" #include // find - -namespace llvm { +using namespace llvm; //===----------------------------------------------------------------------===// // TerminatorInst Class @@ -29,6 +28,13 @@ : Instruction(Type::VoidTy, iType, "", IB) { } +TerminatorInst::TerminatorInst(Instruction::TermOps iType, BasicBlock *IAE) + : Instruction(Type::VoidTy, iType) { + if (IAE) IAE->getInstList().push_back(this); +} + + + //===----------------------------------------------------------------------===// // PHINode Class //===----------------------------------------------------------------------===// @@ -58,5 +64,3 @@ } return Removed; } - -} // End llvm namespace Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.31 llvm/lib/VMCore/Instruction.cpp:1.32 --- llvm/lib/VMCore/Instruction.cpp:1.31 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Instruction.cpp Thu Nov 20 11:45:12 2003 @@ -15,8 +15,7 @@ #include "llvm/SymbolTable.h" #include "llvm/Type.h" #include "Support/LeakDetector.h" - -namespace llvm { +using namespace llvm; Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name, Instruction *InsertBefore) @@ -165,5 +164,3 @@ return false; } } - -} // End llvm namespace Index: llvm/lib/VMCore/iBranch.cpp diff -u llvm/lib/VMCore/iBranch.cpp:1.10 llvm/lib/VMCore/iBranch.cpp:1.11 --- llvm/lib/VMCore/iBranch.cpp:1.10 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/iBranch.cpp Thu Nov 20 11:45:12 2003 @@ -15,8 +15,15 @@ #include "llvm/iTerminators.h" #include "llvm/BasicBlock.h" #include "llvm/Type.h" +using namespace llvm; + +// Out-of-line ReturnInst method, put here so the C++ compiler can choose to +// emit the vtable for the class in this translation unit. +void ReturnInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) { + assert(0 && "ReturnInst has no successors!"); +} + -namespace llvm { BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond, Instruction *InsertBefore) @@ -35,6 +42,23 @@ "May only branch on boolean predicates!!!!"); } +BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond, + BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Br, InsertAtEnd) { + assert(True != 0 && "True branch destination may not be null!!!"); + Operands.reserve(False ? 3 : 1); + Operands.push_back(Use(True, this)); + if (False) { + Operands.push_back(Use(False, this)); + Operands.push_back(Use(Cond, this)); + } + + assert(!!False == !!Cond && + "Either both cond and false or neither can be specified!"); + assert((Cond == 0 || Cond->getType() == Type::BoolTy) && + "May only branch on boolean predicates!!!!"); +} + BranchInst::BranchInst(BasicBlock *True, Instruction *InsertBefore) : TerminatorInst(Instruction::Br, InsertBefore) { assert(True != 0 && "True branch destination may not be null!!!"); @@ -42,6 +66,13 @@ Operands.push_back(Use(True, this)); } +BranchInst::BranchInst(BasicBlock *True, BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Br, InsertAtEnd) { + assert(True != 0 && "True branch destination may not be null!!!"); + Operands.reserve(1); + Operands.push_back(Use(True, this)); +} + BranchInst::BranchInst(const BranchInst &BI) : TerminatorInst(Instruction::Br) { Operands.reserve(BI.Operands.size()); Operands.push_back(Use(BI.Operands[0], this)); @@ -51,5 +82,3 @@ Operands.push_back(Use(BI.Operands[2], this)); } } - -} // End llvm namespace Index: llvm/lib/VMCore/iCall.cpp diff -u llvm/lib/VMCore/iCall.cpp:1.21 llvm/lib/VMCore/iCall.cpp:1.22 --- llvm/lib/VMCore/iCall.cpp:1.21 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/iCall.cpp Thu Nov 20 11:45:12 2003 @@ -16,8 +16,8 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" - -namespace llvm { +#include "llvm/Support/CallSite.h" +using namespace llvm; //===----------------------------------------------------------------------===// // CallInst Implementation @@ -124,6 +124,32 @@ Operands.push_back(Use(params[i], this)); } +InvokeInst::InvokeInst(Value *Func, BasicBlock *IfNormal, + BasicBlock *IfException, + const std::vector ¶ms, + const std::string &Name, BasicBlock *InsertAtEnd) + : TerminatorInst(cast(cast(Func->getType()) + ->getElementType())->getReturnType(), + Instruction::Invoke, Name) { + Operands.reserve(3+params.size()); + Operands.push_back(Use(Func, this)); + Operands.push_back(Use((Value*)IfNormal, this)); + Operands.push_back(Use((Value*)IfException, this)); + const FunctionType *MTy = + cast(cast(Func->getType())->getElementType()); + + const FunctionType::ParamTypes &PL = MTy->getParamTypes(); + assert((params.size() == PL.size()) || + (MTy->isVarArg() && params.size() > PL.size()) && + "Calling a function with bad signature"); + + for (unsigned i = 0; i < params.size(); i++) + Operands.push_back(Use(params[i], this)); + + if (InsertAtEnd) + InsertAtEnd->getInstList().push_back(this); +} + InvokeInst::InvokeInst(const InvokeInst &CI) : TerminatorInst(CI.getType(), Instruction::Invoke) { Operands.reserve(CI.Operands.size()); @@ -146,12 +172,6 @@ return 0; } -} // End llvm namespace - -#include "llvm/Support/CallSite.h" - -namespace llvm { - Function *CallSite::getCalledFunction() const { Value *Callee = getCalledValue(); if (Function *F = dyn_cast(Callee)) @@ -160,5 +180,3 @@ return cast(CPR->getValue()); return 0; } - -} // End llvm namespace Index: llvm/lib/VMCore/iOperators.cpp diff -u llvm/lib/VMCore/iOperators.cpp:1.24 llvm/lib/VMCore/iOperators.cpp:1.25 --- llvm/lib/VMCore/iOperators.cpp:1.24 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/iOperators.cpp Thu Nov 20 11:45:12 2003 @@ -15,8 +15,7 @@ #include "llvm/Type.h" #include "llvm/Constants.h" #include "llvm/BasicBlock.h" - -namespace llvm { +using namespace llvm; //===----------------------------------------------------------------------===// // BinaryOperator Class @@ -196,5 +195,3 @@ case SetLE: return SetGE; } } - -} // End llvm namespace Index: llvm/lib/VMCore/iSwitch.cpp diff -u llvm/lib/VMCore/iSwitch.cpp:1.10 llvm/lib/VMCore/iSwitch.cpp:1.11 --- llvm/lib/VMCore/iSwitch.cpp:1.10 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/iSwitch.cpp Thu Nov 20 11:45:12 2003 @@ -13,8 +13,7 @@ #include "llvm/iTerminators.h" #include "llvm/BasicBlock.h" - -namespace llvm { +using namespace llvm; SwitchInst::SwitchInst(Value *V, BasicBlock *DefaultDest, Instruction *InsertBefore) @@ -24,6 +23,14 @@ Operands.push_back(Use(DefaultDest, this)); } +SwitchInst::SwitchInst(Value *V, BasicBlock *DefaultDest, + BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Switch, InsertAtEnd) { + assert(V && DefaultDest); + Operands.push_back(Use(V, this)); + Operands.push_back(Use(DefaultDest, this)); +} + SwitchInst::SwitchInst(const SwitchInst &SI) : TerminatorInst(Instruction::Switch) { Operands.reserve(SI.Operands.size()); @@ -50,5 +57,3 @@ assert(idx*2 < Operands.size() && "Successor index out of range!!!"); Operands.erase(Operands.begin()+idx*2, Operands.begin()+(idx+1)*2); } - -} // End llvm namespace From brukman at cs.uiuc.edu Thu Nov 20 12:08:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 12:08:02 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311201806.MAA06193@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.26 -> 1.27 --- Log message: Glib has a new bug, while cgoban works out of the box. --- Diffs of the changes: (+22 -9) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.26 llvm-www/status/index.html:1.27 --- llvm-www/status/index.html:1.26 Thu Nov 20 11:03:58 2003 +++ llvm-www/status/index.html Thu Nov 20 12:06:07 2003 @@ -45,6 +45,27 @@ + + + + + + + + + + + + + + + + @@ -140,14 +161,6 @@ editor." - Unix Seventh Edition manual, Bell Telephone Laboratories, 1979. - - - - - - - - @@ -426,7 +439,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 17:03:58 $ + Last modified: $Date: 2003/11/20 18:06:07 $ From lattner at cs.uiuc.edu Thu Nov 20 12:12:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:12:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/iTerminators.h Message-ID: <200311201811.MAA12697@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: iTerminators.h updated: 1.36 -> 1.37 --- Log message: Somehow I forgot poor little UnwindInst *sniff* --- Diffs of the changes: (+4 -3) Index: llvm/include/llvm/iTerminators.h diff -u llvm/include/llvm/iTerminators.h:1.36 llvm/include/llvm/iTerminators.h:1.37 --- llvm/include/llvm/iTerminators.h:1.36 Thu Nov 20 11:44:37 2003 +++ llvm/include/llvm/iTerminators.h Thu Nov 20 12:11:47 2003 @@ -311,6 +311,9 @@ UnwindInst(Instruction *InsertBefore = 0) : TerminatorInst(Instruction::Unwind, InsertBefore) { } + UnwindInst(BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Unwind, InsertAtEnd) { + } virtual Instruction *clone() const { return new UnwindInst(); } @@ -319,9 +322,7 @@ abort(); return 0; } - virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) { - assert(0 && "UnwindInst has no successors!"); - } + virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc); virtual unsigned getNumSuccessors() const { return 0; } // Methods for support type inquiry through isa, cast, and dyn_cast: From lattner at cs.uiuc.edu Thu Nov 20 12:13:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:13:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/iBranch.cpp Message-ID: <200311201812.MAA12867@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: iBranch.cpp updated: 1.11 -> 1.12 --- Log message: Somehow I forgot poor little UnwindInst *sniff* --- Diffs of the changes: (+4 -1) Index: llvm/lib/VMCore/iBranch.cpp diff -u llvm/lib/VMCore/iBranch.cpp:1.11 llvm/lib/VMCore/iBranch.cpp:1.12 --- llvm/lib/VMCore/iBranch.cpp:1.11 Thu Nov 20 11:45:12 2003 +++ llvm/lib/VMCore/iBranch.cpp Thu Nov 20 12:11:56 2003 @@ -23,7 +23,10 @@ assert(0 && "ReturnInst has no successors!"); } - +// Likewise for UnwindInst +void UnwindInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) { + assert(0 && "UnwindInst has no successors!"); +} BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond, Instruction *InsertBefore) From lattner at cs.uiuc.edu Thu Nov 20 12:20:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:20:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200311201819.MAA17927@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.43 -> 1.44 --- Log message: When spewing out warnings during function resolution, do not vomit out pages and pages of non-symbolic types. --- Diffs of the changes: (+8 -4) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.43 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.44 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.43 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Thu Nov 20 12:19:35 2003 @@ -82,8 +82,11 @@ if (OldMT->getParamTypes()[i]->getPrimitiveID() != ConcreteMT->getParamTypes()[i]->getPrimitiveID()) { std::cerr << "WARNING: Function [" << Old->getName() - << "]: Parameter types conflict for: '" << OldMT - << "' and '" << ConcreteMT << "'\n"; + << "]: Parameter types conflict for: '"; + WriteTypeSymbolic(std::cerr, OldMT, &M); + std::cerr << "' and '"; + WriteTypeSymbolic(std::cerr, ConcreteMT, &M); + std::cerr << "'\n"; return Changed; } @@ -227,8 +230,9 @@ if (!DontPrintWarning) { std::cerr << "WARNING: Found global types that are not compatible:\n"; for (unsigned i = 0; i < Globals.size(); ++i) { - std::cerr << "\t" << *Globals[i]->getType() << " %" - << Globals[i]->getName() << "\n"; + std::cerr << "\t"; + WriteTypeSymbolic(std::cerr, Globals[i]->getType(), &M); + std::cerr << " %" << Globals[i]->getName() << "\n"; } } From lattner at cs.uiuc.edu Thu Nov 20 12:24:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:24:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/Linker.cpp Message-ID: <200311201823.MAA19279@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: Linker.cpp updated: 1.63 -> 1.64 --- Log message: Spew symbolic types! --- Diffs of the changes: (+8 -3) Index: llvm/lib/Transforms/Utils/Linker.cpp diff -u llvm/lib/Transforms/Utils/Linker.cpp:1.63 llvm/lib/Transforms/Utils/Linker.cpp:1.64 --- llvm/lib/Transforms/Utils/Linker.cpp:1.63 Tue Nov 11 16:41:34 2003 +++ llvm/lib/Transforms/Utils/Linker.cpp Thu Nov 20 12:23:14 2003 @@ -17,11 +17,12 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/Linker.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/SymbolTable.h" -#include "llvm/DerivedTypes.h" #include "llvm/iOther.h" -#include "llvm/Constants.h" +#include "llvm/Assembly/Writer.h" namespace llvm { @@ -239,7 +240,11 @@ const Type *T1 = cast(VM.find(Name)->second); const Type *T2 = cast(DestST->lookup(Type::TypeTy, Name)); std::cerr << "WARNING: Type conflict between types named '" << Name - << "'.\n Src='" << *T1 << "'.\n Dest='" << *T2 << "'\n"; + << "'.\n Src='"; + WriteTypeSymbolic(std::cerr, T1, Src); + std::cerr << "'.\n Dest='"; + WriteTypeSymbolic(std::cerr, T2, Dest); + std::cerr << "'\n"; // Remove the symbol name from the destination. DelayedTypesToResolve.pop_back(); From lattner at cs.uiuc.edu Thu Nov 20 12:26:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:26:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/LowerSetJmp.cpp Message-ID: <200311201825.MAA19347@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: LowerSetJmp.cpp updated: 1.12 -> 1.13 --- Log message: Start using the nicer terminator auto-insertion API --- Diffs of the changes: (+4 -7) Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.12 llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.13 --- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.12 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp Thu Nov 20 12:25:19 2003 @@ -314,12 +314,11 @@ // The basic block we're going to jump to if we need to rethrow the // exception. BasicBlock* Rethrow = new BasicBlock("RethrowExcept", Func); - BasicBlock::InstListType& RethrowBlkIL = Rethrow->getInstList(); // Fill in the "Rethrow" BB with a call to rethrow the exception. This // is the last instruction in the BB since at this point the runtime // should exit this function and go to the next function. - RethrowBlkIL.push_back(new UnwindInst()); + new UnwindInst(Rethrow); return RethrowBBMap[Func] = Rethrow; } @@ -348,7 +347,7 @@ BasicBlock* DecisionBB = new BasicBlock("LJDecisionBB", Func); BasicBlock::InstListType& DecisionBBIL = DecisionBB->getInstList(); - LongJmpPreIL.push_back(new BranchInst(DecisionBB, Rethrow, Cond)); + new BranchInst(DecisionBB, Rethrow, Cond, LongJmpPre); // Fill in the "decision" basic block. CallInst* LJVal = new CallInst(GetLJValue, std::vector(), "LJVal"); @@ -357,8 +356,7 @@ CallInst(TryCatchLJ, make_vector(GetSetJmpMap(Func), 0), "SJNum"); DecisionBBIL.push_back(SJNum); - SwitchInst* SI = new SwitchInst(SJNum, Rethrow); - DecisionBBIL.push_back(SI); + SwitchInst* SI = new SwitchInst(SJNum, Rethrow, DecisionBB); return SwitchValMap[Func] = SwitchValuePair(SI, LJVal); } @@ -511,8 +509,7 @@ CallInst(IsLJException, std::vector(), "IsLJExcept"); InstList.push_back(IsLJExcept); - BranchInst* BR = new BranchInst(PrelimBBMap[Func], ExceptBB, IsLJExcept); - InstList.push_back(BR); + new BranchInst(PrelimBBMap[Func], ExceptBB, IsLJExcept, NewExceptBB); II.setExceptionalDest(NewExceptBB); ++InvokesTransformed; From lattner at cs.uiuc.edu Thu Nov 20 12:26:08 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:26:08 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp EdgeCode.cpp InstLoops.cpp Message-ID: <200311201825.MAA19358@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: CombineBranch.cpp updated: 1.6 -> 1.7 EdgeCode.cpp updated: 1.26 -> 1.27 InstLoops.cpp updated: 1.11 -> 1.12 --- Log message: Start using the nicer terminator auto-insertion API --- Diffs of the changes: (+5 -11) Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.6 llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.7 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.6 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp Thu Nov 20 12:25:21 2003 @@ -122,9 +122,7 @@ sameTarget.push_back(MI->first); BasicBlock *newBB = new BasicBlock("newCommon", MI->first->getParent()); - BranchInst *newBranch = new BranchInst(MI->second); - - newBB->getInstList().push_back(newBranch); + BranchInst *newBranch = new BranchInst(MI->second, 0, 0, newBB); std::map > phiMap; Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.26 llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.27 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.26 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp Thu Nov 20 12:25:21 2003 @@ -344,12 +344,10 @@ newBB->getInstList().push_back(newBI2); //triggerBB->getInstList().push_back(triggerInst); - Instruction *triggerBranch = new BranchInst(BB2); - triggerBB->getInstList().push_back(triggerBranch); + new BranchInst(BB2, 0, 0, triggerBB); } else{ - Instruction *newBI2=new BranchInst(BB2); - newBB->getInstList().push_back(newBI2); + new BranchInst(BB2, 0, 0, newBB); } //now iterate over BB2, and set its Phi nodes right Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.11 llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.12 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.11 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp Thu Nov 20 12:25:21 2003 @@ -145,10 +145,8 @@ ti->setSuccessor(index, newBB); BasicBlock::InstListType < = newBB->getInstList(); - - Instruction *call = new CallInst(inCountMth); - lt.push_back(call); - lt.push_back(new BranchInst(BB)); + lt.push_back(new CallInst(inCountMth)); + new BranchInst(BB, newBB); //now iterate over *vl, and set its Phi nodes right for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end(); From lattner at cs.uiuc.edu Thu Nov 20 12:26:15 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:26:15 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp LoopSimplify.cpp LowerSwitch.cpp TailRecursionElimination.cpp Message-ID: <200311201825.MAA19371@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.66 -> 1.67 LoopSimplify.cpp updated: 1.24 -> 1.25 LowerSwitch.cpp updated: 1.7 -> 1.8 TailRecursionElimination.cpp updated: 1.6 -> 1.7 --- Log message: Start using the nicer terminator auto-insertion API --- Diffs of the changes: (+15 -19) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.66 llvm/lib/Transforms/Scalar/ADCE.cpp:1.67 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.66 Sun Nov 16 15:39:27 2003 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Thu Nov 20 12:25:22 2003 @@ -302,7 +302,7 @@ // if (!AliveBlocks.count(&Func->front())) { BasicBlock *NewEntry = new BasicBlock(); - NewEntry->getInstList().push_back(new BranchInst(&Func->front())); + new BranchInst(&Func->front(), 0, 0, NewEntry); Func->getBasicBlockList().push_front(NewEntry); AliveBlocks.insert(NewEntry); // This block is always alive! LiveSet.insert(NewEntry->getTerminator()); // The branch is live @@ -432,8 +432,8 @@ // Delete the old terminator instruction... BB->getInstList().pop_back(); const Type *RetTy = Func->getReturnType(); - BB->getInstList().push_back(new ReturnInst(RetTy != Type::VoidTy ? - Constant::getNullValue(RetTy) : 0)); + new ReturnInst(RetTy != Type::VoidTy ? + Constant::getNullValue(RetTy) : 0, BB); } } Index: llvm/lib/Transforms/Scalar/LoopSimplify.cpp diff -u llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.24 llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.25 --- llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.24 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/Scalar/LoopSimplify.cpp Thu Nov 20 12:25:22 2003 @@ -153,8 +153,7 @@ BasicBlock *NewBB = new BasicBlock(BB->getName()+Suffix, BB); // The preheader first gets an unconditional branch to the loop header... - BranchInst *BI = new BranchInst(BB); - NewBB->getInstList().push_back(BI); + BranchInst *BI = new BranchInst(BB, 0, 0, NewBB); // For every PHI node in the block, insert a PHI node into NewBB where the // incoming values from the out of loop edges are moved to NewBB. We have two @@ -380,8 +379,7 @@ // Create and insert the new backedge block... BasicBlock *BEBlock = new BasicBlock(Header->getName()+".backedge", F); - Instruction *BETerminator = new BranchInst(Header); - BEBlock->getInstList().push_back(BETerminator); + BranchInst *BETerminator = new BranchInst(Header, 0, 0, BEBlock); // Move the new backedge block to right after the last backedge block. Function::iterator InsertPos = BackedgeBlocks.back(); ++InsertPos; Index: llvm/lib/Transforms/Scalar/LowerSwitch.cpp diff -u llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.7 llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.8 --- llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.7 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/Scalar/LowerSwitch.cpp Thu Nov 20 12:25:22 2003 @@ -132,8 +132,7 @@ SetCondInst* Comp = new SetCondInst(Instruction::SetLT, Val, Pivot.first, "Pivot"); NewNode->getInstList().push_back(Comp); - BranchInst* Br = new BranchInst(LBranch, RBranch, Comp); - NewNode->getInstList().push_back(Br); + new BranchInst(LBranch, RBranch, Comp, NewNode); return NewNode; } @@ -158,8 +157,7 @@ // Make the conditional branch... BasicBlock* Succ = Leaf.second; - Instruction* Br = new BranchInst(Succ, Default, Comp); - NewLeaf->getInstList().push_back(Br); + new BranchInst(Succ, Default, Comp, NewLeaf); // If there were any PHI nodes in this successor, rewrite one entry // from OrigBlock to come from NewLeaf. @@ -188,7 +186,7 @@ // If there is only the default destination, don't bother with the code below. if (SI->getNumOperands() == 2) { - CurBlock->getInstList().push_back(new BranchInst(SI->getDefaultDest())); + new BranchInst(SI->getDefaultDest(), 0, 0, CurBlock); delete SI; return; } @@ -198,7 +196,7 @@ BasicBlock* NewDefault = new BasicBlock("NewDefault"); F->getBasicBlockList().insert(Default, NewDefault); - NewDefault->getInstList().push_back(new BranchInst(Default)); + new BranchInst(Default, 0, 0, NewDefault); // If there is an entry in any PHI nodes for the default edge, make sure // to update them as well. @@ -221,7 +219,7 @@ OrigBlock, NewDefault); // Branch to our shiny new if-then stuff... - OrigBlock->getInstList().push_back(new BranchInst(SwitchBlock)); + new BranchInst(SwitchBlock, 0, 0, OrigBlock); // We are now done with the switch instruction, delete it. delete SI; Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp diff -u llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.6 llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.7 --- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.6 Tue Nov 11 16:41:34 2003 +++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp Thu Nov 20 12:25:22 2003 @@ -33,7 +33,7 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" -namespace llvm { +using namespace llvm; namespace { Statistic<> NumEliminated("tailcallelim", "Number of tail calls removed"); @@ -45,7 +45,9 @@ } // Public interface to the TailCallElimination pass -FunctionPass *createTailCallEliminationPass() { return new TailCallElim(); } +FunctionPass *llvm::createTailCallEliminationPass() { + return new TailCallElim(); +} bool TailCallElim::runOnFunction(Function &F) { @@ -74,7 +76,7 @@ // us to branch back to the old entry block. OldEntry = &F.getEntryBlock(); BasicBlock *NewEntry = new BasicBlock("tailrecurse", OldEntry); - NewEntry->getInstList().push_back(new BranchInst(OldEntry)); + new BranchInst(OldEntry, 0, 0, NewEntry); // Now that we have created a new block, which jumps to the entry // block, insert a PHI node for each argument of the function. @@ -107,5 +109,3 @@ return MadeChange; } - -} // End llvm namespace From lattner at cs.uiuc.edu Thu Nov 20 12:26:22 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:26:22 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp InlineFunction.cpp UnifyFunctionExitNodes.cpp Message-ID: <200311201825.MAA19382@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.15 -> 1.16 InlineFunction.cpp updated: 1.16 -> 1.17 UnifyFunctionExitNodes.cpp updated: 1.27 -> 1.28 --- Log message: Start using the nicer terminator auto-insertion API --- Diffs of the changes: (+7 -8) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.15 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.16 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.15 Tue Nov 11 16:41:34 2003 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Thu Nov 20 12:25:23 2003 @@ -106,8 +106,7 @@ BasicBlock *NewBB = new BasicBlock(TIBB->getName() + "." + DestBB->getName() + "_crit_edge"); // Create our unconditional branch... - BranchInst *BI = new BranchInst(DestBB); - NewBB->getInstList().push_back(BI); + new BranchInst(DestBB, 0, 0, NewBB); // Branch to the new block, breaking the edge... TI->setSuccessor(SuccNum, NewBB); Index: llvm/lib/Transforms/Utils/InlineFunction.cpp diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.16 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.17 --- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.16 Tue Nov 11 16:41:34 2003 +++ llvm/lib/Transforms/Utils/InlineFunction.cpp Thu Nov 20 12:25:23 2003 @@ -238,7 +238,7 @@ // invoke site. Once this happens, we know that the unwind would cause // a control transfer to the invoke exception destination, so we can // transform it into a direct branch to the exception destination. - BranchInst *BI = new BranchInst(InvokeDest, UI); + new BranchInst(InvokeDest, UI); // Delete the unwind instruction! UI->getParent()->getInstList().pop_back(); Index: llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp diff -u llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.27 llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.28 --- llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.27 Tue Nov 11 16:41:34 2003 +++ llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp Thu Nov 20 12:25:23 2003 @@ -61,13 +61,13 @@ UnwindBlock = UnwindingBlocks.front(); } else { UnwindBlock = new BasicBlock("UnifiedUnwindBlock", &F); - UnwindBlock->getInstList().push_back(new UnwindInst()); + new UnwindInst(UnwindBlock); for (std::vector::iterator I = UnwindingBlocks.begin(), E = UnwindingBlocks.end(); I != E; ++I) { BasicBlock *BB = *I; BB->getInstList().pop_back(); // Remove the return insn - BB->getInstList().push_back(new BranchInst(UnwindBlock)); + new BranchInst(UnwindBlock, 0, 0, BB); } } @@ -91,10 +91,10 @@ // If the function doesn't return void... add a PHI node to the block... PN = new PHINode(F.getReturnType(), "UnifiedRetVal"); NewRetBlock->getInstList().push_back(PN); - NewRetBlock->getInstList().push_back(new ReturnInst(PN)); + new ReturnInst(PN, NewRetBlock); } else { // If it returns void, just add a return void instruction to the block - NewRetBlock->getInstList().push_back(new ReturnInst()); + new ReturnInst(0, NewRetBlock); } // Loop over all of the blocks, replacing the return instruction with an @@ -109,7 +109,7 @@ if (PN) PN->addIncoming(BB->getTerminator()->getOperand(0), BB); BB->getInstList().pop_back(); // Remove the return insn - BB->getInstList().push_back(new BranchInst(NewRetBlock)); + new BranchInst(NewRetBlock, 0, 0, BB); } ReturnBlock = NewRetBlock; return true; From lattner at cs.uiuc.edu Thu Nov 20 12:26:30 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 12:26:30 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Message-ID: <200311201825.MAA19389@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.36 -> 1.37 --- Log message: Start using the nicer terminator auto-insertion API --- Diffs of the changes: (+1 -1) Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.36 llvm/lib/VMCore/BasicBlock.cpp:1.37 --- llvm/lib/VMCore/BasicBlock.cpp:1.36 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/BasicBlock.cpp Thu Nov 20 12:25:24 2003 @@ -243,7 +243,7 @@ } while (Inst != &*I); // Loop until we move the specified instruction. // Add a branch instruction to the newly formed basic block. - InstList.push_back(new BranchInst(New)); + new BranchInst(New, 0, 0, this); // Now we must loop through all of the successors of the New block (which // _were_ the successors of the 'this' block), and update any PHI nodes in From lattner at cs.uiuc.edu Thu Nov 20 13:06:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 13:06:02 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-11-20-Bitfields.c Message-ID: <200311201905.NAA23024@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-11-20-Bitfields.c added (r1.1) --- Log message: New testcase for PR141 --- Diffs of the changes: (+10 -0) Index: llvm/test/Regression/CFrontend/2003-11-20-Bitfields.c diff -c /dev/null llvm/test/Regression/CFrontend/2003-11-20-Bitfields.c:1.1 *** /dev/null Thu Nov 20 13:05:32 2003 --- llvm/test/Regression/CFrontend/2003-11-20-Bitfields.c Thu Nov 20 13:05:21 2003 *************** *** 0 **** --- 1,10 ---- + struct face_cachel { + unsigned int reverse :1; + unsigned char font_specified[1]; + }; + + void + ensure_face_cachel_contains_charset (struct face_cachel *cachel) { + cachel->font_specified[0] = 0; + } + From brukman at cs.uiuc.edu Thu Nov 20 13:09:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 13:09:01 2003 Subject: [llvm-commits] CVS: llvm/tools/gccld/Linker.cpp gccld.h Message-ID: <200311201908.NAA23113@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: Linker.cpp updated: 1.17 -> 1.18 gccld.h updated: 1.5 -> 1.6 --- Log message: Add ability to search only for native shared object, and expose the functionality to the rest of gccld. --- Diffs of the changes: (+9 -7) Index: llvm/tools/gccld/Linker.cpp diff -u llvm/tools/gccld/Linker.cpp:1.17 llvm/tools/gccld/Linker.cpp:1.18 --- llvm/tools/gccld/Linker.cpp:1.17 Sun Nov 16 17:07:13 2003 +++ llvm/tools/gccld/Linker.cpp Thu Nov 20 13:08:06 2003 @@ -39,8 +39,9 @@ /// named by the value of the environment variable LLVM_LIB_SEARCH_PATH. Returns /// an empty string if no matching file can be found. /// -static std::string FindLib(const std::string &Filename, - const std::vector &Paths) { +std::string FindLib(const std::string &Filename, + const std::vector &Paths, + bool SharedObjectOnly) { // Determine if the pathname can be found as it stands. if (FileOpenable(Filename)) return Filename; @@ -53,13 +54,13 @@ for (unsigned Index = 0; Index != Paths.size(); ++Index) { std::string Directory = Paths[Index] + "/"; - if (FileOpenable(Directory + LibName + ".bc")) + if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".bc")) return Directory + LibName + ".bc"; if (FileOpenable(Directory + LibName + ".so")) return Directory + LibName + ".so"; - if (FileOpenable(Directory + LibName + ".a")) + if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".a")) return Directory + LibName + ".a"; } @@ -98,9 +99,6 @@ /// Outputs: /// UndefinedSymbols - A set of C++ strings containing the name of all /// undefined symbols. -/// -/// Return value: -/// None. /// void GetAllUndefinedSymbols(Module *M, std::set &UndefinedSymbols) { Index: llvm/tools/gccld/gccld.h diff -u llvm/tools/gccld/gccld.h:1.5 llvm/tools/gccld/gccld.h:1.6 --- llvm/tools/gccld/gccld.h:1.5 Tue Nov 11 16:41:34 2003 +++ llvm/tools/gccld/gccld.h Thu Nov 20 13:08:06 2003 @@ -58,6 +58,10 @@ std::auto_ptr LoadObject (const std::string & FN, std::string &OutErrorMessage); +std::string FindLib(const std::string &Filename, + const std::vector &Paths, + bool SharedObjectOnly = false); + bool LinkLibraries (const char * progname, Module * HeadModule, From brukman at cs.uiuc.edu Thu Nov 20 13:09:09 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 13:09:09 2003 Subject: [llvm-commits] CVS: llvm/tools/gccld/gccld.cpp Message-ID: <200311201908.NAA23133@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: gccld.cpp updated: 1.63 -> 1.64 --- Log message: When writing out the runner script, add -load= lines to pull in all the shared objects automagically, so it doesn't have to be done by hand. --- Diffs of the changes: (+18 -1) Index: llvm/tools/gccld/gccld.cpp diff -u llvm/tools/gccld/gccld.cpp:1.63 llvm/tools/gccld/gccld.cpp:1.64 --- llvm/tools/gccld/gccld.cpp:1.63 Thu Nov 20 00:21:54 2003 +++ llvm/tools/gccld/gccld.cpp Thu Nov 20 13:08:42 2003 @@ -281,7 +281,24 @@ if (!Out2.good()) return PrintAndReturn(argv[0], "error opening '" + OutputFilename + "' for writing!"); - Out2 << "#!/bin/sh\nlli $0.bc $*\n"; + Out2 << "#!/bin/sh\nlli \\\n"; + // gcc accepts -l and implicitly searches /lib and /usr/lib. + LibPaths.push_back("/lib"); + LibPaths.push_back("/usr/lib"); + // We don't need to link in libc! In fact, /usr/lib/libc.so may not be a + // shared object at all! See RH 8: plain text. + std::vector::iterator libc = + std::find(Libraries.begin(), Libraries.end(), "c"); + if (libc != Libraries.end()) Libraries.erase(libc); + // List all the shared object (native) libraries this executable will need + // on the command line, so that we don't have to do this manually! + for (std::vector::iterator i = Libraries.begin(), + e = Libraries.end(); i != e; ++i) { + std::string FullLibraryPath = FindLib(*i, LibPaths, true); + if (!FullLibraryPath.empty()) + Out2 << " -load=" << FullLibraryPath << " \\\n"; + } + Out2 << " $0.bc $*\n"; Out2.close(); } From lattner at cs.uiuc.edu Thu Nov 20 13:12:06 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 13:12:06 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311201911.NAA23373@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.54 -> 1.55 --- Log message: Bug fix --- Diffs of the changes: (+2 -2) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.54 llvm/docs/ReleaseNotes.html:1.55 --- llvm/docs/ReleaseNotes.html:1.54 Wed Nov 19 19:07:41 2003 +++ llvm/docs/ReleaseNotes.html Thu Nov 20 13:11:47 2003 @@ -167,7 +167,7 @@
      • bugpoint must not pass -R to Mach-O linker
      • crash assigning into an array in a struct which contains a bitfield.
      • Oversized integer bitfields cause crash
      • - +
      • [llvm-gcc] Bitfields & large array don't mix well
      • At this time, LLVM is known to work properly with SPEC CPU 2000, the Olden @@ -468,6 +468,6 @@ Maintained By: The LLVM Team
        -Last modified: Wed Nov 19 19:06:03 CST 2003 +Last modified: Thu Nov 20 13:08:18 CST 2003 From lattner at cs.uiuc.edu Thu Nov 20 13:13:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 13:13:00 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311201912.NAA23535@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.40 -> 1.41 --- Log message: Bug fix --- Diffs of the changes: (+2 -1) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.40 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.41 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.40 Wed Nov 19 19:07:47 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Thu Nov 20 13:11:55 2003 @@ -268,6 +268,7 @@

      • Oversized integer bitfields cause crash.

        +

      • [llvm-gcc] Bitfields & large array don't mix well
      • .

        Notes:

          @@ -528,6 +529,6 @@ Maintained By: The LLVM Team
          -Last modified: Wed Nov 19 19:06:48 CST 2003 +Last modified: Thu Nov 20 13:08:35 CST 2003 From lattner at cs.uiuc.edu Thu Nov 20 13:28:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 13:28:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-11-20-ComplexDivision.c Message-ID: <200311201927.NAA15031@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-11-20-ComplexDivision.c added (r1.1) --- Log message: New testcase for PR132 --- Diffs of the changes: (+5 -0) Index: llvm/test/Regression/CFrontend/2003-11-20-ComplexDivision.c diff -c /dev/null llvm/test/Regression/CFrontend/2003-11-20-ComplexDivision.c:1.1 *** /dev/null Thu Nov 20 13:27:23 2003 --- llvm/test/Regression/CFrontend/2003-11-20-ComplexDivision.c Thu Nov 20 13:27:12 2003 *************** *** 0 **** --- 1,5 ---- + int test() { + __complex__ double C; + double D; + C / D; + } From lattner at cs.uiuc.edu Thu Nov 20 13:31:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 13:31:02 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311201930.NAA22642@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.55 -> 1.56 --- Log message: Bug --- Diffs of the changes: (+2 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.55 llvm/docs/ReleaseNotes.html:1.56 --- llvm/docs/ReleaseNotes.html:1.55 Thu Nov 20 13:11:47 2003 +++ llvm/docs/ReleaseNotes.html Thu Nov 20 13:30:17 2003 @@ -168,6 +168,7 @@

        • crash assigning into an array in a struct which contains a bitfield.
        • Oversized integer bitfields cause crash
        • [llvm-gcc] Bitfields & large array don't mix well
        • +
        • [llvm-gcc] Complex division is not supported
        • At this time, LLVM is known to work properly with SPEC CPU 2000, the Olden @@ -468,6 +469,6 @@ Maintained By: The LLVM Team
          -Last modified: Thu Nov 20 13:08:18 CST 2003 +Last modified: Thu Nov 20 13:29:14 CST 2003 From lattner at cs.uiuc.edu Thu Nov 20 13:31:09 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 13:31:09 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311201930.NAA23063@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.41 -> 1.42 --- Log message: bug --- Diffs of the changes: (+3 -1) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.41 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.42 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.41 Thu Nov 20 13:11:55 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Thu Nov 20 13:30:23 2003 @@ -270,6 +270,8 @@

        • [llvm-gcc] Bitfields & large array don't mix well
        • .

          +

        • [llvm-gcc] Complex division is not supported
        • +

        Notes:

        • Inline assembly is not yet supported.

          @@ -529,6 +531,6 @@ Maintained By: The LLVM Team
          -Last modified: Thu Nov 20 13:08:35 CST 2003 +Last modified: Thu Nov 20 13:29:52 CST 2003 From gaeke at cs.uiuc.edu Thu Nov 20 13:52:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 13:52:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2003-11-08-ArrayAddress.cpp.tr Message-ID: <200311201951.NAA12729@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2003-11-08-ArrayAddress.cpp.tr updated: 1.1 -> 1.2 --- Log message: Fix0r a test that mistakenly used %llvmg++ instead of %llvmgxx. --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/C++Frontend/2003-11-08-ArrayAddress.cpp.tr diff -u llvm/test/Regression/C++Frontend/2003-11-08-ArrayAddress.cpp.tr:1.1 llvm/test/Regression/C++Frontend/2003-11-08-ArrayAddress.cpp.tr:1.2 --- llvm/test/Regression/C++Frontend/2003-11-08-ArrayAddress.cpp.tr:1.1 Sat Nov 8 17:00:49 2003 +++ llvm/test/Regression/C++Frontend/2003-11-08-ArrayAddress.cpp.tr Thu Nov 20 13:51:11 2003 @@ -1,4 +1,4 @@ -// RUN: %llvmg++ -xc++ %s -c -o - | llvm-dis | grep getelementptr +// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep getelementptr struct foo { int array[100]; From gaeke at cs.uiuc.edu Thu Nov 20 13:56:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 13:56:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200311201955.NAA18561@zion.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.21 -> 1.22 --- Log message: In the TestRunner class, don't call "sed", and get rid of extra blanks. --- Diffs of the changes: (+43 -57) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.21 llvm/test/QMTest/llvm.py:1.22 --- llvm/test/QMTest/llvm.py:1.21 Tue Oct 21 17:56:07 2003 +++ llvm/test/QMTest/llvm.py Thu Nov 20 13:55:40 2003 @@ -21,6 +21,8 @@ import qm.fields import os +import string +import re import filecmp import resource @@ -818,26 +820,38 @@ description='Name of script to execute via TestRunner'), ] + # extractScript - Extract RUN: lines from file named + # inputFilename, and write them into outputFilename, making + # substitutions specified by extractEnv. + # + def extractScript (self, inputFilename, outputFilename, extractEnv): + inFile = file (inputFilename) + outFile = file (outputFilename, 'w') + pat = re.compile ("^.*RUN:(.*)$") + for inLine in inFile.readlines (): + mat = pat.match (inLine) + if mat: + outLine = mat.group (1) + for var, val in extractEnv.items (): + outLine = re.sub ('%' + var, val, \ + outLine) + outFile.write (outLine + "\n") + outFile.close () + inFile.close () - def Run (self, context, result): - # + def Run (self, context, result): # Set the core dump size - # - coresize=int(context['coresize']) + coresize = int(context['coresize']) resource.setrlimit (resource.RLIMIT_CORE, (coresize,coresize)) - # # Fetch the source and build root directories from the context. - # - srcroot=context['srcroot'] - buildroot=context['buildroot'] - tmpdir=context['tmpdir'] - buildtype=context['buildtype'] + srcroot = context['srcroot'] + buildroot = context['buildroot'] + tmpdir = context['tmpdir'] + buildtype = context['buildtype'] - # # Create a new directory based upon the test's name. - # tmpdir = tmpdir + '/tr' + os.path.basename (self.srcfile) if ((os.access(tmpdir,os.F_OK)) == 0): try: @@ -846,52 +860,30 @@ result.Fail ('Failed to make ' + tmpdir) return - # - # Construct the pathname of the source file and output script - # file. - # - srcfile=srcroot + '/' + self.srcfile + # Construct the pathnames of the source, output, and + # script files. + srcfile = srcroot + '/' + self.srcfile scriptfile = tmpdir + '/testscript.' + os.path.basename (srcfile) - outputfile = tmpdir + '/testscript.' + os.path.basename (srcfile) + '.out' + outputfile = scriptfile + '.out' - # # Construct a new path that includes the LLVM tools. - # - environment=os.environ - oldpath=environment['PATH'] + environment = os.environ + oldpath = environment['PATH'] environment['PATH'] = buildroot + '/tools/' + buildtype + ':' + srcroot + '/test/Scripts:' + environment['PATH'] environment['QMV_llvmgcc'] = context['llvmgcc'] - # - # Create the script that will run the test. - # - exstatus=os.spawnlp (os.P_WAIT, 'sed', - 'sed', - '-n', - '-e', - '/RUN:/!d;', - '-e', - '/RUN:/s|^.*RUN:\(.*\)$|\\1|g;', - '-e', - 's|%s|' + srcfile + '|g;', - '-e', - 's|%t|' + scriptfile + '.tmp|g;', - '-e', - 's|%llvmgcc|' + context['llvmgcc'] + '|g;', - '-e', - 's|%llvmgxx|' + context['llvmgxx'] + '|g;', - '-e', - 'w ' + scriptfile, - srcfile) - - if (exstatus != 0): - result.Fail('The sed script failed') - environment['PATH'] = oldpath - return + # Extract the RUN: script (making the following substitutions:) + extractEnv = { 's': srcfile, + 't': scriptfile + '.tmp', + 'llvmgcc': context['llvmgcc'], + 'llvmgxx': context['llvmgxx'] } + try: + self.extractScript (srcfile, scriptfile, extractEnv) + except EnvironmentError: + result.Fail ('Failed to extract script from ' + srcfile) + return - # # Execute the script using TestRunner. - # mypath = os.getcwd () os.chdir (tmpdir) if (ExecProgram (('/bin/sh', scriptfile), environment, outputfile)): @@ -899,14 +891,8 @@ os.chdir (mypath) - # - # Restore the PATH environment variable - # + # Restore the PATH environment variable and return. environment['PATH'] = oldpath - - # - # Return to the caller. - # return From gaeke at cs.uiuc.edu Thu Nov 20 13:58:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 13:58:01 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200311201957.NAA19720@zion.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.49 -> 1.50 --- Log message: Blow away compiled versions of qmtest classes on 'make clean'. --- Diffs of the changes: (+2 -0) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.49 llvm/test/Makefile:1.50 --- llvm/test/Makefile:1.49 Wed Nov 19 15:13:25 2003 +++ llvm/test/Makefile Thu Nov 20 13:57:17 2003 @@ -99,4 +99,6 @@ clean:: $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp + $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \ + $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo From brukman at cs.uiuc.edu Thu Nov 20 14:52:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 14:52:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311202051.OAA15486@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.27 -> 1.28 --- Log message: XEmacs has a new bug to track. --- Diffs of the changes: (+9 -9) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.27 llvm-www/status/index.html:1.28 --- llvm-www/status/index.html:1.27 Thu Nov 20 12:06:07 2003 +++ llvm-www/status/index.html Thu Nov 20 14:51:23 2003 @@ -45,6 +45,14 @@

        + + + + + + + + @@ -66,14 +74,6 @@ - - - - - - - - - + @@ -439,7 +439,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 20:51:23 $ + Last modified: $Date: 2003/11/20 20:53:32 $ From lattner at cs.uiuc.edu Thu Nov 20 14:58:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 14:58:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-11-20-UnionBitfield.c Message-ID: <200311202057.OAA20420@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-11-20-UnionBitfield.c added (r1.1) --- Log message: New testcase for PR143 --- Diffs of the changes: (+10 -0) Index: llvm/test/Regression/CFrontend/2003-11-20-UnionBitfield.c diff -c /dev/null llvm/test/Regression/CFrontend/2003-11-20-UnionBitfield.c:1.1 *** /dev/null Thu Nov 20 14:57:43 2003 --- llvm/test/Regression/CFrontend/2003-11-20-UnionBitfield.c Thu Nov 20 14:57:33 2003 *************** *** 0 **** --- 1,10 ---- + struct printf_spec { + unsigned int minus_flag:1; + char converter; + }; + + void parse_doprnt_spec () { + struct printf_spec spec; + spec.minus_flag = 1; + } + From lattner at cs.uiuc.edu Thu Nov 20 14:58:09 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 14:58:09 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311202057.OAA20593@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.29 -> 1.30 --- Log message: I beg to differ --- Diffs of the changes: (+2 -2) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.29 llvm-www/status/index.html:1.30 --- llvm-www/status/index.html:1.29 Thu Nov 20 14:53:32 2003 +++ llvm-www/status/index.html Thu Nov 20 14:57:42 2003 @@ -51,7 +51,7 @@ - + @@ -439,7 +439,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 20:53:32 $ + Last modified: $Date: 2003/11/20 20:57:42 $ From lattner at cs.uiuc.edu Thu Nov 20 15:01:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 15:01:01 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311202100.PAA20973@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.56 -> 1.57 --- Log message: Bug --- Diffs of the changes: (+2 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.56 llvm/docs/ReleaseNotes.html:1.57 --- llvm/docs/ReleaseNotes.html:1.56 Thu Nov 20 13:30:17 2003 +++ llvm/docs/ReleaseNotes.html Thu Nov 20 14:59:57 2003 @@ -169,6 +169,7 @@
      • Oversized integer bitfields cause crash
      • [llvm-gcc] Bitfields & large array don't mix well
      • [llvm-gcc] Complex division is not supported
      • +
      • [llvm-gcc] Illegal union field reference
      • At this time, LLVM is known to work properly with SPEC CPU 2000, the Olden @@ -469,6 +470,6 @@ Maintained By: The LLVM Team
        -Last modified: Thu Nov 20 13:29:14 CST 2003 +Last modified: Thu Nov 20 14:59:29 CST 2003 From lattner at cs.uiuc.edu Thu Nov 20 15:01:09 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 15:01:09 2003 Subject: [llvm-commits] CVS: llvm-www/releases/1.0/docs/ReleaseNotes.html Message-ID: <200311202100.PAA20983@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.0/docs: ReleaseNotes.html updated: 1.42 -> 1.43 --- Log message: Bug bug Bug --- Diffs of the changes: (+4 -1) Index: llvm-www/releases/1.0/docs/ReleaseNotes.html diff -u llvm-www/releases/1.0/docs/ReleaseNotes.html:1.42 llvm-www/releases/1.0/docs/ReleaseNotes.html:1.43 --- llvm-www/releases/1.0/docs/ReleaseNotes.html:1.42 Thu Nov 20 13:30:23 2003 +++ llvm-www/releases/1.0/docs/ReleaseNotes.html Thu Nov 20 15:00:03 2003 @@ -272,6 +272,9 @@

      • [llvm-gcc] Complex division is not supported
      • +

      • [llvm-gcc] Illegal union field reference
      • + + Notes:

        • Inline assembly is not yet supported.

          @@ -531,6 +534,6 @@ Maintained By: The LLVM Team
          -Last modified: Thu Nov 20 13:29:52 CST 2003 +Last modified: Thu Nov 20 14:59:46 CST 2003 From lattner at cs.uiuc.edu Thu Nov 20 15:05:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 15:05:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/2003-11-20-BogusResolveWarning.ll Message-ID: <200311202104.PAA21737@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2003-11-20-BogusResolveWarning.ll added (r1.1) --- Log message: Fix an all too common form of the 'Found global types that are not compatible' warning --- Diffs of the changes: (+10 -0) Index: llvm/test/Regression/Transforms/FunctionResolve/2003-11-20-BogusResolveWarning.ll diff -c /dev/null llvm/test/Regression/Transforms/FunctionResolve/2003-11-20-BogusResolveWarning.ll:1.1 *** /dev/null Thu Nov 20 15:04:45 2003 --- llvm/test/Regression/Transforms/FunctionResolve/2003-11-20-BogusResolveWarning.ll Thu Nov 20 15:04:35 2003 *************** *** 0 **** --- 1,10 ---- + ; RUN: llvm-as < %s | opt -funcresolve -disable-output 2>&1 | not grep WARNING + + + void %test() { + call int(...)* %test() + ret void + } + + declare int %test(...) + From brukman at cs.uiuc.edu Thu Nov 20 15:09:03 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 15:09:03 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311202108.PAA26592@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.30 -> 1.31 --- Log message: XEmacs is getting closer to working, with xboard you no longer need to manually specify libraries. --- Diffs of the changes: (+21 -24) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.30 llvm-www/status/index.html:1.31 --- llvm-www/status/index.html:1.30 Thu Nov 20 14:57:42 2003 +++ llvm-www/status/index.html Thu Nov 20 15:07:55 2003 @@ -45,13 +45,29 @@

        + + + + + + + + - + @@ -81,8 +97,7 @@ - + @@ -130,7 +145,8 @@ - + @@ -375,25 +391,6 @@ - - - - - - - - + + + + + + + + + + + + + + + + @@ -126,7 +146,7 @@ - + @@ -381,26 +401,6 @@ - - - - - - - - - - - - - - - - @@ -435,7 +435,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/21 05:13:20 $ + Last modified: $Date: 2003/11/21 23:26:28 $ From brukman at cs.uiuc.edu Fri Nov 21 17:35:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 17:35:02 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311212334.RAA12890@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.34 -> 1.35 --- Log message: No, really, screen *DOES* in fact work! --- Diffs of the changes: (+2 -2) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.34 llvm-www/status/index.html:1.35 --- llvm-www/status/index.html:1.34 Fri Nov 21 17:26:28 2003 +++ llvm-www/status/index.html Fri Nov 21 17:34:12 2003 @@ -60,7 +60,7 @@ href="http://www.gnu.org/software/screen/">screen - + @@ -435,7 +435,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/21 23:26:28 $ + Last modified: $Date: 2003/11/21 23:34:12 $ From brukman at cs.uiuc.edu Fri Nov 21 17:50:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 17:50:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp Message-ID: <200311212349.RAA12967@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcV9CodeEmitter.cpp updated: 1.44 -> 1.45 --- Log message: * Add code to flush the ICache, which any self-respecting SMC must do * Restore registers *after* everything else to avoid any possible side effects This fixes McCat-imp. --- Diffs of the changes: (+8 -5) Index: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp diff -u llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.44 llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.45 --- llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.44 Wed Nov 12 18:23:05 2003 +++ llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp Fri Nov 21 17:48:54 2003 @@ -380,18 +380,21 @@ // Overwrite it TheJITResolver->insertJumpAtAddr(Target, CodeBegin); - RestoreRegisters(DoubleFP, FSR, FPRS, CCR); + // Flush the I-Cache: FLUSH clears out a doubleword at a given address + // Self-modifying code MUST clear out the I-Cache to be portable +#if defined(sparc) || defined(__sparc__) || defined(__sparcv9) + for (int i = -Offset, e = 32-((int64_t)Offset); i < e; i += 8) + __asm__ __volatile__ ("flush %%i7 + %0" : : "r" (i)); +#endif // Change the return address to re-execute the restore, then the jump. - // However, we can't just modify %i7 here, because we return to the function - // that will restore the floating-point registers for us. Thus, we just return - // the value we want it to be, and the parent will take care of setting %i7 - // correctly. DEBUG(std::cerr << "Callback returning to: 0x" << std::hex << (CameFrom-Offset-12) << "\n"); #if defined(sparc) || defined(__sparc__) || defined(__sparcv9) __asm__ __volatile__ ("sub %%i7, %0, %%i7" : : "r" (Offset+12)); #endif + + RestoreRegisters(DoubleFP, FSR, FPRS, CCR); } /// emitStubForFunction - This method is used by the JIT when it needs to emit From brukman at cs.uiuc.edu Fri Nov 21 18:35:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 18:35:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/External/SPEC/CINT2000/Makefile Message-ID: <200311220034.SAA13157@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/External/SPEC/CINT2000: Makefile updated: 1.10 -> 1.11 --- Log message: Our SPARCs have finally figured out how to enforce CPU time limit. They still don't work with crafty though. --- Diffs of the changes: (+0 -5) Index: llvm/test/Programs/External/SPEC/CINT2000/Makefile diff -u llvm/test/Programs/External/SPEC/CINT2000/Makefile:1.10 llvm/test/Programs/External/SPEC/CINT2000/Makefile:1.11 --- llvm/test/Programs/External/SPEC/CINT2000/Makefile:1.10 Fri Oct 31 11:00:04 2003 +++ llvm/test/Programs/External/SPEC/CINT2000/Makefile Fri Nov 21 18:34:37 2003 @@ -16,9 +16,4 @@ # Get the $(ARCH) setting include $(LEVEL)/Makefile.config -# Disable crafty until it stops infinite-looping on Sparc -ifeq ($(ARCH), Sparc) -PARALLEL_DIRS := $(filter-out 186.crafty, $(PARALLEL_DIRS)) -endif - include ${LEVEL}/test/Programs/Makefile.programs From brukman at cs.uiuc.edu Fri Nov 21 18:39:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 18:39:01 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311220038.SAA18026@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.58 -> 1.59 --- Log message: * Use stylesheets * Close
      • , , and

        tags --- Diffs of the changes: (+305 -191) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.58 llvm/docs/ReleaseNotes.html:1.59 --- llvm/docs/ReleaseNotes.html:1.58 Fri Nov 21 16:11:12 2003 +++ llvm/docs/ReleaseNotes.html Fri Nov 21 18:38:41 2003 @@ -1,16 +1,21 @@ - -LLVM 1.1 Release Notes - - -

      • + + Site Map: + + +
        + + Download! +
        + Download now: + LLVM 1.0
        + +
        + Try the:
        + online demo
        +
        + + View the open-source
        + license +
        + +
        + + Status Updates + + +
        + + Maintained by:
        Chris + Lattner
        + + +
        Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.88 llvm-www/www-index.html:1.89 --- llvm-www/www-index.html:1.88 Tue Nov 18 11:03:51 2003 +++ llvm-www/www-index.html Tue Nov 18 17:04:53 2003 @@ -1,31 +1,12 @@ - - - - The LLVM Compiler Infrastructure Project - - - - - -
        - The LLVM Compiler Infrastructure -
        - -
        + - - - - - - - -
        + - - - - - - - - - - - - - - - - - - - - - - - - - -
        + +
        LLVM Overview
        -
        Overview
        Low Level Virtual Machine (LLVM) is:
        1. A compilation strategy - Fundamentally, LLVM is a @@ -72,393 +53,55 @@ of Computer Science at the University of Illinois, Urbana-Champaign.

          -
        Funding
        - This work is sponsored by the - NSF Next Generation Software - program through grants EIA-0093426 (an NSF CAREER - award) and EIA-0103756. It is also supported in part by the - NSF Operating Systems and Compilers program (grant - #CCR-9988482), by the NSF Embedded Systems program (grant - #CCR-0209202), and by the MARCO/DARPA Gigascale Systems Research - Center (GSRC).

        -

        Publications & - Papers
        -
          -
        1. " - LLVA: A Low-level Virtual Instruction Set - Architecture"
          Vikram Adve, Chris Lattner, - Michael Brukman, Anand Shukla, and Brian Gaeke. - Proc. - of the 36th annual ACM/IEEE international symposium on - Microarchitecture (MICRO-36), San Diego, CA, - December 2003. - -
        2. " - LLVM: A Compilation Framework for Lifelong Program - Analysis & Transformation", - Chris Lattner & Vikram Adve.
          - Technical Report #UIUCDCS-R-2003-2380, Computer Science - Dept., Univ. of Illinois, Sep. 2003. -
        3. " - Memory Safety Without Runtime Checks or Garbage - Collection"
          - Dinakar Dhurjati, Sumant Kowshik, Vikram Adve and - Chris Lattner. - Proc. Languages Compilers and Tools for - Embedded Systems 2003 (LCTES 03), San Diego, - CA, June 2003.
        4. -
        5. "Architecture - For a Next-Generation GCC"
          - Chris Lattner & Vikram Adve, - First - Annual GCC Developers' Summit, - Ottawa, Canada, May 2003.
          -
        6. -
        7. "Data - Structure Analysis: An Efficient Context-Sensitive - Heap Analysis"
          - Chris Lattner & Vikram Adve, Technical - Report #UIUCDCS-R-2003-2340, Computer - Science Dept., Univ. of Illinois, - Apr. 2003.
          -
        8. -
        9. "LLVM: - An Infrastructure for Multi-Stage - Optimization"
          - Chris Lattner. Masters Thesis, Dec. 2002
        10. -
        11. " - Ensuring - Code Safety Without Runtime Checks for - Real-Time Control Systems"
          - Sumant Kowshik, Dinakar Dhurjati, and - Vikram Adve. Proc. Int'l Conf. on - Compilers, Architecture and Synthesis for - Embedded Systems (CASES02), Grenoble, - France, Oct. 2002.
        12. -
        13. "The - LLVM Instruction Set and Compilation - Strategy"
          - Chris Lattner & Vikram Adve, Technical - Report #UIUCDCS-R-2002-2292, Computer - Science Dept., Univ. of Illinois, - Aug. 2002.
          -
        14. -
        15. "Automatic - Pool Allocation for Disjoint Data - Structures,"
          - Chris Lattner & Vikram Adve, ACM - SIGPLAN Workshop on Memory System - Performance (MSP), - Berlin, Germany, June 2002.
          -
        16. -

        -

        Ongoing Research -
        - Our group is participating in several ongoing research - projects, all of which are based on LLVM: -
          -
        • - Low Level Virtual Architecture (LLVA): - A Virtual Instruction Set Computer (VISC) architecture - decouples the external instruction set (V-ISA) seen by - all external software from the (possibly - implementation-specific) hardware ISA used by a - particular processor implementation (I-ISA). We - believe that a variant of LLVM (which we call Low - Level Virtual Architecture, or LLVA) could be a - powerful design choice for a V-ISA in such processor - designs. - We are exploring the architecture, compiler, - and operating system benefits of processor designs - based on LLVA as the virtual ISA.
        • -
        • - SAFECode: SAFECode is a - compiler-based system for enforcing program - safety. SAFECode uses LLVM as its code - representation.
        • -
        • Macroscopic data structure - analysis and transformations: - Analyzing and optimizing entire linked - data structures, based on two supporting techniques: - Data Structure Analysis (DSA) and - Automatic Pool Allocation. - DSA gives compilers extensive - static information about the structure, instances, - and lifetime of entire logical data structures. - Pool Allocation gives compilers detailed control over - the layout of such data structures in the heap. - The DSA pass is included in Release 1.0. -
        • -
        • Runtime optimization on - general-purpose processors: - We are developing techniques for optimizing ordinary - at runtime, by exploiting the LLVM instruction - set and compiler architecture in ways that would not - be possible with ordinary static compilation. - Our tracing and optimization strategy are described - in the section titled - Current Development. -
        • -
        -
        +
        + + + + - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
        Public LLVM Release!
        - The current version of LLVM is 1.0 is now available for download! LLVM is - publicly available under the OSI-certified University of Illinois - Open-Source License. See answers to common - licensing questions.

        News
        - - - - - - -
        Oct 24, 2003-The LLVM 1.0 release is now -available for download.

        - - Status Updates: -

        -
        (older news)

        -

        Documentation
        - LLVM Design: - - - - LLVM User Guides: - -
          -
        • - The LLVM Getting Started Guide - - - Discusses how to get up and running - quickly with the LLVM infrastructure. - Everything from unpacking and - compilation of the distribution to - execution of some tools.
        • - -
        • LLVM Command Guide - - A reference manual for the LLVM command line - utilities ("man" pages for LLVM tools).
        • - -
        • LLVM Project Guide - - How-to guide and templates for new - projects that use the LLVM infrastructure. - The templates (directory organization, Makefiles, - and test tree) allow the project code to be located - outside (or inside) the llvm/ tree, - while using LLVM header files and libraries.
        • - -
        • How to Submit A Bug - Report - Instructions for properly submitting information - about any bugs you run into in the LLVM system.
        • - -
        • LLVM Test Suite Guide - - A reference manual for using the LLVM test suite.
        • - -
        • How to build the C/C++ - front-end - Instructions for building the front-end - from source.
        • -
        - - Programming Documentation: - - - - Support: -

        -

        Current Development -
        - The LLVM infrastructure underlies many ongoing - research projects in our group. Some key additional - components of the system that are being developed in these - projects include: -
          -
        • Automatic Pool Allocation: - A fully automatic program transformation that introduces - region-based memory management in a novel manner: - it partitions the heap into separate regions for distinct - instances of logical data structures (such as a tree or - a hash table). -
        • -
        • A Software Scheme for Online - Tracing: We have developed a tracing scheme that - identifies frequently executed program paths at runtime, - and optionally extracts these paths into a software-managed - trace cache. This currently only works for Sparc code. -
        • -
        • Transparent runtime optimization on - general-purpose processors: - We are developing a transparent trace-based runtime - optimization system that operates on LLVM traces at runtime, - using the software tracing mechanism and trace cache above. -
        • -
        -
        -
         
        The page is maintained by Chris - Lattner. Please let me know if - you have any comments/requests/suggestions/criticisms. + + +
        Public LLVM Release!
        + +

        + The current version of LLVM is 1.0 is now available for + download! LLVM is publicly available under the OSI-certified University of Illinois Open-Source + License. See answers to common + licensing questions.

        + +

        + + +
        Try out LLVM in your browser
        + +

        If you'd like to experiment with LLVM, but don't want to download it and + compile it, we've got just the thing for you. You can now compile C and C++ + in your browser, to see what the LLVM representation + looks like, to see what various C/C++ constructs map to in LLVM, and try out + some of the optimizers.

        + +

        + + +
        Funding
        +

        + + This work is sponsored by the NSF + Next Generation Software program through grants EIA-0093426 (an NSF + CAREER award) and EIA-0103756. It is also supported in part by the NSF + Operating Systems and Compilers program (grant #CCR-9988482), by the + NSF Embedded Systems program (grant #CCR-0209202), and by the + MARCO/DARPA Gigascale Systems Research + Center (GSRC).

        + +
        -
        - - + + \ No newline at end of file From lattner at cs.uiuc.edu Tue Nov 18 17:24:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:24:01 2003 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200311182323.RAA03219@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.1 -> 1.2 --- Log message: Add some useful links --- Diffs of the changes: (+17 -1) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.1 llvm-www/header.incl:1.2 --- llvm-www/header.incl:1.1 Tue Nov 18 17:04:53 2003 +++ llvm-www/header.incl Tue Nov 18 17:23:43 2003 @@ -58,9 +58,25 @@
        +Useful Links +
        + Lists:
        + LLVM-announce
        + LLVM-dev
        + LLVM-commits

        + + + Resources:
        + doxygen + cvsweb
        + Nightly Tester + +

        + +
        + Maintained by:
        Chris Lattner
        -
        From lattner at cs.uiuc.edu Tue Nov 18 17:25:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:25:00 2003 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200311182324.RAA03384@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.2 -> 1.3 --- Log message: Verbosify --- Diffs of the changes: (+2 -2) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.2 llvm-www/header.incl:1.3 --- llvm-www/header.incl:1.2 Tue Nov 18 17:23:43 2003 +++ llvm-www/header.incl Tue Nov 18 17:24:19 2003 @@ -60,13 +60,13 @@ Useful Links
        - Lists:
        + Mailing Lists:
        LLVM-announce
        LLVM-dev
        LLVM-commits

        - Resources:
        + Dev. Resources:
        doxygen cvsweb
        Nightly Tester From lattner at cs.uiuc.edu Tue Nov 18 17:26:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 18 17:26:01 2003 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200311182325.RAA03571@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.3 -> 1.4 --- Log message: minor fixes --- Diffs of the changes: (+4 -3) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.3 llvm-www/header.incl:1.4 --- llvm-www/header.incl:1.3 Tue Nov 18 17:24:19 2003 +++ llvm-www/header.incl Tue Nov 18 17:25:31 2003 @@ -63,14 +63,15 @@ Mailing Lists:
        LLVM-announce
        LLVM-dev
        - LLVM-commits

        - + LLVM-commits + + +

        Dev. Resources:
        doxygen cvsweb
        Nightly Tester -


        From brukman at cs.uiuc.edu Tue Nov 18 17:41:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Nov 18 17:41:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311182340.RAA13643@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.18 -> 1.19 --- Log message: CVS still doesn't work, but GREP does. --- Diffs of the changes: (+18 -19) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.18 llvm-www/status/index.html:1.19 --- llvm-www/status/index.html:1.18 Tue Nov 18 16:29:35 2003 +++ llvm-www/status/index.html Tue Nov 18 17:39:58 2003 @@ -45,6 +45,23 @@
        Status Notes
        grep2.5WORKSPasses own regression tests.
        cvs1.11.618 Nov 2003FAILSFails to login to remote anonymous repository or checkout. May have + something to do with all the "type conflict" warnings at compile-time.
        xpdf
        CVS1.11.630 Oct 2003FAILSFails to login to remote anonymous repository or checkout. May have - something to do with all the "type conflict" warnings at compile-time.
        GNU Goapply this Makefile patch and then run make linux_llvm
        grep2.5compiles but with lots of warnings of the form:
        - ReadArchiveBuffer: WARNING: Skipping unknown file: getu
        gzip ?? 18 Nov 2003 ???At least one bug fixed: bug 125.At least one bug fixed: bug 125.
        2.3.8 18 Nov 2003 ???At least one bug fixed: bug 123. Still looking for - the inefficiency: bug 127.At least one bug fixed: bug 123. Still looking for + the inefficiency: bug 127.
        21.5.14 14 Nov 2003 FAILSSee bug #113 for details.See bug #113 for details.
        2.2.2 13 Nov 2003 FAILSSee bug #113 for details.See bug #113 for details.
        21.3 14 Nov 2003 FAILSSee bug #6 for details.See bug #6 for details.
        4.58 13 Nov 2003 FAILSSee bug #6 for details.See bug #6 for details.
        Status Notes
        pine4.5819 Nov 2003FAILSSee bug #141 for details.
        nano1.2.118 Nov 2003WORKSrequires libncurses, run with:
        +
        lli -load=/usr/lib/libncurses.so nano.bc [nano options]
        +
        grepInexplicably crashes in the JIT soon after start-up. Not yet investigated.
        pine4.5813 Nov 2003FAILSSee bug #6 for details.
        gawk passes its own regression test suite
        nano1.2.1requires libncurses, run with:
        -
        lli -load=/usr/lib/libncurses.so nano.bc [nano options]
        -
        xboard Status Notes
        emacs21.319 Nov 2003FAILSRunning intermediate binary temacs results in a crash. See bug 140 on what makes it even more annoying.
        pineFAILS See bug #113 for details.
        emacs21.314 Nov 2003FAILSSee bug #6 for details.
        glib 4.58 19 Nov 2003 FAILSSee bug #141 for details.Build with: +
        +./build CC=llvm-gcc lrh
        +
        + lrh = Linux Red Hat, there are many such targets. + Compile fails: see bug #141 for details.
        Status Notes
        xemacs21.5.1420 Nov 2003FAILSSee bug 141 for details.
        lrh = Linux Red Hat, there are many such targets. - Compile fails: see bug #141 for details.
        xemacs21.5.1414 Nov 2003FAILSSee bug #113 for details.
        glib Status Notes
        cgoban1.9.1420 Nov 2003WORKSOnly played a local game, did not try connecting to network server.
        glib2.2.220 Nov 2003FAILSCompilation exits with error: +
        +./gmarshal.list:25: error: unexpected character `
        +', expected type name
        +
        +
        xemacs
        glib2.2.213 Nov 2003FAILSSee bug #113 for details.
        tcsh Status Notes
        xemacs21.5.1420 Nov 2003FAILSSee bug 143 for details.
        cgoban
        xemacs21.5.1420 Nov 2003FAILSSee bug 141 for details.
        Misha Brukman The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 18:06:07 $ + Last modified: $Date: 2003/11/20 20:51:23 $ From brukman at cs.uiuc.edu Thu Nov 20 14:54:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 14:54:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311202053.OAA20350@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.28 -> 1.29 --- Log message: Bug 143 is not yet fixed! --- Diffs of the changes: (+2 -2) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.28 llvm-www/status/index.html:1.29 --- llvm-www/status/index.html:1.28 Thu Nov 20 14:51:23 2003 +++ llvm-www/status/index.html Thu Nov 20 14:53:32 2003 @@ -51,7 +51,7 @@
        21.5.14 20 Nov 2003 FAILSSee bug 143 for details.See bug 143 for details.
        21.5.14 20 Nov 2003 FAILSSee bug 143 for details.See bug 143 for details.
        Status Notes
        xboard4.2.620 Nov 2003WORKSWorks well with Crafty, both compiled to LLVM!
        xemacs 21.5.14 20 Nov 2003 FAILSSee bug 143 for details.We're close: +
        +./xemacs -nd -no-packages -batch -l
        +/home/vadve/brukman/src/llvm-code/bad/xemacs-21.5.14/src/../lisp/update-elc.el
        +
        +Fatal error: assertion failed, file alloc.c, line 327, !in_malloc
        +
        +
        21.3 19 Nov 2003 FAILSRunning intermediate binary temacs results in a crash. See bug 140 on what makes it even more annoying.Running intermediate binary temacs results in a crash.
        ?? 18 Nov 2003 ???At least one bug fixed: bug 125.At least one bug fixed: bug + 125.
        passes its own regression test suite
        xboard4.2.6requires a bunch of X libraries to link with, so the command line should be: -
        -lli -load=/usr/X11R6/lib/libXaw.so  \
        -    -load=/usr/X11R6/lib/libXmu.so  \
        -    -load=/usr/X11R6/lib/libXt.so   \
        -    -load=/usr/X11R6/lib/libXext.so \
        -    -load=/usr/X11R6/lib/libXpm.so  \
        -    -load=/usr/X11R6/lib/libSM.so   \
        -    -load=/usr/X11R6/lib/libICE.so  \
        -    -load=/usr/X11R6/lib/libX11.so  \
        -    xboard.bc [xboard options]
        -
        Misha Brukman The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 20:57:42 $ + Last modified: $Date: 2003/11/20 21:07:55 $ From lattner at cs.uiuc.edu Thu Nov 20 15:22:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 15:22:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200311202121.PAA01341@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.44 -> 1.45 --- Log message: * Finegrainify namespacification * Implement FuncResolve/2003-11-20-BogusResolveWarning.ll ... which eliminates a large number of annoying warnings. I know misha will miss them though! --- Diffs of the changes: (+27 -8) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.44 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.45 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.44 Thu Nov 20 12:19:35 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Thu Nov 20 15:21:31 2003 @@ -24,12 +24,12 @@ #include "llvm/Pass.h" #include "llvm/iOther.h" #include "llvm/Constants.h" +#include "llvm/Support/CallSite.h" #include "llvm/Target/TargetData.h" #include "llvm/Assembly/Writer.h" #include "Support/Statistic.h" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved"); @@ -45,7 +45,7 @@ RegisterOpt X("funcresolve", "Resolve Functions"); } -Pass *createFunctionResolvingPass() { +Pass *llvm::createFunctionResolvingPass() { return new FunctionResolvingPass(); } @@ -134,6 +134,26 @@ return Changed; } +// Check to see if all of the callers of F ignore the return value. +static bool CallersAllIgnoreReturnValue(Function &F) { + if (F.getReturnType() == Type::VoidTy) return true; + for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) { + if (ConstantPointerRef *CPR = dyn_cast(*I)) { + for (Value::use_iterator I = CPR->use_begin(), E = CPR->use_end(); + I != E; ++I) { + CallSite CS = CallSite::get(*I); + if (!CS.getInstruction() || !CS.getInstruction()->use_empty()) + return false; + } + } else { + CallSite CS = CallSite::get(*I); + if (!CS.getInstruction() || !CS.getInstruction()->use_empty()) + return false; + } + } + return true; +} + static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD, std::vector &Globals) { assert(!Globals.empty() && "Globals list shouldn't be empty here!"); @@ -159,7 +179,7 @@ Concrete = Globals[i]; } else if (Concrete) { - if (Concrete->isExternal()) // If we have multiple external symbols...x + if (Concrete->isExternal()) // If we have multiple external symbols... if (F->getFunctionType()->getNumParams() > cast(Concrete)->getFunctionType()->getNumParams()) Concrete = F; // We are more concrete than "Concrete"! @@ -205,10 +225,11 @@ if (Concrete && Globals.size() == 2) { GlobalValue *Other = Globals[Globals[0] == Concrete]; // If the non-concrete global is a function which takes (...) arguments, - // and the return values match, do not warn. + // and the return values match (or was never used), do not warn. if (Function *ConcreteF = dyn_cast(Concrete)) if (Function *OtherF = dyn_cast(Other)) - if (ConcreteF->getReturnType() == OtherF->getReturnType() && + if ((ConcreteF->getReturnType() == OtherF->getReturnType() || + CallersAllIgnoreReturnValue(*OtherF)) && OtherF->getFunctionType()->isVarArg() && OtherF->getFunctionType()->getParamTypes().empty()) DontPrintWarning = true; @@ -335,5 +356,3 @@ return Changed; } - -} // End llvm namespace From lattner at cs.uiuc.edu Thu Nov 20 15:23:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 20 15:23:01 2003 Subject: [llvm-commits] CVS: llvm/utils/Burg/gram.yc Message-ID: <200311202122.PAA04175@zion.cs.uiuc.edu> Changes in directory llvm/utils/Burg: gram.yc updated: 1.2 -> 1.3 --- Log message: This function REALLY DOES return void --- Diffs of the changes: (+2 -2) Index: llvm/utils/Burg/gram.yc diff -u llvm/utils/Burg/gram.yc:1.2 llvm/utils/Burg/gram.yc:1.3 --- llvm/utils/Burg/gram.yc:1.2 Mon Mar 31 15:26:06 2003 +++ llvm/utils/Burg/gram.yc Thu Nov 20 15:22:32 2003 @@ -1,10 +1,10 @@ %{ -char rcsid_gram[] = "$Id: gram.yc,v 1.2 2003/03/31 21:26:06 lattner Exp $"; +char rcsid_gram[] = "$Id: gram.yc,v 1.3 2003/11/20 21:22:32 lattner Exp $"; #include #include "b.h" #include "fe.h" -int doGram(List); +void doGram(List); %} %union { From gaeke at cs.uiuc.edu Thu Nov 20 18:01:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:01:00 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200311210000.SAA19228@zion.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.22 -> 1.23 --- Log message: Assume that MachineCodeTest will pass if the assembly file is created, OR if it is NOT created and the error message looks like LLC can't find the backend. --- Diffs of the changes: (+18 -27) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.22 llvm/test/QMTest/llvm.py:1.23 --- llvm/test/QMTest/llvm.py:1.22 Thu Nov 20 13:55:40 2003 +++ llvm/test/QMTest/llvm.py Thu Nov 20 18:00:15 2003 @@ -366,59 +366,50 @@ title='LLVM Assembly Code File', description='LLVM Assembly Code File to Convert to Native Assembly Code'), ] + def runLLC(self, llcpath, bcfile, asmfile): + command = llcpath + ' ' + bcfile + ' ' + '-f -o ' + asmfile + input, output = os.popen4 (command) + outputstr = output.read () + input.close () + output.close () + return outputstr.strip () def Run (self, context, result): - - # # Set the core dump size - # coresize=int(context['coresize']) resource.setrlimit (resource.RLIMIT_CORE, (coresize,coresize)) - # # Fetch the source and build root directories from the context. - # srcroot=context['srcroot'] buildroot=context['buildroot'] tmpdir=context['tmpdir'] - # # Construct the pathname of the source file and object file. - # srcfile=srcroot + '/' + self.srcfile bcfile=tmpdir + '/feature-mc-' + os.path.basename (self.srcfile) - objfile=tmpdir + '/feature-mc-' + os.path.basename (self.srcfile) + '.s' + asmfile=bcfile + '.s' - # # Construct the pathnames to the various utilities. - # as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' llc = buildroot + '/tools/' + context['buildtype'] + '/llc' - # # Assemble the bytecode file. - # if (ExecProgram ((as, srcfile, '-f', '-o', bcfile))): result.Fail ('Failed to assemble ' + srcfile + ' to file ' + bcfile) return - # # Use the LLVM assembler to assemble the program. - # - if (ExecProgram ((llc, bcfile, '-f', '-o', objfile))): - fail = 1 - result.Fail('Failed to compile ' + bcfile + ' to native asm code.') - else: - fail = 0 - - # - # Cleanup the file if it exists. - # - if ((os.access(objfile,os.F_OK)) == 1): - os.remove (objfile) + llcout = self.runLLC (llc, bcfile, asmfile) + + # Fail the test if the asm file was not created, and + # the error message looks like something other than + # "can't find the backend". + if os.access (asmfile, os.F_OK) == 1: + os.remove (asmfile) else: - if (fail == 0): - result.Fail ('Native assembly file ' + objfile + ' was not created') + pat = re.compile ('must use the -march option') + if pat.match (llcout) == None: + result.Fail ('Native assembly file ' + asmfile + ' was not created') return From gaeke at cs.uiuc.edu Thu Nov 20 18:20:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:20:02 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210019.SAA19571@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.5 -> 1.6 --- Log message: Implement option to run gccld (no UI yet) --- Diffs of the changes: (+11 -1) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.5 llvm-www/demo/index.cgi:1.6 --- llvm-www/demo/index.cgi:1.5 Thu Nov 20 10:26:00 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:19:28 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/20 16:26:00 $ +# Last modified $Date: 2003/11/21 00:19:28 $ # use CGI; @@ -181,6 +181,8 @@ if `llvm-dis --help 2>&1` !~ /ll disassembler/; $sanitycheckfail .= ' llvm-gcc' if `llvm-gcc --version 2>&1` !~ /Free Software Foundation/; + $sanitycheckfail .= ' gccld' + if `gccld --help 2>&1` !~ /llvm linker for GCC/; barf( "The demo page is currently unavailable. [tools: ($sanitycheckfail ) failed sanity check]" ) @@ -266,6 +268,14 @@ try_run( "llvm-gcc", "llvm-gcc -o $bytecodeFile -c $inputFile > $outputFile 2>&1", $outputFile ); + + if ( $c->param('linkopt') ) { + print "

        Running link-time optimizer.

        \n"; + my $tmpFile = getname(".bc"); + system("gccld --link-as-library -o=$tmpFile $outputFile 2>&1"); + system("mv $tmpFile $outputFile"); + } + my $disassemblyFile = getname(".ll"); try_run( "llvm-dis", "llvm-dis -o=$disassemblyFile $bytecodeFile > $outputFile 2>&1", From gaeke at cs.uiuc.edu Thu Nov 20 18:23:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:23:00 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210022.SAA19644@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.6 -> 1.7 --- Log message: First try for gccld UI --- Diffs of the changes: (+10 -1) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.6 llvm-www/demo/index.cgi:1.7 --- llvm-www/demo/index.cgi:1.6 Thu Nov 20 18:19:28 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:22:26 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:19:28 $ +# Last modified $Date: 2003/11/21 00:22:26 $ # use CGI; @@ -160,11 +160,20 @@ print "

        \n"; +print "
        "; print "

        Click here if you want Bitter Melon to run the resulting code through c++filt. Warning, the LLVM code produced will probably not be lexically valid, but it will be easier to read.

          ", $c->checkbox( -name => 'cxxdemangle', -label => 'Demangle C++ names with c++filt' ), "
        "; +print "
        "; + +print "

        Bitter Melon can also run the link-time optimizer for you, if you like (but she won't link your code with any libraries.)

          ", + $c->checkbox( + -name => 'linkopt', + -label => 'Run link-time optimizer' +), "
        "; +print "
        "; print "

        ", $c->submit, "\n", $c->endform; From gaeke at cs.uiuc.edu Thu Nov 20 18:27:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:27:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210026.SAA19810@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.7 -> 1.8 --- Log message: Slightly modify mail message --- Diffs of the changes: (+3 -1) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.7 llvm-www/demo/index.cgi:1.8 --- llvm-www/demo/index.cgi:1.7 Thu Nov 20 18:22:26 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:26:08 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:22:26 $ +# Last modified $Date: 2003/11/21 00:26:08 $ # use CGI; @@ -314,6 +314,8 @@ chomp ($host = `host $ip`) if $ip; mailto( 'lattner at cs.uiuc.edu', "--- Query: ---\nFrom: ($ip) $host\nInput: $lines lines of $lg\n" + . "cxxdemangle = " . ($c->param('cxxdemangle') ? 1 : 0) + . ", linkopt = " . ($c->param('linkopt') ? 1 : 0) . "\n\n" . "--- Source: ---\n$source\n" . "--- Result: ---\n$UnhilightedResult\n" ); From gaeke at cs.uiuc.edu Thu Nov 20 18:32:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:32:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210031.SAA19946@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.8 -> 1.9 --- Log message: Make noise less vertically spacey. --- Diffs of the changes: (+5 -3) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.8 llvm-www/demo/index.cgi:1.9 --- llvm-www/demo/index.cgi:1.8 Thu Nov 20 18:26:08 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:31:22 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:26:08 $ +# Last modified $Date: 2003/11/21 00:31:22 $ # use CGI; @@ -279,7 +279,7 @@ $outputFile ); if ( $c->param('linkopt') ) { - print "

        Running link-time optimizer.

        \n"; + print " Running link-time optimizer.\n"; my $tmpFile = getname(".bc"); system("gccld --link-as-library -o=$tmpFile $outputFile 2>&1"); system("mv $tmpFile $outputFile"); @@ -290,8 +290,10 @@ "llvm-dis -o=$disassemblyFile $bytecodeFile > $outputFile 2>&1", $outputFile ); + print " Bytecode size is ", -s $outputFile, " bytes.\n"; + if ( $c->param('cxxdemangle') ) { - print "

        Demangling disassembler output.

        \n"; + print " Demangling disassembler output.\n"; my $tmpFile = getname(".ll"); system("c++filt < $disassemblyFile > $tmpFile 2>&1"); system("mv $tmpFile $disassemblyFile"); From gaeke at cs.uiuc.edu Thu Nov 20 18:33:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:33:00 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210032.SAA20022@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.9 -> 1.10 --- Log message: Whoops, that went in the wrong place. It was supposed to print out the bytecode size. --- Diffs of the changes: (+3 -3) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.9 llvm-www/demo/index.cgi:1.10 --- llvm-www/demo/index.cgi:1.9 Thu Nov 20 18:31:22 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:32:23 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:31:22 $ +# Last modified $Date: 2003/11/21 00:32:23 $ # use CGI; @@ -285,12 +285,12 @@ system("mv $tmpFile $outputFile"); } + print " Bytecode size is ", -s $outputFile, " bytes.\n"; + my $disassemblyFile = getname(".ll"); try_run( "llvm-dis", "llvm-dis -o=$disassemblyFile $bytecodeFile > $outputFile 2>&1", $outputFile ); - - print " Bytecode size is ", -s $outputFile, " bytes.\n"; if ( $c->param('cxxdemangle') ) { print " Demangling disassembler output.\n"; From gaeke at cs.uiuc.edu Thu Nov 20 18:35:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:35:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210034.SAA20113@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.10 -> 1.11 --- Log message: Ok, I am seriously braindamaged. I was trying to run gccld on gcc's standard output. :-P --- Diffs of the changes: (+4 -4) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.10 llvm-www/demo/index.cgi:1.11 --- llvm-www/demo/index.cgi:1.10 Thu Nov 20 18:32:23 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:33:50 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:32:23 $ +# Last modified $Date: 2003/11/21 00:33:50 $ # use CGI; @@ -281,11 +281,11 @@ if ( $c->param('linkopt') ) { print " Running link-time optimizer.\n"; my $tmpFile = getname(".bc"); - system("gccld --link-as-library -o=$tmpFile $outputFile 2>&1"); - system("mv $tmpFile $outputFile"); + system("gccld --link-as-library -o=$tmpFile $bytecodeFile 2>&1"); + system("mv $tmpFile $bytecodeFile"); } - print " Bytecode size is ", -s $outputFile, " bytes.\n"; + print " Bytecode size is ", -s $bytecodeFile, " bytes.\n"; my $disassemblyFile = getname(".ll"); try_run( "llvm-dis", From gaeke at cs.uiuc.edu Thu Nov 20 18:36:03 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:36:03 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210035.SAA20231@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.11 -> 1.12 --- Log message: Give the table a border. I know, I'm going to hell for using a table to do layout. --- Diffs of the changes: (+2 -2) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.11 llvm-www/demo/index.cgi:1.12 --- llvm-www/demo/index.cgi:1.11 Thu Nov 20 18:33:50 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:34:52 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:33:50 $ +# Last modified $Date: 2003/11/21 00:34:52 $ # use CGI; @@ -160,7 +160,7 @@ print "

        \n"; -print " + + + + + + + + - - - - - - - - + Compile fails: see bug 141 and + bug 82 for details. @@ -436,7 +435,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/20 21:07:55 $ + Last modified: $Date: 2003/11/21 05:02:13 $ From brukman at cs.uiuc.edu Fri Nov 21 00:01:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 00:01:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311210513.XAA15369@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.32 -> 1.33 --- Log message: Add a testing date for grep. --- Diffs of the changes: (+2 -2) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.32 llvm-www/status/index.html:1.33 --- llvm-www/status/index.html:1.32 Thu Nov 20 23:02:13 2003 +++ llvm-www/status/index.html Thu Nov 20 23:13:20 2003 @@ -125,7 +125,7 @@ - + @@ -435,7 +435,7 @@
        Misha Brukman
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/21 05:02:13 $ + Last modified: $Date: 2003/11/21 05:13:20 $ From criswell at cs.uiuc.edu Fri Nov 21 10:10:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Nov 21 10:10:02 2003 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200311211609.KAA21403@choi.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.38 -> 1.39 --- Log message: Minor grammatical and punctuation corrections. --- Diffs of the changes: (+3 -3) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.38 llvm/docs/LangRef.html:1.39 --- llvm/docs/LangRef.html:1.38 Fri Nov 7 19:05:38 2003 +++ llvm/docs/LangRef.html Fri Nov 21 10:09:42 2003 @@ -722,10 +722,10 @@
        -

        LLVM functions definitions are composed of a (possibly empty) argument list, +

        LLVM function definitions are composed of a (possibly empty) argument list, an opening curly brace, a list of basic blocks, and a closing curly brace. LLVM function declarations are defined with the "declare" keyword, a -function name and a function signature.

        +function name, and a function signature.

        A function definition contains a list of basic blocks, forming the CFG for the function. Each basic block may optionally start with a label (giving the @@ -2307,7 +2307,7 @@

        Chris Lattner
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/08 01:05:38 $ + Last modified: $Date: 2003/11/21 16:09:42 $
        From lattner at cs.uiuc.edu Fri Nov 21 10:53:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 10:53:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp LoopSimplify.cpp LowerSwitch.cpp TailRecursionElimination.cpp Message-ID: <200311211652.KAA06655@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.67 -> 1.68 LoopSimplify.cpp updated: 1.25 -> 1.26 LowerSwitch.cpp updated: 1.8 -> 1.9 TailRecursionElimination.cpp updated: 1.7 -> 1.8 --- Log message: Minor cleanups and simplifications --- Diffs of the changes: (+7 -7) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.67 llvm/lib/Transforms/Scalar/ADCE.cpp:1.68 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.67 Thu Nov 20 12:25:22 2003 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Fri Nov 21 10:52:01 2003 @@ -302,7 +302,7 @@ // if (!AliveBlocks.count(&Func->front())) { BasicBlock *NewEntry = new BasicBlock(); - new BranchInst(&Func->front(), 0, 0, NewEntry); + new BranchInst(&Func->front(), NewEntry); Func->getBasicBlockList().push_front(NewEntry); AliveBlocks.insert(NewEntry); // This block is always alive! LiveSet.insert(NewEntry->getTerminator()); // The branch is live Index: llvm/lib/Transforms/Scalar/LoopSimplify.cpp diff -u llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.25 llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.26 --- llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.25 Thu Nov 20 12:25:22 2003 +++ llvm/lib/Transforms/Scalar/LoopSimplify.cpp Fri Nov 21 10:52:01 2003 @@ -153,7 +153,7 @@ BasicBlock *NewBB = new BasicBlock(BB->getName()+Suffix, BB); // The preheader first gets an unconditional branch to the loop header... - BranchInst *BI = new BranchInst(BB, 0, 0, NewBB); + BranchInst *BI = new BranchInst(BB, NewBB); // For every PHI node in the block, insert a PHI node into NewBB where the // incoming values from the out of loop edges are moved to NewBB. We have two @@ -379,7 +379,7 @@ // Create and insert the new backedge block... BasicBlock *BEBlock = new BasicBlock(Header->getName()+".backedge", F); - BranchInst *BETerminator = new BranchInst(Header, 0, 0, BEBlock); + BranchInst *BETerminator = new BranchInst(Header, BEBlock); // Move the new backedge block to right after the last backedge block. Function::iterator InsertPos = BackedgeBlocks.back(); ++InsertPos; Index: llvm/lib/Transforms/Scalar/LowerSwitch.cpp diff -u llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.8 llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.9 --- llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.8 Thu Nov 20 12:25:22 2003 +++ llvm/lib/Transforms/Scalar/LowerSwitch.cpp Fri Nov 21 10:52:01 2003 @@ -186,7 +186,7 @@ // If there is only the default destination, don't bother with the code below. if (SI->getNumOperands() == 2) { - new BranchInst(SI->getDefaultDest(), 0, 0, CurBlock); + new BranchInst(SI->getDefaultDest(), CurBlock); delete SI; return; } @@ -196,7 +196,7 @@ BasicBlock* NewDefault = new BasicBlock("NewDefault"); F->getBasicBlockList().insert(Default, NewDefault); - new BranchInst(Default, 0, 0, NewDefault); + new BranchInst(Default, NewDefault); // If there is an entry in any PHI nodes for the default edge, make sure // to update them as well. @@ -219,7 +219,7 @@ OrigBlock, NewDefault); // Branch to our shiny new if-then stuff... - new BranchInst(SwitchBlock, 0, 0, OrigBlock); + new BranchInst(SwitchBlock, OrigBlock); // We are now done with the switch instruction, delete it. delete SI; Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp diff -u llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.7 llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.8 --- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.7 Thu Nov 20 12:25:22 2003 +++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp Fri Nov 21 10:52:01 2003 @@ -76,7 +76,7 @@ // us to branch back to the old entry block. OldEntry = &F.getEntryBlock(); BasicBlock *NewEntry = new BasicBlock("tailrecurse", OldEntry); - new BranchInst(OldEntry, 0, 0, NewEntry); + new BranchInst(OldEntry, NewEntry); // Now that we have created a new block, which jumps to the entry // block, insert a PHI node for each argument of the function. From lattner at cs.uiuc.edu Fri Nov 21 10:53:10 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 10:53:10 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp UnifyFunctionExitNodes.cpp Message-ID: <200311211652.KAA06664@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.16 -> 1.17 UnifyFunctionExitNodes.cpp updated: 1.28 -> 1.29 --- Log message: Minor cleanups and simplifications --- Diffs of the changes: (+5 -11) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.16 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.17 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.16 Thu Nov 20 12:25:23 2003 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Fri Nov 21 10:52:03 2003 @@ -106,7 +106,7 @@ BasicBlock *NewBB = new BasicBlock(TIBB->getName() + "." + DestBB->getName() + "_crit_edge"); // Create our unconditional branch... - new BranchInst(DestBB, 0, 0, NewBB); + new BranchInst(DestBB, NewBB); // Branch to the new block, breaking the edge... TI->setSuccessor(SuccNum, NewBB); Index: llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp diff -u llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.28 llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.29 --- llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.28 Thu Nov 20 12:25:23 2003 +++ llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp Fri Nov 21 10:52:03 2003 @@ -21,13 +21,12 @@ #include "llvm/iTerminators.h" #include "llvm/iPHINode.h" #include "llvm/Type.h" - -namespace llvm { +using namespace llvm; static RegisterOpt X("mergereturn", "Unify function exit nodes"); -Pass *createUnifyFunctionExitNodesPass() { +Pass *llvm::createUnifyFunctionExitNodesPass() { return new UnifyFunctionExitNodes(); } @@ -91,11 +90,8 @@ // If the function doesn't return void... add a PHI node to the block... PN = new PHINode(F.getReturnType(), "UnifiedRetVal"); NewRetBlock->getInstList().push_back(PN); - new ReturnInst(PN, NewRetBlock); - } else { - // If it returns void, just add a return void instruction to the block - new ReturnInst(0, NewRetBlock); } + new ReturnInst(PN, NewRetBlock); // Loop over all of the blocks, replacing the return instruction with an // unconditional branch. @@ -109,10 +105,8 @@ if (PN) PN->addIncoming(BB->getTerminator()->getOperand(0), BB); BB->getInstList().pop_back(); // Remove the return insn - new BranchInst(NewRetBlock, 0, 0, BB); + new BranchInst(NewRetBlock, BB); } ReturnBlock = NewRetBlock; return true; } - -} // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 21 10:53:18 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 10:53:18 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Message-ID: <200311211652.KAA06671@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.37 -> 1.38 --- Log message: Minor cleanups and simplifications --- Diffs of the changes: (+25 -27) Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.37 llvm/lib/VMCore/BasicBlock.cpp:1.38 --- llvm/lib/VMCore/BasicBlock.cpp:1.37 Thu Nov 20 12:25:24 2003 +++ llvm/lib/VMCore/BasicBlock.cpp Fri Nov 21 10:52:05 2003 @@ -21,33 +21,33 @@ #include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" #include +using namespace llvm; -namespace llvm { - -// DummyInst - An instance of this class is used to mark the end of the -// instruction list. This is not a real instruction. -// -struct DummyInst : public Instruction { - DummyInst() : Instruction(Type::VoidTy, OtherOpsEnd) { - // This should not be garbage monitored. - LeakDetector::removeGarbageObject(this); - } +namespace { + /// DummyInst - An instance of this class is used to mark the end of the + /// instruction list. This is not a real instruction. + struct DummyInst : public Instruction { + DummyInst() : Instruction(Type::VoidTy, OtherOpsEnd) { + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(this); + } - virtual Instruction *clone() const { - assert(0 && "Cannot clone EOL");abort(); - return 0; - } - virtual const char *getOpcodeName() const { return "*end-of-list-inst*"; } + virtual Instruction *clone() const { + assert(0 && "Cannot clone EOL");abort(); + return 0; + } + virtual const char *getOpcodeName() const { return "*end-of-list-inst*"; } - // Methods for support type inquiry through isa, cast, and dyn_cast... - static inline bool classof(const DummyInst *) { return true; } - static inline bool classof(const Instruction *I) { - return I->getOpcode() == OtherOpsEnd; - } - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } -}; + // Methods for support type inquiry through isa, cast, and dyn_cast... + static inline bool classof(const DummyInst *) { return true; } + static inline bool classof(const Instruction *I) { + return I->getOpcode() == OtherOpsEnd; + } + static inline bool classof(const Value *V) { + return isa(V) && classof(cast(V)); + } + }; +} Instruction *ilist_traits::createNode() { return new DummyInst(); @@ -243,7 +243,7 @@ } while (Inst != &*I); // Loop until we move the specified instruction. // Add a branch instruction to the newly formed basic block. - new BranchInst(New, 0, 0, this); + new BranchInst(New, this); // Now we must loop through all of the successors of the New block (which // _were_ the successors of the 'this' block), and update any PHI nodes in @@ -265,5 +265,3 @@ } return New; } - -} // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 21 11:07:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 11:07:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200311211706.LAA07293@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.69 -> 1.70 --- Log message: improve error message --- Diffs of the changes: (+2 -2) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.69 llvm/lib/VMCore/Verifier.cpp:1.70 --- llvm/lib/VMCore/Verifier.cpp:1.69 Sun Nov 16 17:07:42 2003 +++ llvm/lib/VMCore/Verifier.cpp Fri Nov 21 11:06:29 2003 @@ -438,7 +438,7 @@ const Type *ElTy = cast(LI.getOperand(0)->getType())->getElementType(); Assert2(ElTy == LI.getType(), - "Load is not of right type for indices!", &LI, ElTy); + "Load result type does not match pointer operand type!", &LI, ElTy); visitInstruction(LI); } @@ -446,7 +446,7 @@ const Type *ElTy = cast(SI.getOperand(1)->getType())->getElementType(); Assert2(ElTy == SI.getOperand(0)->getType(), - "Stored value is not of right type for indices!", &SI, ElTy); + "Stored value type does not match pointer operand type!", &SI, ElTy); visitInstruction(SI); } From lattner at cs.uiuc.edu Fri Nov 21 11:37:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 11:37:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200311211736.LAA07639@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.70 -> 1.71 --- Log message: Fix some problems with assertions printing --- Diffs of the changes: (+19 -7) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.70 llvm/lib/VMCore/Verifier.cpp:1.71 --- llvm/lib/VMCore/Verifier.cpp:1.70 Fri Nov 21 11:06:29 2003 +++ llvm/lib/VMCore/Verifier.cpp Fri Nov 21 11:35:51 2003 @@ -155,18 +155,30 @@ void visitUserOp2(Instruction &I) { visitUserOp1(I); } void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); + + void WriteValue(const Value *V) { + if (!V) return; + if (isa(V)) + std::cerr << *V; + else { + WriteAsOperand (std::cerr, V, true, true, Mod); + std::cerr << "\n"; + } + } + + // CheckFailed - A check failed, so print out the condition and the message // that failed. This provides a nice place to put a breakpoint if you want // to see why something is not correct. // - inline void CheckFailed(const std::string &Message, - const Value *V1 = 0, const Value *V2 = 0, - const Value *V3 = 0, const Value *V4 = 0) { + void CheckFailed(const std::string &Message, + const Value *V1 = 0, const Value *V2 = 0, + const Value *V3 = 0, const Value *V4 = 0) { std::cerr << Message << "\n"; - if (V1) { WriteAsOperand (std::cerr, V1, true, true, Mod); std::cerr << "\n"; } - if (V2) { WriteAsOperand (std::cerr, V2, true, true, Mod); std::cerr << "\n"; } - if (V3) { WriteAsOperand (std::cerr, V3, true, true, Mod); std::cerr << "\n"; } - if (V4) { WriteAsOperand (std::cerr, V4, true, true, Mod); std::cerr << "\n"; } + WriteValue(V1); + WriteValue(V2); + WriteValue(V3); + WriteValue(V4); Broken = true; } }; From criswell at cs.uiuc.edu Fri Nov 21 11:43:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Nov 21 11:43:01 2003 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200311211742.LAA23722@choi.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.39 -> 1.40 --- Log message: Fixed another minor grammatical error. --- Diffs of the changes: (+3 -2) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.39 llvm/docs/LangRef.html:1.40 --- llvm/docs/LangRef.html:1.39 Fri Nov 21 10:09:42 2003 +++ llvm/docs/LangRef.html Fri Nov 21 11:42:22 2003 @@ -671,7 +671,8 @@
        appending: -
        "appending" linkage may only applied to global variables of pointer +
        "appending" linkage may only be applied to global variables of +pointer to array type. When two global variables with appending linkage are linked together, the two global arrays are appended together. This is the LLVM, typesafe, equivalent of having the system linker append together "sections" with @@ -2307,7 +2308,7 @@
        Chris Lattner
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/11/21 16:09:42 $ + Last modified: $Date: 2003/11/21 17:42:22 $ From lattner at cs.uiuc.edu Fri Nov 21 12:30:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 12:30:01 2003 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200311211829.MAA08214@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.89 -> 1.90 --- Log message: Fix horrible grammar-o --- Diffs of the changes: (+2 -2) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.89 llvm-www/www-index.html:1.90 --- llvm-www/www-index.html:1.89 Tue Nov 18 17:04:53 2003 +++ llvm-www/www-index.html Fri Nov 21 12:29:18 2003 @@ -67,7 +67,7 @@
        Public LLVM Release!

        - The current version of LLVM is 1.0 is now available for + The LLVM 1.0 is now available for download! LLVM is publicly available under the OSI-certified University of Illinois Open-Source License. See answers to common @@ -104,4 +104,4 @@

        "; +print "
        "; print "

        Click here if you want Bitter Melon to run the resulting code through c++filt. Warning, the LLVM code produced will probably not be lexically valid, but it will be easier to read.

          ", $c->checkbox( -name => 'cxxdemangle', From gaeke at cs.uiuc.edu Thu Nov 20 18:46:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:46:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210045.SAA30575@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.12 -> 1.13 --- Log message: Show statistics and pass timings, if they want to see them. --- Diffs of the changes: (+16 -3) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.12 llvm-www/demo/index.cgi:1.13 --- llvm-www/demo/index.cgi:1.12 Thu Nov 20 18:34:52 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:45:30 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:34:52 $ +# Last modified $Date: 2003/11/21 00:45:30 $ # use CGI; @@ -173,6 +173,14 @@ -name => 'linkopt', -label => 'Run link-time optimizer' ), "
        "; + +print "
        "; + +print "

        Would you believe the cat even has a stopwatch? Click here to get detailed compilation statistics from each pass.

          ", + $c->checkbox( + -name => 'showstats', + -label => 'Show detailed statistics' +), "
        "; print "
        "; print "

        ", $c->submit, "\n", $c->endform; @@ -274,14 +282,19 @@ my $bytecodeFile = getname(".o"); my $outputFile = getname(".llvm-gcc.out"); + + my $stats = ''; + $stats = '-Wa,--stats,--time-passes' if ($c->param('showstats')); try_run( "llvm-gcc", - "llvm-gcc -o $bytecodeFile -c $inputFile > $outputFile 2>&1", + "llvm-gcc $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1", $outputFile ); if ( $c->param('linkopt') ) { + my $stats = ''; + $stats = '--stats --time-passes' if ($c->param('showstats')); print " Running link-time optimizer.\n"; my $tmpFile = getname(".bc"); - system("gccld --link-as-library -o=$tmpFile $bytecodeFile 2>&1"); + system("gccld $stats --link-as-library -o=$tmpFile $bytecodeFile 2>&1"); system("mv $tmpFile $bytecodeFile"); } From gaeke at cs.uiuc.edu Thu Nov 20 18:55:05 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:55:05 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210054.SAA03834@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.13 -> 1.14 --- Log message: Output is not looking quite right yet. --- Diffs of the changes: (+3 -2) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.13 llvm-www/demo/index.cgi:1.14 --- llvm-www/demo/index.cgi:1.13 Thu Nov 20 18:45:30 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:54:40 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:45:30 $ +# Last modified $Date: 2003/11/21 00:54:40 $ # use CGI; @@ -291,10 +291,11 @@ if ( $c->param('linkopt') ) { my $stats = ''; + my $outputFile = getname(".gccld.out"); $stats = '--stats --time-passes' if ($c->param('showstats')); print " Running link-time optimizer.\n"; my $tmpFile = getname(".bc"); - system("gccld $stats --link-as-library -o=$tmpFile $bytecodeFile 2>&1"); + try_run("gccld", "gccld $stats --link-as-library -o=$tmpFile $bytecodeFile 2>&1 > $outputFile", $outputFile ); system("mv $tmpFile $bytecodeFile"); } From gaeke at cs.uiuc.edu Thu Nov 20 18:57:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:57:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210056.SAA03939@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.14 -> 1.15 --- Log message: pretty names for tools. --- Diffs of the changes: (+3 -3) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.14 llvm-www/demo/index.cgi:1.15 --- llvm-www/demo/index.cgi:1.14 Thu Nov 20 18:54:40 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:56:04 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:54:40 $ +# Last modified $Date: 2003/11/21 00:56:04 $ # use CGI; @@ -285,7 +285,7 @@ my $stats = ''; $stats = '-Wa,--stats,--time-passes' if ($c->param('showstats')); - try_run( "llvm-gcc", + try_run( "llvm C/C++ front-end (llvm-gcc)", "llvm-gcc $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1", $outputFile ); @@ -295,7 +295,7 @@ $stats = '--stats --time-passes' if ($c->param('showstats')); print " Running link-time optimizer.\n"; my $tmpFile = getname(".bc"); - try_run("gccld", "gccld $stats --link-as-library -o=$tmpFile $bytecodeFile 2>&1 > $outputFile", $outputFile ); + try_run("link-time optimizer (gccld)", "gccld $stats --link-as-library -o=$tmpFile $bytecodeFile 2>&1 > $outputFile", $outputFile ); system("mv $tmpFile $bytecodeFile"); } From gaeke at cs.uiuc.edu Thu Nov 20 18:57:09 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 18:57:09 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210056.SAA04030@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.15 -> 1.16 --- Log message: ** insert griping about sh syntax here ** --- Diffs of the changes: (+2 -2) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.15 llvm-www/demo/index.cgi:1.16 --- llvm-www/demo/index.cgi:1.15 Thu Nov 20 18:56:04 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 18:56:40 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:56:04 $ +# Last modified $Date: 2003/11/21 00:56:40 $ # use CGI; @@ -295,7 +295,7 @@ $stats = '--stats --time-passes' if ($c->param('showstats')); print " Running link-time optimizer.\n"; my $tmpFile = getname(".bc"); - try_run("link-time optimizer (gccld)", "gccld $stats --link-as-library -o=$tmpFile $bytecodeFile 2>&1 > $outputFile", $outputFile ); + try_run("link-time optimizer (gccld)", "gccld $stats --link-as-library -o=$tmpFile $bytecodeFile > $outputFile 2>&1", $outputFile ); system("mv $tmpFile $bytecodeFile"); } From gaeke at cs.uiuc.edu Thu Nov 20 19:10:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 19:10:01 2003 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200311210109.TAA04420@zion.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.16 -> 1.17 --- Log message: Stats output seems to be working much better now. Re-run perltidy on the code. --- Diffs of the changes: (+95 -61) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.16 llvm-www/demo/index.cgi:1.17 --- llvm-www/demo/index.cgi:1.16 Thu Nov 20 18:56:40 2003 +++ llvm-www/demo/index.cgi Thu Nov 20 19:09:49 2003 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2003/11/21 00:56:40 $ +# Last modified $Date: 2003/11/21 01:09:49 $ # use CGI; @@ -14,12 +14,12 @@ open( STDERR, ">&STDOUT" ) or die "can't redirect stderr to stdout"; -if (! -d "/tmp/webcompile") { mkdir ("/tmp/webcompile", 0777); } +if ( !-d "/tmp/webcompile" ) { mkdir( "/tmp/webcompile", 0777 ); } -$LOGFILE = '/tmp/webcompile/log.txt'; -$FORM_URL = 'http://llvm.cs.uiuc.edu/demo/index.cgi'; -$CONTACT_ADDRESS = 'gaeke -at- uiuc.edu'; -$LOGO_IMAGE_URL = 'cathead.png'; +$LOGFILE = '/tmp/webcompile/log.txt'; +$FORM_URL = 'http://llvm.cs.uiuc.edu/demo/index.cgi'; +$CONTACT_ADDRESS = 'gaeke -at- uiuc.edu'; +$LOGO_IMAGE_URL = 'cathead.png'; @PREPENDPATHDIRS = ( '/home/vadve/gaeke/llvm/tools/Debug', '/home/vadve/gaeke/bin' ); $ENV{'LLVM_LIB_SEARCH_PATH'} = @@ -29,7 +29,8 @@ sub getname { my ($extension) = @_; for ( my $count = 0 ; ; $count++ ) { - my $name = sprintf( "/tmp/webcompile/_%d_%d%s", $$, $count, $extension ); + my $name = + sprintf( "/tmp/webcompile/_%d_%d%s", $$, $count, $extension ); if ( !-f $name ) { return $name; } } } @@ -70,14 +71,14 @@ } close FILE; my $UnhilightedResult = $result; - my $HtmlResult = "

        $header

        \n
        \n"
        -                   . $c->escapeHTML($result)
        -                   . "\n
        \n"; - if (wantarray) { - return ($UnhilightedResult, $HtmlResult); - } else { - return $HtmlResult; - } + my $HtmlResult = + "

        $header

        \n
        \n" . $c->escapeHTML($result) . "\n
        \n"; + if (wantarray) { + return ( $UnhilightedResult, $HtmlResult ); + } + else { + return $HtmlResult; + } } sub syntaxHighlightLLVM { @@ -90,12 +91,13 @@ } sub mailto { - my ($recipient, $body) = @_; - my $msg = new Mail::Send (Subject=>"LLVM Demo Page Run", To=>$recipient); + my ( $recipient, $body ) = @_; + my $msg = + new Mail::Send( Subject => "LLVM Demo Page Run", To => $recipient ); local ($fh); - $fh = $msg->open(); - print $fh $body; - $fh->close(); + $fh = $msg->open(); + print $fh $body; + $fh->close(); } $c = new CGI; @@ -119,9 +121,8 @@ EOF - if ($LOGO_IMAGE_URL) { - print ""; + print ""; } print <start_multipart_form( 'POST', $FORM_URL ); print "Upload a file: "; @@ -152,40 +152,47 @@ print "

        \n"; -print "

        By the way, what language is this code in?: ", $c->radio_group( +print "

        By the way, what language is this code in?: ", + $c->radio_group( -name => 'language', -values => [ 'C', 'C++' ], -default => 'C' -); + ); print "

        \n"; - print "
        "; -print "

        Click here if you want Bitter Melon to run the resulting code through c++filt. Warning, the LLVM code produced will probably not be lexically valid, but it will be easier to read.

          ", +print +"

          Click here if you want Bitter Melon to run the resulting code through c++filt. Warning, the LLVM code produced will probably not be lexically valid, but it will be easier to read.

            ", $c->checkbox( -name => 'cxxdemangle', -label => 'Demangle C++ names with c++filt' -), "
          "; + ), + "
        "; print "
        "; -print "

        Bitter Melon can also run the link-time optimizer for you, if you like (but she won't link your code with any libraries.)

          ", +print +"

          Bitter Melon can also run the link-time optimizer for you, if you like (but she won't link your code with any libraries.)

            ", $c->checkbox( -name => 'linkopt', -label => 'Run link-time optimizer' -), "
          "; + ), + "
        "; print "
        "; -print "

        Would you believe the cat even has a stopwatch? Click here to get detailed compilation statistics from each pass.

          ", +print +"

          Would you believe the cat even has a stopwatch? Click here to get detailed compilation statistics from each pass.

            ", $c->checkbox( -name => 'showstats', -label => 'Show detailed statistics' -), "
          "; + ), + "
        "; print "
        "; print "

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

        If you have questions about the LLVM code generated by the front-end, please check the FAQ, your question just might be answered (e.g., what is this __main thing?).

        \n"; +print +"\n

        If you have questions about the LLVM code generated by the front-end, please check the FAQ, your question just might be answered (e.g., what is this __main thing?).

        \n"; $ENV{'PATH'} = ( join ( ':', @PREPENDPATHDIRS ) ) . ":" . $ENV{'PATH'}; @@ -209,6 +216,8 @@ sub try_run { my ( $program, $commandline, $outputFile ) = @_; + + #print "command line was [ $commandline ]\n"; my $retcode = system($commandline); if ( -s $outputFile ) { print dumpFile( "Output from $program", $outputFile ); @@ -227,12 +236,12 @@ } %suffixes = ( - 'Java' => '.java', - 'JO99' => '.jo9', - 'C' => '.c', - 'C++' => '.cc', - 'preprocessed C' => '.i', - 'preprocessed C++' => '.ii' + 'Java' => '.java', + 'JO99' => '.jo9', + 'C' => '.c', + 'C++' => '.cc', + 'preprocessed C' => '.i', + 'preprocessed C++' => '.ii' ); %languages = ( '.jo9' => 'JO99', @@ -274,32 +283,52 @@ # Add a newline to the source here to avoid a warning from gcc. $source .= "\n"; + # Avoid security hole due to #including bad stuff. $source =~ s@(\n)?#include.*[<"](.*\.\..*)[">].*\n@$1#error "invalid #include file $2 detected"\n at g; my $inputFile = writeIntoFile( $extension, $source ); - my $pid = $$; + my $pid = $$; my $bytecodeFile = getname(".o"); my $outputFile = getname(".llvm-gcc.out"); + my $timerFile = getname(".llvm-gcc.time"); - my $stats = ''; - $stats = '-Wa,--stats,--time-passes' if ($c->param('showstats')); + my $stats = ''; + $stats = "-Wa,--stats,--time-passes,--info-output-file=$timerFile" + if ( $c->param('showstats') ); try_run( "llvm C/C++ front-end (llvm-gcc)", "llvm-gcc $stats -o $bytecodeFile -c $inputFile > $outputFile 2>&1", $outputFile ); + if ( $c->param('showstats') && -s $timerFile ) { + ( $UnhilightedResult, $HtmlResult ) = + dumpFile( "Statistics for C/C++ front-end", $timerFile ); + print "$HtmlResult\n"; + } if ( $c->param('linkopt') ) { - my $stats = ''; - my $outputFile = getname(".gccld.out"); - $stats = '--stats --time-passes' if ($c->param('showstats')); - print " Running link-time optimizer.\n"; + my $stats = ''; + my $outputFile = getname(".gccld.out"); + my $timerFile = getname(".gccld.time"); + $stats = "--stats --time-passes --info-output-file=$timerFile" + if ( $c->param('showstats') ); + print " Running optimizing linker.\n"; my $tmpFile = getname(".bc"); - try_run("link-time optimizer (gccld)", "gccld $stats --link-as-library -o=$tmpFile $bytecodeFile > $outputFile 2>&1", $outputFile ); + try_run( + "optimizing linker (gccld)", +"gccld $stats --link-as-library -o=$tmpFile $bytecodeFile > $outputFile 2>&1", + $outputFile + ); system("mv $tmpFile $bytecodeFile"); + + if ( $c->param('showstats') && -s $timerFile ) { + ( $UnhilightedResult, $HtmlResult ) = + dumpFile( "Statistics for optimizing linker", $timerFile ); + print "$HtmlResult\n"; + } } - print " Bytecode size is ", -s $bytecodeFile, " bytes.\n"; + print " Bytecode size is ", -s $bytecodeFile, " bytes.\n"; my $disassemblyFile = getname(".ll"); try_run( "llvm-dis", @@ -313,29 +342,34 @@ system("mv $tmpFile $disassemblyFile"); } - my ($UnhilightedResult, $HtmlResult); + my ( $UnhilightedResult, $HtmlResult ); if ( -s $disassemblyFile ) { - ($UnhilightedResult, $HtmlResult) - = dumpFile( "Output from LLVM disassembler", $disassemblyFile ); + ( $UnhilightedResult, $HtmlResult ) = + dumpFile( "Output from LLVM disassembler", $disassemblyFile ); print syntaxHighlightLLVM($HtmlResult); - } else { + } + else { print "

        Hmm, that's weird, llvm-dis didn't produce any output.

        \n"; } addlog( $source, $pid, $UnhilightedResult ); - my ($ip, $host, $lg, $lines); - chomp ($lines = `wc -l < $inputFile`); - $lg = $c->param('language'); - $ip = $c->remote_addr(); - chomp ($host = `host $ip`) if $ip; + my ( $ip, $host, $lg, $lines ); + chomp( $lines = `wc -l < $inputFile` ); + $lg = $c->param('language'); + $ip = $c->remote_addr(); + chomp( $host = `host $ip` ) if $ip; mailto( 'lattner at cs.uiuc.edu', - "--- Query: ---\nFrom: ($ip) $host\nInput: $lines lines of $lg\n" - . "cxxdemangle = " . ($c->param('cxxdemangle') ? 1 : 0) - . ", linkopt = " . ($c->param('linkopt') ? 1 : 0) . "\n\n" + "--- Query: ---\nFrom: ($ip) $host\nInput: $lines lines of $lg\n" + . "C++ demangle = " + . ( $c->param('cxxdemangle') ? 1 : 0 ) + . ", Link opt = " + . ( $c->param('linkopt') ? 1 : 0 ) . "\n\n" + . ", Show stats = " + . ( $c->param('showstats') ? 1 : 0 ) . "\n\n" . "--- Source: ---\n$source\n" . "--- Result: ---\n$UnhilightedResult\n" ); - unlink( $inputFile, $bytecodeFile, $outputFile, $disassemblyFile ); + unlink( $inputFile, $bytecodeFile, $outputFile, $disassemblyFile ); } print $c->hr, "
        $CONTACT_ADDRESS
        ", $c->end_html; From gaeke at cs.uiuc.edu Thu Nov 20 19:13:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 19:13:01 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200311210112.TAA04649@zion.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.50 -> 1.51 --- Log message: Clean more qmtest files. --- Diffs of the changes: (+3 -2) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.50 llvm/test/Makefile:1.51 --- llvm/test/Makefile:1.50 Thu Nov 20 13:57:17 2003 +++ llvm/test/Makefile Thu Nov 20 19:12:47 2003 @@ -91,14 +91,15 @@ $(QMTEST) register test llvm.CXXTest $(QMTEST) register database llvmdb.llvmdb -# # Start up the QMTest GUI -# gui:: $(QMTEST) gui --no-browser --daemon +# Also get rid of qmtest garbage when we 'make clean' in this directory. clean:: $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \ $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo + $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \ + $(LLVM_OBJ_ROOT)/test/results.qmr From gaeke at cs.uiuc.edu Thu Nov 20 19:14:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Nov 20 19:14:00 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200311210113.TAA04715@zion.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.23 -> 1.24 --- Log message: Fix test for non-matching pattern. Also make error message better. --- Diffs of the changes: (+2 -2) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.23 llvm/test/QMTest/llvm.py:1.24 --- llvm/test/QMTest/llvm.py:1.23 Thu Nov 20 18:00:15 2003 +++ llvm/test/QMTest/llvm.py Thu Nov 20 19:13:36 2003 @@ -408,8 +408,8 @@ os.remove (asmfile) else: pat = re.compile ('must use the -march option') - if pat.match (llcout) == None: - result.Fail ('Native assembly file ' + asmfile + ' was not created') + if not pat.search (llcout): + result.Fail ('Native assembly file ' + asmfile + ' was not created; error output was: ' + llcout) return From brukman at cs.uiuc.edu Thu Nov 20 23:43:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Nov 20 23:43:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311210502.XAA10473@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.31 -> 1.32 --- Log message: Nano "just works", pine has a new bug blocking it from compilation. --- Diffs of the changes: (+11 -12) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.31 llvm-www/status/index.html:1.32 --- llvm-www/status/index.html:1.31 Thu Nov 20 15:07:55 2003 +++ llvm-www/status/index.html Thu Nov 20 23:02:13 2003 @@ -45,6 +45,14 @@
        Status Notes
        nano1.2.120 Nov 2003WORKSIt just works.
        lrh = Linux Red Hat, there are many such targets. - Compile fails: see bug 141 for details.
        nano1.2.118 Nov 2003WORKSrequires libncurses, run with:
        -
        lli -load=/usr/lib/libncurses.so nano.bc [nano options]
        -
        grep 2.518 Nov 2003 WORKS Passes own regression tests.
        - \ No newline at end of file + From lattner at cs.uiuc.edu Fri Nov 21 14:24:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 14:24:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Constants.cpp Dominators.cpp Function.cpp Module.cpp ModuleProvider.cpp Pass.cpp SlotCalculator.cpp SymbolTable.cpp Value.cpp Verifier.cpp iMemory.cpp Message-ID: <200311212023.OAA16798@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.112 -> 1.113 Constants.cpp updated: 1.63 -> 1.64 Dominators.cpp updated: 1.51 -> 1.52 Function.cpp updated: 1.56 -> 1.57 Module.cpp updated: 1.44 -> 1.45 ModuleProvider.cpp updated: 1.7 -> 1.8 Pass.cpp updated: 1.53 -> 1.54 SlotCalculator.cpp updated: 1.38 -> 1.39 SymbolTable.cpp updated: 1.40 -> 1.41 Value.cpp updated: 1.40 -> 1.41 Verifier.cpp updated: 1.71 -> 1.72 iMemory.cpp updated: 1.33 -> 1.34 --- Log message: Finegrainify namespacification --- Diffs of the changes: (+150 -166) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.112 llvm/lib/VMCore/AsmWriter.cpp:1.113 --- llvm/lib/VMCore/AsmWriter.cpp:1.112 Wed Nov 19 18:09:43 2003 +++ llvm/lib/VMCore/AsmWriter.cpp Fri Nov 21 14:23:48 2003 @@ -32,8 +32,7 @@ #include "Support/StringExtras.h" #include "Support/STLExtras.h" #include - -namespace llvm { +using namespace llvm; static RegisterPass X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization); @@ -233,8 +232,8 @@ // type, iff there is an entry in the modules symbol table for the specified // type or one of it's component types. This is slower than a simple x << Type; // -std::ostream &WriteTypeSymbolic(std::ostream &Out, const Type *Ty, - const Module *M) { +std::ostream &llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty, + const Module *M) { Out << " "; // If they want us to print out a type, attempt to make it symbolic if there @@ -447,7 +446,8 @@ // ostream. This can be useful when you just want to print int %reg126, not the // whole instruction that generated it. // -std::ostream &WriteAsOperand(std::ostream &Out, const Value *V, bool PrintType, +std::ostream &llvm::WriteAsOperand(std::ostream &Out, const Value *V, + bool PrintType, bool PrintName, const Module *Context) { std::map TypeNames; if (Context == 0) Context = getModuleFromVal(V); @@ -465,7 +465,7 @@ return Out; } - +namespace llvm { class AssemblyWriter { std::ostream &Out; @@ -520,7 +520,7 @@ // which slot it occupies. void printInfoComment(const Value &V); }; - +} // end of anonymous namespace // printTypeAtLeastOneLevel - Print out one level of the possibly complex type // without considering any symbolic types that we may have equal to it. @@ -1063,5 +1063,3 @@ } return *this; } - -} // End llvm namespace Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.63 llvm/lib/VMCore/Constants.cpp:1.64 --- llvm/lib/VMCore/Constants.cpp:1.63 Mon Nov 17 13:47:21 2003 +++ llvm/lib/VMCore/Constants.cpp Fri Nov 21 14:23:48 2003 @@ -19,8 +19,7 @@ #include "llvm/Module.h" #include "Support/StringExtras.h" #include - -namespace llvm { +using namespace llvm; ConstantBool *ConstantBool::True = new ConstantBool(true); ConstantBool *ConstantBool::False = new ConstantBool(false); @@ -540,20 +539,22 @@ // something strange that needs to be done to interface to the ctor for the // constant. // -template -struct ConstantCreator { - static ConstantClass *create(const TypeClass *Ty, const ValType &V) { - return new ConstantClass(Ty, V); - } -}; - -template -struct ConvertConstantType { - static void convert(ConstantClass *OldC, const TypeClass *NewTy) { - assert(0 && "This type cannot be converted!\n"); - abort(); - } -}; +namespace llvm { + template + struct ConstantCreator { + static ConstantClass *create(const TypeClass *Ty, const ValType &V) { + return new ConstantClass(Ty, V); + } + }; + + template + struct ConvertConstantType { + static void convert(ConstantClass *OldC, const TypeClass *NewTy) { + assert(0 && "This type cannot be converted!\n"); + abort(); + } + }; +} namespace { template @@ -712,21 +713,21 @@ //---- ConstantArray::get() implementation... // - -template<> -struct ConvertConstantType { - static void convert(ConstantArray *OldC, const ArrayType *NewTy) { - // Make everyone now use a constant of the new type... - std::vector C; - for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) - C.push_back(cast(OldC->getOperand(i))); - Constant *New = ConstantArray::get(NewTy, C); - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. - } -}; - +namespace llvm { + template<> + struct ConvertConstantType { + static void convert(ConstantArray *OldC, const ArrayType *NewTy) { + // Make everyone now use a constant of the new type... + std::vector C; + for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) + C.push_back(cast(OldC->getOperand(i))); + Constant *New = ConstantArray::get(NewTy, C); + assert(New != OldC && "Didn't replace constant??"); + OldC->uncheckedReplaceAllUsesWith(New); + OldC->destroyConstant(); // This constant is now dead, destroy it. + } + }; +} static ValueMap, ArrayType, ConstantArray> ArrayConstants; @@ -778,20 +779,22 @@ //---- ConstantStruct::get() implementation... // -template<> -struct ConvertConstantType { - static void convert(ConstantStruct *OldC, const StructType *NewTy) { - // Make everyone now use a constant of the new type... - std::vector C; - for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) - C.push_back(cast(OldC->getOperand(i))); - Constant *New = ConstantStruct::get(NewTy, C); - assert(New != OldC && "Didn't replace constant??"); - - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. - } -}; +namespace llvm { + template<> + struct ConvertConstantType { + static void convert(ConstantStruct *OldC, const StructType *NewTy) { + // Make everyone now use a constant of the new type... + std::vector C; + for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) + C.push_back(cast(OldC->getOperand(i))); + Constant *New = ConstantStruct::get(NewTy, C); + assert(New != OldC && "Didn't replace constant??"); + + OldC->uncheckedReplaceAllUsesWith(New); + OldC->destroyConstant(); // This constant is now dead, destroy it. + } + }; +} static ValueMap, StructType, ConstantStruct> StructConstants; @@ -811,24 +814,26 @@ //---- ConstantPointerNull::get() implementation... // -// ConstantPointerNull does not take extra "value" argument... -template -struct ConstantCreator { - static ConstantPointerNull *create(const PointerType *Ty, const ValType &V){ - return new ConstantPointerNull(Ty); - } -}; +namespace llvm { + // ConstantPointerNull does not take extra "value" argument... + template + struct ConstantCreator { + static ConstantPointerNull *create(const PointerType *Ty, const ValType &V){ + return new ConstantPointerNull(Ty); + } + }; -template<> -struct ConvertConstantType { - static void convert(ConstantPointerNull *OldC, const PointerType *NewTy) { - // Make everyone now use a constant of the new type... - Constant *New = ConstantPointerNull::get(NewTy); - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. - } -}; + template<> + struct ConvertConstantType { + static void convert(ConstantPointerNull *OldC, const PointerType *NewTy) { + // Make everyone now use a constant of the new type... + Constant *New = ConstantPointerNull::get(NewTy); + assert(New != OldC && "Didn't replace constant??"); + OldC->uncheckedReplaceAllUsesWith(New); + OldC->destroyConstant(); // This constant is now dead, destroy it. + } + }; +} static ValueMap NullPtrConstants; @@ -865,56 +870,58 @@ // typedef std::pair > ExprMapKeyType; -template<> -struct ConstantCreator { - static ConstantExpr *create(const Type *Ty, const ExprMapKeyType &V) { - if (V.first == Instruction::Cast) - return new ConstantExpr(Instruction::Cast, V.second[0], Ty); - if ((V.first >= Instruction::BinaryOpsBegin && - V.first < Instruction::BinaryOpsEnd) || - V.first == Instruction::Shl || V.first == Instruction::Shr) - return new ConstantExpr(V.first, V.second[0], V.second[1]); - - assert(V.first == Instruction::GetElementPtr && "Invalid ConstantExpr!"); - - std::vector IdxList(V.second.begin()+1, V.second.end()); - return new ConstantExpr(V.second[0], IdxList, Ty); - } -}; +namespace llvm { + template<> + struct ConstantCreator { + static ConstantExpr *create(const Type *Ty, const ExprMapKeyType &V) { + if (V.first == Instruction::Cast) + return new ConstantExpr(Instruction::Cast, V.second[0], Ty); + if ((V.first >= Instruction::BinaryOpsBegin && + V.first < Instruction::BinaryOpsEnd) || + V.first == Instruction::Shl || V.first == Instruction::Shr) + return new ConstantExpr(V.first, V.second[0], V.second[1]); + + assert(V.first == Instruction::GetElementPtr && "Invalid ConstantExpr!"); + + std::vector IdxList(V.second.begin()+1, V.second.end()); + return new ConstantExpr(V.second[0], IdxList, Ty); + } + }; -template<> -struct ConvertConstantType { - static void convert(ConstantExpr *OldC, const Type *NewTy) { - Constant *New; - switch (OldC->getOpcode()) { - case Instruction::Cast: - New = ConstantExpr::getCast(OldC->getOperand(0), NewTy); - break; - case Instruction::Shl: - case Instruction::Shr: - New = ConstantExpr::getShiftTy(NewTy, OldC->getOpcode(), + template<> + struct ConvertConstantType { + static void convert(ConstantExpr *OldC, const Type *NewTy) { + Constant *New; + switch (OldC->getOpcode()) { + case Instruction::Cast: + New = ConstantExpr::getCast(OldC->getOperand(0), NewTy); + break; + case Instruction::Shl: + case Instruction::Shr: + New = ConstantExpr::getShiftTy(NewTy, OldC->getOpcode(), OldC->getOperand(0), OldC->getOperand(1)); - break; - default: - assert(OldC->getOpcode() >= Instruction::BinaryOpsBegin && - OldC->getOpcode() < Instruction::BinaryOpsEnd); - New = ConstantExpr::getTy(NewTy, OldC->getOpcode(), OldC->getOperand(0), - OldC->getOperand(1)); - break; - case Instruction::GetElementPtr: - // Make everyone now use a constant of the new type... - std::vector C; - for (unsigned i = 1, e = OldC->getNumOperands(); i != e; ++i) - C.push_back(cast(OldC->getOperand(i))); - New = ConstantExpr::getGetElementPtrTy(NewTy, OldC->getOperand(0), C); - break; + break; + default: + assert(OldC->getOpcode() >= Instruction::BinaryOpsBegin && + OldC->getOpcode() < Instruction::BinaryOpsEnd); + New = ConstantExpr::getTy(NewTy, OldC->getOpcode(), OldC->getOperand(0), + OldC->getOperand(1)); + break; + case Instruction::GetElementPtr: + // Make everyone now use a constant of the new type... + std::vector C; + for (unsigned i = 1, e = OldC->getNumOperands(); i != e; ++i) + C.push_back(cast(OldC->getOperand(i))); + New = ConstantExpr::getGetElementPtrTy(NewTy, OldC->getOperand(0), C); + break; + } + + assert(New != OldC && "Didn't replace constant??"); + OldC->uncheckedReplaceAllUsesWith(New); + OldC->destroyConstant(); // This constant is now dead, destroy it. } - - assert(New != OldC && "Didn't replace constant??"); - OldC->uncheckedReplaceAllUsesWith(New); - OldC->destroyConstant(); // This constant is now dead, destroy it. - } -}; + }; +} // end namespace llvm static ValueMap ExprConstants; @@ -1039,4 +1046,3 @@ } } -} // End llvm namespace Index: llvm/lib/VMCore/Dominators.cpp diff -u llvm/lib/VMCore/Dominators.cpp:1.51 llvm/lib/VMCore/Dominators.cpp:1.52 --- llvm/lib/VMCore/Dominators.cpp:1.51 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Dominators.cpp Fri Nov 21 14:23:48 2003 @@ -19,8 +19,7 @@ #include "llvm/Assembly/Writer.h" #include "Support/DepthFirstIterator.h" #include "Support/SetOperations.h" - -namespace llvm { +using namespace llvm; //===----------------------------------------------------------------------===// // DominatorSet Implementation @@ -120,7 +119,7 @@ for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) Doms[I]; } - +namespace llvm { static std::ostream &operator<<(std::ostream &o, const std::set &BBs) { for (std::set::const_iterator I = BBs.begin(), E = BBs.end(); @@ -131,6 +130,7 @@ o << " <>"; return o; } +} void DominatorSetBase::print(std::ostream &o) const { for (const_iterator I = begin(), E = end(); I != E; ++I) { @@ -361,4 +361,3 @@ } } -} // End llvm namespace Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.56 llvm/lib/VMCore/Function.cpp:1.57 --- llvm/lib/VMCore/Function.cpp:1.56 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Function.cpp Fri Nov 21 14:23:48 2003 @@ -18,8 +18,7 @@ #include "llvm/Intrinsics.h" #include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" - -namespace llvm { +using namespace llvm; BasicBlock *ilist_traits::createNode() { BasicBlock *Ret = new BasicBlock(); @@ -259,5 +258,3 @@ Value::setName(name); if (P && getName() != "") P->getSymbolTable().insert(this); } - -} // End llvm namespace Index: llvm/lib/VMCore/Module.cpp diff -u llvm/lib/VMCore/Module.cpp:1.44 llvm/lib/VMCore/Module.cpp:1.45 --- llvm/lib/VMCore/Module.cpp:1.44 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Module.cpp Fri Nov 21 14:23:48 2003 @@ -21,8 +21,7 @@ #include #include #include - -namespace llvm { +using namespace llvm; Function *ilist_traits::createNode() { FunctionType *FTy = @@ -55,11 +54,13 @@ // Define the GlobalValueRefMap as a struct that wraps a map so that we don't // have Module.h depend on // -struct GlobalValueRefMap { - typedef std::map MapTy; - typedef MapTy::iterator iterator; - std::map Map; -}; +namespace llvm { + struct GlobalValueRefMap { + typedef std::map MapTy; + typedef MapTy::iterator iterator; + std::map Map; + }; +} Module::Module(const std::string &MID) @@ -310,4 +311,3 @@ } } -} // End llvm namespace Index: llvm/lib/VMCore/ModuleProvider.cpp diff -u llvm/lib/VMCore/ModuleProvider.cpp:1.7 llvm/lib/VMCore/ModuleProvider.cpp:1.8 --- llvm/lib/VMCore/ModuleProvider.cpp:1.7 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/ModuleProvider.cpp Fri Nov 21 14:23:48 2003 @@ -13,8 +13,7 @@ #include "llvm/ModuleProvider.h" #include "llvm/Module.h" - -namespace llvm { +using namespace llvm; /// ctor - always have a valid Module /// @@ -37,5 +36,3 @@ return TheModule; } - -} // End llvm namespace Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.53 llvm/lib/VMCore/Pass.cpp:1.54 --- llvm/lib/VMCore/Pass.cpp:1.53 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Pass.cpp Fri Nov 21 14:23:48 2003 @@ -20,8 +20,7 @@ #include "Support/STLExtras.h" #include "Support/TypeInfo.h" #include - -namespace llvm { +using namespace llvm; // IncludeFile - Stub function used to help linking out. IncludeFile::IncludeFile(void*) {} @@ -469,5 +468,3 @@ E = PassInfoMap->end(); I != E; ++I) passEnumerate(I->second); } - -} // End llvm namespace Index: llvm/lib/VMCore/SlotCalculator.cpp diff -u llvm/lib/VMCore/SlotCalculator.cpp:1.38 llvm/lib/VMCore/SlotCalculator.cpp:1.39 --- llvm/lib/VMCore/SlotCalculator.cpp:1.38 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/SlotCalculator.cpp Fri Nov 21 14:23:48 2003 @@ -26,8 +26,7 @@ #include "Support/PostOrderIterator.h" #include "Support/STLExtras.h" #include - -namespace llvm { +using namespace llvm; #if 0 #define SC_DEBUG(X) std::cerr << X @@ -363,5 +362,3 @@ SC_DEBUG("]\n"); return (int)DestSlot; } - -} // End llvm namespace Index: llvm/lib/VMCore/SymbolTable.cpp diff -u llvm/lib/VMCore/SymbolTable.cpp:1.40 llvm/lib/VMCore/SymbolTable.cpp:1.41 --- llvm/lib/VMCore/SymbolTable.cpp:1.40 Tue Nov 18 19:02:52 2003 +++ llvm/lib/VMCore/SymbolTable.cpp Fri Nov 21 14:23:48 2003 @@ -16,8 +16,7 @@ #include "llvm/Module.h" #include "Support/StringExtras.h" #include - -namespace llvm { +using namespace llvm; #define DEBUG_SYMBOL_TABLE 0 #define DEBUG_ABSTYPE 0 @@ -363,5 +362,3 @@ std::cout << "Symbol table dump:\n"; for_each(begin(), end(), DumpPlane); } - -} // End llvm namespace Index: llvm/lib/VMCore/Value.cpp diff -u llvm/lib/VMCore/Value.cpp:1.40 llvm/lib/VMCore/Value.cpp:1.41 --- llvm/lib/VMCore/Value.cpp:1.40 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/Value.cpp Fri Nov 21 14:23:48 2003 @@ -17,8 +17,7 @@ #include "llvm/Constant.h" #include "Support/LeakDetector.h" #include - -namespace llvm { +using namespace llvm; //===----------------------------------------------------------------------===// // Value Class @@ -109,5 +108,3 @@ setOperand(i, To); // Fix it now... } } - -} // End llvm namespace Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.71 llvm/lib/VMCore/Verifier.cpp:1.72 --- llvm/lib/VMCore/Verifier.cpp:1.71 Fri Nov 21 11:35:51 2003 +++ llvm/lib/VMCore/Verifier.cpp Fri Nov 21 14:23:48 2003 @@ -57,8 +57,7 @@ #include "llvm/Support/InstVisitor.h" #include "Support/STLExtras.h" #include - -namespace llvm { +using namespace llvm; namespace { // Anonymous namespace for class @@ -158,9 +157,11 @@ void WriteValue(const Value *V) { if (!V) return; - if (isa(V)) + if (isa(V)) { std::cerr << *V; - else { + } else if (const Type *Ty = dyn_cast(V)) { + WriteTypeSymbolic(std::cerr, Ty, Mod); + } else { WriteAsOperand (std::cerr, V, true, true, Mod); std::cerr << "\n"; } @@ -184,6 +185,8 @@ }; RegisterOpt X("verify", "Module Verifier"); +} // End anonymous namespace + // Assert - We know that cond should be true, if not print an error message. #define Assert(C, M) \ @@ -569,19 +572,18 @@ "Illegal # arguments for intrinsic function!", IF); } -} // End anonymous namespace //===----------------------------------------------------------------------===// // Implement the public interfaces to this file... //===----------------------------------------------------------------------===// -FunctionPass *createVerifierPass() { +FunctionPass *llvm::createVerifierPass() { return new Verifier(); } // verifyFunction - Create -bool verifyFunction(const Function &f) { +bool llvm::verifyFunction(const Function &f) { Function &F = (Function&)f; assert(!F.isExternal() && "Cannot verify external functions"); @@ -600,12 +602,10 @@ // verifyModule - Check a module for errors, printing messages on stderr. // Return true if the module is corrupt. // -bool verifyModule(const Module &M) { +bool llvm::verifyModule(const Module &M) { PassManager PM; Verifier *V = new Verifier(); PM.add(V); PM.run((Module&)M); return V->Broken; } - -} // End llvm namespace Index: llvm/lib/VMCore/iMemory.cpp diff -u llvm/lib/VMCore/iMemory.cpp:1.33 llvm/lib/VMCore/iMemory.cpp:1.34 --- llvm/lib/VMCore/iMemory.cpp:1.33 Tue Nov 11 16:41:34 2003 +++ llvm/lib/VMCore/iMemory.cpp Fri Nov 21 14:23:48 2003 @@ -14,7 +14,6 @@ #include "llvm/iMemory.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" - using namespace llvm; AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, From lattner at cs.uiuc.edu Fri Nov 21 14:28:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 14:28:01 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200311212027.OAA17033@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.139 -> 1.140 --- Log message: Don't crash on bogus source value --- Diffs of the changes: (+3 -0) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.139 llvm/lib/AsmParser/llvmAsmParser.y:1.140 --- llvm/lib/AsmParser/llvmAsmParser.y:1.139 Tue Nov 11 22:40:30 2003 +++ llvm/lib/AsmParser/llvmAsmParser.y Fri Nov 21 14:27:35 2003 @@ -1171,6 +1171,9 @@ ConstExpr: CAST '(' ConstVal TO Types ')' { + if (!$3->getType()->isFirstClassType()) + ThrowException("cast constant expression from a non-primitive type: '" + + $3->getType()->getDescription() + "'!"); if (!$5->get()->isFirstClassType()) ThrowException("cast constant expression to a non-primitive type: '" + $5->get()->getDescription() + "'!"); From lattner at cs.uiuc.edu Fri Nov 21 14:34:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 14:34:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200311212033.OAA20482@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.72 -> 1.73 --- Log message: Fix problem Reid was having with external globals and nonexternal linkage --- Diffs of the changes: (+2 -3) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.72 llvm/lib/VMCore/Verifier.cpp:1.73 --- llvm/lib/VMCore/Verifier.cpp:1.72 Fri Nov 21 14:23:48 2003 +++ llvm/lib/VMCore/Verifier.cpp Fri Nov 21 14:33:27 2003 @@ -108,8 +108,7 @@ visitGlobalValue(*I); for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) - if (I->isExternal() && I->hasInternalLinkage()) - CheckFailed("Global Variable is external with internal linkage!", I); + visitGlobalValue(*I); // If the module is broken, abort at this time. abortIfBroken(); @@ -203,7 +202,7 @@ void Verifier::visitGlobalValue(GlobalValue &GV) { Assert1(!GV.isExternal() || GV.hasExternalLinkage(), - "Global value has Internal Linkage!", &GV); + "Global is external, but doesn't have external linkage!", &GV); Assert1(!GV.hasAppendingLinkage() || isa(GV), "Only global variables can have appending linkage!", &GV); From lattner at cs.uiuc.edu Fri Nov 21 15:45:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 15:45:02 2003 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200311212144.PAA26450@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.85 -> 1.86 --- Log message: Reorder passes a bit. In particular, it makes sense to run globaldce IMMEDIATELY after funcresolve. Also, run the mem2reg pass _early_ so that IPCP and DAE actually do stuff. Run instcombine and simplify cfg after this to cleanup the intraprocedural messes we create. --- Diffs of the changes: (+4 -2) Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.85 llvm/tools/gccas/gccas.cpp:1.86 --- llvm/tools/gccas/gccas.cpp:1.85 Thu Nov 13 13:26:54 2003 +++ llvm/tools/gccas/gccas.cpp Fri Nov 21 15:44:35 2003 @@ -58,11 +58,13 @@ PM.add(createVerifierPass()); // Verify that input is correct addPass(PM, createLowerSetJmpPass()); // Lower llvm.setjmp/.longjmp addPass(PM, createFunctionResolvingPass()); // Resolve (...) functions - addPass(PM, createCFGSimplificationPass()); // Clean up disgusting code - addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst addPass(PM, createGlobalDCEPass()); // Remove unused globals + addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst + addPass(PM, createPromoteMemoryToRegister()); // "Construct SSA form" addPass(PM, createIPConstantPropagationPass());// IP Constant Propagation addPass(PM, createDeadArgEliminationPass()); // Dead argument elimination + addPass(PM, createInstructionCombiningPass()); // Cleanup after IPCP & DAE + addPass(PM, createCFGSimplificationPass()); // Clean up disgusting code addPass(PM, createPruneEHPass()); // Remove dead EH info From lattner at cs.uiuc.edu Fri Nov 21 15:47:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 15:47:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/Inliner.cpp Message-ID: <200311212146.PAA32012@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: Inliner.cpp updated: 1.5 -> 1.6 --- Log message: Finegrainify namespacification Print out the costs for functions that AREN'T inlined as well --- Diffs of the changes: (+5 -4) Index: llvm/lib/Transforms/IPO/Inliner.cpp diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.5 llvm/lib/Transforms/IPO/Inliner.cpp:1.6 --- llvm/lib/Transforms/IPO/Inliner.cpp:1.5 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/Inliner.cpp Fri Nov 21 15:45:31 2003 @@ -23,8 +23,7 @@ #include "Support/CommandLine.h" #include "Support/Debug.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumInlined("inline", "Number of functions inlined"); @@ -77,7 +76,10 @@ // try to do so... int InlineCost = inSCC ? getRecursiveInlineCost(CS) : getInlineCost(CS); - if (InlineCost < (int)InlineThreshold) { + if (InlineCost >= (int)InlineThreshold) { + DEBUG(std::cerr << " NOT Inlining: cost=" << InlineCost + << ", Call: " << *CS.getInstruction()); + } else { DEBUG(std::cerr << " Inlining: cost=" << InlineCost << ", Call: " << *CS.getInstruction()); @@ -137,4 +139,3 @@ return true; } -} // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 21 15:47:10 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 15:47:10 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/InlineSimple.cpp Message-ID: <200311212146.PAA32332@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: InlineSimple.cpp updated: 1.57 -> 1.58 --- Log message: * Finegrainify namespacification * Make the cost metric for passing constants in as arguments to functions MUCH more accurate, by actually estimating the amount of code that will be constant propagated away. --- Diffs of the changes: (+99 -30) Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.57 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.58 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.57 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Fri Nov 21 15:46:09 2003 @@ -12,19 +12,26 @@ //===----------------------------------------------------------------------===// #include "Inliner.h" +#include "llvm/Instructions.h" #include "llvm/Function.h" -#include "llvm/iMemory.h" #include "llvm/Support/CallSite.h" #include "llvm/Transforms/IPO.h" - -namespace llvm { +using namespace llvm; namespace { // FunctionInfo - For each function, calculate the size of it in blocks and // instructions. struct FunctionInfo { + // NumInsts, NumBlocks - Keep track of how large each function is, which is + // used to estimate the code size cost of inlining it. unsigned NumInsts, NumBlocks; + // ConstantArgumentWeights - Each formal argument of the function is + // inspected to see if it is used in any contexts where making it a constant + // would reduce the code size. If so, we add some value to the argument + // entry here. + std::vector ConstantArgumentWeights; + FunctionInfo() : NumInsts(0), NumBlocks(0) {} }; @@ -36,14 +43,57 @@ RegisterOpt X("inline", "Function Integration/Inlining"); } -Pass *createFunctionInliningPass() { return new SimpleInliner(); } +Pass *llvm::createFunctionInliningPass() { return new SimpleInliner(); } + +// CountCodeReductionForConstant - Figure out an approximation for how many +// instructions will be constant folded if the specified value is constant. +// +static unsigned CountCodeReductionForConstant(Value *V) { + unsigned Reduction = 0; + for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) + if (isa(*UI)) + Reduction += 40; // Eliminating a conditional branch is a big win + else if (SwitchInst *SI = dyn_cast(*UI)) + // Eliminating a switch is a big win, proportional to the number of edges + // deleted. + Reduction += (SI->getNumSuccessors()-1) * 40; + else if (CallInst *CI = dyn_cast(*UI)) { + // Turning an indirect call into a direct call is a BIG win + Reduction += CI->getCalledValue() == V ? 500 : 0; + } else if (InvokeInst *II = dyn_cast(*UI)) { + // Turning an indirect call into a direct call is a BIG win + Reduction += CI->getCalledValue() == V ? 500 : 0; + } else { + // Figure out if this instruction will be removed due to simple constant + // propagation. + Instruction &Inst = cast(**UI); + bool AllOperandsConstant = true; + for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) + if (!isa(Inst.getOperand(i)) && + !isa(Inst.getOperand(i)) && Inst.getOperand(i) != V) { + AllOperandsConstant = false; + break; + } + + if (AllOperandsConstant) { + // We will get to remove this instruction... + Reduction += 7; + + // And any other instructions that use it which become constants + // themselves. + Reduction += CountCodeReductionForConstant(&Inst); + } + } + + return Reduction; +} // getInlineCost - The heuristic used to determine if we should inline the // function call or not. // int SimpleInliner::getInlineCost(CallSite CS) { Instruction *TheCall = CS.getInstruction(); - const Function *Callee = CS.getCalledFunction(); + Function *Callee = CS.getCalledFunction(); const Function *Caller = TheCall->getParent()->getParent(); // Don't inline a directly recursive call. @@ -61,13 +111,42 @@ if (Callee->hasInternalLinkage() && Callee->hasOneUse()) InlineCost -= 30000; + // Get information about the callee... + FunctionInfo &CalleeFI = CachedFunctionInfo[Callee]; + + // If we haven't calculated this information yet... + if (CalleeFI.NumBlocks == 0) { + unsigned NumInsts = 0, NumBlocks = 0; + + // Look at the size of the callee. Each basic block counts as 20 units, and + // each instruction counts as 10. + for (Function::const_iterator BB = Callee->begin(), E = Callee->end(); + BB != E; ++BB) { + NumInsts += BB->size(); + NumBlocks++; + } + + CalleeFI.NumBlocks = NumBlocks; + CalleeFI.NumInsts = NumInsts; + + // Check out all of the arguments to the function, figuring out how much + // code can be eliminated if one of the arguments is a constant. + std::vector &ArgWeights = CalleeFI.ConstantArgumentWeights; + + for (Function::aiterator I = Callee->abegin(), E = Callee->aend(); + I != E; ++I) + ArgWeights.push_back(CountCodeReductionForConstant(I)); + } + + // Add to the inline quality for properties that make the call valuable to // inline. This includes factors that indicate that the result of inlining // the function will be optimizable. Currently this just looks at arguments // passed into the function. // + unsigned ArgNo = 0; for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); - I != E; ++I) { + I != E; ++I, ++ArgNo) { // Each argument passed in has a cost at both the caller and the callee // sides. This favors functions that take many arguments over functions // that take few arguments. @@ -78,33 +157,24 @@ if (isa(I)) InlineCost -= 100; - // If a constant, global variable or alloca is passed in, inlining this - // function is likely to allow significant future optimization possibilities - // (constant propagation, scalar promotion, and scalarization), so encourage - // the inlining of the function. + // If an alloca is passed in, inlining this function is likely to allow + // significant future optimization possibilities (like scalar promotion, and + // scalarization), so encourage the inlining of the function. // - else if (isa(I) || isa(I) || isa(I)) + else if (isa(I)) InlineCost -= 60; + + // If this is a constant being passed into the function, use the argument + // weights calculated for the callee to determine how much will be folded + // away with this information. + else if (isa(I) || isa(I)) { + if (ArgNo < CalleeFI.ConstantArgumentWeights.size()) + InlineCost -= CalleeFI.ConstantArgumentWeights[ArgNo]; + } } // Now that we have considered all of the factors that make the call site more // likely to be inlined, look at factors that make us not want to inline it. - FunctionInfo &CalleeFI = CachedFunctionInfo[Callee]; - - // If we haven't calculated this information yet... - if (CalleeFI.NumBlocks == 0) { - unsigned NumInsts = 0, NumBlocks = 0; - - // Look at the size of the callee. Each basic block counts as 20 units, and - // each instruction counts as 10. - for (Function::const_iterator BB = Callee->begin(), E = Callee->end(); - BB != E; ++BB) { - NumInsts += BB->size(); - NumBlocks++; - } - CalleeFI.NumBlocks = NumBlocks; - CalleeFI.NumInsts = NumInsts; - } // Don't inline into something too big, which would make it bigger. Here, we // count each basic block as a single unit. @@ -112,9 +182,8 @@ // Look at the size of the callee. Each basic block counts as 20 units, and - // each instruction counts as 10. - InlineCost += CalleeFI.NumInsts*10 + CalleeFI.NumBlocks*20; + // each instruction counts as 5. + InlineCost += CalleeFI.NumInsts*5 + CalleeFI.NumBlocks*20; return InlineCost; } -} // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 21 15:53:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 15:53:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/SimpleStructMutation.cpp Message-ID: <200311212152.PAA04733@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: SimpleStructMutation.cpp updated: 1.23 -> 1.24 --- Log message: Get rid of using decls, finegrainify namespacification --- Diffs of the changes: (+18 -23) Index: llvm/lib/Transforms/IPO/SimpleStructMutation.cpp diff -u llvm/lib/Transforms/IPO/SimpleStructMutation.cpp:1.23 llvm/lib/Transforms/IPO/SimpleStructMutation.cpp:1.24 --- llvm/lib/Transforms/IPO/SimpleStructMutation.cpp:1.23 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/SimpleStructMutation.cpp Fri Nov 21 15:52:10 2003 @@ -19,11 +19,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/DerivedTypes.h" #include -using std::vector; -using std::set; -using std::pair; - -namespace llvm { +using namespace llvm; namespace { struct SimpleStructMutation : public MutateStructTypes { @@ -76,8 +72,9 @@ // PruneTypes - Given a type Ty, make sure that neither it, or one of its // subtypes, occur in TypesToModify. // -static void PruneTypes(const Type *Ty, set &TypesToModify, - set &ProcessedTypes) { +static void PruneTypes(const Type *Ty, + std::set &TypesToModify, + std::set &ProcessedTypes) { if (ProcessedTypes.count(Ty)) return; // Already been checked ProcessedTypes.insert(Ty); @@ -98,19 +95,19 @@ } } -static bool FirstLess(const pair &LHS, - const pair &RHS) { +static bool FirstLess(const std::pair &LHS, + const std::pair &RHS) { return LHS.second < RHS.second; } -static unsigned getIndex(const vector > &Vec, +static unsigned getIndex(const std::vector > &Vec, unsigned Field) { for (unsigned i = 0; ; ++i) if (Vec[i].first == Field) return i; } static inline void GetTransformation(const TargetData &TD, const StructType *ST, - vector &Transform, + std::vector &Transform, enum SimpleStructMutation::Transform XForm) { unsigned NumElements = ST->getElementTypes().size(); Transform.reserve(NumElements); @@ -123,7 +120,7 @@ break; case SimpleStructMutation::SortElements: { - vector > ElList; + std::vector > ElList; // Build mapping from index to size for (unsigned i = 0; i < NumElements; ++i) @@ -148,17 +145,16 @@ // Get the results out of the analyzers... FindUsedTypes &FUT = getAnalysis(); - const set &UsedTypes = FUT.getTypes(); + const std::set &UsedTypes = FUT.getTypes(); FindUnsafePointerTypes &FUPT = getAnalysis(); - const set &UnsafePTys = FUPT.getUnsafeTypes(); - + const std::set &UnsafePTys = FUPT.getUnsafeTypes(); // Combine the two sets, weeding out non structure types. Closures in C++ // sure would be nice. - set TypesToModify; - for (set::const_iterator I = UsedTypes.begin(), + std::set TypesToModify; + for (std::set::const_iterator I = UsedTypes.begin(), E = UsedTypes.end(); I != E; ++I) if (const StructType *ST = dyn_cast(*I)) TypesToModify.insert(ST); @@ -167,8 +163,8 @@ // Go through the Unsafe types and remove all types from TypesToModify that we // are not allowed to modify, because that would be unsafe. // - set ProcessedTypes; - for (set::const_iterator I = UnsafePTys.begin(), + std::set ProcessedTypes; + for (std::set::const_iterator I = UnsafePTys.begin(), E = UnsafePTys.end(); I != E; ++I) { //cerr << "Pruning type: " << *I << "\n"; PruneTypes(*I, TypesToModify, ProcessedTypes); @@ -177,18 +173,17 @@ // Build up a set of structure types that we are going to modify, and // information describing how to modify them. - std::map > Transforms; + std::map > Transforms; TargetData &TD = getAnalysis(); - for (set::iterator I = TypesToModify.begin(), + for (std::set::iterator I = TypesToModify.begin(), E = TypesToModify.end(); I != E; ++I) { const StructType *ST = *I; - vector &Transform = Transforms[ST]; // Fill in the map directly + std::vector &Transform = Transforms[ST]; // Fill in the map directly GetTransformation(TD, ST, Transform, XForm); } return Transforms; } -} // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 21 15:55:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 15:55:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ConstantMerge.cpp DeadArgumentElimination.cpp DeadTypeElimination.cpp ExtractFunction.cpp GlobalDCE.cpp IPConstantPropagation.cpp Internalize.cpp LowerSetJmp.cpp Parallelize.cpp PruneEH.cpp RaiseAllocations.cpp Message-ID: <200311212154.PAA10345@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: ConstantMerge.cpp updated: 1.23 -> 1.24 DeadArgumentElimination.cpp updated: 1.13 -> 1.14 DeadTypeElimination.cpp updated: 1.47 -> 1.48 ExtractFunction.cpp updated: 1.6 -> 1.7 GlobalDCE.cpp updated: 1.30 -> 1.31 IPConstantPropagation.cpp updated: 1.4 -> 1.5 Internalize.cpp updated: 1.20 -> 1.21 LowerSetJmp.cpp updated: 1.13 -> 1.14 Parallelize.cpp updated: 1.11 -> 1.12 PruneEH.cpp updated: 1.6 -> 1.7 RaiseAllocations.cpp updated: 1.20 -> 1.21 --- Log message: Finegrainify namespacification --- Diffs of the changes: (+26 -49) Index: llvm/lib/Transforms/IPO/ConstantMerge.cpp diff -u llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.23 llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.24 --- llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.23 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/ConstantMerge.cpp Fri Nov 21 15:54:21 2003 @@ -21,8 +21,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumMerged("constmerge", "Number of global constants merged"); @@ -37,7 +36,7 @@ RegisterOpt X("constmerge","Merge Duplicate Global Constants"); } -Pass *createConstantMergePass() { return new ConstantMerge(); } +Pass *llvm::createConstantMergePass() { return new ConstantMerge(); } bool ConstantMerge::run(Module &M) { std::map CMap; @@ -80,4 +79,3 @@ return MadeChanges; } -} // End llvm namespace Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.13 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.14 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.13 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Fri Nov 21 15:54:21 2003 @@ -29,8 +29,7 @@ #include "Support/Statistic.h" #include "Support/iterator" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumArgumentsEliminated("deadargelim", @@ -108,8 +107,8 @@ /// createDeadArgEliminationPass - This pass removes arguments from functions /// which are not used by the body of the function. /// -Pass *createDeadArgEliminationPass() { return new DAE(); } -Pass *createDeadArgHackingPass() { return new DAH(); } +Pass *llvm::createDeadArgEliminationPass() { return new DAE(); } +Pass *llvm::createDeadArgHackingPass() { return new DAH(); } static inline bool CallPassesValueThoughVararg(Instruction *Call, const Value *Arg) { @@ -578,6 +577,3 @@ RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); return true; } - -} // End llvm namespace - Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.47 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.48 --- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.47 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp Fri Nov 21 15:54:21 2003 @@ -18,8 +18,7 @@ #include "llvm/SymbolTable.h" #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { struct DTE : public Pass { @@ -42,7 +41,7 @@ NumKilled("deadtypeelim", "Number of unused typenames removed from symtab"); } -Pass *createDeadTypeEliminationPass() { +Pass *llvm::createDeadTypeEliminationPass() { return new DTE(); } @@ -96,5 +95,3 @@ return Changed; } - -} // End llvm namespace Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.6 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.7 --- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.6 Mon Nov 17 13:35:17 2003 +++ llvm/lib/Transforms/IPO/ExtractFunction.cpp Fri Nov 21 15:54:22 2003 @@ -6,11 +6,11 @@ // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// + #include "llvm/Transforms/IPO.h" #include "llvm/Pass.h" #include "llvm/Module.h" - -namespace llvm { +using namespace llvm; namespace { class FunctionExtractorPass : public Pass { @@ -89,8 +89,6 @@ RegisterPass X("extract", "Function Extractor"); } -Pass *createFunctionExtractionPass(Function *F) { +Pass *llvm::createFunctionExtractionPass(Function *F) { return new FunctionExtractorPass(F); } - -} // End llvm namespace Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.30 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.31 --- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.30 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/GlobalDCE.cpp Fri Nov 21 15:54:22 2003 @@ -21,8 +21,7 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumFunctions("globaldce","Number of functions removed"); @@ -49,7 +48,7 @@ RegisterOpt X("globaldce", "Dead Global Elimination"); } -Pass *createGlobalDCEPass() { return new GlobalDCE(); } +Pass *llvm::createGlobalDCEPass() { return new GlobalDCE(); } bool GlobalDCE::run(Module &M) { bool Changed = false; @@ -198,4 +197,3 @@ return true; } -} // End llvm namespace Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp diff -u llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.4 llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.5 --- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.4 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/IPConstantPropagation.cpp Fri Nov 21 15:54:22 2003 @@ -21,8 +21,7 @@ #include "llvm/Constants.h" #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumArgumentsProped("ipconstprop", @@ -38,7 +37,7 @@ RegisterOpt X("ipconstprop", "Interprocedural constant propagation"); } -Pass *createIPConstantPropagationPass() { return new IPCP(); } +Pass *llvm::createIPConstantPropagationPass() { return new IPCP(); } bool IPCP::run(Module &M) { bool Changed = false; @@ -117,6 +116,7 @@ Value *V = ArgumentConstants[i].first; if (ConstantPointerRef *CPR = dyn_cast(V)) V = CPR->getValue(); + AI->replaceAllUsesWith(V); ++NumArgumentsProped; MadeChange = true; @@ -124,4 +124,3 @@ return MadeChange; } -} // End llvm namespace Index: llvm/lib/Transforms/IPO/Internalize.cpp diff -u llvm/lib/Transforms/IPO/Internalize.cpp:1.20 llvm/lib/Transforms/IPO/Internalize.cpp:1.21 --- llvm/lib/Transforms/IPO/Internalize.cpp:1.20 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/Internalize.cpp Fri Nov 21 15:54:22 2003 @@ -21,8 +21,7 @@ #include "Support/Statistic.h" #include #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumFunctions("internalize", "Number of functions internalized"); @@ -118,8 +117,6 @@ RegisterOpt X("internalize", "Internalize Global Symbols"); } // end anonymous namespace -Pass *createInternalizePass() { +Pass *llvm::createInternalizePass() { return new InternalizePass(); } - -} // End llvm namespace Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.13 llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.14 --- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.13 Thu Nov 20 12:25:19 2003 +++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp Fri Nov 21 15:54:22 2003 @@ -33,6 +33,7 @@ // pass invokable via the "opt" command at will. //===----------------------------------------------------------------------===// +#include "llvm/Transforms/IPO.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" @@ -46,8 +47,7 @@ #include "Support/Statistic.h" #include "Support/StringExtras.h" #include "Support/VectorExtras.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> LongJmpsTransformed("lowersetjmp", @@ -533,9 +533,8 @@ "", &UI); } -Pass* createLowerSetJmpPass() +Pass* llvm::createLowerSetJmpPass() { return new LowerSetJmp(); } -} // End llvm namespace Index: llvm/lib/Transforms/IPO/Parallelize.cpp diff -u llvm/lib/Transforms/IPO/Parallelize.cpp:1.11 llvm/lib/Transforms/IPO/Parallelize.cpp:1.12 --- llvm/lib/Transforms/IPO/Parallelize.cpp:1.11 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/Parallelize.cpp Fri Nov 21 15:54:22 2003 @@ -52,8 +52,7 @@ #include "Support/hash_map" #include #include - -namespace llvm { +using namespace llvm; //---------------------------------------------------------------------------- // Global constants used in marking Cilk functions and function calls. @@ -538,4 +537,3 @@ return true; } -} // End llvm namespace Index: llvm/lib/Transforms/IPO/PruneEH.cpp diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.6 llvm/lib/Transforms/IPO/PruneEH.cpp:1.7 --- llvm/lib/Transforms/IPO/PruneEH.cpp:1.6 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/PruneEH.cpp Fri Nov 21 15:54:22 2003 @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Transforms/IPO.h" #include "llvm/CallGraphSCCPass.h" #include "llvm/Function.h" #include "llvm/Intrinsics.h" @@ -22,8 +23,7 @@ #include "llvm/Analysis/CallGraph.h" #include "Support/Statistic.h" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumRemoved("prune-eh", "Number of invokes removed"); @@ -39,7 +39,7 @@ RegisterOpt X("prune-eh", "Remove unused exception handling info"); } -Pass *createPruneEHPass() { return new PruneEH(); } +Pass *llvm::createPruneEHPass() { return new PruneEH(); } bool PruneEH::runOnSCC(const std::vector &SCC) { @@ -107,4 +107,3 @@ return MadeChange; } -} // End llvm namespace Index: llvm/lib/Transforms/IPO/RaiseAllocations.cpp diff -u llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.20 llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.21 --- llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.20 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Transforms/IPO/RaiseAllocations.cpp Fri Nov 21 15:54:22 2003 @@ -21,8 +21,7 @@ #include "llvm/Pass.h" #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumRaised("raiseallocs", "Number of allocations raised"); @@ -52,7 +51,7 @@ // createRaiseAllocationsPass - The interface to this file... -Pass *createRaiseAllocationsPass() { +Pass *llvm::createRaiseAllocationsPass() { return new RaiseAllocations(); } @@ -197,4 +196,3 @@ return Changed; } -} // End llvm namespace From lattner at cs.uiuc.edu Fri Nov 21 15:58:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 15:58:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/InlineSimple.cpp Message-ID: <200311212157.PAA25501@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: InlineSimple.cpp updated: 1.58 -> 1.59 --- Log message: Considering that CI is not even IN SCOPE here, I wooda thought the compiler would have caught this. *sigh* --- Diffs of the changes: (+1 -1) Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.58 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.59 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.58 Fri Nov 21 15:46:09 2003 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Fri Nov 21 15:57:29 2003 @@ -62,7 +62,7 @@ Reduction += CI->getCalledValue() == V ? 500 : 0; } else if (InvokeInst *II = dyn_cast(*UI)) { // Turning an indirect call into a direct call is a BIG win - Reduction += CI->getCalledValue() == V ? 500 : 0; + Reduction += II->getCalledValue() == V ? 500 : 0; } else { // Figure out if this instruction will be removed due to simple constant // propagation. From brukman at cs.uiuc.edu Fri Nov 21 16:12:09 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 16:12:09 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311212211.QAA31765@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.57 -> 1.58 --- Log message: Added note about PR140: gccld generates script to run apps and load libraries. --- Diffs of the changes: (+1 -0) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.57 llvm/docs/ReleaseNotes.html:1.58 --- llvm/docs/ReleaseNotes.html:1.57 Thu Nov 20 14:59:57 2003 +++ llvm/docs/ReleaseNotes.html Fri Nov 21 16:11:12 2003 @@ -167,6 +167,7 @@
      • bugpoint must not pass -R to Mach-O linker
      • crash assigning into an array in a struct which contains a bitfield.
      • Oversized integer bitfields cause crash
      • +
      • gccld produces a runner script that includes command-line options to load the necessary shared objects
      • [llvm-gcc] Bitfields & large array don't mix well
      • [llvm-gcc] Complex division is not supported
      • [llvm-gcc] Illegal union field reference
      • From lattner at cs.uiuc.edu Fri Nov 21 16:30:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 16:30:05 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Verifier/2003-11-21-FunctionReturningStructure.ll Message-ID: <200311212229.QAA10205@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Verifier: 2003-11-21-FunctionReturningStructure.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: (+5 -0) Index: llvm/test/Regression/Verifier/2003-11-21-FunctionReturningStructure.ll diff -c /dev/null llvm/test/Regression/Verifier/2003-11-21-FunctionReturningStructure.ll:1.1 *** /dev/null Fri Nov 21 16:28:59 2003 --- llvm/test/Regression/Verifier/2003-11-21-FunctionReturningStructure.ll Fri Nov 21 16:28:49 2003 *************** *** 0 **** --- 1,5 ---- + + %T = type { int } + + declare %T %test() + From brukman at cs.uiuc.edu Fri Nov 21 16:31:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 16:31:00 2003 Subject: [llvm-commits] CVS: llvm/docs/AliasAnalysis.html Message-ID: <200311212230.QAA15303@zion.cs.uiuc.edu> Changes in directory llvm/docs: AliasAnalysis.html updated: 1.9 -> 1.10 --- Log message: Made paragraph structure more consistent. --- Diffs of the changes: (+23 -27) Index: llvm/docs/AliasAnalysis.html diff -u llvm/docs/AliasAnalysis.html:1.9 llvm/docs/AliasAnalysis.html:1.10 --- llvm/docs/AliasAnalysis.html:1.9 Mon Oct 27 12:18:16 2003 +++ llvm/docs/AliasAnalysis.html Fri Nov 21 16:30:25 2003 @@ -5,7 +5,6 @@ Alias Analysis Infrastructure in LLVM -
        @@ -58,30 +57,28 @@
        -

        -Alias Analysis (or Pointer Analysis) is a technique which attempts to determine -whether or not two pointers ever can point to the same object in memory. -Traditionally, Alias Analyses respond to a query with either a Alias Analysis (or Pointer Analysis) is a technique which attempts to +determine whether or not two pointers ever can point to the same object in +memory. Traditionally, Alias Analyses respond to a query with either a Must, May, or No alias response, indicating that two pointers do point to the same object, might point to the same object, or are -known not to point to the same object. -

        -

        -The AliasAnalysis class is the +known not to point to the same object.

        + +

        The AliasAnalysis class is the centerpiece of the LLVM Alias Analysis related infrastructure. This class is the common interface between clients of alias analysis information and the implementations providing it. In addition to simple alias analysis information, this class exposes Mod/Ref information from those implementations which can provide it, allowing for powerful analyses and transformations to work well -together. -

        -

        -This document contains information necessary to successfully implement this +together.

        + +

        This document contains information necessary to successfully implement this interface, use it, and to test both sides. It also explains some of the finer points about what exactly results mean. If you feel that something is unclear or should be added, please let me -know. -

        +know.

        +
        @@ -91,21 +88,20 @@
        -

        -The AliasAnalysis class defines -the interface that Alias Analysis implementations should support. This class -exports two important enums: AliasResult and ModRefResult -which represent the result of an alias query or a mod/ref query, -respectively. -

        -

        -The AliasAnalysis interface exposes information about memory, represented in + +

        The AliasAnalysis class +defines the interface that Alias Analysis implementations should support. This +class exports two important enums: AliasResult and +ModRefResult which represent the result of an alias query or a mod/ref +query, respectively.

        + +

        The AliasAnalysis interface exposes information about memory, represented in several different ways. In particular, memory objects are represented as a starting address and size, and function calls are represented as the actual call or invoke instructions that performs the call. The AliasAnalysis interface also exposes some helper methods which allow you to get -mod/ref information for arbitrary instructions. -

        +mod/ref information for arbitrary instructions.

        +
        @@ -487,7 +483,7 @@
        Chris Lattner
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2003/10/27 18:18:16 $ + Last modified: $Date: 2003/11/21 22:30:25 $
        From lattner at cs.uiuc.edu Fri Nov 21 16:33:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 16:33:01 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200311212232.QAA15805@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.140 -> 1.141 --- Log message: Check return types of functions --- Diffs of the changes: (+3 -0) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.140 llvm/lib/AsmParser/llvmAsmParser.y:1.141 --- llvm/lib/AsmParser/llvmAsmParser.y:1.140 Fri Nov 21 14:27:35 2003 +++ llvm/lib/AsmParser/llvmAsmParser.y Fri Nov 21 16:32:16 2003 @@ -1395,6 +1395,9 @@ UnEscapeLexed($2); std::string FunctionName($2); + if (!(*$1)->isFirstClassType() && *$1 != Type::VoidTy) + ThrowException("LLVM functions cannot return aggregate types!"); + std::vector ParamTypeList; if ($4) { // If there are arguments... for (std::vector >::iterator I = $4->begin(); From lattner at cs.uiuc.edu Fri Nov 21 16:33:09 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 16:33:09 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Function.cpp Verifier.cpp Message-ID: <200311212232.QAA15814@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Function.cpp updated: 1.57 -> 1.58 Verifier.cpp updated: 1.73 -> 1.74 --- Log message: Check return types of functions --- Diffs of the changes: (+6 -0) Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.57 llvm/lib/VMCore/Function.cpp:1.58 --- llvm/lib/VMCore/Function.cpp:1.57 Fri Nov 21 14:23:48 2003 +++ llvm/lib/VMCore/Function.cpp Fri Nov 21 16:32:23 2003 @@ -95,6 +95,9 @@ ArgumentList.setParent(this); SymTab = new SymbolTable(); + assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy) + && "LLVM functions cannot return aggregate values!"); + // Create the arguments vector, all arguments start out unnamed. for (unsigned i = 0, e = Ty->getNumParams(); i != e; ++i) { assert(Ty->getParamType(i) != Type::VoidTy && Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.73 llvm/lib/VMCore/Verifier.cpp:1.74 --- llvm/lib/VMCore/Verifier.cpp:1.73 Fri Nov 21 14:33:27 2003 +++ llvm/lib/VMCore/Verifier.cpp Fri Nov 21 16:32:23 2003 @@ -241,6 +241,9 @@ Assert2(FT->getNumParams() == NumArgs, "# formal arguments must match # of arguments for function type!", &F, FT); + Assert1(F.getReturnType()->isFirstClassType() || + F.getReturnType() == Type::VoidTy, + "Functions cannot return aggregate values!", &F); // Check that the argument values match the function type for this function... unsigned i = 0; From brukman at cs.uiuc.edu Fri Nov 21 17:27:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 17:27:01 2003 Subject: [llvm-commits] CVS: llvm-www/status/index.html Message-ID: <200311212326.RAA07712@zion.cs.uiuc.edu> Changes in directory llvm-www/status: index.html updated: 1.33 -> 1.34 --- Log message: recode and screen: confirmed working. --- Diffs of the changes: (+22 -22) Index: llvm-www/status/index.html diff -u llvm-www/status/index.html:1.33 llvm-www/status/index.html:1.34 --- llvm-www/status/index.html:1.33 Thu Nov 20 23:13:20 2003 +++ llvm-www/status/index.html Fri Nov 21 17:26:28 2003 @@ -45,6 +45,26 @@
        Status Notes
        recode3.621 Nov 2003WORKSpasses its own regression test suite
        screen3.9.1521 Nov 2003Requires patch. The issue + with the types char* vs. unsigned char* has been resolved, + and the patch has been accepted into screen
        nanogrep 2.5 18 Nov 2003WORKSWORKS Passes own regression tests.
        recode3.6passes its own regression test suite
        screen3.9.1529 Aug 2003Requires patch. The issue - with the types char* vs. unsigned char* has been resolved, - and the patch has been accepted into screen
        ruby 3.9.15 21 Nov 2003WORKS Requires patch. The issue with the types char* vs. unsigned char* has been resolved, and the patch has been accepted into screen
        - -
          LLVM 1.1 Release Notes
        + + + + + LLVM 1.1 Release Notes + + + +
        + LLVM 1.1 Release Notes +
          -
        1. Introduction -
        2. What's New? -
        3. Portability and Supported Platforms -
        4. Installation Instructions +
        5. Introduction
        6. +
        7. What's New?
        8. +
        9. Portability and Supported Platforms
        10. +
        11. Installation Instructions
        12. Known Problems -
        13. Additional Information -
      +
    +
  • Additional Information
  • + -

    Written by Chris Lattner

    +

    +

    Written by Chris Lattner

    +

    - -
    -Introduction -
    -
    -What's New? -
    -
    -Portability and Supported Platforms -
      + -LLVM has been extensively tested on Intel and AMD machines running Red +
      + +

      LLVM has been extensively tested on Intel and AMD machines running Red Hat Linux, and Sun UltraSPARC workstations running Solaris 8. Additionally, LLVM works on Mac OS/X 10.3 and above, but only with the C back-end (no native backend for the PowerPC is available yet). The core LLVM infrastructure uses "autoconf" for portability, so hopefully we work on more platforms than that. However, it is likely that we missed something, and that minor porting is required to get LLVM to work on -new platforms. We welcome portability patches and error messages.

      +new platforms. We welcome portability patches and error messages.

      +
      -
    -
    -Known Problems -
      + -This section contains all known problems with the LLVM system, listed by +
      + +

      This section contains all known problems with the LLVM system, listed by component. As new problems are discovered, they will be added to these -sections. +sections.

      +
      - -


    Known problems with the LLVM Core

      + + + +
      + +
        -
      • In the JIT, dlsym on a symbol compiled by the JIT will not work.

        +

      • In the JIT, dlsym on a symbol compiled by the JIT will not +work.
      • The JIT does not use mutexes to protect its internal data structures. As - such, execution of a threaded program could cause these data structures to - be corrupted.

        +such, execution of a threaded program could cause these data structures to be +corrupted.

      • -
      • It is not possible to dlopen an LLVM bytecode file in the JIT.

        +

      • It is not possible to dlopen an LLVM bytecode file in the JIT.
      • Linking in static archive files (.a files) is very slow (there is no symbol -table in the archive).

        +table in the archive).

      • LLVM cannot handle structures with -more than 256 elements.

        +more than 256 elements.

      • + +
      + +
      + + + -


    Known problems with the C front-end

    Bugs:


    Known problems with the C++ front-end

    Bugs:Notes:

      + + + +

      + Notes +
      + +
      + +
      • The C++ front-end is based on a pre-release of the GCC 3.4 C++ parser. This parser is significantly more standards compliant (and picky) than prior GCC @@ -387,7 +470,7 @@ performed. In particular, destructors for objects in the longjmping function and in the setjmp receiver function may not be run. Objects in intervening stack frames will be destroyed however (which is - better than most compilers).

        + better than most compilers).

      • The LLVM C++ front-end follows the Itanium C++ ABI. @@ -398,79 +481,110 @@ Itanium ABI C++ compilers (such as G++, the Intel and HP compilers, etc). However, the exception handling mechanism used by LLVM is very different from the model used in the Itanium ABI, so exceptions will not - interact correctly . + interact correctly.
      • Code for executing destructors when unwinding is not shared (this is a quality of implementation problem, - which does not effect functionality).

        + which does not effect functionality).

      • +
      - -


    Known problems with the X86 back-end


    Known problems with the Sparc back-end


    Known problems with the C back-end

      + + + + + +
      + +
      • The C back-end produces code that violates the ANSI C Type-Based Alias Analysis rules. As such, special options may be necessary to compile the code (for example, GCC requires the -fno-strict-aliasing option). This -problem probably cannot be fixed.

        +problem probably cannot be fixed.

      • Initializers for global variables -cannot include special floating point numbers like Not-A-Number or Infinity.

        +cannot include special floating point numbers like Not-A-Number or +Infinity.

      • Zero arg vararg functions are not supported. This should not affect LLVM produced by the C or C++ -frontends.

        +frontends.

      • The code produces by the C back-end has only been tested with the Sun CC, GCC, and Intel compilers. It is possible that it will have to be adjusted to -support other C compilers.

        +support other C compilers.

      • +
      +
      -
    -
    -Additional Information -
      + -A wide variety of additional information is available on the LLVM web page, +
      + +

      A wide variety of additional information is available on the LLVM web page, including mailing lists publications describing algorithms and components implemented in LLVM. The web page also contains versions of the API documentation which is up-to-date with the CVS version of the source code. You can access versions of these documents specific to this release by going into -the "llvm/doc/" directory in the LLVM tree.

      +the "llvm/doc/" directory in the LLVM tree.

      -If you have any questions or comments about LLVM, please feel free to contact us -via the mailing lists.

      +

      If you have any questions or comments about LLVM, please feel free to contact +us via the mailing lists.

      +
      -
    - -
    +
    + -Maintained By: The LLVM Team
    - - -Last modified: Thu Nov 20 14:59:29 CST 2003 - - + + From brukman at cs.uiuc.edu Fri Nov 21 19:01:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 19:01:01 2003 Subject: [llvm-commits] CVS: llvm/docs/llvm.css Message-ID: <200311220100.TAA27796@zion.cs.uiuc.edu> Changes in directory llvm/docs: llvm.css updated: 1.7 -> 1.8 --- Log message: * No borders on images used as links * Drop font-size from doc_footer class This is now valid CSS. --- Diffs of the changes: (+4 -1) Index: llvm/docs/llvm.css diff -u llvm/docs/llvm.css:1.7 llvm/docs/llvm.css:1.8 --- llvm/docs/llvm.css:1.7 Wed Nov 12 14:31:18 2003 +++ llvm/docs/llvm.css Fri Nov 21 18:59:08 2003 @@ -5,6 +5,9 @@ /* Common styles */ .body { color: black; background: white; margin: 0 0 0 0 } +/* No borders on image links */ +a:link img, a:visited img {border-style: none} + /* * Documentation */ @@ -37,7 +40,7 @@ .doc_text { text-align: left; padding-left: 20pt } -.doc_footer { text-align: left; padding: 0 0 0 0; font-size 12pt } +.doc_footer { text-align: left; padding: 0 0 0 0 } .doc_red { color: red } From brukman at cs.uiuc.edu Fri Nov 21 19:01:12 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 19:01:12 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311220100.TAA27803@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.59 -> 1.60 --- Log message: This document is now valid HTML 4.01 Strict and valid CSS. We shall display images to that effect. If you modify this file, check that you haven't broken anything by clicking on those links, or I will hunt you down and force you to memorize the HTML and CSS specs!! --- Diffs of the changes: (+19 -16) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.59 llvm/docs/ReleaseNotes.html:1.60 --- llvm/docs/ReleaseNotes.html:1.59 Fri Nov 21 18:38:41 2003 +++ llvm/docs/ReleaseNotes.html Fri Nov 21 19:00:11 2003 @@ -27,11 +27,9 @@
  • Known problems with the C back-end
  • Additional Information
  • - - -
    +

    Written by Chris Lattner

    @@ -87,7 +85,7 @@
  • LLVM has been moved into an 'llvm' C++ namespace, for easier integration with third-party -code. Note that due to a bug in GDB 5.x, to debug namespacified LLVM code, +code. Note that due to a bug in GDB 5.x, to debug namespacified LLVM code, you will need to upgrade to GDB 6.
  • @@ -302,13 +300,13 @@
  • The following Unix system functionality has not been tested and may not work: -
      -
    1. sigsetjmp, siglongjmp - These are not turned into the - appropriate invoke/unwind instructions. Note that - setjmp and longjmp are compiled correctly. -
    2. getcontext, setcontext, makecontext - - These functions have not been tested. -
  • +
      +
    1. sigsetjmp, siglongjmp - These are not turned into the + appropriate invoke/unwind instructions. Note that + setjmp and longjmp are compiled correctly. +
    2. getcontext, setcontext, makecontext + - These functions have not been tested. +
  • Although many GCC extensions are supported, some are not. In particular, the following extensions are known to not be supported: @@ -326,7 +324,7 @@
  • Target Builtins: Built-in functions specific to particular targets.
  • Thread-Local: Per-thread variables.
  • Pragmas: Pragmas accepted by GCC.
  • - +

    The following GCC extensions are partially supported. An ignored attribute means that the LLVM compiler ignores the presence of the attribute, @@ -416,7 +414,9 @@

  • Function Names: Printable strings which are the name of the current function.
  • Unnamed Fields: Unnamed struct/union fields within structs/unions.
  • Attribute Syntax: Formal syntax for attributes.
  • - + + +

    If you run into GCC extensions which have not been included in any of these lists, please let us know (also including whether or not they work).

    @@ -581,9 +581,12 @@
    From brukman at cs.uiuc.edu Fri Nov 21 19:08:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 19:08:00 2003 Subject: [llvm-commits] CVS: llvm/docs/AliasAnalysis.html Message-ID: <200311220107.TAA32725@zion.cs.uiuc.edu> Changes in directory llvm/docs: AliasAnalysis.html updated: 1.10 -> 1.11 --- Log message: This page now uses valid HTML 4.01 Strict and valid CSS. --- Diffs of the changes: (+7 -5) Index: llvm/docs/AliasAnalysis.html diff -u llvm/docs/AliasAnalysis.html:1.10 llvm/docs/AliasAnalysis.html:1.11 --- llvm/docs/AliasAnalysis.html:1.10 Fri Nov 21 16:30:25 2003 +++ llvm/docs/AliasAnalysis.html Fri Nov 21 19:07:30 2003 @@ -471,8 +471,7 @@

    The -aa-eval pass simply iterates through all pairs of pointers in a function and asks an alias analysis whether or not the pointers alias. This gives an indication of the precision of the alias analysis. Statistics are -printed. -

    +printed.

    @@ -481,9 +480,12 @@
    From lattner at cs.uiuc.edu Fri Nov 21 19:16:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 19:16:01 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311220115.TAA00593@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.60 -> 1.61 --- Log message: Add newly fixed pr --- Diffs of the changes: (+3 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.60 llvm/docs/ReleaseNotes.html:1.61 --- llvm/docs/ReleaseNotes.html:1.60 Fri Nov 21 19:00:11 2003 +++ llvm/docs/ReleaseNotes.html Fri Nov 21 19:14:58 2003 @@ -123,6 +123,8 @@ href="http://llvm.cs.uiuc.edu/PR127">sped up a lot (up to 4x in some cases). +
  • Methods and functions in anonymous namespaces now get internal linkage.
  • +

    In this release, the following bugs in the previous release were fixed:

    @@ -586,7 +588,7 @@ Valid CSS!
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2003/11/22 01:00:11 $ + Last modified: $Date: 2003/11/22 01:14:58 $ From brukman at cs.uiuc.edu Fri Nov 21 19:25:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 19:25:01 2003 Subject: [llvm-commits] CVS: llvm/docs/llvm.css Message-ID: <200311220124.TAA11311@zion.cs.uiuc.edu> Changes in directory llvm/docs: llvm.css updated: 1.8 -> 1.9 --- Log message: Styles for the page footer to align images properly. --- Diffs of the changes: (+3 -0) Index: llvm/docs/llvm.css diff -u llvm/docs/llvm.css:1.8 llvm/docs/llvm.css:1.9 --- llvm/docs/llvm.css:1.8 Fri Nov 21 18:59:08 2003 +++ llvm/docs/llvm.css Fri Nov 21 19:23:53 2003 @@ -8,6 +8,9 @@ /* No borders on image links */ a:link img, a:visited img {border-style: none} +address img { float: right; width: 88px; height: 31px; } +address { clear: right; } + /* * Documentation */ From brukman at cs.uiuc.edu Fri Nov 21 19:25:11 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 19:25:11 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200311220124.TAA11316@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.61 -> 1.62 --- Log message: Put the W3C graphics on the right side of the page. --- Diffs of the changes: (+8 -7) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.61 llvm/docs/ReleaseNotes.html:1.62 --- llvm/docs/ReleaseNotes.html:1.61 Fri Nov 21 19:14:58 2003 +++ llvm/docs/ReleaseNotes.html Fri Nov 21 19:23:39 2003 @@ -582,14 +582,15 @@
    - + Last modified: $Date: 2003/11/22 01:23:39 $ + From brukman at cs.uiuc.edu Fri Nov 21 19:27:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 19:27:02 2003 Subject: [llvm-commits] CVS: llvm/docs/AliasAnalysis.html Message-ID: <200311220126.TAA16590@zion.cs.uiuc.edu> Changes in directory llvm/docs: AliasAnalysis.html updated: 1.11 -> 1.12 --- Log message: Align the W3C images on the right side, bottom of page. --- Diffs of the changes: (+9 -8) Index: llvm/docs/AliasAnalysis.html diff -u llvm/docs/AliasAnalysis.html:1.11 llvm/docs/AliasAnalysis.html:1.12 --- llvm/docs/AliasAnalysis.html:1.11 Fri Nov 21 19:07:30 2003 +++ llvm/docs/AliasAnalysis.html Fri Nov 21 19:26:21 2003 @@ -478,15 +478,16 @@
    - + Valid HTML 4.01! + + Chris Lattner
    + The LLVM Compiler Infrastructure
    + Last modified: $Date: 2003/11/22 01:26:21 $ + From lattner at cs.uiuc.edu Fri Nov 21 19:30:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 19:30:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SymbolStripping.cpp Message-ID: <200311220129.TAA17373@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SymbolStripping.cpp updated: 1.23 -> 1.24 --- Log message: Finegrainify namespacification The module stripping pass should not strip symbols on external globals --- Diffs of the changes: (+16 -14) Index: llvm/lib/Transforms/Scalar/SymbolStripping.cpp diff -u llvm/lib/Transforms/Scalar/SymbolStripping.cpp:1.23 llvm/lib/Transforms/Scalar/SymbolStripping.cpp:1.24 --- llvm/lib/Transforms/Scalar/SymbolStripping.cpp:1.23 Tue Nov 11 16:41:34 2003 +++ llvm/lib/Transforms/Scalar/SymbolStripping.cpp Fri Nov 21 19:29:35 2003 @@ -25,8 +25,7 @@ #include "llvm/Module.h" #include "llvm/SymbolTable.h" #include "llvm/Pass.h" - -namespace llvm { +using namespace llvm; static bool StripSymbolTable(SymbolTable &SymTab) { bool RemovedSymbol = false; @@ -34,15 +33,20 @@ for (SymbolTable::iterator I = SymTab.begin(); I != SymTab.end(); ++I) { std::map &Plane = I->second; - SymbolTable::type_iterator B; - while ((B = Plane.begin()) != Plane.end()) { // Found nonempty type plane! + SymbolTable::type_iterator B = Plane.begin(); + while (B != Plane.end()) { // Found nonempty type plane! Value *V = B->second; - if (isa(V) || isa(V)) - SymTab.type_remove(B); - else - V->setName("", &SymTab); // Set name to "", removing from symbol table! - RemovedSymbol = true; - assert(Plane.begin() != B && "Symbol not removed from table!"); + if (isa(V) || isa(V)) { + SymTab.type_remove(B++); + RemovedSymbol = true; + } else { + ++B; + if (!isa(V) || cast(V)->hasInternalLinkage()){ + // Set name to "", removing from symbol table! + V->setName("", &SymTab); + RemovedSymbol = true; + } + } } } @@ -69,12 +73,10 @@ "Strip symbols from module and functions"); } -Pass *createSymbolStrippingPass() { +Pass *llvm::createSymbolStrippingPass() { return new SymbolStripping(); } -Pass *createFullSymbolStrippingPass() { +Pass *llvm::createFullSymbolStrippingPass() { return new FullSymbolStripping(); } - -} // End llvm namespace From brukman at cs.uiuc.edu Fri Nov 21 19:31:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Nov 21 19:31:01 2003 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200311220130.TAA22196@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.45 -> 1.46 --- Log message: Switch to the standard footer. This page is not yet W3C-compliant. --- Diffs of the changes: (+5 -6) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.45 llvm/docs/GettingStarted.html:1.46 --- llvm/docs/GettingStarted.html:1.45 Fri Nov 7 13:43:14 2003 +++ llvm/docs/GettingStarted.html Fri Nov 21 19:30:01 2003 @@ -1086,12 +1086,11 @@
    - +
    + Chris Lattner
    + The LLVM Compiler Infrastructure
    + Last modified: $Date: 2003/11/22 01:30:01 $ +
    From lattner at cs.uiuc.edu Fri Nov 21 20:11:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 20:11:01 2003 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp Message-ID: <200311220210.UAA11896@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.25 -> 1.26 --- Log message: Do not crash when dealing with invoke and unwind instructions! --- Diffs of the changes: (+7 -4) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.25 llvm/tools/bugpoint/CrashDebugger.cpp:1.26 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.25 Tue Nov 11 16:41:34 2003 +++ llvm/tools/bugpoint/CrashDebugger.cpp Fri Nov 21 20:10:38 2003 @@ -195,20 +195,23 @@ // Loop over and delete any hack up any blocks that are not listed... for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) for (Function::iterator BB = I->begin(), E = I->end(); BB != E; ++BB) - if (!Blocks.count(BB) && !isa(BB->getTerminator())) { + if (!Blocks.count(BB) && BB->getTerminator()->getNumSuccessors()) { // Loop over all of the successors of this block, deleting any PHI nodes // that might include it. for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) (*SI)->removePredecessor(BB); + if (BB->getTerminator()->getType() != Type::VoidTy) + BB->getTerminator()->replaceAllUsesWith( + Constant::getNullValue(BB->getTerminator()->getType())); + // Delete the old terminator instruction... BB->getInstList().pop_back(); // Add a new return instruction of the appropriate type... const Type *RetTy = BB->getParent()->getReturnType(); - ReturnInst *RI = new ReturnInst(RetTy == Type::VoidTy ? 0 : - Constant::getNullValue(RetTy)); - BB->getInstList().push_back(RI); + new ReturnInst(RetTy == Type::VoidTy ? 0 : + Constant::getNullValue(RetTy), BB); } // The CFG Simplifier pass may delete one of the basic blocks we are From lattner at cs.uiuc.edu Fri Nov 21 20:12:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 20:12:02 2003 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/CodeGeneratorBug.cpp Message-ID: <200311220211.UAA11901@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: CodeGeneratorBug.cpp updated: 1.32 -> 1.33 --- Log message: Use new interfaces --- Diffs of the changes: (+2 -6) Index: llvm/tools/bugpoint/CodeGeneratorBug.cpp diff -u llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.32 llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.33 --- llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.32 Tue Nov 11 16:41:34 2003 +++ llvm/tools/bugpoint/CodeGeneratorBug.cpp Fri Nov 21 20:10:26 2003 @@ -381,15 +381,11 @@ BB->getInstList().push_back(call); // if the type of old function wasn't void, return value of call - ReturnInst *ret; if (oldMain->getReturnType() != Type::VoidTy) { - ret = new ReturnInst(call); + new ReturnInst(call, BB); } else { - ret = new ReturnInst(); + new ReturnInst(0, BB); } - - // Add the return instruction to the BasicBlock - BB->getInstList().push_back(ret); } DisambiguateGlobalSymbols(Program); From lattner at cs.uiuc.edu Fri Nov 21 20:14:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 20:14:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp Message-ID: <200311220213.UAA13259@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.68 -> 1.69 --- Log message: Do not crash when deleing a region with a dead invoke instruction --- Diffs of the changes: (+4 -0) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.68 llvm/lib/Transforms/Scalar/ADCE.cpp:1.69 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.68 Fri Nov 21 10:52:01 2003 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Fri Nov 21 20:13:08 2003 @@ -430,6 +430,10 @@ } // Delete the old terminator instruction... + const Type *TermTy = BB->getTerminator()->getType(); + if (TermTy != Type::VoidTy) + BB->getTerminator()->replaceAllUsesWith( + Constant::getNullValue(TermTy)); BB->getInstList().pop_back(); const Type *RetTy = Func->getReturnType(); new ReturnInst(RetTy != Type::VoidTy ? From lattner at cs.uiuc.edu Fri Nov 21 20:21:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 20:21:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PruneEH/2003-11-21-PHIUpdate.llx Message-ID: <200311220220.UAA14515@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PruneEH: 2003-11-21-PHIUpdate.llx added (r1.1) --- Log message: New testcase that breaks the pruneeh pass --- Diffs of the changes: (+15 -0) Index: llvm/test/Regression/Transforms/PruneEH/2003-11-21-PHIUpdate.llx diff -c /dev/null llvm/test/Regression/Transforms/PruneEH/2003-11-21-PHIUpdate.llx:1.1 *** /dev/null Fri Nov 21 20:20:18 2003 --- llvm/test/Regression/Transforms/PruneEH/2003-11-21-PHIUpdate.llx Fri Nov 21 20:20:08 2003 *************** *** 0 **** --- 1,15 ---- + ; RUN: llvm-as < %s | opt -prune-eh -disable-output + + implementation + + internal void %callee() { ; does not throw + ret void + } + + int %caller() { + invoke void %callee() to label %E except label %E + + E: + %X = phi int [0, %0], [0, %0] + ret int %X + } From lattner at cs.uiuc.edu Fri Nov 21 20:21:11 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 20:21:11 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/PruneEH.cpp Message-ID: <200311220220.UAA15425@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: PruneEH.cpp updated: 1.7 -> 1.8 --- Log message: Fix bug: Transforms/PruneEH/2003-11-21-PHIUpdate.llx --- Diffs of the changes: (+2 -0) Index: llvm/lib/Transforms/IPO/PruneEH.cpp diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.7 llvm/lib/Transforms/IPO/PruneEH.cpp:1.8 --- llvm/lib/Transforms/IPO/PruneEH.cpp:1.7 Fri Nov 21 15:54:22 2003 +++ llvm/lib/Transforms/IPO/PruneEH.cpp Fri Nov 21 20:20:36 2003 @@ -91,12 +91,14 @@ // Anything that used the value produced by the invoke instruction // now uses the value produced by the call instruction. II->replaceAllUsesWith(Call); + II->getExceptionalDest()->removePredecessor(II->getParent()); // Insert a branch to the normal destination right before the // invoke. new BranchInst(II->getNormalDest(), II); // Finally, delete the invoke instruction! + I->getInstList().pop_back(); ++NumRemoved; From lattner at cs.uiuc.edu Fri Nov 21 20:32:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 21 20:32:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/PruneEH.cpp Message-ID: <200311220226.UAA16100@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: PruneEH.cpp updated: 1.8 -> 1.9 --- Log message: Delete dead line --- Diffs of the changes: (+0 -1) Index: llvm/lib/Transforms/IPO/PruneEH.cpp diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.8 llvm/lib/Transforms/IPO/PruneEH.cpp:1.9 --- llvm/lib/Transforms/IPO/PruneEH.cpp:1.8 Fri Nov 21 20:20:36 2003 +++ llvm/lib/Transforms/IPO/PruneEH.cpp Fri Nov 21 20:26:17 2003 @@ -98,7 +98,6 @@ new BranchInst(II->getNormalDest(), II); // Finally, delete the invoke instruction! - I->getInstList().pop_back(); ++NumRemoved; From gaeke at cs.uiuc.edu Fri Nov 21 22:59:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Nov 21 22:59:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll Message-ID: <200311220458.WAA20110@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CBackend: 2003-11-21-ConstantShiftExpr.ll added (r1.1) --- Log message: C Writer was dumping core on this test case. --- Diffs of the changes: (+6 -0) Index: llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll diff -c /dev/null llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll:1.1 *** /dev/null Fri Nov 21 22:58:35 2003 --- llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll Fri Nov 21 22:58:25 2003 *************** *** 0 **** --- 1,6 ---- + %y = weak global sbyte 0 + implementation + uint %testcase() { + entry: + ret uint shr (uint cast (sbyte* %y to uint), ubyte 4) + } From gaeke at cs.uiuc.edu Fri Nov 21 23:03:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Nov 21 23:03:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll Message-ID: <200311220502.XAA20165@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CBackend: 2003-11-21-ConstantShiftExpr.ll updated: 1.1 -> 1.2 --- Log message: Strengthen test case. --- Diffs of the changes: (+5 -1) Index: llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll diff -u llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll:1.1 llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll:1.2 --- llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll:1.1 Fri Nov 21 22:58:25 2003 +++ llvm/test/Regression/CBackend/2003-11-21-ConstantShiftExpr.ll Fri Nov 21 23:01:57 2003 @@ -1,6 +1,10 @@ %y = weak global sbyte 0 implementation -uint %testcase() { +uint %testcaseshr() { entry: ret uint shr (uint cast (sbyte* %y to uint), ubyte 4) +} +uint %testcaseshl() { +entry: + ret uint shl (uint cast (sbyte* %y to uint), ubyte 4) } From gaeke at cs.uiuc.edu Fri Nov 21 23:04:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Nov 21 23:04:02 2003 Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp Message-ID: <200311220503.XAA20180@zion.cs.uiuc.edu> Changes in directory llvm/lib/CWriter: Writer.cpp updated: 1.144 -> 1.145 --- Log message: Fix PR149 - support constant shift expressions. --- Diffs of the changes: (+4 -0) Index: llvm/lib/CWriter/Writer.cpp diff -u llvm/lib/CWriter/Writer.cpp:1.144 llvm/lib/CWriter/Writer.cpp:1.145 --- llvm/lib/CWriter/Writer.cpp:1.144 Sun Nov 16 16:06:14 2003 +++ llvm/lib/CWriter/Writer.cpp Fri Nov 21 23:02:56 2003 @@ -396,6 +396,8 @@ case Instruction::SetLE: case Instruction::SetGT: case Instruction::SetGE: + case Instruction::Shl: + case Instruction::Shr: Out << "("; printConstant(CE->getOperand(0)); switch (CE->getOpcode()) { @@ -410,6 +412,8 @@ case Instruction::SetLE: Out << " <= "; break; case Instruction::SetGT: Out << " > "; break; case Instruction::SetGE: Out << " >= "; break; + case Instruction::Shl: Out << " << "; break; + case Instruction::Shr: Out << " >> "; break; default: assert(0 && "Illegal opcode here!"); } printConstant(CE->getOperand(1)); From gaeke at cs.uiuc.edu Fri Nov 21 23:19:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Nov 21 23:19:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp Message-ID: <200311220518.XAA20727@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectSimple.cpp updated: 1.140 -> 1.141 --- Log message: Stub for constant shift expr support. --- Diffs of the changes: (+23 -0) Index: llvm/lib/Target/X86/InstSelectSimple.cpp diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.140 llvm/lib/Target/X86/InstSelectSimple.cpp:1.141 --- llvm/lib/Target/X86/InstSelectSimple.cpp:1.140 Tue Nov 18 11:47:05 2003 +++ llvm/lib/Target/X86/InstSelectSimple.cpp Fri Nov 21 23:18:35 2003 @@ -224,6 +224,13 @@ MachineBasicBlock::iterator &IP, Value *Op0, Value *Op1, unsigned Opcode, unsigned TargetReg); + + /// emitShiftOperation - Common code shared between visitShiftInst and + /// constant expression support. + void emitShiftOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator &IP, + Value *Op0, Value *Op1, unsigned Opcode, + unsigned TargetReg); /// copyConstantToRegister - Output the instructions required to put the @@ -384,6 +391,12 @@ CE->getOpcode(), R); return; + case Instruction::Shl: + case Instruction::Shr: + emitShiftOperation(MBB, IP, CE->getOperand(0), CE->getOperand(1), + CE->getOpcode(), R); + break; + default: std::cerr << "Offending expr: " << C << "\n"; assert(0 && "Constant expression not yet handled!\n"); @@ -1566,6 +1579,16 @@ const unsigned *Opc = NonConstantOperand[isLeftShift*2+isSigned]; BuildMI(BB, Opc[Class], 1, DestReg).addReg(SrcReg); } +} + +/// emitShiftOperation - Common code shared between visitShiftInst and +/// constant expression support. +void ISel::emitShiftOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator &IP, + Value *Op0, Value *Op1, unsigned Opcode, + unsigned TargetReg) { + // FIXME: Should do all the stuff from visitShiftInst, but use BMI + assert (0 && "Constant shift operations not yet handled"); } From gaeke at cs.uiuc.edu Sat Nov 22 00:19:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Sat Nov 22 00:19:02 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/LLC/select.ll Message-ID: <200311220618.AAA02898@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/LLC: select.ll updated: 1.8 -> 1.9 --- Log message: Unbreak this test case - llvm-as no longer tolerates redefining names in any given type plane. --- Diffs of the changes: (+3 -3) Index: llvm/test/Regression/LLC/select.ll diff -u llvm/test/Regression/LLC/select.ll:1.8 llvm/test/Regression/LLC/select.ll:1.9 --- llvm/test/Regression/LLC/select.ll:1.8 Wed Jan 15 12:06:37 2003 +++ llvm/test/Regression/LLC/select.ll Sat Nov 22 00:18:35 2003 @@ -10,15 +10,15 @@ begin ;