Abhijit Ray
2005-Nov-18 07:35 UTC
[LLVMdev] help with phi elimination/ register allocation
Hi, I would like to have the llvm code modified so as to obtain the amount of spill code generated, for each basic block. Basically what would be helpful would be something like a code for a target which has the same instruction set as LLVM itself. Only extra input I would be providing would be the number of registers. The intention is to analyze the type of applications that stress the register allocator more. Just wanted to know if LLVM already has passes which I can run to get such info. Towards this end ,after some help on the irc channel , I checked out the PHIElimination pass , is it possible to run that pass on the bytecode file using opt I have checked and found that opt --help doesn't have any option of running just the phi elimination pass. Does this mean the phi elimination pass is run only when generating code for a target ? Thanks Abhijit
Chris Lattner
2005-Nov-18 16:12 UTC
[LLVMdev] help with phi elimination/ register allocation
On Fri, 18 Nov 2005, Abhijit Ray wrote:> I would like to have the llvm code modified so as to obtain the amount > of spill code generated, for each basic block.ok.> Basically what would be helpful would be something like a code for a > target which has the same instruction set as LLVM itself. Only extra > input I would be providing would be the number of registers.Ok, realize that this is just an approximation though. Consider 64-bit values on a 32-bit host. These will require twice as many registers to hold as 32-bit values. Anything that just looks at LLVM code will underestimate (by half!) the register pressure in these situations.> The intention is to analyze the type of applications that stress the > register allocator more.Why not just takes something like the itanium backend (which has many registers) and play around with increasing/reducing the number of registers it has? There is already -stats output telling you the number of spills. This would give you a useful number for a real target.> Just wanted to know if LLVM already has passes which I can run to get such info.Not really.> Towards this end ,after some help on the irc channel , I checked out > the PHIElimination pass , is it possible to run that pass on the > bytecode file usingThe PHI elimination pass is part of the code generator, it is not an llvm-to-llvm transformation. However, there is the recently committed reg2mem pass. It does not currently eliminate all PHI nodes, but could be extended to do so if you desire. However, I'm not sure why eliminating SSA form is useful. How are you trying to do measurements? -Chris -- http://nondot.org/sabre/ http://llvm.org/