Commit Graph

5662 Commits

Author SHA1 Message Date
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
Bill Wendling
a6211d9e83 Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55154 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 00:04:26 +00:00
Owen Anderson
c8d3a62092 Remove unneeded #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 19:51:25 +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
Owen Anderson
cb37188323 Use raw_ostream throughout the AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 00:14:44 +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
Bill Wendling
fb018d0433 Don't hoist instructions that define a physical register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55074 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 20:32:05 +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
08293f6b6c Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55049 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 13:50:12 +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
Owen Anderson
a41e47afc1 Allow the fast-path spilling code to attempt folding, but still leaving out remat and splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 22:12:11 +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
Owen Anderson
712c9f0690 The fast-path still needs to set kill markers and spill/restore points as appropriate.
With this patch, all of MultiSource/Applications and all of SPEC2000/2006 pass with
the SimpleSpiller and this fast-path enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 20:09:52 +00:00
Gordon Henriksen
3b26693d33 Delete a dead field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 17:09:26 +00:00
Gordon Henriksen
fcbcfaa95f [PR2327] Leverage TargetRegisterInfo to compute frame offsets for GC metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54994 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 17:06:35 +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
Owen Anderson
724651ab6e Make SimpleSpiller respect subregister indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54968 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 01:05:33 +00:00
Owen Anderson
ae339babb2 Add a flag to enable the fast spilling path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54958 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 00:17:30 +00:00
Owen Anderson
1719731d3d Fix a few more bugs:
1) Assign stack slots to new temporaries.
  2) Don't insert an interval into the return vector more than once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 23:41:04 +00:00
Owen Anderson
9a03293145 Fix several bugs in the new fast-path:
1) Remove an incorrect assertion.
  2) Set the stack slot weight properly.
  3) Resize the VirtRegMap when needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54949 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 21:20:32 +00:00
Owen Anderson
133f10f9bd Clients of addIntervalForSpills expect the added intervals to be returned sorted by starting index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 19:52:22 +00:00
Owen Anderson
8dc2cbe793 Simplify the fast-patch interval spilling by using MachineRegisterInfo::reg_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 18:38:12 +00:00
Owen Anderson
d6664311ac Resurrect some ancient code to add spill ranges without attempting folding, remat, or splitting. This code has been updated to current APIs
in so far as it compiles and, in theory, works, but does not take advantage of recent advancements.  For instance, it could be improved by using
MachineRegisterInfo::use_iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 18:05:32 +00:00
Bill Wendling
d3361e996b Don't hoist instructions that have implicit uses or defines. Before, it was
hoisting out some "test" and "cmp" instructions. This was obvious badness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 00:33:49 +00:00
Gordon Henriksen
8715367182 Don't require Registry specializations to define random static variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54902 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 19:08:34 +00:00
Gordon Henriksen
a08f5186b0 Drop an unnecessary include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54901 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 18:54:05 +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
418b6e875f Don't instantiate GC metadata for declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 16:18:50 +00:00
Anton Korobeynikov
4a8978b61c Fix merge error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54891 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 13:56:03 +00:00
Anton Korobeynikov
abb247fc03 Move all assembler printing related stuff into new libAsmPrinter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54885 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 13:53:04 +00:00
Anton Korobeynikov
9e422dd4f6 Factor out asmprinters from collector interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 13:52: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
Gordon Henriksen
c317a60c27 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@54880 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 12:08:44 +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
Anton Korobeynikov
ffe31d7bf1 Move SLEB/ULEB size calculation routines from AsmPrinter to TargetAsmInfo. This makes JIT asmprinter-free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 12:57:46 +00:00
Owen Anderson
cd1dcbd4fb Convert several std::vectors over to SmallVector, and use reserve() as appropriate for cases where std::vector is still used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-15 18:49:41 +00:00
Owen Anderson
bbf5583283 Use SmallSet instead of std::set to save allocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 23:41:38 +00:00
Owen Anderson
79e6ed9d47 Move MachineInstr::getOpcode inline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 23:25:30 +00:00
Owen Anderson
44eb65cf58 Convert uses of std::vector in TargetInstrInfo to SmallVector. This change had to be propoagated down into all the targets and up into all clients of this API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 22:49:33 +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
Owen Anderson
eaa009d963 Remove more uses of std::set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54787 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 21:01:00 +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
Owen Anderson
22ae999082 Speed up addRegisterDead by adding more fast checks before performing the expensive
subregister query, and by increasing the size of the subregister hashtable so
that there are fewer collisions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 18:34:18 +00:00
Dan Gohman
a8c763b307 Use empty() instead of begin() == end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 18:13:49 +00:00
Owen Anderson
97382166dd Get rid of a use of std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 23:36:23 +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
Owen Anderson
289983123b Expunge the last uses of std::map from LiveIntervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 22:28:50 +00:00
Owen Anderson
20e2839cb9 Move r2iMap_ over to DenseMap from std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54765 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 22:08:30 +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
Owen Anderson
03857b29d8 Make the allocation of LiveIntervals explicit, rather than holding them in the r2iMap_ by value. This will prevent references to them from being invalidated
if the map is changed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 21:49:13 +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
Owen Anderson
32767955a4 Get rid of unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 17:44:52 +00:00
Owen Anderson
27d6681496 1) Merge entire live intervals instead of parts of them.
2) Conditionalize temporary insertion if we don't need it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54741 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 17:25:42 +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
Gordon Henriksen
08db7367b1 Fix some typos. Apparently I think C needs a power-of operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 03:48:46 +00:00
Eric Christopher
7a61d701c0 Have IRBuilder take a template argument on whether or not to preserve
names. This can save a lot of allocations if you aren't going to be
looking at the output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 19:39:37 +00:00
Anton Korobeynikov
f5b6a47bb5 Handle visibility printing with all generality. Remove bunch of duplicate code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 18:25:07 +00:00
Owen Anderson
b12ab97bbd Reduce the entries in a phi before testing it for deadness, because removing the entries might make it dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 18:00:05 +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
Nick Lewycky
d6227385fc Don't crash printing the asm for a ConstantExpr PtrToInt just because the int
is narrower than the pointer. This testcase emits:

  .byte (((17) - 16) & 255)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54517 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 06:34:07 +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
Owen Anderson
724acf1c52 Do a dominator walk when scheduling copies, rather than a DFS on the CFG. Also, fix a few problems when creating
live intervals for temporaries created by phi elimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 18:28:07 +00:00
Dan Gohman
e3d920699c Re-enable elimination of unnecessary SUBREG_TO_REG instructions in
LowerSubregs, and fix an x86-64 isel bug that this exposed.

SUBREG_TO_REG for x86-64 implicit zero extension is only safe for
isel to generate when the source is known to always have zeros in
the high 32 bits. The EXTRACT_SUBREG instruction does not clear
the high 32 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54444 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 02:54:50 +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
9200e81a18 SDISel's constant branch folding can fold away self-loops, which doesn't result in any dead blocks, but
rather an incorrect phi input.  Add code to UnreachableMachineBlockElim to get rid of these entries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54432 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 23:16:52 +00:00
Owen Anderson
883771f86a Correct handle cases where two phis are coalesced together, and correct break up the case where two different
phis want to coalesce with the same vreg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54426 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 22:08:58 +00:00
Owen Anderson
aa111080df Oops, didn't mean to commit this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 20:58:38 +00:00
Owen Anderson
9860b71b6a We don't need to try to coalesce input vregs that are the same as the output vreg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 20:29:20 +00:00
Owen Anderson
9b49120408 Only trim a live interval if the register is not used after the PHI node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:36:17 +00:00
Owen Anderson
788d04152a Only remap each VNInfo once when doing renumbering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:35:45 +00:00
Owen Anderson
24d79ba2ef Fix breakage on ARM/2008-04-10-ScavengerAssert.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54378 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 22:24:40 +00:00
Evan Cheng
e3b8a48d32 Fix PR2596: out of bound reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:51:46 +00:00
Owen Anderson
5d2f8072d4 Correctly handle replacement and removal of PHIs with one incoming register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54374 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:40:45 +00:00
Owen Anderson
71ac0be6bb Oops, we were already checking for dead phis. Handle this the proper way, then.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:18:51 +00:00
Owen Anderson
e7b8205e6e We don't need to update live intervals for dead PHIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 20:51:26 +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
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