aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ConstantHandling.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-09-09 21:00:23 +0000
committerChris Lattner <sabre@nondot.org>2001-09-09 21:00:23 +0000
commit78914e772f4988dd5e521b49e2e9b208fa1b02ab (patch)
tree9d50b707244312bad2e6567df1095d1ebc2db2aa /include/llvm/ConstantHandling.h
parentbf2f0436595602fcc81ef8c644157417db43e1d7 (diff)
Convert ConstRules to use annotations to clean it up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ConstantHandling.h')
-rw-r--r--include/llvm/ConstantHandling.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/llvm/ConstantHandling.h b/include/llvm/ConstantHandling.h
index 453c3e88b1..cbb9789fb0 100644
--- a/include/llvm/ConstantHandling.h
+++ b/include/llvm/ConstantHandling.h
@@ -58,10 +58,12 @@ inline ConstPoolBool *operator!=(const ConstPoolVal &V1,
// Implement all other operators indirectly through TypeRules system
//===----------------------------------------------------------------------===//
-class ConstRules {
+class ConstRules : public Annotation {
protected:
- inline ConstRules() {} // Can only be subclassed...
+ inline ConstRules() : Annotation(AID) {} // Can only be subclassed...
public:
+ static AnnotationID AID; // AnnotationID for this class
+
// Unary Operators...
virtual ConstPoolVal *not(const ConstPoolVal *V) const = 0;
@@ -110,12 +112,11 @@ public:
// we just want to make sure to hit the cache instead of doing it indirectly,
// if possible...
//
- static inline const ConstRules *get(const ConstPoolVal &V) {
- const ConstRules *Result = V.getType()->getConstRules();
- return Result ? Result : find(V.getType());
+ static inline ConstRules *get(const ConstPoolVal &V) {
+ return (ConstRules*)V.getType()->getOrCreateAnnotation(AID);
}
private :
- static const ConstRules *find(const Type *Ty);
+ static Annotation *find(AnnotationID AID, const Annotable *Ty, void *);
ConstRules(const ConstRules &); // Do not implement
ConstRules &operator=(const ConstRules &); // Do not implement