Read-only data handling: a proposal

Martin Mares mj@atrey.karlin.mff.cuni.cz
Mon Sep 15 01:51:00 GMT 1997


Hello,

> It might make sense to only do them during an optimizing compilation.  It
> also brings up the issue that you might want some constants that aren't
> explicitly referenced (so that you can use them in the debugger).

   I still can make them an externally visible variable which forces them to
be output under all circumstances. Anyway, there probably should be a switch
disabling the merge code as its memory requirements (in both my and original
version of the algorithm) can grow very large for `string table' type
files. -fno-const-merge ?

> Well, more correctly, it depends.  Are you suggesting that output of
> constants be deferred until the end of a compilation unit, or end of
> a function? If you're deferring to the end of a compilation unit, then
> you have to arrange for the tree nodes to be copied onto a permanent
> obstack.  This can get quite hairy -- I did it for static variables a
> few years back and we dropped the code after a while because it was
> unmaintainable.

   I was suggesting deferring it until the end of a function -- it's doesn't
have the problems you've mentioned and it can produce better code on some
architectures if you have a smart assembler which can convert absolute refs
to PC-relative refs whenever possible.

				Have a nice fortnight
-- 
Martin `MJ' Mares   <mj@gts.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Beware of bugs in the above code; I have only proved it correct, not tried it."



More information about the Gcc mailing list