任坤
2010-Jan-15 02:39 UTC
[LLVMdev] <IsKill> getting from MachineOperand is just <Used> attribute from logic.
Hi, I have ported LLC to a risc cpu. It can pass benchmark that I have at current. But I want do some optimization after register alloction by adjusting register using. I scan MachineBasicBlock to analyze operand's IsKill, IsDead , IsDef attribute to get a physical register's liverange. But I get a strange case at MBB.jpg. R4 is marked <kill> at MBB0. If I scan R4's liverange by [MBB0->MBB1->MBB2]. I will find R4 first is killed, then is used. It can not unlogisch. Attually R4 just is <Used>. It will cause my optimization pass crash(Actually, I ingore Live In message of MBB. I recollect live in messges at my pass.). 1. Does <kill> attribute of R4 at MBB0 is a unimportant and redundancy messages, Or a little bug??? 2. Is it unreliable to get a physical register's liverange by Kill, Dead messages from MachineBasicBlock?? ___________________________________________________________ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/ -------------- next part -------------- A non-text attachment was scrubbed... Name: MBB.jpg Type: image/jpeg Size: 26396 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100115/2c00f5cc/attachment.jpg>
Jakob Stoklund Olesen
2010-Jan-15 03:44 UTC
[LLVMdev] <IsKill> getting from MachineOperand is just <Used> attribute from logic.
On Jan 14, 2010, at 6:39 PM, 任坤 wrote:> But I want do some optimization after register alloction by adjusting > register using. I scan MachineBasicBlock to analyze operand's IsKill, IsDead , IsDef attribute to get a physical register's liverange. But I get a strange case at MBB.jpg.You can also look at RegisterScavenging.cpp and MachineVerifier.cpp. They are doing the same thing.> R4 is marked <kill> at MBB0. If I scan R4's liverange by [MBB0->MBB1->MBB2]. I will find R4 first is killed, then is used. It can not unlogisch. Attually R4 just is <Used>. It will cause my optimization pass crash(Actually, I ingore Live In message of MBB. I recollect live in messges at my pass.).A register should not be used after it is killed, and if it is needed by a successor block, it should be live out. Note that a register in the live-in list of an MBB is not always live-out from all predecessors. A register defined by IMPLICIT_DEF can be optimized away entirely.> 1. Does <kill> attribute of R4 at MBB0 is a unimportant and redundancy messages, Or a little bug???You have probably found a bug. Can you reproduce it with one of the normal back ends?> 2. Is it unreliable to get a physical register's liverange by Kill, Dead messages from MachineBasicBlock??You also need to use the live-in list for each MBB, but otherwise it should be reliable. Look at how RegisterScavenger is doing it. /jakob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 1929 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100114/b0907dbf/attachment.bin>
任坤
2010-Jan-15 05:33 UTC
[LLVMdev] <IsKill> getting from MachineOperand is just <Used> attribute from logic.
Hi, Jakob: Thanks for your answer. I hope to trace all physical register liverange in MachineBasicBlock. In my test, I find LiveIn message of MBB can not give all livein physical register. So I write a pass to recollect livein message by scan MBB. Current case tell me that just to scan MachineOperand's isDef, isKill, IsDead attribute to rebuild physical register's livein will have bug. If I use add missing live-in into <live-in list for each MBB>, Could I can know which physical register is live at any time? If yes, it is easy for my pass. If not, I need to treat isKill and isDead as isUse, then implement a pass to anaylze CFG to delete unvalid livein message. --- 10年1月15日,周五, Jakob Stoklund Olesen <stoklund at 2pi.dk> 写道:> 发件人: Jakob Stoklund Olesen <stoklund at 2pi.dk> > 主题: Re: [LLVMdev] <IsKill> getting from MachineOperand is just <Used> attribute from logic. > 收件人: "任坤" <hbrenkun at yahoo.cn> > 抄送: "llvm" <llvmdev at cs.uiuc.edu> > 日期: 2010年1月15日,周五,上午11:44 > > On Jan 14, 2010, at 6:39 PM, 任坤 wrote: > > > But I want do some optimization after register > alloction by adjusting > > register using. I scan MachineBasicBlock to analyze > operand's IsKill, IsDead , IsDef attribute to get a physical > register's liverange. But I get a strange case at MBB.jpg. > > You can also look at RegisterScavenging.cpp and > MachineVerifier.cpp. They are doing the same thing. > > > R4 is marked <kill> at MBB0. If I > scan R4's liverange by [MBB0->MBB1->MBB2]. I will find > R4 first is killed, then is used. It can not unlogisch. > Attually R4 just is <Used>. It will cause my > optimization pass crash(Actually, I ingore Live In message > of MBB. I recollect live in messges at my pass.). > > A register should not be used after it is killed, and if it > is needed by a successor block, it should be live out. > > Note that a register in the live-in list of an MBB is not > always live-out from all predecessors. A register defined by > IMPLICIT_DEF can be optimized away entirely. > > > 1. Does <kill> attribute of R4 at MBB0 is > a unimportant and redundancy messages, Or a little > bug??? > > You have probably found a bug. Can you reproduce it with > one of the normal back ends? > > > 2. Is it unreliable to get a physical register's > liverange by Kill, Dead messages from MachineBasicBlock?? > > You also need to use the live-in list for each MBB, but > otherwise it should be reliable. Look at how > RegisterScavenger is doing it. > > /jakob > >___________________________________________________________ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/