Ian, Thanks for your help. What I mainly want to do is to make some hardware decisions by looking at the instructions inside a Basic block. Ths is why I was using the "FOR_EACH_BB" function.
When and where can I intercept the RTL such that I can get the RTL that matches the output assembly equivalents? I am willing to add my own hook if necessary. Thanks! Balaji V. Iyer. -- Balaji V. Iyer PhD Candidate, Center for Efficient, Scalable and Reliable Computing, Department of Electrical and Computer Engineering, North Carolina State University. -----Original Message----- From: Ian Lance Taylor [mailto:i...@google.com] Sent: Tuesday, December 30, 2008 10:51 AM To: Balaji V. Iyer Cc: gcc@gcc.gnu.org Subject: Re: Code Motion after Machine Dependent Reorganization?? "Balaji V. Iyer" <bvi...@ncsu.edu> writes: > I printed out the RTL dump using the following code during the machine > dependent reorganization > > > FOR_EACH_BB(bb) { > for (insn = bb_head(bb); insn != bb_end(bb); insn = > NEXT_INSN(insn)) { > if (INSN_P(insn)) > print_rtl_single(insn); > } > } > > Then I compared with the assembly output and the RTL-equivalent and > they do not come out in the same order.. A couple instructions were > even moved outside a basic-block... Am I going through the instruction > chain in the wrong way? The CFG is not valid at the point of the machine reorg pass, mainly for historical reasons. You can see all the insns reliably by doing for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) Ian