Commit Graph

11664 Commits

Author SHA1 Message Date
Chris Lattner
4e5f03602c This code really wants to iterate over the OPERANDS of an instruction, not
over its USES.  If it's dead it doesn't have any uses!  :)

Thanks to the fabulous and mysterious Bill Wendling for pointing this out.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13102 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 22:29:37 +00:00
Chris Lattner
5d461d20ae Implement a fixme. The helps loops that have induction variables of different
types in them.  Instead of creating an induction variable for all types, it
creates a single induction variable and casts to the other sizes.  This generates
this code:

no_exit:                ; preds = %entry, %no_exit
        %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ]            ; <uint> [#uses=4]
***     %j.0.0 = cast uint %indvar to short             ; <short> [#uses=1]
        %indvar = cast uint %indvar to int              ; <int> [#uses=1]
        %tmp.7 = getelementptr short* %P, uint %indvar          ; <short*> [#uses=1]
        store short %j.0.0, short* %tmp.7
        %inc.0 = add int %indvar, 1             ; <int> [#uses=2]
        %tmp.2 = setlt int %inc.0, %N           ; <bool> [#uses=1]
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=1]
        br bool %tmp.2, label %no_exit, label %loopexit

instead of:

no_exit:                ; preds = %entry, %no_exit
        %indvar = phi ushort [ %indvar.next, %no_exit ], [ 0, %entry ]          ; <ushort> [#uses=2]
***     %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ]            ; <uint> [#uses=3]
        %indvar = cast uint %indvar to int              ; <int> [#uses=1]
        %indvar = cast ushort %indvar to short          ; <short> [#uses=1]
        %tmp.7 = getelementptr short* %P, uint %indvar          ; <short*> [#uses=1]
        store short %indvar, short* %tmp.7
        %inc.0 = add int %indvar, 1             ; <int> [#uses=2]
        %tmp.2 = setlt int %inc.0, %N           ; <bool> [#uses=1]
        %indvar.next = add uint %indvar, 1
***     %indvar.next = add ushort %indvar, 1
        br bool %tmp.2, label %no_exit, label %loopexit

This is an improvement in register pressure, but probably doesn't happen that
often.

The more important fix will be to get rid of the redundant add.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13101 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 22:22:01 +00:00
Chris Lattner
3e1358a9fa Fix an incredibly nasty iterator invalidation problem. I am too spoiled by ilists :)
Eventually it would be nice if CallGraph maintained an ilist of CallGraphNode's instead
of a vector of pointers to them, but today is not that day.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13100 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 20:44:33 +00:00
Chris Lattner
6df29c6453 bug fixed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13099 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 18:52:06 +00:00
Chris Lattner
c398613a4d new testcase for PR326
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13098 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 18:49:35 +00:00
Misha Brukman
8c194eaa05 Add doxygenified comments to functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13097 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 18:36:43 +00:00
Misha Brukman
af76cfb0fb I'm allergic to the word `stuff'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13096 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 18:27:56 +00:00
Brian Gaeke
6896a7dd43 Make SparcV9RegInfo::getRegType() return the right answer for registers
of IntCC, FloatCC, and Special types.

Make SparcV9RegInfo::getRegClassIDOfRegType() return the right answer
if you ask for the class corresponding to SpecialRegType.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13095 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 17:53:58 +00:00
Alkis Evlogimenos
09233fb86e Include cerrno (gcc-3.4 fix)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13091 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 16:11:40 +00:00
Alkis Evlogimenos
afa9235f07 Declare iterator as public since it is defined as such (gcc-3.4 fix)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13090 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 16:10:40 +00:00
Chris Lattner
107fb18d89 Fix typeo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13089 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 14:23:18 +00:00
Chris Lattner
68d57e7ae8 REALLY fix PR324: don't delete linkonce functions until after the SCC traversal
is done, which avoids invalidating iterators in the SCC traversal routines


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13088 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 22:06:53 +00:00
Chris Lattner
72035995d5 Pass the callgraph not the module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 21:52:26 +00:00
Chris Lattner
78637fe9d6 Allow getting the module from a call graph
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13086 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 21:52:12 +00:00
Chris Lattner
25942e9f5c Change it to take a callgraph, from which we can get a module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13085 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 21:52:07 +00:00
Chris Lattner
a10df50282 Add the ability for SCC passes to initialize and finalize themselves
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13084 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 21:30:06 +00:00
Chris Lattner
c99acc3709 Fix PR325
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13081 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 20:26:03 +00:00
Chris Lattner
5ad2b1d544 Fix PR324 and testcase: Inline/2004-04-20-InlineLinkOnce.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13080 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 20:20:59 +00:00
Chris Lattner
7be1e0b478 New testcase, distilled from PR324
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13079 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 20:15:01 +00:00
Brian Gaeke
3f083d5de6 Make it legal to ask for the type of a specialreg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13078 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 20:12:57 +00:00
Brian Gaeke
21a710a52e Add some PRs which were fixed, but not previously mentioned in the rel. notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13077 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 18:18:46 +00:00
Chris Lattner
759d34ffb7 Add support for the select instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13076 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 16:43:21 +00:00
Brian Gaeke
0eb61037f7 Make it legal to request a load or store of %fsr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13073 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 19:12:12 +00:00
Brian Gaeke
9a459abed2 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13072 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 19:09:24 +00:00
Brian Gaeke
94178e9fca Regularize include guards and remove some excess whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13071 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 18:53:44 +00:00
Brian Gaeke
03b562aecb Tighten up SparcV9FloatCCRegClass::getRegName()'s assertion - if you ask it for
the name of %fsr (as the comment in SparcV9RegClassInfo.h used to suggest)
you would walk off the end of the FloatCCRegName array.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13070 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 18:53:43 +00:00
Brian Gaeke
854db8a29a Regularize include guards, remove some excess whitespace and fix some comments.
Remove the extra %fsr register from SparcV9FloatCCRegClass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13069 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 18:53:42 +00:00
Chris Lattner
18f16094c2 Initial checkin of a simple loop unswitching pass. It still needs work,
but it's a start, and seems to do it's basic job.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13068 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 18:07:02 +00:00
Chris Lattner
74332be31e New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13067 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 18:06:34 +00:00
Chris Lattner
8277567dc6 Add accessor for a Loop Unswitching pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13066 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 06:28:37 +00:00
Chris Lattner
06ac2bef15 Eliminate a poorly conceived method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13065 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 06:26:46 +00:00
Chris Lattner
45a1cf87d4 It's not just a printer, it's actually an analysis too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:42:32 +00:00
Misha Brukman
de4803d0af As per Chris, greatly simplify handling of external functions by using the
wrapper idea uniformly: we can use Value::replaceAllUsesWith() instead of
special-casing by class of user.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13063 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:36:47 +00:00
Misha Brukman
f6f7ec1ee2 * Remove note about "UNSUPPORTED: " feature that just became supported
* Fix usage of <p> tag and some grammar


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13062 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:28:39 +00:00
Misha Brukman
b687d82b02 * Reorder #includes
* Wrap a long line


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13061 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:12:35 +00:00
Misha Brukman
e8cad78698 Display sample bugpoint output with the `code' stylesheet class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13060 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:07:29 +00:00
Chris Lattner
072b163424 * Improve file header comment
* Remove #include
* Add some methods to update loop/loopinfo
* Stop explicitly holding the loop depth in the Loop class.  Instead, just
  dynamically calculate it.  This makes it easier to update LoopInfo as a
  result of transformations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13059 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:03:19 +00:00
Chris Lattner
446b86d381 Remove code to update loop depths
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13058 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:02:09 +00:00
Chris Lattner
5864aebe92 Add #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13057 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:01:23 +00:00
Misha Brukman
cb00336384 Add notes about PRs 38 and 290 being fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13056 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:01:01 +00:00
Misha Brukman
a7aadf1642 Wrap (some) lines to 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13055 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 02:56:49 +00:00
Misha Brukman
dc7fef83dc Finally implement rewriting global initializers which use external functions
by creating an internal wrapper function with same signature as the external
function, and use it instead of the "real" function.

The wrapper then calls the external function using the same JIT function
resolution API that has been used before for rewriting instructions, since the
wrapper has an explicit call instruction which we can rewrite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13054 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 01:12:01 +00:00
Chris Lattner
4e77cc46ac Provide an interface that is more convenient for iterating over the blocks
in a loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13052 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 23:37:03 +00:00
Chris Lattner
3280f7bd55 Move isLoopInvariant to the Loop class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13051 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:46:08 +00:00
Chris Lattner
85661d0978 Add new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13050 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:45:27 +00:00
Chris Lattner
88d3ef2c74 Add new method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13049 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:45:16 +00:00
Chris Lattner
59fb87d469 Correct rewriting of exit blocks after my last patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13048 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:27:10 +00:00
Chris Lattner
343c0cfa19 Fix computation of exit blocks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13047 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:21:41 +00:00
Chris Lattner
5fa802fe27 Loop exit sets are no longer explicitly held, they are dynamically computed on demand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13046 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:15:13 +00:00
Chris Lattner
f1ab4b4eac Change the ExitBlocks list from being explicitly contained in the Loop
structure to being dynamically computed on demand.  This makes updating
loop information MUCH easier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13045 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:14:10 +00:00