Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
FortyMcFortface
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johannes Mey
FortyMcFortface
Commits
19ce3368
Commit
19ce3368
authored
8 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
simplify OpenMP list to a Variable list
parent
e1869741
No related branches found
No related tags found
No related merge requests found
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Parser/spec/OmpPrinting.jadd
+38
-50
38 additions, 50 deletions
Parser/spec/OmpPrinting.jadd
Parser/spec/OpenMp.rats
+20
-36
20 additions, 36 deletions
Parser/spec/OpenMp.rats
with
58 additions
and
86 deletions
Parser/spec/OmpPrinting.jadd
+
38
−
50
View file @
19ce3368
class PrettyPrint {
// OmpVariableListItem:OmpListItem ::= Variable ;
public void OmpVariableListItem.prettyPrint(PrettyPrinter s) {
getVariable().prettyPrint(s);
}
// OmpArraySectionListItem:OmpListItem ::= ArraySection ;
public void OmpArraySectionListItem.prettyPrint(PrettyPrinter s) {
getArraySection().prettyPrint(s);
}
// OmpNameListItem:OmpListItem ::= Name ;
public void OmpNameListItem.prettyPrint(PrettyPrinter s) {
getName().prettyPrint(s);
}
// =============================================================================
// Directives
// =============================================================================
...
...
@@ -49,12 +37,12 @@ class PrettyPrint {
}
// OMP 2.12.7
// OmpFlushDirective:OmpDirective ::=
OmpListItem
* ;
// OmpFlushDirective:OmpDirective ::=
Variable
* ;
public void OmpFlushDirective.prettyPrint(PrettyPrinter s) {
s.append("!$omp flush");
if (get
OmpListItem
List().numChildren() > 0) {
if (get
Variable
List().numChildren() > 0) {
s.append(" (");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
s.lb();
...
...
@@ -125,10 +113,10 @@ class PrettyPrint {
}
// OMP 2.14.2
// OmpThreadprivateDirective:OmpDirective ::=
OmpListItem
* ;
// OmpThreadprivateDirective:OmpDirective ::=
Variable
* ;
public void OmpThreadprivateDirective.prettyPrint(PrettyPrinter s) {
s.append("!$omp threadprivate(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
s.lb();
}
...
...
@@ -138,12 +126,12 @@ class PrettyPrint {
// DeclarationConstructs
// =============================================================================
//// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment
OmpListItem
* ;
//// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment
Variable
* ;
public void OmpDeclareTargetDirective.prettyPrint(PrettyPrinter s) {
s.append("!$omp declare target");
if (get
OmpListItem
List().numChildren() > 0) {
if (get
Variable
List().numChildren() > 0) {
s.append("(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
s.lb();
...
...
@@ -1006,10 +994,10 @@ class PrettyPrint {
// Clauses
// =============================================================================
// OmpAlignedClause:OmpClause ::=
OmpListItem
* Expr ;
// OmpAlignedClause:OmpClause ::=
Variable
* Expr ;
public void OmpAlignedClause.prettyPrint(PrettyPrinter s) {
s.append("aligned(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
if (hasExpr()) {
s.append(":");
getExpr().prettyPrint(s);
...
...
@@ -1024,17 +1012,17 @@ class PrettyPrint {
s.append(")");
}
// OmpCopyinClause:OmpClause ::=
OmpListItem
* ;
// OmpCopyinClause:OmpClause ::=
Variable
* ;
public void OmpCopyinClause.prettyPrint(PrettyPrinter s) {
s.append("copyin(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
// OmpCopyprivateClause:OmpClause ::=
OmpListItem
* ;
// OmpCopyprivateClause:OmpClause ::=
Variable
* ;
public void OmpCopyprivateClause.prettyPrint(PrettyPrinter s) {
s.append("copyprivate(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
@@ -1068,19 +1056,19 @@ class PrettyPrint {
// OmpDependInClause:OmpDependClause ;
public void OmpDependInClause.prettyPrint(PrettyPrinter s) {
s.append("depend(in: ");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
// OmpDependOutClause:OmpDependClause ;
public void OmpDependOutClause.prettyPrint(PrettyPrinter s) {
s.append("depend(out: ");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
// OmpDependInoutClause:OmpDependClause ;
public void OmpDependInoutClause.prettyPrint(PrettyPrinter s) {
s.append("depend(inout: ");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
@@ -1098,10 +1086,10 @@ class PrettyPrint {
s.append(")");
}
// OmpFirstPrivateClause:OmpClause ::=
OmpListItem
* ;
// OmpFirstPrivateClause:OmpClause ::=
Variable
* ;
public void OmpFirstPrivateClause.prettyPrint(PrettyPrinter s) {
s.append("firstprivate(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
@@ -1112,24 +1100,24 @@ class PrettyPrint {
s.append(")");
}
//// OmpFromClause:OmpClause ::=
OmpListItem
* ;
//// OmpFromClause:OmpClause ::=
Variable
* ;
public void OmpFromClause.prettyPrint(PrettyPrinter s) {
s.append("from(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
// OmpLastPrivateClause:OmpClause ::=
OmpListItem
* ;
// OmpLastPrivateClause:OmpClause ::=
Variable
* ;
public void OmpLastPrivateClause.prettyPrint(PrettyPrinter s) {
s.append("lastprivate(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
//// OmpLinearClause:OmpClause ::=
OmpListItem
* [Expr] ;
//// OmpLinearClause:OmpClause ::=
Variable
* [Expr] ;
public void OmpLinearClause.prettyPrint(PrettyPrinter s) {
s.append("linear(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
if (hasExpr()) {
s.append(":");
getExpr().prettyPrint(s);
...
...
@@ -1140,25 +1128,25 @@ class PrettyPrint {
// OmpMapAllocClause:OmpMapClause ;
public void OmpMapAllocClause.prettyPrint(PrettyPrinter s) {
s.append("map(alloc: ");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
// OmpMapToClause:OmpMapClause ;
public void OmpMapToClause.prettyPrint(PrettyPrinter s) {
s.append("map(to: ");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
// OmpMapFromClause:OmpMapClause ;
public void OmpMapFromClause.prettyPrint(PrettyPrinter s) {
s.append("map(from: ");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
// OmpMapTofromClause:OmpMapClause ;
public void OmpMapTofromClause.prettyPrint(PrettyPrinter s) {
s.append("map(tofrom: ");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
@@ -1167,7 +1155,7 @@ class PrettyPrint {
s.append("mergeable");
}
//// OmpNowaitClause:OmpClause ::=
OmpListItem
* ;
//// OmpNowaitClause:OmpClause ::=
Variable
* ;
public void OmpNowaitClause.prettyPrint(PrettyPrinter s) {
s.append("nowait");
}
...
...
@@ -1191,10 +1179,10 @@ class PrettyPrint {
s.append("ordered");
}
// OmpPrivateClause:OmpClause ::=
OmpListItem
* ;
// OmpPrivateClause:OmpClause ::=
Variable
* ;
public void OmpPrivateClause.prettyPrint(PrettyPrinter s) {
s.append("private(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
@@ -1212,12 +1200,12 @@ class PrettyPrint {
}
// OmpReductionClause:OmpClause ::= OmpReductionIdentifier
OmpListItem
* ;
// OmpReductionClause:OmpClause ::= OmpReductionIdentifier
Variable
* ;
public void OmpReductionClause.prettyPrint(PrettyPrinter s) {
s.append("reduction(");
getOmpReductionIdentifier().prettyPrint(s);
s.append(":");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
@@ -1308,10 +1296,10 @@ class PrettyPrint {
s.append("schedule(runtime)");
}
// OmpSharedClause:OmpClause ::=
OmpListItem
* ;
// OmpSharedClause:OmpClause ::=
Variable
* ;
public void OmpSharedClause.prettyPrint(PrettyPrinter s) {
s.append("shared(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
@@ -1322,10 +1310,10 @@ class PrettyPrint {
s.append(")");
}
//// OmpToClause:OmpClause ::=
OmpListItem
* ;
//// OmpToClause:OmpClause ::=
Variable
* ;
public void OmpToClause.prettyPrint(PrettyPrinter s) {
s.append("to(");
get
OmpListItem
List().prettyPrintJoin(s, ", ");
get
Variable
List().prettyPrintJoin(s, ", ");
s.append(")");
}
...
...
This diff is collapsed.
Click to expand it.
Parser/spec/OpenMp.rats
+
20
−
36
View file @
19ce3368
...
...
@@ -25,26 +25,10 @@ DoConstruct do_construct +=
/ <BEGINNING> ...
;
//// abstract OmpListItem ;
//// // TODO rewrite to support common block names
//// OmpVariableListItem:OmpListItem ::= Variable ;
//// OmpArraySectionListItem:OmpListItem ::= ArraySection ;
//// OmpNameListItem:OmpListItem ::= Name ;
OmpListItem omp_list_item =
a:array_section
List<Variable> omp_list =
v:variable vl:(COMMA yyValue:variable)*
{
yyValue = new OmpArraySectionListItem(a);
}
/ v:variable
{
yyValue = new OmpVariableListItem(v);
}
;
List<OmpListItem> omp_list =
i:omp_list_item il:(COMMA yyValue:omp_list_item)*
{
yyValue = new List().add(i).addAll(il.list());
yyValue = new List().add(v).addAll(vl.list());
}
;
...
...
@@ -108,7 +92,7 @@ OmpTaskwaitDirective omp_taskwait_directive =
;
//// // OMP 2.12.7
//// OmpFlushDirective:OmpDirective ::=
OmpListItem
* ;
//// OmpFlushDirective:OmpDirective ::=
Variable
* ;
OmpFlushDirective omp_flush_directive =
O_P O_FLUSH LPAREN l:omp_list RPAREN lnc:comment
{
...
...
@@ -175,7 +159,7 @@ OmpCancellationPointDirective omp_cancellation_point_directive =
;
//// // OMP 2.14.2
//// OmpThreadprivateDirective:OmpDirective ::=
OmpListItem
* ;
//// OmpThreadprivateDirective:OmpDirective ::=
Variable
* ;
OmpThreadprivateDirective omp_threadprivate_directive =
O_P O_THREADPRIVATE LPAREN l:omp_list RPAREN lnc:comment
{
...
...
@@ -192,7 +176,7 @@ OmpDeclarationConstruct omp_declaration_construct =
omp_declare_target_directive
;
//// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment
OmpListItem
* ;
//// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment
Variable
* ;
OmpDeclareTargetDirective omp_declare_target_directive =
O_P O_DECLARE O_TARGET LPAREN l:omp_list RPAREN lnc:comment
{
...
...
@@ -1408,7 +1392,7 @@ OmpClause omp_clause =
/ omp_untied_clause
;
//// OmpAlignedClause:OmpClause ::=
OmpListItem
* [Expr] ;
//// OmpAlignedClause:OmpClause ::=
Variable
* [Expr] ;
OmpAlignedClause omp_aligned_clause =
O_ALIGNED LPAREN l:omp_list e:(COLON yyValue:expr)? RPAREN
{
...
...
@@ -1425,7 +1409,7 @@ OmpCollapseClause omp_collapse_clause =
}
;
//// OmpCopyinClause:OmpClause ::=
OmpListItem
* ;
//// OmpCopyinClause:OmpClause ::=
Variable
* ;
OmpCopyinClause omp_copyin_clause =
O_COPYIN LPAREN l:omp_list RPAREN
{
...
...
@@ -1433,7 +1417,7 @@ OmpCopyinClause omp_copyin_clause =
}
;
//// OmpCopyprivateClause:OmpClause ::=
OmpListItem
* ;
//// OmpCopyprivateClause:OmpClause ::=
Variable
* ;
OmpCopyprivateClause omp_copyprivate_clause =
O_COPYPRIVATE LPAREN l:omp_list RPAREN
{
...
...
@@ -1465,7 +1449,7 @@ OmpDefaultClause omp_default_clause =
}
;
//// abstract OmpDependClause:OmpClause ::=
OmpListItem
* ;
//// abstract OmpDependClause:OmpClause ::=
Variable
* ;
//// OmpDependInClause:OmpDependClause ;
//// OmpDependOutClause:OmpDependClause ;
//// OmpDependInoutClause:OmpDependClause ;
...
...
@@ -1509,7 +1493,7 @@ OmpFinalClause omp_final_clause =
}
;
//// OmpFirstPrivateClause:OmpClause ::=
OmpListItem
* ;
//// OmpFirstPrivateClause:OmpClause ::=
Variable
* ;
OmpFirstPrivateClause omp_firstprivate_clause =
O_FIRSTPRIVATE LPAREN l:omp_list RPAREN
{
...
...
@@ -1525,7 +1509,7 @@ OmpIfClause omp_if_clause =
}
;
//// OmpFromClause:OmpClause ::=
OmpListItem
* ;
//// OmpFromClause:OmpClause ::=
Variable
* ;
OmpFromClause omp_from_clause =
O_FROM LPAREN l:omp_list RPAREN
{
...
...
@@ -1533,7 +1517,7 @@ OmpFromClause omp_from_clause =
}
;
//// OmpLastPrivateClause:OmpClause ::=
OmpListItem
* ;
//// OmpLastPrivateClause:OmpClause ::=
Variable
* ;
OmpLastPrivateClause omp_lastprivate_clause =
O_LASTPRIVATE LPAREN l:omp_list RPAREN
{
...
...
@@ -1541,7 +1525,7 @@ OmpLastPrivateClause omp_lastprivate_clause =
}
;
//// OmpLinearClause:OmpClause ::=
OmpListItem
* [Expr] ;
//// OmpLinearClause:OmpClause ::=
Variable
* [Expr] ;
OmpLinearClause omp_linear_clause =
O_LINEAR LPAREN l:omp_list e:(COLON yyValue:expr)? RPAREN
{
...
...
@@ -1550,7 +1534,7 @@ OmpLinearClause omp_linear_clause =
}
;
//// abstract OmpMapClause:OmpClause ::=
OmpListItem
* ;
//// abstract OmpMapClause:OmpClause ::=
Variable
* ;
//// OmpMapAllocClause:OmpMapClause ;
//// OmpMapToClause:OmpMapClause ;
//// OmpMapFromClause:OmpMapClause ;
...
...
@@ -1586,7 +1570,7 @@ OmpMergeableClause omp_mergeable_clause =
}
;
//// OmpNowaitClause:OmpClause ::=
OmpListItem
* ;
//// OmpNowaitClause:OmpClause ::=
Variable
* ;
OmpNowaitClause omp_nowait_clause =
O_NOWAIT
{
...
...
@@ -1618,7 +1602,7 @@ OmpOrderedClause omp_ordered_clause =
}
;
//// OmpPrivateClause:OmpClause ::=
OmpListItem
* ;
//// OmpPrivateClause:OmpClause ::=
Variable
* ;
OmpPrivateClause omp_private_clause =
O_PRIVATE LPAREN l:omp_list RPAREN
{
...
...
@@ -1645,7 +1629,7 @@ OmpProcBindClause omp_proc_bind_clause =
}
;
//// OmpReductionClause:OmpClause ::= OmpReductionIdentifier
OmpListItem
* ;
//// OmpReductionClause:OmpClause ::= OmpReductionIdentifier
Variable
* ;
OmpReductionClause omp_reduction_clause =
O_REDUCTION LPAREN i:omp_reduction_identifier COLON l:omp_list RPAREN
{
...
...
@@ -1760,7 +1744,7 @@ OmpScheduleClause omp_schedule_clause =
;
//// OmpSharedClause:OmpClause ::=
OmpListItem
* ;
//// OmpSharedClause:OmpClause ::=
Variable
* ;
OmpSharedClause omp_shared_clause =
O_SHARED LPAREN l:omp_list RPAREN
{
...
...
@@ -1776,7 +1760,7 @@ OmpThreadLimitClause omp_thread_limit_clause =
}
;
//// OmpToClause:OmpClause ::=
OmpListItem
* ;
//// OmpToClause:OmpClause ::=
Variable
* ;
OmpToClause omp_to_clause =
O_TO LPAREN l:omp_list RPAREN
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment