Dear SDCC developers and users,

because of I have stuck on the broken SDCC inline support years
ago and we still maintain compatibility for MCS51 in our project
we cannot keep hackery to burden moder RISC cores, I have
decided to solve things on right side - in SDCC compiler.

There is wainting series of patches developed to solve BUG #1767885
from September.

https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1767885&group_id=599

I believe, that it is usable for many people stuck on
the same problem. So I bringing attention to it again.
I am not sure, if it is clean enough for mainline, but nobody
from people maintaining the SDCC core has not found time to reply.


0001-Process-inline-function-expansion-even-in-block-vari.patch
         - This is required the functions in initializers has to be expanded

0002-Move-temporary-inline-return-value-storage-in-front.patch
         - Move temporary inline return value storage in front of declarators.
           This seems be required for correct functionality of expansion
           of inline functions block variable declarations and default
           values assignment.

0003-Support-for-better-AST-tree-debug-print.patch
         - this patch has been used to help debugging

Only reply I have received has been from TinyOS community. I have spent
some time to find problems when they reported problems with my
patches. The testing resulted in yet two another patches

0004-Implemented-missing-incorrect-parts-of-inline-expans.patch
         - this one fixes missing processing of switch statement
           during inline functions expansion. To solve that, I have
           used case labels suffixed.
0005-Added-code-to-update-for-statement-during-inline-fun.patch
         - this patch adds completely missing for statements processing
           during inline functions expansion.

The patched SDCC can compile complex libraries with multi-levels inline
functions in headers and result code runs under simulator.

I have continued a little with TinyOS cases as well.
The tinyos8051wg projects some functions marking to make
SDCC more happy after our discussion. More of simple test applications
can be compiled with inline support. There are still problems
with stile of inline use in NESC for more complex ones.

I have done some testing with RS232 Uart Echo application.

tinyos-2.x-contrib/diku/common/apps/Echo$ make c8051F340TB

I have managed it to compile with patched SDCC and to run under
s51 simulator. I have to delete CLKMUL setup from 
PlatformP__GPIOInit__init to run it under s51. But there is still
problem that 

//# 110 
"/home/pi/repo/tinyos/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/mcs51hardware.h"
static  inline   __nesc_atomic_t __nesc_atomic_start(void );

definition is put after the function use by NESC compiler. I.e.:

-----------------------------------
static inline int f1(void);

void main(void)
{
  int i;
  i = 
}

static inline int f1(void)
{
  return 1;
}
-----------------------------------

This is correct according to C99 standard, but requires to start
inline expansion after whole unit (source file) is parsed
into AST (compile unit-at-a-time). This would involve big changes
in SDCC which are above my time constrains. When the NESC generated
code is manually fixed (function definitions moved before its use),
code compiles and runs in simulator.

This is special case, which has made problems to GCC before
3.4.0 version as well

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20712

This is not so critical so I think, that rest of the
my work could be reviewed and usable parts integrated
to not waste effort and use finding as base for future
development. Changes should have minimal (according to my
analysis zero) effect on non inlined code generation.
Possible breakages user codebase utilizing inline functions
should not be critical, because inline has been almost
unusable and heavily broken till now.

Best wishes

                Pavel Pisa
    e-mail:     p...@cmp.felk.cvut.cz
    www:        http://cmp.felk.cvut.cz/~pisa
    university: http://dce.felk.cvut.cz/
    company:    http://www.pikron.com/


> Re: [sdcc-devel] Fix proposal for bug #1767885 - Parameters lost from scope
> of intermediate inline function From: Frieder Ferlemann
> <frieder.ferlem...@we...> - 2009-08-11 18:30 Hi Pavel,
>
> Pavel Pisa schrieb:
> > please, look at my patches series which allowed me compile
> > highly inlined code (main parts of uLUt library) and resulting
> > code worked on mcs51 in s51 simulator as expected.
>
> seems you are hit by summer vacation and/or those who could
> review your patches are otherwise busy...
>
>
> Your patches might also be of interest for nesC
> http://en.wikipedia.org/wiki/NesC
> http://www.tinyos.net/tinyos-2.x/doc/txt/tep121.txt (section 3.4.4)
> http://www.tinyos8051wg.net/
>
>
> Greetings,
> Frieder


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to