aboutsummaryrefslogtreecommitdiff
path: root/tools/gccas/gccas.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-25 21:34:36 +0000
committerChris Lattner <sabre@nondot.org>2004-02-25 21:34:36 +0000
commit079236d1c9909365ffd0ef06831523c87335bb4a (patch)
tree1773e817812915db0a5c98fb3c12eac551915979 /tools/gccas/gccas.cpp
parent757df0282652a9623891baf00d83e03964bb38b1 (diff)
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
Diffstat (limited to 'tools/gccas/gccas.cpp')
0 files changed, 0 insertions, 0 deletions