oota-llvm.git
16 years agoMake the 'shrink global to bool' optimization more self contained, and thus
Chris Lattner [Mon, 14 Jan 2008 01:17:44 +0000 (01:17 +0000)]
Make the 'shrink global to bool' optimization more self contained, and thus
easier to show that its safe.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45946 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTurn a memcpy from a double* into a load/store of double instead of
Chris Lattner [Mon, 14 Jan 2008 00:28:35 +0000 (00:28 +0000)]
Turn a memcpy from a double* into a load/store of double instead of
a load/store of i64.  The later prevents promotion/scalarrepl of the
source and dest in many cases.

This fixes the 300% performance regression of the byval stuff on
stepanov_v1p2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45945 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofactor memcpy/memmove simplification out to its own SimplifyMemTransfer
Chris Lattner [Sun, 13 Jan 2008 23:50:23 +0000 (23:50 +0000)]
factor memcpy/memmove simplification out to its own SimplifyMemTransfer
method, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45944 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agosimplify some code. If we can infer alignment for source and dest that are
Chris Lattner [Sun, 13 Jan 2008 22:30:28 +0000 (22:30 +0000)]
simplify some code.  If we can infer alignment for source and dest that are
greater than memcpy alignment, and if we lower to load/store, use the best
alignment info we have.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45943 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agosimplify some code by adding a InsertBitCastBefore method,
Chris Lattner [Sun, 13 Jan 2008 22:23:22 +0000 (22:23 +0000)]
simplify some code by adding a InsertBitCastBefore method,
make memmove->memcpy conversion a bit simpler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45942 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhitespace tweak.
Duncan Sands [Sun, 13 Jan 2008 21:20:29 +0000 (21:20 +0000)]
Whitespace tweak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45940 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove the assumption that byval has been applied to
Duncan Sands [Sun, 13 Jan 2008 21:19:59 +0000 (21:19 +0000)]
Remove the assumption that byval has been applied to
a pointer to a struct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45939 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow the byval attribute for pointers to any type with
Duncan Sands [Sun, 13 Jan 2008 21:19:12 +0000 (21:19 +0000)]
Allow the byval attribute for pointers to any type with
a size, not just structs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45938 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR1907, a nasty miscompilation because instcombine didn't
Chris Lattner [Sun, 13 Jan 2008 20:59:02 +0000 (20:59 +0000)]
Fix PR1907, a nasty miscompilation because instcombine didn't
realize that ne & sgt  was a signed comparison (it was only
looking at whether the left compare was signed).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45937 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCheck that nested functions don't get pointless
Duncan Sands [Sun, 13 Jan 2008 18:44:12 +0000 (18:44 +0000)]
Check that nested functions don't get pointless
static chains.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45936 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSmall simplification.
Duncan Sands [Sun, 13 Jan 2008 08:12:17 +0000 (08:12 +0000)]
Small simplification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45932 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen turning a call to a bitcast function into a direct call,
Duncan Sands [Sun, 13 Jan 2008 08:02:44 +0000 (08:02 +0000)]
When turning a call to a bitcast function into a direct call,
if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45931 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agonew testcase for rdar://5685492
Chris Lattner [Sun, 13 Jan 2008 00:19:57 +0000 (00:19 +0000)]
new testcase for rdar://5685492

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45918 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoimprove cygwin compatibility, patch by Sam Bishop
Chris Lattner [Sat, 12 Jan 2008 22:54:07 +0000 (22:54 +0000)]
improve cygwin compatibility, patch by Sam Bishop

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45917 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoclarify a note
Chris Lattner [Sat, 12 Jan 2008 18:58:46 +0000 (18:58 +0000)]
clarify a  note

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45914 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd hasByValArgument() to test if a call instruction has byval argument(s).
Evan Cheng [Sat, 12 Jan 2008 18:57:32 +0000 (18:57 +0000)]
Add hasByValArgument() to test if a call instruction has byval argument(s).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45913 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agowe don't have to make an explicit copy of a byval argument when
Chris Lattner [Sat, 12 Jan 2008 18:54:29 +0000 (18:54 +0000)]
we don't have to make an explicit copy of a byval argument when
inlining a function if we know that the function does not write
to *any* memory.  This implements test/Transforms/Inline/byval2.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45912 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIndirect call with byval parameter requires a cast first.
Evan Cheng [Sat, 12 Jan 2008 18:53:07 +0000 (18:53 +0000)]
Indirect call with byval parameter requires a cast first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45911 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBe more liberal in what parameter attributes are
Duncan Sands [Sat, 12 Jan 2008 16:42:01 +0000 (16:42 +0000)]
Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45909 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow clients to specify the inline threshold when creating
Chris Lattner [Sat, 12 Jan 2008 06:49:13 +0000 (06:49 +0000)]
Allow clients to specify the inline threshold when creating
the inliner pass.  Patch by Robert Zeh.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45903 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd support for NetBSD, patch by Krister Walfridsson!
Chris Lattner [Sat, 12 Jan 2008 06:46:09 +0000 (06:46 +0000)]
Add support for NetBSD, patch by Krister Walfridsson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45902 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd -disable-lto optimization.
Evan Cheng [Sat, 12 Jan 2008 04:27:18 +0000 (04:27 +0000)]
Add -disable-lto optimization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45900 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agothis actually does pass with 4.0
Chris Lattner [Sat, 12 Jan 2008 01:45:22 +0000 (01:45 +0000)]
this actually does pass with 4.0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45899 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCode clean up.
Evan Cheng [Sat, 12 Jan 2008 01:08:07 +0000 (01:08 +0000)]
Code clean up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45898 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoByVal arguments are passed on stack. Make sure to allocate a slot using size and...
Evan Cheng [Sat, 12 Jan 2008 01:07:41 +0000 (01:07 +0000)]
ByVal arguments are passed on stack. Make sure to allocate a slot using size and alignment information on the parameter attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45897 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix a wordo that gordon noticed :)
Chris Lattner [Sat, 12 Jan 2008 00:53:16 +0000 (00:53 +0000)]
fix a wordo that gordon noticed :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45896 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAny x86 instruction that reads from an invariant location is invariant.
Chris Lattner [Sat, 12 Jan 2008 00:35:08 +0000 (00:35 +0000)]
Any x86 instruction that reads from an invariant location is invariant.
This allows us to sink things like:
cvtsi2sd 32(%esp), %xmm1
when reading from the argument area, for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45895 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoimplement support for sinking a load out the bottom of a block that
Chris Lattner [Sat, 12 Jan 2008 00:17:41 +0000 (00:17 +0000)]
implement support for sinking a load out the bottom of a block that
has no stores between the load and the end of block.  This works
great and sinks hundreds of stores, but we can't turn it on because
machineinstrs don't have volatility information and we don't want to
sink volatile stores :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45894 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoremove some incorrect classof's.
Chris Lattner [Fri, 11 Jan 2008 23:25:16 +0000 (23:25 +0000)]
remove some incorrect classof's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45893 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen DAE drops the varargs part of a function, ensure any
Duncan Sands [Fri, 11 Jan 2008 23:13:45 +0000 (23:13 +0000)]
When DAE drops the varargs part of a function, ensure any
attributes on the vararg call arguments are also dropped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45892 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMore cbe byval fixes.
Evan Cheng [Fri, 11 Jan 2008 23:10:11 +0000 (23:10 +0000)]
More cbe byval fixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45891 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agollvm-g++ 4.0 has completely different code for this warning,
Chris Lattner [Fri, 11 Jan 2008 23:06:56 +0000 (23:06 +0000)]
llvm-g++ 4.0 has completely different code for this warning,
just xfail it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45890 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agonew testcase
Chris Lattner [Fri, 11 Jan 2008 23:04:14 +0000 (23:04 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45888 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDo not allow attributes beyond a function's last
Duncan Sands [Fri, 11 Jan 2008 22:36:48 +0000 (22:36 +0000)]
Do not allow attributes beyond a function's last
parameter, even if it is a varargs function.  Do
allow attributes on the varargs part of a call,
but not beyond the last argument.  Only allow
selected attributes to be on the varargs part of
a call (currently only 'byval' is allowed).  The
reasoning here is that most attributes, eg inreg,
simply make no sense here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45887 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTeach argpromote to ruthlessly hack small byval structs when it can
Chris Lattner [Fri, 11 Jan 2008 22:31:41 +0000 (22:31 +0000)]
Teach argpromote to ruthlessly hack small byval structs when it can
get away with it, which exposes opportunities to eliminate the memory
objects entirely.  For example, we now compile byval.ll to:

define internal void @f1(i32 %b.0, i64 %b.1) {
entry:
%tmp2 = add i32 %b.0, 1 ; <i32> [#uses=0]
ret void
}

define i32 @main() nounwind  {
entry:
call void @f1( i32 1, i64 2 )
ret i32 0
}

This seems like it would trigger a lot for code that passes around small
structs (e.g. SDOperand's or _Complex)...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45886 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTwo occurrences on one line count as one...
Duncan Sands [Fri, 11 Jan 2008 21:46:24 +0000 (21:46 +0000)]
Two occurrences on one line count as one...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45885 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIf there are attributes on the varargs part of a
Duncan Sands [Fri, 11 Jan 2008 21:23:39 +0000 (21:23 +0000)]
If there are attributes on the varargs part of a
call, don't discard them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45884 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMore CellSPU refinements:
Scott Michel [Fri, 11 Jan 2008 21:01:19 +0000 (21:01 +0000)]
More CellSPU refinements:

- struct_2.ll: Completely unaligned load/store testing

- call_indirect.ll, struct_1.ll: Add test lines to exercise
   X-form [$reg($reg)] addressing

At this point, loads and stores should be under control (he says
in an optimistic tone of voice.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45882 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDisable for now.
Dale Johannesen [Fri, 11 Jan 2008 20:47:33 +0000 (20:47 +0000)]
Disable for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45881 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse smallptrset instead of std::set for efficiency.
Chris Lattner [Fri, 11 Jan 2008 19:36:30 +0000 (19:36 +0000)]
Use smallptrset instead of std::set for efficiency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45878 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoa byval argument is guaranteed to be valid to load.
Chris Lattner [Fri, 11 Jan 2008 19:34:32 +0000 (19:34 +0000)]
a byval argument is guaranteed to be valid to load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45877 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate this code to use eraseFromParent where possible. Compute
Chris Lattner [Fri, 11 Jan 2008 19:20:39 +0000 (19:20 +0000)]
Update this code to use eraseFromParent where possible.  Compute
whether an argument is byval and pass into isSafeToPromoteArgument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45876 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoreplace a loop with a constant time check.
Chris Lattner [Fri, 11 Jan 2008 18:55:10 +0000 (18:55 +0000)]
replace a loop with a constant time check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45875 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoanother minor datastructure tweak.
Chris Lattner [Fri, 11 Jan 2008 18:47:45 +0000 (18:47 +0000)]
another minor datastructure tweak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45874 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agostart using smallvector to avoid vector heap thrashing.
Chris Lattner [Fri, 11 Jan 2008 18:43:58 +0000 (18:43 +0000)]
start using smallvector to avoid vector heap thrashing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45873 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd operator==/!= to smallvector.
Chris Lattner [Fri, 11 Jan 2008 18:42:02 +0000 (18:42 +0000)]
add operator==/!= to smallvector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45872 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agorename MachineInstr::setInstrDescriptor -> setDesc
Chris Lattner [Fri, 11 Jan 2008 18:10:50 +0000 (18:10 +0000)]
rename MachineInstr::setInstrDescriptor -> setDesc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45871 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoremove xchg and shift-reg-by-1 instructions, which are dead.
Chris Lattner [Fri, 11 Jan 2008 18:00:50 +0000 (18:00 +0000)]
remove xchg and shift-reg-by-1 instructions, which are dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45870 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd a note, remove a done deed.
Chris Lattner [Fri, 11 Jan 2008 18:00:13 +0000 (18:00 +0000)]
add a note, remove a done deed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45869 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agohrm - correct spelling.
Arnold Schwaighofer [Fri, 11 Jan 2008 17:10:15 +0000 (17:10 +0000)]
hrm - correct spelling.
Actually were not riding any arguments. Sadly there is no semantic spell checker that is going to safe you from such a mistake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45868 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImprove tail call optimized call's argument lowering. Before this
Arnold Schwaighofer [Fri, 11 Jan 2008 16:49:42 +0000 (16:49 +0000)]
Improve tail call optimized call's argument lowering. Before this
commit all arguments where moved to the stack slot where they would
reside on a normal function call before the lowering to the tail call
stack slot. This was done to prevent arguments overwriting each other.
Now only arguments sourcing from a FORMAL_ARGUMENTS node or a
CopyFromReg node with virtual register (could also be a caller's
argument) are lowered indirectly.

 --This line, and those below, will be ignored--

M    X86/X86ISelLowering.cpp
M    X86/README.txt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45867 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCorrect a copy and paste error.
Arnold Schwaighofer [Fri, 11 Jan 2008 14:34:56 +0000 (14:34 +0000)]
Correct a copy and paste error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45865 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSome C backend ByVal parameter attribute support. Not yet complete.
Evan Cheng [Fri, 11 Jan 2008 09:12:49 +0000 (09:12 +0000)]
Some C backend ByVal parameter attribute support. Not yet complete.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45864 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRename Int_CVTSI642SSr* to Int_CVTSI2SS64r* for naming consistency and remove unused...
Evan Cheng [Fri, 11 Jan 2008 07:37:44 +0000 (07:37 +0000)]
Rename Int_CVTSI642SSr* to Int_CVTSI2SS64r* for naming consistency and remove unused instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45861 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agomore flags set right
Chris Lattner [Fri, 11 Jan 2008 07:18:17 +0000 (07:18 +0000)]
more flags set right

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45860 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd some missing flags.
Chris Lattner [Fri, 11 Jan 2008 06:59:07 +0000 (06:59 +0000)]
add some missing flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45859 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agodon't include loopinfo.h from this file.
Chris Lattner [Fri, 11 Jan 2008 06:30:04 +0000 (06:30 +0000)]
don't include loopinfo.h from this file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45858 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove typedef of loop to top of the file where it is more obvious.
Chris Lattner [Fri, 11 Jan 2008 06:29:42 +0000 (06:29 +0000)]
Move typedef of loop to top of the file where it is more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45857 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix 80 col violations
Chris Lattner [Fri, 11 Jan 2008 06:27:42 +0000 (06:27 +0000)]
Fix 80 col violations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45856 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agodocument the byval parameter attribute.
Chris Lattner [Fri, 11 Jan 2008 06:20:47 +0000 (06:20 +0000)]
document the byval parameter attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45855 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd some notes.
Chris Lattner [Fri, 11 Jan 2008 06:17:47 +0000 (06:17 +0000)]
add some notes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45854 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen inlining a functino with a byval argument, make an explicit
Chris Lattner [Fri, 11 Jan 2008 06:09:30 +0000 (06:09 +0000)]
When inlining a functino with a byval argument, make an explicit
copy of it in case the callee modifies the struct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45853 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoA couple of obvious off-by-one bugs.
Evan Cheng [Fri, 11 Jan 2008 03:07:46 +0000 (03:07 +0000)]
A couple of obvious off-by-one bugs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45852 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMore CellSPU refinement and progress:
Scott Michel [Fri, 11 Jan 2008 02:53:15 +0000 (02:53 +0000)]
More CellSPU refinement and progress:

- Cleaned up custom load/store logic, common code is now shared [see note
  below], cleaned up address modes

- More test cases: various intrinsics, structure element access (load/store
  test), updated target data strings, indirect function calls.

Note: This patch contains a refactoring of the LoadSDNode and StoreSDNode
structures: they now share a common base class, LSBaseSDNode, that
provides an interface to their common functionality. There is some hackery
to access the proper operand depending on the derived class; otherwise,
to do a proper job would require finding and rearranging the SDOperands
sent to StoreSDNode's constructor. The current refactor errs on the
side of being conservatively and backwardly compatible while providing
functionality that reduces redundant code for targets where loads and
stores are custom-lowered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45851 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow parameter attributes on varargs function parameters.
Evan Cheng [Fri, 11 Jan 2008 02:13:09 +0000 (02:13 +0000)]
Allow parameter attributes on varargs function parameters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45850 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWeak zeroes don't go in bss on Darwin.
Dale Johannesen [Fri, 11 Jan 2008 01:59:45 +0000 (01:59 +0000)]
Weak zeroes don't go in bss on Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45849 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWeak things initialized to 0 don't go in bss on Darwin.
Dale Johannesen [Fri, 11 Jan 2008 00:54:37 +0000 (00:54 +0000)]
Weak things initialized to 0 don't go in bss on Darwin.
Cosmetic changes to spacing to match gcc (some dejagnu
tests actually care).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45848 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimplify the side effect stuff a bit more and make licm/sinking
Chris Lattner [Thu, 10 Jan 2008 23:08:24 +0000 (23:08 +0000)]
Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad.

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags.  Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45843 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoClamp down on sinking of lots of instructions.
Chris Lattner [Thu, 10 Jan 2008 22:35:15 +0000 (22:35 +0000)]
Clamp down on sinking of lots of instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45841 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIMPLICIT_USE and IMPLICIT_DEF are dead, remove them.
Chris Lattner [Thu, 10 Jan 2008 19:27:54 +0000 (19:27 +0000)]
IMPLICIT_USE and IMPLICIT_DEF are dead, remove them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45838 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd a note
Chris Lattner [Thu, 10 Jan 2008 18:25:41 +0000 (18:25 +0000)]
add a note

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45837 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoOutput sinl for a long double FSIN node, not sin.
Duncan Sands [Thu, 10 Jan 2008 10:28:30 +0000 (10:28 +0000)]
Output sinl for a long double FSIN node, not sin.
Likewise fix up a bunch of other libcalls.  While
there I remove NEG_F32 and NEG_F64 since they are
not used anywhere.  This fixes 9 Ada ACATS failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45833 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoOnly remat loads from immutable stack slots.
Evan Cheng [Thu, 10 Jan 2008 08:24:38 +0000 (08:24 +0000)]
Only remat loads from immutable stack slots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45831 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimplify some code.
Evan Cheng [Thu, 10 Jan 2008 08:22:10 +0000 (08:22 +0000)]
Simplify some code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45830 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoStart inferring side effect information more aggressively, and fix many bugs in the
Chris Lattner [Thu, 10 Jan 2008 07:59:24 +0000 (07:59 +0000)]
Start inferring side effect information more aggressively, and fix many bugs in the
x86 backend where instructions were not marked maystore/mayload, and perf issues where
instructions were not marked neverHasSideEffects.  It would be really nice if we could
write patterns for copy instructions.

I have audited all the x86 instructions down to MOVDQAmr.  The flags on others and on
other targets are probably not right in all cases, but no clients currently use this
info that are enabled by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45829 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoClearify the meaning of immutable StackObject.
Evan Cheng [Thu, 10 Jan 2008 07:19:43 +0000 (07:19 +0000)]
Clearify the meaning of immutable StackObject.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45828 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a crash on code like: let x = 1 {x
Chris Lattner [Thu, 10 Jan 2008 07:01:53 +0000 (07:01 +0000)]
Fix a crash on code like: let x = 1 {x

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45827 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agorename X86InstrX86-64.td -> X86Instr64bit.td
Chris Lattner [Thu, 10 Jan 2008 05:50:42 +0000 (05:50 +0000)]
rename X86InstrX86-64.td -> X86Instr64bit.td

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45826 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd SDNPSideEffect node property declaration
Chris Lattner [Thu, 10 Jan 2008 05:48:23 +0000 (05:48 +0000)]
add SDNPSideEffect node property declaration

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45825 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoremove explicit sets of 'neverHasSideEffects' that can now be
Chris Lattner [Thu, 10 Jan 2008 05:45:39 +0000 (05:45 +0000)]
remove explicit sets of 'neverHasSideEffects' that can now be
inferred from the instr patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45824 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoif an instr lacks a pattern, assume it has side effects (unless never has s-e is...
Chris Lattner [Thu, 10 Jan 2008 05:40:54 +0000 (05:40 +0000)]
if an instr lacks a pattern, assume it has side effects (unless never has s-e is true).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45823 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agostart inferring 'no side effects'.
Chris Lattner [Thu, 10 Jan 2008 05:39:30 +0000 (05:39 +0000)]
start inferring 'no side effects'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45822 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoget def use info more correct.
Chris Lattner [Thu, 10 Jan 2008 05:12:37 +0000 (05:12 +0000)]
get def use info more correct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45821 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoInfer mayload
Chris Lattner [Thu, 10 Jan 2008 04:44:48 +0000 (04:44 +0000)]
Infer mayload

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45819 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd SDNPMayLoad to the 'load' sdnode definition. This is enough to get all the x86
Chris Lattner [Thu, 10 Jan 2008 04:44:32 +0000 (04:44 +0000)]
add SDNPMayLoad to the 'load' sdnode definition.  This is enough to get all the x86
instructions (with patterns) that load memory marked, for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45818 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agorealize that instructions who match intrinsics that read memory read memory.
Chris Lattner [Thu, 10 Jan 2008 04:38:57 +0000 (04:38 +0000)]
realize that instructions who match intrinsics  that read memory read memory.
Also, instructions with any nodes that are SDNPMayLoad also read memory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45817 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoverify that the frame index is immutable before remat'ing (still disabled)
Chris Lattner [Thu, 10 Jan 2008 04:16:31 +0000 (04:16 +0000)]
verify that the frame index is immutable before remat'ing (still disabled)
or being side-effect free.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45816 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't use LiveVariables::VarInfo::DefInst.
Owen Anderson [Thu, 10 Jan 2008 03:12:54 +0000 (03:12 +0000)]
Don't use LiveVariables::VarInfo::DefInst.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45815 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCodegen improvement has reduced one spill.
Evan Cheng [Thu, 10 Jan 2008 02:54:40 +0000 (02:54 +0000)]
Codegen improvement has reduced one spill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45814 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMark byval parameter stack objects mutable for now.
Evan Cheng [Thu, 10 Jan 2008 02:24:25 +0000 (02:24 +0000)]
Mark byval parameter stack objects mutable for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45813 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a isImmutable bit to StackObject. Fixed stack objects are immutable (in the funct...
Evan Cheng [Thu, 10 Jan 2008 02:18:37 +0000 (02:18 +0000)]
Add a isImmutable bit to StackObject. Fixed stack objects are immutable (in the function) unless specified otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45812 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEmit unused EH frames for weak definitions on Darwin,
Dale Johannesen [Thu, 10 Jan 2008 02:03:30 +0000 (02:03 +0000)]
Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes.
PR 1880.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45811 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoGet rid of all uses of LiveVariables::VarInfo::DefInst in favor of the equivalent...
Owen Anderson [Thu, 10 Jan 2008 01:36:43 +0000 (01:36 +0000)]
Get rid of all uses of LiveVariables::VarInfo::DefInst in favor of the equivalent API from
MachineRegisterInfo.  Once all clients are switched over, the former will be going away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45805 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoprovide def_* and use_* iterators in addition to reg_* iterators.
Chris Lattner [Thu, 10 Jan 2008 01:01:27 +0000 (01:01 +0000)]
provide def_* and use_* iterators in addition to reg_* iterators.
The first only returns definitions of a register, the second only
returns uses, the third returns both.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45803 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd more comments explaining the basics of how the decision of when to rename and...
Owen Anderson [Thu, 10 Jan 2008 00:47:01 +0000 (00:47 +0000)]
Add more comments explaining the basics of how the decision of when to rename and when to insert
copies is made.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45799 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDo not use the stack pointer directly, issue a copyfromreg instead. Otherwise we...
Evan Cheng [Thu, 10 Jan 2008 00:37:26 +0000 (00:37 +0000)]
Do not use the stack pointer directly, issue a copyfromreg instead. Otherwise we can end up with something like ADD32ri %esp, x which two-address pass won't like.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45798 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoGet rid of the isKillInst predicate. LiveVariables already provides this information.
Owen Anderson [Thu, 10 Jan 2008 00:33:11 +0000 (00:33 +0000)]
Get rid of the isKillInst predicate.  LiveVariables already provides this information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45797 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR1845 and rdar://5676945. Generic vectors smaller
Chris Lattner [Thu, 10 Jan 2008 00:30:57 +0000 (00:30 +0000)]
Fix PR1845 and rdar://5676945.  Generic vectors smaller
than hardware supported type will be scalarized, so we
can infer their alignment from that info.

We now codegen pr1845 into:

_boolVectorSelect:
lbz r2, 0(r3)
stb r2, -16(r1)
blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45796 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agonew testcase for PR1845
Chris Lattner [Thu, 10 Jan 2008 00:30:38 +0000 (00:30 +0000)]
new testcase for PR1845

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45795 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove comments that do not correspond to anything after recent refactoring.
Evan Cheng [Thu, 10 Jan 2008 00:09:10 +0000 (00:09 +0000)]
Remove comments that do not correspond to anything after recent refactoring.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45792 91177308-0d34-0410-b5e6-96231b3b80d8