This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][LLVM][NFC] Use tblgen to automatically generate build functions
AbandonedPublic

Authored by Miss_Grape on Dec 10 2022, 2:16 AM.

Diff Detail

Event Timeline

Miss_Grape created this revision.Dec 10 2022, 2:16 AM
Herald added a project: Restricted Project. · View Herald Transcript
Miss_Grape requested review of this revision.Dec 10 2022, 2:16 AM
Miss_Grape retitled this revision from [MLIP][LLVM][NFC] Use tblgen to automatically generate build functions to [MLIR][LLVM][NFC] Use tblgen to automatically generate build functions.Dec 10 2022, 2:17 AM

This moves the builder's C++ code from C++ to tablegen we normally try to keep C++ code in ODS files for minimum. If you want this generated you could implement the infer result type interface on this op and then you'd not need to define any custom builder AFAICS.

This moves the builder's C++ code from C++ to tablegen we normally try to keep C++ code in ODS files for minimum. If you want this generated you could implement the infer result type interface on this op and then you'd not need to define any custom builder AFAICS.

Sorry, i dont understand you, so what do you suggest for this modification?

gysit added a comment.EditedDec 13 2022, 1:19 AM

Sorry, i dont understand you, so what do you suggest for this modification?

I think Jacques suggested two options:

  1. either leave the builders in the C++ file rather than importing them into tablegen,

or

  1. add an interface on the LLVM_ArithmeticCmpOp to infer the result types and generate the builders automatically without writing C++ in tablegen.

I think the right interface is InferTypeOpInterface which declares the inferReturnTypes method. I am not a 100% sure though.

Miss_Grape abandoned this revision.Dec 29 2022, 7:00 PM