diff options
Diffstat (limited to 'flang/include')
| -rw-r--r-- | flang/include/flang/Lower/OpenMP/Clauses.h | 1 | ||||
| -rw-r--r-- | flang/include/flang/Optimizer/Builder/IntrinsicCall.h | 16 | ||||
| -rw-r--r-- | flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h | 2 | ||||
| -rw-r--r-- | flang/include/flang/Parser/dump-parse-tree.h | 8 | ||||
| -rw-r--r-- | flang/include/flang/Parser/openmp-utils.h | 22 | ||||
| -rw-r--r-- | flang/include/flang/Parser/parse-tree.h | 73 | ||||
| -rw-r--r-- | flang/include/flang/Semantics/dump-expr.h | 3 | ||||
| -rw-r--r-- | flang/include/flang/Semantics/symbol.h | 2 | ||||
| -rw-r--r-- | flang/include/flang/Support/Fortran.h | 3 | 
9 files changed, 116 insertions, 14 deletions
| diff --git a/flang/include/flang/Lower/OpenMP/Clauses.h b/flang/include/flang/Lower/OpenMP/Clauses.h index 7492466..688d017 100644 --- a/flang/include/flang/Lower/OpenMP/Clauses.h +++ b/flang/include/flang/Lower/OpenMP/Clauses.h @@ -294,6 +294,7 @@ using Permutation = tomp::clause::PermutationT<TypeTy, IdTy, ExprTy>;  using TaskReduction = tomp::clause::TaskReductionT<TypeTy, IdTy, ExprTy>;  using ThreadLimit = tomp::clause::ThreadLimitT<TypeTy, IdTy, ExprTy>;  using Threads = tomp::clause::ThreadsT<TypeTy, IdTy, ExprTy>; +using Threadset = tomp::clause::ThreadsetT<TypeTy, IdTy, ExprTy>;  using Transparent = tomp::clause::TransparentT<TypeTy, IdTy, ExprTy>;  using To = tomp::clause::ToT<TypeTy, IdTy, ExprTy>;  using UnifiedAddress = tomp::clause::UnifiedAddressT<TypeTy, IdTy, ExprTy>; diff --git a/flang/include/flang/Optimizer/Builder/IntrinsicCall.h b/flang/include/flang/Optimizer/Builder/IntrinsicCall.h index c3cd119b..3407dd0 100644 --- a/flang/include/flang/Optimizer/Builder/IntrinsicCall.h +++ b/flang/include/flang/Optimizer/Builder/IntrinsicCall.h @@ -211,6 +211,8 @@ struct IntrinsicLibrary {    mlir::Value genBarrierArrive(mlir::Type, llvm::ArrayRef<mlir::Value>);    mlir::Value genBarrierArriveCnt(mlir::Type, llvm::ArrayRef<mlir::Value>);    void genBarrierInit(llvm::ArrayRef<fir::ExtendedValue>); +  mlir::Value genBarrierTryWait(mlir::Type, llvm::ArrayRef<mlir::Value>); +  mlir::Value genBarrierTryWaitSleep(mlir::Type, llvm::ArrayRef<mlir::Value>);    fir::ExtendedValue genBesselJn(mlir::Type,                                   llvm::ArrayRef<fir::ExtendedValue>);    fir::ExtendedValue genBesselYn(mlir::Type, @@ -459,7 +461,21 @@ struct IntrinsicLibrary {    mlir::Value genTime(mlir::Type, llvm::ArrayRef<mlir::Value>);    void genTMABulkCommitGroup(llvm::ArrayRef<fir::ExtendedValue>);    void genTMABulkG2S(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkLoadC4(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkLoadC8(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkLoadI4(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkLoadI8(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkLoadR2(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkLoadR4(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkLoadR8(llvm::ArrayRef<fir::ExtendedValue>);    void genTMABulkS2G(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkStoreI4(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkStoreI8(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkStoreR2(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkStoreR4(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkStoreR8(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkStoreC4(llvm::ArrayRef<fir::ExtendedValue>); +  void genTMABulkStoreC8(llvm::ArrayRef<fir::ExtendedValue>);    void genTMABulkWaitGroup(llvm::ArrayRef<fir::ExtendedValue>);    mlir::Value genTrailz(mlir::Type, llvm::ArrayRef<mlir::Value>);    fir::ExtendedValue genTransfer(mlir::Type, diff --git a/flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h b/flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h index 4817ed9..3167c55 100644 --- a/flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h +++ b/flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h @@ -60,6 +60,8 @@ struct OpenACCMappableModel    getOffsetInBytes(mlir::Type type, mlir::Value var, mlir::ValueRange accBounds,                     const mlir::DataLayout &dataLayout) const; +  bool hasUnknownDimensions(mlir::Type type) const; +    llvm::SmallVector<mlir::Value>    generateAccBounds(mlir::Type type, mlir::Value var,                      mlir::OpBuilder &builder) const; diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h index 553cbd5..a7398a4 100644 --- a/flang/include/flang/Parser/dump-parse-tree.h +++ b/flang/include/flang/Parser/dump-parse-tree.h @@ -599,7 +599,7 @@ public:    NODE(parser, OmpInitClause)    NODE(OmpInitClause, Modifier)    NODE(parser, OmpInitializerClause) -  NODE(parser, OmpInitializerProc) +  NODE(parser, OmpInitializerExpression)    NODE(parser, OmpInReductionClause)    NODE(OmpInReductionClause, Modifier)    NODE(parser, OmpInteropPreference) @@ -677,10 +677,16 @@ public:    NODE_ENUM(OmpSeverityClause, Severity)    NODE(parser, OmpStepComplexModifier)    NODE(parser, OmpStepSimpleModifier) +  NODE(parser, OmpStylizedDeclaration) +  NODE(parser, OmpStylizedExpression) +  NODE(parser, OmpStylizedInstance) +  NODE(OmpStylizedInstance, Instance)    NODE(parser, OmpTaskDependenceType)    NODE_ENUM(OmpTaskDependenceType, Value)    NODE(parser, OmpTaskReductionClause)    NODE(OmpTaskReductionClause, Modifier) +  NODE(parser, OmpThreadsetClause) +  NODE_ENUM(OmpThreadsetClause, ThreadsetPolicy)    NODE(parser, OmpToClause)    NODE(OmpToClause, Modifier)    NODE(parser, OmpTraitProperty) diff --git a/flang/include/flang/Parser/openmp-utils.h b/flang/include/flang/Parser/openmp-utils.h index f761332..49db091 100644 --- a/flang/include/flang/Parser/openmp-utils.h +++ b/flang/include/flang/Parser/openmp-utils.h @@ -25,6 +25,13 @@  namespace Fortran::parser::omp { +template <typename T> constexpr auto addr_if(std::optional<T> &x) { +  return x ? &*x : nullptr; +} +template <typename T> constexpr auto addr_if(const std::optional<T> &x) { +  return x ? &*x : nullptr; +} +  namespace detail {  using D = llvm::omp::Directive; @@ -133,9 +140,24 @@ template <typename T> OmpDirectiveName GetOmpDirectiveName(const T &x) {  }  const OmpObjectList *GetOmpObjectList(const OmpClause &clause); + +template <typename T> +const T *GetFirstArgument(const OmpDirectiveSpecification &spec) { +  for (const OmpArgument &arg : spec.Arguments().v) { +    if (auto *t{std::get_if<T>(&arg.u)}) { +      return t; +    } +  } +  return nullptr; +} +  const BlockConstruct *GetFortranBlockConstruct(      const ExecutionPartConstruct &epc); +const OmpCombinerExpression *GetCombinerExpr( +    const OmpReductionSpecifier &rspec); +const OmpInitializerExpression *GetInitializerExpr(const OmpClause &init); +  } // namespace Fortran::parser::omp  #endif // FORTRAN_PARSER_OPENMP_UTILS_H diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h index 2cf6fae..375790a 100644 --- a/flang/include/flang/Parser/parse-tree.h +++ b/flang/include/flang/Parser/parse-tree.h @@ -24,7 +24,9 @@  #include "provenance.h"  #include "flang/Common/idioms.h"  #include "flang/Common/indirection.h" +#include "flang/Common/reference.h"  #include "flang/Support/Fortran.h" +#include "llvm/ADT/ArrayRef.h"  #include "llvm/Frontend/OpenACC/ACC.h.inc"  #include "llvm/Frontend/OpenMP/OMP.h"  #include "llvm/Frontend/OpenMP/OMPConstants.h" @@ -3510,6 +3512,8 @@ struct OmpDirectiveName {  // type-name list item  struct OmpTypeName { +  CharBlock source; +  mutable const semantics::DeclTypeSpec *declTypeSpec{nullptr};    UNION_CLASS_BOILERPLATE(OmpTypeName);    std::variant<TypeSpec, DeclarationTypeSpec> u;  }; @@ -3538,6 +3542,39 @@ struct OmpObjectList {    WRAPPER_CLASS_BOILERPLATE(OmpObjectList, std::list<OmpObject>);  }; +struct OmpStylizedDeclaration { +  COPY_AND_ASSIGN_BOILERPLATE(OmpStylizedDeclaration); +  // Since "Reference" isn't handled by parse-tree-visitor, add EmptyTrait, +  // and visit the members by hand when needed. +  using EmptyTrait = std::true_type; +  common::Reference<const OmpTypeName> type; +  EntityDecl var; +}; + +struct OmpStylizedInstance { +  struct Instance { +    UNION_CLASS_BOILERPLATE(Instance); +    std::variant<AssignmentStmt, CallStmt, common::Indirection<Expr>> u; +  }; +  TUPLE_CLASS_BOILERPLATE(OmpStylizedInstance); +  std::tuple<std::list<OmpStylizedDeclaration>, Instance> t; +}; + +class ParseState; + +// Ref: [5.2:76], [6.0:185] +// +struct OmpStylizedExpression { +  CharBlock source; +  // Pointer to a temporary copy of the ParseState that is used to create +  // additional parse subtrees for the stylized expression. This is only +  // used internally during parsing and conveys no information to the +  // consumers of the AST. +  const ParseState *state{nullptr}; +  WRAPPER_CLASS_BOILERPLATE( +      OmpStylizedExpression, std::list<OmpStylizedInstance>); +}; +  // Ref: [4.5:201-207], [5.0:293-299], [5.1:325-331], [5.2:124]  //  // reduction-identifier -> @@ -3555,9 +3592,22 @@ struct OmpReductionIdentifier {  // combiner-expression ->                           // since 4.5  //    assignment-statement |  //    function-reference -struct OmpCombinerExpression { -  UNION_CLASS_BOILERPLATE(OmpCombinerExpression); -  std::variant<AssignmentStmt, FunctionReference> u; +struct OmpCombinerExpression : public OmpStylizedExpression { +  INHERITED_WRAPPER_CLASS_BOILERPLATE( +      OmpCombinerExpression, OmpStylizedExpression); +  static llvm::ArrayRef<CharBlock> Variables(); +}; + +// Ref: [4.5:222:7-8], [5.0:305:28-29], [5.1:337:20-21], [5.2:127:6-8], +//      [6.0:242:3-5] +// +// initializer-expression ->                        // since 4.5 +//    OMP_PRIV = expression | +//    subroutine-name(argument-list) +struct OmpInitializerExpression : public OmpStylizedExpression { +  INHERITED_WRAPPER_CLASS_BOILERPLATE( +      OmpInitializerExpression, OmpStylizedExpression); +  static llvm::ArrayRef<CharBlock> Variables();  };  inline namespace arguments { @@ -4558,16 +4608,9 @@ struct OmpInReductionClause {    std::tuple<MODIFIERS(), OmpObjectList> t;  }; -// declare-reduction -> DECLARE REDUCTION (reduction-identifier : type-list -//                                              : combiner) [initializer-clause] -struct OmpInitializerProc { -  TUPLE_CLASS_BOILERPLATE(OmpInitializerProc); -  std::tuple<ProcedureDesignator, std::list<ActualArgSpec>> t; -};  // Initialization for declare reduction construct  struct OmpInitializerClause { -  UNION_CLASS_BOILERPLATE(OmpInitializerClause); -  std::variant<OmpInitializerProc, AssignmentStmt> u; +  WRAPPER_CLASS_BOILERPLATE(OmpInitializerClause, OmpInitializerExpression);  };  // Ref: [4.5:199-201], [5.0:288-290], [5.1:321-322], [5.2:115-117] @@ -4782,6 +4825,14 @@ struct OmpTaskReductionClause {    std::tuple<MODIFIERS(), OmpObjectList> t;  }; +// Ref: [6.0:442] +// threadset-clause -> +//     THREADSET(omp_pool|omp_team) +struct OmpThreadsetClause { +  ENUM_CLASS(ThreadsetPolicy, Omp_Pool, Omp_Team) +  WRAPPER_CLASS_BOILERPLATE(OmpThreadsetClause, ThreadsetPolicy); +}; +  // Ref: [4.5:107-109], [5.0:176-180], [5.1:205-210], [5.2:167-168]  //  // to-clause (in DECLARE TARGET) -> diff --git a/flang/include/flang/Semantics/dump-expr.h b/flang/include/flang/Semantics/dump-expr.h index 2dbd4cb..5a78e13 100644 --- a/flang/include/flang/Semantics/dump-expr.h +++ b/flang/include/flang/Semantics/dump-expr.h @@ -48,10 +48,11 @@ private:        // "... [with T = xyz; std::string_view = ...]"  #ifdef __clang__        std::string_view front("[T = "); +      std::string_view back("]");  #else        std::string_view front("[with T = "); -#endif        std::string_view back("; std::string_view ="); +#endif  #elif defined(_MSC_VER)  #define DUMP_EXPR_SHOW_TYPE diff --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h index 04a0639..cb27d544 100644 --- a/flang/include/flang/Semantics/symbol.h +++ b/flang/include/flang/Semantics/symbol.h @@ -830,6 +830,8 @@ public:        OmpUseDevicePtr, OmpUseDeviceAddr, OmpIsDevicePtr, OmpHasDeviceAddr,        // OpenMP data-copying attribute        OmpCopyIn, OmpCopyPrivate, +      // OpenMP special variables +      OmpInVar, OmpOrigVar, OmpOutVar, OmpPrivVar,        // OpenMP miscellaneous flags        OmpCommonBlock, OmpReduction, OmpInReduction, OmpAligned, OmpNontemporal,        OmpAllocate, OmpDeclarativeAllocateDirective, diff --git a/flang/include/flang/Support/Fortran.h b/flang/include/flang/Support/Fortran.h index ea0344e..cf39781 100644 --- a/flang/include/flang/Support/Fortran.h +++ b/flang/include/flang/Support/Fortran.h @@ -86,8 +86,9 @@ ENUM_CLASS(IgnoreTKR,      Rank, // R - don't check ranks      Device, // D - don't check host/device residence      Managed, // M - don't check managed storage -    Contiguous) // C - don't check for storage sequence association with a +    Contiguous, // C - don't check for storage sequence association with a                  // potentially non-contiguous object +    Pointer) // P - ignore pointer and allocatable matching  using IgnoreTKRSet = EnumSet<IgnoreTKR, 8>;  // IGNORE_TKR(A) = IGNORE_TKR(TKRDM)  static constexpr IgnoreTKRSet ignoreTKRAll{IgnoreTKR::Type, IgnoreTKR::Kind, | 
