Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>No, there is no way to use the comments' contents this way, not without significantly changing the IR parser. However, there's no need to re-invent the wheel; there's a mechanism in LLVM which is intended <strong>precisely</strong> for these sorts of things - transferring information from the front-end into an LLVM pass - and that is <a href="http://blog.llvm.org/2010/04/extensible-metadata-in-llvm-ir.html" rel="nofollow noreferrer">metadata</a>.</p> <p>So whatever or whoever is adding this information to the IR should add it with metadata instead - see these sources for more information on how to do that:</p> <ul> <li><a href="http://llvm.org/docs/LangRef.html#metadata" rel="nofollow noreferrer">http://llvm.org/docs/LangRef.html#metadata</a></li> <li><a href="http://llvm.org/docs/LangRef.html#named-metadata" rel="nofollow noreferrer">http://llvm.org/docs/LangRef.html#named-metadata</a></li> <li><a href="https://stackoverflow.com/questions/13425794/adding-metadata-to-instructions-in-llvm-ir">Adding Metadata to Instructions in LLVM IR</a></li> <li><a href="https://stackoverflow.com/questions/9525947/attaching-metadata">How to attach metadata to LLVM IR using the C++ API?</a></li> <li><a href="https://stackoverflow.com/questions/6973570/how-to-add-a-metadata-string-to-an-llvm-module-with-the-c-api">How to add a Metadata String to an LLVM module with the C++ API?</a></li> </ul> <p>If you have no control over the generation of data, then you should add some pre-processing step in which you convert the comments to metadata.</p> <p>In the end the IR should look something like:</p> <pre> define internal void @MDFilter() #0 { entry: %mdContext = alloca %struct.MD5_CTX, align 8<b>, !freq !1</b> %bytes = alloca i32, align 4 %data = alloca [16 x i8], align 16 call void @MD5Init(%struct.MD5_CTX* %mdContext) br label %while.cond<b>, !outedge !2</b> ... <b>!1 = metadata !{i32 2} !2 = metadata !{float 2.0}</b> </pre> <p>And your pass needs to look for these <code>!freq</code> and <code>!outedge</code> nodes.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload