[z88dk-dev] sdcc_compilation

Bridge to the z88dk-developers mailing list
Post Reply
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

[z88dk-dev] sdcc_compilation

Post by alvin »

On 05.02.2015 21:19, Stefano Bodrato (stefano_bodrato@...) wrote:
On 05.02.2015 17:49, alvin (alvin_albrecht@...) wrote:
[…] Inlined asm should be rare
anyway.
And inline asm in need of peephole optimization even more so.

Philipp
:)

Probably if I'm writing in pure assembly code I don't want to get it transparently "optimized".
It’s more about optimizing around the code. If you insert code in the middle of a C function, the peephole optimizer cannot optimize through it -- it can only apply rules before or after the inlined block. If the peephole optimizer is allowed to look, it can do things like change JPs to JRs and maybe make superfluous register assignments go away. The sdcc peephole optimizer is more powerful than copt in z88dk since it sort of simulates the z80 code and can make decisions based on that.


People who are doing this:


int my_asm_function(..)

{

#asm

my code

#endasm

}


don’t want their asm code optimized but they shouldn’t be doing things this way anyway -- their code should be going into a separate asm file. A separate asm file will allow selection of calling convention and assignment to sections separate from the compiler’s code. sdcc has some banking going on but there is a workflow where people can assign their code to a memory map they create by hand. This is currently the model people are using for > 64k programs, ie they currently do not expect the compiler to automatically switch between banks and map stuff to banks.
Post Reply