Changes in directory llvm/include/llvm:
AbstractTypeUser.h updated: 1.25 -> 1.25.4.1 BasicBlock.h updated: 1.56 -> 1.56.2.1 Constant.h updated: 1.25 -> 1.25.2.1 DerivedTypes.h updated: 1.68.4.1 -> 1.68.4.2 Function.h updated: 1.66 -> 1.66.4.1 GlobalValue.h updated: 1.23 -> 1.23.4.1 Instruction.h updated: 1.68 -> 1.68.2.1 Instructions.h updated: 1.27.2.1 -> 1.27.2.2 Intrinsics.h updated: 1.32 -> 1.32.4.1 Module.h updated: 1.62 -> 1.62.4.1 Type.h updated: 1.77.4.1 -> 1.77.4.2 --- Log message: Merged mainline into Vector LLVM branch --- Diffs of the changes: (+109 -135) AbstractTypeUser.h | 8 ----- BasicBlock.h | 2 - Constant.h | 2 - DerivedTypes.h | 71 ++--------------------------------------------------- Function.h | 2 - GlobalValue.h | 19 +++++++++++--- Instruction.h | 2 - Instructions.h | 40 +++++++++++++++++++++++------ Intrinsics.h | 9 +++--- Module.h | 24 +++++++++-------- Type.h | 65 +++++++++++++++++++++++++++--------------------- 11 files changed, 109 insertions(+), 135 deletions(-) Index: llvm/include/llvm/AbstractTypeUser.h diff -u llvm/include/llvm/AbstractTypeUser.h:1.25 llvm/include/llvm/AbstractTypeUser.h:1.25.4.1 --- llvm/include/llvm/AbstractTypeUser.h:1.25 Thu Apr 21 22:20:18 2005 +++ llvm/include/llvm/AbstractTypeUser.h Wed Nov 16 12:31:11 2005 @@ -117,14 +117,6 @@ // operator-> - Allow user to dereference handle naturally... inline const Type *operator->() const { return Ty; } - - // removeUserFromConcrete - This function should be called when the User is - // notified that our type is refined... and the type is being refined to - // itself, which is now a concrete type. When a type becomes concrete like - // this, we MUST remove ourself from the AbstractTypeUser list, even though - // the type is apparently concrete. - // - void removeUserFromConcrete(); }; Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.56 llvm/include/llvm/BasicBlock.h:1.56.2.1 --- llvm/include/llvm/BasicBlock.h:1.56 Fri Aug 12 17:13:27 2005 +++ llvm/include/llvm/BasicBlock.h Wed Nov 16 12:31:11 2005 @@ -139,7 +139,7 @@ void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const BasicBlock *BB) { return true; } + static inline bool classof(const BasicBlock *) { return true; } static inline bool classof(const Value *V) { return V->getValueType() == Value::BasicBlockVal; } Index: llvm/include/llvm/Constant.h diff -u llvm/include/llvm/Constant.h:1.25 llvm/include/llvm/Constant.h:1.25.2.1 --- llvm/include/llvm/Constant.h:1.25 Tue Oct 4 13:12:13 2005 +++ llvm/include/llvm/Constant.h Wed Nov 16 12:31:11 2005 @@ -75,7 +75,7 @@ /// use Value::replaceAllUsesWith, which automatically dispatches to this /// method as needed. /// - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { + virtual void replaceUsesOfWithOnConstant(Value *, Value *, Use *) { // Provide a default implementation for constants (like integers) that // cannot use any other values. This cannot be called at runtime, but needs // to be here to avoid link errors. Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.68.4.1 llvm/include/llvm/DerivedTypes.h:1.68.4.2 --- llvm/include/llvm/DerivedTypes.h:1.68.4.1 Tue Oct 18 14:21:56 2005 +++ llvm/include/llvm/DerivedTypes.h Wed Nov 16 12:31:11 2005 @@ -29,22 +29,14 @@ class ArrayValType; class StructValType; class PointerValType; -class StreamValType; class VectorValType; class FixedVectorValType; -class DerivedType : public Type, public AbstractTypeUser { - // AbstractTypeUsers - Implement a list of the users that need to be notified - // if I am a type, and I get resolved into a more concrete type. - // - mutable std::vector<AbstractTypeUser *> AbstractTypeUsers; +class DerivedType : public Type { friend class Type; protected: - DerivedType(TypeID id) : Type("", id) {} - ~DerivedType() { - assert(AbstractTypeUsers.empty()); - } + DerivedType(TypeID id) : Type(id) {} /// notifyUsesThatTypeBecameConcrete - Notify AbstractTypeUsers of this type /// that the current type has transitioned from being abstract to being @@ -58,12 +50,6 @@ /// void dropAllTypeUses(); - void RefCountIsZero() const { - if (AbstractTypeUsers.empty()) - delete this; - } - - public: //===--------------------------------------------------------------------===// @@ -71,22 +57,6 @@ // are managed by (add|remove)AbstractTypeUser. See comments in // AbstractTypeUser.h for more information. - /// addAbstractTypeUser - Notify an abstract type that there is a new user of - /// it. This function is called primarily by the PATypeHandle class. - /// - void addAbstractTypeUser(AbstractTypeUser *U) const { - assert(isAbstract() && "addAbstractTypeUser: Current type not abstract!"); - AbstractTypeUsers.push_back(U); - } - - /// removeAbstractTypeUser - Notify an abstract type that a user of the class - /// no longer has a handle to the type. This function is called primarily by - /// the PATypeHandle class. When there are no users of the abstract type, it - /// is annihilated, because there is no way to get a reference to it ever - /// again. - /// - void removeAbstractTypeUser(AbstractTypeUser *U) const; - /// refineAbstractTypeTo - This function is used to when it is discovered that /// the 'this' abstract type is actually equivalent to the NewType specified. /// This causes all users of 'this' to switch to reference the more concrete @@ -176,7 +146,6 @@ return T->getTypeID() == ArrayTyID || T->getTypeID() == StructTyID || T->getTypeID() == PointerTyID || - T->getTypeID() == StreamTyID || T->getTypeID() == VectorTyID || T->getTypeID() == FixedVectorTyID; } @@ -268,7 +237,6 @@ static inline bool classof(const Type *T) { return T->getTypeID() == ArrayTyID || T->getTypeID() == PointerTyID || - T->getTypeID() == StreamTyID || T->getTypeID() == VectorTyID || T->getTypeID() == FixedVectorTyID; } @@ -311,40 +279,6 @@ } }; -/// StreamType - Class to represent vector types -/// -class StreamType : public SequentialType { - friend class TypeMap<StreamValType, StreamType>; - - StreamType(const StreamType &); // Do not implement - const StreamType &operator=(const StreamType &); // Do not implement - -protected: - /// This should really be private, but it squelches a bogus warning - /// from GCC to make them protected: warning: `class StreamType' only - /// defines private constructors and has no friends - /// - /// Private ctor - Only can be created by a static member... - /// - StreamType(const Type *ElType); - -public: - /// StreamType::get - This static method is the primary way to construct a - /// StreamType - /// - static StreamType *get(const Type *ElementType); - - // Implement the AbstractTypeUser interface. - virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); - virtual void typeBecameConcrete(const DerivedType *AbsTy); - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const StreamType *T) { return true; } - static inline bool classof(const Type *T) { - return T->getTypeID() == StreamTyID; - } -}; - /// VectorType - Class to represent vector types /// class VectorType : public SequentialType { @@ -387,6 +321,7 @@ } }; + /// FixedVectorType - Class to represent vectors with fixed lengths /// class FixedVectorType : public VectorType { Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.66 llvm/include/llvm/Function.h:1.66.4.1 --- llvm/include/llvm/Function.h:1.66 Sun May 15 20:49:12 2005 +++ llvm/include/llvm/Function.h Wed Nov 16 12:31:11 2005 @@ -57,8 +57,6 @@ typedef ArgumentListType::iterator arg_iterator; typedef ArgumentListType::const_iterator const_arg_iterator; - typedef arg_iterator aiterator; // legacy, deprecated - typedef const_arg_iterator const_aiterator; // legacy, deprecated private: // Important things that make up a function! Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.23 llvm/include/llvm/GlobalValue.h:1.23.4.1 --- llvm/include/llvm/GlobalValue.h:1.23 Thu Apr 21 15:11:51 2005 +++ llvm/include/llvm/GlobalValue.h Wed Nov 16 12:31:11 2005 @@ -38,15 +38,28 @@ protected: GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const std::string &name = "") - : Constant(Ty, vty, Ops, NumOps, name), Linkage(linkage), Parent(0) { } + : Constant(Ty, vty, Ops, NumOps, name), + Parent(0), Linkage(linkage), Alignment(0) { } - LinkageTypes Linkage; // The linkage of this global Module *Parent; + LinkageTypes Linkage; // The linkage of this global + unsigned Alignment; // Alignment of this symbol, must be power of two + std::string Section; // Section to emit this into, empty mean default public: ~GlobalValue() { removeDeadConstantUsers(); // remove any dead constants using this. } + unsigned getAlignment() const { return Alignment; } + void setAlignment(unsigned Align) { + assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!"); + Alignment = Align; + } + + bool hasSection() const { return !Section.empty(); } + const std::string &getSection() const { return Section; } + void setSection(const std::string &S) { Section = S; } + /// If the usage is empty (except transitively dead constants), then this /// global value can can be safely deleted since the destructor will /// delete the dead constants as well. @@ -101,7 +114,7 @@ void removeDeadConstantUsers(); // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const GlobalValue *T) { return true; } + static inline bool classof(const GlobalValue *) { return true; } static inline bool classof(const Value *V) { return V->getValueType() == Value::FunctionVal || V->getValueType() == Value::GlobalVariableVal; Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.68 llvm/include/llvm/Instruction.h:1.68.2.1 --- llvm/include/llvm/Instruction.h:1.68 Mon Aug 8 00:21:33 2005 +++ llvm/include/llvm/Instruction.h Wed Nov 16 12:31:11 2005 @@ -157,7 +157,7 @@ void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const Instruction *I) { return true; } + static inline bool classof(const Instruction *) { return true; } static inline bool classof(const Value *V) { return V->getValueType() >= Value::InstructionVal; } Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.27.2.1 llvm/include/llvm/Instructions.h:1.27.2.2 --- llvm/include/llvm/Instructions.h:1.27.2.1 Tue Oct 18 14:21:56 2005 +++ llvm/include/llvm/Instructions.h Wed Nov 16 12:31:11 2005 @@ -35,10 +35,11 @@ /// AllocaInst. /// class AllocationInst : public UnaryInstruction { + unsigned Alignment; protected: - AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, + AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align, const std::string &Name = "", Instruction *InsertBefore = 0); - AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, + AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align, const std::string &Name, BasicBlock *InsertAtEnd); public: @@ -65,6 +66,15 @@ /// const Type *getAllocatedType() const; + /// getAlignment - Return the alignment of the memory that is being allocated + /// by the instruction. + /// + unsigned getAlignment() const { return Alignment; } + void setAlignment(unsigned Align) { + assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!"); + Alignment = Align; + } + virtual Instruction *clone() const = 0; // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -91,11 +101,18 @@ explicit MallocInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "", Instruction *InsertBefore = 0) - : AllocationInst(Ty, ArraySize, Malloc, Name, InsertBefore) {} + : AllocationInst(Ty, ArraySize, Malloc, 0, Name, InsertBefore) {} MallocInst(const Type *Ty, Value *ArraySize, const std::string &Name, BasicBlock *InsertAtEnd) - : AllocationInst(Ty, ArraySize, Malloc, Name, InsertAtEnd) {} - + : AllocationInst(Ty, ArraySize, Malloc, 0, Name, InsertAtEnd) {} + MallocInst(const Type *Ty, Value *ArraySize, unsigned Align, + const std::string &Name, BasicBlock *InsertAtEnd) + : AllocationInst(Ty, ArraySize, Malloc, Align, Name, InsertAtEnd) {} + explicit MallocInst(const Type *Ty, Value *ArraySize, unsigned Align, + const std::string &Name = "", + Instruction *InsertBefore = 0) + : AllocationInst(Ty, ArraySize, Malloc, Align, Name, InsertBefore) {} + virtual MallocInst *clone() const; // Methods for support type inquiry through isa, cast, and dyn_cast: @@ -121,11 +138,18 @@ explicit AllocaInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "", Instruction *InsertBefore = 0) - : AllocationInst(Ty, ArraySize, Alloca, Name, InsertBefore) {} + : AllocationInst(Ty, ArraySize, Alloca, 0, Name, InsertBefore) {} AllocaInst(const Type *Ty, Value *ArraySize, const std::string &Name, BasicBlock *InsertAtEnd) - : AllocationInst(Ty, ArraySize, Alloca, Name, InsertAtEnd) {} - + : AllocationInst(Ty, ArraySize, Alloca, 0, Name, InsertAtEnd) {} + AllocaInst(const Type *Ty, Value *ArraySize, unsigned Align, + const std::string &Name, BasicBlock *InsertAtEnd) + : AllocationInst(Ty, ArraySize, Alloca, Align, Name, InsertAtEnd) {} + explicit AllocaInst(const Type *Ty, Value *ArraySize, unsigned Align, + const std::string &Name = "", + Instruction *InsertBefore = 0) + : AllocationInst(Ty, ArraySize, Alloca, Align, Name, InsertBefore) {} + virtual AllocaInst *clone() const; // Methods for support type inquiry through isa, cast, and dyn_cast: Index: llvm/include/llvm/Intrinsics.h diff -u llvm/include/llvm/Intrinsics.h:1.32 llvm/include/llvm/Intrinsics.h:1.32.4.1 --- llvm/include/llvm/Intrinsics.h:1.32 Tue May 3 12:19:29 2005 +++ llvm/include/llvm/Intrinsics.h Wed Nov 16 12:31:11 2005 @@ -32,10 +32,11 @@ vacopy, // Used to implement the va_copy macro in C // Code generator intrinsics. - returnaddress, // Yields the return address of a dynamic call frame - frameaddress, // Yields the frame address of a dynamic call frame - prefetch, // Prefetch a value into the cache - pcmarker, // Export a PC from near the marker + returnaddress, // Yields the return address of a dynamic call frame + frameaddress, // Yields the frame address of a dynamic call frame + prefetch, // Prefetch a value into the cache + pcmarker, // Export a PC from near the marker + readcyclecounter, // Read cycle counter register // setjmp/longjmp intrinsics. setjmp, // Used to represent a setjmp call in C Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.62 llvm/include/llvm/Module.h:1.62.4.1 --- llvm/include/llvm/Module.h:1.62 Sun May 15 20:49:23 2005 +++ llvm/include/llvm/Module.h Wed Nov 16 12:31:11 2005 @@ -22,6 +22,7 @@ #include "llvm/Function.h" #include "llvm/GlobalVariable.h" #include "llvm/ADT/SetVector.h" +#include "llvm/Support/DataTypes.h" namespace llvm { @@ -51,17 +52,15 @@ typedef iplist<Function> FunctionListType; typedef SetVector<std::string> LibraryListType; - // Global Variable iterators... - typedef GlobalListType::iterator global_iterator; - typedef GlobalListType::const_iterator const_global_iterator; - typedef global_iterator giterator; // these are legacy, deprecated - typedef const_global_iterator const_giterator; + // Global Variable iterators. + typedef GlobalListType::iterator global_iterator; + typedef GlobalListType::const_iterator const_global_iterator; - // Function iterators... + // Function iterators. typedef FunctionListType::iterator iterator; typedef FunctionListType::const_iterator const_iterator; - // Library list iterators + // Library list iterators. typedef LibraryListType::const_iterator lib_iterator; enum Endianness { AnyEndianness, LittleEndian, BigEndian }; @@ -86,9 +85,11 @@ Module(const std::string &ModuleID); ~Module(); - const std::string& getModuleIdentifier() const { return ModuleID; } - const std::string& getTargetTriple() const { return TargetTriple; } - void setTargetTriple(const std::string& T) { TargetTriple = T; } + const std::string &getModuleIdentifier() const { return ModuleID; } + void setModuleIdentifier(const std::string &ID) { ModuleID = ID; } + + const std::string &getTargetTriple() const { return TargetTriple; } + void setTargetTriple(const std::string &T) { TargetTriple = T; } /// Target endian information... Endianness getEndianness() const { return Endian; } @@ -111,7 +112,8 @@ /// table. If it does not exist, add a prototype for the function and return /// it. This version of the method takes a null terminated list of function /// arguments, which makes it easier for clients to use. - Function *getOrInsertFunction(const std::string &Name, const Type *RetTy,...); + Function *getOrInsertFunction(const std::string &Name, const Type *RetTy,...) + END_WITH_NULL; /// getFunction - Look up the specified function in the module symbol table. /// If it does not exist, return null. Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.77.4.1 llvm/include/llvm/Type.h:1.77.4.2 --- llvm/include/llvm/Type.h:1.77.4.1 Tue Oct 18 14:21:56 2005 +++ llvm/include/llvm/Type.h Wed Nov 16 12:31:11 2005 @@ -48,9 +48,9 @@ class OpaqueType; class PointerType; class StructType; -class FixedVectorType; +class TypeMapBase; -class Type { +class Type : public AbstractTypeUser { public: ///===-------------------------------------------------------------------===// /// Definitions of all of the base types for the Type system. Based on this @@ -85,7 +85,7 @@ private: TypeID ID : 8; // The current base type of this type. - bool Abstract; // True if type contains an OpaqueType + bool Abstract : 1; // True if type contains an OpaqueType /// RefCount - This counts the number of PATypeHolders that are pointing to /// this type. When this number falls to zero, if the type is abstract and @@ -96,17 +96,16 @@ const Type *getForwardedTypeInternal() const; protected: - Type(const std::string& Name, TypeID id); - virtual ~Type() {} + Type(const char *Name, TypeID id); + Type(TypeID id) : ID(id), Abstract(false), RefCount(0), ForwardType(0) {} + virtual ~Type() { + assert(AbstractTypeUsers.empty()); + } /// Types can become nonabstract later, if they are refined. /// inline void setAbstract(bool Val) { Abstract = Val; } - // PromoteAbstractToConcrete - This is an internal method used to calculate - // change "Abstract" from true to false when types are refined. - void PromoteAbstractToConcrete(); - unsigned getRefCount() const { return RefCount; } /// ForwardType - This field is used to implement the union find scheme for @@ -123,6 +122,10 @@ /// not contain any elements (most are derived). std::vector<PATypeHandle> ContainedTys; + /// AbstractTypeUsers - Implement a list of the users that need to be notified + /// if I am a type, and I get resolved into a more concrete type. + /// + mutable std::vector<AbstractTypeUser *> AbstractTypeUsers; public: void print(std::ostream &O) const; @@ -305,15 +308,6 @@ /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Type *T) { return true; } - // Virtual methods used by callbacks below. These should only be implemented - // in the DerivedType class. - virtual void addAbstractTypeUser(AbstractTypeUser *U) const { - abort(); // Only on derived types! - } - virtual void removeAbstractTypeUser(AbstractTypeUser *U) const { - abort(); // Only on derived types! - } - void addRef() const { assert(isAbstract() && "Cannot add a reference to a non-abstract type!"); ++RefCount; @@ -325,9 +319,25 @@ // If this is the last PATypeHolder using this object, and there are no // PATypeHandles using it, the type is dead, delete it now. - if (--RefCount == 0) - RefCountIsZero(); + if (--RefCount == 0 && AbstractTypeUsers.empty()) + delete this; } + + /// addAbstractTypeUser - Notify an abstract type that there is a new user of + /// it. This function is called primarily by the PATypeHandle class. + /// + void addAbstractTypeUser(AbstractTypeUser *U) const { + assert(isAbstract() && "addAbstractTypeUser: Current type not abstract!"); + AbstractTypeUsers.push_back(U); + } + + /// removeAbstractTypeUser - Notify an abstract type that a user of the class + /// no longer has a handle to the type. This function is called primarily by + /// the PATypeHandle class. When there are no users of the abstract type, it + /// is annihilated, because there is no way to get a reference to it ever + /// again. + /// + 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 @@ -340,10 +350,14 @@ /// their size is relatively uncommon, move this operation out of line. bool isSizedDerivedType() const; - virtual void RefCountIsZero() const { - abort(); // only on derived types! - } + virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); + virtual void typeBecameConcrete(const DerivedType *AbsTy); +protected: + // PromoteAbstractToConcrete - This is an internal method used to calculate + // change "Abstract" from true to false when types are refined. + void PromoteAbstractToConcrete(); + friend class TypeMapBase; }; //===----------------------------------------------------------------------===// @@ -367,11 +381,6 @@ Ty->removeAbstractTypeUser(User); } -inline void PATypeHandle::removeUserFromConcrete() { - if (!Ty->isAbstract()) - Ty->removeAbstractTypeUser(User); -} - // Define inline methods for PATypeHolder... inline void PATypeHolder::addRef() { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits