[LLVMdev] Where is liveness analysis pass?

Jin Gu Kang jaykang10 at imrc.kist.re.kr
Thu Jan 13 00:28:59 PST 2011


Hi Zhanglin.

First I suggest to read http://llvm.org/docs/CodeGenerator.html#liveintervals. :)

I saw the basic processing order of Live interval in backend LLVM source code as following:
1. LiveVariables::runOnMachineFunction() "lib/CodeGen/LiveVariables.cpp"
--> This pass computes live variable information for each virtual register and register allocatable physical register in the function. (Target dependent)
2. SlotIndexes::runOnMachineFunction() "lib/CodeGen/SlotIndexes.cpp"
-->  This pass assigns indexes to each instruction and basic blocks
3. LiveIntervals::runOnMachineFunction() "lib/CodeGen/LiveIntervalAnalysis.cpp"
--> This pass computes live interval for live variables.
4. SimpleRegisterCoalescing::runOnMachineFunction "lib/CodeGen/SimpleRegisterCoalescing.cpp" 
-> After SimpleRegisterCoalescing, live intervals are merged.

As you know, liveness inforamtion in backend is target dependent.
If you want to use target independent liveness information, I suggest you to use live variable information for virtual register in "LiveVariables::runOnMachineFunction()" pass.

Best regards,
Jin-Gu Kang






________________________________________
From: llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] On Behalf Of Zhanglin Liu [way_lzl at sina.com]
Sent: Thursday, January 13, 2011 4:16 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Where is liveness analysis pass?

Hello all

Currently I want to use the accurate liveness information when writing a *target independent* FunctionPass based on LLVM. The one I can find is LiveValues, a FunctionPass. But it doesn't use classic dataflow equation and can only provide approximate and conservative result. The another one is LiveVariables which use classic data flow equation, but it comes from Clang's analysis phase and only used in frontend.

My question is whether there is such a liveness analysis pass existed for FuntionPass?

Thanks for any suggestion.
--------------------------------
--Zhanglin



More information about the llvm-dev mailing list