-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FXML-4791] Add printout of references with emitc.reference attr #316
Conversation
fc11685
to
61d5346
Compare
One thing that seems to be common is to define named attributes of ops in the ODS. Should we also do this for the reference attribute? |
I think we'll have to live with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I ended up duplicating most of the code in mlir/lib/Interfaces/FunctionImplementation.cpp into mlir/lib/Dialect/EmitC/IR/FunctionOpAssembly.cpp. Now we get a nice printout of function signatures:
|
Something tells me upstream won't like the duplicated code very much. But they might be fine with amending the function interfaces that will set custom parsers for arguments and likewise results (in which case we wouldn't have to duplicate so much code, only the code that does the argument list parsing). |
So, here's an attempt to have some form of references with EmitC. This PR merely consists of:
emitc.reference
that, when borne by function arguments or cast operations, results in a reference variable being created,To make things smoother for the arrival of a reference type (if that's what upstream would like to see), the printout of types is split into two functions:
printReferenceToType
, andprintType
(the existing function). For now,printReferenceToType
callsprintType
but not the other way around, so only the outermost type can bear references (there's no way to make an array of refs for instance); a true reference type would allow nesting and therefore back-and-forth calls betweenprintReferenceToType
andprintType
.