@@ -26,6 +26,7 @@ class Context;
26
26
class PointerType ;
27
27
class VectorType ;
28
28
class FixedVectorType ;
29
+ class ScalableVectorType ;
29
30
class IntegerType ;
30
31
class FunctionType ;
31
32
class ArrayType ;
@@ -39,21 +40,22 @@ class StructType;
39
40
class Type {
40
41
protected:
41
42
llvm::Type *LLVMTy;
42
- friend class ArrayType ; // For LLVMTy.
43
- friend class StructType ; // For LLVMTy.
44
- friend class VectorType ; // For LLVMTy.
45
- friend class FixedVectorType ; // For LLVMTy.
46
- friend class PointerType ; // For LLVMTy.
47
- friend class FunctionType ; // For LLVMTy.
48
- friend class IntegerType ; // For LLVMTy.
49
- friend class Function ; // For LLVMTy.
50
- friend class CallBase ; // For LLVMTy.
51
- friend class ConstantInt ; // For LLVMTy.
52
- friend class ConstantArray ; // For LLVMTy.
53
- friend class ConstantStruct ; // For LLVMTy.
54
- friend class ConstantVector ; // For LLVMTy.
55
- friend class CmpInst ; // For LLVMTy. TODO: Cleanup after
56
- // sandboxir::VectorType is more complete.
43
+ friend class ArrayType ; // For LLVMTy.
44
+ friend class StructType ; // For LLVMTy.
45
+ friend class VectorType ; // For LLVMTy.
46
+ friend class FixedVectorType ; // For LLVMTy.
47
+ friend class ScalableVectorType ; // For LLVMTy.
48
+ friend class PointerType ; // For LLVMTy.
49
+ friend class FunctionType ; // For LLVMTy.
50
+ friend class IntegerType ; // For LLVMTy.
51
+ friend class Function ; // For LLVMTy.
52
+ friend class CallBase ; // For LLVMTy.
53
+ friend class ConstantInt ; // For LLVMTy.
54
+ friend class ConstantArray ; // For LLVMTy.
55
+ friend class ConstantStruct ; // For LLVMTy.
56
+ friend class ConstantVector ; // For LLVMTy.
57
+ friend class CmpInst ; // For LLVMTy. TODO: Cleanup after
58
+ // sandboxir::VectorType is more complete.
57
59
58
60
// Friend all instruction classes because `create()` functions use LLVMTy.
59
61
#define DEF_INSTR (ID, OPCODE, CLASS ) friend class CLASS ;
@@ -390,6 +392,57 @@ class FixedVectorType : public VectorType {
390
392
}
391
393
};
392
394
395
+ class ScalableVectorType : public VectorType {
396
+ public:
397
+ static ScalableVectorType *get (Type *ElementType, unsigned MinNumElts);
398
+
399
+ static ScalableVectorType *get (Type *ElementType,
400
+ const ScalableVectorType *SVTy) {
401
+ return get (ElementType, SVTy->getMinNumElements ());
402
+ }
403
+
404
+ static ScalableVectorType *getInteger (ScalableVectorType *VTy) {
405
+ return cast<ScalableVectorType>(VectorType::getInteger (VTy));
406
+ }
407
+
408
+ static ScalableVectorType *
409
+ getExtendedElementVectorType (ScalableVectorType *VTy) {
410
+ return cast<ScalableVectorType>(
411
+ VectorType::getExtendedElementVectorType (VTy));
412
+ }
413
+
414
+ static ScalableVectorType *
415
+ getTruncatedElementVectorType (ScalableVectorType *VTy) {
416
+ return cast<ScalableVectorType>(
417
+ VectorType::getTruncatedElementVectorType (VTy));
418
+ }
419
+
420
+ static ScalableVectorType *getSubdividedVectorType (ScalableVectorType *VTy,
421
+ int NumSubdivs) {
422
+ return cast<ScalableVectorType>(
423
+ VectorType::getSubdividedVectorType (VTy, NumSubdivs));
424
+ }
425
+
426
+ static ScalableVectorType *
427
+ getHalfElementsVectorType (ScalableVectorType *VTy) {
428
+ return cast<ScalableVectorType>(VectorType::getHalfElementsVectorType (VTy));
429
+ }
430
+
431
+ static ScalableVectorType *
432
+ getDoubleElementsVectorType (ScalableVectorType *VTy) {
433
+ return cast<ScalableVectorType>(
434
+ VectorType::getDoubleElementsVectorType (VTy));
435
+ }
436
+
437
+ unsigned getMinNumElements () const {
438
+ return cast<llvm::ScalableVectorType>(LLVMTy)->getMinNumElements ();
439
+ }
440
+
441
+ static bool classof (const Type *T) {
442
+ return isa<llvm::ScalableVectorType>(T->LLVMTy );
443
+ }
444
+ };
445
+
393
446
class FunctionType : public Type {
394
447
public:
395
448
// TODO: add missing functions
0 commit comments