Commit Graph

2842 Commits

Author SHA1 Message Date
Chris Lattner
944fac71e0 Switch the asmprinter (.ll) and all the stuff it requires over to
use raw_ostream instead of std::ostream.  Among other goodness,
this speeds up llvm-dis of kc++ with a release build from 0.85s
to 0.49s (88% faster).

Other interesting changes:
 1) This makes Value::print be non-virtual.
 2) AP[S]Int and ConstantRange can no longer print to ostream directly, 
    use raw_ostream instead.
 3) This fixes a bug in raw_os_ostream where it didn't flush itself 
    when destroyed.
 4) This adds a new SDNode::print method, instead of only allowing "dump".


A lot of APIs have both std::ostream and raw_ostream versions, it would
be useful to go through and systematically anihilate the std::ostream 
versions.

This passes dejagnu, but there may be minor fallout, plz let me know if
so and I'll fix it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:23:09 +00:00
Dan Gohman
6ecf50908c Make MBBMap a DenseMap instead of a std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 02:44:46 +00:00
Dan Gohman
f350b277f3 Move the point at which FastISel taps into the SelectionDAGISel
process up to a higher level. This allows FastISel to leverage
more of SelectionDAGISel's infastructure, such as updating Machine
PHI nodes.

Also, implement transitioning from SDISel back to FastISel in
the middle of a block, so it's now possible to go back and
forth. This allows FastISel to hand individual CallInsts and other
complicated things off to SDISel to handle, while handling the rest
of the block itself.

To help support this, reorganize the SelectionDAG class so that it
is allocated once and reused throughout a function, instead of
being completely reallocated for each block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55219 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 02:25:05 +00:00
Dan Gohman
6679906d97 Avoid creating shift-by-zero SDNodes in the common case of
i8* getelementptr. DAGCombine eliminates these, but this is
a fairly common case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55214 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 01:06:51 +00:00
Dan Gohman
6f17966a80 Move SelectionDAG's constructor out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 00:50:30 +00:00
Dan Gohman
3c8f36fd03 Reapply r55191 and r55192.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55205 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 21:28:19 +00:00
Bill Wendling
449416deb6 Reverting r55190, r55191, and r55192. They broke the build with this error message:
{standard input}:17:bad register name `%sil'
make[4]: *** [libgcc/./_addvsi3.o] Error 1
make[4]: *** Waiting for unfinished jobs....
{standard input}:23:bad register name `%dil'
{standard input}:28:bad register name `%dil'
make[4]: *** [libgcc/./_addvdi3.o] Error 1
{standard input}:18:bad register name `%sil'
make[4]: *** [libgcc/./_subvsi3.o] Error 1



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55200 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 20:51:05 +00:00
Dan Gohman
5ed3cbb753 Fix the InsertBranch call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55192 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 19:26:10 +00:00
Dan Gohman
e0182ec0e4 Support non-fallthrough unconditional branches in FastISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 19:21:41 +00:00
Dan Gohman
3b7753be2e Add FastISel support for PHINodes. Machine PHI nodes
are not yet updated properly, but that's a separate
task.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55187 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 17:37:48 +00:00
Dan Gohman
22bb31103d Factor out the predicate check code from DAGISelEmitter.cpp
and use it in FastISelEmitter.cpp, and make FastISel
subtarget aware. Among other things, this lets it work
properly on x86 targets that don't have SSE, where it
successfully selects x87 instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 00:20:26 +00:00
Dan Gohman
2bb1e3eede Add libcalls for the new rounding opcodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 18:38:14 +00:00
Dan Gohman
509e84fa71 Add libm-oriented ISD opcodes for rounding operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 17:55:02 +00:00
Dan Gohman
f93cf79505 Have FastISel skip the multiply by 1 for getelementptr on i8*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 17:37:05 +00:00
Dan Gohman
7a0e6593d0 MVT::getMVT uses iPTR for pointer types, while we need the actual
intptr_t type in this case. FastISel can now select simple
getelementptr instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 17:25:26 +00:00
Dan Gohman
ca84121596 Elements in DeadNodeSet are checked for use_empty() before they
are actually deleted, so it's not necessary to remove re-used
nodes from the set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55123 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 16:24:54 +00:00
Dan Gohman
d5fe57d2f9 Basic fast-isel support for instructions with constant int operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 01:41:07 +00:00
Evan Cheng
2076aa800e Type of first GEP operand is always the same as the target pointer type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 01:19:11 +00:00
Dan Gohman
fd903944de Fix unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 23:53:10 +00:00
Evan Cheng
83785c8096 First cut, un-optimized (and untested) fast isel lowering of GetElementPtrInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 22:45:34 +00:00
Dan Gohman
f990b571c5 Simplify the BuildMI calls even more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 21:10:53 +00:00
Dan Gohman
bb466331e7 Simplify FastISel's constructor argument list, make the FastISel
class hold a MachineRegisterInfo member, and make the
MachineBasicBlock be passed in to SelectInstructions rather
than the FastISel constructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55076 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 21:05:57 +00:00
Dan Gohman
2385852b5b Dump the instruction that foiled ISel even when -debug is not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 20:47:32 +00:00
Dan Gohman
cb34cd7b5e Make more use of the BuildMI API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 18:16:32 +00:00
Dan Gohman
4cbe0662ab Minor code reorganization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 18:10:48 +00:00
Dan Gohman
77ad79689d Minor whitespace cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 18:09:38 +00:00
Dan Gohman
b7864a9e23 Fix 80 column violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 18:09:02 +00:00
Evan Cheng
d420789301 Kill off SimpleBBISel, it's replaced by FastISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 17:50:32 +00:00
Dan Gohman
a267651b7e Disable DAGCombine's alignment inference in "fast" codegen mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55059 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 16:30:28 +00:00
Dan Gohman
b8d2f550b8 Change the FoldingSetNodeID usage for objects which carry
alignment and volatility information, such as loads and
stores, to reduce the number of integer values added to
the FoldingSetNodeID.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55058 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 15:58:01 +00:00
Dan Gohman
c53ec49885 Use BitVector instead of std::vector<unsigned char>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 14:58:41 +00:00
Dan Gohman
7a30bc4e7c Avoid an empty-if-body warning in release builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 14:00:56 +00:00
Dan Gohman
e6798b757a Fix FastISel to recognize that the last block in the function does
not have a fall-through successor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55033 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 01:17:01 +00:00
Dan Gohman
cc8430f742 Fix a leak in the FastISel code that Chris pointed out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55031 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:56:17 +00:00
Dan Gohman
3e697cfa97 Add support for running SelectionDAG if FastISel fails. This is under
a command-line option, so that the default behavior is an abort, which
is useful for exposing code that isn't supported yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:47:54 +00:00
Dan Gohman
a7f2dff98e Fix FastISel to recognize unhandled operands, such as constants
that aren't available as virtual registers (for now).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55026 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:35:17 +00:00
Dan Gohman
8014e86580 Add FastISel support for floating-point operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:23:20 +00:00
Dan Gohman
bdedd44773 Add FastISel support for several more binary operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:11:48 +00:00
Dan Gohman
78eca170e9 Add code to call FastISel, and a command-line option to enable it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55015 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 22:33:34 +00:00
Dan Gohman
6f2766d597 Support unconditional fall-through branches in FastISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55014 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 22:31:46 +00:00
Dan Gohman
8133a52eb5 Use the BuildMI overload that sets up a destination register
instead of the one that doesn't and then adding it manually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 20:46:54 +00:00
Dan Gohman
32155acb8a Handle the case where target-specific fastisel code doesn't have
a desired opcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 20:43:22 +00:00
Chris Lattner
65a7bd8b8e don't use the result of WriteTypeSymbolic or WriteAsOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54978 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 04:44:30 +00:00
Gordon Henriksen
5eca075b74 Rename some GC classes so that their roll will hopefully be clearer.
In particular, Collector was confusing to implementors. Several
thought that this compile-time class was the place to implement
their runtime GC heap. Of course, it doesn't even exist at runtime.
Specifically, the renames are:

  Collector               -> GCStrategy
  CollectorMetadata       -> GCFunctionInfo
  CollectorModuleMetadata -> GCModuleInfo
  CollectorRegistry       -> GCRegistry
  Function::getCollector  -> getGC (setGC, hasGC, clearGC)

Several accessors and nested types have also been renamed to be
consistent. These changes should be obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 18:44:35 +00:00
Gordon Henriksen
5a29c9eed1 Factor GC metadata table assembly generation out of Collector in preparation for splitting AsmPrinter into its own library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 12:56:54 +00:00
Chris Lattner
fad86b003a Rework the routines that convert AP[S]Int into a string. Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to 
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 07:19:36 +00:00
Dan Gohman
e285a74f7c Make FastISel's constructor protected, and give it a destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 21:51:29 +00:00
Dan Gohman
7f8613e5b8 Improve support for vector casts in LLVM IR and CodeGen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 20:04:46 +00:00
Dan Gohman
a60832b018 Fix a bogus srem rule - a negative value srem'd by a power-of-2
can have a non-negative result; for example, -16%16 is 0. Also,
clarify the related comments. This fixes PR2670.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 23:12:35 +00:00
Dan Gohman
6ab6422f25 Allow SelectionDAG to create EXTRACT_VECTOR_ELT nodes with
non-constant indices. Only a few of the peephole checks require
a constant index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 21:51:37 +00:00
Dan Gohman
b0cf29c5cf Initial checkin of the new "fast" instruction selection support. See
the comments in FastISelEmitter.cpp for details on what this is.
This is currently experimental and unusable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 20:19:35 +00:00
Dan Gohman
925a7e8ed6 Rename SelectionDAGISel's FastISel to Fast, to begin to make
room for the new FastISel instruction selection code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54749 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 19:47:40 +00:00
Dan Gohman
04f4f4f447 Correct the filename in the top-of-file comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 17:42:33 +00:00
Dan Gohman
8cea8ff34c Take the FrameOffset into account when computing the alignment
of stack objects. This fixes PR2656.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 18:27:03 +00:00
Evan Cheng
381cb07544 Add skeleton of simple basic block instruction selector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54522 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 07:27:28 +00:00
Bruno Cardoso Lopes
e36bfe678d Add the remaining fp_round libcalls:
FPROUND_F80_F32, FPROUND_PPCF128_F32, 
FPROUND_F80_F64, FPROUND_PPCF128_F64

Support for soften float fp_round operands is added, Mips 
needs this to round f64->f32.

Also added support to soften float FABS result, Mips doesn't 
support double fabs results while in 'single float only' mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 19:01:24 +00:00
Evan Cheng
39fd6e81b1 Factor code that finalize PHI nodes, jump tables, etc. out of SelectBasicBlock. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 00:43:25 +00:00
Owen Anderson
3bc9c6f3e7 Remove the -disable-correct-folding option, which was ugly and is no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:27:54 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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