Jump to content

Chameleon missing optimization

Recommended Posts

I've just found your compiler and was playing with it to see if it was any good.

And I found something strange in Chameleon compiler.

I was testing very basic code to set and reset bits, chars and structs (targetting PIC16F1825).

When the code is compiled with Chameleon, it uses 85 words, in BoostC i takes 47 to 49 words (depending on optimization options).

Chameleon size does not change with optimization and code is very bad for some bit manipulation code:

        PORTIO |= 1;
0026  3001  	MOVLW 0x01
0027  048C  	IORWF gbl_LATA, F

        PORTIO &= ~1;
0028  30FE  	MOVLW 0xFE
0029  058C  	ANDWF gbl_LATA, F

        PORTIO.0 = 1;
002A  0020  	MOVLB 0x00
002B  142A  	BSF CompTempVar614,0
002C  182A  	BTFSC CompTempVar614,0
002D  2830  	GOTO	label3
002E  0022  	MOVLB 0x02
002F  100C  	BCF gbl_LATA,0
0030        label3
0030  0020  	MOVLB 0x00
0031  1C2A  	BTFSS CompTempVar614,0
0032  2835  	GOTO	label4
0033  0022  	MOVLB 0x02
0034  140C  	BSF gbl_LATA,0
0035        label4

Same code compiled with BoostC:

        PORTIO |= 1;
001C  140C  	BSF gbl_LATA,0

        PORTIO &= ~1;
001D  100C  	BCF gbl_LATA,0

        PORTIO.0 = 1;
001E  140C  	BSF gbl_LATA,0

Even with optimization to set to 0, BoostC gives:

PORTIO |= 1;
001D  140C  	BSF gbl_LATA,0

        PORTIO &= ~1;
001E  30FE  	MOVLW 0xFE
001F  058C  	ANDWF gbl_LATA, F

        PORTIO.0 = 1;
0020  140C  	BSF gbl_LATA,0

Note: this code is nothing more than a test.

Attached you have the test file.



Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...