On Apr 9, 2014, at 4:15 AM, Kyrill Tkachov <kyrylo.tkac...@arm.com> wrote:
> Hi all, > > I'm looking at some curious pre-reload scheduling behaviour and I noticed > this: > > At the add_branch_dependences function sched-rgn.c there is a comment that > says "branches, calls, uses, clobbers, cc0 setters, and instructions that can > throw exceptions" should be scheduled at the end of the basic block. > > However right below it the code that detects this kind of insns seems to only > look for these insns that are directly adjacent to the end of the block > (implemented with a while loop that ends as soon as the current insn is not > one of the aforementioned). > > Shouldn't the code look through the whole basic block, gather all of the > branches, clobbers etc. and schedule them at the end? > Not really. The instruction sequences mentioned in the comment end basic block by definition -- if there is a jump or other "special" sequence, then basic block can't continue beyond that as control may be transffered to something other than the next instruction. Add_branch_dependencies() makes sure that scheduler does not "accidentally" place something after those "special" sequences thus creating a corrupted basic block. -- Maxim Kuvyrkov www.linaro.org