FAQ  •  Register  •  Login

Assembler shortcut

<<

britlion

Posts: 722

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Thu Jun 03, 2010 5:45 pm

Assembler shortcut

Not sure where else to put this - Not really a bug, per se, as an efficiency; I mentioned it elsewhere but I think it got lost.

With a sub that pokes memory based on labels:

eg:

  Code:
SUB pokethis(data as uByte)
poke @label+1,data
return

label:
asm
LD A,00
end asm


Seems to produce assembler that does this:
  Code:
ld hl, __LABEL__BLPutCharHeight
inc hl


Can the compiler not shortcut that to
  Code:
ld hl, __LABEL__BLPutCharHeight+N ?
and work out at assembly time where that should be, thus producing shorter and faster code for what is, after all, a constant?

(or is there something clever in the optimizer that spots that sort of thing - load followed by incs or fixed adds?)
<<

boriel

Site Admin

Posts: 1277

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sun Jun 13, 2010 4:40 pm

Re: Assembler shortcut

I've included that optimization with -O3 in the latest release (1.2.6r1603d). Please, download and test.
Now this introduces *SEVERE CHANGES* in the compiler :oops: and I've not tested it intensively. So recompile your programs with -O3 and... let's pray... :oops: :P

Note: This version also fix some -O3 bugs (some optimizations not being done). Also adds the 16bit subtraction optimization you suggested.

Return to Wishlist

Who is online

Users browsing this forum: No registered users and 0 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO