Commit Graph

60760 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
aa4b0159da Avoid allocating the same physreg to multiple virtregs in one instruction.
While that approach works wonders for register pressure, it tends to break
everything.

This should unbreak the arm-linux builder and fix a number of miscompilations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 17:18:59 +00:00
Jakob Stoklund Olesen
f3ea06b108 Minor optimizations. DenseMap::begin() is surprisingly slow on an empty map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103940 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 15:30:37 +00:00
Jakob Stoklund Olesen
548643c573 Extract spill cost calculation to a new method, and use definePhysReg() to clear
out aliases when allocating. Clean up allocVirtReg().

Use calcSpillCost() to allow more aggressive hinting. Now the hint is always
taken unless blocked by a reserved register. This leads to more coalescing,
lower register pressure, and less spilling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 15:30:32 +00:00
Zhongxing Xu
bae5210321 Remove unused member variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103936 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 09:47:55 +00:00
Jakob Stoklund Olesen
0c9e4f5f3f Only use clairvoyance when defining a register, and then only if it has one use.
This makes allocation independent on the ordering of use-def chains.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 04:50:57 +00:00
Jakob Stoklund Olesen
646dd7c899 Eliminate a hash table probe when killing virtual registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 03:26:09 +00:00
Jakob Stoklund Olesen
ac3e529831 Execute virtreg kills immediately instead of after processing all uses.
This is safe to do because the physreg has been marked UsedInInstr and the kill flag will be set on the last operand using the virtreg if there are more then one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 03:26:06 +00:00
Jakob Stoklund Olesen
41e1401de5 Sprinkle superregister <imp-def> and <imp-kill> operands when dealing with subregister indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 02:49:21 +00:00
Jakob Stoklund Olesen
4b6bbe885d Now that we don't keep live registers across calls, there is not reason to go
through the very long list of call-clobbered registers. We just assume all
registers are clobbered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 02:49:18 +00:00
Jakob Stoklund Olesen
844db9cc6f Boldly attempt consistent capitalization. Functional changes unintended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 02:49:15 +00:00
Eric Christopher
d04d98d24f Assume that we'll handle mangling the symbols earlier and just put the
symbol to the file as we have it.  Simplifies out tbss handling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 02:13:02 +00:00
Jakob Stoklund Olesen
e6aba83797 Spill and kill all virtual registers across a call.
Debug code doesn't use callee saved registers anyway, and the code is simpler this way. Now spillVirtReg always kills, and the isKill parameter is not needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 02:07:32 +00:00
Jakob Stoklund Olesen
01dcbf8507 Reduce hashtable probes by using DenseMap::insert() for lookup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 02:07:29 +00:00
Jakob Stoklund Olesen
6fb69d85e9 Make MBB a class member instead of passing it around everywhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 02:07:22 +00:00
Evan Cheng
ad6c5a20ba Yes, if the redef is a copy, update the old val# with the copy. But make sure to clear the copy field if the redef is not a copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 01:47:47 +00:00
Evan Cheng
9c207ac0dc No reason not to run the NEON domain croassing fix up pass in thumb2 mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 01:11:46 +00:00
Dale Johannesen
88dc976102 Removing as part of previous reversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 20:19:40 +00:00
Dale Johannesen
f7f5a2760a Revert 103911; it broke a test that expects bitconvert
<1xi64> -> i64 to work in MMX registers on hosts where -no-sse
is the default (not mine).  The right thing is
to accept this and make i64->f64 conversions go through memory,
but I don't have time right now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 20:19:04 +00:00
Dale Johannesen
f9b2242927 Make x86-64 64-bit bitconvert work when SSE is not available.
(This worked as of about 6 months ago and I didn't track down
exactly what broke it; I think this fix is appropriate.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103911 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 18:22:38 +00:00
Anton Korobeynikov
bd91ea53f8 Chris said that the comment char should be escaped. Fix all the occurences of "@" in *.td
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 09:15:36 +00:00
Anton Korobeynikov
ded05e34b6 Add support for thiscall calling convention.
Patch by Charles Davis and Steven Watanabe!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 09:08:45 +00:00
Anton Korobeynikov
4878b8415f Generalize the ARM DAG combiner of mul with constants to all power-of-two cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103901 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 08:54:20 +00:00
Evan Cheng
8f6de385d6 Model vst lane instructions with REG_SEQUENCE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103898 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 03:27:48 +00:00
Rafael Espindola
bbe03f8d29 Avoid renaming loadable modules at install time. Now the gold plugin is named
LLVMgold.so both in both the build and install directories.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 03:13:23 +00:00
Rafael Espindola
a89efd537d Use $ORIGIN in the rpath of libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 03:05:14 +00:00
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
Anton Korobeynikov
a9790d739a Some cheap DAG combine goodness for multiplication with a particular constant.
This can be extended later on to handle more "complex" constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103881 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 18:16:59 +00:00
Anton Korobeynikov
418d1d954d "trap" pseudo-op turned out to be apple-local.
Temporary emit it as raw bytes until it will be added to binutils as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103878 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 17:19:20 +00:00
Chris Lattner
4c297c9153 improve portability to systems that don't have round, patch by
Evzen Muller!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103877 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 17:11:55 +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
Evan Cheng
7189fd03fa Model 128-bit vld lane with REG_SEQUENCE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103868 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 07:53:37 +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
Nick Lewycky
54b78dca4e Teach the always inliner to release its inline cost estimates, like the basic
inliner did in r103653. Why does the always inliner even bother with cost
estimates anyways?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 04:26:25 +00:00
Nick Lewycky
1462a9b97f Clean up, no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 03:41:58 +00:00
Jakob Stoklund Olesen
c66c78c684 Add reg_nodbg_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 02:52:58 +00:00
Evan Cheng
4782b1e2ca v4i64 and v8i64 are only synthesizable when NEON is available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 02:20:21 +00:00
Evan Cheng
06b666c705 Allow TargetLowering::getRegClassFor() to be called on illegal types. Also
allow target to override it in order to map register classes to illegal
but synthesizable types. e.g. v4i64, v8i64 for ARM / NEON.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103854 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 02:18:07 +00:00
Evan Cheng
7092c2bfcb Model 64-bit lane vld with REG_SEQUENCE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 01:36:29 +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
fd72617688 Add some comments about undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103834 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 23:01:02 +00:00
Evan Cheng
12c24690c7 Model VST*_UPD and VST*oddUPD pair with REG_SEQUENCE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 22:54:52 +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
Bill Wendling
23ead99283 SystemZ really does mean "has calls" and not just "adjusts stack." Go ahead and
replace the check with the appropriate predicate. Modify the testcase to reflect
the correct code. (It should be saving callee-saved registers on the stack
allocated by the calling fuction.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103829 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 22:17:42 +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