Commit Graph

12066 Commits

Author SHA1 Message Date
Chris Lattner
2b10b08ad6 Pass boolean constants into function calls more efficiently, generating:
mov DWORD PTR [%ESP + 4], 1

instead of:

        mov %EAX, 1
        mov DWORD PTR [%ESP + 4], %EAX


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13494 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 16:35:04 +00:00
Chris Lattner
587992721c Do not pass in the same argument to the extracted function more than once, and
give the extracted function a more useful name than just foo_code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13493 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 16:26:18 +00:00
Chris Lattner
68bee938e5 Check to see if all blocks are extractible first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13491 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 16:08:01 +00:00
Chris Lattner
d99e1d3afb Implement support for code extracting basic blocks that have a return
instruction in them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13490 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 16:07:41 +00:00
Chris Lattner
e746ad512e Implement splitting of PHI nodes, allowing block extraction of BB's that have
PHI node entries from multiple outside-the-region blocks.  This also fixes
extraction of the entry block in a function.  Yaay.

This has successfully block extracted all (but one) block from the score_move
function in obsequi (out of 33).  Hrm, I wonder which block the bug is in.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13489 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 15:29:13 +00:00
Chris Lattner
bf749367cb * Pull some code out into the definedInRegion/definedInCaller methods
* Add a stub for the severSplitPHINodes which will allow us to bbextract
  bb's with PHI nodes in them soon.
* Remove unused arguments from findInputsOutputs
* Dramatically simplify the code in findInputsOutputs.  In particular,
  nothing really cares whether or not a PHI node is using something.
* Move moveCodeToFunction to after emitCallAndSwitchStatement as that's the
  order they get called.
* Fix a bug where we would code extract a region that included a call to
  vastart.  Like 'alloca', calls to vastart must stay in the function that
  they are defined in.
* Add some comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13482 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 06:01:40 +00:00
Chris Lattner
346be7f5bc Generate substantially better code when there are a limited number of exits
from the extracted region.  If the return has 0 or 1 exit blocks, the new
function returns void.  If it has 2 exits, it returns bool, otherwise it
returns a ushort as before.

This allows us to use a conditional branch instruction when there are two
exit blocks, as often happens during block extraction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13481 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 04:14:24 +00:00
Chris Lattner
5b01e298ed Two minor improvements:
1. Get rid of the silly abort block.  When doing bb extraction, we get one
     abort block for every block extracted, which is kinda annoying.
  2. If the switch ends up having a single destination, turn it into an
     unconditional branch.

I would like to add support for conditional branches, but to do this we will
want to have the function return a bool instead of a ushort.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13478 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 03:22:33 +00:00
Chris Lattner
b83c0f3f63 Don't leave dead bytecode.output files around if the optimizer/block extractor crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13477 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 02:55:45 +00:00
Misha Brukman
b584c5d812 This file has been superseded by docs/index.html .
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13476 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 02:48:30 +00:00
Chris Lattner
2290e75406 Implement the final missing bits for block extractor support. Now bugpoint
can extract basic blocks up to the limit of the block extractor implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13475 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 02:43:24 +00:00
Misha Brukman
300e74b43f Add link to Valgrind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13472 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 00:57:24 +00:00
Chris Lattner
5e783ab0b5 Implement basic block extraction for the miscompilation debugger. This still needs
two things: the FIXME in ExtractBlocks needs to be implemented, and the basic block
extractor itself needs to have enough bugs fixed for this to be more or less
useful.

Until the time that this is generally useful, it is hidden behind the new bugpoint
-enable-block-extraction option.  I hope to get the FIXME done tonight.

Also of note, this patch adds a -extract-bbs option to bugpoint which can be used
to debug the block extractor.  (hint hint Misha :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13471 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 21:54:13 +00:00
Chris Lattner
1c2f68631e A class that is meant to be a base class should have a virtual destructor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13470 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 20:41:07 +00:00
Chris Lattner
8436c21ad1 Add a note to make sure the program is memory correct
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13464 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 19:34:27 +00:00
John Criswell
19fa3f51ee Added obsequi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13462 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 19:29:59 +00:00
Brian Gaeke
379b380a8b Use inttypes.h, which exists on all of Linux, Solaris and Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13461 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 16:14:53 +00:00
Chris Lattner
3528a4be8e Unbreak the build on X86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13460 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 14:08:54 +00:00
Brian Gaeke
a7750fc61f Squash warnings on Solaris/sparc... the test suite is not working for me so I
can't be sure if these are OK, but they look OK.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13459 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 07:45:28 +00:00
Brian Gaeke
2928a169bb Do not hardcode the name of gcc, because its full pathname may have been
specified by top-level configure


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13458 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 07:42:58 +00:00
Brian Gaeke
8c603ef339 Do not depend on the path to bash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13457 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 07:42:19 +00:00
Brian Gaeke
c66d8b0aca Include <sys/types.h> to get the definition of int64_t on Solaris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13456 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 07:18:02 +00:00
Chris Lattner
8abf69374e Switch this from using an std::map to using a DenseMap. This speeds up
phi-elimination from 0.6 to 0.54s on kc++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13454 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-10 19:17:36 +00:00
Chris Lattner
80e20eb487 Use a new VRegPHIUseCount to compute uses of PHI values by other phi values
in the basic block being processed.  This fixes PhiElimination on kimwitu++
from taking 105s to taking a much more reasonable 0.6s (in a debug build).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13453 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-10 19:06:37 +00:00
Chris Lattner
791f896d9f Now that we use an ilist of machine instructions, iterators are more robust
than before.  Because this is the case, we can compute the first non-phi
instruction once when de-phi'ing a block.  This shaves ~4s off of
phielimination of _Z7yyparsev in kimwitu++ from 109s -> 105s.  There are
still much more important gains to come.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13452 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-10 18:47:18 +00:00
Chris Lattner
c81e6bae88 Fix a fairly serious pessimizaion that was preventing us from efficiently
compiling things like 'add long %X, 1'.  The problem is that we were switching
the order of the operands for longs even though we can't fold them yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13451 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-10 15:15:55 +00:00
Chris Lattner
3699e05fb2 Bug fixed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13450 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-10 14:28:09 +00:00
Chris Lattner
6d3848df7e Patch to fix PR337. Make sure to mark all aliased physical registers as used
when we see a read of a register.  This is important in cases like:

AL = ...
AH = ...

   = AX

The read of AX must make both the AL and AH defs live until the use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13444 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-10 05:12:43 +00:00
Chris Lattner
02eac39359 Testcase for PR337, which was reduced by Reid Spencer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13443 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-10 05:11:24 +00:00
Reid Spencer
44ff57a56b Bug 178 Fixed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13442 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 23:32:39 +00:00
Reid Spencer
dc8e6b59e7 Changes to make the Stacker Stack use 64 bit values. This *should* get
around the problem with Stacker on Solaris because the Stack can handle
64-bit entries (pointer sized).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13441 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 23:20:19 +00:00
Chris Lattner
9984fd0df9 Fix some comments, avoid sign extending booleans when zero extend works fine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13440 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 23:16:33 +00:00
Chris Lattner
96e3b426d5 Generate more efficient code for casting booleans to integers (no sign extension required)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13439 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 22:28:45 +00:00
Chris Lattner
cb3ad01833 syntactically loopify natural loops so that the GCC loop optimizer can find them. This should *dramatically* improve the performance of CBE compiled code on targets that depend on GCC's loop optimizations (like PPC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13438 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 20:41:32 +00:00
Chris Lattner
4589ed9510 Do not emit prototypes for setjmp/longjmp, as they are handled specially
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13437 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 16:03:29 +00:00
Chris Lattner
0555ed8bff Fine grainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13436 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 06:22:29 +00:00
Chris Lattner
6875807572 Make the floating point constant pools local to each function, split the
FindUsedTypes manipulation stuff out to be a seperate pass, and make the
main CWriter be a function pass now!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13435 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 06:20:51 +00:00
Brian Gaeke
b0fd761c3d Bug fixed.
Rewrite portability intro.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13434 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 05:28:35 +00:00
Chris Lattner
c2421439b5 Get this looking more like a function pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13433 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 04:30:20 +00:00
Chris Lattner
0979ca7e3e Implement the AddPrototypes method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13432 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 04:29:57 +00:00
Chris Lattner
43c81f19ee Add support for inserting all prototypes up-front
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13431 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 04:29:49 +00:00
Chris Lattner
a05e0ec419 Print all PHI copies for successor blocks before the terminator, whether it be a conditional branch or switch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13430 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 03:42:48 +00:00
Chris Lattner
be97b4e9ab Fix stupid bug in my checkin yesterday
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13429 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 22:41:42 +00:00
Tanya Lattner
b4b2e9d5a7 Fixed up sched graph.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13428 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 16:14:24 +00:00
Tanya Lattner
5a75c91951 Registering the ModuloScheduling pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13427 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 16:14:02 +00:00
Tanya Lattner
e5abfd2c05 Changed CPUResource to allow access to max num users for a resource.
Also added ModuloScheduling as a friend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13426 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 16:13:26 +00:00
Tanya Lattner
6b160503b5 Changed CPUResource to allow access to maxnum users.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13425 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 16:12:50 +00:00
Tanya Lattner
73e3e2e10f Updating my versions of ModuloScheduling in cvs. Still not complete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13424 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 16:12:10 +00:00
Brian Gaeke
429022bf83 Add support for widening integral casts.
Flesh out the SetCC support... which currently ends in a little bit
of unfinished code (which is probably completely hilarious) for
generating the condition value splitting the basic block up into 4
blocks, like this (clearly a better API is needed for this!):

       BB
   cond. branch
     /         /          R1=1    R2=0
     \      /
      \    /
    R=phi(R1,R2)

Other minor edits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13423 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 06:36:14 +00:00
Brian Gaeke
59dbff714c Add a bunch more branches
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13422 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 06:08:29 +00:00