Commit graph

25 commits

Author SHA1 Message Date
Jean Perier 49af2a6275 [mlir][flang] Do not prevent integer types from being parsed as MLIR keywords
DialectAsmParser::parseKeyword is rejecting `'i' digit+` while it is
a valid identifier according to mlir/docs/LangRef.md.

Integer types actually used to be TOK_KEYWORD a while back before the
change: 6af866c58d.

This patch Modifies `isCurrentTokenAKeyword` to return true for tokens that
match integer types too.

The motivation for this change is the parsing of `!fir.type<{` `component-name: component-type,`+ `}>`
type in FIR that represent Fortran derived types. The component-names are
parsed as keywords, and can very well be i32 or any ixxx (which are
valid Fortran derived type component names).

The Quant dialect type parser had to be modified since it relied on `iw` not
being parsed as keywords.

Differential Revision: https://reviews.llvm.org/D108913
2021-09-03 08:20:49 +02:00
River Riddle f8479d9de5 [mlir] Set the namespace of the BuiltinDialect to 'builtin'
Historically the builtin dialect has had an empty namespace. This has unfortunately created a very awkward situation, where many utilities either have to special case the empty namespace, or just don't work at all right now. This revision adds a namespace to the builtin dialect, and starts to cleanup some of the utilities to no longer handle empty namespaces. For now, the assembly form of builtin operations does not require the `builtin.` prefix. (This should likely be re-evaluated though)

Differential Revision: https://reviews.llvm.org/D105149
2021-07-28 21:00:10 +00:00
Eric Schweitz 97d8972c9c [flang][fir] Add the pre-code gen rewrite pass and codegen ops.
Before the conversion to LLVM-IR dialect and ultimately LLVM IR, FIR is
partially rewritten into a codegen form.  This patch adds that pass, the
fircg dialect, and the small set of Ops in the fircg (sub) dialect.
Fircg is not part of the FIR dialect and should never be used outside of
the (closed) conversion to LLVM IR.

Authors: Eric Schweitz, Jean Perier, Rajan Walia, et.al.

Differential Revision: https://reviews.llvm.org/D98063
2021-03-24 19:27:10 -07:00
Sourabh Singh Tomar 8ca16e9778 [flang] Replace Arithmetic Ops with their builtin conunterpart
Replaces `fir.add, fir.sub, fir.mul, fir.div` with their builtin
conuterparts.

This part of upstreaming effort, upstreams some parts of:
PR:https://github.com/flang-compiler/f18-llvm-project/pull/681

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D98719
2021-03-17 08:58:10 +05:30
Valentin Clement c3e5f504a0 [flang][fir] Add FIR Types parser diagnostic tests + cleanup
Add diagnostic tests for Types parsers and remove duplicated diagnostics handled by the MLIR
parser.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D97643
2021-03-05 14:58:44 -05:00
Valentin Clement d090f42778 [flang][fir] Add diagnostic tests for FIR ops verifier
Add diagnostic tests with fir-opt for the diagnostics emitted by the ops verifier

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D97996
2021-03-05 10:21:17 -05:00
Eric Schweitz 0b785a46b7 [flang][fir] Add remaining Ops. Updates to pre-existing Ops.
- add ops: rebox, insert_on_range, absent, is_present
  - embox, coordinate_of: replace old hand-written parser/pretty-printer with assembly format
  - remove dead floating point ops, since buitlins work for all types
  - update call op
  - update documentation
  - misc. NFC to formatting
  - add op round trip tests

Authors: Eric Schweitz, Jean Perier, Zachary Selk, Kiran Chandramohan, et.al.

Differential Revision: https://reviews.llvm.org/D97500
2021-02-26 17:21:35 -08:00
Eric Schweitz 67360decc3 [flang][fir] Add array value operations.
We lower expressions with rank > 0 to a set of high-level array operations.
These operations are then analyzed and refined to more primitve
operations in subsequent pass(es).

This patch upstreams these array operations and some other helper ops.

Authors: Eric Schweitz, Rajan Walia, Kiran Chandramohan, et.al.

https://github.com/flang-compiler/f18-llvm-project/pull/565

Differential Revision: https://reviews.llvm.org/D97421
2021-02-25 19:16:43 -08:00
Eric Schweitz 082ec3ab07 [flang][fir][NFC] Remove dead code.
This patch removes OpaqueAttr as it is no longer used.

Differential Revision: https://reviews.llvm.org/D97424
2021-02-24 17:31:23 -08:00
Eric Schweitz 3304061432 [flang][fir] Add zero_bits operation.
This patch adds the new zero_bits operation and upstrams other changes
including the following:

  - update tablegen syntax to newer forms
  - update memory effects annotations
  - update documentation [NFC]
  - other NFC, such as whitespace and formatting

Differential revision: https://reviews.llvm.org/D97331
2021-02-24 08:15:16 -08:00
clementval 8260232cdd [flang][fir] Add fir-opt tool
This patch introduce the fir-opt tool. Similar to mlir-opt for FIR.
It will be used in following patches to test fir opt and round-trip.

Reviewed By: schweitz, mehdi_amini

Differential Revision: https://reviews.llvm.org/D96535
2021-02-16 11:48:40 -05:00
clementval af186e9372 Revert "[flang][fir] Add fir-opt tool"
This reverts commit df1eeaa7b4.

Buildbot failure.
2021-02-12 22:27:48 -05:00
Valentin Clement df1eeaa7b4 [flang][fir] Add fir-opt tool
This patch introduce the fir-opt tool. Similar to mlir-opt for FIR.
It will be used in following patches to test fir opt and round-trip.

Reviewed By: schweitz, mehdi_amini

Differential Revision: https://reviews.llvm.org/D96535
2021-02-12 22:20:38 -05:00
Eric Schweitz 399c3d5b29 [flang][fir] Add shape, shape_shift, and slice types.
Adding the FIR types used to describe the Fortran semantics of indexing
FIR arrays.

https://github.com/flang-compiler/f18-llvm-project/pull/267

Differential Revision: https://reviews.llvm.org/D96172
2021-02-09 08:55:47 -08:00
Eric Schweitz 2cd0a113df [flang][fir] Add OpaqueAttr.
Add the opaque attribute class used in flang.

https://github.com/flang-compiler/f18-llvm-project/pull/402

Differential Revision: https://reviews.llvm.org/D96293
2021-02-08 16:02:22 -08:00
Eric Schweitz 7e20a41348 [flang][fir] Update FIR's character type.
Upstream the changes made to the !fir.char type.

https://github.com/flang-compiler/f18-llvm-project/pull/269
https://github.com/flang-compiler/f18-llvm-project/pull/557

Author: Eric Schweitz, Jean Perier

Differention Revision: https://reviews.llvm.org/D96183
2021-02-08 08:20:04 -08:00
Eric Schweitz f6342806db [flang][fir] Add FIR's vector type.
This patch adds support for `!fir.vector`, a rank one, constant length
data type.

https://github.com/flang-compiler/f18-llvm-project/pull/413

Differential Revision: https://reviews.llvm.org/D96162
2021-02-05 12:44:19 -08:00
Eric Schweitz 9673a00995 [flang] Remove dims type and gendims op.
These are no longer part of FIR.
https://github.com/flang-compiler/f18-llvm-project/pull/267

Differential Revision: https://reviews.llvm.org/D96077
2021-02-04 14:37:07 -08:00
Sourabh Singh Tomar f2879559ac [flang] Enable FIR types and Dialect round trip tests
Reviewed By: schweitz, mehdi_amini

Differential Revision: https://reviews.llvm.org/D95958
2021-02-03 23:46:55 +05:30
Peter Steinfeld 3fd7774033 [flang] Fix FIR test failures
When doing out-of-tree builds, FIR tests were failing.  I made a change
similar to the one by @jurahul to fix this.

Differential Revision: https://reviews.llvm.org/D91654
2020-11-17 12:25:15 -08:00
Rahul Joshi ba3317d0ba Fix flang MLIR unit test verification failures
- Eliminate public function declarations in these tests
2020-11-16 17:32:28 -08:00
Eric Schweitz bc0342383d [flang] Upstream recent work on FIR to llvm-project.
Summary:

Reviewers: DavidTruby, sscalpone, jeanPerier

Subscribers: mgorny, aartbik, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78835
2020-04-27 17:48:57 -07:00
Eric Schweitz d58a405de6 [flang] Upstream patch to enable the fir-ops test. bug 45487
Differential revision: https://reviews.llvm.org/D77834
2020-04-14 10:02:04 -07:00
David Truby 89c7d9633b [flang] Temporarily XFAIL failing test Fir/fir-ops.fir 2020-04-09 18:36:17 +01:00
Luke Ireland f1a8eae3b6 [flang] Port all remaining regression tests to lit
We have re-classified a subset of the regression tests as unit tests and
now we are porting the remaining ones.

Test discovery and running is now performed by lit rather than ctest.
The tests continue to use their original scripts with minor
modifications. Most of the changes were mechanical and so scripted.
A few changes were made by hand. Details

Manual:
  * modfile09-*.f90 tests depend on being run together as some tests have
    dependencies on modules created by other tests. This will need
     separating out when porting away from test_modfile.sh, but for now,
     added modfile09-*.f90 to the Inputs directory and added a single
     tests modfile09.f90 to hold the run line.
  * getdefinition03-a.f90 includes a non-test file getdefinition03-b.f90.
    Manually edited the former to find the latter in Inputs so as to add
    only one test.
  * Same pattern for getsymbols03-{a,b}.f90

Auto:
  * Remaining tests have a lit RUN line added to them based on the type
    of test they are.
  * Failing tests also have an XFAIL line added to them.
  * Generic tests have their pre-existing RUN lines replaced with the
    word "EXEC" to avoid conflict with the added lit RUN line.

Original-commit: flang-compiler/f18@63ec0af9f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/1027
Tree-same-pre-rewrite: false
2020-03-13 11:58:11 +00:00