Commit Graph

5658 Commits

Author SHA1 Message Date
Dan Gohman
430b8a22e2 Fix several const-correctness issues, resolving some -Wcast-qual warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 14:45:15 +00:00
Evan Cheng
4fa393aae1 Remove #if 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 07:20:57 +00:00
Evan Cheng
068b4ff553 Fix PR2568: Fix bug that cause redudant kill marker after its live interval has been extended due to coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 07:10:38 +00:00
Owen Anderson
59c0d4fcde Remove unneeded iteration. Thanks to Dan for the feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 00:30:10 +00:00
Owen Anderson
6ac8df7f61 This option doesn't need to be a target option. It can be in SDISel instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54336 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 00:27:28 +00:00
Owen Anderson
bd3ba461eb - Fix SelectionDAG to generate correct CFGs.
- Add a basic machine-level dead block eliminator.

These two have to go together, since many other parts of the code generator are unable to handle the unreachable blocks otherwise created.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54333 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:54:43 +00:00
Dan Gohman
6f498b0a8e Fix SDISel lowering of PHI nodes to use ComputeValueVTs.
This allows it to work correctly on aggregate values.
This fixes PR2623.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:42:46 +00:00
Dan Gohman
1f565bcff6 Fix SDISel lowering of zeroinitializer and undef to use ComputeValueVTs.
This allows it to work correctly on nested aggregate values.
This fixes PR2625.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:30:41 +00:00
Dale Johannesen
7232464bda Add a flag to disable jump table generation (all
switches use the binary search algorithm) for
environments that don't support it.  PPC64 JIT
is such an environment; turn the flag on for that.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 18:13:12 +00:00
Dan Gohman
75dcf08243 Improve dagcombining for sext-loads and sext-in-reg nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 00:50:31 +00:00
Dan Gohman
0b12aef490 Move SelectionDAG::viewGraph() out of line; as an inline function
it isn't always visible to gdb.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54228 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:48:53 +00:00
Dan Gohman
90d33ee746 Don't look for leaf values to store when lowering stores of
empty structs. This fixes PR2612.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:36:51 +00:00
Owen Anderson
d723f722b2 Use existing LiveInterval methods to simplify live interval merging. Thanks to Evan for pointing these out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54225 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:27:35 +00:00
Owen Anderson
912923925f Value numbers whose def index is a special sentinel value should not be remapped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 17:42:47 +00:00
Owen Anderson
9382b9310f More fixes for corner cases when remapping live range indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54186 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 00:22:56 +00:00
Owen Anderson
b9fb8d1e69 When merging live intervals, we also need to merge in any live ranges that are inputs to two-address instructions
that themselves define a range we already care about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 00:21:16 +00:00
Owen Anderson
83ea1f8e19 When merging a PHI operand's live interval into the PHI's live interval, we need to merge over all liveranges in
the operand's interval that share the relevant value number, not just the range that immediately precedes the PHI.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 21:17:08 +00:00
Owen Anderson
a0c032f9b2 Don't decrement the BB remap when we don't need to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54173 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 21:15:44 +00:00
Duncan Sands
68d4d1d49c Fix PR2609. If a label is deleted, then it needs
to be marked invalid regardless of whether it is
a debug, an exception handling or (hopefully) a
GC label.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 20:56:02 +00:00
Nate Begeman
24dc346a16 Fix broken CellSPU lowering, re-instate braces in Legalize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54168 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 19:07:27 +00:00
Nate Begeman
f09d131126 Disable a fix in the previous patch, since it breaks CellSPU.
The CellSPU codegen is broken, but needs to be fixed before we can
put this back in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 18:28:31 +00:00
Nate Begeman
5bc1ea0736 Add vector shifts to the IR, patch by Eli Friedman.
CodeGen & Clang work coming next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 15:49:41 +00:00
Dan Gohman
fed90b6d09 Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.

Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.

Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 21:51:04 +00:00
Dan Gohman
0471a79f20 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54136 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 18:43:51 +00:00
Dan Gohman
29cdb26bba Make the ScheduleDAG's GraphRoot edge be blue and dashed too, like
the SelectionDAG's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 22:46:49 +00:00
Dan Gohman
475871a144 Rename SDOperand to SDValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 21:46:04 +00:00
Dan Gohman
8968450305 Tidy SDNode::use_iterator, and complete the transition to have it
parallel its analogue, Value::value_use_iterator. The operator* method
now returns the user, rather than the use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 20:43:25 +00:00
Dan Gohman
2a6299543f Rename isOnlyUseOf to isOnlyUserOf.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54124 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 18:06:42 +00:00
Duncan Sands
4ddc41e58c Some binary operations were being treated as
unary operations!  Add support for softening
some additional unary operations like fp_to_sint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54122 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 12:28:43 +00:00
Owen Anderson
a279a896ec Fix the issues originally addressed in r54070. After thinking about it some more, I realized that the right thing to do
is to have StrongPHIElimination use its knowledge of the PHIs before they're erased to update the intervals appropriate.  This is
both simpler and more accurate than the alternative, which was having LIA figure it out when it renumbered things, plus it's just
the right thing to do!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 23:38:08 +00:00
Owen Anderson
0a7615af25 Revert my previous patch. In retrospect, this is completely the wrong way to fix this problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 23:06:59 +00:00
Owen Anderson
0c525ca72f Special cases are needed in renumbering when dealing with renumbering after a PHI has been removed. The interval previously defined
by the PHI needs to be extended to the beginning of its basic block, and the intervals that were inputs need to be trimmed to the end 
of their basic blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 22:32:01 +00:00
Owen Anderson
020decc2b4 In order to avoid reprocessing a register more than once, we need to add it
to the handled set so it will get filtered out in future iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54065 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 21:35:43 +00:00
Owen Anderson
55c64358d1 Remove live interval entries for an interval if we're eliminating its only VN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 21:08:41 +00:00
Owen Anderson
8d0cc0af5a Properly remap live ranges whose end indices are the end of the function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 21:07:13 +00:00
Owen Anderson
d7dcbecdbc Make the remapping of interval indices (particularly ending indices) more robust.
This is tricky business, and will probably take a few more iterations to get
the last kinks out of it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54043 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 19:50:48 +00:00
Dan Gohman
4c8f87038d Disable the new aggressive remat logic introduced in 54000; it causes some
regressions, such as PR2595. Also, there is a significant code-quality
issue in SPEC 464.h264ref and a few others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54014 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 15:08:37 +00:00
Mon P Wang
92879f3a9e When splitting a vector shuffle, fixed which type we used for the hi part
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 01:30:26 +00:00
Dan Gohman
8b4588fa64 Use AliasAnalysis::pointsToConstantMemory in SDISel to avoid unnecessary
dependencies with constant load nodes. This allows them to be scheduled
freely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 00:04:14 +00:00
Dan Gohman
6d69ba8a69 Enable rematerialization of constants using AliasAnalysis::pointsToConstantMemory,
and knowledge of PseudoSourceValues. This unfortunately isn't sufficient to allow
constants to be rematerialized in PIC mode -- the extra indirection is a
complication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 00:02:30 +00:00
Owen Anderson
c12417edc9 Store the predecessor MBB in the PHIUnion, rather than an index, since the indices will change after renumbering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 17:12:16 +00:00
Owen Anderson
7fbad27cfb Enable the insertion of empty indices into LiveInterals, thereby making renumbering possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 21:37:49 +00:00
Owen Anderson
496bac5b08 Fix a compile-time regression introduced by my heuristic-changing patch. I forgot
to multiply the instruction count by a constant factor in a few places, which
caused the register allocator to require many more iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 19:47:27 +00:00
Dan Gohman
fc74abfba5 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:34:11 +00:00
Duncan Sands
11e56cb4dc LegalizeTypes support for VSETCC. Fixes PR2575.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 23:54:03 +00:00
Owen Anderson
a1566f2e12 Change the heuristics used in the coalescer, register allocator, and within
live intervals itself to use an instruction count approximation that is 
not affected by inserting empty indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 22:46:49 +00:00
Evan Cheng
2925786765 Fix pr2566: incorrect assumption about bit_convert. It doesn't not have to output a vector value. Patch by Nicolas Capens!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 20:42:56 +00:00
Dan Gohman
694caf56f1 Make the GraphRoot edge look like a chain edge, which is more accurate,
and use the right result number, in the off chance that the graph root
has multiple result values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53923 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 17:52:59 +00:00
Bill Wendling
c91d0b9bdd Another buildbot test commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:53:37 +00:00
Bill Wendling
4e97401e1f Trivial check-in to test buildbot. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:28:47 +00:00
Dan Gohman
79acd2b51f Fix grammaros in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 22:38:59 +00:00
Dan Gohman
358033102f Enhance the GraphWriter support for edge destinations, and teach the
SelectionDAG graph writer to make use of them. Now, nodes with multiple
values are displayed as such, with incoming edges pointing to the
specific value they use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:06:55 +00:00
Dan Gohman
2dbc167294 After early-lowering the FORMAL_ARGUMENTS node, delete it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53874 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:04:07 +00:00
Dan Gohman
462dc7f496 Add titles to the various SelectionDAG viewGraph calls
that include useful information like the name of the
block being viewed and the current phase of compilation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53872 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 20:00:07 +00:00
Dan Gohman
80f3d46968 Fix uses of underscore-capital names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53870 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 19:48:15 +00:00
Dan Gohman
6116a73da4 Now that the MachineInstr leaks are fixed, enable leak checking
in the MachineInstr clone code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53868 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:47:29 +00:00
Duncan Sands
d038e04188 Add VerifyNode, a place to put sanity checks on
generic SDNode's (nodes with their own constructors
should do sanity checking in the constructor).  Add
sanity checks for BUILD_VECTOR and fix all the places
that were producing bogus BUILD_VECTORs, as found by
"make check".  My favorite is the BUILD_VECTOR with
only two operands that was being used to build a
vector with four elements!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 10:20:31 +00:00
Bill Wendling
fbbd701bbd Pull r53795 from Gaz into mainline:
If .loc and .file aren't used, always emit the "debug_line" section. This
requires at least one entry in the line matrix. So if there's nothing to emit
into the matrix, emit an end of matrix value anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 00:11:19 +00:00
Evan Cheng
1ed9922794 Fix a memory leak in LiveIntervalAnalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 00:37:25 +00:00
Duncan Sands
c3e26727c1 Softfloat support for FDIV. Patch by
Richard Pennington.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 21:18:48 +00:00
Duncan Sands
f8ac645c59 Eliminate unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53772 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 21:07:41 +00:00
Duncan Sands
77926da196 Revert 53729, after waking up in the middle of
the night realising that it was wrong :)  I
think the reason the same type was being used
for the shufflevec of indices as for the actual
indices is so that if one of them needs splitting
then so does the other.  After my patch it might
be that the indices need splitting but not the
rest, yet there is no good way of handling that.
I think the right solution is to not have the
shufflevec be an operand at all: just have it
be the list of numbers it actually is, stored
as extra info in the node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 20:12:05 +00:00
Dan Gohman
fa82857e41 Fix a LocalSpiller leak. This fixes tramp3d-v4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 18:28:56 +00:00
Dan Gohman
2c3f7ae384 Re-introduce LeakDetector support for MachineInstrs and MachineBasicBlocks.
Fix a leak that this turned up in LowerSubregs.cpp.
And, comment a leak in LiveIntervalAnalysis.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 23:49:46 +00:00
Dan Gohman
dc5f936bf8 When printing MemOperand nodes, only use print() for
PseudoSourceValue values, which never have names. Use getName()
for all other values, because we want to print just a short summary
of the value, not the entire instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 21:12:16 +00:00
Evan Cheng
76a4d58998 Subreg live interval valno may not have a corresponding def machineinstr since it's less precise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:48:53 +00:00
Duncan Sands
f1bb7f1d3e Use a legal type for elements of the vector_shuffle
mask.  These are just indices into the shuffled vector
so their type is unrelated to the type of the
shuffled elements (which is what was being used before).
This fixes vec_shuffle-11.ll when using LegalizeTypes.
What seems to have happened is that Dan's recent change
r53687, which corrected the result type of the shuffle,
somehow caused LegalizeTypes to notice that the mask
operand was a BUILD_VECTOR with a legal type but elements
of an illegal type (i64).  LegalizeTypes legalized this
by introducing a new BUILD_VECTOR of i32 and bitcasting
it to the old type.  But the mask operand is not supposed
to be a bitcast but a straight BUILD_VECTOR of constants,
causing a crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53729 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:28:41 +00:00
Dan Gohman
e8be6c6391 Add a new function, ReplaceAllUsesOfValuesWith, which handles bulk
replacement of multiple values. This is slightly more efficient
than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically
could be optimized even further. However, an important property of this
new function is that it handles the case where the source value set and
destination value set overlap. This makes it feasible for isel to use
SelectNodeTo in many very common cases, which is advantageous because
SelectNodeTo avoids a temporary node and it doesn't require CSEMap
updates for users of values that don't change position.

Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to
handle operand lists more efficiently, and to correctly handle a number
of corner cases to which its new wider use exposes it.

This commit also includes a change to the encoding of post-isel opcodes
in SDNodes; now instead of being sandwiched between the target-independent
pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel
opcodes are now represented as negative values. This makes it possible
to test if an opcode is pre-isel or post-isel without having to know
the size of the current target's post-isel instruction set.

These changes speed up llc overall by 3% and reduce memory usage by 10%
on the InstructionCombining.cpp testcase with -fast and -regalloc=local.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53728 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:10:17 +00:00
Duncan Sands
79ada108dd LegalizeTypes support for what seems to be the
only missing ppc long double operations: FNEG
and FP_EXTEND.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53723 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:35:14 +00:00
Duncan Sands
f00e74f4d6 Turn LegalizeTypes back off again for the moment:
it is breaking Darwin bootstrap due to missing
functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:06:03 +00:00
Duncan Sands
b2ff885aae Factorize some code for determining which libcall to use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53713 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 02:36:29 +00:00
Dan Gohman
7a9a5af6a0 Fix the result type of a VECTOR_SHUFFLE+BIT_CONVERT dagcombine. This
was turned up by some new SelectionDAG assertion checks that I'm
working on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 16:13:58 +00:00
Duncan Sands
95db39a9de Add support for promoting and expanding AssertZext
and AssertSext.  Needed when passing huge integer
parameters with the zeroext or signext attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 16:03:07 +00:00
Dan Gohman
c0d6012b31 Fix a comment to say nonnegative instead of positive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 15:57:10 +00:00
Dan Gohman
c5e1f98fdf Add an assert to check for empty flags for MachineMemOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 15:56:42 +00:00
Duncan Sands
05c397d52a Reorder methods alphabetically. No functionality change.
While this is not a wonderful organizing principle, it
does make it easy to find routines, and clear where to
insert new ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 11:41:33 +00:00
Duncan Sands
7f1d8aeef6 Turn on LegalizeTypes by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 11:36:51 +00:00
Dan Gohman
4093d83010 SelectionDAG::AssignNodeIds is unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 18:29:32 +00:00
Dan Gohman
90a7b8fba6 Don't sort SDNodes by their addresses in SelectionDAG::dump. Instead,
just use the AllNodes order, which is at least relatively stable
across runs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 18:18:54 +00:00
Duncan Sands
295a7cddbd LegalizeTypes support for fabs on ppc long double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 15:02:44 +00:00
Duncan Sands
c07e6e53f7 LegalizeTypes support for promotion of bswap.
In LegalizeDAG the value is zero-extended to
the new type before byte swapping.  It doesn't
matter how the extension is done since the new
bits are shifted off anyway after the swap, so
extend by any old rubbish bits.  This results
in the final assembler for the testcase being
one line shorter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:18:22 +00:00
Duncan Sands
8d56a6f4d8 LegalizeTypes support for promotion of SIGN_EXTEND_INREG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:14:24 +00:00
Duncan Sands
bf304c2065 Reorder the integer promotion methods alphabetically.
No change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:12:34 +00:00
Mon P Wang
2920d2b7b6 Fixed potential bug if the source and target of a bit convert have different alignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 05:28:34 +00:00
Dan Gohman
5e84368b26 Reapply 53476 and 53480, with a fix so that it properly updates
the BB member to the current basic block after emitting
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53567 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 18:19:29 +00:00
Dan Gohman
91d49f5ba1 Improve debug output for MemOperandSDNode. PseudoSourceValue nodes
don't have value names, so use print instead of getName() to get a
useful string.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:51:24 +00:00
Dan Gohman
2b062994a6 Fix edito in the PseudoSourceValue name list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:45:47 +00:00
Duncan Sands
189a2b32f8 I don't think BUILD_PAIR can have a vector result.
Remove support for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:34:19 +00:00
Duncan Sands
a489be59ef Tighten up some checks. Fix FPOWI splitting for
non-power-of-two vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53558 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:33:37 +00:00
Duncan Sands
262e04b307 An INSERT_VECTOR_ELT can insert a larger value
than the vector element type.  Don't forget to
handle this when the insertion index is not a
constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:32:02 +00:00
Duncan Sands
8cc364c5cc According to the docs, it is possible to have an
extending load of a vector.  Handle this case when
splitting vector loads.  I'm not completely sure
what is supposed to happen, but I think it means
hi should be set to undef.  LegalizeDAG does not
consider this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:27:46 +00:00
Duncan Sands
28c05ac995 There should be no extending loads or truncating
stores of one-element vectors.  Also, neaten the
handling of INSERT_VECTOR_ELT when the inserted
type is larger than the vector element type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:22:31 +00:00
Duncan Sands
d164ea2fb0 Ignore TargetConstant with an illegal type. These
are used for passing huge immediates in inline ASM
from the front-end straight down to the ASM writer.
Of course this is a hack, but it is simple, limited
in scope, works in practice, and is what LegalizeDAG
does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:15:45 +00:00
Evan Cheng
b9890ae3c3 Typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 02:22:07 +00:00
Evan Cheng
79a796c2b1 Fix PR2536: a nasty spiller bug. If a two-address instruction uses a register but the use portion of its live range is not part of its liveinterval, it must be defined by an implicit_def. In that case, do not spill the use. e.g.
8   %reg1024<def> = IMPLICIT_DEF
12  %reg1024<def> = INSERT_SUBREG %reg1024<kill>, %reg1025, 2

The live range [12, 14) are not part of the r1024 live interval since it's defined by an implicit def. It will not conflicts with live interval of r1025. Now suppose both registers are spilled, you can easily see a situation where both registers are reloaded before the INSERT_SUBREG and both target registers that would overlap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:56:02 +00:00
Evan Cheng
b5eec33dcd Back out 53476 and 53480 for now. Somehow they cause llc to miscompile 179.art.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:38:51 +00:00
Dan Gohman
a54cf17661 Include a frame index in the "fixed stack" pseudo source value
instead of using the frame index for the SVOffset, which was
inconsistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:44:52 +00:00
Dan Gohman
5e76c3be73 Fix an obsolete top-level comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53481 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:39:58 +00:00
Dan Gohman
0f4012f475 Factor out debugging code into the common base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:36:22 +00:00
Dan Gohman
dbe2a5a269 Add support for putting NamedRegionTimers in TimerGroups, and
use a timer group for the timers in SelectionDAGISel. Also,
Split scheduling out from emitting, to give each their own
timer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 21:54:34 +00:00
Dan Gohman
dc2fbddd9d Trim unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 20:38:31 +00:00
Duncan Sands
92e0834ac7 Remove an apparently useless routine: there should
be no need to split the result of a vector RET node,
since they are always already legal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53462 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 17:02:09 +00:00
Duncan Sands
ac6cecec18 It is pointless to turn a UINT_TO_FP into an
SINT_TO_FP libcall plus additional operations:
it might as well be a direct UINT_TO_FP libcall.
So only turn it into an SINT_TO_FP if the target
has special handling for SINT_TO_FP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 17:00:14 +00:00
Duncan Sands
9bed0f58eb Add two missing SINT_TO_FP libcalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:57:02 +00:00
Duncan Sands
edfba7e707 Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was
copied to LegalizeTypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:54:57 +00:00
Duncan Sands
dddc6291fb Add support for 128 bit shifts and 32 bit shifts
on 16 bit machines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53458 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:52:29 +00:00
Chris Lattner
c563e1d8fe Fix a bug in the soft-float handling of FCOPYSIGN that Duncan noticed
when working on legalizetypes.  Both legalizetypes and legalizeops now
produce hte same code for CodeGen/ARM/fcopysign.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53435 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 23:46:13 +00:00
Chris Lattner
70587ea813 make legalize types be a command line option: -enable-legalize-types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53434 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 23:37:50 +00:00
Dan Gohman
fdeb4b3f1d Make stack slot coloring's debug output more consistent with
other passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 19:49:32 +00:00
Evan Cheng
bdb10fe0f6 Change StackSlotForVirtReg (which maps vregs to frame indices) from std::map to IndexedMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 18:23:23 +00:00
Duncan Sands
5ac319ac71 Add support for 128 bit multiplicative operations.
Lack of these caused a bootstrap failure with Fortran
on x86-64 with LegalizeTypes turned on.  While there,
be nice to 16 bit machines and support expansion of
i32 too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 15:35:05 +00:00
Duncan Sands
be1ad4de29 Add a mysteriously missing libcall, FPTOSINT_F80_I32.
Be nice to 16 bit machines by supporting FP_TO_XINT
expansion for these.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 15:33:02 +00:00
Duncan Sands
03dc093a2e Fix a FIXME: use an apint in CTTZ legalization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 15:30:54 +00:00
Duncan Sands
ae099d5442 Remove PromoteIntRes_FP_ROUND - not sure what it
was doing there: FP_ROUND returns a float, not an
integer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 15:29:55 +00:00
Duncan Sands
c5ffb45934 Make sure the alignment of the temporary created
in CreateStackStoreLoad is good enough for both
the source and destination types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 15:26:17 +00:00
Duncan Sands
f4e4629ee8 Make the LegalizeType method naming scheme more regular.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 15:25:04 +00:00
Duncan Sands
e1d97b1a74 Don't barf when dumping a constant that contains
a ginormous value (eg: i128 -1).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 11:23:14 +00:00
Evan Cheng
ef0732d25a - Change the horrible N^2 isRegReDefinedByTwoAddr. Now callers must supply the operand index of def machineoperand and at most one full scan of non-implicit operands is needed.
- Change local register allocator to use the new isRegReDefinedByTwoAddr instead of reinventing the wheel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 07:35:43 +00:00
Owen Anderson
743a1e6a9c Use DenseMap instead of std::map in local register allocation. This improves the time on instcombine from .31s to .22s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53390 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 01:56:35 +00:00
Owen Anderson
ecee36ece6 Fix 403.gcc. Finally got the check for two-address-ness correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 01:53:01 +00:00
Owen Anderson
eacdef21c6 Revert r53367, which was breaking things.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53378 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 23:09:10 +00:00
Dan Gohman
b9c33c3229 Simplify hasNUsesOfValue and hasAnyUsesOfValue even more. This
makes their special-case checks of use_size() less beneficial,
so remove them. This eliminates all but one use of use_size(),
which is in AssignTopologicalOrder, which uses it only once for
each node, and so can reasonably afford to recompute it, as
this allows the UsesSize field of SDNode to be removed
altogether.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 23:03:14 +00:00
Dan Gohman
1373c1c395 hasAnyUseOfValue can check SDUse nodes of its users directly instead
of examining every operand of every user.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53374 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 22:39:01 +00:00
Dan Gohman
1ea58a52a4 Move MemoryVT out of LSBaseNode into MemSDNode, allowing the
getMemOperand function to be moved into the base class as well
and made non-virtual.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 22:08:04 +00:00
Evan Cheng
d411419422 Avoid creating expensive comment string if it's not going to be printed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 21:53:02 +00:00
Owen Anderson
eb580ee133 Loosen our check here. Local regalloc only cares that the reg is used and def'd by the same instruction, but about the details of
the relationship.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53367 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 21:34:36 +00:00
Dan Gohman
492f276cbc Move the IsVolatile and SVOffset fields into the MemSDNode base
class, and store IsVolatile and Alignment in a more compact form.
This makes AtomicSDNode slightly larger, but it shrinks LoadSDNode
and StoreSDNode, which are much more common and are the largest of
the SDNode subclasses. Also, this lets the isVolatile() and
getAlignment() accessors be non-virtual.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 21:23:02 +00:00
Owen Anderson
dd4b47c9b2 Don't use an expensive check for two-address-ness when we have the information sitting around to determine it much more quickly,
This speeds up the local register allocator from 0.37s to 0.31s on instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 21:15:10 +00:00
Owen Anderson
9094db17b4 Factor local liveness computation out into its own function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53352 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 20:14:53 +00:00
Dan Gohman
85e6815d83 Reuse the MO variable instead of recomputing it in RegAllocLocal.
Keep RegAllocSimple in sync.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 20:12:26 +00:00
Dan Gohman
88cef2480f Give RegAllocSimple a TargetInstrInfo member to keep it consistent
with RegAllocLocal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 19:56:01 +00:00
Dan Gohman
8849054624 RegAllocLocal has a TargetInstrInfo data member. Use it instead
of having local variables duplicate it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 19:55:19 +00:00
Dan Gohman
0383bc014c Use find with std::map, when that's what's needed, instead of lower_bound
with extra checks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 19:51:00 +00:00
Anton Korobeynikov
e87f52d722 Switch to new section name handling facility
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 13:27:16 +00:00
Duncan Sands
dd1c20d258 Remove some unneeded includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 12:08:25 +00:00
Duncan Sands
b5508e4237 Redo LegalizeTypes soft float support for
SINT_TO_FP and UINT_TO_FP.  This now produces
the same code as LegalizeDAG (the previous
code was based on a mistaken idea of what
LegalizeDAG did in this case).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 12:07:22 +00:00
Duncan Sands
452911c468 Forgot to update the chain result when softening
loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53287 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 11:15:31 +00:00
Duncan Sands
f8568b464f LegalizeTypes soft float support for FP_TO_SINT and
FP_TO_UINT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 11:13:46 +00:00
Duncan Sands
851b1ee83f LegalizeTypes support for powi soft float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53285 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 11:11:47 +00:00
Duncan Sands
ddc7aa3417 Make the role of MVT::i32 clearer here, and add a
note since it is not clear whether it is correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53284 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 08:07:41 +00:00
Evan Cheng
1afe5c3ff8 Missed alignment argument on stores lowered from memcpy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53281 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 06:38:06 +00:00
Bill Wendling
3e30cbb457 Make the DICountVisitor not a visitor. This keeps us from calling virtual
functions and junk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 06:02:33 +00:00
Dan Gohman
f877b735ad const-ify SelectionDAG::getNodeValueTypes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 00:00:42 +00:00
Dan Gohman
4e526b9a5b It's no longer necessary to test if a MachineBasicBlock's
parent is non-null. It now always is.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 23:59:09 +00:00
Dan Gohman
f1bf29e648 Verify that MachineMemOperand alignment is a non-zero power of 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 23:47:04 +00:00
Dan Gohman
9c6e70eca9 Factor out the code for computing an alignment value, and make it
available to getAtomic in addition to just getLoad and getStore,
to prevent MachineMemOperands with 0 alignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53261 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 23:46:32 +00:00
Owen Anderson
0966f0f0e4 Fix the build. Apparently MachineInstr& is no longer implicitly convertable to MachineBasicBlock::iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53260 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 23:36:37 +00:00
Owen Anderson
491fccc4b4 Make the local register allocator compute (purely local) liveness information for itself
rather than depending on LiveVariables.  This decreases compile time from:
0.5909s (LV + Regalloc) to 0.421s (just regalloc).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 22:24:50 +00:00
Dale Johannesen
33d9b356ab Remove some dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 21:53:43 +00:00
Evan Cheng
71e8685633 Do not CSE DEBUG_LOC, DBG_LABEL, DBG_STOPPOINT, DECLARE, and EH_LABEL SDNode's. This improves compile time slightly at -O0 -g.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 20:06:39 +00:00
Duncan Sands
7ba11c552b Remove custom expansion from LegalizeTypes when doing
soft float: experiments show that targets aren't
expecting this for results or for operands.  Add
support select/select_cc result soft float and
correct operand soft float for these.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53245 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 20:03:24 +00:00
Duncan Sands
3a2eb297af Add missing select_cc libcall line, somehow omitted
in LegalizeTypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 20:00:05 +00:00
Evan Cheng
ab8faba2fb Unbreak C++ tests on x86 Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53237 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 16:40:43 +00:00
Duncan Sands
28124ac606 LegalizeTypes support for FP_ROUND and FP_EXTEND
soft float.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 10:50:55 +00:00
Evan Cheng
77c8f7674d Avoid unnecessary string construction during asm printing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 00:55:58 +00:00
Dan Gohman
8e5f2c6f65 Pool-allocation for MachineInstrs, MachineBasicBlocks, and
MachineMemOperands. The pools are owned by MachineFunctions.

This drastically reduces the number of calls to malloc/free made
during the "Emit" phase of scheduling, as well as later phases
in CodeGen. Combined with other changes, this speeds up the
"instruction selection" phase of CodeGen by 10% in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 23:14:23 +00:00
Dan Gohman
0e5f1306b0 Pool-allocation for SDNodes. The pool is allocated once for each function,
and reused across SelectionDAGs.

This drastically reduces the number of calls to malloc/free made during
instruction selection, and improves memory locality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53211 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 23:02:41 +00:00
Bill Wendling
4925567f85 Use the canonical way to get an empty structure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53206 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 21:41:57 +00:00
Bill Wendling
667a68b96a Use StringMap for greater justice!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53202 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 20:59:31 +00:00
Dan Gohman
0fe9c6e7ba Fix SDNode::MorphNodeTo (a function used by by SelectNodeTo) to
properly track dead nodes that are on the original SDNode's operand
list but not the new one, and have no other uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53201 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 20:57:48 +00:00
Dan Gohman
ce42e404a2 Move MachineMemOperand's constructor out of line, to avoid a
#include dependency on Support/MathExtras.h in the header file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53200 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 20:32:02 +00:00
Dan Gohman
fd3ff032b8 Use of operator* is redundant and confusing here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53197 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 20:08:05 +00:00
Dan Gohman
4542611bb9 Minor const-correctness fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53196 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 20:06:06 +00:00
Dan Gohman
03bafaf802 Assert that all MachineInstrs update PhysRegUseDefLists in
their cleanup code. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 19:55:35 +00:00
Dan Gohman
6d9cdd5617 Remove most of the uses of SDOperandPtr, usually replacing it with a
simple const SDOperand*, which is what's usually needed.

For AddNodeIDOperands, which is small, just duplicate the function to
accept an SDUse*.

For SelectionDAG::getNode - Add an overload that accepts SDUse* that
copies the operands into a temporary SDOperand array, but also has
special-case checks for 0 through 3 operands to avoid the copy in
the common cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53183 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 18:26:29 +00:00
Dan Gohman
1002c02034 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 18:00:37 +00:00
Dan Gohman
6b345ee9b2 Make DenseMap's insert return a pair, to more closely resemble std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 17:46:23 +00:00
Evan Cheng
21cacc4de8 LegalizeSetCCOperands should legalize the result of ExpandLibCall. Patch by Richard Osborne.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 07:18:09 +00:00
Bill Wendling
8870ce951d Prevent option name conflict.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53166 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 05:42:27 +00:00
Duncan Sands
990f032907 LegalizeTypes soft-float support for stores of a
float value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53165 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 00:08:12 +00:00
Mon P Wang
364d73ddab Fixed generating incorrect aligned stores that I backout of r53031
that fixed problems in EmitStackConvert where the source and target type
have different alignment by creating a stack slot with the max
alignment of source and target type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 20:40:31 +00:00
Duncan Sands
126d90770b Rather than having a different custom legalization
hook for each way in which a result type can be
legalized (promotion, expansion, softening etc),
just use one: ReplaceNodeResults, which returns
a node with exactly the same result types as the
node passed to it, but presumably with a bunch of
custom code behind the scenes.  No change if the
new LegalizeTypes infrastructure is not turned on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-04 11:47:58 +00:00
Duncan Sands
ececf99c07 Linux also does not require exception handling
moves in order to get correct debug info.  Since
I can't imagine how any target could possibly
be any different, I've just stripped out the
option: now all the world's like Darwin!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-04 09:55:48 +00:00
Bill Wendling
c04f46567c Don't return std::vector by value, but pass it in by reference to be filled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53123 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 23:13:02 +00:00
Bill Wendling
10fff6078a Revert my previous check-in that split up MachineModuleInfo. It turns out to
slow the compiler down at -O0 some 30% or more. Ooops.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53120 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 22:53:42 +00:00
Evan Cheng
a122f2f51e Backed out 53031.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53110 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 18:20:14 +00:00
Evan Cheng
9f1c8317a4 - Remove calls to copyKillDeadInfo which is an N^2 function. Instead, propagate kill / dead markers as new instructions are constructed in foldMemoryOperand, convertToThressAddress, etc.
- Also remove LiveVariables::instructionChanged, etc. Replace all calls with cheaper calls which update VarInfo kill list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 09:09:37 +00:00
Dan Gohman
2ebc11ac6d Reapply r52988, "Simplify addRegisterKilled and addRegisterDead." The
254.gap failure was not due to this mod.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53068 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 01:18:51 +00:00
Dan Gohman
9b44c1f2a0 Avoid unnecessarily copying APInt objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53065 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 00:52:03 +00:00
Evan Cheng
5b9f60bc22 Use std::replace instead of std::find and push_back.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 00:28:27 +00:00
Evan Cheng
be04dc1413 - Add LiveVariables::replaceKillInstruction. This does a subset of instructionChanged. That is, it only update the VarInfo.kills if the new instruction is known to have the correct dead and kill markers.
- CommuteInstruction copies kill / dead markers over to new instruction. So use replaceKillInstruction instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 00:07:19 +00:00
Owen Anderson
f660c171c8 Make LiveVariables even more optional, by making it optional in the call to TargetInstrInfo::convertToThreeAddressInstruction
Also, if LV isn't around, then TwoAddr doesn't need to be updating flags, since they won't have been set in the first place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53058 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 23:41:07 +00:00
Dan Gohman
cd920d9ecf Replace a few uses of SelectionDAG::getTargetNode with
SelectionDAG::SelectNodeTo in the instruction selector. This
updates existing nodes in place instead of creating new ones.

Go back to selecting ISD::DBG_LABEL nodes into
TargetInstrInfo::DBG_LABEL nodes instead of leaving them
unselected, now that SelectNodeTo allows us to update them
in place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 23:23:19 +00:00
Dan Gohman
8b69135f05 Revert r52988. It broke 254.gap on x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 22:12:55 +00:00
Owen Anderson
802af11460 TwoAddressInstructionPass doesn't really require LiveVariables, it just needs to update it if it's already around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53049 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 21:28:58 +00:00
Duncan Sands
4bdcb61af3 Add a new getMergeValues method that does not need
to be passed the list of value types, and use this
where appropriate.  Inappropriate places are where
the value type list is already known and may be
long, in which case the existing method is more
efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 17:40:58 +00:00
Mon P Wang
bee98c66c0 Fixed problem in EmitStackConvert where the source and target type
have different alignment by creating a stack slot with the max
alignment of source and target type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53031 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 17:07:12 +00:00
Chris Lattner
349db1738d instead of aborting on shifts of i1, just implicitly fold them.
The dag combiner can produce a shift of i1 when folding icmp i1's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 17:01:57 +00:00
Duncan Sands
8dd5af562b Fix typo compounded by a cut-and-pasto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 10:03:53 +00:00
Duncan Sands
3a38e5e3c4 Let AnalyzeNewNode take care of calling ExpungeNode.
This makes sure that all new nodes are expunged, not
just those the top node of a new subtree.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 09:56:41 +00:00
Evan Cheng
c6be777208 - Use a faster priority comparison function if -fast.
- Code clean up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53010 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 09:23:51 +00:00
Chris Lattner
fce6e546aa Add a new (simple) StringMap::clear method, patch by Pratik
Solanki!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53008 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 05:26:32 +00:00
Bill Wendling
3a43a7f8b2 Use the canonical form for getting an empty structure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 00:50:02 +00:00
Bill Wendling
12432cfc59 Sorry. I couldn't sleep at night knowing I put these ugly casts into the source tree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 00:35:47 +00:00
Bill Wendling
aa8f8889a8 Darwin doesn't need exception handling information for the "move" info when
debug information is being output, because it's leet!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52994 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 23:34:48 +00:00
Evan Cheng
6547e406cf Avoid creating expensive comment string if it's not going to be printed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 23:18:29 +00:00
Owen Anderson
4474c792c6 No need to use std::distance. We can just count the number of operands
much more cheaply.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52990 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 22:34:11 +00:00
Evan Cheng
1096734011 Simplify addRegisterKilled and addRegisterDead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52988 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 22:21:21 +00:00
Bill Wendling
a28cd12b06 - Update comments.
- Don't use GlobalVariable::LinkageTypes when unsigned works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 22:08:01 +00:00
Dale Johannesen
62bc8a4486 Fix longstanding thinko: don't exclude
predessors of exit blocks from tail merging
consideration.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 21:50:14 +00:00
Evan Cheng
6518c6ed7e Eliminate a compile time warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52982 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 21:35:46 +00:00
Owen Anderson
25995093e7 Add a version of AsmPrinter::EOL that takes a const char* so that we don't have to do as many implicit std::string constructions.
Unfortunately, this doesn't appear to translate to a real speedup in practice.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52981 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 21:16:27 +00:00
Evan Cheng
f1a792bc59 Do run ComputeLiveOutVRegInfo with -fast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52975 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 18:15:04 +00:00
Evan Cheng
4576f6d7a9 Do not use computationally expensive scheduling heuristics with -fast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 18:05:03 +00:00
Evan Cheng
ebffb660a6 Apply Chris' suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 17:59:20 +00:00
Dan Gohman
528bc02877 Minimize duplicated code in AsmPrinter::printLabel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52944 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 00:16:26 +00:00
Dan Gohman
4406604047 Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminating
the need for a flavor operand, and add a new SDNode subclass,
LabelSDNode, for use with them to eliminate the need for a label id
operand.

Change instruction selection to let these label nodes through
unmodified instead of creating copies of them. Teach the MachineInstr
emitter how to emit a MachineInstr directly from an ISD label node.

This avoids the need for allocating SDNodes for the label id and
flavor value, as well as SDNodes for each of the post-isel label,
label id, and label flavor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 00:05:16 +00:00
Evan Cheng
ee4dc16d75 Suppress compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 22:33:56 +00:00
Evan Cheng
9ef4c5302e Don't run stack slot coloring if -fast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 22:33:16 +00:00
Dan Gohman
99fe47bc81 Use a simpler but equivalent form of RecordSource.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52931 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 22:21:03 +00:00
Evan Cheng
f667480d84 Add timing report for various sub-passes under SelectionDAGISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 22:10:09 +00:00
Dan Gohman
d19a53ba1d std::ostream and std::string microoptimizations for asm printing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 22:03:41 +00:00
Dan Gohman
cf8462f300 Use reserve.
SelectionDAG::allnodes_size is linear, but that doesn't appear to
outweigh the benefit of reducing heap traffic. If it does become a
problem, we should teach SelectionDAG to keep a count of how many
nodes are live, because there are several other places where that
information would be useful as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52926 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 21:04:06 +00:00
Dan Gohman
7f460203b0 Rename ISD::LOCATION to ISD::DBG_STOPPOINT to better reflect its
purpose, and give it a custom SDNode subclass so that it doesn't
need to have line number, column number, filename string, and
directory string, all existing as individual SDNodes to be the
operands.

This was the only user of ISD::STRING, StringSDNode, etc., so
remove those and some associated code.

This makes stop-points considerably easier to read in
-view-legalize-dags output, and reduces overhead (creating new
nodes and copying std::strings into them) on code containing
debugging information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 20:59:49 +00:00
Evan Cheng
db8d56b825 Split scheduling from instruction selection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52923 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 20:45:06 +00:00
Dale Johannesen
edec8d89df No need to align the stack if there are no stack
objects.  Fixes a couple of tests on Linux.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52921 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 20:40:16 +00:00
Evan Cheng
fdb99838a3 Remove unneeded include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52920 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 20:38:22 +00:00
Dan Gohman
a44b674a42 Replace some std::vectors that showed up in heap profiling with
SmallVectors. Change the signature of TargetLowering::LowerArguments
to avoid returning a vector by value, and update the two targets
which still use this directly, Sparc and IA64, accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 20:31:15 +00:00
Dan Gohman
117b64b3f8 Correct the allocation size for CCState's UsedRegs member, which
only needs one bit for each register. UsedRegs is a SmallVector
sized at 16, so this eliminates a heap allocation/free for every
call and return processed by Legalize on most targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52915 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 20:25:31 +00:00
Duncan Sands
6f7e1cddf6 ExpungeNode is only needed for new nodes! This
fixes CodeGen/PowerPC/2008-06-19-LegalizerCrash.ll
when using the new LegalizeTypes infrastructure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 16:43:45 +00:00
Duncan Sands
d3ca9fc998 Support for VAARG. As noted in a comment, this is
wrong for types like x86 long double and i1, but
no worse than what is done in LegalizeDAG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 13:55:15 +00:00
Duncan Sands
7fc8ab81f5 Support for promoting select_cc operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 11:50:11 +00:00
Duncan Sands
f9516208e5 Revert the SelectionDAG optimization that makes
it impossible to create a MERGE_VALUES node with
only one result: sometimes it is useful to be able
to create a node with only one result out of one of
the results of a node with more than one result, for
example because the new node will eventually be used
to replace a one-result node using ReplaceAllUsesWith,
cf X86TargetLowering::ExpandFP_TO_SINT.  On the other
hand, most users of MERGE_VALUES don't need this and
for them the optimization was valuable.  So add a new
utility method getMergeValues for creating MERGE_VALUES
nodes which by default performs the optimization.
Change almost everywhere to use getMergeValues (and
tidy some stuff up at the same time).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 10:19:09 +00:00
Evan Cheng
0ff39b3feb - Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an empty string for ConstantAggregateZero case which surprises selectiondag.
- Correctly handle memcpy from constant string which is zero-initialized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52891 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 07:31:25 +00:00
Chris Lattner
80c1a5622a Implement split and scalarize for SELECT_CC, fixing PR2504
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 02:43:01 +00:00
Anton Korobeynikov
6d116bc7ce Revert (52748 and friends):
Move GetConstantStringInfo to lib/Analysis. Remove
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.

This unbreaks llvm-gcc bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 17:57:03 +00:00
Chris Lattner
03a5707955 Really fix the bootstrap failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52854 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 06:24:50 +00:00
Chris Lattner
b746b82113 Add back the capability to include nul characters in strings with
GetConstantStringInfo.  This will hopefully restore llvm-gcc to 
happy bootstrap land.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52851 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 05:33:32 +00:00
Dan Gohman
77455617fb When folding a bitcast into a load or store, preserve the alignment
information of the original load or store, which is checked to be
at least as good, and possibly better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52849 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 00:45:22 +00:00
Evan Cheng
01b2e236b5 Looks like this condition is inverted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 22:11:49 +00:00
Bill Wendling
f0e9c56540 Reduce number of times .size() is called on a vector. Rename some variables to
match normal naming scheme.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 07:13:44 +00:00
Owen Anderson
bffdf66b80 Use a SmallSet when we can to reduce memory allocations.
This speeds up a particular testcase from 0.0302s to 0.0222s in LiveVariables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52819 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 07:05:59 +00:00
Chris Lattner
07c68f9b6f simplify this check, GetConstantStringInfo validates that a
global is constant already.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52812 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 03:18:41 +00:00
Bill Wendling
0ac1b6d768 Cruft left from patch revert...sorry. :-(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52808 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 01:32:08 +00:00
Bill Wendling
914c970899 Reverting broken patch r52803.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 01:27:56 +00:00
Owen Anderson
b827c26e1e Don't perform expensive queries checking for super and sub registers when we know that there aren't any.
This speed up LiveVariables on instcombine at -O0 -g from 0.3855s to 0.3503s.  Look for more improvements in this area soon!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52804 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 01:22:50 +00:00
Bill Wendling
e6b6bae536 - Remove a use of std::vector.
- Make sure that we're not recalculating the size of a vector
  that never changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 00:56:36 +00:00
Bill Wendling
305635abea Refactor the DebugInfoDesc stuff out of the MachineModuleInfo file. Clean up
some uses of std::vector, where it's return std::vector by value. Yuck!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52800 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 00:09:40 +00:00
Chris Lattner
f77e46be6d duncan points out that isOperationLegal includes a check for
type legality.  Thanks Duncan!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 17:16:00 +00:00
Owen Anderson
8342cfff9a Don't create a whole new string just to copy the elements into it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52785 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 17:06:02 +00:00
Dale Johannesen
b5dae00325 Fixes the last x86-64 test failure in compat.exp:
<16 x float> is 64-byte aligned (for some reason),
which gets us into the stack realignment code.  The
computation changing FP-relative offsets to SP-relative
was broken, assiging a spill temp to a location
also used for parameter passing.  This
fixes it by rounding up the stack frame to a multiple
of the largest alignment (I concluded it wasn't fixable
without doing this, but I'm not very sure.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 01:51:13 +00:00
Eric Christopher
0d2b0aba42 Move GetConstantStringInfo to lib/Analysis. Remove
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 00:31:12 +00:00
Chris Lattner
cda8875433 when we know the signbit of an input to uint_to_fp is zero,
change it to sint_to_fp on targets where that is cheaper (and
visaversa of course).  This allows us to compile uint_to_fp to:

_test:
	movl	4(%esp), %eax
	shrl	$23, %eax
	cvtsi2ss	%eax, %xmm0
	movl	8(%esp), %eax
	movss	%xmm0, (%eax)
	ret

instead of:

	.align	3
LCPI1_0:					##  double
	.long	0	## double least significant word 4.5036e+15
	.long	1127219200	## double most significant word 4.5036e+15
	.text
	.align	4,0x90
	.globl	_test
_test:
	subl	$12, %esp
	movl	16(%esp), %eax
	shrl	$23, %eax
	movl	%eax, (%esp)
	movl	$1127219200, 4(%esp)
	movsd	(%esp), %xmm0
	subsd	LCPI1_0, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movl	20(%esp), %eax
	movss	%xmm0, (%eax)
	addl	$12, %esp
	ret




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52747 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 00:16:49 +00:00
Owen Anderson
6b098dee28 Remember which MachineOperand we were processing, so we don't have to scan the list to find it again later.
This speeds up live intervals from 0.37s to 0.30s on instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52745 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 23:39:39 +00:00
Dan Gohman
48b0b882c7 Fix the text in an assert string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52744 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 22:14:43 +00:00
Evan Cheng
ab26227c8c - Fix a x86 vector isel bug: illegal transformation of a vector_shuffle into a
shift.
- Add a readme entry for a missing vector_shuffle optimization that results in
  awful codegen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52740 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 20:52:59 +00:00
Duncan Sands
041cde26ea Add support for expanding PPC 128 bit floats.
For this it is convenient to permit floats to
be used with EXTRACT_ELEMENT, so I tweaked
things to allow that.  I also added libcalls
for ppcf128 to i32 forms of FP_TO_XINT, since
they exist in libgcc and this case can certainly
occur (and does occur in the testsuite) - before
the i64 libcall was being used.  Also, the
XINT_TO_FP result seemed to be wrong when
the argument is an i128: the wrong fudge
factor was added (the i32 and i64 cases were
handled directly, but the i128 code fell
through to some generic softening code which
seemed to think it was i64 to f32!).  So I
fixed it by adding a fudge factor that I
found in my breakfast cereal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 20:24:48 +00:00
Duncan Sands
11ac797f5e Add/complete support for integer and float
select_cc and friends.  This code could be
factorized a bit but I'm not sure that it's
worth it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52724 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 16:34:21 +00:00
Dan Gohman
fd4418fc9b Remove the OrigVT member from AtomicSDNode, as it is redundant with
the base SDNode's VTList.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52722 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 16:07:49 +00:00
Mon P Wang
2887310630 Added MemOperands to Atomic operations since Atomics touches memory.
Added abstract class MemSDNode for any Node that have an associated MemOperand
Changed atomic.lcs => atomic.cmp.swap, atomic.las => atomic.load.add, and
atomic.lss => atomic.load.sub


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 08:15:39 +00:00