SShraiysh VaishayRevert "[flang][OpenMP] Lowering support for default clause"
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[flang] Save binding labels as strings Binding labels start as expressions but they have to evaluate to constant character of default kind, so they can be represented as an std::string. Leading and trailing blanks have to be removed, so the folded expression isn't exactly right anyway. So all BIND(C) symbols now have a string binding label, either the default or user-supplied one. This is recorded in the .mod file. Add WithBindName mix-in for details classes that can have a binding label so that they are all consistent. Add GetBindName() and SetBindName() member functions to Symbol. Add tests that verifies that leading and trailing blanks are ignored in binding labels and that the default label is folded to lower case. Differential Revision: https://reviews.llvm.org/D99208 | 5 年前 | |
[flang] Add one semantic check for masked array assignment As Fortran 2018 states, in each where-assignment-stmt, the mask-expr and the variable being defined shall be arrays of the same shape. The previous check does not consider checking if it is an array. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D125022 | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Add clang-tidy check for braces around if Flang diverges from the llvm coding style in that it requires braces around the bodies of if/while/etc statements, even when the body is a single statement. This commit adds the readability-braces-around-statements check to flang's clang-tidy config file. Hopefully the premerge bots will pick it up and report violations in Phabricator. We also explicitly disable the check in the directories corresponding to the Lower and Optimizer libraries, which rely heavily on mlir and llvm and therefore follow their coding style. Likewise for the tools directory. We also fix any outstanding violations in the runtime and in lib/Semantics. Differential Revision: https://reviews.llvm.org/D104100 | 4 年前 | |
[flang][openacc] Semantic checks for OpenACC 3.0 clauses validity Summary: This patch adds semantic checking for the OpenACC 3.0 clauses validity. Reviewers: sscalpone, tskeith, klausler, ichoyjx, DavidTruby, jdoerfert Reviewed By: tskeith, klausler Subscribers: mgorny, llvm-commits Tags: #llvm, #flang Differential Revision: https://reviews.llvm.org/D83807 | 5 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang][openacc][NFC] Make self clause value optional in ACC.td and extract the parser Set the isOptional flag for the self clause. Move the optional and parenthesis part of the parser. Update the rest of the code to deal with the optional value. Preparatory work for D106968. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D106965 | 3 年前 | |
[flang][directive] Enforce basic semantic check for all clauses This patch is a follow up to D94821 to ensure the correct behavior of the general directive structure checker. This patch add the generation of the Enter function declaration for clauses in the TableGen backend. This helps to ensure each clauses declared in the TableGen file has at least a basic check. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D95108 | 5 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Finer control over error recovery with GetExpr() Prior to this patch, the semantics utility GetExpr() will crash unconditionally if it encounters a typed expression in the parse tree that has not been set by expression semantics. This is the right behavior when called from lowering, by which time it is known that the program had no fatal user errors, since it signifies a fatal internal error. However, prior to lowering, in the statement semantics checking code, a more nuanced test should be used before crashing -- specifically, we should not crash in the face of a missing typed expression when in error recovery mode. Getting this right requires GetExpr() and its helper class to have access to the semantics context, so that it can check AnyFatalErrors() before crashing. So this patch touches nearly all of its call sites. Differential Revision: https://reviews.llvm.org/D123873 | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Allow restricted specific intrinsic functions as implicitly-interfaced procedure pointer targets The predicate "CanBeCalledViaImplicitInterface()" was returning false for restricted specific intrinsic functions (e.g., SIN) because their procedure characteristics have the elemental attribute; this leads to a bogus semantic error when one attempts to use them as proc-targets in procedure pointer assignment statements when the left-hand side of the assignment is a procedure pointer with an implicit interface. However, these restricted specific intrinsic functions have always been allowed as special cases for such usage -- it is as if they are elemental when it is necessary for them to be so, but not when it's a problem. Differential Revision: https://reviews.llvm.org/D130386 | 3 年前 | |
[flang] Extension: Accept Hollerith actual arguments as if they were BOZ When a Hollerith (or short character) literal is presented as an actual argument that corresponds to a dummy argument for which a BOZ literal would be acceptable, treat the Hollerith as if it had been a BOZ literal in the same way -- and with the same code -- as f18 already does for the similar extension in DATA statements. Differential Revision: https://reviews.llvm.org/D126144 | 4 年前 | |
[flang] Downgrade a fatal error to a warning A non-CHARACTER expression in a CASE statement is allowed to have a distinct kind (not type) from the expression in its SELECT CASE. If a value in a CASE statement is out of range for the SELECT CASE type, emit a warning, but it should not be a fatal error. Differential Revision: https://reviews.llvm.org/D124544 | 4 年前 | |
[flang] Semantics for SELECT CASE Prep for review Respond to review comments Fix first line in new test Original-commit: flang-compiler/f18@12f6f30600db4cb3902677cd42764450ddeda5e0 Reviewed-on: https://github.com/flang-compiler/f18/pull/1089 | 6 年前 | |
[flang] Finer control over error recovery with GetExpr() Prior to this patch, the semantics utility GetExpr() will crash unconditionally if it encounters a typed expression in the parse tree that has not been set by expression semantics. This is the right behavior when called from lowering, by which time it is known that the program had no fatal user errors, since it signifies a fatal internal error. However, prior to lowering, in the statement semantics checking code, a more nuanced test should be used before crashing -- specifically, we should not crash in the face of a missing typed expression when in error recovery mode. Getting this right requires GetExpr() and its helper class to have access to the semantics context, so that it can check AnyFatalErrors() before crashing. So this patch touches nearly all of its call sites. Differential Revision: https://reviews.llvm.org/D123873 | 4 年前 | |
[flang] Support for image selectors Summary: This change implements support for image selectors and image selector specifications as described in section 9.6. In check-coarray[.h,cpp] I changed the Leave() function for parser::ImageSelectorSpec to take a parser::ImageSelector, which contains a list of image selector specifications. This allows us to detect when the same specification is used more than once. I also added code to analyze the expressions for the image selector specifications to expression.cpp and a test for all of the conditions to check at compile-time. Note that we do not check at compile-time to see if the value of the cosubscripts are within the specified cobounds. We also do not check anything related to selecting a valid team. We also do not check that the denotation of the stat-variable is not dependent on the evaluation of an entity in the same statement. Reviewers: klausler, tskeith, DavidTruby Subscribers: llvm-commits Tags: #llvm, #flang Differential Revision: https://reviews.llvm.org/D83336 | 5 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang] Implement semantics for DEC STRUCTURE/RECORD Implements part of the legacy "DEC structures" feature from VMS Fortran. STRUCTUREs are processed as if they were derived types with SEQUENCE. DATA-like object entity initialization is supported as well (e.g., INTEGER FOO/666/) since it was used for default component initialization in structures. Anonymous components (named %FILL) are also supported. These features, and UNION/MAP, were already being parsed. An omission in the collection of structure field names in the case of nested structures with entity declarations was fixed in the parser. Structures are supported in modules, but this is mostly for testing purposes. The names of fields in structures accessed via USE association cannot appear with dot notation in client code (at least not yet). DEC structures antedate Fortran 90, so their actual use in applications should not involve modules. This patch does not implement UNION/MAP, since that feature would impose difficulties later in lowering them to MLIR types. In the meantime, if they appear, semantics will issue a "not yet implemented" error message. Differential Revision: https://reviews.llvm.org/D117151 | 4 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Add IsElementalProcedure() predicate Replace most tests of the explicit Attr::ELEMENTAL symbol flag with a new predicate IsElementalProcedure() that works correctly for alternate ENTRY points and does the right thing for procedure interfaces that reference elemental intrinsic functions like SIN() whose elemental nature does not propagate. Differential Revision: https://reviews.llvm.org/D129022 | 3 年前 | |
[flang] Improve initializer semantics, esp. for component default values This patch plugs many holes in static initializer semantics, improves error messages for default initial values and other component properties in parameterized derived type instantiations, and cleans up several small issues noticed during development. We now do proper scalar expansion, folding, and type, rank, and shape conformance checking for component default initializers in derived types and PDT instantiations. The initial values of named constants are now guaranteed to have been folded when installed in the symbol table, and are no longer folded or scalar-expanded at each use in expression folding. Semantics documentation was extended with information about the various kinds of initializations in Fortran and when each of them are processed in the compiler. Some necessary concomitant changes have bulked this patch out a bit: * contextual messages attachments, which are now produced for parameterized derived type instantiations so that the user can figure out which instance caused a problem with a component, have been added as part of ContextualMessages, and their implementation was debugged * several APIs in evaluate::characteristics was changed so that a FoldingContext is passed as an argument rather than just its intrinsic procedure table; this affected client call sites in many files * new tools in Evaluate/check-expression.cpp to determine when an Expr actually is a single constant value and to validate a non-pointer variable initializer or object component default value * shape conformance checking has additional arguments that control whether scalar expansion is allowed * several now-unused functions and data members noticed and removed * several crashes and bogus errors exposed by testing this new code were fixed * a -fdebug-stack-trace option to enable LLVM's stack tracing on a crash, which might be useful in the future TL;DR: Initialization processing does more and takes place at the right times for all of the various kinds of things that can be initialized. Differential Review: https://reviews.llvm.org/D92783 | 5 年前 | |
Remove redundant return statements (NFC) Identified with readability-redundant-control-flow. | 3 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang] Fix crash on erroneous expressions Summary: If you create an expression with parse errors, the parser::Expr.typedExpr will be empty, which causes a compiler crash. The crash is caused by the check in check-do-forall.cpp that scans all expresssions to see if DO variables are being modified. It turned out that the problem was that I was fetching subexpressions of type parser::Expr, which are not guaranteed to have a non-null typedExpr. I fixed this by only grabbing the top-level expression from which to gather arguments as part of the DO loop analysis. This, in turn, exposed a problem where I wasn't collecting all of the actual arguments in an expression. This was caused by the fact that I wasn't recursing through the rest of the expression after finding an argument. I fixed this by recursing through the argument in the member function in CollectActualArgumentsHelper. Reviewers: klausler, tskeith, DavidTruby Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81101 | 5 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Admit trailing blanks when checking I/O specifiers Fortran specifically allows character-valued I/O specifiers to have trailing blanks, e.g. OPEN(666,STATUS='SCRATCH '). The runtime I/O library already handles them, but the I/O static checks in semantics do not. Differential Revision: https://reviews.llvm.org/D130381 | 3 年前 | |
[flang] Finer control over error recovery with GetExpr() Prior to this patch, the semantics utility GetExpr() will crash unconditionally if it encounters a typed expression in the parse tree that has not been set by expression semantics. This is the right behavior when called from lowering, by which time it is known that the program had no fatal user errors, since it signifies a fatal internal error. However, prior to lowering, in the statement semantics checking code, a more nuanced test should be used before crashing -- specifically, we should not crash in the face of a missing typed expression when in error recovery mode. Getting this right requires GetExpr() and its helper class to have access to the semantics context, so that it can check AnyFatalErrors() before crashing. So this patch touches nearly all of its call sites. Differential Revision: https://reviews.llvm.org/D123873 | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Accept POINTER followed by INTERFACE As is already supported for dummy procedures, we need to also accept declarations of procedure pointers that consist of a POINTER attribute statement followed by an INTERFACE block. (The case of an INTERFACE block followed by a POINTER statement already works.) While cleaning this case up, adjust the utility predicate IsProcedurePointer() to recognize it (namely a SubprogramDetails symbol with Attr::POINTER) and delete IsProcName(). Extend tests, and add better comments to symbol.h to document the two ways in which procedure pointers are represented. Differential Revision: https://reviews.llvm.org/D125139 | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang][OpenMP] Added semantic checks for hint clause This patch improves semantic checks for hint clause. It checks "hint-expression is a constant expression that evaluates to a scalar value with kind omp_sync_hint_kind and a value that is a valid synchronization hint." Reviewed By: peixin Differential Revision: https://reviews.llvm.org/D127615 | 3 年前 | |
[flang][OpenMP] Added semantic checks for hint clause This patch improves semantic checks for hint clause. It checks "hint-expression is a constant expression that evaluates to a scalar value with kind omp_sync_hint_kind and a value that is a valid synchronization hint." Reviewed By: peixin Differential Revision: https://reviews.llvm.org/D127615 | 3 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Fix semantics check for RETURN statement The RETURN statement is allowed in functions and subroutines, but not in main programs. It is however a common extension, which we also implement, to allow RETURN from main programs -- we only issue a portability warning when -pedantic or -std=f2018 are set. This patch fixes false positives for this portability warning, where it was triggered also when RETURN was present in functions or subroutines. Fixexs #55080 Reviewed By: PeteSteinfeld Differential Revision: https://reviews.llvm.org/D124732 | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang]Semantics for SELECT RANK. Summary: Initially on github I worked on semantic checks.Then I tried some compile-time test of the rank value, they were failing as there were no symbols generated for them inside SELECT RANK's scope.So I went further to add new symbol in each scope, also added the respective 'rank: ' field for a symbol when we dump the symboltable. I added a field to keep track of the rank in AssocEntityDetails class.This caused shape analysis framework to become inconsistent. So shape analysis framework was updated to handle this new representation. * I added more tests for above changes. * On phabricator I addressed some minor changes. * Lastly I worked on review comments. Reviewers: klausler,sscalpone,DavidTruby,kiranchandramohan,tskeith,anchu-rajendran,kiranktp Reviewed By:klausler, DavidTruby, tskeith Subscribers:#flang-commits, #llvm-commits Tags: #flang, #llvm Differential Revision: https://reviews.llvm.org/D78623 | 6 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang] Semantics for SELECT TYPE Summary: Added support for all semantic checks except C1157 was previously implemented. Address review comments. Reviewers: PeteSteinfeld, tskeith, klausler, DavidTruby, kiranktp, anchu-rajendran, sscalpone Subscribers: kiranchandramohan, llvm-commits, flang-commits Tags: #llvm, #flang Differential Revision: https://reviews.llvm.org/D79851 | 5 年前 | |
[flang] Finer control over error recovery with GetExpr() Prior to this patch, the semantics utility GetExpr() will crash unconditionally if it encounters a typed expression in the parse tree that has not been set by expression semantics. This is the right behavior when called from lowering, by which time it is known that the program had no fatal user errors, since it signifies a fatal internal error. However, prior to lowering, in the statement semantics checking code, a more nuanced test should be used before crashing -- specifically, we should not crash in the face of a missing typed expression when in error recovery mode. Getting this right requires GetExpr() and its helper class to have access to the semantics context, so that it can check AnyFatalErrors() before crashing. So this patch touches nearly all of its call sites. Differential Revision: https://reviews.llvm.org/D123873 | 4 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Establish a single source of target information for semantics Create a TargetCharacteristics class to centralize the few items of target specific information that are relevant to semantics. Use the new class for all target queries, including derived type component layout modeling. Future work will initialize this class with target information provided or forwarded by the drivers, and use it to fold layout-dependent intrinsic functions like TRANSFER(). Differential Revision: https://reviews.llvm.org/D129018 Updates: Attempts to work around build issues on Windows. | 3 年前 | |
[flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZEOF() STORAGE_SIZE() is a standard inquiry intrinsic (size in bits of an array element of the same type as the argument); SIZEOF() is a common extension that returns the size in bytes of its argument; C_SIZEOF() is a renaming of SIZEOF() in module ISO_C_BINDING. STORAGE_SIZE() and SIZEOF() are implemented via rewrites to expressions; these expressions will be constant when the necessary type parameters and bounds are also constant. Code to calculate the sizes of types (with and without alignment) was isolated into Evaluate/type.* and /characteristics.*. Code in Semantics/compute-offsets.* to calculate sizes and alignments of derived types' scopes was exposed so that it can be called at type instantiation time (earlier than before) so that these inquiry intrinsics could be called from specification expressions. Differential Revision: https://reviews.llvm.org/D93322 | 5 年前 | |
[flang] Correct IsHostAssociated() to be true for BLOCK constructs The predicate IsHostAssocited() was implemented in a way that would return true only for cases of host association into a module or inner subprogram. Technically, the use of a name in a BLOCK construct that is not declared therein is considered in the Fortran standard to also be a form of host association, and this matters when doing error checking on DATA statements. Differential Revision: https://reviews.llvm.org/D130388 | 3 年前 | |
[flang] Implement semantics for DEC STRUCTURE/RECORD Implements part of the legacy "DEC structures" feature from VMS Fortran. STRUCTUREs are processed as if they were derived types with SEQUENCE. DATA-like object entity initialization is supported as well (e.g., INTEGER FOO/666/) since it was used for default component initialization in structures. Anonymous components (named %FILL) are also supported. These features, and UNION/MAP, were already being parsed. An omission in the collection of structure field names in the case of nested structures with entity declarations was fixed in the parser. Structures are supported in modules, but this is mostly for testing purposes. The names of fields in structures accessed via USE association cannot appear with dot notation in client code (at least not yet). DEC structures antedate Fortran 90, so their actual use in applications should not involve modules. This patch does not implement UNION/MAP, since that feature would impose difficulties later in lowering them to MLIR types. In the meantime, if they appear, semantics will issue a "not yet implemented" error message. Differential Revision: https://reviews.llvm.org/D117151 | 4 年前 | |
[flang] Fix a warning This patch fixes: llvm-project/flang/lib/Semantics/expression.cpp:405:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] | 3 年前 | |
[flang] Handle module subprogram with interface in same (sub)module when writing module file There's a few (3) cases where Fortran allows two distinct symbols to have the same name in the same scope. Module file output copes with only two of them. The third involves a separate module procedure that isn't separate: both the procedure and its declared interface appear in the same (sub)module. Fix to ensure that the interface is included in the module file output, so that the module file reader doesn't suffer a bogus error about a "separate module procedure without an interface". Differential Revision: https://reviews.llvm.org/D127784 | 3 年前 | |
[flang] Distinguish intrinsic from non-intrinsic modules For "USE, INTRINSIC", search only for intrinsic modules; for "USE, NON_INTRINSIC", do not recognize intrinsic modules. Allow modules of both kinds with the same name to be used in the same source file (but not in the same scoping unit, a constraint of the standard that is now enforced). The symbol table's scope tree now has a single instance of a scope with a new kind, IntrinsicModules, whose children are the USE'd intrinsic modules (explicit or not). This separate "top-level" scope is a child of the single global scope and it allows both intrinsic and non-intrinsic modules of the same name to exist in the symbol table. Intrinsic modules' scopes' symbols now have the INTRINSIC attribute set. The search path directories need to make a distinction between regular directories and the one(s) that point(s) to intrinsic modules. I allow for multiple intrinsic module directories in the second search path, although only one is needed today. Differential Revision: https://reviews.llvm.org/D118631 | 4 年前 | |
[flang] Allow restricted specific intrinsic functions as implicitly-interfaced procedure pointer targets The predicate "CanBeCalledViaImplicitInterface()" was returning false for restricted specific intrinsic functions (e.g., SIN) because their procedure characteristics have the elemental attribute; this leads to a bogus semantic error when one attempts to use them as proc-targets in procedure pointer assignment statements when the left-hand side of the assignment is a procedure pointer with an implicit interface. However, these restricted specific intrinsic functions have always been allowed as special cases for such usage -- it is as if they are elemental when it is necessary for them to be so, but not when it's a problem. Differential Revision: https://reviews.llvm.org/D130386 | 3 年前 | |
[flang] DATA stmt processing (part 3/4): Remaining prep work Rolls up small changes across the frontend to prepare for the large forthcoming patch (part 4/4) that completes DATA statement processing via conversion to initializers. Reviewed By: PeteSteinfeld Differential Revision: https://reviews.llvm.org/D82137 | 5 年前 | |
[flang] Avoid global name conflict when BIND(C,NAME=) is used At the top level of program units in a source file, two subprograms are allowed to have the same name if at least one of them has a distinct interoperable binding name. F18's symbol table requires (most) symbols in a scope to have distinct names, though. Solve by using compiler-created names for the symbols of global scope subprograms that have interoperable binding names. Differential Revision: https://reviews.llvm.org/D124295 | 4 年前 | |
[flang] Avoid global name conflict when BIND(C,NAME=) is used At the top level of program units in a source file, two subprograms are allowed to have the same name if at least one of them has a distinct interoperable binding name. F18's symbol table requires (most) symbols in a scope to have distinct names, though. Solve by using compiler-created names for the symbols of global scope subprograms that have interoperable binding names. Differential Revision: https://reviews.llvm.org/D124295 | 4 年前 | |
Revert "[flang][OpenMP] Lowering support for default clause" This reverts commit 05e6fce84fd39d150195b8928561f2c90c71e538. | 3 年前 | |
[flang][NFC] Extract name resolution for OpenACC & OpenMP into new file Move ResolveAccParts and ResolveOmpParts from resolve-names.cpp to resolve-directives.{h,cpp}. Move the implementation in the classes DirectiveAttributeVisitor, AccAttributeVisitor, and OmpAttributeVisitor to resolve-directives.cpp as well. To allow this to happen, move EvaluateIntExpr and introduce EvaluateInt64 to resolve-names-utils.h. The latter is also useful elsewhere in resolve-names.cpp for converting an Expr to std::int64_t. The other problem was that ResolveDesignator was called from the code that was moved. At the moment it doesn't seem to be doing anything so I removed the calls (and no tests failed). If it proves to be needed, we can either resolve those designators in resolve-names.cpp or pass the ResolveDesignator function in to the code that needs to call it. Differential Revision: https://reviews.llvm.org/D84768 | 5 年前 | |
[flang] Fix bogus branch target error on END SELECT The scope model used for branch target checking treats a label on an END SELECT statement as if it were in the previous CASE block. This makes it illegal to GO TO that label from within any earlier CASE block in that statement. Fix by treating the CASE blocks as nested scopes within the scope of the SELECT construct. Also, add a "warning:" tag to related warning messages. Differential Revision: https://reviews.llvm.org/D127425 | 3 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Add & use a better visit() (take 2) Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit(). Modifies most use sites in the front-end and runtime to use common::visit(). The C++ standard mandates that std::visit() have O(1) execution time, which forces implementations to build dispatch tables. This new common::visit() is O(log2 N) in the number of alternatives in a variant<>, but that N tends to be small and so this change produces a fairly significant improvement in compiler build memory requirements, a 5-10% improvement in compiler build time, and a small improvement in compiler execution time. Building with -DFLANG_USE_STD_VISIT causes common::visit() to be an alias for std::visit(). Calls to common::visit() with multiple variant arguments are referred to std::visit(), pending further work. This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit(). | 4 年前 | |
[flang] Add nonfatal message classes F18 presently has fatal and non-fatal diagnostic messages. We'd like to make non-fatal warnings stand out better in the output of the compiler. This will turn out to be a large change that affects many files. This patch is just the first part. It converts a Boolean isFatal_ data member of the message classes into a severity code, and defines four of these codes (Error, Warning, Portability, and a catch-all Other). Later patches will result from sweeping over the parser and semantics, changing most non-fatal diagnostic messages into warnings and portability notes. Differential Revision: https://reviews.llvm.org/D121228 | 4 年前 | |
[flang] Correct IsHostAssociated() to be true for BLOCK constructs The predicate IsHostAssocited() was implemented in a way that would return true only for cases of host association into a module or inner subprogram. Technically, the use of a name in a BLOCK construct that is not declared therein is considered in the Fortran standard to also be a form of host association, and this matters when doing error checking on DATA statements. Differential Revision: https://reviews.llvm.org/D130388 | 3 年前 | |
[flang] Distinguish intrinsic from non-intrinsic modules For "USE, INTRINSIC", search only for intrinsic modules; for "USE, NON_INTRINSIC", do not recognize intrinsic modules. Allow modules of both kinds with the same name to be used in the same source file (but not in the same scoping unit, a constraint of the standard that is now enforced). The symbol table's scope tree now has a single instance of a scope with a new kind, IntrinsicModules, whose children are the USE'd intrinsic modules (explicit or not). This separate "top-level" scope is a child of the single global scope and it allows both intrinsic and non-intrinsic modules of the same name to exist in the symbol table. Intrinsic modules' scopes' symbols now have the INTRINSIC attribute set. The search path directories need to make a distinction between regular directories and the one(s) that point(s) to intrinsic modules. I allow for multiple intrinsic module directories in the second search path, although only one is needed today. Differential Revision: https://reviews.llvm.org/D118631 | 4 年前 | |
[flang] Handle USE association in parse tree rewriting f18 was treating "f() = 1" as a statement function definition if it could be viewed as being in the specification part and "f" was a USE-associated function returning a data pointer. (The non-USE-associated case is fine.) Fix to allow for "f" to be USE associated. Differential Revision: https://reviews.llvm.org/D127430 | 3 年前 | |
[flang] Reformat with latest clang-format and .clang-format Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094 | 6 年前 | |
[flang] Replace crash and improve a semantics TODO message The derived type information table construction code had a crash whose root cause was replacing an expression with one of its operands -- the deletion of the LHS of that assignment led to the RHS being invalidated before it could be read. Fix by cloning the RHS. Also update a TODO message to the new "_todo_en_US" message class and add a comment about how it should be resolved. Differential Revision: https://reviews.llvm.org/D126154 | 4 年前 | |
[flang] Do not pass derived type by descriptor when not needed A missing "!" in the call interface lowering caused all derived type arguments without length parameters that require and explicit interface to be passed via fir.box (runtime descriptor). This was not the intent: there is no point passing a simple derived type scalars or explicit shapes by descriptor just because they have an attribute like TARGET. This would actually be problematic with existing code that is not always 100% compliant: some code implicitly calls procedures with TARGET dummy attributes (this is not something a compiler can enforce if the call and procedure definition are not in the same file). Add a Scope::IsDerivedTypeWithLengthParameter to avoid passing derived types with only kind parameters by descriptor. There is no point, the callee knows about the kind parameter values. Differential Revision: https://reviews.llvm.org/D123990 | 4 年前 | |
[flang] Establish a single source of target information for semantics Create a TargetCharacteristics class to centralize the few items of target specific information that are relevant to semantics. Use the new class for all target queries, including derived type component layout modeling. Future work will initialize this class with target information provided or forwarded by the drivers, and use it to fold layout-dependent intrinsic functions like TRANSFER(). Differential Revision: https://reviews.llvm.org/D129018 Updates: Attempts to work around build issues on Windows. | 3 年前 | |
[flang] Add IsElementalProcedure() predicate Replace most tests of the explicit Attr::ELEMENTAL symbol flag with a new predicate IsElementalProcedure() that works correctly for alternate ENTRY points and does the right thing for procedure interfaces that reference elemental intrinsic functions like SIN() whose elemental nature does not propagate. Differential Revision: https://reviews.llvm.org/D129022 | 3 年前 | |
[flang] Correct IsHostAssociated() to be true for BLOCK constructs The predicate IsHostAssocited() was implemented in a way that would return true only for cases of host association into a module or inner subprogram. Technically, the use of a name in a BLOCK construct that is not declared therein is considered in the Fortran standard to also be a form of host association, and this matters when doing error checking on DATA statements. Differential Revision: https://reviews.llvm.org/D130388 | 3 年前 | |
[flang] Establish a single source of target information for semantics Create a TargetCharacteristics class to centralize the few items of target specific information that are relevant to semantics. Use the new class for all target queries, including derived type component layout modeling. Future work will initialize this class with target information provided or forwarded by the drivers, and use it to fold layout-dependent intrinsic functions like TRANSFER(). Differential Revision: https://reviews.llvm.org/D129018 Updates: Attempts to work around build issues on Windows. | 3 年前 | |
[flang][openacc] Basic name resolution infrastructure for OpenACC construct Reviewed By: tskeith, klausler, ichoyjx Differential Revision: https://reviews.llvm.org/D83998 | 5 年前 |