mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Ok, break down and add some cast<>'ing helper methods to the Type class
to reduce the number of cast<>'s we have. This allows someone to use things like Ty->getVectorNumElements() instead of cast<VectorType>(Ty)->getNumElements() when you know that a type is a vector. It would be a great general cleanup to move the codebase to use these, I will do so in the code I'm touching. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148999 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -197,6 +197,45 @@ bool Type::isSizedDerivedType() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Subclass Helper Methods
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
unsigned Type::getIntegerBitWidth() const {
|
||||
return cast<IntegerType>(this)->getBitWidth();
|
||||
}
|
||||
|
||||
bool Type::isFunctionVarArg() const {
|
||||
return cast<FunctionType>(this)->isVarArg();
|
||||
}
|
||||
|
||||
Type *Type::getFunctionParamType(unsigned i) const {
|
||||
return cast<FunctionType>(this)->getParamType(i);
|
||||
}
|
||||
|
||||
unsigned Type::getFunctionNumParams() const {
|
||||
return cast<FunctionType>(this)->getNumParams();
|
||||
}
|
||||
|
||||
Type *Type::getSequentialElementType() const {
|
||||
return cast<SequentialType>(this)->getElementType();
|
||||
}
|
||||
|
||||
uint64_t Type::getArrayNumElements() const {
|
||||
return cast<ArrayType>(this)->getNumElements();
|
||||
}
|
||||
|
||||
unsigned Type::getVectorNumElements() const {
|
||||
return cast<VectorType>(this)->getNumElements();
|
||||
}
|
||||
|
||||
unsigned Type::getPointerAddressSpace() const {
|
||||
return cast<PointerType>(this)->getAddressSpace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Primitive 'Type' data
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Reference in New Issue
Block a user