[LLVMdev] Where is liveness analysis pass?

Zhanglin Liu way_lzl at sina.com
Thu Jan 13 00:55:15 PST 2011


Jin-Gu

Thanks for your suggestion. Using liveness information for virtual register is a good idea, but what I am working on is a source-to-source compiler, so I prefer to use FunctionPass instead of MachineFunctionPass.

Interestingly I found a FunctionPass example for classic liveness data flow equation.
http://cs.pub.ro/~cpl/wiki/images/1/15/Hello.txt


------------------------------------------------
--Zhanglin
----- Original Message -----
From: Jin Gu Kang <jaykang10 at imrc.kist.re.kr>
To: Zhanglin Liu <way_lzl at sina.com>
Subject: RE: [LLVMdev] Where is liveness analysis pass?
Date: 2011-1-13 16:28:59

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




More information about the llvm-dev mailing list