diff options
author | Chris Lattner <sabre@nondot.org> | 2005-09-27 06:08:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-09-27 06:08:32 +0000 |
commit | 225e8dd2f512e3e6840ba7cb1570fdc4d56a853f (patch) | |
tree | 67a27bd3b6c0cf2740ba46ab743883934723d6a1 /include/llvm/Constant.h | |
parent | a9ec8ab32bce9021c9501b45eea6bbc76ffeb207 (diff) |
Split SimpleConstantVal up into its components, so each Constant subclass gets
a different enum value. This allows 'classof' for these to be really simple,
not needing to call getType() anymore.
This speeds up isa/dyncast/etc for constants, and also makes them smaller.
For example, the text section of a release build of InstCombine.cpp shrinks
from 230037 bytes to 216363 bytes, a 6% reduction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constant.h')
-rw-r--r-- | include/llvm/Constant.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index b8ec03b3ec..b82a259849 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -61,12 +61,8 @@ public: static inline bool classof(const Constant *) { return true; } static inline bool classof(const GlobalValue *) { return true; } static inline bool classof(const Value *V) { - return V->getValueType() == Value::SimpleConstantVal || - V->getValueType() == Value::ConstantExprVal || - V->getValueType() == Value::ConstantAggregateZeroVal || - V->getValueType() == Value::FunctionVal || - V->getValueType() == Value::GlobalVariableVal || - V->getValueType() == Value::UndefValueVal; + return V->getValueType() >= ConstantFirstVal && + V->getValueType() <= ConstantLastVal; } /// replaceUsesOfWithOnConstant - This method is a special form of |