<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
In last week's technical call we discussed ways to progress upstreaming the lowering of FIR to llvm-project/flang. It was mentioned that people interested in FIR should suggest plans to Nvidia to help with upstreaming the lowering. For this purpose, I created
 a patch in <a href="https://reviews.llvm.org/D79731">https://reviews.llvm.org/D79731</a> which captures the basic lowering (empty named subroutines) from the parse tree to FIR. The patch requires a bit of cleanup but is functional, passes existing tests and
 two simple tests (in flang/test/Lower/program-units-fir-mangling.f90) for lowering/name mangling of subroutines.<br>
<br>
The patch brings in the lowering code in Bridge.cpp, FIRBuilder.cpp, Mangler.cpp. In Bridge.cpp, only portions of the code for lowering a Function's header/footer is included. Code for instantiating local variables, alternate returns, genFIR for loops and other
 constructs are removed. The FIROpBuilder in <span style="font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">FIRBuilder.cpp/<span style="font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">FIRBuilder.h
 only derives from the mlir OpBuilder, other builders (characterops,complexops,instrinsicops) are removed. The tool for invoking and testing the lowering, bbc, is included. Portions of the code for generating llvm dialect is removed. All other code for handling
 expressions, type conversions, runtime etc are not included. All the excluded code can be upstreamed later in further patches.</span></span><br>
<span style="color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: small; background-color: rgb(255, 255, 255); display: inline !important"> </span><br>
The patch is around 3300 lines of changes. It can be further simplified in further revisions if required. Almost half of the changes are in PFTBuilder.cpp, PFTBuilder.h. Some of these are NFC which are needed to keep pace with fir-dev branch of f18-llvm-project
 in github/flang-compiler. Changes for the tool bbc can also be stripped out into a separate patch if necessary.<br>
<br>
I wanted to get some feedback before proceeding further.<br>
<br>
Thanks,<br>
Kiran</div>
</body>
</html>