New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(zcc) Support using ez80-clang as compiler #2329
Comments
A little more progress:
The generated code is quite chunky (lots of index registers) but the llvm optimiser does seem to make things a fair bit quicker. So it's a nice compromise. Compilation speed is nice and speedy as well. |
What does that mean in context of debugging? In comparison to gdbserver stubs etc? |
It's a good question that at the moment I've not thought too much about - I'm just tinkering and trying to come up with a way to handle It looks like there's always a frame pointer, so walking the function call tree should be possible. It does look like DWARF information can be output, though of course we don't do anything with that and the gas style directives will cause a few problems |
I'm still bashing my head a little with
The clang variant has the prototype arguments reversed but is otherwise the same code.
Generates:
Uncommenting the call to func2 yields:
So we can see that the inline definition has been added to the local source. Given that I don't think pointers to library functions are used that much it's probably liveable with. The extra exporting within libsrc/ can probably be handled with a judicious search/replace for .asm and sccz80 compiled code can just additionally export the other entry point. Which just leaves a mammoth job in the headers which might be do-able with some appropriate macros. There's already quite a large task to hide all the The alternative is switching the whole library to |
Lovely:
Which is starting to look a bit like the header generation m4 in newlib. |
Ah , edge conditions. I've forgotten if there is a correct behaviour, or if it's undefined. sccz80 keeps the sign bit whilst shifting. sdcc doesn't and clang, well it depends (as below). The sccz80 behaviour matches that of the compiler support routines.
|
The branch ez80_clang provides support for
-compiler=ez80clang
- hello world works perfectly!Support routines are starting to be written, there's a few of them: https://github.com/jacobly0/llvm-project/blob/6c61664110f888c0285ae4c48b150c9a7a4361bb/llvm/lib/Target/Z80/Z80ISelLowering.cpp
Notes:
add-target-feature -idxhalf
-triple z180
__stdc
so classic is actually easier to get running than newlib (due to the 8 bit parameter handling difference between sdcc and clang)Tasklist:
__STDC_ABI_ONLY
macro to hide away__z88dk_callee
and__z88dk_fastcall
macro mappingslibrt
(support routines) as we come across themCreate rules for KC160 ((toolchain) Add support for KC160 (KL5C160xxx) #2402) - I have a feeling it will be good match if we pick the z180 triplet and fix up frame access.z180 triplet uses iyh/iylThe text was updated successfully, but these errors were encountered: