llvm-6502/lib/Transforms/IPO
Chris Lattner 079236d1c9 My faith in programmers has been found to be totally misplaced. One would
assume that if they don't intend to write to a global variable, that they
would mark it as constant.  However, there are people that don't understand
that the compiler can do nice things for them if they give it the information
it needs.

This pass looks for blatently obvious globals that are only ever read from.
Though it uses a trivially simple "alias analysis" of sorts, it is still able
to do amazing things to important benchmarks.  253.perlbmk, for example,
contains several ***GIANT*** function pointer tables that are not marked
constant and should be.  Marking them constant allows the optimizer to turn
a whole bunch of indirect calls into direct calls.  Note that only a link-time
optimizer can do this transformation, but perlbmk does have several strings
and other minor globals that can be marked constant by this pass when run
from GCCAS.

176.gcc has a ton of strings and large tables that are marked constant, both
at compile time (38 of them) and at link time (48 more).  Other benchmarks
give similar results, though it seems like big ones have disproportionally
more than small ones.

This pass is extremely quick and does good things.  I'm going to enable it
in gccas & gccld.  Not bad for 50 SLOC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11836 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 21:34:36 +00:00
..
ConstantMerge.cpp Merging constants can cause further room for improvement. Iterate until 2003-12-28 07:19:08 +00:00
DeadArgumentElimination.cpp rename the "exceptional" destination of an invoke instruction to the 'unwind' dest 2004-02-08 21:44:31 +00:00
DeadTypeElimination.cpp Finegrainify namespacification 2003-11-21 21:54:22 +00:00
ExtractFunction.cpp Finegrainify namespacification 2003-11-21 21:54:22 +00:00
FunctionResolution.cpp Start using the new and improve interface to FunctionType arguments 2004-02-09 04:14:01 +00:00
GlobalDCE.cpp Finegrainify namespacification 2003-11-21 21:54:22 +00:00
GlobalOpt.cpp My faith in programmers has been found to be totally misplaced. One would 2004-02-25 21:34:36 +00:00
Inliner.cpp Finegrainify namespacification 2003-11-21 21:45:31 +00:00
Inliner.h Put all LLVM code into the llvm namespace, as per bug 109. 2003-11-11 22:41:34 +00:00
InlineSimple.cpp Considering that CI is not even IN SCOPE here, I wooda thought the compiler 2003-11-21 21:57:29 +00:00
Internalize.cpp Finegrainify namespacification 2003-11-21 21:54:22 +00:00
IPConstantPropagation.cpp Finegrainify namespacification 2003-11-21 21:54:22 +00:00
LowerSetJmp.cpp rename the "exceptional" destination of an invoke instruction to the 'unwind' dest 2004-02-08 21:44:31 +00:00
Makefile Added LLVM copyright notice to Makefiles. 2003-10-20 22:26:57 +00:00
MutateStructTypes.cpp Adjust to the changed StructType interface. In particular, getElementTypes() is gone. 2004-02-09 04:37:31 +00:00
Parallelize.cpp Finegrainify namespacification 2003-11-21 21:54:22 +00:00
PruneEH.cpp Intrinsic functions cannot throw 2004-02-13 16:46:46 +00:00
RaiseAllocations.cpp Implement RaiseAllocations/FreeCastConstantExpr.ll 2003-12-07 01:42:08 +00:00
SimpleStructMutation.cpp Don't depend on auto data conversion 2004-02-09 05:16:30 +00:00