169 lines · plain
1!RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case --check-prefix="UNPARSE" %s2!RUN: %flang_fc1 -fdebug-dump-parse-tree-no-sema -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s3 4! Check that constructs A and B are parsed correctly, where the name of A5! is a prefix of B.6! Currently it's TARGET vs TARGET DATA, TARGET ENTER DATA, TARGET EXIT DATA,7! and TARGET UPDATE.8 9subroutine f00(x)10 implicit none11 integer :: x12 !$omp target13 !$omp target data map(x)14 x = x + 115 !$omp end target data16 !$omp end target17end18 19!UNPARSE: SUBROUTINE f00 (x)20!UNPARSE: IMPLICIT NONE21!UNPARSE: INTEGER x22!UNPARSE: !$OMP TARGET23!UNPARSE: !$OMP TARGET DATA MAP(x)24!UNPARSE: x = x+125!UNPARSE: !$OMP END TARGET DATA26!UNPARSE: !$OMP END TARGET27!UNPARSE: END SUBROUTINE28 29!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct30!PARSE-TREE: | OmpBeginDirective31!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target32!PARSE-TREE: | | OmpClauseList ->33!PARSE-TREE: | Block34!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct35!PARSE-TREE: | | | OmpBeginDirective36!PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = target data37!PARSE-TREE: | | | | OmpClauseList -> OmpClause -> Map -> OmpMapClause38!PARSE-TREE: | | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'39!PARSE-TREE: | | | | | bool = 'true'40!PARSE-TREE: | | | Block41!PARSE-TREE: | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt42!PARSE-TREE: | | | | | Variable -> Designator -> DataRef -> Name = 'x'43!PARSE-TREE: | | | | | Expr -> Add44!PARSE-TREE: | | | | | | Expr -> Designator -> DataRef -> Name = 'x'45!PARSE-TREE: | | | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'46!PARSE-TREE: | | | OmpEndDirective47!PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = target data48!PARSE-TREE: | | | | OmpClauseList ->49!PARSE-TREE: | OmpEndDirective50!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target51!PARSE-TREE: | | OmpClauseList ->52 53 54subroutine f01(x)55 implicit none56 integer :: x57 !$omp target58 !$omp target enter data map(x)59 x = x + 160 !$omp end target61end62 63!UNPARSE: SUBROUTINE f01 (x)64!UNPARSE: IMPLICIT NONE65!UNPARSE: INTEGER x66!UNPARSE: !$OMP TARGET67!UNPARSE: !$OMP TARGET ENTER DATA MAP(x)68!UNPARSE: x = x+169!UNPARSE: !$OMP END TARGET70!UNPARSE: END SUBROUTINE71 72!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct73!PARSE-TREE: | OmpBeginDirective74!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target75!PARSE-TREE: | | OmpClauseList ->76!PARSE-TREE: | Block77!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification78!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = target enter data79!PARSE-TREE: | | | OmpClauseList -> OmpClause -> Map -> OmpMapClause80!PARSE-TREE: | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'81!PARSE-TREE: | | | | bool = 'true'82!PARSE-TREE: | | | Flags = {}83!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt84!PARSE-TREE: | | | Variable -> Designator -> DataRef -> Name = 'x'85!PARSE-TREE: | | | Expr -> Add86!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'87!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'88!PARSE-TREE: | OmpEndDirective89!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target90!PARSE-TREE: | | OmpClauseList ->91 92 93subroutine f02(x)94 implicit none95 integer :: x96 !$omp target97 !$omp target exit data map(x)98 x = x + 199 !$omp end target100end101 102!UNPARSE: SUBROUTINE f02 (x)103!UNPARSE: IMPLICIT NONE104!UNPARSE: INTEGER x105!UNPARSE: !$OMP TARGET106!UNPARSE: !$OMP TARGET EXIT DATA MAP(x)107!UNPARSE: x = x+1108!UNPARSE: !$OMP END TARGET109!UNPARSE: END SUBROUTINE110 111!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct112!PARSE-TREE: | OmpBeginDirective113!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target114!PARSE-TREE: | | OmpClauseList ->115!PARSE-TREE: | Block116!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification117!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = target exit data118!PARSE-TREE: | | | OmpClauseList -> OmpClause -> Map -> OmpMapClause119!PARSE-TREE: | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'120!PARSE-TREE: | | | | bool = 'true'121!PARSE-TREE: | | | Flags = {}122!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt123!PARSE-TREE: | | | Variable -> Designator -> DataRef -> Name = 'x'124!PARSE-TREE: | | | Expr -> Add125!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'126!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'127!PARSE-TREE: | OmpEndDirective128!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target129!PARSE-TREE: | | OmpClauseList ->130 131 132subroutine f03(x)133 implicit none134 integer :: x135 !$omp target136 !$omp target update to(x)137 x = x + 1138 !$omp end target139end140 141!UNPARSE: SUBROUTINE f03 (x)142!UNPARSE: IMPLICIT NONE143!UNPARSE: INTEGER x144!UNPARSE: !$OMP TARGET145!UNPARSE: !$OMP TARGET UPDATE TO(x)146!UNPARSE: x = x+1147!UNPARSE: !$OMP END TARGET148!UNPARSE: END SUBROUTINE149 150!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct151!PARSE-TREE: | OmpBeginDirective152!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target153!PARSE-TREE: | | OmpClauseList ->154!PARSE-TREE: | Block155!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification156!PARSE-TREE: | | | OmpDirectiveName -> llvm::omp::Directive = target update157!PARSE-TREE: | | | OmpClauseList -> OmpClause -> To -> OmpToClause158!PARSE-TREE: | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'159!PARSE-TREE: | | | | bool = 'true'160!PARSE-TREE: | | | Flags = {}161!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt162!PARSE-TREE: | | | Variable -> Designator -> DataRef -> Name = 'x'163!PARSE-TREE: | | | Expr -> Add164!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'165!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'166!PARSE-TREE: | OmpEndDirective167!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target168!PARSE-TREE: | | OmpClauseList ->169