mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 13:50:11 +00:00
[OpenACC] Implement copyin/create clause parsing.
Implement two more clauses, copyin and create. These are both pretty simple in that they are just a tag followed by a var-list.
This commit is contained in:
parent
118d4234ac
commit
7b8f7f75a0
@ -208,6 +208,12 @@ enum class OpenACCClauseKind {
|
||||
/// 'copyout' clause, allowed on Compute and Combined constructs, plus 'data',
|
||||
/// 'exit data', and 'declare'.
|
||||
CopyOut,
|
||||
/// 'copyin' clause, allowed on Compute and Combined constructs, plus 'data',
|
||||
/// 'enter data', and 'declare'.
|
||||
CopyIn,
|
||||
/// 'copyin' clause, allowed on Compute and Combined constructs, plus 'data',
|
||||
/// 'enter data', and 'declare'.
|
||||
Create,
|
||||
|
||||
/// Represents an invalid clause, for the purposes of parsing.
|
||||
Invalid,
|
||||
@ -294,6 +300,12 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &Out,
|
||||
case OpenACCClauseKind::CopyOut:
|
||||
return Out << "copyout";
|
||||
|
||||
case OpenACCClauseKind::CopyIn:
|
||||
return Out << "copyin";
|
||||
|
||||
case OpenACCClauseKind::Create:
|
||||
return Out << "create";
|
||||
|
||||
case OpenACCClauseKind::Invalid:
|
||||
return Out << "<invalid>";
|
||||
}
|
||||
|
@ -91,7 +91,9 @@ OpenACCClauseKind getOpenACCClauseKind(Token Tok) {
|
||||
Tok.getIdentifierInfo()->getName())
|
||||
.Case("attach", OpenACCClauseKind::Attach)
|
||||
.Case("auto", OpenACCClauseKind::Auto)
|
||||
.Case("create", OpenACCClauseKind::Create)
|
||||
.Case("copy", OpenACCClauseKind::Copy)
|
||||
.Case("copyin", OpenACCClauseKind::CopyIn)
|
||||
.Case("copyout", OpenACCClauseKind::CopyOut)
|
||||
.Case("default", OpenACCClauseKind::Default)
|
||||
.Case("delete", OpenACCClauseKind::Delete)
|
||||
@ -398,7 +400,9 @@ ClauseParensKind getClauseParensKind(OpenACCClauseKind Kind) {
|
||||
|
||||
case OpenACCClauseKind::Default:
|
||||
case OpenACCClauseKind::If:
|
||||
case OpenACCClauseKind::Create:
|
||||
case OpenACCClauseKind::Copy:
|
||||
case OpenACCClauseKind::CopyIn:
|
||||
case OpenACCClauseKind::CopyOut:
|
||||
case OpenACCClauseKind::UseDevice:
|
||||
case OpenACCClauseKind::NoCreate:
|
||||
@ -559,6 +563,13 @@ bool Parser::ParseOpenACCClauseParams(OpenACCClauseKind Kind) {
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case OpenACCClauseKind::CopyIn:
|
||||
tryParseAndConsumeSpecialTokenKind(
|
||||
*this, OpenACCSpecialTokenKind::ReadOnly, Kind);
|
||||
if (ParseOpenACCClauseVarList(Kind))
|
||||
return true;
|
||||
break;
|
||||
case OpenACCClauseKind::Create:
|
||||
case OpenACCClauseKind::CopyOut:
|
||||
tryParseAndConsumeSpecialTokenKind(*this, OpenACCSpecialTokenKind::Zero,
|
||||
Kind);
|
||||
|
@ -529,6 +529,72 @@ void VarListClauses() {
|
||||
// expected-error@+2{{use of undeclared identifier 'invalid'}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyout(invalid s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{expected ','}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(s.array[s.value] s.array[s.value :5] ), seq
|
||||
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(zero:s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(zero : s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{use of undeclared identifier 'zero'}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(zero s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{invalid tag 'readonly' on 'create' clause}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(readonly:s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{invalid tag 'invalid' on 'create' clause}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(invalid:s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{invalid tag 'invalid' on 'create' clause}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(invalid:s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{use of undeclared identifier 'invalid'}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial create(invalid s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{expected ','}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(s.array[s.value] s.array[s.value :5] ), seq
|
||||
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(readonly:s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(readonly : s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{use of undeclared identifier 'readonly'}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(readonly s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{invalid tag 'zero' on 'copyin' clause}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(zero :s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{invalid tag 'invalid' on 'copyin' clause}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(invalid:s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{invalid tag 'invalid' on 'copyin' clause}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(invalid:s.array[s.value : 5], s.value), seq
|
||||
|
||||
// expected-error@+2{{use of undeclared identifier 'invalid'}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc serial copyin(invalid s.array[s.value : 5], s.value), seq
|
||||
}
|
||||
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
|
Loading…
Reference in New Issue
Block a user