Commit Graph

6229 Commits

Author SHA1 Message Date
Chris Lattner
015959ee38 Operate on the Machine CFG instead of on the LLVM CFG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13302 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-01 21:24:39 +00:00
Chris Lattner
f25fb4bc64 Stop LiveVariables from using BasicBlocks as part of the mapping, instead
use MachineBasicBlocks.  To do this, we traverse the Machine CFG instead of
the LLVM CFG, which is also *MUCH* more efficient by having fewer levels of
indirections and mappings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13301 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-01 21:24:24 +00:00
Chris Lattner
55a4700857 Add a constructor that got lost
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13297 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-01 11:17:13 +00:00
Brian Gaeke
3c66c355b6 Generalize the strlen size_t hack, for the benefit of the other external
functions with wrappers that either take or return size_ts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13296 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-01 06:42:15 +00:00
Tanya Lattner
0e1c48b209 Removing MachineResource class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13291 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-30 20:40:38 +00:00
Chris Lattner
c1526a9da1 Fix a major pessimization in the instcombiner. If an allocation instruction
is only used by a cast, and the casted type is the same size as the original
allocation, it would eliminate the cast by folding it into the allocation.

Unfortunately, it was placing the new allocation instruction right before
the cast, which could pull (for example) alloca instructions into the body
of a function.  This turns statically allocatable allocas into expensive
dynamically allocated allocas, which is bad bad bad.

This fixes the problem by placing the new allocation instruction at the same
place the old one was, duh. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13289 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-30 04:37:52 +00:00
Misha Brukman
96a8bd7f54 Wrapped code and comments at 80 cols; doxygenified some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13264 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-29 04:05:30 +00:00
Misha Brukman
bf94a1e22a Reorder #includes as per style guide.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13263 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-29 04:04:47 +00:00
Misha Brukman
e5242def97 class AssemblyWriter:
* Make contained ostream pointer, not reference
* Allow setting of that ostream via setStream()

class CachedWriter:
* setStream() in turn calls setStream() on the AssemblyWriter


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13247 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 19:24:28 +00:00
Misha Brukman
8618e52be5 Send text and numbers directly to CachedWriter's contained ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13243 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 18:52:43 +00:00
Misha Brukman
500acf72cc Squelch compile-time warning (profile build).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13228 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 15:32:09 +00:00
Misha Brukman
5cf1acff3c * Add ability to print out type as symbolic
* Add Module accessor to AssemblyWriter


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13227 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 15:31:21 +00:00
Brian Gaeke
1afe7736ff Make RequiresFPRegKill() take a MachineBasicBlock arg.
In InsertFPRegKills(), just check the MachineBasicBlock for successors
instead of its corresponding BasicBlock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13213 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 04:45:55 +00:00
Brian Gaeke
235aa5eba7 In InsertFPRegKills(), use the machine-CFG itself rather than the
LLVM CFG when trying to find the successors of BB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13212 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 04:34:16 +00:00
Brian Gaeke
ea9ca67304 Update the machine-CFG edges whenever we see a branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13211 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 04:19:37 +00:00
Brian Gaeke
235d3b7b52 Integrate the rest of my random sparcv9 scribblings into this file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13204 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-27 22:04:03 +00:00
Chris Lattner
003d5173ca Fix warning building in optimized mode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13190 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-27 18:24:38 +00:00
Chris Lattner
6ffe551f65 Changes to fix up the inst_iterator to pass to boost iterator checks. This
patch was graciously contributed by Vladimir Prus.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13185 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-27 15:13:33 +00:00
Brian Gaeke
c6e2d8a2ff Add functions that return instances of these printer passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13175 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-26 16:27:08 +00:00
Chris Lattner
bac7da8461 If an object is not in the scalar map then it must be a global from another
graph.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13173 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-26 14:44:08 +00:00
Chris Lattner
83a2e6e4a1 Instcombine X/-1 --> 0-X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13172 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-26 14:01:59 +00:00
Brian Gaeke
3ca4fccac5 Fix file header comments and include guards -- many files have been moved or
renamed since they were last spiffed up, or they just never had proper comments
in the first place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13148 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-25 07:04:49 +00:00
Brian Gaeke
27beae85a0 Add a getRegisterInfo() accessor just like on the X86 target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13147 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-25 06:32:28 +00:00
Brian Gaeke
c991586b92 Regularize file header comment and include guard.
Include SparcV9RegisterInfo.h.
Add a getRegisterInfo() accessor and SparcV9RegisterInfo instance, just like
on the X86 target.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13146 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-25 06:32:16 +00:00
Brian Gaeke
2363b4ef5b Add MRegisterInfo subclass for the SparcV9 target (containing only stub
functions for now). This automatically turns on the printing of machine
registers using their own real names, instead of goofy things like %mreg(42),
and allows us to migrate code incrementally to the new interface as we see fit.

The register file description it uses is hand-written, so that the register
numbers will match the ones that the SparcV9 target already uses.
Perhaps someday we'll tablegen it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13145 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-25 06:32:05 +00:00
Misha Brukman
22108fac63 * Allow aggregating extracted function arguments (controlled by flag)
* Commandline option (for now) controls that flag that is passed in


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13141 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 23:54:17 +00:00
Brian Gaeke
dd6d822fa6 Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13136 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 21:45:02 +00:00
Chris Lattner
4a7553e2da Move the scev expansion code into this pass, where it belongs. There is
still room for cleanup, but at least the code modification is out of the
analysis now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13135 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 21:29:48 +00:00
Chris Lattner
b06432c276 Eliminate all of the SCEV Expansion code which is really part of the
IndVars pass, not part of SCEV *analysis*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13134 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 21:29:03 +00:00
Brian Gaeke
18f9f66369 Merge TargetRegInfo.h into SparcV9RegInfo.h, which is its only subclass.
This prepares us to be able to de-virtualize and de-abstract it, and
take the register allocator bits out and move them into the register allocator
proper...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13127 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 18:15:48 +00:00
Brian Gaeke
3b2e5e619e Include SparcV9RegInfo.h instead of TargetRegInfo.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13126 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 18:15:47 +00:00
Brian Gaeke
35450d2aaa Include SparcV9RegInfo.h instead of TargetRegInfo.h. This serves as a bit of
documentation that this module needs to be made independent of the
register file description of the current target.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13125 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 18:15:46 +00:00
Brian Gaeke
4d529bc07b Get rid of the old byte-at-a-time emission code used when the Sparc JIT was
being tested on X86, as per Chris's request.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13124 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 18:10:38 +00:00
Brian Gaeke
b440dea57b Go back to the interpreter main loop after performing intrinsic lowering,
because 1) the first instruction might not be a call site, and
2) CS and SF.Caller were not getting set to point to the new call site
anyway (resulting in a crash on e.g. call %llvm.memset).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13122 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 18:05:28 +00:00
Brian Gaeke
b61fc83ecb Use emitWordAt() to emit forward-branch fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13120 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 17:11:16 +00:00
Brian Gaeke
62c6f879ae Emit SPARC machine code a word at a time instead of a byte at a time.
Use emitWordAt() to emit forward-branch fixups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13119 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 17:11:15 +00:00
Brian Gaeke
aea1b58f1e Implement emitWordAt() for the JIT emitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13118 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 17:11:14 +00:00
Brian Gaeke
da8246bb71 Implement emitWordAt() for the debug emitter and the file printer emitter. (I
am not so sure about the file printer emitter, but the debug emitter change
should be harmless.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13117 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 17:11:13 +00:00
Misha Brukman
7d248397a7 Clarify the logic: the flag is renamed to `deleteFn' to signify it will delete
the function instead of isolating it. This also means the condition is reversed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13112 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-22 23:00:51 +00:00
Misha Brukman
79906c9825 Add a flag to choose between isolating a function or deleting the function from
the Module. The default behavior keeps functionality as before: the chosen
function is the one that remains.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13111 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-22 22:52:22 +00:00
Chris Lattner
b4782d13d1 Disable a previous patch that was causing indvars to loop infinitely :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13108 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-22 15:12:36 +00:00
Chris Lattner
fcb81f5f4c Fix an extremely serious thinko I made in revision 1.60 of this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13106 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-22 14:59:40 +00:00
Chris Lattner
1363e85df7 Implement a todo, rewriting all possible scev expressions inside of the
loop.  This eliminates the extra add from the previous case, but it's
not clear that this will be a performance win overall.  Tommorows test
results will tell. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13103 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 23:36:08 +00:00
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
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
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