C static analysis tools often use intermediate representations (IRs) that organize program data in a simple, well‐structured manner. However, the C parsers that create IRs are slow, and because they are difficult to write, only a few implementations exist, limiting the languages in which a C static analysis can be written. To solve these problems, we investigate two language‐independent, on‐disk representations of C IRs: one using XML and the other using an Internet standard binary encoding called eXternal Data Representation (XDR). We benchmark the parsing speeds of both options, finding the XML to be about a factor of 2 slower than parsing C and the XDR over 6 times faster. Furthermore, we show that the XML files are far too large at 19 times the size of C source code, whereas XDR is only 2.2 times the C size. We also demonstrate the portability of our XDR system by presenting a C source code querying tool in Ruby. Our solution and the insights we gained from building it will be useful to analysis authors and other clients of C IRs. We have made our software freely available for download at http://www.cs.umd.edu/projects/PL/scil/. Copyright © 2010 John Wiley&Sons, Ltd.
C静态分析工具通常使用中间表示形式(IR),它以一种简单、结构良好的方式组织程序数据。然而,创建IR的C解析器速度较慢,并且由于它们难以编写,只有少数几种实现存在,这限制了可以编写C静态分析的语言。为了解决这些问题,我们研究了两种与语言无关的C IR的磁盘存储表示形式:一种使用XML,另一种使用一种称为外部数据表示(XDR)的互联网标准二进制编码。我们对这两种选择的解析速度进行了基准测试,发现XML比解析C慢约2倍,而XDR则快6倍多。此外,我们表明XML文件太大,是C源代码大小的19倍,而XDR仅为C大小的2.2倍。我们还通过用Ruby展示一个C源代码查询工具来证明我们的XDR系统的可移植性。我们的解决方案以及我们从构建它的过程中获得的见解将对分析作者和C IR的其他使用者有用。我们已将我们的软件免费提供下载,网址是http://www.cs.umd.edu/projects/PL/scil/。版权所有© 2010约翰威立父子有限公司