This is an archive of the discontinued LLVM Phabricator instance.

[flang] Create fir.dispatch_table and fir.dt_entry operations
ClosedPublic

Authored by clementval on Nov 16 2022, 6:39 AM.

Details

Summary

Create the fir.dispatch_table operation based on semantics
information. The fir.dispatch_table will be used for static devirtualization
as well as for fir.select_type conversion.

Depends on D138129

Diff Detail

Event Timeline

clementval created this revision.Nov 16 2022, 6:39 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 16 2022, 6:39 AM
clementval requested review of this revision.Nov 16 2022, 6:39 AM

clang-format

PeteSteinfeld accepted this revision.Nov 16 2022, 8:31 AM

I had one nit, but otherwise all build and tests correctly and looks good.

flang/lib/Lower/Bridge.cpp
251

Should read "to generate the "

255

Did you mean to say "symbols symbols"?

flang/lib/Optimizer/Dialect/FIROps.cpp
1100–1107

You can move this declaration closer to where parent is used.

This revision is now accepted and ready to land.Nov 16 2022, 8:31 AM
jeanPerier accepted this revision.Nov 16 2022, 8:43 AM

Looks great

flang/include/flang/Optimizer/Dialect/FIROps.td
2809

Why do you need both the sym_name and symref ? Can't the sym_name be deduced from the symref somehow ?

Fix after update to D138129

clementval added inline comments.Nov 17 2022, 12:52 AM
flang/include/flang/Optimizer/Dialect/FIROps.td
2809

I was following GlobalOp but might be unnecessary. I'll try to get rid of it.

clementval marked 3 inline comments as done.

Address review comment

clementval marked an inline comment as done.Nov 17 2022, 1:22 AM
clementval added inline comments.
flang/include/flang/Optimizer/Dialect/FIROps.td
2809

So this is actually doable if we use a SymbolNameAttr and the Printer API to print it correctly. We should update GlobalOp a some point to follow this as well instead of having two attributes.

flang/lib/Optimizer/Dialect/FIROps.cpp