Commit Graph

372 Commits

Author SHA1 Message Date
Chris Lattner 31ba129cbe Add folding rules for mul X, 0 and mul X, 2
llvm-svn: 2417
2002-04-29 22:24:47 +00:00
Chris Lattner 7d3253876a Significantly clean up SCCP pass. Now the two classes are merged and in
an anonymous namespace where they belong.

llvm-svn: 2415
2002-04-29 21:26:08 +00:00
Chris Lattner 27eeecbb69 Range insertion now returns an iterator
llvm-svn: 2414
2002-04-29 21:25:34 +00:00
Chris Lattner 09bbb5c015 Remove unused files: This is the old induction varaible cannonicalization
pass built on top of interval analysis

llvm-svn: 2411
2002-04-29 20:18:00 +00:00
Chris Lattner 15e8f4c012 changes because iMemory.h no longer #includes DerivedTypes.h
This only requires Type.h anyway

llvm-svn: 2405
2002-04-29 18:48:30 +00:00
Chris Lattner d5a847057b Eliminate duplicate or unneccesary #include's
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner 2dfc667a7d Remove broken assertion.
llvm-svn: 2396
2002-04-29 16:20:25 +00:00
Chris Lattner 37104aace8 Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.

llvm-svn: 2395
2002-04-29 14:57:45 +00:00
Chris Lattner 8d843f6b77 More cleanups
llvm-svn: 2392
2002-04-29 01:58:47 +00:00
Chris Lattner fc1a433dae Code cleanups
llvm-svn: 2391
2002-04-29 01:22:55 +00:00
Chris Lattner f12cc842b3 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
llvm-svn: 2386
2002-04-28 21:27:06 +00:00
Chris Lattner ca14237696 Split ConstantVals.h into Constant.h and Constants.h
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner 78dd56fe62 Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
to the global namespace

llvm-svn: 2370
2002-04-28 16:21:30 +00:00
Chris Lattner 1467f64f01 Initial checkin of simple&fast SSA based GCSE algorithm
llvm-svn: 2338
2002-04-28 00:47:11 +00:00
Chris Lattner c8e665431b * Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
  - Method is now const
  - It now takes one AnalysisUsage object to fill in instead of 3 vectors
    to fill in
  - Pass's now specify which other passes they _preserve_ not which ones
    they modify (be conservative!)
  - A pass can specify that it preserves all analyses (because it never
    modifies the underlying program)
* s/Method/Function/g in other random places as well

llvm-svn: 2333
2002-04-27 06:56:12 +00:00
Chris Lattner 66cfaf1da2 Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null.

llvm-svn: 2332
2002-04-27 03:15:45 +00:00
Chris Lattner 2716b5e524 Change Constant::getNullConstant to Constant::getNullValue
llvm-svn: 2323
2002-04-27 02:25:14 +00:00
Chris Lattner 260ab20422 Significantly rework InstructionCombining to work better and to be cleaner.
We now use an InstVisitor to delegate to different cases that we are
interested in handling.  We also fix the FIXME's by adding users to the
worklist when appropriate.

llvm-svn: 2292
2002-04-18 17:39:14 +00:00
Chris Lattner 6e56079654 Convert SCCP over to use InstVisitor instead of hand crafted switch
llvm-svn: 2286
2002-04-18 15:13:15 +00:00
Chris Lattner 5873900709 GEP instructions can never be constant propogated.
llvm-svn: 2284
2002-04-18 14:44:13 +00:00
Chris Lattner f40379e403 Store instructions always return void, so they never get a name
llvm-svn: 2283
2002-04-18 14:43:54 +00:00
Chris Lattner 3a60d04722 Eliminate cast of same type instructions.
llvm-svn: 2251
2002-04-15 19:45:29 +00:00
Chris Lattner 2e9fa6d101 Move FunctionArgument out of iOther.h into Argument.h and rename class to
be 'Argument' instead of FunctionArgument.

llvm-svn: 2216
2002-04-09 19:48:49 +00:00
Chris Lattner 06be180225 Add explicit #includes of Function.h to make up for the removed #include
in iOther.h

llvm-svn: 2209
2002-04-09 19:08:28 +00:00
Chris Lattner d92b01c385 Add #includes to make up for #includes pruned out of header files.
llvm-svn: 2207
2002-04-09 18:37:46 +00:00
Chris Lattner f8e4dc33ab s/Method/Function
Remove extraneous #includes of llvm/Assembly/Writer

llvm-svn: 2178
2002-04-08 22:03:00 +00:00
Chris Lattner 65b529fe6d ConstantHandling moved into VMCore library
llvm-svn: 2165
2002-04-08 20:18:09 +00:00
Chris Lattner 62b7fd136e Change references to the Method class to be references to the Function
class.  The Method class is obsolete (renamed) and all references to it
are being converted over to Function.

llvm-svn: 2144
2002-04-07 20:49:59 +00:00
Chris Lattner c13563d5c0 Simplify code a lot by using the Module::getFunction & getOrInsertFunction
llvm-svn: 2028
2002-03-29 03:38:05 +00:00
Chris Lattner 57698e2c0b Change references from Method to Function
change references from MethodARgument to FunctionArgument

llvm-svn: 1991
2002-03-26 18:01:55 +00:00
Vikram S. Adve 1ee0658a07 Major overhaul to support arbitrary mixed array and structure indices.
Also moved to the Scalar/ directory and renamed to "MultiDim".

llvm-svn: 1961
2002-03-24 03:21:18 +00:00
Vikram S. Adve 5d218dff24 New pass to decompose multi-dimensional array references into
a sequence of 1-D references, using a sequence of getElementPtrs.

llvm-svn: 1948
2002-03-23 20:43:39 +00:00
Chris Lattner bee86626e1 Fix bug: test/Regression/Other/2002-03-11-InstCombineHang.ll
llvm-svn: 1864
2002-03-11 23:28:45 +00:00
Chris Lattner 477fe0845a Fix bug: test/Regression/Other/2002-03-11-ConstPropCrash.ll
llvm-svn: 1858
2002-03-11 22:11:07 +00:00
Chris Lattner 04805fa29c 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 83d485b310 * 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 60a6591d83 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 352151e222 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 d5d56780e2 Convert xforms over to new pass structure.
llvm-svn: 1605
2002-01-31 00:45:11 +00:00
Chris Lattner d5851db315 Remove extraneous #includes
llvm-svn: 1588
2002-01-26 22:47:32 +00:00
Chris Lattner 7209dc2446 Remove opt namespace
llvm-svn: 1587
2002-01-26 22:47:07 +00:00
Chris Lattner ccbd4e4643 Implement new DeadInstElmination pass
remove old comment

llvm-svn: 1555
2002-01-23 05:48:24 +00:00
Chris Lattner 70090079e7 Don't insert a useless cast
llvm-svn: 1527
2002-01-22 03:30:06 +00:00
Chris Lattner 3787ee6be6 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 4f0f09757d 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 d07471d6c3 LowerAllocations is really a BasicBlock pass. Make it so.
llvm-svn: 1521
2002-01-21 23:34:02 +00:00
Chris Lattner ee965abc36 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 0686e435d1 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 7f74a56e24 Changes to build successfully with GCC 3.02
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner ca081257e5 initial checkin
llvm-svn: 1480
2001-12-14 16:52:21 +00:00
Chris Lattner b3364fc169 Remove unsized array support
llvm-svn: 1466
2001-12-14 16:38:04 +00:00
Chris Lattner f5c6f65e7f 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 674394077f Actually return true when a change has been made
llvm-svn: 1425
2001-12-05 19:41:33 +00:00
Chris Lattner 25b151dfdf Fix a bug introduced by "internal linkage" work.
llvm-svn: 1415
2001-12-04 18:01:49 +00:00
Chris Lattner d23d752dc5 Fix bugs, don't do external methods which causes segv.
llvm-svn: 1414
2001-12-04 08:13:06 +00:00
Chris Lattner 91daaabb56 Implement induction variable simplification
llvm-svn: 1411
2001-12-04 04:32:29 +00:00
Chris Lattner 2413b160ec 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 3462ae3ad7 Rename ConstPoolVal -> Constant
Rename ConstPool*   -> Constant*
Rename ConstPoolVals.h -> ConstantVals.h

llvm-svn: 1407
2001-12-03 22:26:30 +00:00
Chris Lattner fb5ae02e1a 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 476e6df794 Initial checkin of indvar stuff
llvm-svn: 1404
2001-12-03 17:28:42 +00:00
Chris Lattner 5de2204fe8 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 c4ad64cb9c Misc cleanups
llvm-svn: 1377
2001-11-26 18:57:38 +00:00
Chris Lattner 1f86880af4 Expose constant propogation of an instruction in a clean way
llvm-svn: 1376
2001-11-26 18:57:12 +00:00
Chris Lattner 3b7199e36c Add #includes to enable buiding in Release mode
llvm-svn: 1174
2001-11-07 13:49:45 +00:00
Chris Lattner 033324fc0c Avoid making a broken transformation!
llvm-svn: 1115
2001-11-03 21:30:22 +00:00
Chris Lattner 7567f6c15f 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 04648a4cc6 Simplify DCE code a lot
llvm-svn: 1079
2001-11-01 05:55:29 +00:00
Chris Lattner 7e6a0d8c17 Use the correct prototype for malloc and free
llvm-svn: 1066
2001-10-31 06:36:23 +00:00
Chris Lattner 9db8b765cd Implemented constant propogation of cast instructions
llvm-svn: 1064
2001-10-31 05:07:57 +00:00
Chris Lattner 6fea0324d7 Convert to new simpler pass itf
llvm-svn: 880
2001-10-18 05:27:33 +00:00
Chris Lattner 5398a6eb6c Convert optimizations to the pass infrastructure
llvm-svn: 873
2001-10-18 01:32:34 +00:00
Chris Lattner 1bb5f8e4ee Add new Pass infrastructure and some examples
llvm-svn: 836
2001-10-15 17:31:51 +00:00
Chris Lattner f0b68888af Support the invoke instruction
llvm-svn: 765
2001-10-13 06:52:41 +00:00
Chris Lattner da55810666 Commit more code over to new cast style
llvm-svn: 697
2001-10-02 03:41:24 +00:00
Chris Lattner 3856934386 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 8f19112923 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 4b717c0edc Add support for new style casts
llvm-svn: 694
2001-10-01 16:18:37 +00:00
Chris Lattner ba1c1f2fb6 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 bb09a10929 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 b271be3185 ADCE is broken but at least we know why
llvm-svn: 656
2001-09-28 00:06:42 +00:00
Chris Lattner acfd27d502 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 d707ec62b6 Types and constants are wierd things in symbol tables now
llvm-svn: 457
2001-09-07 16:43:50 +00:00
Chris Lattner dae05dc937 * 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 6d7bce9f3c Constants are now global unique objects
llvm-svn: 454
2001-09-07 16:42:26 +00:00
Chris Lattner 07e158de3c * Eliminate constant pool dependancies:
* Eliminate DoRemoveUnusedConstants

llvm-svn: 453
2001-09-07 16:42:08 +00:00
Chris Lattner 030772df99 * 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 b62b602fe2 Enable the elimination of method prototypes that are not referenced
llvm-svn: 325
2001-07-28 17:51:49 +00:00
Chris Lattner e2472bbf6c Moved inline/llvm/Tools/* to include/llvm/Support/*
llvm-svn: 279
2001-07-23 17:46:59 +00:00
Chris Lattner 3e37ec7c0a Support external methods
llvm-svn: 200
2001-07-15 21:43:45 +00:00
Chris Lattner 5451c9e977 Add knowledge about the struct form of the GetElementPtr instruction
llvm-svn: 183
2001-07-14 06:11:51 +00:00
Chris Lattner 5b1200bf8e Remove dependency on the structure of ValueHolder.
llvm-svn: 182
2001-07-14 06:11:26 +00:00
Chris Lattner d6c5a769ea 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 31feae8550 Implement checking for new instructions
llvm-svn: 163
2001-07-08 21:18:49 +00:00
Chris Lattner fb8ed0cf3a Use the CDG to mark branches alive on demand.
llvm-svn: 159
2001-07-08 18:38:36 +00:00
Chris Lattner a682182f64 Neg instruction removed. Cast instruction implemented.
llvm-svn: 156
2001-07-08 04:57:15 +00:00
Chris Lattner b1ca9cbceb 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 a073acb22d 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 8024bde7c7 Update to include right file
llvm-svn: 138
2001-07-06 16:32:07 +00:00
Chris Lattner b28986ffc7 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 1960b3c6d2 Rename DoSparseConditionalConstantProp -> DoSCCP
llvm-svn: 117
2001-06-30 06:37:43 +00:00
Chris Lattner d42d492734 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 7ce8b17e60 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 10b250eb4d Added documentation. Constant fold terminators.
llvm-svn: 106
2001-06-29 23:56:23 +00:00
Chris Lattner 84f07396d3 * 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 e4abb60948 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 4cee8d8ffb 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 347389dae8 Add a new Sparse Conditional Constant Propogation pass
llvm-svn: 95
2001-06-27 23:38:11 +00:00
Chris Lattner 1a67fb8860 Misc cleanup
llvm-svn: 91
2001-06-27 23:36:09 +00:00
Chris Lattner f222bf33c3 * 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 dbdaaef7d5 Implement induction variable injection!
llvm-svn: 75
2001-06-25 07:32:19 +00:00
Chris Lattner c3a6f546de 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 f64a8936e5 #include a different header due to Intervals.h splitting up
llvm-svn: 63
2001-06-24 04:05:45 +00:00
Chris Lattner 4c4f178723 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 b20a15d334 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 778de94723 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 f86e38e452 Add capability to print a derived interval graph
llvm-svn: 42
2001-06-20 22:44:38 +00:00
Chris Lattner d286a997d3 Add a test case for interval code
llvm-svn: 36
2001-06-20 19:27:11 +00:00
Chris Lattner 5ba5f88c35 Updates to work with new cfg namespace
llvm-svn: 29
2001-06-13 19:55:22 +00:00
Chris Lattner 874ddadf72 Updates to support
* Changes in PHI node structure

llvm-svn: 25
2001-06-11 15:04:40 +00:00
Chris Lattner 7e0d6e05ac Updated to work with new CFG.h file.
llvm-svn: 15
2001-06-07 21:18:45 +00:00
Chris Lattner d821c2af37 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 2f7c963559 Initial revision
llvm-svn: 2
2001-06-06 20:29:01 +00:00