From: Chris Lattner Date: Sun, 27 Jun 2004 18:38:24 +0000 (+0000) Subject: Eliminate the Instruction::iType field, folding it into the Value::VTy field. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7da38ec915010576685200089c75a2135bd3fa97;p=oota-llvm.git Eliminate the Instruction::iType field, folding it into the Value::VTy field. This reduces the size of the instruction class by 4 bytes, and means that isa(V) (for example) only needs to do one load from memory instead of two. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14434 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index d2f61965ddd..31407ff8498 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -21,6 +21,7 @@ namespace llvm { struct AssemblyAnnotationWriter; +class BinaryOperator; template struct ilist_traits; template= BinaryOpsBegin && iType < BinaryOpsEnd; + return getOpcode() >= BinaryOpsBegin && getOpcode() < BinaryOpsEnd; } /// isAssociative - Return true if the instruction is associative: diff --git a/include/llvm/Value.h b/include/llvm/Value.h index c47c96962f4..7d870d67097 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -133,6 +133,11 @@ public: unsigned getValueType() const { return SubclassID; } + +private: + /// FIXME: this is a gross hack, needed by another gross hack. Eliminate! + void setValueType(unsigned VT) { SubclassID = VT; } + friend class Instruction; }; inline std::ostream &operator<<(std::ostream &OS, const Value *V) { @@ -190,7 +195,7 @@ template <> inline bool isa_impl(const Value &Val) { return Val.getValueType() == Value::ArgumentVal; } template <> inline bool isa_impl(const Value &Val) { - return Val.getValueType() == Value::InstructionVal; + return Val.getValueType() >= Value::InstructionVal; } template <> inline bool isa_impl(const Value &Val) { return Val.getValueType() == Value::BasicBlockVal;