Commit Graph

9642 Commits

Author SHA1 Message Date
Anton Korobeynikov
c4e8bec703 Revert r56675 - it breaks unwinding runtime everywhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 11:09:36 +00:00
Dale Johannesen
880ae364ba Make atomic Swap work, 64-bit on x86-32.
Make it all work in non-pic mode.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 22:25:52 +00:00
Dale Johannesen
1b54c7fe9b Pass MemOperand through for 64-bit atomics on 32-bit,
incidentally making the case where the memop is a
pointer deref work.  Fix cmp-and-swap regression.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57027 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 19:41:08 +00:00
Dan Gohman
da8ac5fd91 Avoid creating two TargetLowering objects for each target.
Instead, just create one, and make sure everything that needs
it can access it. Previously most of the SelectionDAGISel
subclasses all had their own TargetLowering object, which was
redundant with the TargetLowering object in the TargetMachine
subclasses, except on Sparc, where SparcTargetMachine
didn't have a TargetLowering object. Change Sparc to work
more like the other targets here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57016 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 16:55:19 +00:00
Dan Gohman
38217fef57 Remove an unused field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57014 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 16:17:33 +00:00
Jim Grosbach
48b828fdb4 Indexing off by one resulted in errant encoding of source register for
reg->reg moves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:53:56 +00:00
Jim Grosbach
016d34cc4c NeedStub/DoesntNeedStub logic was reversed, leading to not using a stub
for global relocations that do need them (libc calls, for example).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57010 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:52:42 +00:00
Dan Gohman
d735b8019b Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:45:36 +00:00
Dan Gohman
4e6ed5eefd Fix X86FastISel to handle dynamic allocas that have avoided
getting inserted into the ValueMap. This avoids infinite
recursion in some rare cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 01:27:49 +00:00
Dan Gohman
d98d6203e4 Optimize conditional branches in X86FastISel. This replaces
sequences like this:
       sete    %al
       testb   %al, %al
       jne     LBB11_1
with this:
       je      LBB11_1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56969 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 22:15:21 +00:00
Dale Johannesen
48c1bc2ace Handle some 64-bit atomics on x86-32, some of the time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 18:53:47 +00:00
Dan Gohman
5bbee4b40a Work around an interaction between fast-isel and regalloc=local. The
local register allocator's physreg liveness doesn't recognize subregs,
so it doesn't know that defs of %ecx that are immediately followed by
uses of %cl aren't dead. This comes up due to the way fast-isel emits
shift instructions.

This is a temporary workaround. Arguably, local regalloc should
handle subreg references correctly. On the other hand, perhaps
fast-isel should use INSERT_SUBREG instead of just assigning to the
most convenient super-register of %cl when lowering shifts.

This fixes MultiSource/Benchmarks/MallocBench/espresso,
MultiSource/Applications/hexxagon, and others, under -fast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56947 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 14:56:12 +00:00
Bill Wendling
5e249b4a14 "The original bug was a complaint that _mm_srli_si128 mis-compiled when passed
a constant vector ("{0x123, 0x456}" syntax).  The fix is to simplify the
_mm_srli_si128 macro, and  move the "* 8" from the macro into the compiler
back-end.  I can't change the existing __builtins because so many people are
using them :-(."
Patch by Stuart Hastings!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56944 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 05:56:52 +00:00
Devang Patel
4ae641f4d1 Remove OptimizeForSize global. Use function attribute optsize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 23:18:38 +00:00
Dan Gohman
6d4b052579 Split x86's ADJCALLSTACK instructions into 32-bit and 64-bit forms.
This allows the 64-bit forms to use+def RSP instead of ESP. This
doesn't fix any real bugs today, but it is more precise and it
makes the debug dumps on x86-64 look more consistent.

Also, add some comments describing the CALL instructions' physreg
operand uses and defs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56925 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 18:28:06 +00:00
Jim Grosbach
efd30ba798 Fix typo s/ther/there/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 18:16:49 +00:00
Dan Gohman
2662d55866 Mark CALL instructions as having a Use of ESP/RSP.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56911 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 04:14:30 +00:00
Bill Wendling
6158d8492c Implement the -fno-builtin option in the front-end, not in the back-end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 00:59:58 +00:00
Bill Wendling
6e08738d4b Just don't transform this memset into "bzero" if no-builtin is specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 22:05:33 +00:00
Bill Wendling
6f287b22d2 Add the new `-no-builtin' flag. This flag is meant to mimic the GCC
`-fno-builtin' flag. Currently, it's used to replace "memset" with "_bzero"
instead of "__bzero" on Darwin10+. This arguably violates the meaning of this
flag, but is currently sufficient. The meaning of this flag should become more
specific over time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56885 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 21:22:07 +00:00
Dan Gohman
f06c835f76 Optimize SelectionDAG's AssignTopologicalOrder even further.
Completely eliminate the TopOrder std::vector. Instead, sort
the AllNodes list in place. This also eliminates the need to
call AllNodes.size(), a linear-time operation, before
performing the sort.

Also, eliminate the Sources temporary std::vector, since it
essentially duplicates the sorted result as it is being
built.

This also changes the direction of the topological sort
from bottom-up to top-down. The AllNodes list starts out in
roughly top-down order, so this reduces the amount of
reordering needed. Top-down is also more convenient for
Legalize, and ISel needed only minor adjustments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56867 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 18:30:35 +00:00
Dan Gohman
5396c99baa Fix X86FastISel's output for x86-32 PIC constant pool addresses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56829 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 01:21:32 +00:00
Dan Gohman
57c3dac0df Move the GlobalBaseReg field out of X86ISelDAGToDAG.cpp
and X86FastISel.cpp into X86MachineFunction.h, so that it
can be shared, instead of having each selector keep track
of its own.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 00:58:23 +00:00
Dan Gohman
9b66d73bb1 Disable all x87 usage, including f32 and f64 when the subtarget
doesn't have SSE(2), with X86FastISel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56823 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 00:48:39 +00:00
Dale Johannesen
71d1bf55a2 Remove misuse of ReplaceNodeResults for atomics with
valid types.  No functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56808 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 22:25:26 +00:00
Dan Gohman
7962e856d1 Fix an over-pessimization about GlobalVariable addresses in X86FastISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 21:13:15 +00:00
Evan Cheng
d47e0b664f Fix PR2835. Do not change the width of a volatile load.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 17:26:18 +00:00
Duncan Sands
5df3186f59 Rename isWeakForLinker to mayBeOverridden. Use it
instead of hasWeakLinkage in a bunch of optimization
passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56782 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 11:25:42 +00:00
Evan Cheng
184793fc8a Re-apply 56683 with fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-27 01:56:22 +00:00
Daniel Dunbar
02a4da2c22 Unbreak build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56727 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-27 00:22:09 +00:00
Devang Patel
2c9c3e7368 Implement function notes as function attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:51:19 +00:00
Evan Cheng
b7a75a5a54 Implement "punpckldq %xmm0, $xmm0" as "pshufd $0x50, %xmm0, %xmm" unless optimizing for code size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:41:32 +00:00
Bill Wendling
d5d8191b20 Temporarily reverting r56683. This is causing a failure during the build of llvm-gcc:
/Volumes/Gir/devel/llvm/clean/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.obj/./gcc/ -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Gir/devel/llvm/clean/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -mmacosx-version-min=10.4 -O2  -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Gir/devel/llvm/clean/llvm.obj/include -I/Volumes/Gir/devel/llvm/clean/llvm.src/include -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c ../../llvm-gcc.src/gcc/unwind-dw2-fde-darwin.c -o libgcc/./unwind-dw2-fde-darwin.o
Assertion failed: (TargetRegisterInfo::isVirtualRegister(regA) && TargetRegisterInfo::isVirtualRegister(regB) && "cannot update physical register live information"), function runOnMachineFunction, file /Volumes/Gir/devel/llvm/clean/llvm.src/lib/CodeGen/TwoAddressInstructionPass.cpp, line 311.
../../llvm-gcc.src/gcc/unwind-dw2.c:1527: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
{standard input}:3521:non-relocatable subtraction expression, "_dwarf_reg_size_table" minus "L20$pb"
{standard input}:3521:symbol: "_dwarf_reg_size_table" can't be undefined in a subtraction expression
{standard input}:3520:non-relocatable subtraction expression, "_dwarf_reg_size_table" minus "L20$pb"
...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 22:10:44 +00:00
Dan Gohman
7810bfed55 Rename ConstantSDNode's getSignExtended to getSExtValue, for
consistancy with ConstantInt, and re-implement it in terms
of ConstantInt's getSExtValue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56700 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:54:37 +00:00
Dan Gohman
83ccd14228 Mark lea fi# as being really rematerializable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56698 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:30:20 +00:00
Evan Cheng
c739489c19 unpckhps requires sse1, punpckhdq requires sse2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:26:30 +00:00
Dan Gohman
09aae469ce Fix X86FastISel's address folding to check displacement
values for overflow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56686 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 20:04:15 +00:00
Evan Cheng
36a55023c1 Fix @llvm.frameaddress codegen. FP elimination optimization should be disabled when frame address is desired. Also add support for depth > 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:48:35 +00:00
Oscar Fuentes
dbc2e856fc CMake: Builds all examples. Corrected name of CBackend target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:48:03 +00:00
Dale Johannesen
86098bd6a6 Add "inreg" field to CallSDNode (doesn't increase
its size).  Adjust various lowering functions to
pass this info through from CallInst.  Use it to
implement sseregparm returns on X86.  Remove
X86_ssecall calling convention.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:31:26 +00:00
Dan Gohman
97135e1ee5 Factor out the code for determining when symblic addresses
require RIP-relative addressing and use it to fix a bug
in X86FastISel in x86-64 PIC mode, where it was trying to
use base/index registers with RIP-relative addresses. This
fixes a bunch of x86-64 testsuite failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:15:30 +00:00
Evan Cheng
a67f32abb5 Avoid spilling EBP / RBP twice in the prologue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56675 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:14:21 +00:00
Evan Cheng
4367ff7aff X86 address displacement field must be interpreted as a 32-bit value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56665 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 16:58:16 +00:00
Oscar Fuentes
e1ad087fcb CMake: Builds all targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56641 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 04:40:32 +00:00
Dan Gohman
5af29c2e57 Disable support for x86_f80 in X86FastISel. Supporting it would
require more work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 01:39:32 +00:00
Bill Wendling
d751c64a67 If we have a function with an unreachable statement such that the ending debug
information is in an unreachable block, then it's possible that the high/low pc
values won't be set for the dwarf information. E.g., this function:

void abort(void) __attribute__((__noreturn__));
void dead_beef(void) __attribute__ ((noreturn));

int *b;

void dead_beef(void) {
  *b=0xdeadbeef;
  abort();
}

has a call to "@llvm.dbg.region.end" only in the unreachable block:

define void @dead_beef() noreturn nounwind  {
entry:
	call void @llvm.dbg.func.start(...)
	call void @llvm.dbg.stoppoint(...)
...
	call void @abort( ) noreturn nounwind 
	unreachable

return:		; No predecessors!
	call void @llvm.dbg.stoppoint(...)
	call void @llvm.dbg.region.end(...)
	ret void
}

The dwarf information emitted is something like:

0x00000084:     TAG_subprogram [5]  
                 AT_name( "dead_beef" )
                 AT_external( 0x01 )
                 AT_prototyped( 0x01 )
                 AT_decl_file( 0x01 )
                 AT_decl_line( 0x08 )

Note that this is *not* the best fix for this problem, but a band-aid for an
gaping wound. This code needs to be changed when we revamp our debugging
information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 00:28:12 +00:00
Evan Cheng
4dcc8a373d Prefer movlhps over punpcklqdq, etc. in more cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 23:35:16 +00:00
Dan Gohman
789ce77c6a Fix a bug in which address displacements were being added to the
load from the stub, instead of the result of the load from the stub.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56626 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 23:34:02 +00:00
Devang Patel
0598866c05 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:45 +00:00
Anton Korobeynikov
32b952a2a6 Reapply 56585:56589 with proper fix for some gcc versions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:33 +00:00