#2042 Allocation of variable to hx increases code size a lot

hc08 port (43)

Compiling the attached source file results in using current (rev #7891) svn results in a code size of 65 bytes. Doing so in the lospre branch results in a cvode size of 80 bytes. lospre only makes one change to the iCode: a new temporary is created an one of the parameters is assigned to this temporary.
If this temporary was spilt, the additional iCode would result in an ldhx followed by sthx with an imm operand, resulting in a total code size increase of 4 bytes. However the register allocator places it in hx, and we get a total code size increase of 15 bytes instead.
Compilation options were

--std-c99 --out-fmt-ihx --i-code-in-asm --no-peep --opt-code-size -ms08 --max-allocs-per-node 1000000

for both. The asm codes states "Register assignment is optimal." for both. Thus this is clearly a bug in register allocation or code generation (maybe an issue with the cost).



  • Philipp Klaus Krause

    I found the issue in code generation, burt since it is more of a missing optimization than a real bug, I'll commit the fix to the smallopts branch to be merged after the 3.2.0 release. I also found a small bug in cost calcaultion for branches, which I will commit to trunk.


  • Philipp Klaus Krause

    • assigned_to: nobody --> spth
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks