[all-commits] [llvm/llvm-project] 8f3f88: [Matrix] Implement matrix index expressions ([][]).

Florian Hahn via All-commits all-commits at lists.llvm.org
Mon Jun 1 12:19:44 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f3f88d2f50d97011bf48ccc507bef033715e566
      https://github.com/llvm/llvm-project/commit/8f3f88d2f50d97011bf48ccc507bef033715e566
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-06-01 (Mon, 01 Jun 2020)

  Changed paths:
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/AST/BuiltinTypes.def
    M clang/include/clang/AST/ComputeDependence.h
    M clang/include/clang/AST/Expr.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/Stmt.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/Specifiers.h
    M clang/include/clang/Basic/StmtNodes.td
    M clang/include/clang/Sema/Initialization.h
    M clang/include/clang/Sema/Sema.h
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ComputeDependence.cpp
    M clang/lib/AST/Expr.cpp
    M clang/lib/AST/ExprClassification.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/NSAPI.cpp
    M clang/lib/AST/StmtPrinter.cpp
    M clang/lib/AST/StmtProfile.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypeLoc.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/lib/CodeGen/CGValue.h
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/Sema/SemaCast.cpp
    M clang/lib/Sema/SemaExceptionSpec.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaInit.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTCommon.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/test/CodeGen/matrix-type-operators.c
    M clang/test/CodeGenCXX/matrix-type-operators.cpp
    A clang/test/CodeGenObjC/matrix-type-operators.m
    M clang/test/Sema/matrix-type-operators.c
    M clang/test/SemaCXX/matrix-type-operators.cpp
    A clang/test/SemaObjC/matrix-type-operators.m
    M clang/tools/libclang/CXCursor.cpp
    M llvm/include/llvm/IR/MatrixBuilder.h

  Log Message:
  -----------
  [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




More information about the All-commits mailing list