Thursday 15 July 2010

How to use comments in LLVM IR in my pass? -


Is it possible to use comments in the IR? Actually I want to annotate the IR with the original block frequency, which is written in the comments, as shown below, and I need the frequency value in my I know that this is a simple method, but It will be enough. Define Internal Zero @ MDFilter () # 0 {entry: ;;; Original block killed 2 times & lt; - I need to align this comment in my PASS% mdContext = alloca% struct.MD5_CTX, align 8% bytes = Alokha i32, align 4% data = Along with [16x i8], 16 callless zero @ MD5Init% Struct.MD5_CTX *% mdContext) br label% while.cond ;;;; External Count: [2.000000e + 00 - & gt; While.cond]

Any other way is also welcome to get this information.

No, there is no way to use the content of the comments in such a way, not the IR parser However, there is no need to re-invent the wheel; There is a mechanism in LLVM, whose purpose is OK for these types of things - transferring information to an LLVM near the front - and that is it.

Anyone who knows this information should add it to the metadata by adding the IR - for more information about these sources:

  • If you have no control over the generation of data, then you need to add some pre-processing steps For the metadata in which you change the comments.

    Finally, something like IR should look like:

     defined internal zero @ mdfilter () # 0 {entry:% mdContext = alloca% struct.MD5_CTX, align 8  ,! Freq! 1 % bytes = alloca i32, align 4% data = alochana [16 x i8], align 16 calls zero @ md5 int (% struct.MD5_CTX *% mdContext) BR label% Cond ,! Outedge! 2  ... ! 1 = Metadata! {I32 2}! 2 = Metadata! {Float 2.0}   

    and you have these ! Need to see Freq Ode> and ! Outage nodes.

  • No comments:

    Post a Comment