|
12 | 12 |
|
13 | 13 | #include "flang/Lower/OpenMP.h"
|
14 | 14 | #include "flang/Lower/Bridge.h"
|
| 15 | +#include "flang/Lower/FIRBuilder.h" |
15 | 16 | #include "flang/Lower/PFTBuilder.h"
|
16 | 17 | #include "flang/Parser/parse-tree.h"
|
| 18 | +#include "mlir/Dialect/OpenMP/OpenMPDialect.h" |
17 | 19 |
|
18 | 20 | #define TODO() llvm_unreachable("not yet implemented")
|
19 | 21 |
|
| 22 | +void Fortran::lower::genOMP( |
| 23 | + Fortran::lower::AbstractConverter &absConv, |
| 24 | + Fortran::lower::pft::Evaluation &eval, |
| 25 | + const Fortran::parser::OpenMPSimpleStandaloneConstruct |
| 26 | + &simpleStandaloneConstruct) { |
| 27 | + const auto &directive = |
| 28 | + std::get<Fortran::parser::OmpSimpleStandaloneDirective>( |
| 29 | + simpleStandaloneConstruct.t); |
| 30 | + switch (directive.v) { |
| 31 | + |
| 32 | + case parser::OmpSimpleStandaloneDirective::Directive::Barrier: |
| 33 | + absConv.getFirOpBuilder().create<mlir::omp::BarrierOp>( |
| 34 | + absConv.getCurrentLocation()); |
| 35 | + break; |
| 36 | + case parser::OmpSimpleStandaloneDirective::Directive::Taskwait: |
| 37 | + TODO(); |
| 38 | + case parser::OmpSimpleStandaloneDirective::Directive::Taskyield: |
| 39 | + TODO(); |
| 40 | + case parser::OmpSimpleStandaloneDirective::Directive::TargetEnterData: |
| 41 | + TODO(); |
| 42 | + case parser::OmpSimpleStandaloneDirective::Directive::TargetExitData: |
| 43 | + TODO(); |
| 44 | + case parser::OmpSimpleStandaloneDirective::Directive::TargetUpdate: |
| 45 | + TODO(); |
| 46 | + case parser::OmpSimpleStandaloneDirective::Directive::Ordered: |
| 47 | + TODO(); |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +void Fortran::lower::genOMP( |
| 52 | + Fortran::lower::AbstractConverter &absConv, |
| 53 | + Fortran::lower::pft::Evaluation &eval, |
| 54 | + const Fortran::parser::OpenMPStandaloneConstruct &standaloneConstruct) { |
| 55 | + std::visit( |
| 56 | + common::visitors{ |
| 57 | + [&](const Fortran::parser::OpenMPSimpleStandaloneConstruct |
| 58 | + &simpleStandaloneConstruct) { |
| 59 | + genOMP(absConv, eval, simpleStandaloneConstruct); |
| 60 | + }, |
| 61 | + [&](const Fortran::parser::OpenMPFlushConstruct &flushConstruct) { |
| 62 | + TODO(); |
| 63 | + }, |
| 64 | + [&](const Fortran::parser::OpenMPCancelConstruct &cancelConstruct) { |
| 65 | + TODO(); |
| 66 | + }, |
| 67 | + [&](const Fortran::parser::OpenMPCancellationPointConstruct |
| 68 | + &cancellationPointConstruct) { TODO(); }, |
| 69 | + }, |
| 70 | + standaloneConstruct.u); |
| 71 | +} |
| 72 | + |
20 | 73 | void Fortran::lower::genOpenMPConstruct(
|
21 |
| - Fortran::lower::AbstractConverter &, Fortran::lower::pft::Evaluation &, |
22 |
| - const Fortran::parser::OpenMPConstruct &) { |
23 |
| - TODO(); |
| 74 | + Fortran::lower::AbstractConverter &absConv, |
| 75 | + Fortran::lower::pft::Evaluation &eval, |
| 76 | + const Fortran::parser::OpenMPConstruct &ompConstruct) { |
| 77 | + |
| 78 | + std::visit( |
| 79 | + common::visitors{ |
| 80 | + [&](const Fortran::parser::OpenMPStandaloneConstruct |
| 81 | + &standaloneConstruct) { |
| 82 | + genOMP(absConv, eval, standaloneConstruct); |
| 83 | + }, |
| 84 | + [&](const Fortran::parser::OpenMPSectionsConstruct |
| 85 | + §ionsConstruct) { TODO(); }, |
| 86 | + [&](const Fortran::parser::OpenMPLoopConstruct &loopConstruct) { |
| 87 | + TODO(); |
| 88 | + }, |
| 89 | + [&](const Fortran::parser::OpenMPBlockConstruct &blockConstruct) { |
| 90 | + TODO(); |
| 91 | + }, |
| 92 | + [&](const Fortran::parser::OpenMPAtomicConstruct &atomicConstruct) { |
| 93 | + TODO(); |
| 94 | + }, |
| 95 | + [&](const Fortran::parser::OpenMPCriticalConstruct |
| 96 | + &criticalConstruct) { TODO(); }, |
| 97 | + }, |
| 98 | + ompConstruct.u); |
24 | 99 | }
|
25 | 100 |
|
26 | 101 | void Fortran::lower::genOpenMPEndLoop(
|
|
0 commit comments