circt icon indicating copy to clipboard operation
circt copied to clipboard

[FIRRTL] Reconsider use of inferReturnType in FIRRTLExprs

Open mikeurbach opened this issue 1 year ago • 0 comments

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.

mikeurbach avatar Feb 15 '24 17:02 mikeurbach