Mutual Inlining: An Inlining Algorithm to Reduce the Executable Size

Y. Ben-Asher, Nidal Faour, Ofer Shinaar
{"title":"Mutual Inlining: An Inlining Algorithm to Reduce the Executable Size","authors":"Y. Ben-Asher, Nidal Faour, Ofer Shinaar","doi":"10.5121/csit.2022.120601","DOIUrl":null,"url":null,"abstract":"We consider the problem of selecting an optimized subset of inlinings (replacing a call to a function by its body) that minimize the resulting code size. Frequently, in embedded systems, the program’s executable file size must fit into a small size memory. In such cases, the compiler should generate as small as possible executables. In particular, we seek to improve the code size obtained by the LLVM inliner executed with the -Oz option. One important aspect is whether or not this problem requires a global solution that considers the full span of the call graph or a local solution (as is the case with the LLVM inliner) that decides whether to apply inlining to each call separately based on the expected code-size improvement. We have implemented a global type of inlining algorithm called Mutual Inlining that selects the next call-site (f()callsg() to be inline based on its global properties. The first property is the number of calls to g(). Next property is determining if inlining g() to f() may prevent inlining other more beneficial neighboring callsites. Finaly repeated inlining iterations over the call graph are performed until there are no more beneficial inlinings to perform. Hence, considering the effect of previously made inlinings on the next call-site to be inline. Our results show small but consistant improvement compare to LLVM’s Oz.","PeriodicalId":201778,"journal":{"name":"Embedded Systems and Applications","volume":"98 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-03-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Embedded Systems and Applications","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.5121/csit.2022.120601","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

We consider the problem of selecting an optimized subset of inlinings (replacing a call to a function by its body) that minimize the resulting code size. Frequently, in embedded systems, the program’s executable file size must fit into a small size memory. In such cases, the compiler should generate as small as possible executables. In particular, we seek to improve the code size obtained by the LLVM inliner executed with the -Oz option. One important aspect is whether or not this problem requires a global solution that considers the full span of the call graph or a local solution (as is the case with the LLVM inliner) that decides whether to apply inlining to each call separately based on the expected code-size improvement. We have implemented a global type of inlining algorithm called Mutual Inlining that selects the next call-site (f()callsg() to be inline based on its global properties. The first property is the number of calls to g(). Next property is determining if inlining g() to f() may prevent inlining other more beneficial neighboring callsites. Finaly repeated inlining iterations over the call graph are performed until there are no more beneficial inlinings to perform. Hence, considering the effect of previously made inlinings on the next call-site to be inline. Our results show small but consistant improvement compare to LLVM’s Oz.
相互内联:一种减少可执行文件大小的内联算法
我们考虑的问题是选择一个优化的内联子集(用函数体替换对函数的调用),从而最小化生成的代码大小。通常,在嵌入式系统中,程序的可执行文件大小必须适合小内存。在这种情况下,编译器应该生成尽可能小的可执行文件。特别是,我们试图改进使用-Oz选项执行的LLVM内联程序获得的代码大小。一个重要的方面是,这个问题是否需要一个全局解决方案来考虑调用图的整个范围,还是需要一个局部解决方案(就像LLVM内联的情况一样),后者根据预期的代码大小改进来决定是否对每个调用分别应用内联。我们已经实现了一种全局类型的内联算法,称为互内联,它根据全局属性选择下一个调用站点(f()调用sg())作为内联。第一个属性是调用g()的次数。下一个属性是确定将g()内联到f()是否会阻止内联其他更有益的相邻调用。最后,在调用图上执行重复的内联迭代,直到没有更多有益的内联要执行。因此,考虑先前所做的内联对下一个要内联的调用站点的影响。与LLVM的Oz相比,我们的结果显示出微小但持续的改进。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信