On Thu, Dec 5, 2013 at 12:11 PM, dxq wrote: > hi all, > > *We found that COND_EXEC is better than IF_THEN_ELSE when used as expressing > condition move insns, because in sched, IF_THEN_ELSE insn has a dependence > on itself, and COND_EXEC has not. > * Besides, IF_THEN_ELSE is not good for SMS. some backend (frv) expands > condition move as IF_THEN_ELSE pattern before reload and splits IF_THEN_ELSE > into COND_EXEC at split2 pass, which is a post reolad pass. However, in SMS > pass(pre-reload), we can't get the accurate information of IF_THEN_ELSE > insns. > * However, as far as i know, COND_EXEC is not supporting in pre-reload > passes. > > So, I'm asking for some suggestions for supporiting COND_EXEC in pre-reload > passes, for me, maybe from split1 to reload pass is good enough. what work > need to do for supporting that, and is there any one who has done any work > on that?
Supporting COND_EXEC before register allocation (RA) is in itself not a big challenge. The problem is handling them *during* register allocation: How to do spilling/reloading registers used in a predicated instruction, and how to spill/reload the predicate condition (condition code or BImode register). If I would have to add support for this myself, I'd do it as follows: 1. Make your port work with LRA instead of reload. 2. Make pre-RA passes handle COND_EXEC with the predicate (COND_EXEC_COND) explicitly assigned to a hard register and only predicated instructions (COND_EXEC_EXPR) that don't need reloads (e.g. only reg->reg and imm->reg moves). 3. Try to get the simple test cases from (1) to get through IRA/LRA. I wouldn't try doing it with reload. With LRA it's likely simpler to add support for this because you can spill to pseudo-registers. 4. Gradually relax the constraints on the kind of COND_EXEC instructions you accept before reload, and play whack-a-mole on all bugs that ubdoubtedly will pop up. Supporting COND_EXEC before reload has been discussed before on this mailing list, but I don't think anyone has every started a serious effort to implement it. There are so few targets that use COND_EXPR and the ones that do (ia64) are falling out of favor. I expect (or at least: hope) that LRA makes it a lot easier to implement it. Ciao! Steven