Hi everyone,
I am looking at a way to mark part of a source code for an optimisation pass (or
how to transfert information from source code to IR).
I want to work on C / C++ / Objective-c and Swift.
Something like:
...
//Begin Optimisation
if(i % 2){
printf(“Something”);
}
//End Optimisation
for(int i = 0; i < 10; ++i){
printf("%d, “, i);
}
printf("\n”);
…
I have found several informations here:
http://clang-analyzer.llvm.org/annotations.html
<http://clang-analyzer.llvm.org/annotations.html>. I was thinking about
using #pragma or annotate attribute but this is not working on Swift.
Does anyone has an hint to begin with?
Greetings,
Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20160922/643a5f86/attachment.html>
Hi, I am looking at a way to mark part of a source code for an optimisation> pass (or how to transfert information from source code to IR). >Does it have to be comments, or could you do something like this? if (optimize_me(i%2)) { ... } You could look at how __builtin_expect is handled inside the compiler. In lib/Transforms/Scalar/LowerExpectIntrinsic.cpp, branch weight metadata is generated based on that function. You could probably adapt this to generate the metadata that you need. Best, Jonas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160923/b6ce733a/attachment.html>
Hi Jonas,> Does it have to be comments, or could you do something like this?Not at all, it was just an example, it can pragma or builtin function or anything else.> You could look at how __builtin_expect is handled inside the compiler. In lib/Transforms/Scalar/LowerExpectIntrinsic.cpp, branch weight metadata is generated based on that function. You could probably adapt this to generate the metadata that you need.I will take a look at it thanks. Greetings. Johan> On 23 Sep 2016, at 11:52, Jonas Wagner <jonas.wagner at epfl.ch> wrote: > > Hi, > > I am looking at a way to mark part of a source code for an optimisation pass (or how to transfert information from source code to IR). > > Does it have to be comments, or could you do something like this? > > if (optimize_me(i%2)) { > ... > } > > You could look at how __builtin_expect is handled inside the compiler. In lib/Transforms/Scalar/LowerExpectIntrinsic.cpp, branch weight metadata is generated based on that function. You could probably adapt this to generate the metadata that you need. > > Best, > Jonas >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160923/06c848f7/attachment.html>