Remove an unused utility function. This was previously used by
GrandCentral, but this is no longer load bearing.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
IMCP needs to use a post-order walk as it is deleting operations (and the
operations are not skipped after erasure). This should fix observed
failures in nightly CI [[1]].
[1]: 46014cd277 (commitcomment-146717821)
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change IMCP to recurse into layers. This has the effect of allowing IMCP
to sink constants into layers and to properly visit instances which are
instantiated under layers.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change IMCP's module update to use a walk instead of only visiting
top-level ops. This is intended to be an entirely mechanical change and
is broken out in a separate commit because of its mechanical nature.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Fix incorrect iteration over a set to do operation erasure. The order of
operations is operations is important to avoid erasing an op before all
its users are erased. Avoid this with a SetVector.
h/t @dtzSiFive for identifying the problem/fix.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change the InferReadWrite pass to fail if it ever sees a WhenOp. If this
happens, the pass can silently do the wrong thing when trying to determine
signal drivers. This is a conservative check (with false positives), but
will have no false negatives.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Fix the InferReadWrite pass to walk into nested regions instead of only
visiting the top-level ops immediately in an FModuleOp's body. This has
the effect of allowing it to work on memories that are declared inside
layers.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change LowerMemory to use a walk as opposed to iteration over operations.
This is done to make this pass work with operations which have regions and
may contain memories, i.e., to make this pass work with layers and whens.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Remove String, Boolean, Integer, Double, Literal, Deleted.
Instead of ignoring these, they will now be errors.
This reduces supported types to: Ground, Vector, Bundle.
This adds `walk_with_filter` python method to invoke callbacks
only for subset of operations. We require GIL to call python function
so this could improve performance of the tools based on Python API.
```
Starting walk_with_filter
walk_with_filter elapsed time: 0.005462 seconds cnt=1
Starting operation.walk
operation.walk elapsed time: 1.061360 seconds cnt=2
```
* Must be passive
* Explicitly diagnose if source/dest diff cannot be cast away.
Add tests. Second crashed attempting to construct invalid RefType
before this change (non-passive base type).
While visiting, preserve layer "color" when inserting ref.cast.
Found via fuzzing.
This was made a warning in https://github.com/llvm/circt/pull/7129. In
reality, the flows can fail during LowerClasses if we do allow this
through, so this adds back the previous restrictions so we ensure from
the start that we have unambiguous paths as originally intended.
Closes https://github.com/llvm/circt/issues/7128.
Adding inner symbols, specifically to module ports, mutates the
attribute dictionary and that races / breaks concurrent access to
properties (e.g., port names and types) commonly inspected during
parsing other module bodies (e.g., InstanceOp's).
Avoid this by instead gathering a list of operations and their
intended target as "fixups" to be processed after the original
(possibly parallel) parsing has completed and it is safe to do so.
This could be parallellized (per-module fixups)
but is not expected to have sufficient work to justify the overhead.
Don't return success if there's a value, that value
may be failure. Fixes crash.
Emit diagnostic if no value found, to ensure something is produced.
Found via fuzzing.
The corresponding code snippet has a problem for checking whether the
pointer pointing to a module op is a nullptr. This commit rewrites its
code to fix the warning.
The ESI logging API is intended to be agnostic of the application's logging framework. In other words, it can be adapted to the application's logging method with ease -- users must only extend one class. It also comes with a simple text logger.
It is also designed to enable debug logging in Release builds with (very) minimal performance overhead if the user does not set the log level to debug.
This PR introduces the API, but doesn't use it much. More plumbing will be required to actually use it. In the interest of keeping this PR small, this is left for future work.
Don't convert the output op in the module pattern because the operands will be of the wrong type since the body has not been converted yet, so it need to apply the hw output pattern afterwards anyway. Instead of relying on that pattern we should have a separate one for moore.output to hw.output that is applied once the rest of the body was converted. The HW output pattern is unnecessary because in the IR before conversion, no hw.output operation should be present (at least none that has a moore typed operand), thus its presence is only the consequence of a bad conversion process (if a target operation is inserted of which the operands are still of the source type, conversion casts should be inserted).