Commit Graph

5618 Commits

Author SHA1 Message Date
Rafael Espindola
91ee5454ae Reduce the size of the Parts vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 18:29:58 +00:00
Owen Anderson
c0bb68b982 Hook up support for fast-isel of trunc instructions, using the newly working support for EXTRACT_SUBREG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 18:26:01 +00:00
Owen Anderson
40a468f249 FastEmitInst_extractsubreg doesn't need to be passed the register class. It can get it from MachineRegisterInfo instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 17:47:37 +00:00
Dan Gohman
f641395435 Revert r55467; it causes regressions in UnitTests/Vector/divides,
Benchmarks/sim/sim, and others on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 17:22:54 +00:00
Rafael Espindola
c748ffa4e4 Correctly resize the Parts array.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 14:24:45 +00:00
Evan Cheng
9242cb8b82 If a copy isn't coalesced, but its src is defined by trivial computation. Re-materialize the src to replace the copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55467 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 07:53:51 +00:00
Dale Johannesen
e00a8a2a2e Split the ATOMIC NodeType's to include the size, e.g.
ATOMIC_LOAD_ADD_{8,16,32,64} instead of ATOMIC_LOAD_ADD.
Increased the Hardcoded Constant OpActionsCapacity to match.
Large but boring; no functional change.

This is to support partial-word atomics on ppc; i8 is
not a valid type there, so by the time we get to lowering, the
ATOMIC_LOAD nodes looks the same whether the type was i8 or i32.
The information can be added to the AtomicSDNode, but that is the
largest SDNode; I don't fully understand the SDNode allocation,
but it is sensitive to the largest node size, so increasing
that must be bad.  This is the alternative.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55457 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 02:44:49 +00:00
Dan Gohman
7c3234c6be Reorganize the lifetimes of the major objects SelectionDAGISel
works with.

SelectionDAG, FunctionLoweringInfo, and SelectionDAGLowering
objects now get created once per SelectionDAGISel instance, and
can be reused across blocks and across functions. Previously,
they were created and destroyed each time they were needed.

This reorganization simplifies the handling of PHI nodes, and
also SwitchCases, JumpTables, and BitTestBlocks. This
simplification has the side effect of fixing a bug in FastISel
where successor PHI nodes weren't being updated correctly.

This is also a step towards making the transition from FastISel
into and out of SelectionDAG faster, and also making
plain SelectionDAG faster on code with lots of little blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55450 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 23:52:12 +00:00
Owen Anderson
8970f00def Add a helper method that will be used to support EXTRACT_SUBREG for selecting trunc's in fast-isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55439 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 22:30:02 +00:00
Evan Cheng
8763c1c544 Move the check whether it's worth remating to caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55434 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 20:58:54 +00:00
Dan Gohman
a318dabc0e Fix FastISel's bitcast code for the case where getRegForValue fails.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 20:41:38 +00:00
Evan Cheng
df3b99381f Refactor isSafeToReMat out of 2addr pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 20:33:50 +00:00
Owen Anderson
6336b70541 Use TargetLowering to get the types in fast isel, which handles pointer types correctly for our purposes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55428 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 18:58:30 +00:00
Dan Gohman
151ed61a2f Don't check TLI.getOperationAction. The FastISel way is to
just try to do the action and let the tablegen-generated code
determine if there is target-support for an operation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 18:15:05 +00:00
Dan Gohman
ad368ac2b5 Add a new FastISel method, getRegForValue, which takes care of
the details of materializing constants and other values into
registers, and make use of it in several places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55426 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 18:10:19 +00:00
Dan Gohman
96a9999d79 Add a comment about the current floating-point constant code in FastISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 18:01:42 +00:00
Dan Gohman
e5a8dc5cc4 Optimize ScheduleDAGRRList's topological sort to use one pass instead
of two, and to not need a scratch std::vector. Also, compute the ordering
immediately in the result array, instead of in another scratch std::vector
that is copied to the result array.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 16:29:48 +00:00
Dan Gohman
3a09d891a4 Optimize ScheduleDAG's ComputeDepths and ComputeHeights to not need
a scratch std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 16:27:25 +00:00
Dan Gohman
a8b8332e81 Remove the std::ostream form of PseudoSourceValue's print,
which isn't needed anymore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 16:19:44 +00:00
Dan Gohman
10df0fa73e Basic FastISel support for floating-point constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 01:09:54 +00:00
Owen Anderson
96c5ea878c Fix handling of inttoptr and ptrtoint when unhandled operands are present.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55400 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 00:35:37 +00:00
Owen Anderson
9d5b416240 Add support for fast isel of inttoptr and ptrtoint in the cases where truncation is not needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55399 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 00:31:01 +00:00
Owen Anderson
d0533c9998 Factor out a large amoutn of the cast handling code in fast isel into helper methods.
This simultaneously makes the code simpler and adds support for sext as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 23:46:32 +00:00
Owen Anderson
97e2568f46 Add support for fast isel of zext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 23:14:49 +00:00
Gabor Greif
99a6cb92d1 disallow direct access to SDValue::ResNo, provide a getter instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 22:36:50 +00:00
Owen Anderson
13269335a5 Add support for fptosi of constants in fast isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 22:34:28 +00:00
Dan Gohman
3200d92947 Optimize SelectionDAG's topological sort to use one pass instead
of two, and to not need a scratch std::vector. Also, use the
SelectionDAG's topological sort in LegalizeDAG instead of having
a separate implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 21:42:18 +00:00
Dan Gohman
763d89343b Refactor the bitcast code into its own function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55387 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 21:28:54 +00:00
Dan Gohman
80bc6e2243 Make FastISel use the correct argument type when casting GEP indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 20:57:08 +00:00
Dan Gohman
b71fea248f Don't select binary instructions with illegal types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 20:52:40 +00:00
Owen Anderson
a843b8d391 Add support for fast isel of sitofp, and remove some unnecessary and imprecise legality checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55381 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 20:37:00 +00:00
Owen Anderson
77a218765a Use a combination of copyRegToReg and ISD::BIT_CONVERT when doing fast isel of bitcasts,
allowing it to support the full range of conversions people might ask for in a correct manner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55378 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 18:51:24 +00:00
Owen Anderson
940f83e772 Make TargetInstrInfo::copyRegToReg return a bool indicating whether the copy requested
was inserted or not.  This allows bitcast in fast isel to properly handle the case
where an appropriate reg-to-reg copy is not available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 18:03:31 +00:00
Owen Anderson
46aa2f5aab Add support for fast isel of non-constant fptosi instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55373 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 17:44:42 +00:00
Chris Lattner
09c5d8baa2 typo fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 06:07:47 +00:00
Dan Gohman
1146728bfa Actually recycle SDNode allocations. SelectionDAG is using
RecyclingAllocator, but this change is needed for the nodes
to actually be recycled. This cuts SelectionDAG's memory
usage high-water-mark in half in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 01:44:34 +00:00
Owen Anderson
0f84e4e310 Add a RetVT parameter to emitted FastISel methods, so that we will be able to pass the desired return
type down.  This is not currently used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55345 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 23:58:18 +00:00
Evan Cheng
b41aec5476 Unbreak build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 22:20:39 +00:00
Owen Anderson
d894f1d274 Expand bitcast support in fast isel to support bitcasts of non-constant values by emitting reg-reg copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 21:32:34 +00:00
Owen Anderson
6d0c25ec3a Add support for fast isel of (integer) immediate materialization pattens, and use them to support
bitcast of constants in fast isel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 20:20:32 +00:00
Chris Lattner
edfb72c628 simplify PseudoSourceValue printing a bit. Unnest all of PseudoSourceValue.cpp from the llvm namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55293 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 20:37:32 +00:00
Evan Cheng
40ab164d3a Print PseudoSourceValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 18:51:20 +00:00
Chris Lattner
c56711c212 make sure to flush the stream after dumping, to make sure it goes out immediately.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 18:28:30 +00:00
Chris Lattner
62ca32540f get MachineConstantPool off std::ostream, onto raw_ostream. It would be
really nice if someone converted MachineFunction::print to raw_ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55268 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:53:13 +00:00
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