aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTCommon.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2020-06-01 19:42:03 +0100
committerFlorian Hahn <flo@fhahn.com>2020-06-01 20:08:49 +0100
commit8f3f88d2f50d97011bf48ccc507bef033715e566 (patch)
treee65b6ffa00e749719fc7ad0c3b7516568a940c3f /clang/lib/Serialization/ASTCommon.cpp
parentb638b63b99d66786cb37336292604a2ae3490cfd (diff)
downloadllvm-8f3f88d2f50d97011bf48ccc507bef033715e566.zip
llvm-8f3f88d2f50d97011bf48ccc507bef033715e566.tar.gz
llvm-8f3f88d2f50d97011bf48ccc507bef033715e566.tar.bz2
[Matrix] Implement matrix index expressions ([][]).
This patch implements matrix index expressions (matrix[RowIdx][ColumnIdx]). It does so by introducing a new MatrixSubscriptExpr(Base, RowIdx, ColumnIdx). MatrixSubscriptExprs are built in 2 steps in ActOnMatrixSubscriptExpr. First, if the base of a subscript is of matrix type, we create a incomplete MatrixSubscriptExpr(base, idx, nullptr). Second, if the base is an incomplete MatrixSubscriptExpr, we create a complete MatrixSubscriptExpr(base->getBase(), base->getRowIdx(), idx) Similar to vector elements, it is not possible to take the address of a MatrixSubscriptExpr. For CodeGen, a new MatrixElt type is added to LValue, which is very similar to VectorElt. The only difference is that we may need to cast the type of the base from an array to a vector type when accessing it. Reviewers: rjmccall, anemet, Bigcheese, rsmith, martong Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D76791
Diffstat (limited to 'clang/lib/Serialization/ASTCommon.cpp')
-rw-r--r--clang/lib/Serialization/ASTCommon.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTCommon.cpp b/clang/lib/Serialization/ASTCommon.cpp
index 84d1947..a7fd5de 100644
--- a/clang/lib/Serialization/ASTCommon.cpp
+++ b/clang/lib/Serialization/ASTCommon.cpp
@@ -240,6 +240,9 @@ serialization::TypeIdxFromBuiltin(const BuiltinType *BT) {
case BuiltinType::BuiltinFn:
ID = PREDEF_TYPE_BUILTIN_FN;
break;
+ case BuiltinType::IncompleteMatrixIdx:
+ ID = PREDEF_TYPE_INCOMPLETE_MATRIX_IDX;
+ break;
case BuiltinType::OMPArraySection:
ID = PREDEF_TYPE_OMP_ARRAY_SECTION;
break;