C++ PATCH: multiple inheritance optimization

Mark Mitchell mark@codesourcery.com
Mon Jan 17 18:51:00 GMT 2000


  On Mon, Jan 17, 2000 at 02:55:15PM -0800, Mark Mitchell wrote:
  > ========== OLD ABI =========
  > 
  > 	xorl	%eax, %eax
  > 	testl	%ecx, %ecx
  > 	leal	8(%ecx), %edx
  > 	sete	%al
  > 	decl	%eax
  > 	andl	%edx, %eax
  > 	movl	4(%eax), %ebx
  > 	xorl	%eax, %eax
  > 	testl	%ecx, %ecx
  > 	sete	%al
  > 	decl	%eax
  > 	andl	%eax, %edx
  > 	pushl	%edx
  > 	movl	8(%ebx), %ebx
  > .LCFI6:
  > 	call	*%ebx

  This calculates (u ? u+8 : u) twice, and due to the if-conversion,
  it's too complicated for cse to grovel it's way through.

  Any chance you could help the code generator out here and save the
  first copy and reuse it?  Or are the two COND_EXPRs coming from 
  different parts of the front end?

Different, but not too different.  In this case, when you know you're
going to make a call anyhow, there's no reason to be checking for
NULL, since a call through a NULL object isn't legal in the first
place, so we could just not do the conditionals.  I'll see if there's
an easy way to tell the right parts of the compiler that.

But, I'd be more motivated, actually, to figure out how to make GCSE
handle these kinds of things correctly.  Even if we solve *this* one,
this bit of converting to bases happens a lot, and it would be much
better if the back-end could be taught to handle it.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


More information about the Gcc-patches mailing list