llvm / llvm/circt

[FIRRTL] Reconsider use of inferReturnType in FIRRTLExprs

Open
#6,705 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

We require FIRRTLExprs to define inferReturnType, which is used, for example, here: https://github.com/llvm/circt/blob/a3e993cb387a08e686b0df1d7f5b599bca0b3751/lib/Dialect/FIRRTL/Import/FIRParser.cpp#L2285

There is some ODS machinery to allow subclasses to customize this using inferTypeDecl and inferType: https://github.com/llvm/circt/blob/a3e993cb387a08e686b0df1d7f5b599bca0b3751/include/circt/Dialect/FIRRTL/FIRRTLExpressions.td#L548-L566

@uenoku pointed out on https://github.com/llvm/circt/pull/6701 that we can probably just use methods from InferTypeOpInterface. All of this machinery seems to predate that existing, but we might be able to simplify it now.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading FIRRTLExpressions.td around the inferTypeDecl and inferType definitions, then inspect the FIRRTLParser.cpp use of inferReturnType and the discussion in pull request 6701. Determine whether InferTypeOpInterface can replace the existing FIRRTLExprs machinery; done means the redundant machinery is simplified without breaking the affected FIRRTL expression type inference.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.