From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.29.196 with SMTP id m4mr9594091obh.26.1391930288944; Sat, 08 Feb 2014 23:18:08 -0800 (PST) X-Received: by 10.140.93.109 with SMTP id c100mr9086qge.16.1391930288916; Sat, 08 Feb 2014 23:18:08 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!c10no12574210igq.0!news-out.google.com!y18ni5935qap.1!nntp.google.com!k15no13925959qaq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 8 Feb 2014 23:18:08 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=178.215.113.26; posting-account=0EXciQoAAABnszktho592qzTsx_OoajA NNTP-Posting-Host: 178.215.113.26 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <30a19252-d0c4-4f43-9e1b-76f6f3ed7f78@googlegroups.com> Subject: Source code instrumentation as compilation part? From: droiddermo@gmail.com Injection-Date: Sun, 09 Feb 2014 07:18:08 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:18451 Date: 2014-02-08T23:18:08-08:00 List-Id: Hello! I'm looking for a best way to integrate GNAT compiler with our custo= m code analysis/modification tools. We are using custom tools to perform di= fferent code metrics (like execution time, test coverage and etc) and even = do some code obfuscation. So for example for measuring code execution time = I need to insert 2 function calls into each function/procedure (the first o= ne where the function starts, and the other one for each function exit). Th= e code for these 2 functions are implemented in a separate translation unit= .=20 So what is the best way to do these code instrumentations with GNAT compile= r in terms of simplicity and performance?=20 Looks like the ASIS library can help me out, but it is made for creating se= parate tools. Is it possible to integrate ASIS-based tool with GNAT? So for= example to write a tool that would be loaded by GNAT during compilation, a= nd would modify nodes in the AST before it (the AST) is about to be transfo= rmed into GIMPLE. Or is it possible to get GIMPLE from GNAT compiler, modify and pass it to G= CC? I couldn't find if there is a working GIMPLE front-end inside GCC, but = it seems that GIMPLE is used internally only. I can dump it with pretty muc= h and GCC compiler, but I can't recompile modified GIMPLE afterwards.