|
14 | 14 | #ifndef LLVM_CLANG_AST_TYPE_H |
15 | 15 | #define LLVM_CLANG_AST_TYPE_H |
16 | 16 |
|
| 17 | +#include "dxc/DXIL/DxilConstants.h" |
17 | 18 | #include "clang/AST/NestedNameSpecifier.h" |
18 | 19 | #include "clang/AST/TemplateName.h" |
19 | 20 | #include "clang/Basic/AddressSpaces.h" |
@@ -1699,7 +1700,14 @@ class Type : public ExtQualsTypeCommonBase { |
1699 | 1700 |
|
1700 | 1701 | bool isOpenCLSpecificType() const; // Any OpenCL specific type |
1701 | 1702 |
|
| 1703 | + // HLSL Change Start |
1702 | 1704 | bool isLinAlgMatrixType() const; // HLSL __builtin_LinAlgMatrix |
| 1705 | + bool isAttributedLinAlgMatrixType() |
| 1706 | + const; // HLSL attributed __builtin_LinAlgMatrix |
| 1707 | + bool isDependentAttributedLinAlgMatrixType() |
| 1708 | + const; // HLSL attributed __builtin_LinAlgMatrix with dependent |
| 1709 | + // parameters |
| 1710 | + // HLSL Change End |
1703 | 1711 |
|
1704 | 1712 | /// Determines if this type, which must satisfy |
1705 | 1713 | /// isObjCLifetimeType(), is implicitly __unsafe_unretained rather |
@@ -3736,6 +3744,108 @@ class AttributedType : public Type, public llvm::FoldingSetNode { |
3736 | 3744 | } |
3737 | 3745 | }; |
3738 | 3746 |
|
| 3747 | +// HLSL Change Start |
| 3748 | + |
| 3749 | +class AttributedLinAlgMatrixType : public Type, public llvm::FoldingSetNode { |
| 3750 | + friend class ASTContext; // ASTContext creates these |
| 3751 | + |
| 3752 | + QualType WrappedType; // should be __builtin_LinAlgMatrix |
| 3753 | + hlsl::DXIL::ComponentType ComponentTy; |
| 3754 | + size_t Rows, Cols; |
| 3755 | + hlsl::DXIL::MatrixUse Use; |
| 3756 | + hlsl::DXIL::MatrixScope Scope; |
| 3757 | + |
| 3758 | + AttributedLinAlgMatrixType(QualType WrappedTy, |
| 3759 | + hlsl::DXIL::ComponentType ComponentTy, size_t Rows, |
| 3760 | + size_t Cols, hlsl::DXIL::MatrixUse Use, |
| 3761 | + hlsl::DXIL::MatrixScope Scope) |
| 3762 | + : Type(AttributedLinAlgMatrix, QualType(), /*Dependent*/ false, |
| 3763 | + /*InstantiationDependent*/ false, /*VariablyModified*/ false, |
| 3764 | + /*ContainsUnexpandedParameterPack*/ false), |
| 3765 | + WrappedType(WrappedTy), ComponentTy(ComponentTy), Rows(Rows), |
| 3766 | + Cols(Cols), Use(Use), Scope(Scope) {} |
| 3767 | + |
| 3768 | +public: |
| 3769 | + QualType getWrappedType() const { return WrappedType; } |
| 3770 | + |
| 3771 | + hlsl::DXIL::ComponentType getComponentType() const { return ComponentTy; } |
| 3772 | + size_t getRows() const { return Rows; } |
| 3773 | + size_t getCols() const { return Cols; } |
| 3774 | + hlsl::DXIL::MatrixUse getUse() const { return Use; } |
| 3775 | + hlsl::DXIL::MatrixScope getScope() const { return Scope; } |
| 3776 | + |
| 3777 | + void appendMangledAttributes(llvm::raw_ostream &OS) const; |
| 3778 | + |
| 3779 | + bool isSugared() const { return false; } |
| 3780 | + QualType desugar() const { return QualType(this, 0); } |
| 3781 | + |
| 3782 | + void Profile(llvm::FoldingSetNodeID &ID) { |
| 3783 | + Profile(ID, WrappedType, ComponentTy, Rows, Cols, Use, Scope); |
| 3784 | + } |
| 3785 | + |
| 3786 | + static void Profile(llvm::FoldingSetNodeID &ID, QualType WrappedTy, |
| 3787 | + hlsl::DXIL::ComponentType ComponentTy, size_t Rows, |
| 3788 | + size_t Cols, hlsl::DXIL::MatrixUse Use, |
| 3789 | + hlsl::DXIL::MatrixScope Scope) { |
| 3790 | + ID.AddPointer(WrappedTy.getAsOpaquePtr()); |
| 3791 | + ID.AddInteger(static_cast<uint32_t>(ComponentTy)); |
| 3792 | + ID.AddInteger(static_cast<uint32_t>(Rows)); |
| 3793 | + ID.AddInteger(static_cast<uint32_t>(Cols)); |
| 3794 | + ID.AddInteger(static_cast<uint32_t>(Use)); |
| 3795 | + ID.AddInteger(static_cast<uint32_t>(Scope)); |
| 3796 | + } |
| 3797 | + |
| 3798 | + static bool classof(const Type *T) { |
| 3799 | + return T->getTypeClass() == AttributedLinAlgMatrix; |
| 3800 | + } |
| 3801 | +}; |
| 3802 | + |
| 3803 | +class DependentAttributedLinAlgMatrixType : public Type, |
| 3804 | + public llvm::FoldingSetNode { |
| 3805 | + const ASTContext &Context; |
| 3806 | + QualType WrappedType; // should be __builtin_LinAlgMatrix |
| 3807 | + Expr *ComponentTyExpr; |
| 3808 | + Expr *RowsExpr; |
| 3809 | + Expr *ColsExpr; |
| 3810 | + Expr *UseExpr; |
| 3811 | + Expr *ScopeExpr; |
| 3812 | + |
| 3813 | + DependentAttributedLinAlgMatrixType(const ASTContext &Context, |
| 3814 | + QualType WrappedType, |
| 3815 | + Expr *ComponentTyExpr, Expr *RowsExpr, |
| 3816 | + Expr *ColsExpr, Expr *UseExpr, |
| 3817 | + Expr *ScopeExpr); |
| 3818 | + |
| 3819 | + friend class ASTContext; |
| 3820 | + |
| 3821 | +public: |
| 3822 | + QualType getWrappedType() const { return WrappedType; } |
| 3823 | + Expr *getComponentTyExpr() const { return ComponentTyExpr; } |
| 3824 | + Expr *getRowsExpr() const { return RowsExpr; } |
| 3825 | + Expr *getColsExpr() const { return ColsExpr; } |
| 3826 | + Expr *getUseExpr() const { return UseExpr; } |
| 3827 | + Expr *getScopeExpr() const { return ScopeExpr; } |
| 3828 | + |
| 3829 | + bool isSugared() const { return false; } |
| 3830 | + QualType desugar() const { return QualType(this, 0); } |
| 3831 | + |
| 3832 | + static bool classof(const Type *T) { |
| 3833 | + return T->getTypeClass() == DependentAttributedLinAlgMatrix; |
| 3834 | + } |
| 3835 | + |
| 3836 | + void Profile(llvm::FoldingSetNodeID &ID) { |
| 3837 | + Profile(ID, Context, getWrappedType(), getComponentTyExpr(), getRowsExpr(), |
| 3838 | + getColsExpr(), getUseExpr(), getScopeExpr()); |
| 3839 | + } |
| 3840 | + |
| 3841 | + static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, |
| 3842 | + QualType WrappedType, Expr *ComponentTyExpr, |
| 3843 | + Expr *RowsExpr, Expr *ColsExpr, Expr *UseExpr, |
| 3844 | + Expr *ScopeExpr); |
| 3845 | +}; |
| 3846 | + |
| 3847 | +// HLSL Change End |
| 3848 | + |
3739 | 3849 | class TemplateTypeParmType : public Type, public llvm::FoldingSetNode { |
3740 | 3850 | // Helper data collector for canonical types. |
3741 | 3851 | struct CanonicalTTPTInfo { |
@@ -5426,6 +5536,14 @@ inline bool Type::isEventT() const { |
5426 | 5536 | inline bool Type::isLinAlgMatrixType() const { |
5427 | 5537 | return isSpecificBuiltinType(BuiltinType::LinAlgMatrix); |
5428 | 5538 | } |
| 5539 | + |
| 5540 | +inline bool Type::isAttributedLinAlgMatrixType() const { |
| 5541 | + return isa<AttributedLinAlgMatrixType>(this); |
| 5542 | +} |
| 5543 | + |
| 5544 | +inline bool Type::isDependentAttributedLinAlgMatrixType() const { |
| 5545 | + return isa<DependentAttributedLinAlgMatrixType>(this); |
| 5546 | +} |
5429 | 5547 | // HLSL Change Ends |
5430 | 5548 |
|
5431 | 5549 | inline bool Type::isImageType() const { |
|
0 commit comments