1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 13:33:37 +02:00
Commit Graph

980 Commits

Author SHA1 Message Date
Chris Lattner
9036c86b14 Add support for 'rename'
llvm-svn: 11813
2004-02-24 22:17:00 +00:00
Chris Lattner
d9652be664 Add support for remove, fwrite, and fread
Also fix problem where we didn't check to see if a node pointer was null.
Though fclose(null) doesn't make a lot of sense, 300.twolf does it.

llvm-svn: 11810
2004-02-24 22:02:48 +00:00
Chris Lattner
63b79422f3 Fix a soon-to-be-missing #include
llvm-svn: 11707
2004-02-22 06:26:17 +00:00
Chris Lattner
573441bfbd Use isNull instead of getNode() to test for existence of a node, this is cheaper.
FIX MAJOR BUG, whereby we didn't merge null edges correctly. Correcting this
fixes poolallocation on 175.vpr, and possibly others.

llvm-svn: 11695
2004-02-22 00:53:54 +00:00
Chris Lattner
7bff00313e Fix an iterator invalidation problem which was causing some nodes to not be
correctly merged over!

llvm-svn: 11693
2004-02-21 22:28:26 +00:00
Chris Lattner
458704f675 Use handy method
llvm-svn: 11692
2004-02-21 22:27:31 +00:00
Chris Lattner
dacc6a7448 Instead of cloning the globals for main into the globals graph at the end of
BU propagation, clone the globals into the GG of EACH FUNCTION that finishes
processing!  The GlobalsGraph *must* include all globals and effects from
all functions in the program.  Fixing this makes pool allocation work better
on 175.vpr, but it still ultimately crashes.

llvm-svn: 11686
2004-02-21 00:30:28 +00:00
Chris Lattner
0f9200e5a5 There is no need to merge the globals graph into the function graphs at the
end of the BU and CBU passes.  The globals will be marked incomplete, so it
doesn't matter if they are missing some info, and merging isn't guaranteed
to bring everything in anyway!

llvm-svn: 11684
2004-02-20 23:52:15 +00:00
Chris Lattner
31f8fa66cb Add two missing returns, which caused us to be very pessimistic about the
printf and scanf families!

llvm-svn: 11683
2004-02-20 23:27:09 +00:00
Chris Lattner
4653c4cb50 Add support for some string functions, the scanf family, and sprintf
llvm-svn: 11673
2004-02-20 20:27:11 +00:00
Chris Lattner
d9e1a49650 When we complete the bottom-up pass, make sure to merge the globals in 'main' into
the globals graph.

llvm-svn: 11562
2004-02-17 19:06:47 +00:00
Chris Lattner
2c0736be99 Only spit out warning for functions that take pointers, not for sin and the like
Add more special case handling for stdio functions.  I feel dirty, how about you?

llvm-svn: 11506
2004-02-16 22:57:19 +00:00
Chris Lattner
513e4c7bd9 memset and bcopy and now unified by the llvm.memset intrinsic
llvm-svn: 11503
2004-02-16 18:37:40 +00:00
Chris Lattner
cd6a595db5 No need to scan zero initializers. This should make DSA a bit faster.
llvm-svn: 11471
2004-02-15 05:53:42 +00:00
Chris Lattner
33ed4f9de9 Add support for a bunch more functions
llvm-svn: 11395
2004-02-13 21:21:48 +00:00
Chris Lattner
fbacee0077 Add support for fopen/fclose. Specifically with fopen, we were marking all of the
operands as incomplete, though fopen is known to only read them.  This just adds
fclose for symmetry, though it doesn't gain anything.  This makes the dsgraphs for
181.mcf much more precise.

llvm-svn: 11390
2004-02-13 20:05:32 +00:00
Chris Lattner
dd8e3f4208 Restructure code to handle memcpy/memmove
llvm-svn: 11374
2004-02-13 16:09:54 +00:00
Chris Lattner
ffd9c8a00b Cosmetic improvements to this option.
llvm-svn: 11331
2004-02-11 19:14:04 +00:00
Chris Lattner
66e7209785 Actually load profiling information now! Block layout can use real, live,
actual profile info, and works!  :)

llvm-svn: 11324
2004-02-11 18:21:05 +00:00
Chris Lattner
16ad30203c Fix a typeo
llvm-svn: 11323
2004-02-11 18:20:41 +00:00
Chris Lattner
36f91c80f4 Fix copy-and-pastos
llvm-svn: 11319
2004-02-11 06:10:18 +00:00
Chris Lattner
c456d0cbc7 Add skeleton profileinfoloader pass. This will be enhanced to actually LOAD
a profile tommorow.  :)

llvm-svn: 11318
2004-02-11 06:10:05 +00:00
Chris Lattner
427c8ee657 Factor this code out of llvm-prof
llvm-svn: 11314
2004-02-11 05:54:25 +00:00
Chris Lattner
c9900e2eb3 Make sure to register the 'no profile' implementation as the default for ProfileInfo
llvm-svn: 11309
2004-02-11 04:47:54 +00:00
Chris Lattner
f8077b7801 Simplify implementation, and probably speed things up too.
llvm-svn: 11308
2004-02-11 03:57:16 +00:00
Chris Lattner
a81258a786 An initial implementation of an LLVM ProfileInfo class which is designed to
eventually allow Passes to use profiling information to direct them.

llvm-svn: 11294
2004-02-10 22:11:42 +00:00
Chris Lattner
16690fad3d Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
llvm-svn: 11228
2004-02-09 04:37:31 +00:00
Chris Lattner
838c2dd5af Add one that I missed
llvm-svn: 11179
2004-02-08 01:53:10 +00:00
Chris Lattner
cc1376078c Instead of callign removeTriviallyDeadNodes on the global graph every time
removeDeadNodes is called, only call it at the end of the pass being run.
This saves 1.3 seconds running DSA on 177.mesa (5.3->4.0s), which is
pretty big.  This is only possible because of the automatic garbage
collection done on forwarding nodes.

llvm-svn: 11178
2004-02-08 01:51:48 +00:00
Chris Lattner
e2ee216e1f Remove another unneeded call.
llvm-svn: 11177
2004-02-08 01:40:40 +00:00
Chris Lattner
85ba7bbf78 This call is no longer needed now that merging does not produce garbage
llvm-svn: 11176
2004-02-08 01:38:34 +00:00
Chris Lattner
32a3eb0b88 Substantially improve the DSA code by removing 'forwarding' nodes from
DSGraphs while they are forwarding.  When the last reference to the forwarding
node is dropped, the forwarding node is autodeleted.  This should simplify
removeTriviallyDead nodes, and is only (efficiently) possible because we are
using an ilist of dsnodes now.

llvm-svn: 11175
2004-02-08 01:27:18 +00:00
Chris Lattner
84ff796305 Bugfix for ilist conversion. The ilist wants to make an 'end' node which has
G == 0

llvm-svn: 11174
2004-02-08 01:05:37 +00:00
Chris Lattner
29067016a4 Switch the Nodes list from being an std::vector<DSNode*> to an ilist<DSNode>
llvm-svn: 11173
2004-02-08 00:53:26 +00:00
Chris Lattner
2c836fc933 Change to use node_iterators instead of direct access to Nodes
llvm-svn: 11171
2004-02-08 00:23:16 +00:00
Chris Lattner
6af67c7eb4 getNodes() is gone, use node_begin/end instead
Rename stats from dsnode -> dsa
Add a new stat

llvm-svn: 11167
2004-02-07 23:58:05 +00:00
Chris Lattner
ed36ca5f13 getNodes() is gone
llvm-svn: 11166
2004-02-07 23:57:26 +00:00
Chris Lattner
ce838bfae6 There is no need to clone over nodes that are going to be dead anyway
llvm-svn: 11157
2004-02-07 22:00:03 +00:00
Chris Lattner
ffc5eee17a In a "seeing the forest through the trees" kinda situation, I realized that a
complete rewrite of load-vn will make it a bit faster.  This changes speeds up
the gcse pass (which uses load-vn) from 25.45s to 0.42s on the testcase in
PR209.

I've also verified that this gives the exact same results as the old one.

llvm-svn: 11132
2004-02-05 17:20:00 +00:00
Chris Lattner
1a04f2a635 This is a big diff with no functionality change. We just reorder some code,
which causes big reindentation.  While I'm at it, I fix the fixme by removing
some dead code.

llvm-svn: 11131
2004-02-05 05:56:23 +00:00
Chris Lattner
7d5e3febb7 finegrainify namespacification
llvm-svn: 11130
2004-02-05 05:51:40 +00:00
Tanya Lattner
d7b137d9fb Fixed Chris' typo.
llvm-svn: 11128
2004-02-05 04:45:21 +00:00
Chris Lattner
b721589bc0 Implement optimizations for handling large basic blocks.
llvm-svn: 11126
2004-02-05 00:36:43 +00:00
Chris Lattner
89f03df701 Avoid referencing deleted DSgraphs when merging an SCC into a larger SCC. This
fixes the crash in 176.gcc.

llvm-svn: 11033
2004-01-31 21:02:18 +00:00
Chris Lattner
a497e3d6e1 Fix thinko
llvm-svn: 11027
2004-01-30 22:48:02 +00:00
Chris Lattner
0127841d4e Forward method request to chained aa implementation
llvm-svn: 11024
2004-01-30 22:20:55 +00:00
Chris Lattner
8bcdaf9b5d Implement the pointsToConstantMemory() method.
llvm-svn: 11022
2004-01-30 22:17:24 +00:00
Chris Lattner
71d05cef5e Improve mod/ref information based on the pointsToConstantMemory method.
llvm-svn: 11021
2004-01-30 22:16:42 +00:00
Misha Brukman
440d62207c Order #includes alphabetically, per style guide.
llvm-svn: 11015
2004-01-30 17:26:24 +00:00
Chris Lattner
dfa4f14e34 Fix a bug aflicting 265.gap
llvm-svn: 11006
2004-01-29 08:36:22 +00:00
Chris Lattner
caecd769c4 Minor bugfixes
llvm-svn: 11005
2004-01-29 03:32:15 +00:00
Chris Lattner
7ab2349541 Rename DSGraph::ScalarMapTy -> DSScalarMap
llvm-svn: 11001
2004-01-28 09:15:42 +00:00
Chris Lattner
9a79b1690c Fix a bug
llvm-svn: 11000
2004-01-28 03:31:34 +00:00
Chris Lattner
8324e48b84 Eliminate the call to removeTriviallyDeadNodes from updateFromGlobals graph,
moving it to the start of removeDeadNodes.  This speeds up DSA by 2s on perlbmk
from 41s

llvm-svn: 10999
2004-01-28 03:24:41 +00:00
Chris Lattner
92eb91ed70 In the TD pass, iterate over globals directly instead of through the whole scalar
map.  This saves 5s in the TD pass, from 22->17s on perlbmk

llvm-svn: 10998
2004-01-28 03:12:48 +00:00
Chris Lattner
c25a7dad97 In the TD pass, don't iterate over the scalar map to find the globals, iterate over
the globals directly.  This doesn't save any substantial time, however, because the
globals graph only contains globals!

llvm-svn: 10997
2004-01-28 03:07:30 +00:00
Chris Lattner
394c9343b4 In updateFromGlobalsGraph, instead of iterating over all of the scalars in the
function to find the globals, iterate over all of the globals directly.  This
speeds the function up from 14s to 6.3s on perlbmk, reducing DSA time from
53->46s.

llvm-svn: 10996
2004-01-28 03:03:06 +00:00
Chris Lattner
528f5842dd Minor tweaks, eliminate useless integer pruning optimziation, turn on
timers by default

llvm-svn: 10993
2004-01-28 02:41:32 +00:00
Chris Lattner
18e0615a69 Further reduce the number of nodes cloned with getClonedNH, using merge instead.
This reduces the number of nodes allocated, then immediately merged and DNE'd
from 2193852 to 1298049.  unfortunately this only speeds DSA up by ~1.5s (of
53s), because it's spending most of its time waddling through the scalar map :(

llvm-svn: 10992
2004-01-28 02:11:49 +00:00
Chris Lattner
6d38674f7b Add a timer, fix a minor bug.
Also, use RC::merge when possible, reducing the number of nodes allocated, then immediately merged away from 2985444 to 2193852 on perlbmk.

llvm-svn: 10991
2004-01-28 02:05:05 +00:00
Chris Lattner
10881df6e2 Another bugfix, disable "spurious" output.
You gotta love spurious

llvm-svn: 10990
2004-01-28 01:19:52 +00:00
Chris Lattner
b0d7b564dd fix bug in previous checkin
llvm-svn: 10989
2004-01-27 22:54:56 +00:00
Chris Lattner
3bd20c5114 * Add a new commandline argument to control the "global roots hack". Default
it to be off.  If it looks like it's completely unnecessary after testing, I
  will remove it completely (which is the hope).
* Callers of the DSNode "copy ctor" can not choose to not copy links.
* Make node collapsing not create a garbage node in some cases, avoiding a
  memory allocation, and a subsequent DNE.
* When merging types, allow two functions of different types to be merged
  without collapsing.
* Use DSNodeHandle::isNull more often instead of DSNodeHandle::getNode() == 0,
  as it is much more efficient.
*** Implement the new, more efficient reachability cloner class
    In addition to only cloning nodes that are reachable from interesting
    roots, this also fixes the huge inefficiency we had where we cloned lots
    of nodes, only to merge them away immediately after they were cloned.
    Now we only actually allocate a node if there isn't one to merge it into.
* Eliminate the now-obsolete cloneReachable* and clonePartiallyInto methods
* Rewrite updateFromGlobalsGraph to use the reachability cloner
* Rewrite mergeInGraph to use the reachability cloner
* Disable the scalar map scanning code in removeTriviallyDeadNodes.  In large
  SCC's, this is extremely expensive.  We need a better data structure for the
  scalar map, because we really want to scan the unique node handles, not ALL
  of the scalars.
* Remove the incorrect SANER_CODE_FOR_CHECKING_IF_ALL_REFERRERS_ARE_FROM_SCALARMAP code.
* Move the code for eliminating integer nodes from the trivially dead
  eliminator to the dead node eliminator.
* removeDeadNodes no longer uses removeTriviallyDeadNodes, as it contains a
  superset of the node removal power.
* Only futz around with the globals graph in removeDeadNodes if it is modified

llvm-svn: 10987
2004-01-27 22:03:40 +00:00
Chris Lattner
727e11ac33 Rewrite to use the reachability cloner interface. Also, make this much more
efficient in the case where a function calls into the same graph multiple times
(ie, it either contains multiple calls to the same function, or multiple calls
to functions in the same SCC graph)

llvm-svn: 10986
2004-01-27 21:53:14 +00:00
Chris Lattner
25f95d2b7c minor cleanups
llvm-svn: 10985
2004-01-27 21:51:19 +00:00
Chris Lattner
9117f221b1 Get clone flags right, so we don't build InlinedGlobals only to clear them
llvm-svn: 10984
2004-01-27 21:50:41 +00:00
Chris Lattner
6d2f67adb3 Initial support for implementing clonePartiallyInto in terms of cloneReachableSubgraph, though this support is currently disabled.
llvm-svn: 10970
2004-01-23 01:44:53 +00:00
Chris Lattner
a72f3a387a Eliminated the CompletedNodes argument to the cloneReachable* methods. This
map was only used to implement a marginal GlobalsGraph optimization, and it
actually slows the analysis down (due to the overhead of keeping it), so just
eliminate it entirely.

llvm-svn: 10955
2004-01-22 16:56:13 +00:00
Chris Lattner
50e765d1a2 Ok, I'm tired of pulling out all my timers to check stuff in, just do it.
llvm-svn: 10954
2004-01-22 16:36:28 +00:00
Chris Lattner
da04e4d383 Bug fix: X.mergeWith(Y) was not updating Y if Y was a null node handle!
llvm-svn: 10953
2004-01-22 16:31:08 +00:00
Chris Lattner
07d45564d0 Start implementing DSGraph::clonePartiallyInto and implement mergeInGraph
in terms of it.

Though clonePartiallyInto is not cloning partial graphs yet, this change
dramatically speeds up inlining of graphs with many scalars.  For example,
this change speeds up the BU pass on 253.perlbmk from 69s to 36s, because
it avoids iteration over the scalar map, which can get pretty large.

llvm-svn: 10951
2004-01-22 15:30:58 +00:00
Chris Lattner
961cc51cf1 Allow disabling of ALL printing overhead when performing timings
llvm-svn: 10948
2004-01-22 13:42:43 +00:00
Chris Lattner
c290310e9f Remove use of ConstantHandling itf
llvm-svn: 10781
2004-01-12 18:02:15 +00:00
Chris Lattner
a2612e417c Eliminate use of ConstantHandling itf
llvm-svn: 10780
2004-01-12 17:57:32 +00:00
Chris Lattner
d2ef2c91e8 Live var is now in lib/Target/Sparc
llvm-svn: 10735
2004-01-09 18:16:20 +00:00
Chris Lattner
103dabde37 Move sparc-specific code into lib/Target/Sparc
llvm-svn: 10734
2004-01-09 18:15:56 +00:00
Chris Lattner
1736f44b1d Improve encapsulation in the Loop and LoopInfo classes by eliminating the
getSubLoops/getTopLevelLoops methods, replacing them with iterator-based
accessors.

llvm-svn: 10714
2004-01-08 00:09:44 +00:00
Chris Lattner
8caf13292a Add a note
llvm-svn: 10617
2003-12-28 04:03:49 +00:00
Chris Lattner
099e1f16b8 rename ClassifyExpression -> ClassifyExpr
llvm-svn: 10592
2003-12-23 08:04:08 +00:00
Chris Lattner
5780f54596 Finegrainify namespacification
llvm-svn: 10588
2003-12-23 06:44:41 +00:00
Chris Lattner
b0c30fd90f finegrainify namespacification
Implement indvar analysis of getelementptr and sub expressions

llvm-svn: 10582
2003-12-22 05:26:29 +00:00
Chris Lattner
457dd0b6c7 Add a new AliassetTracker::remove method. Because we need to be able to remove
a pointer from an AliasSet, maintain the pointer values on a doubly linked
list instead of a singly linked list, to permit efficient removal from the
middle of the list.

llvm-svn: 10506
2003-12-18 08:11:56 +00:00
Alkis Evlogimenos
29127b8825 Change interface of MachineOperand as follows:
a) remove opIsUse(), opIsDefOnly(), opIsDefAndUse()
    b) add isUse(), isDef()
    c) rename opHiBits32() to isHiBits32(),
              opLoBits32() to isLoBits32(),
              opHiBits64() to isHiBits64(),
              opLoBits64() to isLoBits64().

This results to much more readable code, for example compare
"op.opIsDef() || op.opIsDefAndUse()" to "op.isDef()" a pattern used
very often in the code.

llvm-svn: 10461
2003-12-14 13:24:17 +00:00
Chris Lattner
a9d238d598 Finegrainify namespacification
Add capability to represent volatile AliasSet's
Propagate this information from loads&stores into the aliassets

llvm-svn: 10457
2003-12-14 04:52:11 +00:00
Chris Lattner
f9c24d19cf Factor out some duplicated code, implement the rest of the cases in
BasicAA/2003-12-11-ConstExprGEP.ll

llvm-svn: 10412
2003-12-11 23:20:16 +00:00
Chris Lattner
2185bd56cc Fix PR86. This makes basicaa _SIGNIFICANLY_ more aggressive with getelementptr's
llvm-svn: 10410
2003-12-11 22:44:13 +00:00
Chris Lattner
89c05af2e2 Finegrainify namespacification
Add new -print-cfg-only pass

llvm-svn: 10407
2003-12-11 21:48:18 +00:00
Chris Lattner
a1ddf56288 Fix a glaring bug
llvm-svn: 10400
2003-12-11 06:06:28 +00:00
Chris Lattner
3245f523d9 Realize the gep P, <zeros> must aliases P.
This is a partial fix for PR 86

llvm-svn: 10399
2003-12-11 06:02:00 +00:00
Chris Lattner
99253d6580 With Brian's change to AA.h we can now clean out this uglyness
llvm-svn: 10398
2003-12-11 05:44:59 +00:00
Brian Gaeke
9b3f9806a2 IncludeFile hack to pull in BasicValueNumbering whenever ValueNumbering.h
is included.

llvm-svn: 10397
2003-12-11 05:05:56 +00:00
Chris Lattner
035bd2ae32 Finegrainify namespacification
llvm-svn: 10367
2003-12-10 15:34:03 +00:00
Chris Lattner
090dd39b2c Finegrainify namespacification
Provide a context module to WriteAsOperand

llvm-svn: 10366
2003-12-10 15:33:59 +00:00
Chris Lattner
5f0dc73b86 Finegrainify namespacification
Move method out of generic dominators construction code

llvm-svn: 10299
2003-12-07 00:35:42 +00:00
Chris Lattner
e8a612e92d Do not depend on index type to determine whether it is a structure or sequential index
llvm-svn: 10221
2003-11-25 20:19:55 +00:00
Chris Lattner
96656a16ad Fix file header
llvm-svn: 10219
2003-11-25 20:11:47 +00:00
Chris Lattner
2cc98be419 Remove dead variable
llvm-svn: 10218
2003-11-25 20:11:00 +00:00
Chris Lattner
259524df92 Use gep_type_begin/end instead of looking for ubytes
llvm-svn: 10217
2003-11-25 20:10:07 +00:00
Chris Lattner
8b644ddc5b Finegrainify namespacification
llvm-svn: 10210
2003-11-25 18:33:40 +00:00
Chris Lattner
7485243e7a Implement a small optimization to handling of GEP's that are equivalent to casts.
This results in substantially reduced collapsing for some testcases

llvm-svn: 10002
2003-11-14 17:09:46 +00:00
Chris Lattner
ca8f3561c2 Trying to get the dsgraph for an external function is bad for DSA's health
llvm-svn: 9979
2003-11-13 18:48:11 +00:00
Chris Lattner
88bf4d25a0 Implement the CompleteBU pass
llvm-svn: 9964
2003-11-13 05:05:41 +00:00
Chris Lattner
547205d4bc Minor code cleanup
llvm-svn: 9962
2003-11-13 05:04:19 +00:00
Chris Lattner
8508dec429 Disable integer tracking by default
llvm-svn: 9960
2003-11-13 03:10:49 +00:00
Chris Lattner
55ad096ff8 Add an initial version of the CompleteBUDataStructures class, which is currently
identical to the BU pass, but has an accurate call graph

llvm-svn: 9956
2003-11-13 01:43:00 +00:00
Chris Lattner
b60823472a Fine-grainify namespaces for this library
llvm-svn: 9948
2003-11-12 23:11:14 +00:00
Chris Lattner
95d0b541c1 Add new argument to disable checking
llvm-svn: 9922
2003-11-12 17:58:22 +00:00
Chris Lattner
e73452b42d Print return nodes for graphs with multiple functions in them correctly
llvm-svn: 9914
2003-11-12 04:58:19 +00:00
Chris Lattner
87ad20251a Don't crash if no gg
llvm-svn: 9913
2003-11-12 04:57:58 +00:00
Chris Lattner
a08ef02e96 Cleanups
llvm-svn: 9907
2003-11-12 00:40:34 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner
6deb20046e Compute node offsets correctly
llvm-svn: 9895
2003-11-11 20:12:32 +00:00
Chris Lattner
365bda897c Add new method for computing node mappings. This is used by the pool allocator
llvm-svn: 9880
2003-11-11 05:08:59 +00:00
Chris Lattner
b63e179816 More additions
llvm-svn: 9834
2003-11-09 19:54:30 +00:00
Chris Lattner
a3444ad7e0 Add more functions
llvm-svn: 9826
2003-11-09 04:10:41 +00:00
Chris Lattner
6e7ff9a44d None of the __llvm_* functions call into the program. This makes the
callgraph MUCH simpler for eh using program.

llvm-svn: 9825
2003-11-09 04:00:59 +00:00
Chris Lattner
e63e580e56 Add support for memmove
llvm-svn: 9824
2003-11-09 03:32:52 +00:00
Chris Lattner
eb36733092 Handle bzero and memset in the local analysis, because we were missing the fact
that memset returns its argument!!

llvm-svn: 9811
2003-11-08 21:55:50 +00:00
Chris Lattner
28d77c2122 This doesn't use DSCallSiteIterator
llvm-svn: 9809
2003-11-08 21:17:37 +00:00
Chris Lattner
b5a2959ef2 Fix name collision
llvm-svn: 9722
2003-11-05 05:55:45 +00:00
Chris Lattner
a71b07eeca All DSGraphs keep a reference to the targetdata they are created with. This is
used to eliminate the hard coded, hacked in, sparc specific, global TargetData.
Changing the TargetData used to actually match the code fixes problems, and
eliminates a crash.

llvm-svn: 9659
2003-11-02 22:27:28 +00:00
Chris Lattner
63fb5bcaac Fix bug: test/Regression/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll
llvm-svn: 9658
2003-11-02 21:02:20 +00:00
Chris Lattner
29f03b2d39 Including the symbol table in the FindUsedTypes analysis was the WRONG way
to fix test/Regression/CBackend/2003-10-23-UnusedType.ll.  This completely
neutered the deadtypeelim pass.

llvm-svn: 9646
2003-11-02 01:28:41 +00:00
Chris Lattner
9c85e0b72c Make the call graph more precise despite the hated constantpointerrefs.
Do you detect the animosity I feel towards CPRs yet?

llvm-svn: 9640
2003-10-31 21:05:12 +00:00
Chris Lattner
586db4056a When someone includes CallGraph.h, make sure that they link in CallGraph.cpp
llvm-svn: 9611
2003-10-30 05:17:30 +00:00
Chris Lattner
305fcb1536 Fix PR62, and llvm/test/Regression/CBackend/2003-10-28-CastToPtrToStruct.ll
ConstantExpr's can use unrelated types, make sure to scan them.

llvm-svn: 9569
2003-10-28 23:09:45 +00:00
Chris Lattner
28732137bc Fix bug: CBackend/2003-10-23-UnusedType.ll and hopefully 252.eon
llvm-svn: 9441
2003-10-23 19:30:30 +00:00
Chris Lattner
307255971c This is a disgusting hack that improves code substantially, by making
callgraphSCC passes more effective.

llvm-svn: 9384
2003-10-22 18:53:31 +00:00
Chris Lattner
ce023da56a Do not add unreachable code to a natural loop!
llvm-svn: 9377
2003-10-22 16:41:21 +00:00
Chris Lattner
43276ffbf4 Make sure to print labels on nodes without names
llvm-svn: 9376
2003-10-22 16:30:58 +00:00
Chris Lattner
dd7d5d8172 If the basic block has no name, make sure to print the % number of it
llvm-svn: 9375
2003-10-22 16:22:42 +00:00
Chris Lattner
8476f4bb56 Implement the Function::viewCFG* methods, for use in a debugger. Also, the
-print-cfg pass now lives here.

llvm-svn: 9374
2003-10-22 16:03:49 +00:00
John Criswell
de34542f41 Added LLVM copyright header.
llvm-svn: 9321
2003-10-21 15:17:13 +00:00
John Criswell
71d2894956 Added LLVM copyright notice to Makefiles.
llvm-svn: 9312
2003-10-20 22:26:57 +00:00
Chris Lattner
489483fe88 Convert this code from using annotations to using a local map
llvm-svn: 9310
2003-10-20 20:52:23 +00:00
Chris Lattner
e06b3121c8 Remove using declaration
llvm-svn: 9307
2003-10-20 20:38:17 +00:00
John Criswell
b402729b30 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
87843f87b8 Change the Opcode enum for PHI nodes from "Instruction::PHINode" to "Instruction::PHI" to be more consistent with the other instructions.
llvm-svn: 9269
2003-10-19 21:34:28 +00:00
Chris Lattner
97f3f7e819 Make use of "external" depth-first iterators to avoid revisiting nodes
multiple times.  This reduces the time to construct post-dominance sets a LOT.
For example, optimizing perlbmk goes from taking 12.9894s to 1.4074s.

llvm-svn: 9091
2003-10-13 16:36:06 +00:00
Chris Lattner
b6c8569f05 Regularize header file comments
llvm-svn: 9071
2003-10-13 03:32:08 +00:00
Chris Lattner
be9a1813c6 Make getNumBackEdges more efficient
llvm-svn: 9063
2003-10-12 22:14:27 +00:00
Alkis Evlogimenos
e6fdc87045 Use std::string::size_type for for ColonPos to stop gcc from giving a warning
llvm-svn: 8811
2003-10-01 22:49:22 +00:00
Chris Lattner
471405e2ba DOn't crash if program calls the null pointer
llvm-svn: 8708
2003-09-24 23:42:58 +00:00
Chris Lattner
36559daef0 Remove explicit use of BasicBlock::succ_iterator
llvm-svn: 8706
2003-09-24 22:18:35 +00:00
Chris Lattner
883cc51630 Functions reachable from the arguments of unresolvable call nodes should
not have their arguments marked complete

llvm-svn: 8639
2003-09-20 23:58:33 +00:00
Chris Lattner
681a690f26 The Globals graph must become complete at the end of the BU phase!
llvm-svn: 8638
2003-09-20 23:27:05 +00:00
Chris Lattner
a85a2f8d86 Do not mark incoming arguments to functions complete if the function is pointed to by a global in the globals graph
llvm-svn: 8637
2003-09-20 22:24:04 +00:00
Chris Lattner
c2e75f110a Make sure to add global variable initializers to the Globals graph!
llvm-svn: 8636
2003-09-20 21:48:16 +00:00
Chris Lattner
a721b89e37 Don't consider incomplete nodes to be typesafe!
llvm-svn: 8635
2003-09-20 21:48:01 +00:00
Chris Lattner
f203e908e3 Remove trivially dead nodes was not removing nodes that were dead due to forwarding!
llvm-svn: 8634
2003-09-20 21:34:07 +00:00
Chris Lattner
372fe6873d Add special case handling for calloc and realloc
llvm-svn: 8630
2003-09-20 16:50:46 +00:00
Chris Lattner
b12a8a6177 Switch from using CallInst's to represent call sites to using the LLVM
CallSite class.  Now we can represent function calls by invoke instructions
too!

llvm-svn: 8629
2003-09-20 16:34:13 +00:00
Chris Lattner
6a460d88d3 Make this work better for constants that aren't necessarily in ANY graph, such as null pointers
llvm-svn: 8628
2003-09-20 16:12:57 +00:00
Chris Lattner
aaf3999fba Fix bug: BasicAA/2003-09-19-LocalArgument.ll
llvm-svn: 8615
2003-09-20 03:08:47 +00:00
Chris Lattner
448df1c145 Keep track of the number of typed/untyped memory accesses theyre are in the program
VS: ----------------------------------------------------------------------

llvm-svn: 8611
2003-09-20 01:20:46 +00:00
Chris Lattner
98d4e5dffc These two conditions are not exclusive!!
llvm-svn: 8518
2003-09-15 04:35:16 +00:00
Chris Lattner
f3c318737f Make the print output more useful
llvm-svn: 8517
2003-09-15 04:29:37 +00:00
Misha Brukman
b9a4ddbfc5 Fixed spelling and grammar.
llvm-svn: 8478
2003-09-11 18:14:24 +00:00
Chris Lattner
3d39abeeb7 Renamed DominatorTree::Node::getNode() -> getBlock()
llvm-svn: 8469
2003-09-11 16:26:13 +00:00
Misha Brukman
6c4ffae6a5 Spell `definitely' correctly.
llvm-svn: 8466
2003-09-11 15:31:17 +00:00
Chris Lattner
9d9fd138dc Rework post dominator information so that we do not have to
unify all exit nodes of a function to compute post-dominance information.
This does not work with functions that have both unwind and return nodes,
because we cannot unify these blocks.  The new implementation is better
anyway. :)

llvm-svn: 8460
2003-09-10 20:37:08 +00:00
Chris Lattner
e5b90f633d Remove using declarations
llvm-svn: 8442
2003-09-10 16:08:03 +00:00
Chris Lattner
f4be611b55 another trivial cleanup
llvm-svn: 8435
2003-09-10 14:55:05 +00:00
Chris Lattner
37123e1b58 Simplification of trip counting machinery.
- make sure to check the indvar type before anything else (efficiency)
  - Make sure to insert the 'add' into the program, even though it'll be
    dead
  - Wrap code at 80 columns
  - Other minor cleanups to reduce indentation level

llvm-svn: 8434
2003-09-10 14:51:49 +00:00
Chris Lattner
620f051422 Spelling fixes
llvm-svn: 8429
2003-09-10 05:24:09 +00:00
Chris Lattner
5d113e557d clean up file header comment
llvm-svn: 8427
2003-09-10 05:08:19 +00:00
Chris Lattner
f0c30718e2 Simplify some code
llvm-svn: 8426
2003-09-10 04:49:10 +00:00
Chris Lattner
f3505abe43 Fix bug: RLE-Preserve-Volatile.ll
Volatile loads and stores must not be value numbered

llvm-svn: 8398
2003-09-08 18:13:58 +00:00
Chris Lattner
e5a47a9d95 This file is hopelessly out of date
llvm-svn: 8298
2003-09-01 20:14:00 +00:00
Chris Lattner
0620f3d2fa Replace M with F when refering to functions
llvm-svn: 8274
2003-08-31 20:36:52 +00:00
Chris Lattner
f72da72785 Rename TarjanSCCIterator -> scc_iterator
* Increases consistency with other iterators (e.g. df_iterator, po_iterator...)
  * It's shorter
  * We don't name classes by the implementation, we name it for the interface!

llvm-svn: 8273
2003-08-31 20:01:57 +00:00
Chris Lattner
b16810e6ee Don't explicitly use the SCC class
llvm-svn: 8271
2003-08-31 19:55:06 +00:00
Chris Lattner
1b262a5395 Remove dead var
llvm-svn: 8270
2003-08-31 19:54:57 +00:00
Chris Lattner
acd5eb1663 The SCC::HasLoop method is now in the main iterator
llvm-svn: 8269
2003-08-31 19:51:38 +00:00
Chris Lattner
05498bc768 Remove explicit passing of SCC's around as objects.
llvm-svn: 8267
2003-08-31 19:46:48 +00:00
Chris Lattner
8314d710a6 Move the getAnalysisUsage method from the header file
llvm-svn: 8264
2003-08-31 19:40:57 +00:00
Chris Lattner
87aba3e3d5 The tarjan iterator now returns a reference to the current SCC, not a possibly null pointer!
llvm-svn: 8262
2003-08-31 19:35:16 +00:00
Chris Lattner
9e2279bd9d Minor cleanups
Iterate from tarj_begin -> tarj_end, not from tarj_begin -> NULL

llvm-svn: 8260
2003-08-31 19:29:52 +00:00
Chris Lattner
e4682822fb Indent classes correctly in the namespace
move bodies out-of-line
Add getAnalysisUsage method for SFGSCC

llvm-svn: 8259
2003-08-31 19:27:11 +00:00
Chris Lattner
f8dfcdadf3 * Cleanups
* Iterate from tarj_begin -> tarj_end, not from tarj_begin -> NULL

llvm-svn: 8258
2003-08-31 19:23:41 +00:00
Chris Lattner
0fd60ef271 Initial checkin of the CallGraphSCCPass class
llvm-svn: 8247
2003-08-31 01:54:59 +00:00
Chris Lattner
6f0cabcb53 There is no reason for this to be a pass!
llvm-svn: 8214
2003-08-29 14:43:17 +00:00
Misha Brukman
56f7db4178 Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Chris Lattner
d34f5bd750 Fix the bug that broke the nightly tester in McCat/18-imp last night. :(
llvm-svn: 7925
2003-08-17 21:47:33 +00:00
Chris Lattner
0674b75f99 Fix bug: LoopPreheaders/2003-08-15-PreheadersFail.ll
llvm-svn: 7915
2003-08-16 20:57:16 +00:00
Vikram S. Adve
39ff8beb24 Improvement to the previous fix: branch following a delay slot of
another delayed instr. would cause the later sanity-check (assertion)
in PhyRegAlloc.cpp to fail, even though there is really no error.

llvm-svn: 7848
2003-08-14 20:45:56 +00:00
Vikram S. Adve
e456b5fc93 For an instruction with delay slots, mark all live values before
the instruction as being live before/after the delay slot
instructions as well.

llvm-svn: 7795
2003-08-12 22:19:59 +00:00
Chris Lattner
c25494f95e Remove unnecessary use of NonCopyable
llvm-svn: 7641
2003-08-06 17:16:24 +00:00
Chris Lattner
e2ee62c91c Add more verbose comment
llvm-svn: 7610
2003-08-05 18:38:37 +00:00
Sumant Kowshik
1a4fce3511 Added function mergeInGlobalsGraph which merges in the entire globals graph with the graph of a function
llvm-svn: 7606
2003-08-05 17:04:41 +00:00
Chris Lattner
686e94e760 DEBUG got moved to Support/Debug.h
llvm-svn: 7492
2003-08-01 22:15:03 +00:00
Vikram S. Adve
59e7da7437 Don't require a BB to look-up live variables, unless they may need to
be recomputed.

llvm-svn: 7388
2003-07-29 19:42:32 +00:00
Chris Lattner
36a7bf78fa Fix another minor bug
llvm-svn: 7340
2003-07-26 23:00:05 +00:00
Chris Lattner
752a4ca4c4 Dont' try to parse the colon
llvm-svn: 7323
2003-07-25 20:49:29 +00:00
Chris Lattner
915b998b3f Add a more general check-flags which can be used to ensure arbitrary flags are set
llvm-svn: 7322
2003-07-25 20:45:40 +00:00
Chris Lattner
bfe70df7fc Fit code into 80 columns
llvm-svn: 7249
2003-07-23 15:17:01 +00:00
Chris Lattner
0fce06e40e Eliminate old-style cast
llvm-svn: 7248
2003-07-23 15:16:40 +00:00
Vikram S. Adve
420ec0bb0f Fix comment.
llvm-svn: 7227
2003-07-22 12:08:58 +00:00
Brian Gaeke
026c333f07 Fix typo in call to isUnresolvableFunc, which was breaking the build.
llvm-svn: 7194
2003-07-17 19:07:46 +00:00
Vikram S. Adve
96abba3e01 Rematerialize nodes from the globals graph into the current graph
after all callees are inlined into the current graph.

NOTE: There's also a major bug fix for the BU pass in DataStructure.cpp,
which ensures that resolvable indirect calls are not moved out to the
globals graph, so that they are eventually inlined (if possible).

llvm-svn: 7189
2003-07-16 21:42:03 +00:00
Vikram S. Adve
e2993f34ed (1) Rematerialize nodes from the globals graph into the current graph
after all callers are inlined into the current graph.
(2) Optimize the way a graph is inlined into its callees in the TD phase:
    (a) Use DSGraph::cloneReachableSubgraph to clone only a subgraph at
        each call site, for faster inlining.
    (b) Clone separately for the same callee at different call sites,
        since only the reachable subgraph is being cloned, not the entire
        caller graph.

llvm-svn: 7188
2003-07-16 21:40:28 +00:00
Vikram S. Adve
d1a85b7860 Implement 2 important changes: (1) rematerialization from the globals graph,
and (2) faster inlining by cloning only reachable nodes.  In particular:
(1) Added DSGraph::cloneReachableSubgraph and DSGraph::cloneReachableNodes
    to clone the subgraph reachable from a set of root nodes, into the
    current graph, merging the global nodes into thos in the current graph.
    The TD pass now uses this for faster inlining, and so does the
    next function.
(2) Added DSGraph::updateFromGlobalGraph() to rematerialize nodes from the
    globals graph into the current graph in both BU and TD passes.
(3) `I' flags are removed from all nodes in the globals graph, because they
    are difficult to maintain correctly and are not needed anyway.
(4) Aux. function calls are only removed to the globals graph if they
    will never be resovled.  (This is what fixed gap.)  The immediate
    reason is that if we took these out of a function (and moved them to
    the globals graph) we would need to rematerialize these nodes into the
    function graph for every function in the BU pass.  The longer term
    problem is that we would need to find a way to remove them from the
    globals graph iff they have been resolved on all paths through the
    call graph.

llvm-svn: 7187
2003-07-16 21:36:31 +00:00
Vikram S. Adve
0ce80bfa82 Factor out the test for unresolvable external functions into
isUnresolvableFunc() (I thought I needed this externally.
I don't, but it's still nicer this way.)

llvm-svn: 7186
2003-07-16 21:25:17 +00:00
Misha Brukman
0b5999cca1 The word separate' only has one e'.
llvm-svn: 7174
2003-07-14 17:26:34 +00:00
Chris Lattner
b93ef28cef Reuse the values if they are constants: this is important so that we index into the right structure field
This fixes bug: BasicAA/2003-07-03-BasicAACrash.ll

llvm-svn: 7093
2003-07-03 06:42:38 +00:00
Chris Lattner
2a6504c799 Remove globals more aggressively from graphs.
Fix a bug where we removed nodes that were marked U.

llvm-svn: 7090
2003-07-03 02:03:53 +00:00
Chris Lattner
492b7eeb06 INCLUDE_PARENT_GRAPH is required!
llvm-svn: 7088
2003-07-02 23:57:05 +00:00
Chris Lattner
86c8f822ec Disable incorrect mustalias code
llvm-svn: 7087
2003-07-02 23:56:51 +00:00
Chris Lattner
478e42b621 Remove space at end of line
llvm-svn: 7084
2003-07-02 23:44:15 +00:00
Chris Lattner
b64aff94fd Fix how we are handling unreachable functions. This DRAMATICALLY improves efficiency
llvm-svn: 7082
2003-07-02 23:42:48 +00:00
Chris Lattner
083398eff5 Keep track of how many inlinings are performed
llvm-svn: 7076
2003-07-02 20:24:42 +00:00
Chris Lattner
59bb44723a Try using trivially dead deletion
llvm-svn: 7075
2003-07-02 19:49:11 +00:00
Chris Lattner
c1f922d61e Remove dead Nodes list
llvm-svn: 7065
2003-07-02 06:06:34 +00:00
Chris Lattner
56585a82d9 Complete rewrite of td pass
llvm-svn: 7064
2003-07-02 04:39:44 +00:00
Chris Lattner
a85502303e Print collapsed to match the paper
llvm-svn: 7063
2003-07-02 04:39:27 +00:00
Chris Lattner
95c5313776 Reduce amount of work we do calculating mustaliases if the arg is a global
llvm-svn: 7062
2003-07-02 04:39:13 +00:00
Chris Lattner
f4a221c87c Add support for ParentGraph only when building in debug mode
Minor cleanups, reenable folding of call nodes to external functions

llvm-svn: 7061
2003-07-02 04:38:49 +00:00
Chris Lattner
d49611837b Add some functions to the blacklist
llvm-svn: 7060
2003-07-02 04:38:00 +00:00
Chris Lattner
64ea02737e Make the BU closure keep track of which actual calls happen
Minor cleanups

llvm-svn: 7059
2003-07-02 04:37:48 +00:00
Chris Lattner
60652f41c4 Make local pass print out its progress
llvm-svn: 7058
2003-07-02 04:37:26 +00:00
Chris Lattner
f3cfe71797 Fix bug: Regression/Other/2002-03-11-ExprAssertion.ll
llvm-svn: 7046
2003-07-01 21:08:52 +00:00
Chris Lattner
5ddec0f02d Rework TD pass to work with the precise call graph constructed by the BU phase
llvm-svn: 7031
2003-07-01 16:28:11 +00:00
Chris Lattner
3536455262 Do not treat global variables as functions! (and assert failing)
llvm-svn: 7030
2003-07-01 16:27:53 +00:00
Chris Lattner
7ab30a179b Dont' print scalar nodes for ConstantPointerRefs
llvm-svn: 7029
2003-07-01 16:27:32 +00:00
Chris Lattner
599287e3c3 Minor cleanups
llvm-svn: 7027
2003-07-01 16:04:18 +00:00
Chris Lattner
33fce4d868 Use the getFunctionNames method
llvm-svn: 7008
2003-06-30 05:57:39 +00:00
Chris Lattner
cb32be085b Add new method
llvm-svn: 7007
2003-06-30 05:57:30 +00:00
Chris Lattner
851b6382b6 Split CallSiteIterator out into DSCallSiteIterator.h, and generalize it a bit
llvm-svn: 7006
2003-06-30 05:27:53 +00:00
Chris Lattner
e40d871120 Be more const-correct
llvm-svn: 7005
2003-06-30 05:27:18 +00:00
Chris Lattner
fb9f50ee23 Fix bug in last checkin
llvm-svn: 7003
2003-06-30 05:18:26 +00:00
Chris Lattner
9954cfc9bf Reimplement the BU closure to collapse all SCC graphs into a single graph.
Look at all of the code that gets deleted!

llvm-svn: 7001
2003-06-30 05:09:58 +00:00
Chris Lattner
60b2516889 Handle the case where OldNodeMap == &ScalarMap correctly
llvm-svn: 7000
2003-06-30 05:09:29 +00:00
Chris Lattner
20d3019fa6 Remove dead method
llvm-svn: 6999
2003-06-30 04:53:39 +00:00
Chris Lattner
37d7a580b2 Do not delete the same graph multiple times when freeing memory if graphs are sharing
llvm-svn: 6998
2003-06-30 04:53:27 +00:00
Chris Lattner
64008895c8 Do not multiply delete graphs if functions are sharing graphs
llvm-svn: 6997
2003-06-30 04:53:08 +00:00
Chris Lattner
8574358e8a Move usages of explicit hash_* datastructures to use typedefs
llvm-svn: 6996
2003-06-30 03:36:09 +00:00
Chris Lattner
203826c2e1 Revamp DSGraphs so that they can support multiple functions in the same
DSGraph at one time

llvm-svn: 6994
2003-06-30 03:15:25 +00:00
Chris Lattner
2ce6424601 Adjust for new DSGraph API
llvm-svn: 6993
2003-06-30 03:14:54 +00:00
Chris Lattner
762a057a22 Abstract out the predicate which decides whether a function gets complete
arguments or not...

llvm-svn: 6987
2003-06-29 22:37:07 +00:00
Chris Lattner
9cb6f34b81 Fix minor bug in previous checkin
llvm-svn: 6986
2003-06-29 22:36:31 +00:00
Chris Lattner
9229da84be Add support for ensuring that nodes are not incomplete
llvm-svn: 6985
2003-06-29 22:36:15 +00:00
Chris Lattner
94b29bf96d Add support for "physical subtyping", which fixes:
DSGraph/2003-06-29-NodeCollapsing2.ll & DSGraph/PhysicalSubtyping.ll

llvm-svn: 6982
2003-06-29 20:27:45 +00:00
Chris Lattner
ed9302c854 Add print method to not get silly warning from analyze
llvm-svn: 6981
2003-06-29 20:27:16 +00:00
Chris Lattner
55099822d5 New pass which is useful for writing regression tests
llvm-svn: 6979
2003-06-29 18:17:07 +00:00
Chris Lattner
b932c794ee Expose must alias information for global variables, implementing: DSGraph/mustalias.ll
llvm-svn: 6973
2003-06-29 00:54:08 +00:00
Chris Lattner
d1ca41db68 If the alias analysis algorithm we are using can provide MUST alias information,
expose it directly as value numbering information

llvm-svn: 6972
2003-06-29 00:53:34 +00:00
Chris Lattner
7b5077de46 Count operands to instructions as well as just results. This allows for global variables to be checked as well
llvm-svn: 6970
2003-06-29 00:07:11 +00:00
Chris Lattner
1352a50cbb Propagate globals graph from the local to bu to td globals graphs. This
fixes bug: DSGraph/buglobals.ll

llvm-svn: 6947
2003-06-28 22:14:55 +00:00
Chris Lattner
801e22514d Drop references to globals who do exist in the globals graph, but are never
read or written to.  Keep track of how many times this happens.  This should
be good for deleting things like references to type information in C++ classes

llvm-svn: 6946
2003-06-28 22:10:58 +00:00
Chris Lattner
5f90382628 Avoid double negatives
llvm-svn: 6945
2003-06-28 21:58:28 +00:00