Page MenuHomePhabricator

[mlir][LLVM] Finer-grained control for C interface emission
ClosedPublic

Authored by nicolasvasilache on Apr 2 2020, 8:34 AM.

Details

Reviewers
ftynse
rriddle
Summary

C interface emission is controlled by a flag and has coarse granularity.
With this coarse control, interfaces are emitted for all external functions.
This makes is easy to get undefined symbols.

This revision adds support for controlling per-function emission with an "emit_c_interface" attribute.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
ftynse requested changes to this revision.Apr 2 2020, 8:41 AM
ftynse added inline comments.
mlir/include/mlir/IR/Function.h
96 ↗(On Diff #254533)

I would not leak implementation details of std->llvm lowering into core IR. We can have a dialect attribute llvm.emit_c_interface attached to a FuncOp without having FuncOp know about it. Then the lowering can check for it.

This revision now requires changes to proceed.Apr 2 2020, 8:41 AM
mehdi_amini added inline comments.Apr 2 2020, 8:53 AM
mlir/include/mlir/IR/Function.h
96 ↗(On Diff #254533)

+1: seems like a layering violation right now.

Avoid leaking into FuncOp.

ftynse accepted this revision.Apr 2 2020, 9:47 AM
ftynse added inline comments.
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
1135

Spurious reformatting.

ftynse added inline comments.Apr 2 2020, 9:55 AM
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
1135

Note that I removed this code altogether, make sure not to re-add this during rebase, thanks!

Drop spurious formatting.

nicolasvasilache marked 2 inline comments as done.Apr 2 2020, 10:04 AM
Harbormaster completed remote builds in B51490: Diff 254533.
rriddle accepted this revision.Apr 3 2020, 11:26 AM

It would be nice to keep track of all of the different ways that the ABI is being expressed.

This revision is now accepted and ready to land.Apr 3 2020, 11:26 AM