1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

5485 Commits

Author SHA1 Message Date
Chris Lattner
ad241cc3ea Fix test/Regression/Transforms/LevelRaise/2002-03-21-MissedRaise2.ll
llvm-svn: 1941
2002-03-21 22:39:59 +00:00
Chris Lattner
a80b65c208 Fix test/Regression/Other/2002-03-21-LevelRaiseMiss.ll
llvm-svn: 1933
2002-03-21 21:21:13 +00:00
Chris Lattner
c2b5cb5619 Make ConvertableToGEP handle cases where the user is indexing into the
first element of a structure type.  Before this would not be handled because
getStructOffset would either stop immediately (because StopEarly was true
and Offset = 0), or blast past the level we wanted.

Now ConvertableToGEP steps down through the type one level at a time, checking
the Offset and Scale conditions at each step

llvm-svn: 1931
2002-03-21 06:27:20 +00:00
Chris Lattner
559c71f6f4 Implement the new InsertInstBeforeInst function
llvm-svn: 1930
2002-03-21 06:24:00 +00:00
Chris Lattner
14fe793707 Fix the: test/Regression/Other/2002-03-20-LevelRaiseCrash.ll bug. It turned
out that almost always the result of the add was the same as the GEP that
would be generated.  In this case, however, it wasn't, so bad things happened.

llvm-svn: 1929
2002-03-21 06:22:23 +00:00
Chris Lattner
e9ec6058e4 Declare the new InsertInstBeforeInst function
llvm-svn: 1927
2002-03-21 06:15:53 +00:00
Chris Lattner
72367834b0 1. Fix bug test/Regression/Other/2002-03-20-LevelRaiseBadCodegen.ll
2. Allow negative scales in ConvertableToGEP, so that this loop from
   alloc_tree in the Olden health benchmark is correctly raised:

       for (i = 3; i >= 0; i--)
         fval[i] = alloc_tree(level - 1, label*4 + i + 1, new);

   Stepping through the array backwards caused a negative scale.

llvm-svn: 1922
2002-03-21 03:04:38 +00:00
Chris Lattner
db90f5f6ea Namespace qualify debugging code
llvm-svn: 1921
2002-03-21 03:02:07 +00:00
Vikram S. Adve
308f672ac8 Just a comment.
llvm-svn: 1908
2002-03-18 03:40:25 +00:00
Vikram S. Adve
5f910def00 New pass to decompose multi-dimensional array references into
a sequence of 1-D references, using a sequence of getElementPtrs.

llvm-svn: 1907
2002-03-18 03:39:09 +00:00
Chris Lattner
88ccdcd73e Remove code designed to compensate for a bug in GCC. The bug has since
been fixed.

llvm-svn: 1881
2002-03-15 20:35:21 +00:00
Chris Lattner
55aff5c433 Cleanup error message output a bit
llvm-svn: 1879
2002-03-15 20:21:29 +00:00
Chris Lattner
2ecc9a337c Fix bug: test/Regression/Other/2002-03-14-LevelRaiseHang.ll
llvm-svn: 1869
2002-03-14 16:37:04 +00:00
Chris Lattner
b0128957b1 Fix bug: test/Regression/Other/2002-03-11-InstCombineHang.ll
llvm-svn: 1864
2002-03-11 23:28:45 +00:00
Chris Lattner
ba4660ff3d update comments
llvm-svn: 1862
2002-03-11 22:21:04 +00:00
Chris Lattner
0f8d0257f9 * Fix bug: test/Regression/Other/2002-03-11-LevelRaiseIterInvalidate.ll
* Use more concise form of ReplaceInstWithInst to make code simpler
* Output nicer message for dead code eliminated when debugging

llvm-svn: 1861
2002-03-11 22:19:48 +00:00
Chris Lattner
889b1e5b00 Fix bug: test/Regression/Other/2002-03-11-ConstPropCrash.ll
llvm-svn: 1858
2002-03-11 22:11:07 +00:00
Chris Lattner
34eab0d19c Fix bug: test/Regression/Other/2002-03-11-LevelRaiseCalls.ll
llvm-svn: 1844
2002-03-11 17:27:34 +00:00
Chris Lattner
60cb774b66 We were not correctly burrowing down multiple levels to get to a leaf. Fix this now
llvm-svn: 1833
2002-03-07 21:18:00 +00:00
Chris Lattner
09424811e9 Support changing the pointer type of a store for the case where we are
storing into the first element of the structure type.

llvm-svn: 1832
2002-03-07 21:17:35 +00:00
Chris Lattner
962e012ad5 Take CallGraph out of the CFG namespace. It has nothing to do with CFGs
llvm-svn: 1820
2002-03-06 17:16:43 +00:00
Chris Lattner
e2383e8592 Change over to use new style pass mechanism, now passes only expose small
creation functions in their public header file, unless they can help it.

llvm-svn: 1816
2002-02-26 21:46:54 +00:00
Chris Lattner
1b9b843452 Move ProfilePaths class into ProfilePaths library, only expose a creation function
llvm-svn: 1812
2002-02-26 20:04:59 +00:00
Chris Lattner
6693158d06 Pass stuff by reference instead of by copy. Copying entire graphs seems like
a bad idea

llvm-svn: 1810
2002-02-26 19:49:45 +00:00
Chris Lattner
6145c5df9d Move processGraph down lower in the file so all of the forward declarations
can be eliminated.

llvm-svn: 1809
2002-02-26 19:43:49 +00:00
Chris Lattner
12573def64 * Changes to compile successfully with GCC 3.0
* Eliminated memory leak in processGraph
* Pass vectors by const reference to moveDummyCode instead of by copy

llvm-svn: 1808
2002-02-26 19:40:28 +00:00
Anand Shukla
3644255181 Makefile for profile-paths
llvm-svn: 1807
2002-02-26 19:36:43 +00:00
Anand Shukla
b9e67e748a Initial checkin: functions on Graph used for path profile pass
llvm-svn: 1806
2002-02-26 19:02:16 +00:00
Anand Shukla
d3ce435557 Initial checkin: instrument code to get path execution frequency
llvm-svn: 1805
2002-02-26 19:00:48 +00:00
Anand Shukla
d5d415f609 Initial checkin: helper file to insert instrumentation code along edges
llvm-svn: 1804
2002-02-26 18:59:46 +00:00
Anand Shukla
4f842414ae Initial check in of graph.cpp: implements graph interface used in path profiles
llvm-svn: 1803
2002-02-26 18:58:39 +00:00
Anand Shukla
d7f2b91c9b New makefile to include ProfilePaths dir
llvm-svn: 1799
2002-02-26 18:20:27 +00:00
Chris Lattner
11d689e99a When inlining basic blocks and instructions, give them a name!
llvm-svn: 1796
2002-02-25 00:31:02 +00:00
Chris Lattner
b4e6953fc0 Namespaces
llvm-svn: 1791
2002-02-24 23:03:09 +00:00
Chris Lattner
3d83ea4268 Handle more cases in the linker
llvm-svn: 1771
2002-02-18 19:05:15 +00:00
Chris Lattner
a87f4f1b13 Bug fix for test/Regression/Other/2002-02-14-LevelRaiseBadAssert.ll
llvm-svn: 1767
2002-02-14 22:21:40 +00:00
Chris Lattner
6ae007b43e Implement conversion of method pointer parameter in Call instruction
to clean up MST benchmark.

llvm-svn: 1763
2002-02-14 19:44:09 +00:00
Chris Lattner
1ae58c1268 * Check in fix for: llvm/test/Regression/Other/2002-02-14-LevelRaiseInstDelete.ll
* Minor reformatting.

llvm-svn: 1760
2002-02-14 18:55:22 +00:00
Chris Lattner
8e9be000a7 * Pull BasicBlock::pred_* and BasicBlock::succ_* out of BasicBlock.h and into
llvm/Support/CFG.h
* Make pred & succ iterators for intervals global functions
* Add #includes that are now neccesary because BasicBlock.h doesn't include
  InstrTypes.h anymore

llvm-svn: 1750
2002-02-12 22:39:50 +00:00
Chris Lattner
b0a2c5546b Method.h no longer includes BasicBlock.h
Method::inst_* is now in llvm/Support/InstIterator.h
GraphTraits specializations for BasicBlock and Methods are now in llvm/Support/CFG.h

llvm-svn: 1746
2002-02-12 21:07:25 +00:00
Chris Lattner
5276164ac4 Add neccesary #include
llvm-svn: 1742
2002-02-12 20:19:06 +00:00
Chris Lattner
20edcad40a I forgot to provide dominance frontier information. Now it's available.
Also add more comments.

llvm-svn: 1741
2002-02-12 18:27:41 +00:00
Chris Lattner
326b548cd4 Initial checkin of new memory -> register promotion pass
llvm-svn: 1739
2002-02-12 17:16:22 +00:00
Chris Lattner
43ed408912 General cleanup
llvm-svn: 1628
2002-02-01 04:53:48 +00:00
Chris Lattner
0d3eaa9575 Eliminate SimplifyCFG.h file, pull everything into the UnifyMethodExitNodes class
llvm-svn: 1613
2002-01-31 01:12:06 +00:00
Chris Lattner
dc15bb209d MethodPass's are now guaranteed to not be run on external methods!
llvm-svn: 1611
2002-01-31 00:51:24 +00:00
Chris Lattner
2e463f5dbe Convert xforms over to new pass structure.
llvm-svn: 1605
2002-01-31 00:45:11 +00:00
Chris Lattner
15c05486cc Convert analyses to new pass structure
llvm-svn: 1603
2002-01-31 00:42:27 +00:00
Chris Lattner
2cab187296 Remove extraneous #includes
llvm-svn: 1588
2002-01-26 22:47:32 +00:00
Chris Lattner
0fea9f487b Remove opt namespace
llvm-svn: 1587
2002-01-26 22:47:07 +00:00
Chris Lattner
71ee02c009 Implement new DeadInstElmination pass
remove old comment

llvm-svn: 1555
2002-01-23 05:48:24 +00:00
Chris Lattner
e12b9f9277 Don't insert a useless cast
llvm-svn: 1527
2002-01-22 03:30:06 +00:00
Chris Lattner
4cecd63a42 Rename LowerAllocations.h to ChangeAllocations.h since it now contains the
RaiseAllocations pass as well.

llvm-svn: 1525
2002-01-22 01:04:08 +00:00
Chris Lattner
83056c99ec Pull RaiseAllocations stuff out of the CleanGCC pass into it's own pass in
the ChangeAllocations.h header file.

llvm-svn: 1522
2002-01-22 00:13:51 +00:00
Chris Lattner
250d937680 LowerAllocations is really a BasicBlock pass. Make it so.
llvm-svn: 1521
2002-01-21 23:34:02 +00:00
Chris Lattner
4454cdc5c0 Move stuff out of the Optimizations directories into the appropriate Transforms
directories.  Eliminate the opt namespace.

llvm-svn: 1520
2002-01-21 23:17:48 +00:00
Chris Lattner
15f43a7af7 Elminate an unused variable
llvm-svn: 1518
2002-01-21 23:16:30 +00:00
Chris Lattner
bbb4dcdcd1 Rename SwapStructureContents -> IPO/SimpleStructMutation
Move MutateStructTypes.(cpp|h) -> IPO/MutateStructTypes.(cpp|h)

llvm-svn: 1510
2002-01-21 07:52:35 +00:00
Chris Lattner
2521ae1011 Implement a more powerful, simpler, pass system. This pass system can figure
out how to run a collection of passes optimially given their behaviors and
charactaristics.

Convert code to use it.

llvm-svn: 1507
2002-01-21 07:31:50 +00:00
Chris Lattner
3dc9a2a61f Changes to build successfully with GCC 3.02
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner
37ba4e2bb7 initial checkin
llvm-svn: 1480
2001-12-14 16:52:21 +00:00
Chris Lattner
98a6e485b0 * isFirstClassType is now provided by the Type class
* Add ReplaceInstWithInst

llvm-svn: 1468
2001-12-14 16:39:22 +00:00
Chris Lattner
553ec6b72f * add ReplaceInstWithInst
* Add support for pointer indexing
* Fix minor bugs that are majorly annoying

llvm-svn: 1467
2001-12-14 16:38:59 +00:00
Chris Lattner
9e6ccdd858 Remove unsized array support
llvm-svn: 1466
2001-12-14 16:38:04 +00:00
Chris Lattner
cd134c6891 * Support pointer indexing
* Unsized arrays are a thing of the past, remove DoInsertArrayCast family
* Remove cases were we would get into infinite loops because we would insert a cast
  which would then be removed, inserting a different cast, ad infinitum...
* Remove some code that should be redundant with ExprTypeConvert code

llvm-svn: 1465
2001-12-14 16:37:52 +00:00
Chris Lattner
1dc9744cc7 Many many changes and bugfixes:
* Remove support for unsized arrays
* Add pointer indexing support
* Allow more arbitrary malloc type changes (which are too generous currently
  and should be fixed in the future)
* Allow more and better conversions

llvm-svn: 1464
2001-12-14 16:35:53 +00:00
Chris Lattner
315df5b058 The proper prototype for malloc returns a pointer, not an unsized array
llvm-svn: 1463
2001-12-14 16:32:20 +00:00
Chris Lattner
6b2dc21b63 * Refactor trace values to work as a proper pass. Before it used to add
methods while the pass was running which was a no no.  Now it adds the
  printf method at pass initialization
* Revamp code to use printf calls instead of the old style print_<type>
  calls.
* Simplify code

llvm-svn: 1457
2001-12-14 16:26:05 +00:00
Chris Lattner
488f202019 Assertion could never fail because another one would in it's place. :)
llvm-svn: 1449
2001-12-13 00:45:40 +00:00
Chris Lattner
d76171a512 Implement more general conversions for getelementptr instructions
llvm-svn: 1432
2001-12-07 04:40:30 +00:00
Chris Lattner
9ae054fd1a Remove code that is superceeded by code in ExprTypeConvert.cpp
llvm-svn: 1431
2001-12-07 04:39:01 +00:00
Chris Lattner
e3b8fb7426 Don't insert scales of 1 :)
llvm-svn: 1430
2001-12-07 04:26:02 +00:00
Chris Lattner
e3b57cfe8f We can do cast-add elimination even on casts that reinterpret
llvm-svn: 1427
2001-12-06 18:06:13 +00:00
Chris Lattner
e23b6591f9 Fix bug that caused invalid transformations to be applied
llvm-svn: 1426
2001-12-06 18:05:55 +00:00
Chris Lattner
d89106f96b Actually return true when a change has been made
llvm-svn: 1425
2001-12-05 19:41:33 +00:00
Chris Lattner
8ca0f9efd6 Handle more complex array indexing expressions
llvm-svn: 1424
2001-12-05 19:41:16 +00:00
Chris Lattner
662a17ba5f Fix pessimizations on sized arrays
llvm-svn: 1423
2001-12-05 19:40:32 +00:00
Chris Lattner
57e64f9985 Fix a few bugs. Fix pessimization handling sized arrays
llvm-svn: 1422
2001-12-05 19:39:15 +00:00
Chris Lattner
d1a8ed7d8c Hrm, don't do debugging output when debugging is off. :(
llvm-svn: 1420
2001-12-05 06:40:17 +00:00
Chris Lattner
05fb7c607f Fixes to type conversion stuff to match induction variables more frequently
llvm-svn: 1417
2001-12-05 06:34:00 +00:00
Chris Lattner
7059b60173 Fix a bug introduced by "internal linkage" work.
llvm-svn: 1415
2001-12-04 18:01:49 +00:00
Chris Lattner
8ec5ceb110 Fix bugs, don't do external methods which causes segv.
llvm-svn: 1414
2001-12-04 08:13:06 +00:00
Chris Lattner
c1b018dcf4 Remove printouts
llvm-svn: 1413
2001-12-04 08:12:53 +00:00
Chris Lattner
bd85988c94 Implement induction variable simplification
llvm-svn: 1411
2001-12-04 04:32:29 +00:00
Chris Lattner
c4a5815033 Renamed inst_const_iterator -> const_inst_iterator
Renamed op_const_iterator   -> const_op_iterator
Renamed PointerType::getValueType() -> PointerType::getElementType()

llvm-svn: 1408
2001-12-04 00:03:30 +00:00
Chris Lattner
f6b7da2bb5 Rename ConstPoolVal -> Constant
Rename ConstPool*   -> Constant*
Rename ConstPoolVals.h -> ConstantVals.h

llvm-svn: 1407
2001-12-03 22:26:30 +00:00
Chris Lattner
bcf2df7058 Split the PHINode class out from the iOther.h file into the iPHINode.h file
llvm-svn: 1405
2001-12-03 18:02:31 +00:00
Chris Lattner
a337749b35 Initial checkin of indvar stuff
llvm-svn: 1404
2001-12-03 17:28:42 +00:00
Chris Lattner
cf360e3fd8 Compile the scalar directory
llvm-svn: 1403
2001-12-03 17:28:15 +00:00
Chris Lattner
463cc31132 Create a new #include "Support/..." directory structure to move things
from "llvm/Support/..." that are not llvm dependant.

Move files and fix #includes

llvm-svn: 1400
2001-11-27 00:03:19 +00:00
Chris Lattner
7b91b28853 Turn off debug info
llvm-svn: 1396
2001-11-26 19:36:58 +00:00
Chris Lattner
84d72f9596 Make strings be internal
llvm-svn: 1384
2001-11-26 19:14:33 +00:00
Chris Lattner
2459d65720 Remove debugging output
llvm-svn: 1383
2001-11-26 19:14:16 +00:00
Chris Lattner
c56685dca6 Support internal linkage
llvm-svn: 1382
2001-11-26 19:14:03 +00:00
Chris Lattner
5753d430a6 Build IPO directory
llvm-svn: 1381
2001-11-26 18:59:30 +00:00
Chris Lattner
dce8511222 Implement support for internal methods
llvm-svn: 1380
2001-11-26 18:59:18 +00:00
Chris Lattner
4d2046a71e Include const prop as part of -raise
llvm-svn: 1379
2001-11-26 18:58:55 +00:00
Chris Lattner
d10d3f1015 Misc cleanups
llvm-svn: 1377
2001-11-26 18:57:38 +00:00
Chris Lattner
8fd567523c Expose constant propogation of an instruction in a clean way
llvm-svn: 1376
2001-11-26 18:57:12 +00:00
Chris Lattner
118f8023f8 Implement DCE of global values
llvm-svn: 1360
2001-11-26 18:42:17 +00:00
Chris Lattner
e996313daa Support array indexing
llvm-svn: 1345
2001-11-26 17:00:43 +00:00
Chris Lattner
4694a03e25 Support Composite's, not just structs
llvm-svn: 1344
2001-11-26 17:00:13 +00:00
Chris Lattner
ab740485ab losslessCastableTypes is moved to Type class
getStructOffsetType supports array indexing

llvm-svn: 1343
2001-11-26 16:59:47 +00:00
Chris Lattner
c1f0351928 Support selectable structure transformations
llvm-svn: 1342
2001-11-26 16:59:10 +00:00
Chris Lattner
98a6ef2594 Support mutation of array indexing
llvm-svn: 1341
2001-11-26 16:58:33 +00:00
Chris Lattner
95b74bb24f Clean up code, implement array indexing stuff
llvm-svn: 1340
2001-11-26 16:58:14 +00:00
Chris Lattner
a9084f9746 Implement array indexing reverse engineering
llvm-svn: 1339
2001-11-26 16:57:31 +00:00
Vikram S. Adve
44df059d4d Print incoming arguments and return values.
llvm-svn: 1315
2001-11-15 15:00:16 +00:00
Chris Lattner
e19d5b4615 -cleangcc pass now remove type names that are never referenced and type names for pointers to primitive types.
llvm-svn: 1312
2001-11-15 04:34:46 +00:00
Chris Lattner
4046596beb Remove much cruft from the MemAccessInst instruction
llvm-svn: 1298
2001-11-14 11:27:58 +00:00
Chris Lattner
f45cb25619 Better heuristics for handling arrays
llvm-svn: 1296
2001-11-14 11:02:49 +00:00
Chris Lattner
71a0797f80 * Change ExpressionConvertableToType to more closely match map behavior of
ConvertExpressionToType
* Make ValueHandle's remove instruction from maps when they are deleted so that
  no false map hits occur if a subsequent instruction is allocated to the same
  space in memory.  This was a VERY VERY VERY EVIL NASTY BUG to track down. :-P

llvm-svn: 1288
2001-11-13 05:01:36 +00:00
Chris Lattner
3b2e10698f Avoid assertion failure when taking size of unsized array. Todo item herE
llvm-svn: 1286
2001-11-13 04:59:41 +00:00
Chris Lattner
184137a419 Fix minor bug
llvm-svn: 1273
2001-11-12 20:13:04 +00:00
Ruchira Sasanka
3e193c7709 Changed insert instructions only for CONSTANTS - back to original
llvm-svn: 1271
2001-11-12 19:32:04 +00:00
Chris Lattner
053906abc0 Initail checking of structure swapper
llvm-svn: 1248
2001-11-10 07:28:25 +00:00
Chris Lattner
79fd0836bb Initial checkin of structure mutator
llvm-svn: 1246
2001-11-10 07:26:31 +00:00
Chris Lattner
de13795a04 Remove false optimization that basically broke everything
llvm-svn: 1219
2001-11-09 01:08:10 +00:00
Chris Lattner
7969ed3025 * Add better caching of data to avoid silly recusions
* Only check to see if uses of instructions can be converted for expressions... so we don't look at all of the uses of a constant.  This was making the code unnecessarily conservative

llvm-svn: 1218
2001-11-08 22:06:31 +00:00
Chris Lattner
fdc70e08d0 Improve raising significantly
llvm-svn: 1214
2001-11-08 20:19:56 +00:00
Vikram S. Adve
a0da8fc9c5 Bug fix: cannot modify Phi operands while iterating over them!
llvm-svn: 1203
2001-11-08 05:25:33 +00:00
Chris Lattner
e33afc1d46 Add #includes to enable buiding in Release mode
llvm-svn: 1174
2001-11-07 13:49:45 +00:00
Chris Lattner
a688655cba Fix minor bug for shifts
llvm-svn: 1160
2001-11-06 21:51:48 +00:00
Chris Lattner
fcf608c1a7 Fix bugs
llvm-svn: 1152
2001-11-06 08:34:29 +00:00
Chris Lattner
da8737d88a Fix many bugs. Implement PHI transforms & other cycles
llvm-svn: 1151
2001-11-06 08:34:17 +00:00
Chris Lattner
688f944802 Fix bug with ADD nodes and malloc promotion
llvm-svn: 1144
2001-11-05 21:13:30 +00:00
Chris Lattner
d376cb5113 Don't print spurious linking warnings about methods that are never used.
Cleanup ExprTypeConvert a bit.

llvm-svn: 1141
2001-11-05 19:43:10 +00:00
Chris Lattner
a346367992 Use the expression map correctly.
llvm-svn: 1140
2001-11-05 18:30:53 +00:00
Chris Lattner
68180b2837 New file for expression tree conversion
llvm-svn: 1128
2001-11-04 23:24:20 +00:00
Chris Lattner
5d261d7928 Refactor code to share stuff
llvm-svn: 1127
2001-11-04 23:24:06 +00:00
Chris Lattner
f358050083 * Relax restriction that prevented malloc promotion in certain cases
llvm-svn: 1125
2001-11-04 22:11:10 +00:00
Chris Lattner
84715d0d46 * Disable debug output
* fix minor bug with taking datasize of unsized array type
* Insert code to support speculative changes later

llvm-svn: 1122
2001-11-04 21:32:11 +00:00
Chris Lattner
50508dde95 Convert backward conversion of expression trees into a new more powerful bidirectional approach. Add transforms for more instructions.
llvm-svn: 1121
2001-11-04 20:21:12 +00:00
Chris Lattner
ea63d43a07 Minor method rename
llvm-svn: 1119
2001-11-04 08:08:34 +00:00
Chris Lattner
1b0ded767a Add transformations for Load and GetElementPtr. Fix broken transform with shr.
llvm-svn: 1118
2001-11-04 07:42:17 +00:00
Chris Lattner
42cf9aaa3a Fix cast instructions that end up in bad places in GCC output
llvm-svn: 1117
2001-11-04 07:40:51 +00:00
Chris Lattner
82c7401f23 Avoid making a broken transformation!
llvm-svn: 1115
2001-11-03 21:30:22 +00:00
Chris Lattner
2b011e7b50 Add new cleanup pass:
//  1. PHI nodes with multiple entries for the same predecessor.  GCC sometimes
//     generates code that looks like this:
//
//  bb7:  br bool %cond1004, label %bb8, label %bb8
//  bb8: %reg119 = phi uint [ 0, %bb7 ], [ 1, %bb7 ]
//
//     which is completely illegal LLVM code.  To compensate for this, we insert
//     an extra basic block, and convert the code to look like this:
//
//  bb7: br bool %cond1004, label %bbX, label %bb8
//  bbX: br label bb8
//  bb8: %reg119 = phi uint [ 0, %bbX ], [ 1, %bb7 ]
//

llvm-svn: 1114
2001-11-03 21:08:59 +00:00
Chris Lattner
bcdf581aec * Export method to merge identically named methods
* Add code to fix PHI nodes that are missing arguments.  These PHI nodes can
  be generated by GCC if there is an uninitialized variable flowing into a merge
  point.  For example:

int foo(int y) {
  int X;
  if (y) X = 1;
  return X;
}

llvm-svn: 1110
2001-11-03 19:51:56 +00:00
Ruchira Sasanka
ee84dc6f89 Commented out code so that copies are inserted for all phi args
CahedCopyMap was disabled to insert phi elimination code for all phi args

llvm-svn: 1105
2001-11-03 17:09:59 +00:00
Chris Lattner
30050d95ae Changes to compile the TSP benchmark successfully. Favor warning instead of assertion failures.
llvm-svn: 1103
2001-11-03 10:04:22 +00:00
Chris Lattner
fb0626b9ed Add code to link method together with the same name if one is vararg and the other isn't.
This resolves definitions like this:
   %list * "foo"(...)
   %list * "foo"(int)

together which can often occur because C programmers don't put prototypes in like they should.  GRR

llvm-svn: 1102
2001-11-03 09:19:00 +00:00
Chris Lattner
b778b5bd90 Don't forget to link type names together too. Fix for Olden/mst benchmark
llvm-svn: 1094
2001-11-03 05:18:24 +00:00
Chris Lattner
b995f1c44f Add extra code for debugging linker problems
llvm-svn: 1091
2001-11-03 03:27:29 +00:00
Chris Lattner
7682955ac0 * Add comments for peepholes
* Implement new peephole:
     // Peephole optimize the following instructions:
     // %t1 = cast {<...>} * %StructPtr to <ty> *
     //
     // Into: %t2 = getelementptr {<...>} * %StructPtr, <0, 0, 0, ...>
     //       %t1 = cast <eltype> * %t1 to <ty> *

  This peephole eliminated 9 evil casts in the health benchmark, and
  completely turned the addList method around.  :)

llvm-svn: 1085
2001-11-01 17:05:27 +00:00
Chris Lattner
06e4402e71 Add DCE as integral part of the level raising to avoid processing instructions that are dead
llvm-svn: 1084
2001-11-01 07:00:51 +00:00
Chris Lattner
a621bac2a6 Expose the low level DCE mechanism to external users
Refactor code to support it

llvm-svn: 1083
2001-11-01 07:00:27 +00:00
Chris Lattner
8b30d77212 * Implement expression type conversion for constant values
* Fix a problem setting a name on a constant value that died because no symbol table was passed in
* Add some comments describing the passes
* Implement a new peephole:
     // Peephole optimize the following instructions:
     // %t = cast <T1>* %P to <T2> * ;; If T1 is losslessly convertable to T2
     // store <T2> %V, <T2>* %t
     //
     // Into:
     // %t = cast <T2> %V to <T1>
     // store <T1> %t2, <T1>* %P

llvm-svn: 1080
2001-11-01 05:57:59 +00:00
Chris Lattner
3b2c78da03 Simplify DCE code a lot
llvm-svn: 1079
2001-11-01 05:55:29 +00:00
Chris Lattner
261785f670 * Convert getelementptr/store pairs into a single store
* Convert getelementptr/load pairs into a single load

llvm-svn: 1075
2001-11-01 03:12:34 +00:00
Chris Lattner
01dc694896 Initial checkin of level raising code, after move and cleanup and expands from the opt directory
llvm-svn: 1074
2001-11-01 02:42:08 +00:00
Chris Lattner
cd8bcd33aa Propogate name to the malloc itself instead of to the cast
llvm-svn: 1071
2001-11-01 02:40:36 +00:00
Chris Lattner
986e273442 Use the correct prototype for malloc and free
llvm-svn: 1066
2001-10-31 06:36:23 +00:00
Chris Lattner
009d9de81c Implement code to convert %malloc and %free FUNCTION CALLS into the instruction equivalent
llvm-svn: 1065
2001-10-31 06:35:59 +00:00
Chris Lattner
91fc057638 Implemented constant propogation of cast instructions
llvm-svn: 1064
2001-10-31 05:07:57 +00:00
Chris Lattner
a9dacc1925 Initial version of GCC cleanup pass: just removes extraneous global symbol table entries for types
llvm-svn: 1062
2001-10-31 04:33:19 +00:00
Chris Lattner
98ce708757 Fix bug when inlining a method that refers to a global variable
llvm-svn: 1056
2001-10-31 02:27:26 +00:00
Chris Lattner
37164a34d5 Fix broken assertion. Didn't allow for pointer case
llvm-svn: 1034
2001-10-29 17:27:38 +00:00
Chris Lattner
d8958859d9 Pull method symbols over when linking. Otherwise the result of the link will appear stripped
llvm-svn: 1033
2001-10-29 16:55:41 +00:00
Vikram S. Adve
3af80d1a15 Make newlines be newlines! This should now work in both lli and native code.
llvm-svn: 1016
2001-10-28 22:44:02 +00:00
Chris Lattner
42883552ec Remove non linking related stuff
llvm-svn: 1015
2001-10-28 22:43:06 +00:00
Vikram S. Adve
2c1193dfdd Added name-mangling routines for future use.
llvm-svn: 1003
2001-10-28 21:38:02 +00:00
Vikram S. Adve
767c1505bc Use separate functions for printing values of each type.
Put trace code before condition-generating instruction in basic blocks
that end in a conditional branch.

llvm-svn: 1002
2001-10-28 21:37:25 +00:00
Chris Lattner
307595fd40 Fix problem linking in a method prototype when a method body exists
llvm-svn: 965
2001-10-23 20:43:42 +00:00
Chris Lattner
a83d6a2ee9 Refix bugs, stop using deprecated strstream header
llvm-svn: 898
2001-10-18 20:06:03 +00:00
Chris Lattner
5c29b9fafd Initial checkin
llvm-svn: 897
2001-10-18 20:05:37 +00:00
Vikram S. Adve
0b908c75a6 Only print values live at BB or method exit, and insert loads at each
BB exit to read and print values stored in that BB.   Note that only
these stored values are live at method exit!.  Also, print messages at
method entry and exit.

llvm-svn: 892
2001-10-18 18:16:11 +00:00
Vikram S. Adve
487da75338 Handle multiple exit blocks correctly.
Restore string variable cache.
Resurrect code to use formatted printing instead of PrintVal
but leave it turned off for now.

llvm-svn: 888
2001-10-18 13:49:22 +00:00
Chris Lattner
b0066e78ac Convert to be compatible with lli.
Need to eliminate duplicate \n entries

llvm-svn: 883
2001-10-18 06:03:05 +00:00
Chris Lattner
a8ed40026f Massive hacks to try to fix subtle logic bugs. I think it's all working now,
at least what used to.  I should disable method exit code completely because
it's broken (doesn't insert just post dominating values)

llvm-svn: 881
2001-10-18 05:28:08 +00:00
Chris Lattner
40372ce62d Convert to new simpler pass itf
llvm-svn: 880
2001-10-18 05:27:33 +00:00
Chris Lattner
4429216038 Convert optimizations to the pass infrastructure
llvm-svn: 873
2001-10-18 01:32:34 +00:00
Chris Lattner
9bfad5b7b1 Add new Pass infrastructure and some examples
llvm-svn: 836
2001-10-15 17:31:51 +00:00
Chris Lattner
fd1ab08cba Rename ConstPoolPointerReference to ConstPoolPointerRef - My fingers get tired typing that much
llvm-svn: 822
2001-10-15 13:21:42 +00:00
Chris Lattner
9754557583 * getExitNode() doesn't exist in method anymore
* Make local functions static

llvm-svn: 820
2001-10-15 13:07:21 +00:00
Vikram S. Adve
4ab6d41945 Added Instrumentation subdirectory.
llvm-svn: 819
2001-10-15 12:01:05 +00:00
Chris Lattner
9c144fbb72 Implement linking of global variable constant references
llvm-svn: 817
2001-10-15 03:12:52 +00:00
Chris Lattner
8dc436c6db Minor cleanup
llvm-svn: 812
2001-10-14 23:29:30 +00:00
Chris Lattner
9f4d1bcb25 Implement linker. It's 95% working now.
llvm-svn: 810
2001-10-14 23:29:15 +00:00
Vikram S. Adve
8d61ebc675 Insert code to trace values at basic block and method exits.
Current version does not check for liveness.

llvm-svn: 800
2001-10-14 23:18:45 +00:00
Chris Lattner
110d64205d Check in makefile
llvm-svn: 788
2001-10-13 16:57:03 +00:00
Chris Lattner
9d7255f19c Start of a linker
llvm-svn: 775
2001-10-13 07:03:50 +00:00
Chris Lattner
4c81efaf8e Support the invoke instruction
llvm-svn: 765
2001-10-13 06:52:41 +00:00
Chris Lattner
8314c1f1bc Support indirect calls
llvm-svn: 764
2001-10-13 06:52:31 +00:00
Chris Lattner
08b1dde37e Commit more code over to new cast style
llvm-svn: 697
2001-10-02 03:41:24 +00:00
Chris Lattner
ad1b0a1a83 Convert more code to use new style casts
Eliminate old style casts from value.h

llvm-svn: 696
2001-10-01 20:11:19 +00:00
Chris Lattner
4c684cde80 Add more support for new style casts
Convert more code to use them

llvm-svn: 695
2001-10-01 18:26:53 +00:00
Chris Lattner
43781f1f96 Add support for new style casts
llvm-svn: 694
2001-10-01 16:18:37 +00:00
Chris Lattner
345daca305 Pull predecessor and successor iterators out of the CFG*.h files, and plop them into
the BasicBlock class where they should be.  pred_begin/pred_end become methods on BasicBlock,
and the cfg namespace isn't used anymore.

llvm-svn: 691
2001-10-01 13:19:53 +00:00
Chris Lattner
9b45b18404 Pull iterators out of CFG.h and CFGdecls and put them in Support directory
llvm-svn: 664
2001-09-28 22:56:31 +00:00
Chris Lattner
2fc6c49ee7 ADCE is broken but at least we know why
llvm-svn: 656
2001-09-28 00:06:42 +00:00
Chris Lattner
c583ae1a1a Make ADCE more robust, it still has problems, but it's getting closer
llvm-svn: 521
2001-09-09 22:26:47 +00:00
Chris Lattner
e299925703 Types and constants are wierd things in symbol tables now
llvm-svn: 457
2001-09-07 16:43:50 +00:00
Chris Lattner
b82abeff92 * Eliminate reference to ConstantPool class
* Constants are global objects that are not allocated or freed

llvm-svn: 456
2001-09-07 16:43:22 +00:00
Chris Lattner
797730ca28 Constant pool is dead
llvm-svn: 455
2001-09-07 16:42:51 +00:00
Chris Lattner
4fc1bcadd9 Constants are now global unique objects
llvm-svn: 454
2001-09-07 16:42:26 +00:00
Chris Lattner
eaf4551d57 * Eliminate constant pool dependancies:
* Eliminate DoRemoveUnusedConstants

llvm-svn: 453
2001-09-07 16:42:08 +00:00
Chris Lattner
6a211421bf * Supoprt global constants
* Remove support for local constant pools
* Eliminate constant pool merging method, which is no longer neccesary
* Disable invalid optimization (todo: fix it)

llvm-svn: 452
2001-09-07 16:41:30 +00:00
Chris Lattner
a4b4e46e90 Enable the elimination of method prototypes that are not referenced
llvm-svn: 325
2001-07-28 17:51:49 +00:00
Chris Lattner
ff6c44f04f Moved inline/llvm/Tools/* to include/llvm/Support/*
llvm-svn: 279
2001-07-23 17:46:59 +00:00
Chris Lattner
11f4097f50 Support external methods
llvm-svn: 200
2001-07-15 21:43:45 +00:00
Chris Lattner
a969eb234b Add knowledge about the struct form of the GetElementPtr instruction
llvm-svn: 183
2001-07-14 06:11:51 +00:00
Chris Lattner
10ff90d678 Remove dependency on the structure of ValueHolder.
llvm-svn: 182
2001-07-14 06:11:26 +00:00
Chris Lattner
80c9d7c165 Don't clean out the type plane of the constant pool... this is a hack. FIXME
llvm-svn: 172
2001-07-09 19:38:52 +00:00
Chris Lattner
3b66715c67 Implement checking for new instructions
llvm-svn: 163
2001-07-08 21:18:49 +00:00
Chris Lattner
acc906f1de Use the CDG to mark branches alive on demand.
llvm-svn: 159
2001-07-08 18:38:36 +00:00
Chris Lattner
7a7ddef47e Neg instruction removed. Cast instruction implemented.
llvm-svn: 156
2001-07-08 04:57:15 +00:00
Chris Lattner
c00392210d Broad superficial changes:
* Renamed getOpcode to getOpcodeName
* Changed getOpcodeName to return a const char * instead of string
* Added a getOpcode method to replace getInstType
* Changed code to use getOpcode instead of getInstType

llvm-svn: 152
2001-07-07 19:24:15 +00:00
Chris Lattner
6f7587e4d3 Changed the fundemental architecture of Operands for Instructions. Now
Operands are maintained as a vector<Use> in the User class, and operator
iterators are provided as before.  Getting an operand no longer requires
a virtual function call.

WARNING: getOperand(x) where x >= getNumOperands() will now assert instead
of returning null!

llvm-svn: 149
2001-07-07 08:36:50 +00:00
Chris Lattner
dab02ca9e0 Add method to unify all exit nodes of a method
llvm-svn: 143
2001-07-06 16:58:36 +00:00
Chris Lattner
e28135f621 Update to include right file
llvm-svn: 138
2001-07-06 16:32:07 +00:00
Chris Lattner
d4e8817fd9 Initial checkin. Should print dead instructions, except it doesn't do
control dependencies.  :(

llvm-svn: 119
2001-06-30 06:39:11 +00:00
Chris Lattner
c4e564a84c Rename DoSparseConditionalConstantProp -> DoSCCP
llvm-svn: 117
2001-06-30 06:37:43 +00:00
Chris Lattner
0815f96a2f Optimizations got their own header files
Optimizations now live in the 'opt' namespace
include/llvm/Opt was renamed include/llvm/Optimizations

llvm-svn: 113
2001-06-30 04:36:40 +00:00
Chris Lattner
fd733edaa7 Export ConstantFoldTerminator, allow it to fold conditional branches to
the same label.

llvm-svn: 107
2001-06-29 23:56:58 +00:00
Chris Lattner
81bbbcfe1f Added documentation. Constant fold terminators.
llvm-svn: 106
2001-06-29 23:56:23 +00:00
Chris Lattner
e005dc792d * Factored RemovePredecessorFromBlock into BasicBlock::removePredecessor
* Avoid messing around with this case:
  br label %A
%A:  br label %A
* Enable optimizations that are correct now.

llvm-svn: 102
2001-06-29 05:24:28 +00:00
Chris Lattner
f5b28afa04 We need to make sure to remove PHI nodes in the successor that cannot be
executed when removing branch dest.

llvm-svn: 101
2001-06-29 05:23:10 +00:00
Chris Lattner
d616582a7a Miscellaneous cleanups:
* Convert post to pre-increment for for loops
  * Use generic programming more
  * Use new Value::cast* instructions
  * Use new Module, Method, & BasicBlock forwarding methods
  * Use new facilities in STLExtras.h
  * Use new Instruction::isPHINode() method

llvm-svn: 96
2001-06-27 23:41:11 +00:00
Chris Lattner
0a37aa1884 Add a new Sparse Conditional Constant Propogation pass
llvm-svn: 95
2001-06-27 23:38:11 +00:00
Chris Lattner
87259414f9 Misc cleanup
llvm-svn: 91
2001-06-27 23:36:09 +00:00
Chris Lattner
c9c6ca507f * Expose DoConstantPoolMerging
* Cleanups (post->pre increment, new cleaner API, etc)
* Moved stuff into ConstantHandling.h

llvm-svn: 90
2001-06-27 23:35:26 +00:00
Chris Lattner
725a64614c Implement induction variable injection!
llvm-svn: 75
2001-06-25 07:32:19 +00:00
Chris Lattner
105f271c39 A silly stupid test of the loop depth calculator was added. REMOVE in the
future.

llvm-svn: 72
2001-06-25 03:55:37 +00:00
Chris Lattner
89a7836d09 #include a different header due to Intervals.h splitting up
llvm-svn: 63
2001-06-24 04:05:45 +00:00
Chris Lattner
4ebfee6ae4 Implement a lot more functionality. Now loop invariant and linear
induction variables are correctly identified.

llvm-svn: 57
2001-06-22 02:24:38 +00:00
Chris Lattner
b87e26435e Moved printing code to the Assembly/Writer library.
Code now detects looping intervals

llvm-svn: 52
2001-06-21 05:27:22 +00:00
Chris Lattner
5d07eeb20a Get rid of a silly printout that isn't needed right now
llvm-svn: 45
2001-06-20 23:09:39 +00:00
Chris Lattner
3f0d248cea Add capability to print a derived interval graph
llvm-svn: 42
2001-06-20 22:44:38 +00:00
Chris Lattner
30200aa462 Add a test case for interval code
llvm-svn: 36
2001-06-20 19:27:11 +00:00
Chris Lattner
469c33ad89 Updates to work with new cfg namespace
llvm-svn: 29
2001-06-13 19:55:22 +00:00
Chris Lattner
a6d2f96bdb Updates to support
* Changes in PHI node structure

llvm-svn: 25
2001-06-11 15:04:40 +00:00
Chris Lattner
5975876e9b Updated to work with new CFG.h file.
llvm-svn: 15
2001-06-07 21:18:45 +00:00
Chris Lattner
68035d3c02 Significant rework. DCE is still not done (see #ifdef'd out parts)
but at least the stuff that is checked in, now works.

llvm-svn: 10
2001-06-07 16:59:26 +00:00
Chris Lattner
e6b9b382e2 Initial revision
llvm-svn: 2
2001-06-06 20:29:01 +00:00