<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/146159>146159</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Modular Printf Implemenation
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mysterymath
</td>
</tr>
</table>
<pre>
This is a tracking issue for implemenation work for [RFC: printf Code Size Optimization](https://discourse.llvm.org/t/rfc-printf-code-size-optimization/83146).
This would take the form of a new clang function attribute, `modular_format(<modular_impl_fn>, <impl_name>, <aspects...>)`. This could only be applied to functions that also bear the `format` attribute. It would inform the compiler that it could redirect the call to the modular version of the function, so long as it emitted a reference to a symbol corresponding to each requested aspect that it could not prove is unused by the call.
The symbols referenced take the form `<impl_name>_<aspect>`, which allows many different front-end functions to share the same implementation. For example, `fprintf`, and `printf` would both share the implementation name `__printf`.
The initial implementation would support only the `float` aspect, which is required by any call with a floating point argument.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcVMFy4zYM_Rr6grFGpmTZPuiQ9VYze-i00_bugUTIYkORKgnFdb5-h5TWcXJKBiYeHt57Aoagr5aoFvtvYv99gzMPztfjPTD5-4g8bFqn7vU_gw6gAyCwx-5V2yvoEGaC3nnQ42RoJIusnYWb86-pLPbf_mrOoniByWvLPZydIvhbvxP8MbEe9XtqEPvvQh4H5imI4kXIRshG6dC52QfKjHkbM-evQjYsZOP7brugbTunaBv0O23dM5psjsWurIQ8ZSJ_EflLon5zs1HA-ErAQ2I9gusBwdINOoP2Cv1su7QAMnvdzkxCnkFU-ejUbNBfYhOykEdRnH_V4uqX3orit_S4OKeCxZE-Shgm6jhkWZZqJ1HlGSRWXWLlrLlDS4DTZDQpYPfgEoAHZEATHLSEPpEXVb5SqfIPshn84HVNbdN-8W3nxkkb8guO5nWkJ6U9dby8QWPi0Pj_uhe8kQ9RC9cveq184kbBgXH2ChgiHo2amRQgeOrJk-0oYiGE-9g6A53znsLkrIqZYQeE3QCe_psppL4kzhd61jFM3r1RjNxs50AK2vuD7MNYWqeEj-FfTRZV_sWVy8OSaEeVx51ug-4GQGPcLcCI9g5K9wmRoffO8pasenbFQRjQL3MCjvT4BjilMIPGeaD_MVbXGPVLbteJaFUsPmqrda3j4Qn6MyrEDWLX5fLoe9JCW80azdemBTjM0-Q8L2H7lSLj1hAtcjyE0CE5pP2ie9QjheSmeQCE1BftnJy2DOivcxyXbVRdqFNxwg3Vu8N-l1d5IY-boT7gLj9huVc5tYdeFdi3u32Ppazawwkr3Oha5nKfV_Igd8WxPGbHXJWnssTDqcW83RWizGlEbR73YJPOT70rq93-tDHYkgnpiEkZP-n0q5Ay3jRfx6ZtO1-DKHOjA4cPGNZsqP59jf2fy6H68XzQNrM39efzdNU8zG3WuVHIJkKtf7aTd_8mJZtEIAjZrAzfavkzAAD__6jp3Hw">