From: Sandeep D. <sa...@dd...> - 2000-02-22 19:15:03
|
Hi Michael , This maynot be very easy to do..SDCCast.c would be the place to start... it just creates a tree as if there are several assignments to array elements in your case it creates six assignments. tile[0] = 1; tile[1] = 2; ... tile[5] = 6; we might me able to change this ..if this is a constant array however the compiler will generate the code differently it will generate _tile: .db 1,2,3,4,5,6 Sandeep > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi all. I've added a 'c1' mode to sdcc so that it can be used inside a C > front end like gcc or lcc. See --c1mode. Basically its a mode where it > compiles pre-processed code into assembler. I'm using it with a hacked > version of lcc to give cmd lines like 'lcc -mgbz80 -o big.gb b1.c b2.c > lib.o' > > My question for the day is: > For static data like: > > char tile[] = { > 1, 2, 3, 4, 5, 6 > }; > > sdcc generates: > ld bc,#tile > ld a,1 > ld (bc),a > ld bc,#tile+1 > ld a,2 > ld (bc),a ... > > which is incredibly inefficent (6 bytes per static byte). What I'd like > it to do is: > > ld de,#tile > ld hl,#1_start$ > ld bc,#1_end$ > ldir (basically a memcpy) > jp 1_end$ > 1_start$: > .db 1,2,3,4,5,6 > 1_end$: > ... next gs init. > > Any clues as to where to start? I believe the relevent code is in > SDCCast.c, but I've yet to find where it actually emits the > genPointerSet. It seems that theres some interesting tree unfolding going > on. > > - -- Michael > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.0 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE4shC3UejL3SuzxEgRAsvkAKCdo8LdZ5OMKVHSPvcg4nbCP/tPcQCfZlYB > 5SakardoxNcLMYWAH5c/UTE= > =WbZu > -----END PGP SIGNATURE----- > > _______________________________________________ > sdcc-devel mailing list > sdc...@li... > http://lists.sourceforge.net/mailman/listinfo/sdcc-devel -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sandeep Dutta Phone: 650-356-5417 Diab-SDS Fax: 650-356-5490 323 Vintage Park Drive Email: sa...@dd... Foster City, CA 94404 URL: www.ddi.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |