Hello Liam,

SDCC does not perform this optimization unless you tell it to with
--acall-ajmp. This assumes that ALL lcall instructions can be replaced
with ACALL independent of their address (it happens at compile time). In
other words it assumes that everything is placed in the same 2kB. If your
device is limited to 2kB anyway then it is certainly worth it.

But a generic implementation would have to check that addresses lie in the
same 2kB block. This can only be done during/after linking. And then it
messes up the addresses so it needs to be done in iterations. The linker
would also need to understand the instructions which it currently does
not.

And then there is the problem of handling jumptables which can come from
switch statements. They use a calculated address to jump into the table.

These are reasons why this is really difficult and thus not implemented.
If you have 2kB or less you can safely enable the option. If you have
more, we hope you can live with the larger instructions.

Maarten

> Hello!
>
> We're happily using sdcc in a project of ours in which we're very close to
> the code space limits of our 8051 device.
>
> We've whipped up a script that consumes the .rst files produced during
> compilation to test whether lcall/ljmp intructions could be replaced by
> acall/ajmp, and have found many candidates for this size optimization.
>
> Does sdcc attempt to perform this kind of optimization? If not, would it
> be possible or interesting to add it?
>
> Thanks,
> Liam

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to