haifa-scheduler marks instructions having TRUE dependencies as an ANTI dependencies.
Hi all, It seems that sometimes haifa-scheduler assigns ANTI dependency for the instructions having TRUE dependency. I observed it happening in case of basic block as following: <32 memory load/store rtx> rtx_1: store to memory rtx_2: load from memory I1 and i2 will have ANTI dependency instead of TRUE dependency. Once the sizes of pending_read_insns and pending_write_insns is bigger than MAX_PENDING_LIST_LENGTH (32) the sched_analyze_1 does flush_pending_lists thus putting current insn (rtx_1 in this example) to the last_pending_memory_flush list. During the analysis of the next rtx (rtx_2 in the example) sched_analyze_2 marks rtx_1 and rtx_2 as having ANTI dependence. This is done in sched-deps.c:2652 by the following code: for (u = deps->last_pending_memory_flush; u; u = XEXP (u, 1)) add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI); I have few questions with this regard: 1. Is my understanding correct? 2. If it is what is the reason for this behavior? 3. What should I do in the cost_adjust hook if I want to distinguish between two cases (TRUE and ANTI dependency). In my target the cost for anti-dependency is 0, and cost for the true dependency 1 or bigger. BR, Viktor.
converting rtx object to the assembly instruction.
Is there a simple way to convert rtx object to the assemble insutruction? Ideally I would like to have function something like: const char *rtx2asm(rtx insn); returning a string with the asm instruction for the insn. Closest thing that I found is the final_scan_insn function in final.c but unfortunatelly it outputs the asm string to the file so it makes it not usefull for my purposes. Thanks, Viktor.
Re: converting rtx object to the assembly instruction.
On 8/13/2013 10:37 PM, Richard Sandiford wrote: Viktor Pobedin writes: Is there a simple way to convert rtx object to the assemble insutruction? Ideally I would like to have function something like: const char *rtx2asm(rtx insn); returning a string with the asm instruction for the insn. Closest thing that I found is the final_scan_insn function in final.c but unfortunatelly it outputs the asm string to the file so it makes it not usefull for my purposes. Yeah, I'm afraid that's all there is. Richard Richard, Thanks for the clarification. I found a relative easy way to implement this function by redirecting the FILE to char. Posting it here, maybe someone else will find it usefull: char *rtx2asm(rtx insn) { static char *bp; size_t size; int seen = 0; FILE *tmp = asm_out_file; asm_out_file = open_memstream(&bp, &size); final_scan_insn (insn, asm_out_file, 0, 0 , &seen); fflush (asm_out_file); asm_out_file = tmp; bp[strlen(bp)-1] = 0; return bp; } BR, Viktor.