Commit Graph

66 Commits

Author SHA1 Message Date
Girish Pai bf7c4e722e
Bump LLVM (#7223) 2024-06-26 13:19:37 -07:00
fzi-hielscher 0e22c2b27a
[NFCI][Conversion] Refactor TableGen Pass includes (#7174)
Refactor includes of TableGen passes in the "Conversion" sub-tree to the new style.
See #3962 , https://reviews.llvm.org/D143773
2024-06-14 16:37:29 +02:00
Hideto Ueno f32a5a196c
Bump llvm (#7167)
Bump to 00bb18a77c

* applySignatureConversion change 52050f3ff3
2024-06-14 14:38:46 +09:00
Martin Erhart 8867f7b867 [LLHD] Use free variants of isa/cast/dyn_cast
Refer to https://mlir.llvm.org/deprecation/
2024-04-28 15:48:54 +02:00
Prithayan Barua 4156a7589a
LLVM bump (#6782)
* LLVM bump to f75c6ed93e785c09884a317ce2bfd440e7f8f573
2024-03-04 13:10:37 -08:00
Girish Pai 02f0bff91b
Bump LLVM (#6404)
The upstream change to !llvm.ptr has triggered a lot of churn in the LLHD side of CIRCT. We currently don't rely on llhd-sim for anything in-tree. A few breakages remain in the interaction between the llhd-sim runtime and the generated code:

* test/Dialect/LLHD/Simulator/sim_formats.mlir
* test/Dialect/LLHD/Simulator/sim_process.mlir
* test/Dialect/LLHD/Simulator/sim_reg.mlir
* test/Dialect/LLHD/Simulator/sim_wait.mlir

These are now gated behind a REQUIRES: llhd-sim-fixed in order to unblock the LLVM bump and allow for them to be fixed in parallel. We might want to introduce a few intermediate ops in the LLHD dialect to reduce the pretty big abstraction gap between LLHD ops and LLVM. A lot of things can now go through the SCF dialect (and maybe memrefs?).
2023-11-14 20:35:02 -07:00
Robert Young d64d0cb8a0
Bump LLVM (#6207)
There were three breaking changes in LLVM:

1: In the LLVM dialect, NullOp was replaced with a more general ZeroOp. See:
https://github.com/llvm/llvm-project/pull/67183.

2: AffineForOp's getInitOperands was renamed to getInits. See:
https://github.com/llvm/llvm-project/pull/66925.

3: In the SCF dialect, the WhileOp now implements LoopLikeOpInterface, which
now supports multiple loop regions. The getLoopBody member-function was removed
in favour of LoopLike's getLoopRegions.  The While Op only has a single region,
so we can replace calls to getLoopBody with getRegion. See:
https://github.com/llvm/llvm-project/pull/66754
2023-09-27 12:15:03 -04:00
Schuyler Eldridge 4f853a6f16
Use const for typeConverter
Conversion patterns now have a `const` TypeConverter.  Propagate this
through to methods which are expecting a non-const one.

This reflects changes here: https://reviews.llvm.org/D157601

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2023-08-14 19:51:05 -04:00
Martin Erhart e7285eda01
[CombToLLVM] Remove pass (#4926)
Instead users should use CombToArith+ArithToLLVM. There is still a pattern population function left for the comb.parity op, which does not have an equivalent in the arith dialect.
2023-04-06 20:24:06 +02:00
Adam Izraelevitz 126ba049a0
Bump LLVM (#4845)
* LLHDToLLVM: make void pointers consistent

---------

Co-authored-by: Martin Erhart <maerhart@outlook.com>
2023-03-22 15:21:29 -07:00
Martin Erhart 05eeac696a
[HWToLLVM] Add support for aggregate constant op (#4756) 2023-03-03 11:08:02 +01:00
Will Dietz dc8abdf8f6
LLVM bump (#4704)
Only minor changes needed on our end:
* circt-translate: Update test to reflect supporting multiple translations.
* [LLHDtoLLVM] Continue not using opaque pointers.
* Drop useFoldAPI in Dialect ODS, only new method is supported now.
2023-02-25 16:24:47 -06:00
John Demme 5bffaaaa93
Bump LLVM submodule (#4568)
* Bump LLVM submodule

Minimal progress, but worth sharing.

* compiling now

* clang-format

* remove unnecessary includes from msft dialect

* XFAIL'ing broken Calyx tests

* Bump LLVM submodule

Minimal progress, but worth sharing.

* compiling now

* clang-format

* remove unnecessary includes from msft dialect

* XFAIL'ing broken Calyx tests

* Fix Calyx tests and ASAN, and re-enable. (#4592)

* Bump to 26th Jan

* switch to ninja and latest cmake

* hopefully fix ci builds

* use full path

* [circt-reduce] Set the default op for pass manager to builtin.module

---------

Co-authored-by: Andrew Young <youngar17@gmail.com>
Co-authored-by: Mike Urbach <mikeurbach@gmail.com>
Co-authored-by: Prithayan Barua <prithayan@gmail.com>
2023-01-27 07:57:27 -08:00
Hideto Ueno 9bbd2e0357
Bump llvm (#4432)
This bumps llvm just before 53406427cd which will cause a lot of complication failures about FunctionOpInterface. This PR mostly replaces llvm::None with std::nullopt.
2022-12-13 03:21:28 +09:00
Martin Erhart 3786f40cc2
[llhd-sim] Fix: reference binding to misaligned address (#4116) 2022-10-17 16:10:15 +02:00
Mike Urbach d4aade214b
Bump LLVM to c4ca3a2c4b00033c393f694c1d92d28ff55c69cd. (#4048)
This included three renames:
* Arithmetic -> Arith
* FunctionOpInterface::getBody -> FunctionOpInterface::getBodyBlock
* MemRef dialect switching to prefixed accessors (memref -> getMemref, etc.)
2022-10-03 20:36:21 -06:00
Nandor Licker 5e50beca79
LLVM Bump (#3708)
* [D131537](https://reviews.llvm.org/D131537) modernized LLVM ops
* [D131702](https://reviews.llvm.org/D131702) changed segment size attributes
* [D131822](https://reviews.llvm.org/D131822) renamed Confined
2022-08-13 17:28:28 +03:00
Bea Healy 2c95a38a71
[LLHDToLLVM] Refactor conversion patterns of each dialect to separate files (#3599)
Moves Comb to LLVM and HW to LLVM conversions out of the LLHDToLLVM pass and into their own dedicated lowering passes, as proposed in #3539.

The methods convertToLLVMEndianess and llvmIndexOfStructField are also encapsulated here within a HWToLLVMEndianessConverter class, in order to allow easier re-use between different passes.
2022-07-29 12:29:32 +02:00
Martin Erhart 4384faa7cd
[LLHDToLLVM] Populate ArithToLLVM conversion patterns (#3587)
Because LLHD uses operations from the cf dialect calling canonicalize creates, e.g., arith.select when control flow can be simplified. Canonicalization patterns of arith might then modify this further to arith.extui or similar. To be able to continue using the cf operations and benefit from all the control flow simplification canonicalizations, we need to add support for lowering arith operations to LLVM.
2022-07-25 14:13:25 +02:00
Martin Erhart cb61f5ce4c
[LLHDToLLVM] Add lowering support for comb.replicate (#3588) 2022-07-25 14:12:58 +02:00
Martin Erhart 3aba0da962
[LLHDToLLVM] Generalize signal init expression support (#3589) 2022-07-25 14:09:34 +02:00
Martin Erhart d52a3cc9de
[LLHD] Remove shifts in favor of comb shifts and dynamic extract operations (#3584)
Since we have added operations to extract elements and slices from integers, signals, and pointers, and because the Moore compiler recently switched to not using these shifts anymore, we don't need these shift operations anymore to perform a dynamic extract. This also removes the weird corner case where two signals can be concatenated using these operations which are especially difficult to handle in the simulator.
2022-07-22 23:56:31 +02:00
Martin Erhart b5bf74863d [Comb] Adopt prefixed accessors
Another step towards #2006
2022-07-14 13:57:36 +02:00
Martin Erhart 3ab2c5ad78
[HW] Adopt prefixed accessors (#3533)
We cannot directly switch to prefixed only because of the use of duck-typing in HWOpInterfaces.td and SVOps.cpp. This means we need to generate both the prefixed and non-prefixed accessors until all dialects that make use of HWInstanceLike have switched. This includes HW, SV, FIRRTL, MSFT.
2022-07-14 11:08:23 +02:00
Martin Erhart 2612a4ad7f
[LLHD] Use prefixed accessors (#3527) 2022-07-14 08:38:13 +02:00
Fabian Schuiki 246d4fdd34
Bump LLVM to 61814586 (#2758) 2022-03-14 14:13:45 +01:00
Andrew Lenharth bb21827888
Bump LLVM to 761bc83af4ee70c6c5156f73ed88947a5d9f013f
Bump LLVM to 761bc83af4ee70c6c5156f73ed88947a5d9f013f
2022-02-16 23:32:32 -06:00
uenoku 7205a2cb2d
LLVM bump (#2467)
* mlir::Identifier deprecated
* StringAttr::get(string, context) deprecated
* Many api changes in std dialect e.g. op.res() ==> op.getRes()
* getAsmBlockArgumentNames is moved to interface (https://reviews.llvm.org/D116018)
* populateFuncOpTypeConversionPattern => 
  populateFunctionLikeOpTypeConversionPattern
* SmallVector::set_size() becomes private (https://reviews.llvm.org/D115380) replaced with resize()
* #dialect.mnemonic is elided by default https://reviews.llvm.org/D113873.  For now, migrate by marking every type directive in asmFormat as qualified(https://reviews.llvm.org/D116905).
* Indices of LLVM::GEPOp are now required to be constant (https://reviews.llvm.org/D116759)
2022-01-22 06:01:19 +09:00
Hideto Ueno 6c5e0ce771
[HW] Use StringAttr instead of StringRef in FieldInfo, nfc (#2325)
* [HW] Use StringAttr instead of StringRef in FieldInfo, nfc

This commit changes to use use StringAttr instead of StringRef
in FieldInfo to avoid unnecessary copies of field names.
Changes are mainly about parser/printer and CAPI.
This commit also changes Struct/UnionTypeImpl to use ArrayRefParameter
instead of ArrayRefOfSelfAllocationParameter in their tablegen
definition. And this deletes unnecessary allocators too.
2021-12-12 15:52:52 +09:00
Chris Lattner c986956a56 [Comb] Remove the now-unused comb.sext operator.
This is better modeled with existing replicate/extract/concat
primitives, which are more expressive and general.

This resolves Issue #2248
2021-12-02 22:34:28 -08:00
Hideto Ueno 846a38fb9f
LLVM Submodule Update (#2225)
Bump LLVM for the following improvements:

- https://reviews.llvm.org/D113511
- https://reviews.llvm.org/D113641

This required modifications to work around the following changes to
upstream:

- Replace Identifier with StringAttr (https://reviews.llvm.org/D113536)
- Use mlir::NamedAttribute (https://reviews.llvm.org/D113956)
- Use macher::m_Any (https://reviews.llvm.org/D113905)
- Update printer/parser of types/attributes
  (https://reviews.llvm.org/D113637) to use AsmPrinter/Parser instead of
  DialectAsmParser/Printer

Co-authored-by: Martin Erhart <maerhart@outlook.com>
2021-12-01 00:14:17 -05:00
Fabian Schuiki 93562bb255
[LLHD] Remove TerminatorOp (#2236)
Since MLIR has gained the `NoTerminator` op trait in the meantime,
remove the LLHD `TerminatorOp` that was originally introduced to get
around a lack of this trait. This requires adjusting the code in a few
places where the terminator is handled explicitly.
2021-11-25 09:03:30 +01:00
Schuyler Eldridge d237a78a18
Bump LLVM for D111695 (#2074)
Bump LLVM to pull in performance improvements from
https://reviews.llvm.org/D111695.

This required the following fixes:
  - Fix usages of deprecated matchAndRewrite member function that uses
    an ArrayRef<Value>.  Change this to use an OpAdaptor.
  - Use Source Not Argument Materialization in HWToLLHD.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2021-11-03 23:58:28 -04:00
Martin Erhart 3453997c2d
[LLHD] Delete insert ops, revise extract ops (#1992)
Closes #1656 by removing the LLHD insert operations and replacing the extract operations as described in the issue.

Some notes/observations:
- Semantics of accessing out of bounds for both slices and single elements in LLHD were partially implemented to return a default value depending on the type (only for non-signal arrays in `llhd.dyn_extract_slice`) or UB. This PR defines it to be UB as this is also what HW does (I think).
- Field accesses to structs are checked, though.
- Extract slice operations cannot return a wider type (at most equal size), I think this is not the case in HW
- `llhd.sig.array_slice` does not work for a full slice of an array with one element (also `llhd.sig.extract` with signal of `i1`) as it requires a `i0` value as index, but this is not supported by `HWIntegerType` (e.g., `llhd.sig.array_slice %array at %index : (!llhd.sig<!hw.array<1xi32>>) -> !llhd.sig<!hw.array<1xi32>>`). A full slice, however, works for more elements in the array. `hw.array_slice` has the same behavior, I don't know if this is intended, or whether it should be enabled, or returning the same number of elements should be forbidden. Seems a bit inconsistent to me this way.
- Removed `sig` type support for `llhd.shr` in `LLHDToLLVM` as it was wrong in the first place (see #1988 ) and it lowered to an operation removed with this PR. It requires concatenating two signals in some way, this seems too complicated to quickly include in this PR.
2021-10-19 13:08:03 +02:00
Martin Erhart 7ada4af1cd
[LLHD] Remove llhd.eq and llhd.neq (#1965)
Replaced by hw.bitcast and comb.icmp
2021-10-11 12:39:56 +02:00
Martin Erhart 59b851ee67
[Simulator] Add support for HW aggregate operations (#1964)
Add support for HW aggregate operations in the LLHD simulator as preparation for #1653 and #1656 to avoid loosing simulator functionality.

Makes sure the endianess and bitcast semantics described in the rationale are followed. As HW uses big endian semantics and LLVM is machine dependent, the order of struct fields and array elements is reversed for little endian machines to match the in-memory layout. Big endian machines are not supported for now.

The lowering currently uses unpacked structs, however, HW structs are packed. This may lead to problems and should be fixed in a later PR (not included here as it adds a lot of noise).
2021-10-11 12:35:45 +02:00
Chris Lattner 910ee76fbd [include/circt/Conversion] Flatten out a level of directories, NFC.
Move singleton headers like circt/Conversion/LLHDToLLVM/LLHDToLLVM.h
up to circt/Conversion/LLHDToLLVM.h since that is the only thing in that
directory.
2021-10-04 16:29:31 -07:00
Martin Erhart ffb9cd2f86
[LLHD] Generate types, attributes and their storages using tablegen (#1782) 2021-09-27 21:33:01 +02:00
Andrew Young a3ed3e60c2
Update LLVM to 704a395 (#1765)
This updates LLVM to 704a395.  We are pulling the new version of LLVM for the top commit which allows 0-bit APInts.  This will help us model 0 bit constants in FIRRTL, and we will be able to properly use IntegerAttr as a (possibly 0-length) bitvector for FIRRTL port directions.

Included in this update is a change to the way `unrealized_conversion_casts` are handled by the LLVM converter infrastructure.  We needed to update `LLHDToLLVM` to apply the new conversion casts.  For more information see the public PSA on the LLVM discourse[^0].

This revealed a problem in the `LLHDToLLVM` where there was a failed to legalize operations in the lowering of `llhd.proc` and `llhd.entity`.  These operation's lowering logic needed to ensure that operations from the (old) body of `llhd.proc` and `llhd.entity` were type converted before inserting new LLVM operations which used their results.

[0] https://llvm.discourse.group/t/psa-run-reconcile-unrealized-casts-after-all-convert-to-llvm-from-now-on/4266
Co-authored-by: Martin Erhart <maerhart@outlook.com>
2021-09-13 00:27:02 -07:00
John Demme 9472cd8d99
LLVM Submodule Update (#1716)
Co-authored-by: Martin Erhart <maerhart@outlook.com>
2021-09-04 14:54:13 -07:00
Martin Erhart 36323daa35
[LLHD] Replace llhd.const with hw.constant (#1702) 2021-09-03 10:19:37 +02:00
John Demme 221e2db01c
Update LLVM submodule (#1687)
Co-authored-by: Andrew Young <youngar17@gmail.com>
2021-09-01 12:46:54 -07:00
Anurudh Peduri 34832f42df
[LLHD] Replace llhd.neg with comb.sub (#1654) (#1678)
* [LLHD] Replace llhd.neg with comb.sub (#1654)

* [LLHD][test] remove repeated test for `comb.sub`
2021-08-31 18:21:10 +02:00
Martin Erhart 8b5f5e216b
[LLHD] Use integer, array and struct types from HW dialect (#1669)
* [LLHD] Use integer, array and struct types from HW dialect

* Simplify HWDialect declaration
2021-08-30 23:02:16 +02:00
Martin Erhart 9146f17b83
[LLHD] Replace standard dialect arithmetic ops with comb ops (#1660)
* [LLHD] Replace standard dialect arithmetic ops with comb ops

* Small fixes

* comb.icmp support

* Support remaining operations

* Small fix
2021-08-30 16:00:56 +02:00
Martin Erhart f5055566f4
[LLHD] Use comb dialects ops where possible (#1649)
* [LLHD] Use comb dialects ops where possible

* Clang-format

* Remove redundant code

* Remove unused includes, add tests, remove redundant code
2021-08-28 08:39:06 +02:00
John Demme 21485874c8
[llvm] Update submodule to latest (#1589)
Co-authored-by: Andrew Lenharth <andrew@lenharth.org>
Co-authored-by: Fabian Schuiki <fabian@schuiki.ch>
Co-authored-by: Andrew Young <youngar17@gmail.com>
2021-08-18 19:37:43 -07:00
mikeurbach 9ffb0e61bd
Update LLVM to 345ace026b6e5cdbc38d207291e4b399d72e62ee. (#1470)
This picks up the start of some reworking happening upstream for
Python bindings, as well as another minor change in LLVM conversion.
2021-07-22 15:11:59 -06:00
John Demme 7a2e3e4524
Bump llvm submodule (#1433) 2021-07-15 22:03:29 -07:00
Andrew Lenharth e4fc39261d
Remove sv.yield and update canonical pattern matches to match mlir updates (#830)
Remove sv.yield and update canonical pattern matches to match mlir updates
2021-03-26 15:51:10 -05:00