[flang][OpenMP] Parse METADIRECTIVE in specification part (#123397)
Add METADIRECTIVE to the OpenMP declarative constructs as well. Emit a TODO error for both declarative and executable cases.
This commit is contained in:
parent
c7c7eabc7f
commit
6dfe20dbbd
@ -112,6 +112,10 @@ std::string OpenMPCounterVisitor::getName(const OpenMPDeclarativeConstruct &c) {
|
||||
const CharBlock &source{o.source};
|
||||
return normalize_construct_name(source.ToString());
|
||||
},
|
||||
[&](const OmpMetadirectiveDirective &o) -> std::string {
|
||||
const CharBlock &source{o.source};
|
||||
return normalize_construct_name(source.ToString());
|
||||
},
|
||||
[&](const auto &o) -> std::string {
|
||||
const CharBlock &source{std::get<Verbatim>(o.t).source};
|
||||
return normalize_construct_name(source.ToString());
|
||||
|
@ -4540,8 +4540,8 @@ struct OpenMPDeclarativeConstruct {
|
||||
CharBlock source;
|
||||
std::variant<OpenMPDeclarativeAllocate, OpenMPDeclareMapperConstruct,
|
||||
OpenMPDeclareReductionConstruct, OpenMPDeclareSimdConstruct,
|
||||
OpenMPDeclareTargetConstruct, OpenMPThreadprivate,
|
||||
OpenMPRequiresConstruct, OpenMPUtilityConstruct>
|
||||
OpenMPThreadprivate, OpenMPRequiresConstruct, OpenMPUtilityConstruct,
|
||||
OpenMPDeclareTargetConstruct, OmpMetadirectiveDirective>
|
||||
u;
|
||||
};
|
||||
|
||||
|
@ -3142,6 +3142,13 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
// support the case of threadprivate variable declared in module.
|
||||
}
|
||||
|
||||
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
semantics::SemanticsContext &semaCtx,
|
||||
lower::pft::Evaluation &eval,
|
||||
const parser::OmpMetadirectiveDirective &meta) {
|
||||
TODO(converter.getCurrentLocation(), "METADIRECTIVE");
|
||||
}
|
||||
|
||||
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
semantics::SemanticsContext &semaCtx,
|
||||
lower::pft::Evaluation &eval,
|
||||
@ -3234,11 +3241,6 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
TODO(converter.getCurrentLocation(), "OpenMPDepobjConstruct");
|
||||
}
|
||||
|
||||
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
semantics::SemanticsContext &semaCtx,
|
||||
lower::pft::Evaluation &eval,
|
||||
const parser::OmpMetadirectiveDirective &construct) {}
|
||||
|
||||
static void
|
||||
genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
|
||||
|
@ -1297,7 +1297,9 @@ TYPE_PARSER(startOmpLine >>
|
||||
construct<OpenMPDeclarativeConstruct>(
|
||||
Parser<OpenMPThreadprivate>{}) ||
|
||||
construct<OpenMPDeclarativeConstruct>(
|
||||
Parser<OpenMPUtilityConstruct>{})) /
|
||||
Parser<OpenMPUtilityConstruct>{}) ||
|
||||
construct<OpenMPDeclarativeConstruct>(
|
||||
Parser<OmpMetadirectiveDirective>{})) /
|
||||
endOmpLine))
|
||||
|
||||
// Block Construct
|
||||
|
9
flang/test/Lower/OpenMP/Todo/metadirective-exec.f90
Normal file
9
flang/test/Lower/OpenMP/Todo/metadirective-exec.f90
Normal file
@ -0,0 +1,9 @@
|
||||
!RUN: %not_todo_cmd bbc -emit-hlfir -fopenmp -fopenmp-version=52 -o - %s 2>&1 | FileCheck %s
|
||||
!RUN: %not_todo_cmd %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -o - %s 2>&1 | FileCheck %s
|
||||
|
||||
!CHECK: not yet implemented: METADIRECTIVE
|
||||
subroutine f00
|
||||
continue
|
||||
!Executable
|
||||
!$omp metadirective when(user={condition(.true.)}: nothing)
|
||||
end
|
9
flang/test/Lower/OpenMP/Todo/metadirective-spec.f90
Normal file
9
flang/test/Lower/OpenMP/Todo/metadirective-spec.f90
Normal file
@ -0,0 +1,9 @@
|
||||
!RUN: %not_todo_cmd bbc -emit-hlfir -fopenmp -fopenmp-version=52 -o - %s 2>&1 | FileCheck %s
|
||||
!RUN: %not_todo_cmd %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -o - %s 2>&1 | FileCheck %s
|
||||
|
||||
!CHECK: not yet implemented: METADIRECTIVE
|
||||
subroutine f00
|
||||
!Specification
|
||||
!$omp metadirective when(user={condition(.true.)}: nothing)
|
||||
implicit none
|
||||
end
|
@ -2,12 +2,14 @@
|
||||
!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50 %s | FileCheck --check-prefix="PARSE-TREE" %s
|
||||
|
||||
subroutine f01
|
||||
continue
|
||||
!$omp metadirective &
|
||||
!$omp & when(user={condition(.true.)}: nothing) &
|
||||
!$omp & default(nothing)
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f01
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(USER={CONDITION(.true._4)}: NOTHING) DEFAULT(NOTHING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
|
||||
|
@ -2,10 +2,12 @@
|
||||
!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=52 %s | FileCheck --check-prefix="PARSE-TREE" %s
|
||||
|
||||
subroutine f00
|
||||
continue
|
||||
!$omp metadirective when(construct={target, parallel}: nothing)
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f00
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(CONSTRUCT={TARGET, PARALLEL}: NOTHING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
|
||||
@ -22,10 +24,12 @@ end
|
||||
!PARSE-TREE: | | | OmpClauseList ->
|
||||
|
||||
subroutine f01
|
||||
continue
|
||||
!$omp metadirective when(target_device={kind(host), device_num(1)}: nothing)
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f01
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(TARGET_DEVICE={KIND(host), DEVICE_NUM(1_4)}: NOTHING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
|
||||
@ -47,10 +51,12 @@ end
|
||||
!PARSE-TREE: | | | OmpClauseList ->
|
||||
|
||||
subroutine f02
|
||||
continue
|
||||
!$omp metadirective when(target_device={kind(any), device_num(7)}: nothing)
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f02
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(TARGET_DEVICE={KIND(any), DEVICE_NUM(7_4)}: NOTHING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
|
||||
@ -72,11 +78,13 @@ end
|
||||
!PARSE-TREE: | | | OmpClauseList ->
|
||||
|
||||
subroutine f03
|
||||
continue
|
||||
!$omp metadirective &
|
||||
!$omp & when(implementation={atomic_default_mem_order(acq_rel)}: nothing)
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f03
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={ATOMIC_DEFAULT_MEM_ORDER(ACQ_REL)}: &
|
||||
!UNPARSE: !$OMP&NOTHING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
@ -94,11 +102,13 @@ end
|
||||
!PARSE-TREE: | | | OmpClauseList ->
|
||||
|
||||
subroutine f04
|
||||
continue
|
||||
!$omp metadirective &
|
||||
!$omp when(implementation={extension_trait(haha(1), foo(baz, "bar"(1)))}: nothing)
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f04
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={extension_trait(haha(1_4), foo(baz,bar(1_4&
|
||||
!UNPARSE: !$OMP&)))}: NOTHING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
@ -127,6 +137,7 @@ end
|
||||
|
||||
subroutine f05(x)
|
||||
integer :: x
|
||||
continue
|
||||
!$omp metadirective &
|
||||
!$omp & when(user={condition(score(100): .true.)}: &
|
||||
!$omp & parallel do reduction(+: x)) &
|
||||
@ -137,6 +148,7 @@ end
|
||||
|
||||
!UNPARSE: SUBROUTINE f05 (x)
|
||||
!UNPARSE: INTEGER x
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(USER={CONDITION(SCORE(100_4): .true._4)}: PARALLEL DO REDUCTION(+&
|
||||
!UNPARSE: !$OMP&: x)) OTHERWISE(NOTHING)
|
||||
!UNPARSE: DO i=1_4,10_4
|
||||
@ -165,6 +177,7 @@ end
|
||||
!PARSE-TREE: | | OmpClauseList ->
|
||||
|
||||
subroutine f06
|
||||
continue
|
||||
! Two trait set selectors
|
||||
!$omp metadirective &
|
||||
!$omp & when(implementation={vendor("amd")}, &
|
||||
@ -172,6 +185,7 @@ subroutine f06
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f06
|
||||
!UNPARSE: CONTINUE
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={VENDOR(amd)}, USER={CONDITION(.true._4)}: NO&
|
||||
!UNPARSE: !$OMP&THING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
@ -196,3 +210,42 @@ end
|
||||
!PARSE-TREE: | | | llvm::omp::Directive = nothing
|
||||
!PARSE-TREE: | | | OmpClauseList ->
|
||||
|
||||
subroutine f07
|
||||
! Declarative metadirective
|
||||
!$omp metadirective &
|
||||
!$omp & when(implementation={vendor("amd")}: declare simd) &
|
||||
!$omp & when(user={condition(.true.)}: declare target) &
|
||||
!$omp & otherwise(nothing)
|
||||
end
|
||||
|
||||
!UNPARSE: SUBROUTINE f07
|
||||
!UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={VENDOR(amd)}: DECLARE SIMD) WHEN(USE&
|
||||
!UNPARSE: !$OMP&R={CONDITION(.true._4)}: DECLARE TARGET) OTHERWISE(NOTHING)
|
||||
!UNPARSE: END SUBROUTINE
|
||||
|
||||
!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpMetadirectiveDirective
|
||||
!PARSE-TREE: | OmpClauseList -> OmpClause -> When -> OmpWhenClause
|
||||
!PARSE-TREE: | | Modifier -> OmpContextSelectorSpecification -> OmpTraitSetSelector
|
||||
!PARSE-TREE: | | | OmpTraitSetSelectorName -> Value = Implementation
|
||||
!PARSE-TREE: | | | OmpTraitSelector
|
||||
!PARSE-TREE: | | | | OmpTraitSelectorName -> Value = Vendor
|
||||
!PARSE-TREE: | | | | Properties
|
||||
!PARSE-TREE: | | | | | OmpTraitProperty -> OmpTraitPropertyName -> string = 'amd'
|
||||
!PARSE-TREE: | | OmpDirectiveSpecification
|
||||
!PARSE-TREE: | | | llvm::omp::Directive = declare simd
|
||||
!PARSE-TREE: | | | OmpClauseList ->
|
||||
!PARSE-TREE: | OmpClause -> When -> OmpWhenClause
|
||||
!PARSE-TREE: | | Modifier -> OmpContextSelectorSpecification -> OmpTraitSetSelector
|
||||
!PARSE-TREE: | | | OmpTraitSetSelectorName -> Value = User
|
||||
!PARSE-TREE: | | | OmpTraitSelector
|
||||
!PARSE-TREE: | | | | OmpTraitSelectorName -> Value = Condition
|
||||
!PARSE-TREE: | | | | Properties
|
||||
!PARSE-TREE: | | | | | OmpTraitProperty -> Scalar -> Expr = '.true._4'
|
||||
!PARSE-TREE: | | | | | | LiteralConstant -> LogicalLiteralConstant
|
||||
!PARSE-TREE: | | | | | | | bool = 'true'
|
||||
!PARSE-TREE: | | OmpDirectiveSpecification
|
||||
!PARSE-TREE: | | | llvm::omp::Directive = declare target
|
||||
!PARSE-TREE: | | | OmpClauseList ->
|
||||
!PARSE-TREE: | OmpClause -> Otherwise -> OmpOtherwiseClause -> OmpDirectiveSpecification
|
||||
!PARSE-TREE: | | llvm::omp::Directive = nothing
|
||||
!PARSE-TREE: | | OmpClauseList ->
|
Loading…
x
Reference in New Issue
Block a user