Hi,

> I had quick peek at the generated code and noticed that pointer access
> to a structure involved call to some support function to handle the
> generic pointer.

You could use __data pointers, which should be dereferenced inline.
They are also only two bytes each and thus help reducing the code
size (e.g., only 2 instead of 3 bytes passed as args saves 2 instructions).

Iff all data structures possibly pointed to by your 
  struct something *ptr;
reside in RAM (rather than Flash or EEPROM), you can designate your pointer
as a pointer to RAM like so:
  __data struct something *ptr;

Assignments to the pointer should not need special attention, except
for casts:
    ptr = (struct something *)&blob;
might need to be rewritten to
    ptr = (__data struct something *)&blob;
You can also no longer make this pointer reference string literals, as
these are (usually/always?) stored in Flash.
Maybe that helps?

> Now I'm slightly concerned that the pointer access seems rather
> expensive in terms of execution time (the interrupt will be
> called several thousand times per second). I'm thinking maybe I should
> refactor the code to directly access global variables.

This will always be faster, of course.

Best regards,
Raphael


------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to