-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenACC] implement 'device_type' for combined constructs
This clause is pretty small/doesn't do much semantic-analysis-wise, , other than have two spellings and disallow certain clauses after it. However, as most of those aren't implemented yet, the diagnostic is left as a TODO.
- Loading branch information
1 parent
67fb268
commit 6b2de10
Showing
11 changed files
with
514 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
178 changes: 178 additions & 0 deletions
178
clang/test/SemaOpenACC/combined-construct-device_type-ast.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
// RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s | ||
|
||
// Test this with PCH. | ||
// RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s | ||
// RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s | ||
#ifndef PCH_HELPER | ||
#define PCH_HELPER | ||
|
||
struct SomeS{}; | ||
void NormalUses() { | ||
// CHECK: FunctionDecl{{.*}}NormalUses | ||
// CHECK-NEXT: CompoundStmt | ||
|
||
SomeS SomeImpl; | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} SomeImpl 'SomeS' | ||
// CHECK-NEXT: CXXConstructExpr | ||
bool SomeVar; | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} SomeVar 'bool' | ||
|
||
#pragma acc parallel loop device_type(SomeS) dtype(SomeImpl) | ||
for(int i = 0; i < 5; ++i){} | ||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop | ||
// CHECK-NEXT: device_type(SomeS) | ||
// CHECK-NEXT: dtype(SomeImpl) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
#pragma acc serial loop device_type(SomeVar) dtype(int) | ||
for(int i = 0; i < 5; ++i){} | ||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} serial loop | ||
// CHECK-NEXT: device_type(SomeVar) | ||
// CHECK-NEXT: dtype(int) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
#pragma acc kernels loop device_type(private) dtype(struct) | ||
for(int i = 0; i < 5; ++i){} | ||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} kernels loop | ||
// CHECK-NEXT: device_type(private) | ||
// CHECK-NEXT: dtype(struct) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
#pragma acc parallel loop device_type(private) dtype(class) | ||
for(int i = 0; i < 5; ++i){} | ||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop | ||
// CHECK-NEXT: device_type(private) | ||
// CHECK-NEXT: dtype(class) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
#pragma acc serial loop device_type(float) dtype(*) | ||
for(int i = 0; i < 5; ++i){} | ||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} serial loop | ||
// CHECK-NEXT: device_type(float) | ||
// CHECK-NEXT: dtype(*) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
#pragma acc kernels loop device_type(float, int) dtype(*) | ||
for(int i = 0; i < 5; ++i){} | ||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} kernels loop | ||
// CHECK-NEXT: device_type(float, int) | ||
// CHECK-NEXT: dtype(*) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
} | ||
|
||
template<typename T> | ||
void TemplUses() { | ||
// CHECK-NEXT: FunctionTemplateDecl{{.*}}TemplUses | ||
// CHECK-NEXT: TemplateTypeParmDecl{{.*}}T | ||
// CHECK-NEXT: FunctionDecl{{.*}}TemplUses | ||
// CHECK-NEXT: CompoundStmt | ||
#pragma acc parallel loop device_type(T) dtype(T) | ||
for(int i = 0; i < 5; ++i){} | ||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop | ||
// CHECK-NEXT: device_type(T) | ||
// CHECK-NEXT: dtype(T) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
|
||
|
||
// Instantiations | ||
// CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void ()' implicit_instantiation | ||
// CHECK-NEXT: TemplateArgument type 'int' | ||
// CHECK-NEXT: BuiltinType{{.*}} 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
|
||
// CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop | ||
// CHECK-NEXT: device_type(T) | ||
// CHECK-NEXT: dtype(T) | ||
// CHECK-NEXT: ForStmt | ||
// CHECK-NEXT: DeclStmt | ||
// CHECK-NEXT: VarDecl{{.*}} i 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0 | ||
// CHECK-NEXT: <<<NULL>>> | ||
// CHECK-NEXT: BinaryOperator{{.*}}'<' | ||
// CHECK-NEXT: ImplicitCastExpr | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5 | ||
// CHECK-NEXT: UnaryOperator{{.*}}++ | ||
// CHECK-NEXT: DeclRefExpr{{.*}}'i' 'int' | ||
// CHECK-NEXT: CompoundStmt | ||
} | ||
|
||
void Inst() { | ||
TemplUses<int>(); | ||
} | ||
|
||
#endif // PCH_HELPER |
Oops, something went wrong.