<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
+1 for clang emitting MLIR.<br>
<br>
<div dir="ltr">Best regards,
<div>Alexey Bataev</div>
</div>
<div dir="ltr"><br>
<blockquote type="cite">3 июня 2020 г., в 19:26, Chris Lattner via llvm-dev <llvm-dev@lists.llvm.org> написал(а):<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr"><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jun 2, 2020, at 4:21 PM, comex via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">While this is a different area of the codebase, another thing that<br class="">
would benefit greatly from being moved out of Clang is function call<br class="">
ABI handling. Currently, that handling is split awkwardly between<br class="">
Clang and LLVM proper, forcing frontends that implement C FFI to<br class="">
either recreate the Clang parts themselves (like Rust does), depend on<br class="">
Clang (like Swift does), or live with FFI just not working with some<br class="">
function signatures. I'm not sure what Flang currently does, but my<br class="">
understanding is that Flang does support C FFI, so it would probably<br class="">
benefit from this as well. Just something to consider. :)<br class="">
</div>
</div>
</blockquote>
<br class="">
</div>
<div>For what its worth, I think there is a pretty clear path on this, but it hinges on Clang moving to MLIR as its code generation backend (an intermediary to generating LLVM IR).</div>
<div><br class="">
</div>
<div>The approach is to factor the ABI lower part of clang out of Clang itself into a specific dialect lowering pass, that works on a generic C type system (plus callout to extended type systems). MLIR has all the infra to support this, it is just a massive
job to refactor all the things to change clang’s architecture.</div>
<div><br class="">
</div>
<div>I also don’t think there is broad consensus on the direction for Clang here, but given that Flang is already using MLIR for this, maybe it would make sense to start work there.</div>
<div><br class="">
</div>
<div>If you’re curious, I co-delivered a talk about this recently, the slides <a href="https://docs.google.com/presentation/d/11-VjSNNNJoRhPlLxFgvtb909it1WNdxTnQFipryfAPU/edit#slide=id.g7d334b12e5_0_4" class="">are available here</a>.</div>
<div><br class="">
</div>
<div>-Chris</div>
<br class="">
</div>
</blockquote>
</body>
</html>