Commit Graph

47 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
00207237dd Add fast register allocator, enabled with -regalloc=fast.
So far this is just a clone of -regalloc=local that has been lobotomized to run
25% faster. It drops the least-recently-used calculations, and is just plain
stupid when it runs out of registers.

The plan is to make this go even faster for -O0 by taking advantage of the short
live intervals in unoptimized code. It should not be necessary to calculate
liveness when most virtual registers are killed 2-3 instructions after they are
born.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 18:02:42 +00:00
Dan Gohman
af5097537c Update CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101976 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 01:32:29 +00:00
David Greene
5c8aa950fe Ok, third time's the charm. No changes from last time except the CMake
source addition.  Apparently the buildbots were wrong about failures.

---

Add some switches helpful for debugging:

-print-before=<Pass Name>

Dump IR before running pass <Pass Name>.

-print-before-all

Dump IR before running each pass.

-print-after-all

Dump IR after running each pass.

These are helpful when tracking down a miscompilation.  It is easy to
get IR dumps and do diffs on them, etc.

To make this work well, add a new getPrinterPass API to Pass so that
each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass
suitable for dumping out the kind of object the Pass works on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100249 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 23:17:14 +00:00
Chris Lattner
457c6c5ccb remove empty file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100222 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 20:26:36 +00:00
Benjamin Kramer
d0327f80ec Update CMake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100206 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 19:09:51 +00:00
Eric Christopher
7b2c9e6a30 Add file to CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:49:43 +00:00
Anton Korobeynikov
04c60d9535 Add missed entry to cmake build list file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96292 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 22:55:13 +00:00
Bob Wilson
fe61fb1e10 Add a new pass on machine instructions to optimize away PHI cycles that
reduce down to a single value.  InstCombine already does this transformation
but DAG legalization may introduce new opportunities.  This has turned out to
be important for ARM where 64-bit values are split up during type legalization:
InstCombine is not able to remove the PHI cycles on the 64-bit values but
the separate 32-bit values can be optimized.  I measured the compile time 
impact of this (running llc on 176.gcc) and it was not significant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95951 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 01:30:21 +00:00
Daniel Dunbar
87641fa6dc Update CMake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95041 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 01:12:20 +00:00
Benjamin Kramer
dcff928b59 Update CMake list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 20:59:04 +00:00
Ted Kremenek
11f30b0131 Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93571 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 22:59:46 +00:00
Ted Kremenek
ce3ad1565a Update CMake file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93283 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 01:02:47 +00:00
Lang Hames
94a4a5eec6 Added CalcSpillWeights to CMakeLists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 07:43:25 +00:00
Douglas Gregor
e731fa2957 Fix CMake makefiles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 22:19:31 +00:00
Jim Grosbach
b51d3f9c8d Add MaxStackAlignment.cpp to CMake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 19:31:07 +00:00
Bob Wilson
15acadde5f Split tail duplication into a separate pass. This is needed to avoid
running tail duplication when doing branch folding for if-conversion, and
we also want to be able to run tail duplication earlier to fix some
reg alloc problems.  Move the CanFallThrough function from BranchFolding
to MachineBasicBlock so that it can be shared by TailDuplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89904 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 00:32:21 +00:00
Douglas Gregor
dece1e217a Fix CMake makefiles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85994 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 01:32:06 +00:00
David Goodwin
348777110a Add aggressive anti-dependence breaker. Currently it is not the default for any target. Enable with -break-anti-dependencies=all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 19:32:42 +00:00
David Goodwin
2e7be612d5 Break anti-dependence breaking out into its own class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 16:59:04 +00:00
Chris Lattner
831a2bba04 second half of lazy liveness removal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 22:49:30 +00:00
Evan Cheng
f436463dbd Remove simple regalloc. It has bit rotted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 05:48:07 +00:00
Xerxes Ranby
3314091792 updated lib/CodeGen/CMakeLists.txt to unbreak cmake build after r82018
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 10:18:36 +00:00
Chris Lattner
19ef669689 fix a gone file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 01:11:21 +00:00
Benjamin Kramer
ae68a19ef9 Update CMakeLists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 18:47:11 +00:00
David Goodwin
d94a4e5d8d Post RA scheduler changes. Introduce a hazard recognizer that uses the target schedule information to accurately model the pipeline. Update the scheduler to correctly handle multi-issue targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 15:55:25 +00:00
Daniel Dunbar
08ada178b8 Update CMake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07 03:59:06 +00:00
Ted Kremenek
f6e75c3435 Update CMake files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-03 23:44:01 +00:00
Ted Kremenek
f83146fd11 Update CMake files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 18:50:22 +00:00
Benjamin Kramer
376cd007ec Fix cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 00:35:23 +00:00
Duncan Sands
08b7daf3ff Fix the cmake build - patch by Xerxes Rånby.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 14:28:32 +00:00
Douglas Gregor
033080cf6a CMake build fixes, from Xerxes Ranby
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74720 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 18:53:52 +00:00
Douglas Gregor
8947881444 Fix linking of llvm-ld and lli with CMake, from Xerxes Rånby
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 15:37:00 +00:00
Oscar Fuentes
89456cecb3 CMake: Updated list of files on lib/CodeGen/CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-10 22:53:59 +00:00
Bruno Cardoso Lopes
4cb31436bd Move ELFCodeEmiter stuff to new files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 17:47:27 +00:00
Oscar Fuentes
030019f113 CMake: Added missing source file to lib/CodeGen/CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72775 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 15:29:09 +00:00
Duncan Sands
b0f1e1780c Add a new codegen pass that normalizes dwarf exception handling
code in preparation for code generation.  The main thing it does
is handle the case when eh.exception calls (and, in a future
patch, eh.selector calls) are far away from landing pads.  Right
now in practice you only find eh.exception calls close to landing
pads: either in a landing pad (the common case) or in a landing
pad successor, due to loop passes shifting them about.  However
future exception handling improvements will result in calls far
from landing pads:
(1) Inlining of rewinds.  Consider the following case:
In function @f:
...
  invoke @g to label %normal unwind label %unwinds
...
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

In function @g:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  "rethrow exception"

Now inline @g into @f.  Currently this is turned into:
In function @f:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  invoke "rethrow exception" to label %normal unwind label %unwinds
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

However we would like to simplify invoke of "rethrow exception" into
a branch to the %unwinds label.  Then %unwinds is no longer a landing
pad, and the eh.exception call there is then far away from any landing
pads.

(2) Using the unwind instruction for cleanups.
It would be nice to have codegen handle the following case:
  invoke @something to label %continue unwind label %run_cleanups
...
handler:
... perform cleanups ...
  unwind

This requires turning "unwind" into a library call, which
necessarily takes a pointer to the exception as an argument
(this patch also does this unwind lowering).  But that means
you are using eh.exception again far from a landing pad.

(3) Bugpoint simplifications.  When bugpoint is simplifying
exception handling code it often generates eh.exception calls
far from a landing pad, which then causes codegen to assert.
Bugpoint then latches on to this assertion and loses sight
of the original problem.

Note that it is currently rare for this pass to actually do
anything.  And in fact it normally shouldn't do anything at
all given the code coming out of llvm-gcc!  But it does fire
a few times in the testsuite.  As far as I can see this is
almost always due to the LoopStrengthReduce codegen pass
introducing pointless loop preheader blocks which are landing
pads and only contain a branch to another block.  This other
block contains an eh.exception call.  So probably by tweaking
LoopStrengthReduce a bit this can be avoided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 20:36:31 +00:00
Mike Stump
1d4c738603 Fix cmake builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 00:18:14 +00:00
Jakob Stoklund Olesen
48872e0d84 Pass to verify generated machine code.
The following is checked:

* Operand counts: All explicit operands must be present.

* Register classes: All physical and virtual register operands must be
  compatible with the register class required by the instruction descriptor.

* Register live intervals: Registers must be defined only once, and must be
  defined before use.

The machine code verifier is enabled with the command-line option
'-verify-machineinstrs', or by defining the environment variable
LLVM_VERIFY_MACHINEINSTRS to the name of a file that will receive all the
verifier errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71918 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 00:33:53 +00:00
Chris Lattner
9422e01a63 add ShrinkWrapping.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-13 06:27:38 +00:00
Evan Cheng
bbf1db7213 Rename "loop aligner" pass to "code placement optimization" pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 05:42:24 +00:00
Oscar Fuentes
5dcf50bd03 CMake: Updated lib/CodeGen/CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 14:56:40 +00:00
Gabor Greif
c40d4f85dd update
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 22:52:25 +00:00
Dan Gohman
343f0c0467 Experimental post-pass scheduling support. Post-pass scheduling
is currently off by default, and can be enabled with
-disable-post-RA-scheduler=false.

This doesn't have a significant impact on most code yet because it doesn't
yet do anything to address anti-dependencies and it doesn't attempt to
disambiguate memory references. Also, several popular targets
don't have pipeline descriptions yet.

The majority of the changes here are splitting the SelectionDAG-specific
code out of ScheduleDAG, so that ScheduleDAG can be moved to
libLLVMCodeGen.a. The interface between ScheduleDAG-using code and
the rest of the scheduling code is somewhat rough and will evolve.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 23:18:57 +00:00
Oscar Fuentes
5c42fd8af1 CMake: Updated list of source files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 03:24:04 +00:00
Oscar Fuentes
7334b15210 CMake: updated lib/CodeGen/CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 02:37:50 +00:00
Oscar Fuentes
80533040bc CMake: Reflected changes on source file structure. New plugin support
for llvmc2 incomplete.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57076 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 21:18:50 +00:00
Oscar Fuentes
3d01fc7de8 Initial support for the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 01:08:49 +00:00