Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > Re: Code genera...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 1041 of 1070
Post > Topic >>

Re: Code generator detail

by jacob navia <jacob@[EMAIL PROTECTED] > Apr 25, 2008 at 12:31 PM

Bartc wrote:
OK

1: I changed the code generator to emit the code as you want
2: I wrote this program:

typedef void (*fnptr)(void);
fnptr pfnptr;
fnptr *ppfnptr;
void n(void)
{
}

int main(void)
{
	int i;

	pfnptr=n;
	ppfnptr = &pfnptr;
	for (i=0; i<100000000; i++)
		(*ppfnptr)();
}

Then I compiled using the new code generator. Elapsed time 1.558 seconds
Then I compiled using the old code generator. Elapsed time 1.502 seconds

The difference is not significative

Code generated by the old code generator:
[0000027] 8b1d00000000     mov       0x0,%ebx   (_ppfnptr)
[0000033] ff141d00000000   call      *0x0(,%ebx,1)

Code generated by the new code generator:
[0000027] 8b1d00000000     mov       0x0,%ebx   (_ppfnptr)
[0000033] 8b1b             mov       (%ebx),%ebx
[0000035] ffd3             call      *%ebx

I would like to improve the code generated, but I just do not understand
why you see such a difference.

Which CPU are you using?
Which OS?


-- 
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 




 5 Posts in Topic:
Code generator detail
"Bartc" <bc@  2008-04-25 01:00:44 
Re: Code generator detail
jacob navia <jacob@[EM  2008-04-25 07:58:08 
Re: Code generator detail
"Bartc" <bc@  2008-04-25 09:48:17 
Re: Code generator detail
jacob navia <jacob@[EM  2008-04-25 12:31:47 
Re: Code generator detail
"Bartc" <bc@  2008-04-25 11:32:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 8:13:26 CDT 2008.