rs6000 toc reference rtl

Alan Modra amodra@gmail.com
Wed Sep 7 09:18:00 GMT 2011


On Tue, Sep 06, 2011 at 01:11:26AM +0930, Alan Modra wrote:
> Consequently, Mike's change to split rtl for
> indirect calls sometimes sees the scheduler moving the r2 load in the
> indirect call sequence before a toc reference.

Actually, this isn't correct.  Mike's change adding rs6000.c
rs6000_call_indirect_aix just made it more likely.  Even before this
post-reload scheduling could move the r2 load around, since rs6000.md
call_indirect_aix patterns were (and still are) split post-reload.

Here's an example I was shown today of such damage (qemu compiled
with gcc-4.6-redhat).

.LVL57151:
	ld 0,0(31)			# load opd+0, function addr
	addis 4,2,.LC4758@toc@ha
	ld 11,16(31)
	mr 7,3
	std 2,40(1)			# save r2
	mr 5,25
	addi 4,4,.LC4758@toc@l
	mtctr 0				#
	mr 6,26
	ld 2,8(31)			# load opd+8, new toc ptr in r2
	mr 3,28
.LBB255670:
.LBB255668:
	.loc 8 98 0
	addis 27,2,.LC4761@toc@ha	# oops, should be using old r2
.LVL57152:
	addi 27,27,.LC4761@toc@l
.LBE255668:
.LBE255670:
	.loc 3 9212 0
	addis 25,2,.LC4762@toc@ha	# oops again
	.loc 3 9198 0
	bctrl				# make the call
	ld 2,40(1)			# restore r2

r27 and r25 set up here for later use now contain bogus values.
The blame rests on my 2011-06-20 change.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Gcc-patches mailing list