[llvm-dev] Mark code from source to IR

Jonas Wagner via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 23 02:52:19 PDT 2016


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160923/b6ce733a/attachment.html>

More information about the llvm-dev mailing list