Commit Graph

1170 Commits

Author SHA1 Message Date
Chris Lattner 04efa4b155 Add new function
llvm-svn: 10529
2003-12-19 05:56:28 +00:00
Chris Lattner a29600046d Minor cleanups and simplifications
llvm-svn: 10127
2003-11-21 16:52:05 +00:00
Chris Lattner 2af517281d Start using the nicer terminator auto-insertion API
llvm-svn: 10111
2003-11-20 18:25:24 +00:00
Chris Lattner 63a0ccff44 Spew symbolic types!
llvm-svn: 10110
2003-11-20 18:23:14 +00:00
Brian Gaeke 960707c335 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 1e6d3053f2 Reorganize code for locality, improve comments
llvm-svn: 9857
2003-11-10 04:42:42 +00:00
Chris Lattner 4474336166 Adjust to new critical edge interface
llvm-svn: 9853
2003-11-10 04:10:50 +00:00
Chris Lattner 38cd27e450 Various cleanups and efficiency improvements
llvm-svn: 9753
2003-11-06 19:46:29 +00:00
Chris Lattner 8055fb3afa Yet more fixes for constant expr shifts
llvm-svn: 9739
2003-11-05 20:43:58 +00:00
Chris Lattner ba55bd37fe Further fixes for PR93
llvm-svn: 9738
2003-11-05 20:37:01 +00:00
John Criswell 81587e798a Checking in Chris's suggestions:
Added assert() to ensure symbol table is well formed.
Added code to remember the value that was found; resolving types can change
the symbol table and invalidate the value of the iterator.
Added comments to the ResolveTypes() function (mainly for my own benefit).
Please feel free to correct the comments if they are not accurate.

llvm-svn: 9693
2003-11-04 15:22:26 +00:00
Chris Lattner b727fb2663 Fix test: Linker/2003-10-27-LinkOncePromote.ll
Fix PR58

llvm-svn: 9530
2003-10-27 16:39:39 +00:00
Chris Lattner d9f4ffdf5e Get the list of PHI node values before the basic block is split. Also, add
PHI node entries for unwind instructions just like for call instructions which
became invokes!  This fixes PR57, tested by
Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll

llvm-svn: 9526
2003-10-27 05:33:09 +00:00
Chris Lattner 4f2581f828 Fix bug: Linker/2003-10-21-ConflictingTypesTolerance.ll
llvm-svn: 9357
2003-10-21 22:46:38 +00:00
Chris Lattner 9bc22b7439 Fix message to make more sense and confuse Chris less
llvm-svn: 9354
2003-10-21 21:52:20 +00:00
John Criswell 29265fe981 Added LLVM copyright header.
llvm-svn: 9321
2003-10-21 15:17:13 +00:00
John Criswell 4436c49787 Added LLVM copyright notice to Makefiles.
llvm-svn: 9312
2003-10-20 22:26:57 +00:00
John Criswell 482202a601 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 b32f5748b7 Fix PR#50
llvm-svn: 9227
2003-10-18 06:14:59 +00:00
Chris Lattner 068ad84038 Add support for 'weak' linkage.
llvm-svn: 9171
2003-10-16 18:29:00 +00:00
Chris Lattner f77a856f3b Cleanup
llvm-svn: 9133
2003-10-15 16:42:21 +00:00
Chris Lattner b4778c73c9 Do not move variable sized allocations to the top of the caller, which might
break dominance relationships, and is otherwise bad.  This fixes bug:
Inline/2003-10-13-AllocaDominanceProblem.ll.  This also fixes miscompilation
of 3 176.gcc source files (reload1.c, global.c, flow.c)

llvm-svn: 9109
2003-10-14 01:11:07 +00:00
Chris Lattner 72272a70b8 Rename loop preheaders pass to loop simplify
llvm-svn: 9061
2003-10-12 21:52:28 +00:00
Misha Brukman 8b2bd4ed47 Fix spelling.
llvm-svn: 9027
2003-10-10 17:57:28 +00:00
Chris Lattner 6aa34b0d0b Avoid doing pointless work. Amazingly, this makes us go faster.
Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s.

In release mode, it went from taking 25.8741s to taking 11.5712s.

This also fixes a FIXME.

llvm-svn: 8890
2003-10-06 15:23:43 +00:00
Chris Lattner c30f22f57c This changes the PromoteMemToReg function to create "pruned" SSA form, not
"minimal" SSA form (in other words, it doesn't insert dead PHIs).  This
speeds up the mem2reg pass very significantly because it doesn't have to
do a lot of frivolous work in many common cases.

In the 252.eon function I have been playing with, this doesn't even insert
the 120 PHI nodes that it used to which were trivially dead (in the process
of promoting 356 alloca instructions overall).  This speeds up the mem2reg
pass from 1.2459s to 0.1284s.  More significantly, the DCE pass used to take
2.4138s to remove the 120 dead PHI nodes that mem2reg constructed, now it
takes 0.0134s (which is the time to scan the function and decide that there
is nothing dead).  So overall, on this one function, we speed things up a
total of 3.5179s, which is a 24.8x speedup!  :)

This change is tested by the Mem2Reg/2003-10-05-DeadPHIInsertion.ll test,
which now passes.

llvm-svn: 8884
2003-10-05 22:19:20 +00:00
Chris Lattner a906bacfdd Change the interface to PromoteMemToReg to also take a DominatorTree
llvm-svn: 8883
2003-10-05 21:20:13 +00:00
Chris Lattner 8047152977 Speed up the mem2reg transform for allocas which are only read/written in a single
basic block.  This is amazingly common in code generated by the C/C++ front-ends.
This change makes it not have to insert ANY phi nodes, whereas before it would insert
a ton of dead ones which DCE would have to clean up.

Thus, this fix improves compile-time performance of these trivial allocas in two ways:
  1. It doesn't have to do the walking and book-keeping for renaming
  2. It does not insert dead phi nodes for them which would have to
     subsequently be cleaned up.

On my favorite testcase from 252.eon, this special case handles 305 out of
356 promoted allocas in the function.  It speeds up the mem2reg pass from 7.5256s
to 1.2505s.  It inserts 677 fewer dead PHI nodes, which speeds up a subsequent
-dce pass from 18.7524s to 2.4806s.

There are still 120 trivially dead PHI nodes being inserted for variables used
in multiple basic blocks, but they are not handled by this patch.

llvm-svn: 8881
2003-10-05 20:54:03 +00:00
Chris Lattner a5721d3d03 The first PHI node may be null, scan for the first non-null one
llvm-svn: 8865
2003-10-05 05:34:39 +00:00
Chris Lattner 203bc011e5 The VersionNumbers vector is only used during PHI placement. Turn it into an argument, allowing us to get rid of the vector.
llvm-svn: 8864
2003-10-05 04:33:22 +00:00
Chris Lattner 7d9692df22 * Update file header comment
*** Revamp the code which handled unreachable code in the function.  Now the
    code is much more efficient for high-degree basic blocks, such as those
    that occur in the 252.eon SPEC benchmark.

For the interested, the time to promote a SINGLE alloca in _ZN7mrScene4ReadERSi
function used to be > 3.5s.  Now it is < .075s.  The function has a LOT of
allocas in it, so it appeared to be infinite looping, this should make it much
nicer.  :)

llvm-svn: 8863
2003-10-05 04:26:39 +00:00
Chris Lattner db1f81bcb5 Simplify the loop a bit
llvm-svn: 8862
2003-10-05 03:45:44 +00:00
Chris Lattner 2093012a03 There is no need for separate WriteSets and PhiNodeBlocks lists. It is just a
work-list of value definitions.  This allows elimination of the explicit
'iterative' step of the algorithm, and also reuses temporary memory better.

llvm-svn: 8861
2003-10-05 03:39:10 +00:00
Chris Lattner 9408b1e8b9 The PhiNodes 2D vector is only used during PHI node placement. It doesn't
need to be an instance variable!

llvm-svn: 8860
2003-10-05 03:26:25 +00:00
Chris Lattner 417bc173ee * Document instance vars better
* Fuse two parallel loops
* Use a more specific type for AllocaLookup

llvm-svn: 8859
2003-10-05 03:16:07 +00:00
Chris Lattner c360f135be Two small cleanups/speedups:
* Do not insert a new entry into NewPhiNodes during the rename pass if there are no PHIs in a block.
 * Do not compute WriteSets in parallel

llvm-svn: 8858
2003-10-05 02:37:36 +00:00
Chris Lattner c3d57b5923 * Minor cleanups
* Eliminate the KillList instance variable, instead, just delete loads and
  stores as they are "renamed", and delete allocas when they are done
* Make the 'visited' set an instance variable to avoid passing it on the stack.

llvm-svn: 8857
2003-10-05 01:52:53 +00:00
Chris Lattner 50ac360a34 Fix bugs in the last change
llvm-svn: 8667
2003-09-22 23:30:59 +00:00
Chris Lattner d6002b8e15 Fix bug: Inline/2003-09-22-PHINodesInNormalInvokeDest.ll
llvm-svn: 8666
2003-09-22 22:35:39 +00:00
Chris Lattner 0178d262e6 Fix bug: Inline/2003-09-22-PHINodesInExceptionDest.ll
... by making sure to update PHI nodes to take into consideration the
extra edges we get if we inline a call instruction through an invoke.

llvm-svn: 8664
2003-09-22 21:59:27 +00:00
Chris Lattner 4413e4362c Minor cleanups, no functional changes
Rename Function::getEntryNode -> getEntryBlock

llvm-svn: 8623
2003-09-20 14:36:23 +00:00
Chris Lattner 7f89ea75e1 Fix bug: Inline/2003-09-14-InlineValue.ll
llvm-svn: 8514
2003-09-15 02:10:16 +00:00
Chris Lattner f941396cce Expand the pass to unify all of the unwind blocks as well
llvm-svn: 8456
2003-09-10 20:34:51 +00:00
Chris Lattner 04ecefe232 Eliminate support for the llvm.unwind intrinisic, using the Unwind instruction instead
llvm-svn: 8411
2003-09-08 19:44:26 +00:00
Chris Lattner caa12cfa75 Should invokify is always true
llvm-svn: 8409
2003-09-08 19:00:30 +00:00
Chris Lattner 66cc0141b0 Fix bug where we considered function types equivalent even if they had differing numbers of arguments
llvm-svn: 8178
2003-08-28 16:42:50 +00:00
Chris Lattner be8d6816d0 Remove special casing
llvm-svn: 8144
2003-08-25 22:34:15 +00:00
Chris Lattner 4f05103ad2 Fix bug: Linker/2003-08-23-GlobalVarLinking.ll
llvm-svn: 8130
2003-08-24 19:30:20 +00:00
Chris Lattner 3ba0f88a0a Implement: Linker/2003-08-24-InheritPtrSize.ll
llvm-svn: 8129
2003-08-24 19:26:42 +00:00
Chris Lattner 3f5823f131 Implement SimplifyCFG/InvokeEliminate.ll
llvm-svn: 8126
2003-08-24 18:36:16 +00:00
Chris Lattner 0f98032fd8 rethrow is really the language independent primitive here. "throw" can be written
in terms of it and llvm.exc.setcurrent.
Rework the intrinsics.

llvm-svn: 8111
2003-08-24 12:24:11 +00:00
Chris Lattner 0cc265e6bf *** Implement inlining of Invoke instructions!
llvm-svn: 8106
2003-08-24 06:59:16 +00:00
Chris Lattner fc3fe5cd75 Implement: Inline/cfg_preserve_test.ll
llvm-svn: 8099
2003-08-24 04:06:56 +00:00
Chris Lattner c54d608377 Implement SimplifyCFG/2003-08-17-FoldSwitch.ll:test5
llvm-svn: 8093
2003-08-23 23:18:19 +00:00
Chris Lattner 02da0ef418 Do not consider any types that exist in the global symbol table!
llvm-svn: 8084
2003-08-23 21:32:24 +00:00
Chris Lattner f38c0483ba Fix bug: Linker/2003-08-23-RecursiveOpaqueTypeResolve.ll
llvm-svn: 8083
2003-08-23 21:25:54 +00:00
Chris Lattner 31de50ab44 Implement Linker/2003-08-23-GlobalVarLinking.ll, which should fix 176.gcc
llvm-svn: 8080
2003-08-23 20:31:10 +00:00
Chris Lattner 954a6095d7 Fix typeo
llvm-svn: 8059
2003-08-22 20:16:48 +00:00
Chris Lattner 1a8a45977a The process of linking types can cause their addresses to become invalid. For this reason, we must use TypeHandles!
llvm-svn: 8057
2003-08-22 19:12:55 +00:00
Chris Lattner f872d41f55 Implement Linker/2003-08-20-OpaqueTypeResolve.ll
Hopefully this will fix the 176.gcc spec test as well.

llvm-svn: 8051
2003-08-22 06:07:12 +00:00
Misha Brukman 7eb05a170a Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Chris Lattner 821deeeffa Implement folding of switch instructions.
Implements SimplifyCFG/2003-08-17-FoldSwitch.ll

llvm-svn: 7923
2003-08-17 20:21:14 +00:00
Chris Lattner 031340a551 Fix bug: SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
llvm-svn: 7921
2003-08-17 19:41:53 +00:00
Chris Lattner 4b7e3364c7 The fixme is irrelevant: if that happens, the LLVM bytecode is malformed.
This fixes testcase: SimplifyCFG/2003-08-17-BranchFold.ll

llvm-svn: 7919
2003-08-17 19:34:55 +00:00
Chris Lattner edc8c54e16 Fix bug: SimplifyCFG/2003-08-05-InvokeCrash.ll
Fix bug: SimplifyCFG/2003-08-05-MishandleInvoke.ll

llvm-svn: 7599
2003-08-05 16:27:44 +00:00
Tanya Lattner e2d74c1c81 Fixed comment width, changed arg to be const, fixed indentation, removed unnecessary includes.
llvm-svn: 6476
2003-05-31 20:01:37 +00:00
Tanya Lattner 71e56e278c Added the CloneTrace function which clones traces. It takes a vector of basic blocks, removes
internal phi nodes, and returns a new vector of basic blocks.

llvm-svn: 6431
2003-05-30 15:50:18 +00:00
Chris Lattner f789f29aaa Eliminate unnecessary ->get calls that are now automatically handled.
llvm-svn: 6397
2003-05-29 15:12:27 +00:00
Chris Lattner 530d4bffbf * Separate all of the grunt work of inlining out into the Utils library.
* Make the function inliner _significantly_ smarter.  :)

llvm-svn: 6396
2003-05-29 15:11:31 +00:00
Chris Lattner 8d0a71aff8 Remove using declarations
llvm-svn: 6306
2003-05-22 22:00:07 +00:00
Misha Brukman 373086db75 Hopefully, the final fix for `[Pp]ropogate'.
llvm-svn: 6251
2003-05-20 21:01:22 +00:00
Chris Lattner 25fa9718cb Fix Bug: Linker/2003-05-15-TypeProblem.ll
llvm-svn: 6225
2003-05-15 16:30:55 +00:00
Chris Lattner 58ea8ff469 Fix major problem with appending linkage changes
llvm-svn: 6185
2003-05-14 12:11:51 +00:00
Chris Lattner f779becc5a Implement linkage of appending global variables!
llvm-svn: 6178
2003-05-13 21:33:43 +00:00
Chris Lattner 3a2fe67908 Fix bug: mem2reg/2003-04-24-MultipleIdenticalSuccessors.ll
llvm-svn: 5919
2003-04-25 00:54:58 +00:00
Chris Lattner 364437e6a3 Fix iterator invalidation problem
llvm-svn: 5895
2003-04-24 17:52:20 +00:00
Chris Lattner b57ed83e28 Make sure that the cloned module retains the type symbol table entries!
llvm-svn: 5894
2003-04-24 17:15:33 +00:00
Chris Lattner 0aebf8f80a Make sure to preserve endiannes and pointer size when cloning modules!
llvm-svn: 5892
2003-04-24 15:54:40 +00:00
Chris Lattner 21a8e8a2c9 Fix Bug: Linker/2003-04-23-LinkOnceLost.ll
llvm-svn: 5879
2003-04-23 18:38:39 +00:00
Chris Lattner 889f620841 Remove unnecesary &*'s
llvm-svn: 5872
2003-04-23 16:37:45 +00:00
Chris Lattner c6ce4dafbe Add warning when linking modules with disagreeing target properties
llvm-svn: 5845
2003-04-22 19:13:20 +00:00
Chris Lattner d36ad926f2 Preserve the new moduleID field
llvm-svn: 5835
2003-04-22 18:02:26 +00:00
Chris Lattner 4522f446c1 Fix bug: 2003-01-30-LinkerRename.ll
llvm-svn: 5828
2003-04-21 21:15:04 +00:00
Chris Lattner 4adb8536d9 Fix linking a function with qualifiers to a external function declaration:
Fixed bug: Linker/2003-04-21-Linkage.ll

llvm-svn: 5827
2003-04-21 21:07:05 +00:00
Chris Lattner 46371cc500 Fix bug where use still existed in dead code
llvm-svn: 5824
2003-04-21 19:15:26 +00:00
Chris Lattner 5f5d985583 Fix bug: Mem2reg/2003-04-18-DeadBlockProblem.ll
llvm-svn: 5810
2003-04-18 19:25:22 +00:00
Chris Lattner e9f4232a70 Refactor CloneFunction to expose the new CloneBasicBlock function
llvm-svn: 5806
2003-04-18 03:50:09 +00:00
Chris Lattner de6f87ba07 New const_cast instead of c style cast
llvm-svn: 5805
2003-04-18 03:49:49 +00:00
Chris Lattner 379a8d2d1c Add new linkage types to support a real frontend
llvm-svn: 5786
2003-04-16 20:28:45 +00:00
Chris Lattner 18b1bf67b2 * Fix bug: Mem2Reg/2003-04-10-DFNotFound.ll
* Make Mem2Reg assign version numbers now for renamed variables instead of
  .mem2reg suffixes.  This produces what people think of as SSA.

llvm-svn: 5771
2003-04-10 19:41:13 +00:00
Chris Lattner 07f7e5d3b5 * We now preserve the no-critical-edge pass (because we cannot insert critical edges)
* Small modification to be more efficient

llvm-svn: 5757
2003-03-31 17:30:25 +00:00
Chris Lattner 569a57f9ff Fix bug: SimplifyCFG/2003-03-07-DominateProblem.ll
llvm-svn: 5722
2003-03-07 18:13:41 +00:00
Chris Lattner e54d214fcb Implement CFGSimplify/PhiBlockMerge*.ll
llvm-svn: 5702
2003-03-05 21:36:33 +00:00
Chris Lattner 31116bafed Implement testcase CFGSimplify/EqualPHIEdgeBlockMerge.ll
llvm-svn: 5699
2003-03-05 21:01:52 +00:00
Chris Lattner e27406eb59 Change the mem2reg interface to accept a TargetData argument
llvm-svn: 5685
2003-03-03 17:25:18 +00:00
Chris Lattner 4869f3700e Rename Instruction::hasSideEffects() -> mayWriteToMemory()
llvm-svn: 5620
2003-02-24 20:48:32 +00:00
Chris Lattner 26f159046c Split mem2reg promotion into two parts: a function which does the work, and
a pass which wraps the function.  This allows other passes to use the functionality

llvm-svn: 5610
2003-02-22 23:57:48 +00:00
Chris Lattner 04cad6a010 Clean up std namespace references
llvm-svn: 5608
2003-02-22 22:25:17 +00:00
Chris Lattner 069c158bc5 * Fix linking of opaque types and their non-opaque versions
* Fix bug: Linker/2003-01-30-LinkerTypeRename.ll

llvm-svn: 5441
2003-01-30 20:53:43 +00:00
Chris Lattner 2e65dd3575 Eliminate using decls
llvm-svn: 5439
2003-01-30 19:53:34 +00:00
Chris Lattner 803c66bc64 Add debugging helper
llvm-svn: 5235
2003-01-13 00:52:25 +00:00
Vikram S. Adve c864ab1e33 This file implements the function DemoteRegToStack(), which takes a
virtual register computed by an Instruction& X and replaces it with
a slot in the stack frame, allocated via alloca.

llvm-svn: 4964
2002-12-10 13:07:58 +00:00
Chris Lattner 1ee7f8e6bb Fix bug that was bugging bugpoint
llvm-svn: 4953
2002-12-07 21:27:16 +00:00
Chris Lattner f4c0811faa Fix big bug introduced with symbol table changes
llvm-svn: 4885
2002-12-03 18:32:30 +00:00
Chris Lattner e4dbb1af42 Initial checkin of Module cloning support stuff
llvm-svn: 4788
2002-11-20 20:47:41 +00:00
Chris Lattner 98cf1f5d64 - Eliminated the deferred symbol table stuff in Module & Function, it really
wasn't an optimization and it was causing lots of bugs.

llvm-svn: 4779
2002-11-20 18:36:02 +00:00
Chris Lattner 7c6d9d9eac Fix minor bugs
llvm-svn: 4778
2002-11-20 18:32:31 +00:00
Chris Lattner 84dd0f4767 Remove unneccesary #include
llvm-svn: 4772
2002-11-19 23:12:53 +00:00
Chris Lattner fb311d203a Implement the CloneFunction function
llvm-svn: 4771
2002-11-19 23:12:22 +00:00
Chris Lattner c362618f2a Minor changes to cloning interface
llvm-svn: 4770
2002-11-19 22:54:01 +00:00
Chris Lattner 8bce9886c3 Fix two fixmes: integrate with inlining, and document
llvm-svn: 4769
2002-11-19 22:04:49 +00:00
Chris Lattner b1120055b9 Rework inline pass to use cloning infrastructure to do the dirty work
llvm-svn: 4766
2002-11-19 21:54:07 +00:00
Chris Lattner 1666751257 Start using the new function cloning header
llvm-svn: 4764
2002-11-19 20:59:41 +00:00
Chris Lattner 12764c85e8 BreakCriticalEdges should update dominance frontier information as well as
other dominance stuff.  Patch contributed by Casey Carter

llvm-svn: 4457
2002-10-31 02:44:36 +00:00
Misha Brukman 632df28deb Fix spelling of `propagate'.
llvm-svn: 4423
2002-10-29 23:06:16 +00:00
Chris Lattner 820d971233 - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to
setPreservesCFG to be less confusing.

llvm-svn: 4255
2002-10-21 20:00:28 +00:00
Chris Lattner 149376dee5 - Change Function's so that their argument list is populated when they are
constructed.  Before, external functions would have an empty argument list,
    now a Function ALWAYS has a populated argument list.

llvm-svn: 4149
2002-10-13 20:57:00 +00:00
Chris Lattner b7368500dc - Fix bug: cee/2002-10-07-NoImmediateDominator.ll
llvm-svn: 4081
2002-10-08 21:53:51 +00:00
Chris Lattner a704ac8a66 Changes to support PHINode::removeIncoming changes
llvm-svn: 4079
2002-10-08 21:36:33 +00:00
Chris Lattner 5ac72defc9 Expose isCriticalEdge & SplitCriticalEdge methods from crit-edges pass
llvm-svn: 4075
2002-10-08 21:06:27 +00:00
Chris Lattner bf3a099a62 Updates to work with recent Statistic's changes:
* Renamed StatisticReporter.h/cpp to Statistic.h/cpp
    * Broke constructor to take two const char * arguments instead of one, so
      that indendation can be taken care of automatically.
    * Sort the list by pass name when printing
    * Make sure to print all statistics as a group, instead of randomly when
      the statistics dtors are called.
    * Updated ProgrammersManual with new semantics.

llvm-svn: 4002
2002-10-01 22:38:41 +00:00
Chris Lattner bedbd6bc16 - Cleanup break-crit-edges pass by making SplitCriticalEdge a member method.
- break-crit-edges pass does not invalidate loop-preheader pass.

llvm-svn: 3944
2002-09-26 16:18:51 +00:00
Chris Lattner b408154f5f - Fix bug: Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
llvm-svn: 3917
2002-09-24 21:19:41 +00:00
Chris Lattner d6dcd8ec32 Fix bug: SimplifyCFG/2002-09-24-PHIAssertion.ll
llvm-svn: 3913
2002-09-24 16:09:17 +00:00
Chris Lattner c05ad96803 - Do not expose Critical Edge breaking mechanics outside the BCE pass, thus
removing it from Transforms/Local.h and from Transforms/Utils/*

llvm-svn: 3911
2002-09-24 15:52:01 +00:00
Chris Lattner 75f80bd0b6 - Do not expose Critical Edge breaking mechanics outside the BCE pass, thus
removing it from Transforms/Local.h and from Transforms/Utils/*

llvm-svn: 3910
2002-09-24 15:51:56 +00:00
Chris Lattner 4bec665b09 - Expose passinfo from BreakCriticalEdges pass so that it may be "Required"
by other passes.  Make BCE pass be in anonymous namespace now.

llvm-svn: 3907
2002-09-24 15:43:12 +00:00
Chris Lattner 5325c5f340 Minor cleanups
llvm-svn: 3904
2002-09-24 00:09:26 +00:00
Chris Lattner b03832d5d0 Add new BreakCriticalEdges pass
llvm-svn: 3903
2002-09-24 00:08:39 +00:00
Chris Lattner 4037a261d8 Insert resolved constants into the global map so they are reused correctly.
This bug was exposed linking the SPEC benchmark suite.

llvm-svn: 3888
2002-09-23 18:14:15 +00:00
Chris Lattner 674c9ff585 Fix bug I introduced with one of my previous changes.
Thanks fly out to Nick for noticing it!  :)

llvm-svn: 3691
2002-09-12 19:00:43 +00:00
Chris Lattner 3d7720ae7d Fix bugs in previous checkins
llvm-svn: 3673
2002-09-10 23:31:28 +00:00
Chris Lattner db3f9bc948 Fix minor problems in previous checkin
llvm-svn: 3668
2002-09-10 22:52:49 +00:00
Chris Lattner f80f7b02b7 Clean up code due to auto-insert constructors
llvm-svn: 3666
2002-09-10 22:38:49 +00:00
Chris Lattner a239e6879d Clean up code due to auto-insert constructors
llvm-svn: 3665
2002-09-10 22:38:47 +00:00
Chris Lattner 6a5364e46f Fix file header to be accurate, instead of something I just copied and pasted.
llvm-svn: 3591
2002-09-06 03:59:56 +00:00
Chris Lattner 50dd6724a2 Fix bug with critical edge splitting code where it wouldn't update PHI nodes
in the old destination block to indicate that the value flows from the new
edge splitting block, not from the original multi-successor block.

llvm-svn: 3590
2002-09-06 03:51:45 +00:00
Chris Lattner c2cd504569 Check in the implementation of critical edge detection and splitting
llvm-svn: 3588
2002-09-06 02:35:34 +00:00
Chris Lattner dfb3a2cd07 Eliminated the MemAccessInst class, folding contents into GEP class.
llvm-svn: 3487
2002-08-22 23:37:20 +00:00
Chris Lattner 1a386b6a73 - Do not expose ::ID from any of the analyses anymore.
llvm-svn: 3417
2002-08-21 17:09:49 +00:00
Chris Lattner 325398c6a4 fixed bug: test/Regression/Linker/2002-08-20-ConstantExpr.ll
llvm-svn: 3412
2002-08-20 19:35:11 +00:00
Chris Lattner 330b7ac76c Remove support for Not ConstantExpr. This simplifies the unary case to only
have to support the cast instruction, so the function is renamed to getCast.

llvm-svn: 3328
2002-08-14 18:24:09 +00:00
Chris Lattner f0ed55d1ee - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument

llvm-svn: 3265
2002-08-08 19:01:30 +00:00
Chris Lattner a13a2dac7e Cleanup ConstantExpr handling:
* Correctly delete TypeHandles in AsmParser.  In addition to not leaking
   memory, this prevents a bug that could have occurred when a type got
   resolved that the constexpr was using
 * Check for errors in the AsmParser instead of hitting assertion failures
   deep in the code
 * Simplify the interface to the ConstantExpr class, removing unneccesary
   parameters to the ::get* methods.
 * Rename the 'getelementptr' version of ConstantExpr::get to
   ConstantExpr::getGetElementPtr

llvm-svn: 3160
2002-07-30 18:54:22 +00:00
Chris Lattner beb40f9f6c Remove FIXME's that aren't really needed after all.
llvm-svn: 3158
2002-07-30 16:38:54 +00:00
Chris Lattner b17274ebf6 Implement a new RemoveSuccessor function
llvm-svn: 3131
2002-07-29 22:32:08 +00:00
Chris Lattner 1cec4d90cd Allow folding of basic blocks that have PHI nodes in them, fixing "bug":
test/Regression/Transforms/SimplifyCFG/2002-06-24-PHINode.ll

llvm-svn: 3128
2002-07-29 21:26:30 +00:00
Chris Lattner 96a0dfa33e * Standardize how analysis results/passes as printed with the print() virtual
methods
* Eliminate AnalysisID:  Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
  the analyses themselves.

llvm-svn: 3115
2002-07-27 01:12:15 +00:00
Chris Lattner c8b7092e54 * Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses

llvm-svn: 3113
2002-07-26 21:12:46 +00:00
Chris Lattner a2c0985980 * Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses

llvm-svn: 3112
2002-07-26 21:12:44 +00:00
Chris Lattner 2d380955dd *** empty log message ***
llvm-svn: 3072
2002-07-24 22:40:39 +00:00
Chris Lattner b28b680155 *** empty log message ***
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner a896b08b5c *** empty log message ***
llvm-svn: 3002
2002-07-23 17:52:38 +00:00
Chris Lattner f0cfe654d7 * Rewrite loop to be slightly more efficient (arguably)
* Fix a MAJOR thinko that was causing bad links to happen on Spec

llvm-svn: 2953
2002-07-18 02:31:03 +00:00
Chris Lattner 0b0758f916 Implement linking of ConstExprs
llvm-svn: 2946
2002-07-18 00:13:08 +00:00
Chris Lattner 33422fedc2 *** empty log message ***
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Anand Shukla 2ac04a0083 changes to make it compatible with 64bit gcc
llvm-svn: 2795
2002-06-25 21:18:19 +00:00
Chris Lattner 113f4f4609 MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2779
2002-06-25 16:13:24 +00:00
Chris Lattner fda72b1aad *** empty log message ***
llvm-svn: 2777
2002-06-25 16:12:52 +00:00
Chris Lattner ab038d44b0 Simplify the interface to local DCE and Constant prop
llvm-svn: 2749
2002-05-26 20:18:18 +00:00
Chris Lattner 466a049b67 Add implementation of SimplifyCFG
llvm-svn: 2701
2002-05-21 20:50:24 +00:00
Chris Lattner 4b009adc77 Simplify interface to ConstantFoldTerminator
llvm-svn: 2697
2002-05-21 20:04:50 +00:00
Chris Lattner 0b18c1d64e Add support for printing out statistics information when -stats is added to
the command line

llvm-svn: 2601
2002-05-10 15:38:35 +00:00
Chris Lattner bbcb8914e6 Give the unified exit node a name
llvm-svn: 2550
2002-05-07 22:14:45 +00:00
Chris Lattner b4cfa7ff97 Merge all individual .h files into a single Scalar.h file
llvm-svn: 2537
2002-05-07 20:03:00 +00:00
Chris Lattner 15435fd550 Move UnifyFunctionExitNodes to Utils library: final resting place this time
llvm-svn: 2531
2002-05-07 19:18:48 +00:00
Chris Lattner 64d1334ba7 Cleanup implementation a bit
llvm-svn: 2526
2002-05-07 18:51:25 +00:00
Chris Lattner 7608a46cbe Updates to move some header files out of include/llvm/Transforms into
the Scalar and Utils subdirectories

llvm-svn: 2523
2002-05-07 18:36:35 +00:00
Chris Lattner 28537dff72 Add code pulled out of TransformInternals.cpp, ConstProp.cpp, and DCE.cpp
llvm-svn: 2513
2002-05-07 18:07:59 +00:00
Chris Lattner b3e81510d7 Fixed bug: test/Regression/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
llvm-svn: 2423
2002-05-01 15:38:23 +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 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 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 b3d1caf947 Eliminate the PromoteInstance class, incorporating it into the PromotePass
class.

llvm-svn: 2375
2002-04-28 19:12:38 +00:00
Chris Lattner 13dbfe5217 Eliminate visited, CurrentValue, and WriteSets as instance variables of
PromoteInstance.  Make them local variables that are passed around as
appropriate.  Especially in the case of CurrentValue, this makes the
code simpler.

llvm-svn: 2374
2002-04-28 18:54:01 +00:00
Chris Lattner ff8a62589c * Fix bug: test/Regression/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll
* Minor cleanup that was missed in last patch

llvm-svn: 2373
2002-04-28 18:39:46 +00:00
Chris Lattner 421873de24 This huge changeset is a strictly cleanup change
Bugfixes will come in the next revision so that the diff is obvious.

llvm-svn: 2372
2002-04-28 18:27:55 +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 99b6f5cac4 Change the Dominator info and LoopInfo classes to keep track of BasicBlock's, not
const BasicBlocks

llvm-svn: 2337
2002-04-28 00:15:57 +00:00
Chris Lattner f998685cd9 s/Method/Function
llvm-svn: 2336
2002-04-27 07:27:19 +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 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 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 0d4858a4eb Eliminate explicit use of Writer library, using debug dump output instead.
llvm-svn: 2147
2002-04-07 22:31:23 +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 16bfdb5f02 New clone function routine
llvm-svn: 2045
2002-03-29 19:03:54 +00:00
Chris Lattner 91db58298a s/Method/Function
llvm-svn: 2034
2002-03-29 03:44:36 +00:00
Cameron Buschardt fea5661d49 * Move classes around
* rename constructor function
* Move stuff into anonymous namespaces

llvm-svn: 2007
2002-03-27 23:28:40 +00:00
Cameron Buschardt baef5b2ee2 Implemented promote mem->reg pass.
llvm-svn: 2005
2002-03-27 23:17:37 +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
Chris Lattner 60ab10bbef Cleanup error message output a bit
llvm-svn: 1879
2002-03-15 20:21:29 +00:00
Chris Lattner 93a0341dbf Namespaces
llvm-svn: 1791
2002-02-24 23:03:09 +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 429a20af4c Add neccesary #include
llvm-svn: 1742
2002-02-12 20:19:06 +00:00
Chris Lattner 50a45782ec 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 12f155a6f0 Initial checkin of new memory -> register promotion pass
llvm-svn: 1739
2002-02-12 17:16:22 +00:00
Chris Lattner 86595ae342 General cleanup
llvm-svn: 1628
2002-02-01 04:53:48 +00:00
Chris Lattner f9f2896c48 Eliminate SimplifyCFG.h file, pull everything into the UnifyMethodExitNodes class
llvm-svn: 1613
2002-01-31 01:12:06 +00:00
Chris Lattner ccf571a408 Convert analyses to new pass structure
llvm-svn: 1603
2002-01-31 00:42:27 +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 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 22fd21ed16 Implement support for internal methods
llvm-svn: 1380
2001-11-26 18:59:18 +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 3855f2c806 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 1e60d6b762 Add extra code for debugging linker problems
llvm-svn: 1091
2001-11-03 03:27:29 +00:00
Chris Lattner 3e95c716aa 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
Chris Lattner fc361b1d55 Remove non linking related stuff
llvm-svn: 1015
2001-10-28 22:43:06 +00:00
Vikram S. Adve 6e26c8b0fc Added name-mangling routines for future use.
llvm-svn: 1003
2001-10-28 21:38:02 +00:00
Chris Lattner b046867a97 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 162ed4d6cc Rename ConstPoolPointerReference to ConstPoolPointerRef - My fingers get tired typing that much
llvm-svn: 822
2001-10-15 13:21:42 +00:00
Chris Lattner c306f18c3e Implement linking of global variable constant references
llvm-svn: 817
2001-10-15 03:12:52 +00:00
Chris Lattner 1090dc96ff Implement linker. It's 95% working now.
llvm-svn: 810
2001-10-14 23:29:15 +00:00
Chris Lattner b7b537f192 Start of a linker
llvm-svn: 775
2001-10-13 07:03:50 +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 29aae157f7 Add method to unify all exit nodes of a method
llvm-svn: 143
2001-07-06 16:58:36 +00:00