int64_t Signed;
uint64_t Unsigned;
} Val;
- ConstantIntegral(const Type *Ty, uint64_t V);
+ ConstantIntegral(const Type *Ty, ValueTy VT, uint64_t V);
public:
/// getRawValue - return the underlying value of this constant as a 64-bit
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantIntegral *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isIntegral();
+ return V->getValueType() == ConstantBoolVal ||
+ V->getValueType() == ConstantSIntVal ||
+ V->getValueType() == ConstantUIntVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantBool *) { return true; }
static bool classof(const Value *V) {
- return (V == True) | (V == False);
+ return V->getValueType() == ConstantBoolVal;
}
};
class ConstantInt : public ConstantIntegral {
protected:
ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
- ConstantInt(const Type *Ty, uint64_t V);
+ ConstantInt(const Type *Ty, ValueTy VT, uint64_t V);
public:
/// equalsInt - Provide a helper method that can be used to determine if the
/// constant contained within is equal to a constant. This only works for
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantInt *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isInteger();
+ return V->getValueType() == ConstantSIntVal ||
+ V->getValueType() == ConstantUIntVal;
}
};
///
static inline bool classof(const ConstantSInt *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isSigned();
+ return V->getValueType() == ConstantSIntVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantUInt *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isUnsigned();
+ return V->getValueType() == ConstantUIntVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantFP *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->isFloatingPoint();
+ return V->getValueType() == ConstantFPVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantArray *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->getTypeID() == Type::ArrayTyID;
+ return V->getValueType() == ConstantArrayVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantStruct *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->getTypeID() == Type::StructTyID;
+ return V->getValueType() == ConstantStructVal;
}
};
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantPacked *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- V->getType()->getTypeID() == Type::PackedTyID;
+ return V->getValueType() == ConstantPackedVal;
}
};
protected:
ConstantPointerNull(const PointerType *T)
: Constant(reinterpret_cast<const Type*>(T),
- Value::SimpleConstantVal, 0, 0) {}
+ Value::ConstantPointerNullVal, 0, 0) {}
public:
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantPointerNull *) { return true; }
static bool classof(const Value *V) {
- return V->getValueType() == SimpleConstantVal &&
- isa<PointerType>(V->getType());
+ return V->getValueType() == ConstantPointerNullVal;
}
};
UndefValueVal, // This is an instance of UndefValue
ConstantExprVal, // This is an instance of ConstantExpr
ConstantAggregateZeroVal, // This is an instance of ConstantAggregateNull
- SimpleConstantVal, // This is some other type of Constant
+ ConstantBoolVal, // This is an instance of ConstantBool
+ ConstantSIntVal, // This is an instance of ConstantSInt
+ ConstantUIntVal, // This is an instance of ConstantUInt
+ ConstantFPVal, // This is an instance of ConstantFP
+ ConstantArrayVal, // This is an instance of ConstantArray
+ ConstantStructVal, // This is an instance of ConstantStruct
+ ConstantPackedVal, // This is an instance of ConstantPacked
+ ConstantPointerNullVal, // This is an instance of ConstantPointerNull
InstructionVal, // This is an instance of Instruction
+
+ // Markers:
+ ConstantFirstVal = FunctionVal,
+ ConstantLastVal = ConstantPointerNullVal,
};
unsigned getValueType() const {
return SubclassID;
// the subtype header files to test to see if the value is a subclass...
//
template <> inline bool isa_impl<Constant, Value>(const Value &Val) {
- return Val.getValueType() == Value::SimpleConstantVal ||
- Val.getValueType() == Value::FunctionVal ||
- Val.getValueType() == Value::GlobalVariableVal ||
- Val.getValueType() == Value::ConstantExprVal ||
- Val.getValueType() == Value::ConstantAggregateZeroVal ||
- Val.getValueType() == Value::UndefValueVal;
+ return Val.getValueType() >= Value::ConstantFirstVal &&
+ Val.getValueType() <= Value::ConstantLastVal;
}
template <> inline bool isa_impl<Argument, Value>(const Value &Val) {
return Val.getValueType() == Value::ArgumentVal;