[LLVMdev] Total size of global data

Eli Friedman eli.friedman at gmail.com
Tue Jul 21 13:21:17 PDT 2009


On Tue, Jul 21, 2009 at 1:02 PM, Scott Ricketts<sricketts at maxentric.com> wrote:
> I wrote a pass that attempts to add up the total size of the global
> data in a module. Currently, it iterates through all of the global
> values and checks their type sizes using TargetData. I have realized
> that this is not quite right because global values can point to the
> same data in memory (or can at least overlap) as in the case of
> constant strings.

It's impossible to tell what exactly will get merged until link-time;
also, CodeGen often introduces constant globals.  That said, as far as
I know, LLVM doesn't know how to merge constants beyond running the
constmerge pass and emitting globals into sections which can be
merged.

What are you actually trying to do?

-Eli



More information about the llvm-dev mailing list