code gen for C string literals

Ian Lance Taylor iant@google.com
Mon Feb 14 17:47:00 GMT 2011


kevin diggs <diggskevin38@gmail.com> writes:

> "in GENERIC"??? Is this the initial RTL output?

GENERIC is the name for the tree representation used by the C frontend.
Since a string literal only appears in an operand, STRING_CST is what
you will see in GIMPLE as well.

> Assuming the size does not bust through a processors offset addressing
> capabilities, something similar should be doable for accessing things
> in any section (clustered section access optimization). I just figure
> that string literals are far more common. Off the top of your head do
> you know what I would search for for something like:
>
> int im_a_global_int;
>
> which would be treated similarly to a string literal (at least as far
> as how it is accessed), right?

That's a very general question and I'm not sure just how to answer it.
At the GENERIC/GIMPLE level that is just a variable.  At the RTL level
it will turn into a memory address (a MEM).

Ian



More information about the Gcc-help mailing list