Merge pull request #19792 from jketema/sve

C++: Add Arm scalable vector type QL classes
This commit is contained in:
Jeroen Ketema
2025-06-18 17:01:29 +02:00
committed by GitHub
16 changed files with 11873 additions and 1749 deletions

View File

@@ -352,7 +352,23 @@ class UnknownType extends BuiltInType {
private predicate isArithmeticType(@builtintype type, int kind) {
builtintypes(type, _, kind, _, _, _) and
kind >= 4 and
kind != 34 // Exclude decltype(nullptr)
kind != 34 and // Exclude decltype(nullptr)
kind != 63 // Exclude __SVCount_t
}
/**
* The Arm scalable vector count type.
*
* In the following example, `a` is declared using the scalable vector
* count type:
* ```
* svcount_t a;
* ```
*/
class ScalableVectorCount extends BuiltInType {
ScalableVectorCount() { builtintypes(underlyingElement(this), _, 63, _, _, _) }
override string getAPrimaryQlClass() { result = "ScalableVectorCount" }
}
/**
@@ -1084,7 +1100,7 @@ class NullPointerType extends BuiltInType {
/**
* A C/C++ derived type.
*
* These are pointer and reference types, array and GNU vector types, and `const` and `volatile` types.
* These are pointer and reference types, array and vector types, and `const` and `volatile` types.
* In all cases, the type is formed from a single base type. For example:
* ```
* int *pi;
@@ -1648,6 +1664,30 @@ class GNUVectorType extends DerivedType {
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConst() }
}
/**
* An Arm Scalable vector type.
*
* In the following example, `a` has a scalable vector type consisting
* of 8-bit signed integer elements:
* ```
* svint8_t a;
* ```
*/
class ScalableVectorType extends DerivedType {
ScalableVectorType() { derivedtypes(underlyingElement(this), _, 11, _) }
/**
* Get the number of tuple elements of this scalable vector type.
*/
int getNumTupleElements() { tupleelements(underlyingElement(this), result) }
override string getAPrimaryQlClass() { result = "ScalableVectorType" }
override string explain() { result = "scalable vector of {" + this.getBaseType().explain() + "}" }
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConst() }
}
/**
* A C/C++ pointer to a function. See 7.7.
* ```

View File

@@ -134,6 +134,8 @@ private predicate isOpaqueType(Type type) {
)
or
type instanceof PointerToMemberType // PTMs are missing size info
or
type instanceof ScalableVectorCount
}
/**