[LLVMdev] information-transfer between analysis-pases

John Criswell criswell at cs.uiuc.edu
Tue Feb 17 07:05:02 PST 2009


RAAD B wrote:
> Ok, but what about a pass like alias-analysis.
> How are the results stored, so that other passes can use them.
>   
Currently, most/all analysis information is stored in memory; the
analysis passes do not encode their results into the LLVM IR.  There is
a new annotation intrinsic for encoding arbitrary information in the IR,
but to the best of my knowledge, no analysis pass uses it to encode its
results directly in the LLVM IR.

Instead, during execution of an LLVM-based tool (e.g. the opt tool), a
piece of code called the Pass Manager schedules analysis and
transformation passes for execution.  LLVM passes are C++ objects.  When
a transform pass needs analysis results, it asks the Pass Manager for a
pointer to the C++ object for the corresponding analysis pass; it then
calls methods on this pointer to query the information it requires.  So,
all analysis information is passed around in memory between passes.

For more information, I'd suggest reading the "Writing an LLVM Pass"
document at http://llvm.org/docs/WritingAnLLVMPass.html.

-- John T.

> -Raad
>
> ________________________________
> From: Eli Friedman <eli.friedman at gmail.com>
> To: LLVM Developers Mailing List <llvmdev at cs.uiuc.edu>
> Sent: Tuesday, February 17, 2009 9:52:58 AM
> Subject: Re: [LLVMdev] information-transfer between analysis-pases
>
> On Tue, Feb 17, 2009 at 12:46 AM, RAAD B <raad_7007 at yahoo.com<mailto:raad_7007 at yahoo.com>> wrote:
>   
>> Hello together,
>>
>> I have seen that the analysis-results are stored in llvm-IR as annotations.
>> For example <; preds = %entry> in basicBlock level and <; <i32*> [#uses=2]>
>> for a variable.
>>
>> Is there any documentation about annotations?
>>     
>
> That isn't really analysis; it's just some easy-to-extract information
> the disassembler uses to make the output more readable.  Those notes
> are treated as comments by the assembler.
>
> -Eli
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu>        http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>   




More information about the llvm-dev mailing list