aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Type.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-02 23:35:57 +0000
committerChris Lattner <sabre@nondot.org>2003-10-02 23:35:57 +0000
commit1c5164e9cff87b9682fcf620c7aac099ff378e18 (patch)
tree9d281931f92a568e21033924f80b001e1982d69b /include/llvm/Type.h
parentc7b6f035011c2bd8846edf76a8f416cc96c1f94e (diff)
Make the PATypeHolder use a simple union-find implementation to handle
merging of types. This makes it MUCH more efficient than before, also making things simpler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Type.h')
-rw-r--r--include/llvm/Type.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index 30949a6457..5900b402dc 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -73,6 +73,7 @@ private:
unsigned UID; // The unique ID number for this class
bool Abstract; // True if type contains an OpaqueType
+ const Type *getForwardedTypeInternal() const;
protected:
/// ctor is protected, so only subclasses can create Type objects...
Type(const std::string &Name, PrimitiveID id);
@@ -90,6 +91,12 @@ protected:
/// isTypeAbstract - This method is used to calculate the Abstract bit.
///
bool isTypeAbstract();
+
+ /// ForwardType - This field is used to implement the union find scheme for
+ /// abstract types. When types are refined to other types, this field is set
+ /// to the more refined type. Only abstract types can be forwarded.
+ mutable const Type *ForwardType;
+
public:
virtual void print(std::ostream &O) const;
@@ -177,6 +184,13 @@ public:
///
unsigned getPrimitiveSize() const;
+ /// getForwaredType - Return the type that this type has been resolved to if
+ /// it has been resolved to anything. This is used to implement the
+ /// union-find algorithm for type resolution.
+ const Type *getForwardedType() const {
+ if (!ForwardType) return 0;
+ return getForwardedTypeInternal();
+ }
//===--------------------------------------------------------------------===//
// Type Iteration support