[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalConstifier.cpp
Chris Lattner
sabre at nondot.org
Wed Oct 6 23:20:32 PDT 2004
On Wed, 6 Oct 2004, Reid Spencer wrote:
> > * Rename pass to globalopt, since we do more than just constify
> > * Instead of handling dead functions specially, just nuke them.
> > * Be more aggressive about cleaning up after constification, in
> > particular, handle getelementptr instructions and constantexprs.
> > * Be a little bit more structured about how we process globals.
> >
> > *** Delete globals that are only stored to, and never read. These are
> > clearly not useful, so they should go. This implements deadglobal.llx
>
> Are you sure about that? What if the global is a machine register in a device
> driver. Its side effect could be something outside the program. I wouldn't make
> this assumption, especially if the global is "volatile"
Globals aren't volatile, just the loads and stores to them are. Machine
registers mapped onto globals isn't legal with LLVM: instead you should
use something like:
volatile int *Ptr = (volatile int*)0x0123123; // IO port address
*Ptr = 4;
In the future, when and if we have something like the GCC 'always keep
this global in this register' extension, we will have to check to see if
the global has that property before we make this xform.
-Chris
--
http://llvm.org/
http://nondot.org/sabre/
More information about the llvm-commits
mailing list