[llvm-commits] llvm-gcc patch
FYI, this updates llvm-gcc to work with recent llvm cvs changes. -Chris Index: llvm-backend.cpp === --- llvm-backend.cpp(revision 118395) +++ llvm-backend.cpp(working copy) @@ -575,10 +575,10 @@ bool ValidateRegisterVariable(tree decl) if (TREE_THIS_VOLATILE(decl)) warning("volatile register variables don%'t work as you might wish"); -SET_DECL_LLVM(decl, ConstantBool::False); +SET_DECL_LLVM(decl, ConstantBool::getFalse()); return false; // Everything ok. } - SET_DECL_LLVM(decl, ConstantBool::True); + SET_DECL_LLVM(decl, ConstantBool::getTrue()); return true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.145 -> 1.146 --- Log message: Minor cleanups --- Diffs of the changes: (+24 -36) Type.cpp | 60 1 files changed, 24 insertions(+), 36 deletions(-) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.145 llvm/lib/VMCore/Type.cpp:1.146 --- llvm/lib/VMCore/Type.cpp:1.145 Thu Sep 28 18:38:07 2006 +++ llvm/lib/VMCore/Type.cppThu Sep 28 18:45:00 2006 @@ -382,44 +382,32 @@ //===--===// -// Static 'Type' data +// Primitive 'Type' data //===--===// -#define DeclarePrimType(TY, Str) \ - struct VISIBILITY_HIDDEN TY##Type : public Type { \ -TY##Type() : Type(Str, Type::TY##TyID) {}\ - }; \ - static ManagedStatic The##TY##Ty - -namespace { - DeclarePrimType(Void, "void"); - DeclarePrimType(Bool, "bool"); - DeclarePrimType(SByte, "sbyte"); - DeclarePrimType(UByte, "ubyte"); - DeclarePrimType(Short, "short"); - DeclarePrimType(UShort, "ushort"); - DeclarePrimType(Int,"int"); - DeclarePrimType(UInt, "uint"); - DeclarePrimType(Long, "long"); - DeclarePrimType(ULong, "ulong"); - DeclarePrimType(Float, "float"); - DeclarePrimType(Double, "double"); - DeclarePrimType(Label, "label"); -} - -Type *Type::VoidTy = &*TheVoidTy; -Type *Type::BoolTy = &*TheBoolTy; -Type *Type::SByteTy = &*TheSByteTy; -Type *Type::UByteTy = &*TheUByteTy; -Type *Type::ShortTy = &*TheShortTy; -Type *Type::UShortTy = &*TheUShortTy; -Type *Type::IntTy= &*TheIntTy; -Type *Type::UIntTy = &*TheUIntTy; -Type *Type::LongTy = &*TheLongTy; -Type *Type::ULongTy = &*TheULongTy; -Type *Type::FloatTy = &*TheFloatTy; -Type *Type::DoubleTy = &*TheDoubleTy; -Type *Type::LabelTy = &*TheLabelTy; +#define DeclarePrimType(TY, Str) \ + namespace { \ +struct VISIBILITY_HIDDEN TY##Type : public Type { \ + TY##Type() : Type(Str, Type::TY##TyID) {}\ +}; \ + }\ + static ManagedStatic The##TY##Ty; \ + Type *Type::TY##Ty = &*The##TY##Ty + +DeclarePrimType(Void, "void"); +DeclarePrimType(Bool, "bool"); +DeclarePrimType(SByte, "sbyte"); +DeclarePrimType(UByte, "ubyte"); +DeclarePrimType(Short, "short"); +DeclarePrimType(UShort, "ushort"); +DeclarePrimType(Int,"int"); +DeclarePrimType(UInt, "uint"); +DeclarePrimType(Long, "long"); +DeclarePrimType(ULong, "ulong"); +DeclarePrimType(Float, "float"); +DeclarePrimType(Double, "double"); +DeclarePrimType(Label, "label"); +#undef DeclarePrimType //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.144 -> 1.145 --- Log message: Now that ConstantBool::True/False are gone, we can modify Type.cpp to eliminate its static dtors, without having code that depends on order of initialization. Eliminate static ctors/dtors from Type.cpp. --- Diffs of the changes: (+73 -91) Type.cpp | 164 --- 1 files changed, 73 insertions(+), 91 deletions(-) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.144 llvm/lib/VMCore/Type.cpp:1.145 --- llvm/lib/VMCore/Type.cpp:1.144 Sun Aug 27 07:54:02 2006 +++ llvm/lib/VMCore/Type.cppThu Sep 28 18:38:07 2006 @@ -21,6 +21,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/ManagedStatic.h" #include #include using namespace llvm; @@ -57,13 +58,15 @@ // for types as they are needed. Because resolution of types must invalidate // all of the abstract type descriptions, we keep them in a seperate map to make // this easy. -static std::map ConcreteTypeDescriptions; -static std::map AbstractTypeDescriptions; +static ManagedStatic > ConcreteTypeDescriptions; +static ManagedStatic > AbstractTypeDescriptions; Type::Type(const char *Name, TypeID id) : ID(id), Abstract(false), RefCount(0), ForwardType(0) { assert(Name && Name[0] && "Should use other ctor if no name!"); - ConcreteTypeDescriptions[this] = Name; + (*ConcreteTypeDescriptions)[this] = Name; } @@ -250,18 +253,18 @@ std::vector &TypeStack) { if (isa(Ty)) { // Base case for the recursion std::map::iterator I = - AbstractTypeDescriptions.lower_bound(Ty); -if (I != AbstractTypeDescriptions.end() && I->first == Ty) + AbstractTypeDescriptions->lower_bound(Ty); +if (I != AbstractTypeDescriptions->end() && I->first == Ty) return I->second; std::string Desc = "opaque"; -AbstractTypeDescriptions.insert(std::make_pair(Ty, Desc)); +AbstractTypeDescriptions->insert(std::make_pair(Ty, Desc)); return Desc; } if (!Ty->isAbstract()) { // Base case for the recursion std::map::iterator I = - ConcreteTypeDescriptions.find(Ty); -if (I != ConcreteTypeDescriptions.end()) return I->second; + ConcreteTypeDescriptions->find(Ty); +if (I != ConcreteTypeDescriptions->end()) return I->second; } // Check to see if the Type is already on the stack... @@ -354,9 +357,9 @@ const std::string &Type::getDescription() const { if (isAbstract()) -return getOrCreateDesc(AbstractTypeDescriptions, this); +return getOrCreateDesc(*AbstractTypeDescriptions, this); else -return getOrCreateDesc(ConcreteTypeDescriptions, this); +return getOrCreateDesc(*ConcreteTypeDescriptions, this); } @@ -382,39 +385,41 @@ // Static 'Type' data //===--===// -namespace { - struct VISIBILITY_HIDDEN PrimType : public Type { -PrimType(const char *S, TypeID ID) : Type(S, ID) {} - }; -} +#define DeclarePrimType(TY, Str) \ + struct VISIBILITY_HIDDEN TY##Type : public Type { \ +TY##Type() : Type(Str, Type::TY##TyID) {}\ + }; \ + static ManagedStatic The##TY##Ty -static PrimType TheVoidTy ("void" , Type::VoidTyID); -static PrimType TheBoolTy ("bool" , Type::BoolTyID); -static PrimType TheSByteTy ("sbyte" , Type::SByteTyID); -static PrimType TheUByteTy ("ubyte" , Type::UByteTyID); -static PrimType TheShortTy ("short" , Type::ShortTyID); -static PrimType TheUShortTy("ushort", Type::UShortTyID); -static PrimType TheIntTy ("int" , Type::IntTyID); -static PrimType TheUIntTy ("uint" , Type::UIntTyID); -static PrimType TheLongTy ("long" , Type::LongTyID); -static PrimType TheULongTy ("ulong" , Type::ULongTyID); -static PrimType TheFloatTy ("float" , Type::FloatTyID); -static PrimType TheDoubleTy("double", Type::DoubleTyID); -static PrimType TheLabelTy ("label" , Type::LabelTyID); - -Type *Type::VoidTy = &TheVoidTy; -Type *Type::BoolTy = &TheBoolTy; -Type *Type::SByteTy = &TheSByteTy; -Type *Type::UByteTy = &TheUByteTy; -Type *Type::ShortTy = &TheShortTy; -Type *Type::UShortTy = &TheUShortTy; -Type *Type::IntTy= &TheIntTy; -Type *Type::UIntTy = &TheUIntTy; -Type *Type::LongTy = &TheLongTy; -Type *Type::ULongTy = &TheULongTy; -Type *Type::FloatTy = &TheFloatTy; -Type *Type::DoubleTy = &TheDoubleTy; -Type *Type::LabelTy = &TheLabelTy; +namespace { + DeclarePrimType(Void, "void"); + DeclarePrimType(Bool, "bool"); + DeclarePrimType(SByte, "sbyte"); + DeclarePrimType(UByte, "ubyte"); + DeclarePrimType(Short, "short"); + DeclarePrimType(UShort, "ushort"); + DeclarePrimType(Int,"int"); + DeclarePrimType(UInt, "uint"); + De
[llvm-commits] CVS: llvm/include/llvm/Type.h
Changes in directory llvm/include/llvm: Type.h updated: 1.89 -> 1.90 --- Log message: Now that ConstantBool::True/False are gone, we can modify Type.cpp to eliminate its static dtors, without having code that depends on order of initialization. Eliminate static ctors/dtors from Type.cpp. --- Diffs of the changes: (+0 -5) Type.h |5 - 1 files changed, 5 deletions(-) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.89 llvm/include/llvm/Type.h:1.90 --- llvm/include/llvm/Type.h:1.89 Sat Sep 23 01:09:45 2006 +++ llvm/include/llvm/Type.hThu Sep 28 18:38:07 2006 @@ -347,11 +347,6 @@ /// void removeAbstractTypeUser(AbstractTypeUser *U) const; - /// clearAllTypeMaps - This method frees all internal memory used by the - /// type subsystem, which can be used in environments where this memory is - /// otherwise reported as a leak. - static void clearAllTypeMaps(); - private: /// isSizedDerivedType - Derived types like structures and arrays are sized /// iff all of the members of the type are sized as well. Since asking for ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Constants.h
Changes in directory llvm/include/llvm: Constants.h updated: 1.87 -> 1.88 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+11 -7) Constants.h | 18 +++--- 1 files changed, 11 insertions(+), 7 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.87 llvm/include/llvm/Constants.h:1.88 --- llvm/include/llvm/Constants.h:1.87 Sun Sep 17 23:58:06 2006 +++ llvm/include/llvm/Constants.h Thu Sep 28 18:36:21 2006 @@ -125,12 +125,14 @@ class ConstantBool : public ConstantIntegral { ConstantBool(bool V); public: - static ConstantBool *True, *False; ///< The True & False values + /// getTrue/getFalse - Return the singleton true/false values. + static ConstantBool *getTrue(); + static ConstantBool *getFalse(); /// This method is provided mostly for compatibility with the other /// ConstantIntegral subclasses. /// @brief Static factory method for getting a ConstantBool instance. - static ConstantBool *get(bool Value) { return Value ? True : False; } + static ConstantBool *get(bool Value) { return Value ? getTrue() : getFalse();} /// This method is provided mostly for compatibility with the other /// ConstantIntegral subclasses. @@ -139,7 +141,9 @@ /// Returns the opposite value of this ConstantBool value. /// @brief Get inverse value. - inline ConstantBool *inverted() const { return (this==True) ? False : True; } + inline ConstantBool *inverted() const { +return getValue() ? getFalse() : getTrue(); + } /// @returns the value of this ConstantBool /// @brief return the boolean value of this constant. @@ -147,10 +151,10 @@ /// @see ConstantIntegral for details /// @brief Implement overrides - virtual bool isNullValue() const { return this == False; } - virtual bool isMaxValue() const { return this == True; } - virtual bool isMinValue() const { return this == False; } - virtual bool isAllOnesValue() const { return this == True; } + virtual bool isNullValue() const { return getValue() == false; } + virtual bool isMaxValue() const { return getValue() == true; } + virtual bool isMinValue() const { return getValue() == false; } + virtual bool isAllOnesValue() const { return getValue() == true; } /// @brief Methods to support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ConstantBool *) { return true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.51 -> 1.52 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+4 -4) ScalarEvolution.cpp |8 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.51 llvm/lib/Analysis/ScalarEvolution.cpp:1.52 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.51 Sun Aug 27 17:30:17 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Sep 28 18:35:49 2006 @@ -1689,7 +1689,7 @@ // Evaluate the condition for this iteration. Result = ConstantExpr::get(SetCCOpcode, Result, RHS); if (!isa(Result)) break; // Couldn't decide for sure -if (Result == ConstantBool::False) { +if (cast(Result)->getValue() == false) { #if 0 std::cerr << "\n***\n*** Computed loop count " << *ItCst << "\n*** From global " << *GV << "*** BB: " << *L->getHeader() @@ -2168,7 +2168,7 @@ if (ConstantBool *CB = dyn_cast(ConstantExpr::getSetLT(R1->getValue(), R2->getValue( { -if (CB != ConstantBool::True) +if (CB->getValue() == false) std::swap(R1, R2); // R1 is the minimum root now. // We can only use this value if the chrec ends up with an exact zero @@ -2198,7 +2198,7 @@ if (SCEVConstant *C = dyn_cast(V)) { Constant *Zero = Constant::getNullValue(C->getValue()->getType()); Constant *NonZero = ConstantExpr::getSetNE(C->getValue(), Zero); -if (NonZero == ConstantBool::True) +if (NonZero == ConstantBool::getTrue()) return getSCEV(Zero); return UnknownValue; // Otherwise it will loop infinitely. } @@ -2386,7 +2386,7 @@ if (ConstantBool *CB = dyn_cast(ConstantExpr::getSetLT(R1->getValue(), R2->getValue( { -if (CB != ConstantBool::True) +if (CB->getValue() == false) std::swap(R1, R2); // R1 is the minimum root now. // Make sure the root is not off by one. The returned iteration should ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp InstructionCombining.cpp LoopUnswitch.cpp PredicateSimplifier.cpp SCCP.cpp
Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.34 -> 1.35 InstructionCombining.cpp updated: 1.515 -> 1.516 LoopUnswitch.cpp updated: 1.47 -> 1.48 PredicateSimplifier.cpp updated: 1.15 -> 1.16 SCCP.cpp updated: 1.131 -> 1.132 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+108 -115) CorrelatedExprs.cpp |7 +-- InstructionCombining.cpp | 109 --- LoopUnswitch.cpp | 19 PredicateSimplifier.cpp | 73 ++- SCCP.cpp | 15 ++ 5 files changed, 108 insertions(+), 115 deletions(-) Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.34 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.35 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.34 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Thu Sep 28 18:35:21 2006 @@ -788,12 +788,12 @@ // Propagate information into the true block... // - PropagateEquality(BI->getCondition(), ConstantBool::True, + PropagateEquality(BI->getCondition(), ConstantBool::getTrue(), getRegionInfo(BI->getSuccessor(0))); // Propagate information into the false block... // - PropagateEquality(BI->getCondition(), ConstantBool::False, + PropagateEquality(BI->getCondition(), ConstantBool::getFalse(), getRegionInfo(BI->getSuccessor(1))); } @@ -971,8 +971,7 @@ // See if we can figure out a result for this instruction... Relation::KnownResult Result = getSetCCResult(SCI, RI); if (Result != Relation::Unknown) { - PropagateEquality(SCI, Result ? ConstantBool::True : ConstantBool::False, -RI); + PropagateEquality(SCI, ConstantBool::get(Result != 0), RI); } } } Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.516 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515 Wed Sep 20 10:37:57 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 28 18:35:21 2006 @@ -1989,7 +1989,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::False); + UpdateValueUsesWith(CondI, ConstantBool::getFalse()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(2)); else @@ -2001,7 +2001,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::True); + UpdateValueUsesWith(CondI, ConstantBool::getTrue()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(1)); else @@ -2213,7 +2213,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) -UpdateValueUsesWith(CondI, ConstantBool::False); +UpdateValueUsesWith(CondI, ConstantBool::getFalse()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(2)); else @@ -2225,7 +2225,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) -UpdateValueUsesWith(CondI, ConstantBool::True); +UpdateValueUsesWith(CondI, ConstantBool::getTrue()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(1)); else @@ -2344,14 +2344,14 @@ /// SetCC instruction. static Value *getSetCCValue(unsigned Opcode, Value *LHS, Value *RHS) { switch (Opcode) { - case 0: return ConstantBool::False; + case 0: return ConstantBool::getFalse(); case 1: return new SetCondInst(Instruction::SetGT, LHS, RHS); case 2: return new SetCondInst(Instruction::SetEQ, LHS, RHS); case 3: return new SetCondInst(Instruction::SetGE, LHS, RHS); case 4: return new SetCondInst(Instruction::SetLT, LHS, RHS); case 5: return new SetCondInst(Instruction::SetNE, LHS, RHS); case 6: return new SetCondInst(Instruction::SetLE, LHS, RHS); - case 7: return ConstantBool::True; + case 7: return ConstantBool::getTrue(); default: assert(0 && "Illegal SetCCCode!"); return 0; } } @@ -2851,7 +2851,7 @@ default: assert(0 && "Unknown integer condition code!"); case Instruction::SetEQ: // (X == 13
[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp
Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.64 -> 1.65 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+5 -4) GlobalOpt.cpp |9 + 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.64 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.65 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.64 Thu Sep 14 13:23:27 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 28 18:35:21 2006 @@ -709,7 +709,7 @@ // keep track of whether the global was initialized yet or not. GlobalVariable *InitBool = new GlobalVariable(Type::BoolTy, false, GlobalValue::InternalLinkage, - ConstantBool::False, GV->getName()+".init"); + ConstantBool::getFalse(), GV->getName()+".init"); bool InitBoolUsed = false; // Loop over all uses of GV, processing them in turn. @@ -728,7 +728,7 @@ switch (SCI->getOpcode()) { default: assert(0 && "Unknown opcode!"); case Instruction::SetLT: -LV = ConstantBool::False; // X < null -> always false +LV = ConstantBool::getFalse(); // X < null -> always false break; case Instruction::SetEQ: case Instruction::SetLE: @@ -747,7 +747,7 @@ } else { StoreInst *SI = cast(GV->use_back()); // The global is initialized when the store to it occurs. - new StoreInst(ConstantBool::True, InitBool, SI); + new StoreInst(ConstantBool::getTrue(), InitBool, SI); SI->eraseFromParent(); } @@ -859,7 +859,8 @@ static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { // Create the new global, initializing it to false. GlobalVariable *NewGV = new GlobalVariable(Type::BoolTy, false, - GlobalValue::InternalLinkage, ConstantBool::False, GV->getName()+".b"); + GlobalValue::InternalLinkage, ConstantBool::getFalse(), + GV->getName()+".b"); GV->getParent()->getGlobalList().insert(GV, NewGV); Constant *InitVal = GV->getInitializer(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.91 -> 1.92 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provideConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+15 -17) ConstantFolding.cpp | 32 +++- 1 files changed, 15 insertions(+), 17 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.91 llvm/lib/VMCore/ConstantFolding.cpp:1.92 --- llvm/lib/VMCore/ConstantFolding.cpp:1.91Sun Sep 17 14:14:47 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Sep 28 18:34:49 2006 @@ -225,7 +225,7 @@ struct VISIBILITY_HIDDEN EmptyRules : public TemplateRules { static Constant *EqualTo(const Constant *V1, const Constant *V2) { -if (V1 == V2) return ConstantBool::True; +if (V1 == V2) return ConstantBool::getTrue(); return 0; } }; @@ -296,10 +296,10 @@ struct VISIBILITY_HIDDEN NullPointerRules : public TemplateRules { static Constant *EqualTo(const Constant *V1, const Constant *V2) { -return ConstantBool::True; // Null pointers are always equal +return ConstantBool::getTrue(); // Null pointers are always equal } static Constant *CastToBool(const Constant *V) { -return ConstantBool::False; +return ConstantBool::getFalse(); } static Constant *CastToSByte (const Constant *V) { return ConstantSInt::get(Type::SByteTy, 0); @@ -729,7 +729,7 @@ // FIXME: When we support 'external weak' references, we have to prevent // this transformation from happening. This code will need to be updated // to ignore external weak symbols when we support it. - return ConstantBool::True; + return ConstantBool::getTrue(); } else if (const ConstantExpr *CE = dyn_cast(V)) { if (CE->getOpcode() == Instruction::Cast) { Constant *Op = const_cast(CE->getOperand(0)); @@ -842,10 +842,8 @@ Constant *llvm::ConstantFoldSelectInstruction(const Constant *Cond, const Constant *V1, const Constant *V2) { - if (Cond == ConstantBool::True) -return const_cast(V1); - else if (Cond == ConstantBool::False) -return const_cast(V2); + if (const ConstantBool *CB = dyn_cast(Cond)) +return const_cast(CB->getValue() ? V1 : V2); if (isa(V1)) return const_cast(V2); if (isa(V2)) return const_cast(V1); @@ -1011,11 +1009,11 @@ // We distilled this down to a simple case, use the standard constant // folder. ConstantBool *R = dyn_cast(ConstantExpr::getSetEQ(V1, V2)); - if (R == ConstantBool::True) return Instruction::SetEQ; + if (R && R->getValue()) return Instruction::SetEQ; R = dyn_cast(ConstantExpr::getSetLT(V1, V2)); - if (R == ConstantBool::True) return Instruction::SetLT; + if (R && R->getValue()) return Instruction::SetLT; R = dyn_cast(ConstantExpr::getSetGT(V1, V2)); - if (R == ConstantBool::True) return Instruction::SetGT; + if (R && R->getValue()) return Instruction::SetGT; // If we couldn't figure it out, bail. return Instruction::BinaryOpsEnd; @@ -1240,20 +1238,20 @@ Opcode == Instruction::SetGE); case Instruction::SetLE: // If we know that V1 <= V2, we can only partially decide this relation. - if (Opcode == Instruction::SetGT) return ConstantBool::False; - if (Opcode == Instruction::SetLT) return ConstantBool::True; + if (Opcode == Instruction::SetGT) return ConstantBool::getFalse(); + if (Opcode == Instruction::SetLT) return ConstantBool::getTrue(); break; case Instruction::SetGE: // If we know that V1 >= V2, we can only partially decide this relation. - if (Opcode == Instruction::SetLT) return ConstantBool::False; - if (Opcode == Instruction::SetGT) return ConstantBool::True; + if (Opcode == Instruction::SetLT) return ConstantBool::getFalse(); + if (Opcode == Instruction::SetGT) return ConstantBool::getTrue(); break; case Instruction::SetNE: // If we know that V1 != V2, we can only partially decide this relation. - if (Opcode == Instruction::SetEQ) return ConstantBool::False; - if (Opcode == Instruction::SetNE) return ConstantBool::True; + if (Opcode == Instruction::SetEQ) return ConstantBool::getFalse(); + if (Opcode == Instruction::SetNE) return ConstantBool::getTrue(); break; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.162 -> 1.163 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+18 -8) Constants.cpp | 26 ++ 1 files changed, 18 insertions(+), 8 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.162 llvm/lib/VMCore/Constants.cpp:1.163 --- llvm/lib/VMCore/Constants.cpp:1.162 Wed Sep 27 19:38:19 2006 +++ llvm/lib/VMCore/Constants.cpp Thu Sep 28 18:34:27 2006 @@ -26,10 +26,6 @@ #include using namespace llvm; -ConstantBool *ConstantBool::True = new ConstantBool(true); -ConstantBool *ConstantBool::False = new ConstantBool(false); - - //===--===// // Constant Class //===--===// @@ -128,7 +124,7 @@ // Static constructor to create the maximum constant of an integral type... ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) { switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::True; + case Type::BoolTyID: return ConstantBool::getTrue(); case Type::SByteTyID: case Type::ShortTyID: case Type::IntTyID: @@ -152,7 +148,7 @@ // Static constructor to create the minimum constant for an integral type... ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) { switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::False; + case Type::BoolTyID: return ConstantBool::getFalse(); case Type::SByteTyID: case Type::ShortTyID: case Type::IntTyID: @@ -176,7 +172,7 @@ // Static constructor to create an integral constant with all bits set ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) { switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::True; + case Type::BoolTyID: return ConstantBool::getTrue(); case Type::SByteTyID: case Type::ShortTyID: case Type::IntTyID: @@ -877,6 +873,20 @@ }; } + +// ConstantBool::get*() implementation. + +ConstantBool *ConstantBool::getTrue() { + static ConstantBool *T = 0; + if (T) return T; + return T = new ConstantBool(true); +} +ConstantBool *ConstantBool::getFalse() { + static ConstantBool *F = 0; + if (F) return F; + return F = new ConstantBool(false); +} + // ConstantUInt::get() and ConstantSInt::get() implementations... // static ManagedStatic > SIntConstants; @@ -1380,7 +1390,7 @@ C = ConstantExpr::getCast(C, C->getType()->getSignedVersion()); return ConstantExpr::getCast(C, Ty); } else { -if (C == ConstantBool::True) +if (C == ConstantBool::getTrue()) return ConstantIntegral::getAllOnesValue(Ty); else return ConstantIntegral::getNullValue(Ty); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.h X86InstrInfo.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.h updated: 1.73 -> 1.74 X86InstrInfo.cpp updated: 1.60 -> 1.61 --- Log message: update comments --- Diffs of the changes: (+2 -1) X86ISelLowering.h |2 +- X86InstrInfo.cpp |1 + 2 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.73 llvm/lib/Target/X86/X86ISelLowering.h:1.74 --- llvm/lib/Target/X86/X86ISelLowering.h:1.73 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Thu Sep 28 18:33:12 2006 @@ -146,7 +146,7 @@ /// at function entry, used for PIC code. GlobalBaseReg, - /// TCPWrapper - A wrapper node for TargetConstantPool, + /// Wrapper - A wrapper node for TargetConstantPool, /// TargetExternalSymbol, and TargetGlobalAddress. Wrapper, Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.60 llvm/lib/Target/X86/X86InstrInfo.cpp:1.61 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.60 Fri Sep 8 01:48:29 2006 +++ llvm/lib/Target/X86/X86InstrInfo.cppThu Sep 28 18:33:12 2006 @@ -213,6 +213,7 @@ /// commute them. /// MachineInstr *X86InstrInfo::commuteInstruction(MachineInstr *MI) const { + // FIXME: Can commute cmoves by changing the condition! switch (MI->getOpcode()) { case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I -> A = SHLD16rri8 C, B, (16-I) case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I -> A = SHRD16rri8 C, B, (16-I) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCJITInfo.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCJITInfo.cpp updated: 1.29 -> 1.30 --- Log message: wrap long lines --- Diffs of the changes: (+4 -2) PPCJITInfo.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.29 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.30 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.29 Fri Sep 8 17:42:09 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Thu Sep 28 18:32:43 2006 @@ -70,7 +70,8 @@ extern "C" void PPC32CompilationCallback(); extern "C" void PPC64CompilationCallback(); -#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && !defined(__ppc64__) +#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ +!defined(__ppc64__) // CompilationCallback stub - We can't use a C function with inline assembly in // it, because we the prolog/epilog inserted by GCC won't work for us. Instead, // write our own wrapper, which does things our way, so we have complete control @@ -135,7 +136,8 @@ } #endif -#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && defined(__ppc64__) +#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ +defined(__ppc64__) asm( ".text\n" ".align 2\n" ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.15 -> 1.16 --- Log message: simplify code --- Diffs of the changes: (+1 -2) CppWriter.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.15 llvm/tools/llvm2cpp/CppWriter.cpp:1.16 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.15 Thu Sep 14 13:23:27 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Thu Sep 28 18:24:48 2006 @@ -677,8 +677,7 @@ } if (const ConstantBool *CB = dyn_cast(CV)) { Out << "ConstantBool* " << constName << " = ConstantBool::get(" -<< (CB == ConstantBool::True ? "true" : "false") -<< ");"; +<< (CB->getValue() ? "true" : "false") << ");"; } else if (const ConstantSInt *CI = dyn_cast(CV)) { Out << "ConstantSInt* " << constName << " = ConstantSInt::get(" << typeName << ", " << CI->getValue() << ");"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp
Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.271 -> 1.272 --- Log message: Simplify some code, reformat break's --- Diffs of the changes: (+12 -6) Writer.cpp | 18 -- 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.271 llvm/lib/Target/CBackend/Writer.cpp:1.272 --- llvm/lib/Target/CBackend/Writer.cpp:1.271 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Thu Sep 28 18:19:29 2006 @@ -638,10 +638,12 @@ switch (CPV->getType()->getTypeID()) { case Type::BoolTyID: -Out << (CPV == ConstantBool::False ? '0' : '1'); break; +Out << (cast(CPV)->getValue() ? '1' : '0'); +break; case Type::SByteTyID: case Type::ShortTyID: -Out << cast(CPV)->getValue(); break; +Out << cast(CPV)->getValue(); +break; case Type::IntTyID: if ((int)cast(CPV)->getValue() == (int)0x8000) Out << "((int)0x8000U)"; // Handle MININT specially to avoid warning @@ -653,15 +655,19 @@ if (cast(CPV)->isMinValue()) Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)"; else - Out << cast(CPV)->getValue() << "ll"; break; + Out << cast(CPV)->getValue() << "ll"; +break; case Type::UByteTyID: case Type::UShortTyID: -Out << cast(CPV)->getValue(); break; +Out << cast(CPV)->getValue(); +break; case Type::UIntTyID: -Out << cast(CPV)->getValue() << 'u'; break; +Out << cast(CPV)->getValue() << 'u'; +break; case Type::ULongTyID: -Out << cast(CPV)->getValue() << "ull"; break; +Out << cast(CPV)->getValue() << "ull"; +break; case Type::FloatTyID: case Type::DoubleTyID: { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.101 -> 1.102 --- Log message: simplify code --- Diffs of the changes: (+1 -1) AsmPrinter.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.101 llvm/lib/CodeGen/AsmPrinter.cpp:1.102 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.101 Tue Sep 26 19:06:07 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Thu Sep 28 18:17:41 2006 @@ -364,7 +364,7 @@ if (CV->isNullValue() || isa(CV)) O << "0"; else if (const ConstantBool *CB = dyn_cast(CV)) { -assert(CB == ConstantBool::True); +assert(CB->getValue()); O << "1"; } else if (const ConstantSInt *CI = dyn_cast(CV)) if (((CI->getValue() << 32) >> 32) == CI->getValue()) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.14 -> 1.15 --- Log message: Simplify some code --- Diffs of the changes: (+2 -2) ConstantRange.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.14 llvm/lib/Analysis/ConstantRange.cpp:1.15 --- llvm/lib/Analysis/ConstantRange.cpp:1.14Thu Apr 21 18:46:51 2005 +++ llvm/lib/Analysis/ConstantRange.cpp Thu Sep 28 18:14:29 2006 @@ -30,8 +30,8 @@ using namespace llvm; static ConstantIntegral *Next(ConstantIntegral *CI) { - if (CI->getType() == Type::BoolTy) -return CI == ConstantBool::True ? ConstantBool::False : ConstantBool::True; + if (ConstantBool *CB = dyn_cast(CI)) +return ConstantBool::get(!CB->getValue()); Constant *Result = ConstantExpr::getAdd(CI, ConstantInt::get(CI->getType(), 1)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Changes in directory llvm/lib/Transforms/IPO: ArgumentPromotion.cpp updated: 1.25 -> 1.26 --- Log message: Another attempt at making ArgPromotion smarter. This patch no longer breaks Burg. --- Diffs of the changes: (+49 -1) ArgumentPromotion.cpp | 50 +- 1 files changed, 49 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.25 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.26 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.25 Fri Sep 15 12:24:45 2006 +++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Thu Sep 28 18:02:22 2006 @@ -179,6 +179,53 @@ return true; } +/// AccessOccursOnPath - Returns true if and only if a load or GEP instruction +/// on Pointer occurs in Path, or in every control-flow path that succeeds it. +bool AccessOccursOnPath(Value* V, BasicBlock* Start) { + std::vector Worklist; + Worklist.push_back(Start); + + std::set Visited; + + while (!Worklist.empty()) { +BasicBlock* BB = Worklist.back(); +Worklist.pop_back(); +Visited.insert(BB); + +bool ContainsAccess = false; +for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + if (isa(I)) { +for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) + if (*OI == V) { +ContainsAccess = true; +break; + } + } else if (isa(I)) { +for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) + if (*OI == V) { +ContainsAccess = AccessOccursOnPath(I, I->getParent()); +break; + } + } + + if (ContainsAccess) + break; +} + +if (ContainsAccess) continue; + +TerminatorInst* TI = BB->getTerminator(); +if (isa(TI) || isa(TI)) { + for (unsigned i = 0; i < TI->getNumSuccessors(); ++i) +if (!Visited.count(TI->getSuccessor(i))) + Worklist.push_back(TI->getSuccessor(i)); +} else { + return false; +} + } + + return true; +} /// isSafeToPromoteArgument - As you might guess from the name of this method, /// it checks to see if it is both safe and useful to promote the argument. @@ -252,7 +299,8 @@ // of the pointer in the entry block of the function) or if we can prove that // all pointers passed in are always to legal locations (for example, no null // pointers are passed in, no pointers to free'd memory, etc). - if (!HasLoadInEntryBlock && !AllCalleesPassInValidPointerForArgument(Arg)) + if (!AccessOccursOnPath(Arg, Arg->getParent()->begin()) && + !AllCalleesPassInValidPointerForArgument(Arg)) return false; // Cannot prove that this is safe!! // Okay, now we know that the argument is only used by load instructions and ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp
Changes in directory llvm/lib/Transforms/Utils: CodeExtractor.cpp updated: 1.39 -> 1.40 --- Log message: simplify code --- Diffs of the changes: (+1 -1) CodeExtractor.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.39 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.40 --- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.39Sun Jan 22 16:53:01 2006 +++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Thu Sep 28 17:58:25 2006 @@ -470,7 +470,7 @@ case 0: case 1: break; // No value needed. case 2: // Conditional branch, return a bool -brVal = SuccNum ? ConstantBool::False : ConstantBool::True; +brVal = ConstantBool::get(!SuccNum); break; default: brVal = ConstantUInt::get(Type::UShortTy, SuccNum); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.206 -> 1.207 --- Log message: simplify code --- Diffs of the changes: (+1 -1) AsmWriter.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.206 llvm/lib/VMCore/AsmWriter.cpp:1.207 --- llvm/lib/VMCore/AsmWriter.cpp:1.206 Wed Sep 20 17:03:51 2006 +++ llvm/lib/VMCore/AsmWriter.cpp Thu Sep 28 17:50:29 2006 @@ -421,7 +421,7 @@ const int IndentSize = 4; static std::string Indent = "\n"; if (const ConstantBool *CB = dyn_cast(CV)) { -Out << (CB == ConstantBool::True ? "true" : "false"); +Out << (CB->getValue() ? "true" : "false"); } else if (const ConstantSInt *CI = dyn_cast(CV)) { Out << CI->getValue(); } else if (const ConstantUInt *CI = dyn_cast(CV)) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c
Changes in directory llvm/test/Regression/CFrontend: 2005-12-04-AttributeUsed.c updated: 1.1 -> 1.2 --- Log message: Use the -emit-llvm switch to generate LLVM assembly that can be parsed by the test case. --- Diffs of the changes: (+1 -1) 2005-12-04-AttributeUsed.c |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c diff -u llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.1 llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.2 --- llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.1 Sun Dec 4 22:48:12 2005 +++ llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c Thu Sep 28 16:36:21 2006 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X +// RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X int X __attribute__((used)); int Y; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll
Changes in directory llvm/test/Regression/Assembler: 2006-09-28-CrashOnInvalid.ll added (r1.1) --- Log message: Add a test case for PR902: http://llvm.org/PR902 . --- Diffs of the changes: (+7 -0) 2006-09-28-CrashOnInvalid.ll |7 +++ 1 files changed, 7 insertions(+) Index: llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll diff -c /dev/null llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll:1.1 *** /dev/null Thu Sep 28 16:20:16 2006 --- llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll Thu Sep 28 16:20:05 2006 *** *** 0 --- 1,7 + ; Test for PR902. This program is erroneous, but should not crash llvm-as. + ; This tests that a simple error is caught and processed correctly. + ; RUN: (llvm-as < %s) 2>&1 | grep 'FP constant invalid for type' + void %test() { + add int 1, 2.0 + ret void + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstr64Bit.td
Changes in directory llvm/lib/Target/PowerPC: PPCInstr64Bit.td updated: 1.19 -> 1.20 --- Log message: Shift amounts are always 32-bits, even in 64-bit mode. This fixes CodeGen/PowerPC/2006-09-28-shift_64.ll --- Diffs of the changes: (+6 -6) PPCInstr64Bit.td | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.19 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.20 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.19 Tue Jul 18 11:33:26 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.tdThu Sep 28 15:48:45 2006 @@ -168,15 +168,15 @@ def CMPLDI : DForm_6_ext<10, (ops CRRC:$dst, G8RC:$src1, u16imm:$src2), "cmpldi $dst, $src1, $src2", IntCompare>, isPPC64; -def SLD : XForm_6<31, 27, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB), +def SLD : XForm_6<31, 27, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB), "sld $rA, $rS, $rB", IntRotateD, - [(set G8RC:$rA, (shl G8RC:$rS, G8RC:$rB))]>, isPPC64; -def SRD : XForm_6<31, 539, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB), + [(set G8RC:$rA, (shl G8RC:$rS, GPRC:$rB))]>, isPPC64; +def SRD : XForm_6<31, 539, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB), "srd $rA, $rS, $rB", IntRotateD, - [(set G8RC:$rA, (srl G8RC:$rS, G8RC:$rB))]>, isPPC64; -def SRAD : XForm_6<31, 794, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB), + [(set G8RC:$rA, (srl G8RC:$rS, GPRC:$rB))]>, isPPC64; +def SRAD : XForm_6<31, 794, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB), "srad $rA, $rS, $rB", IntRotateD, - [(set G8RC:$rA, (sra G8RC:$rS, G8RC:$rB))]>, isPPC64; + [(set G8RC:$rA, (sra G8RC:$rS, GPRC:$rB))]>, isPPC64; def EXTSW : XForm_11<31, 986, (ops G8RC:$rA, G8RC:$rS), "extsw $rA, $rS", IntGeneral, [(set G8RC:$rA, (sext_inreg G8RC:$rS, i32))]>, isPPC64; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll
Changes in directory llvm/test/Regression/CodeGen/PowerPC: 2006-09-28-shift_64.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+27 -0) 2006-09-28-shift_64.ll | 27 +++ 1 files changed, 27 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll:1.1 *** /dev/null Thu Sep 28 15:48:27 2006 --- llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll Thu Sep 28 15:48:17 2006 *** *** 0 --- 1,27 + ; RUN: llvm-as < %s | llc -march=ppc64 + target endian = big + target pointersize = 64 + target triple = "powerpc64-apple-darwin8" + + implementation ; Functions: + + void %glArrayElement_CompExec() { + entry: + %tmp3 = and ulong 0, 18446744073701163007 ; [#uses=1] + br label %cond_true24 + + cond_false: ; preds = %cond_true24 + ret void + + cond_true24: ; preds = %cond_true24, %entry + %indvar.ph = phi uint [ 0, %entry ], [ %indvar.next, %cond_true24 ] ; [#uses=1] + %indvar = add uint 0, %indvar.ph; [#uses=2] + %code.0 = cast uint %indvar to ubyte; [#uses=1] + %tmp5 = add ubyte %code.0, 16 ; [#uses=1] + %tmp7 = shr ulong %tmp3, ubyte %tmp5; [#uses=1] + %tmp7 = cast ulong %tmp7 to int ; [#uses=1] + %tmp8 = and int %tmp7, 1; [#uses=1] + %tmp8 = seteq int %tmp8, 0 ; [#uses=1] + %indvar.next = add uint %indvar, 1 ; [#uses=1] + br bool %tmp8, label %cond_false, label %cond_true24 + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c
Changes in directory llvm/test/Regression/CFrontend: 2006-09-28-SimpleAsm.c added (r1.1) --- Log message: Testcase for PR924: http://llvm.org/PR924 --- Diffs of the changes: (+11 -0) 2006-09-28-SimpleAsm.c | 11 +++ 1 files changed, 11 insertions(+) Index: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1 *** /dev/null Thu Sep 28 13:58:12 2006 --- llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c Thu Sep 28 13:58:02 2006 *** *** 0 --- 1,11 + // RUN: %llvmgcc %s -S -o /dev/null && + // RUN: %llvmgcc %s -S -o - | grep 'ext: xorl %eax, eax; movl' && + // RUN: %llvmgcc %s -S -o - | grep 'nonext: xorl %eax, %eax; mov' + // PR924 + + void bar() { +// Extended asm +asm volatile ("ext: xorl %%eax, eax; movl eax, fs; movl eax, gs %%blah %= %% " : : "r"(1)); +// Non-extended asm. +asm volatile ("nonext: xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs %%blah %= %% "); + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp
Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.60 -> 1.61 --- Log message: TargetRegisterClass specifies the desired spill alignment. However, it cannot be honored if stack alignment is smaller. --- Diffs of the changes: (+6 -1) PrologEpilogInserter.cpp |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.61 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60 Wed Sep 27 19:10:27 2006 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Thu Sep 28 13:52:32 2006 @@ -190,7 +190,12 @@ int FrameIdx; if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) { // Nope, just spill it anywhere convenient. - FrameIdx = FFI->CreateStackObject(RC->getSize(), RC->getAlignment()); + unsigned Align = RC->getAlignment(); + unsigned StackAlign = TFI->getStackAlignment(); + // We may not be able to sastify the desired alignment specification of + // the TargetRegisterClass if the stack alignment is smaller. Use the min. + Align = std::min(Align, StackAlign); + FrameIdx = FFI->CreateStackObject(RC->getSize(), Align); if ((unsigned)FrameIdx < MinCSFrameIndex) MinCSFrameIndex = FrameIdx; if ((unsigned)FrameIdx > MaxCSFrameIndex) MaxCSFrameIndex = FrameIdx; } else { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/NewNightlyTest.pl
Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.61 -> 1.62 --- Log message: Fix search file for -release. --- Diffs of the changes: (+2 -2) NewNightlyTest.pl |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.61 llvm/utils/NewNightlyTest.pl:1.62 --- llvm/utils/NewNightlyTest.pl:1.61 Thu Sep 28 12:49:20 2006 +++ llvm/utils/NewNightlyTest.plThu Sep 28 13:45:11 2006 @@ -660,7 +660,7 @@ $afiles.= `find lib/ -iname '*.a' -ls`; $afiles.= `find tools/ -iname '*.a' -ls`; if($BUILDTYPE eq "release"){ -$afiles.= `find Release/ -iname '*.a' -ls`; +$afiles.= `find Release+Asserts/ -iname '*.a' -ls`; } elsif($BUILDTYPE eq "release-asserts") { $afiles.= `find Release-Asserts/ -iname '*.a' -ls`; } else { @@ -671,7 +671,7 @@ $ofiles.= `find lib/ -iname '*.o' -ls`; $ofiles.= `find tools/ -iname '*.o' -ls`; if($BUILDTYPE eq "release"){ -$ofiles.= `find Release/ -iname '*.o' -ls`; +$ofiles.= `find Release+Asserts/ -iname '*.o' -ls`; } elsif($BUILDTYPE eq "release-asserts") { $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`; } else { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/NewNightlyTest.pl
Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.60 -> 1.61 --- Log message: Add support for -release-asserts. --- Diffs of the changes: (+9 -1) NewNightlyTest.pl | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.60 llvm/utils/NewNightlyTest.pl:1.61 --- llvm/utils/NewNightlyTest.pl:1.60 Wed Sep 20 04:20:22 2006 +++ llvm/utils/NewNightlyTest.plThu Sep 28 12:49:20 2006 @@ -29,6 +29,7 @@ # -nodejagnu Do not run feature or regression tests # -parallelRun two parallel jobs with GNU Make. # -release Build an LLVM Release version +# -release-asserts Build an LLVM ReleaseAsserts version # -enable-llcbeta Enable testing of beta features in llc. # -disable-llc Disable LLC tests in the nightly tester. # -disable-jit Disable JIT tests in the nightly tester. @@ -133,6 +134,9 @@ if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } if (/^-release$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} + if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". + "DISABLE-ASSERTIONS=1 ". + "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release-asserts"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } if (/^-disable-llc$/){ $PROGTESTOPTS .= " DISABLE_LLC=1"; $CONFIGUREARGS .= " --disable-llc_diffs"; next; } @@ -206,7 +210,7 @@ "\"-nickname \""); } -if ($BUILDTYPE ne "release") { +if ($BUILDTYPE ne "release" && $BUILDTYPE ne "release-asserts") { $BUILDTYPE = "debug"; } @@ -657,6 +661,8 @@ $afiles.= `find tools/ -iname '*.a' -ls`; if($BUILDTYPE eq "release"){ $afiles.= `find Release/ -iname '*.a' -ls`; + } elsif($BUILDTYPE eq "release-asserts") { + $afiles.= `find Release-Asserts/ -iname '*.a' -ls`; } else { $afiles.= `find Debug/ -iname '*.a' -ls`; } @@ -666,6 +672,8 @@ $ofiles.= `find tools/ -iname '*.o' -ls`; if($BUILDTYPE eq "release"){ $ofiles.= `find Release/ -iname '*.o' -ls`; + } elsif($BUILDTYPE eq "release-asserts") { +$ofiles.= `find Release-Asserts/ -iname '*.o' -ls`; } else { $ofiles.= `find Debug/ -iname '*.o' -ls`; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html
Changes in directory llvm/docs: WritingAnLLVMPass.html updated: 1.49 -> 1.50 --- Log message: Provide a gdb usage fix provided by Zhongzing Xu. --- Diffs of the changes: (+2 -2) WritingAnLLVMPass.html |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.49 llvm/docs/WritingAnLLVMPass.html:1.50 --- llvm/docs/WritingAnLLVMPass.html:1.49 Sun Aug 27 19:45:38 2006 +++ llvm/docs/WritingAnLLVMPass.htmlThu Sep 28 11:53:47 2006 @@ -1593,7 +1593,7 @@ want: -(gdb) break PassManager::run +(gdb) break llvm::PassManager::run Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70. (gdb) run test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption] Starting program: opt test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption] @@ -1711,7 +1711,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.org";>The LLVM Compiler Infrastructure - Last modified: $Date: 2006/08/28 00:45:38 $ + Last modified: $Date: 2006/09/28 16:53:47 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.50 -> 1.51 --- Log message: "Once more into the breach, dear friends, once more, or fill the wall up with our English dead." No! Really! Serious this time...It was how the vreg uses were being adjusted that was causing hte Olden tests to fail. I corrected this and the Olden and Regression tests all passed. --- Diffs of the changes: (+42 -26) PHIElimination.cpp | 68 - 1 files changed, 42 insertions(+), 26 deletions(-) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.50 llvm/lib/CodeGen/PHIElimination.cpp:1.51 --- llvm/lib/CodeGen/PHIElimination.cpp:1.50Wed Sep 27 19:11:54 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Thu Sep 28 02:10:24 2006 @@ -34,12 +34,15 @@ struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { + analyzePHINodes(Fn); + bool Changed = false; // Eliminate PHI instructions by inserting copies into predecessor blocks. for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) Changed |= EliminatePHINodes(Fn, *I); + VRegPHIUseCount.clear(); return Changed; } @@ -54,15 +57,26 @@ /// bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB); void LowerAtomicPHINode(MachineBasicBlock &MBB, -MachineBasicBlock::iterator AfterPHIsIt, -DenseMap &VUC); +MachineBasicBlock::iterator AfterPHIsIt); + +/// analyzePHINodes - Gather information about the PHI nodes in +/// here. In particular, we want to map the number of uses of a virtual +/// register which is used in a PHI node. We map that to the BB the +/// vreg is coming from. This is used later to determine when the vreg +/// is killed in the BB. +/// +void analyzePHINodes(const MachineFunction& Fn); + +typedef std::pair BBVRegPair; +typedef std::map VRegPHIUse; + +VRegPHIUse VRegPHIUseCount; }; RegisterPass X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); } - const PassInfo *llvm::PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -72,20 +86,6 @@ if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI) return false; // Quick exit for basic blocks without PHIs. - // VRegPHIUseCount - Keep track of the number of times each virtual register - // is used by PHI nodes in successors of this block. - DenseMap VRegPHIUseCount; - VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg()); - - for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(), - E = MBB.pred_end(); PI != E; ++PI) -for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(), - E = (*PI)->succ_end(); SI != E; ++SI) - for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end(); - BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) -for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) - VRegPHIUseCount[BBI->getOperand(i).getReg()]++; - // Get an iterator to the first instruction after the last PHI node (this may // also be the end of the basic block). MachineBasicBlock::iterator AfterPHIsIt = MBB.begin(); @@ -93,9 +93,9 @@ AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt;// Skip over all of the PHI nodes... - while (MBB.front().getOpcode() == TargetInstrInfo::PHI) { -LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount); - } + while (MBB.front().getOpcode() == TargetInstrInfo::PHI) +LowerAtomicPHINode(MBB, AfterPHIsIt); + return true; } @@ -115,14 +115,13 @@ /// atomic execution of PHIs. This lowering method is always correct all of the /// time. void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt, - DenseMap &VRegPHIUseCount) { + MachineBasicBlock::iterator AfterPHIsIt) { // Unlink the PHI node from the basic block, but don't delete the PHI yet. MachineInstr *MPhi = MBB.remove(MBB.begin()); unsigned DestReg = MPhi->getOperand(0).getReg(); - // Create a new register for the incoming PHI arguments/ + // Create a new register for the incoming PHI arguments. MachineFunction &MF = *MBB.getParent(); const TargetRegisterClass *RC = MF.getSSARegMap()->getRegClass(DestReg); unsigned IncomingReg = MF.getSSARegMap()->createVirtualRegister(RC); @@ -165,9 +164,10 @@ // Adjust the VRegPHIUseCount map to account for the removal of this PHI // node. - unsigned NumPreds = (MPhi->getNumOperands()-1)/2; for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2) -VRegPHIUseCount[M