Commit Graph

5042 Commits

Author SHA1 Message Date
Anton Korobeynikov
0b12ecf6ff Turn StripPointerCast() into a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 22:54:15 +00:00
Duncan Sands
671fa97a4b Output correct exception handling and frame info
on x86-64 linux.  This causes no regressions on
32 bit linux and 32 bit ppc.  More tests pass
on 64 bit ppc with no regressions.  I didn't
turn on eh on 64 bit linux because the intrinsics
needed to compile the eh runtime aren't done
yet.  But if you turn it on and link with the
mainline runtime then eh seems to work fine
on x86-64 linux with this patch.  Thanks to
Dale for testing.  The main point of the patch
is that if you output that some object is
encoded using 4 bytes you had better not output
8 bytes for it: the patch makes everything
consistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 19:11:09 +00:00
Evan Cheng
7ebc06bfd8 Yet another nasty spiller bug.
%ecx = op
store %cl<kill>, (addr)
(addr) = op %al

It's not safe to unfold the last operand and eliminate store even though %cl is marked kill. It's a sub-register use which means one of its super-register(s) may be used below.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 00:49:28 +00:00
Dan Gohman
42ac929ed9 Fix a bug in the ComputeMaskedBits logic for multiply.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 00:35:55 +00:00
Anton Korobeynikov
b04adddd50 Make StripPointerCast a common function (should we mak it method of Value instead?)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 22:52:30 +00:00
Dan Gohman
4a3f6c8882 Make several variable declarations static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:53:16 +00:00
Dan Gohman
84b7df43fb Remove uses of llvm/System/IncludeFile.h that are no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:32:53 +00:00
Dan Gohman
54eed37131 Instead of enumerating each opcode that isn't handled that
ComputeMaskedBits handles, just use a 'default:'. This avoids
TargetLowering's list getting out of date with SelectionDAG's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 00:53:29 +00:00
Dan Gohman
23e1df8b8d Correct the value of LowBits in srem and urem handling in
ComputeMaskedBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 00:51:48 +00:00
Dan Gohman
703bfe6909 Fix a broken doxygen comment, and reword it for clarity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 00:20:10 +00:00
Mon P Wang
63307c335a Added addition atomic instrinsics and, or, xor, min, and max.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50663 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 19:05:59 +00:00
Dan Gohman
87c3d4173e Fix a bug in the ELF writer that caused it to produce malformed
ELF headers. The ELF writer still isn't generally usable though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 16:48:32 +00:00
Dan Gohman
a779a9899a Add AsmPrinter support for emitting a directive to declare that
the code being generated does not require an executable stack.

Also, add target-specific code to make use of this on Linux
on x86. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50634 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 00:28:39 +00:00
Dan Gohman
1d9cd50677 Fix a mistake in the computation of leading zeros for udiv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 21:30:02 +00:00
Dan Gohman
7ceda160b3 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 00:05:03 +00:00
Dan Gohman
1fa850bdd2 Use push_back(...) instead of resize(1, ...), per review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 00:03:54 +00:00
Dan Gohman
cba3b44d25 Fix uninitialized uses of the FPC variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50558 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 23:40:44 +00:00
Chris Lattner
6bf30ab347 don't randomly miscompile seto/setuo just because we are in
ffastmath mode.  This fixes rdar://5902801, a miscompilation
of gcc.dg/builtins-8.c.

Bill, please pull this into Tak.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 07:26:11 +00:00
Arnold Schwaighofer
30e62c098b Tail call optimization improvements:
Move platform independent code (lowering of possibly overwritten
arguments, check for tail call optimization eligibility) from
target X86ISelectionLowering.cpp to TargetLowering.h and
SelectionDAGISel.cpp.

Initial PowerPC tail call implementation:

Support ppc32 implemented and tested (passes my tests and
test-suite llvm-test).  
Support ppc64 implemented and half tested (passes my tests).
On ppc tail call optimization is performed if 
  caller and callee are fastcc
  call is a tail call (in tail call position, call followed by ret)
  no variable argument lists or byval arguments
  option -tailcallopt is enabled
Supported:
 * non pic tail calls on linux/darwin
 * module-local tail calls on linux(PIC/GOT)/darwin(PIC)
 * inter-module tail calls on darwin(PIC)
If constraints are not met a normal call will be emitted.

A test checking the argument lowering behaviour on x86-64 was added.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 09:16:33 +00:00
Dale Johannesen
21d972ad04 Add comments for previous patch as requested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 00:43:29 +00:00
Scott Michel
82747a5484 Fix custom target lowering for zero/any/sign_extend: make sure that
DAG.UpdateNodeOperands() is called before (not after) the call to
TLI.LowerOperation().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 00:26:38 +00:00
Dale Johannesen
7b251e0474 Make eh_frame objects by 8-byte aligned on 64-bit
targets.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 22:58:20 +00:00
Roman Levenstein
a0201d5204 Use std::set instead of std::priority_queue for the RegReductionPriorityQueue.
This removes the existing bottleneck related to the removal of elements from 
the middle of the queue.

Also fixes a subtle bug in ScheduleDAGRRList::CapturePred:
It was updating the state of the SUnit before removing it. As a result, the
comparison operators were working incorrectly and this SUnit could not be removed 
from the queue properly.

Reviewed by Evan and Dan. Approved by Dan.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50412 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 09:07:59 +00:00
Chris Lattner
3fb2968f2f make the vector conversion magic handle multiple results.
We now compile test2/test3 to:

_test2:
	## InlineAsm Start
	set %xmm0, %xmm1
	## InlineAsm End
	addps	%xmm1, %xmm0
	ret
_test3:
	## InlineAsm Start
	set %xmm0, %xmm1
	## InlineAsm End
	paddd	%xmm1, %xmm0
	ret

as expected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 04:48:56 +00:00
Chris Lattner
41f6259a4b add support for multiple return values in inline asm. This is a step
towards PR2094.  It now compiles the attached .ll file to:

_sad16_sse2:
	movslq	%ecx, %rax
	## InlineAsm Start
	%ecx %rdx %rax %rax %r8d %rdx %rsi
	## InlineAsm End
	## InlineAsm Start
	set %eax
	## InlineAsm End
	ret

which is pretty decent for a 3 output, 4 input asm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50386 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 04:29:54 +00:00
Evan Cheng
8509fcf8eb Another extract_subreg coalescing bug.
e.g.
vr1024<2> extract_subreg vr1025, 2
If vr1024 do not have the same register class as vr1025, it's not safe to coalesce this away. For example, vr1024 might be a GPR32 while vr1025 might be a GPR64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50385 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 01:41:44 +00:00
Evan Cheng
33bf38ad88 Fix a bug in RegsForValue::getCopyToRegs() that causes cyclical scheduling units. If it's creating multiple CopyToReg nodes that are "flagged" together, it should not create a TokenFactor for it's chain outputs:
c1, f1 = CopyToReg                                                                                                                                                                                             
c2, f2 = CopyToReg                                                                                                                                                                                             
c3     = TokenFactor c1, c2                                                                                                                                                                                    
 ...                                                                                                                                                                                                                      
       = user c3, ..., f2

Now that the two CopyToReg's and the user are "flagged" together. They effectively forms a single scheduling unit. The TokenFactor is now both an operand and a successor of the Flagged nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50376 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 22:07:13 +00:00
Dan Gohman
187db7b950 Evan pointed out that folding sext to zext may not be correct
if the zext is not legal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50368 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 18:47:17 +00:00
Dan Gohman
ebc3a3a3b2 Delete an unused constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50367 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 18:28:49 +00:00
Dan Gohman
10a6b7ab65 Add a comment to CreateRegForValue that clarifies the handling of
aggregate types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50366 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 18:19:43 +00:00
Dan Gohman
0fe00906c8 Rewrite the comments for RegsForValue and its members, and
reorder some of the members for clarity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50365 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 18:10:39 +00:00
Dan Gohman
b20d4f8d49 Don't call size() on each iteration of the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 17:42:03 +00:00
Dan Gohman
1f13c686df Fix the SVOffset values for loads and stores produced by
memcpy/memset expansion. It was a bug for the SVOffset value
to be used in the actual address calculations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 17:15:20 +00:00
Dan Gohman
23e8b71526 Teach InstCombine's ComputeMaskedBits what SelectionDAG's
ComputeMaskedBits knows about cttz, ctlz, and ctpop. Teach
SelectionDAG's ComputeMaskedBits what InstCombine's knows
about SRem. And teach them both some things about high bits
in Mul, UDiv, URem, and Sub. This allows instcombine and
dagcombine to eliminate sign-extension operations in
several new cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 17:02:21 +00:00
Dan Gohman
8f0ad582e8 Teach DAGCombine to convert (sext x) to (zext x) when the
sign-bit of x is known to be zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 16:58:24 +00:00
Chris Lattner
6833b0601b Another collection of random cleanups. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 07:16:35 +00:00
Chris Lattner
b606dba13b Remove the SmallVector ctor that converts from a SmallVectorImpl. This
conversion open the door for many nasty implicit conversion issues, and
can be easily solved by initializing with (V.begin(), V.end()) when 
needed.

This patch includes many small cleanups for sdisel also.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 06:44:42 +00:00
Chris Lattner
8eaff0449c switch RegsForValue::Regs to be a SmallVector to avoid
heap thrash on tiny (usually single-element) vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 06:02:19 +00:00
Chris Lattner
f899fce0c0 move static function out of anon namespace, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 23:48:12 +00:00
Chris Lattner
acf8b01fd6 Another step to getting multiple result inline asm to work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 23:44:28 +00:00
Chris Lattner
24e1a9d311 typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 01:49:46 +00:00
Chris Lattner
5a09690446 Implement a signficant optimization for inline asm:
When choosing between constraints with multiple options,
like "ir", test to see if we can use the 'i' constraint and
go with that if possible.  This produces more optimal ASM in
all cases (sparing a register and an instruction to load it),
and fixes inline asm like this:

void test () {
  asm volatile (" %c0 %1 " : : "imr" (42), "imr"(14));
}

Previously we would dump "42" into a memory location (which
is ok for the 'm' constraint) which would cause a problem
because the 'c' modifier is not valid on memory operands.

Isn't it great how inline asm turns 'missed optimization'
into 'compile failed'??

Incidentally, this was the todo in 
PowerPC/2007-04-24-InlineAsm-I-Modifier.ll

Please do NOT pull this into Tak.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 00:37:18 +00:00
Chris Lattner
507ffd2423 isa+cast -> dyn_cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 00:16:18 +00:00
Chris Lattner
4376fea663 Move a bunch of inline asm code out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 00:09:47 +00:00
Chris Lattner
5e764233f3 A few inline asm cleanups:
- Make targetlowering.h fit in 80 cols.
  - Make LowerAsmOperandForConstraint const.
  - Make lowerXConstraint -> LowerXConstraint
  - Make LowerXConstraint return a const char* instead of taking a string byref.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-26 23:02:14 +00:00
Dan Gohman
23ce502cb7 Remove the code from CodeGenPrepare that moved getresult instructions
to the block that defines their operands. This doesn't work in the
case that the operand is an invoke, because invoke is a terminator
and must be the last instruction in a block.

Replace it with support in SelectionDAGISel for copying struct values
into sequences of virtual registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 18:27:55 +00:00
Nate Begeman
6867991d54 Pull the code to perform an INSERT_VECTOR_ELT in memory out into its own
function, and then use it to fix a bug in SplitVectorOp that expected inserts
to always have constant insertion indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50273 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 18:07:40 +00:00
Evan Cheng
a971dbdde2 - Check if a register is livein before removing it. It may have already been removed.
- Do not iterate over SmallPtrSet, the order of iteration is not deterministic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 09:06:33 +00:00
Dan Gohman
67780f108c Use isa instead of dyn_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 20:25:16 +00:00
Dan Gohman
3dc34f682d Add support to codegen for getresult instructions with undef operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 20:21:29 +00:00