[flang-commits] [PATCH] D150159: [flang] CUDA Fortran - part 1/5: parsing

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon May 8 16:59:25 PDT 2023


klausler created this revision.
klausler added reviewers: razvanlupusoru, clementval, wangzpgi, kiranchandramohan.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, mattd, mehdi_amini, jdoerfert, yaxunl.
Herald added a reviewer: sscalpone.
Herald added a reviewer: awarzynski.
Herald added a project: All.
klausler requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: jplehr, sstefan1.

Begin upstreaming of CUDA Fortran support in LLVM Flang.

This first patch implements parsing for CUDA Fortran syntax,
including:

- a new LanguageFeature enum value for CUDA Fortran
- driver change to enable that feature for *.cuf and *.CUF source files
- parse tree representation of CUDA Fortran syntax
- dumping and unparsing of the parse tree
- the actual parsers for CUDA Fortran syntax
- prescanning support for !@CUF and !$CUF
- basic sanity testing via unparsing and parse tree dumps

... along with any minimized changes elsewhere to make these
work, mostly no-op cases in common::visitors instances in
semantics and lowering to allow them to compile in the face
of new types in variant<> instances in the parse tree.

Because CUDA Fortran allows the kernel launch chevron syntax
("call foo<<<blocks, threads>>>()") only on CALL statements and
not on function references, the parse tree nodes for CallStmt,
FunctionReference, and their shared Call were rearranged a bit;
this caused a fair amount of one-line changes in many files.

More patches will follow that implement CUDA Fortran in the symbol
table and name resolution, and then semantic checking.


https://reviews.llvm.org/D150159

Files:
  flang/docs/ParserCombinators.md
  flang/include/flang/Common/Fortran-features.h
  flang/include/flang/Common/Fortran.h
  flang/include/flang/Common/indirection.h
  flang/include/flang/Common/template.h
  flang/include/flang/Frontend/FrontendOptions.h
  flang/include/flang/Parser/dump-parse-tree.h
  flang/include/flang/Parser/message.h
  flang/include/flang/Parser/parse-tree-visitor.h
  flang/include/flang/Parser/parse-tree.h
  flang/lib/Common/Fortran.cpp
  flang/lib/Frontend/FrontendAction.cpp
  flang/lib/Frontend/FrontendOptions.cpp
  flang/lib/Lower/Allocatable.cpp
  flang/lib/Lower/Bridge.cpp
  flang/lib/Lower/PFTBuilder.cpp
  flang/lib/Parser/Fortran-parsers.cpp
  flang/lib/Parser/basic-parsers.h
  flang/lib/Parser/executable-parsers.cpp
  flang/lib/Parser/io-parsers.cpp
  flang/lib/Parser/misc-parsers.h
  flang/lib/Parser/parse-tree.cpp
  flang/lib/Parser/parsing.cpp
  flang/lib/Parser/preprocessor.cpp
  flang/lib/Parser/prescan.cpp
  flang/lib/Parser/program-parsers.cpp
  flang/lib/Parser/stmt-parser.h
  flang/lib/Parser/unparse.cpp
  flang/lib/Semantics/check-allocate.cpp
  flang/lib/Semantics/check-do-forall.cpp
  flang/lib/Semantics/expression.cpp
  flang/lib/Semantics/resolve-names.cpp
  flang/lib/Semantics/tools.cpp
  flang/test/Parser/cuf-sanity-common
  flang/test/Parser/cuf-sanity-tree.CUF
  flang/test/Parser/cuf-sanity-unparse.CUF
  flang/test/lib/lit.local.cfg
  flang/test/lit.cfg.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150159.520521.patch
Type: text/x-patch
Size: 73862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230508/4784dd12/attachment-0001.bin>


More information about the flang-commits mailing list