[Bug target/20243] static initialization .data redundantly copied to ram prior to use.

schlie at comcast dot net gcc-bugzilla@gcc.gnu.org
Tue Mar 1 01:02:00 GMT 2005

------- Additional Comments From schlie at comcast dot net  2005-03-01 01:02 -------
Subject: Re:  static initialization .data redundantly
 copied to ram prior to use.

> ------- Additional Comments From bjoern dot m dot haase at web dot de
> I think the key problem is, that C language permits you to pass pointers to
> your static const data structures to other functions. Possibly functions that
> are not located within the same source file. While functions whithin the
> source file that defines the const data structures could in principle know
> that these data should be located in program memory and that they should be
> accessed by using lpm instructions, I do not see how to pass this knowledge to
> externally defined functions. Only solution in my opinion would be to define
> different classes of pointers.

- Understood, however would seem to correspondingly require a new type
  and/or attribute be defined and visible from the parser through to type
  checking and rtl template matching; So wonder if it's sufficient to use
  the existing "static const" attributes to designate program-memory
  mapped data (which is what it is) and thereby assume that only references
  to "static const" are prog-mem references, and correspondingly require
  functions which access such data directly to explicitly identify their
  arguments accordingly, as otherwise the reference will be presumed to
  reference data-memory. However any "static const" may first be copied to
  a data-memory variable and then passed as reference as desired to utilize
  functions with more generalized arguments, and then freed, or whatever.
  Hopefully such attributes are already visible at the tree/rtl/template
  level so that memory operand templates may identify (static const *)
  types, and utilize program vs data memory loads as appropriate; as
  otherwise, it's not real clear that this has much a chance of being
  accomplished; and would be a shame to otherwise waist RAM on static
  const data already stored and accessible the program-memory. 



More information about the Gcc-bugs mailing list