Commit Graph

9825 Commits

Author SHA1 Message Date
Dale Johannesen
8d908ebd19 Fix uint64->{float, double} conversion to do rounding correctly in 32-bit.
The implementation in LegalizeIntegerTypes to handle this as 
sint64->float + appropriate power of 2 is subject to double rounding,
considered incorrect by numerics people.  Use this implementation only
when it is safe.  This leads to using library calls in some cases
that produced inline code before, but it's correct now.
(EVTToAPFloatSemantics belongs somewhere else, any suggestions?)

Add a correctly rounding (though not particularly fast) conversion
that uses X87 80-bit computations for x86-32.

7885399, 5901940.  This shows up in gcc.c-torture/execute/ieee/rbug.c
in the gcc testsuite on some platforms.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103883 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 18:51:12 +00:00
Dale Johannesen
789955127e Improve assertion messages.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103882 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 18:38:02 +00:00
Chris Lattner
87565c1d77 improve portability to systems that don't have powf/modf (e.g. solaris 9)
patch by Evzen Muller!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103876 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 17:10:24 +00:00
Chandler Carruth
2c13ab2bb8 Fix an GCC warning that seems to have actually caught a bug (!!!) in
a condition's grouping. Every other use of Allocatable.test(Hint) groups it the
same way as it is indented, so move the parentheses to agree with that
grouping.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103869 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 10:23:23 +00:00
Jakob Stoklund Olesen
1e03ff4243 Calculate liveness on the fly for local registers.
When working top-down in a basic block, substituting physregs for virtregs, the use-def chains are kept up to date. That means we can recognize a virtreg kill by the use-def chain becoming empty.

This makes the fast allocator independent of incoming kill flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 06:09:08 +00:00
Evan Cheng
61d531066d A partial re-def instruction may be a copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103850 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 01:35:44 +00:00
Evan Cheng
b990a2f249 Teach two-address pass to do some coalescing while eliminating REG_SEQUENCE
instructions.

e.g.
%reg1026<def> = VLDMQ %reg1025<kill>, 260, pred:14, pred:%reg0
%reg1027<def> = EXTRACT_SUBREG %reg1026, 6
%reg1028<def> = EXTRACT_SUBREG %reg1026<kill>, 5
...
%reg1029<def> = REG_SEQUENCE %reg1028<kill>, 5, %reg1027<kill>, 6, %reg1028, 7, %reg1027, 8, %reg1028, 9, %reg1027, 10, %reg1030<kill>, 11, %reg1032<kill>, 12

After REG_SEQUENCE is eliminated, we are left with:

%reg1026<def> = VLDMQ %reg1025<kill>, 260, pred:14, pred:%reg0
%reg1029:6<def> = EXTRACT_SUBREG %reg1026, 6
%reg1029:5<def> = EXTRACT_SUBREG %reg1026<kill>, 5

The regular coalescer will not be able to coalesce reg1026 and reg1029 because it doesn't
know how to combine sub-register indices 5 and 6. Now 2-address pass will consult the
target whether sub-registers 5 and 6 of reg1026 can be combined to into a larger
sub-register (or combined to be reg1026 itself as is the case here). If it is possible, 
it will be able to replace references of reg1026 with reg1029 + the larger sub-register
index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103835 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 23:21:14 +00:00
Dan Gohman
7f0d69555c Fast ISel trivially coalesces away no-op casts, so check for this when
setting kill flags.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 22:53:18 +00:00
Jakob Stoklund Olesen
6a6328ba3d Don't bother spilling before a return
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103831 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 22:40:43 +00:00
Jakob Stoklund Olesen
ab2d00863f RegAllocLocal can count copies too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103830 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 22:40:40 +00:00
Jakob Stoklund Olesen
efa155fd6e Track allocatable instead of reserved regs, and never take an unallocatable hint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 22:02:56 +00:00
Dan Gohman
8b3a8f5773 Don't set kill flags for instructions which the scheduler has cloned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103827 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 22:01:14 +00:00
Jakob Stoklund Olesen
e97dda4fc5 Avoid scanning the long tail of physreg operands on calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:55:52 +00:00
Devang Patel
26c6995654 Do not forget to mark prcessed arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103822 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:55:50 +00:00
Jakob Stoklund Olesen
8a65c510a4 Count coalesced copies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103821 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:55:50 +00:00
Jakob Stoklund Olesen
a0e618de5d Allow virtreg redefines when verifying for RegAllocFast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:55:44 +00:00
Jim Grosbach
01384ef159 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103807 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:20:46 +00:00
Jim Grosbach
9001303a3f 80 column and trailing whitespace cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103806 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:19:48 +00:00
Jim Grosbach
5468e0928b add cmd line option to leave dbgvalues in during post-RA sceduling. Useful
while debugging what's mishandled about them in the post-RA pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:18:04 +00:00
Bill Wendling
b92187a410 Rename "HasCalls" in MachineFrameInfo to "AdjustsStack" to better describe what
the variable actually tracks.

N.B., several back-ends are using "HasCalls" as being synonymous for something
that adjusts the stack. This isn't 100% correct and should be looked into.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103802 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:14:32 +00:00
Devang Patel
98e1cac52c Add support to preserve type info for the variables that are removed by the optimizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103798 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 21:01:35 +00:00
Jakob Stoklund Olesen
1b2c761a9c When verifying two-address instructions, check the following:
- Kill is implicit when use and def registers are identical.
- Only virtual registers can differ.

Add a -verify-fast-regalloc to run the verifier before the fast allocator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103797 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 20:28:32 +00:00
Jakob Stoklund Olesen
4ed1082683 Simplify the handling of physreg defs and uses in RegAllocFast.
This adds extra security against using clobbered physregs, and it adds kill
markers to physreg uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 18:03:25 +00:00
Daniel Dunbar
bd616b69f7 XFAIL the test I added with vg_leak, apparently it is the first and only llc
-filetype=obj test, and -filetype=obj leaks a few objects. Added a FIXME, we
need to sort out the ownership model for the various MC objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103769 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 07:47:51 +00:00
Daniel Dunbar
d11d59e35a Inline Asm: Ensure buffer is newline terminated to match how the text is printed.
- This is a hack, but I can't decide the best place to handle this. Chris?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103765 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 04:31:50 +00:00
Jakob Stoklund Olesen
7ff82e1501 Enable opportunistic coalescing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103764 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 04:30:51 +00:00
Jakob Stoklund Olesen
57b6076d34 Trust kill flags from isel and later passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 00:02:23 +00:00
Jakob Stoklund Olesen
7d4f25904d Fix an embarrassing runtime regression for RegAllocFast.
This loop is quadratic in the capacity for a DenseMap:

  while(!map.empty())
    map.erase(map.begin());

Instead we now do a normal begin() - end() iteration followed by map.clear().
That also has the nice sideeffect of shrinking the map capacity on demand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103747 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 00:02:20 +00:00
Dale Johannesen
a5afa1cb21 Implement a correct ui64->f32 conversion. The old
one was subject to double rounding in extreme cases.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103744 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 23:50:42 +00:00
Jakob Stoklund Olesen
c9c4dacd03 Clean up RegAllocFast debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103739 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 20:43:17 +00:00
Dan Gohman
e6cd757e68 Teach MachineLICM and MachineSink how to clear kill flags conservatively
when they move instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 20:34:42 +00:00
Dan Gohman
49b4589978 Add a utility function for conservatively clearing kill flags, and make
use of it in MachineCSE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103726 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 19:24:00 +00:00
Dan Gohman
e1308d86ed An Instruction has a trivial kill only if its use is in the same
basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103725 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 19:19:32 +00:00
Jakob Stoklund Olesen
4bf4bafcce Take allocation hints from copy instructions to/from physregs.
This causes way more identity copies to be generated, ripe for coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 00:19:43 +00:00
Jakob Stoklund Olesen
63e34f690c More asserts around physreg uses
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 00:19:39 +00:00
Evan Cheng
054dbb8e82 If REG_SEQUENCE source is livein, copy it first. Also, update livevariables information when a copy is introduced.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103680 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 00:00:35 +00:00
Evan Cheng
de7dea2e44 Do not attempt copy coalescing if the source and dest sub-register indices do not match.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103679 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 23:59:42 +00:00
Jakob Stoklund Olesen
804291e316 Make sure to add kill flags to the last use of a virtreg when it is redefined.
The X86 floating point stack pass and others depend on good kill flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103635 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 18:46:03 +00:00
Duncan Sands
5b1b3b73f2 Remove unused variable. Tweak a comment while there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 07:11:33 +00:00
Nathan Jeffords
871bb94c43 updated support for the COFF .linkonce
Now, the .linkonce directive is emitted as part of MCSectionCOFF::PrintSwitchToSection instead of AsmPrinter::EmitLinkage since it is an attribute of the section the symbol was placed into not the symbol itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103568 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 04:26:09 +00:00
Evan Cheng
736f89b1c1 Teach local regalloc about virtual registers with sub-indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 01:29:36 +00:00
Evan Cheng
3ae56bcd8a Code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 01:27:49 +00:00
Jakob Stoklund Olesen
1a1ad578a3 Avoid scoping issues, fix buildbots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103530 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 00:11:19 +00:00
Dan Gohman
a6cb641f48 Add initial kill flag support to FastISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103529 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 23:54:07 +00:00
Daniel Dunbar
0efd768aea Make Clang happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103528 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 23:53:13 +00:00
Jakob Stoklund Olesen
210e2afcc7 Store the Dirty bit in the LiveReg structure instead of a bit vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103522 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 23:24:47 +00:00
Jakob Stoklund Olesen
76b4d5a021 Keep track of the last place a live virtreg was used.
This allows us to add accurate kill markers, something the scavenger likes.
Add some more tests from ARM that needed this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103521 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 23:24:45 +00:00
Dan Gohman
9d7019f586 Don't set kill flags on uses of CopyFromReg nodes. InstrEmitter doesn't
create separate virtual registers for CopyFromReg values, so uses of
them don't necessarily kill the value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103519 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 21:59:14 +00:00
Jakob Stoklund Olesen
8e8b3cb937 Silence warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103508 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 20:51:04 +00:00
Jakob Stoklund Olesen
82b07dc499 Simplify the tracking of used physregs to a bulk bitor followed by a transitive
closure after allocating all blocks.

Add a few more test cases for -regalloc=fast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 20:30:28 +00:00