1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 22:42:46 +02:00
Commit Graph

4145 Commits

Author SHA1 Message Date
Christopher Lamb
8875f43912 Implement review feedback. No functionality change.
llvm-svn: 40863
2007-08-06 16:33:56 +00:00
Reid Spencer
3e54e72ef1 Fix minor doxygen nits.
llvm-svn: 40854
2007-08-05 20:06:04 +00:00
Chris Lattner
bc90e7255f shorten this name
llvm-svn: 40843
2007-08-05 18:45:33 +00:00
Chandler Carruth
00e56b0e81 This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.

llvm-svn: 40807
2007-08-04 01:51:18 +00:00
Dan Gohman
352de5aeb9 More explicit keywords.
llvm-svn: 40757
2007-08-02 21:21:54 +00:00
Chris Lattner
9319dfc93a don't redefine a parameter
llvm-svn: 40748
2007-08-02 18:08:16 +00:00
Evan Cheng
a06b9cf09f Do not emit copies for physical register output if it's not used.
llvm-svn: 40722
2007-08-02 05:29:38 +00:00
Scott Michel
199544367f Style police: Expand the tabs to spaces!
llvm-svn: 40712
2007-08-02 02:22:46 +00:00
Evan Cheng
14bd520741 Instead of adding copyfromreg's to handle physical definitions. Now isel can
simply specify them as results and let scheduledag handle them. That
is, instead of
SDOperand Flag = DAG.getTargetNode(Opc, MVT::i32, MVT::Flag, ...)
SDOperand Result = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, Flag)

Just write:
SDOperand Result = DAG.getTargetNode(Opc, MVT::i32, MVT::i32, ...)

And let scheduledag emit the move from X86::EAX to a virtual register.

llvm-svn: 40710
2007-08-02 00:28:15 +00:00
Evan Cheng
d6d66f0cf4 Bugs: missing partial uses and redundant partial defs.
llvm-svn: 40688
2007-08-01 20:18:21 +00:00
Lauro Ramos Venancio
1ef30713de Expand unaligned loads/stores when the target doesn't support them. (PR1548)
llvm-svn: 40682
2007-08-01 19:34:21 +00:00
David Greene
f06a395bb9 New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector.

Updates to all clients.

llvm-svn: 40660
2007-08-01 03:43:44 +00:00
Evan Cheng
8889a56947 simpleregistercoalescing -> regcoalescing. It's too long for me to handle.
llvm-svn: 40654
2007-07-31 22:37:44 +00:00
Scott Michel
c65b4c8eeb - Allow custom lowering for CTPOP, CTTZ, CTLZ.
- Fixed an existing unexpanded tab.

llvm-svn: 40605
2007-07-30 21:00:31 +00:00
Dan Gohman
375d541183 Fix a bug in getCopyFromParts turned up in the testcase for PR1132.
llvm-svn: 40598
2007-07-30 19:09:17 +00:00
Dan Gohman
555f611994 Print a space between the comment character and the basic block name,
for prettiness.

llvm-svn: 40593
2007-07-30 15:06:25 +00:00
Duncan Sands
e8bb2c6d32 Support for trampolines, except for X86 codegen which is
still under discussion.

llvm-svn: 40549
2007-07-27 12:58:54 +00:00
Christopher Lamb
55a1e36013 Move subreg lowering pass to be right after regalloc, per feedback.
llvm-svn: 40548
2007-07-27 07:36:14 +00:00
Dan Gohman
249090568d Fix the alias analysis query in DAGCombiner to not add in two
offsets. The SrcValueOffset values are the real offsets from the
SrcValue base pointers.

llvm-svn: 40534
2007-07-26 16:14:06 +00:00
Christopher Lamb
258dab5389 Add a MachineFunction pass, which runs post register allocation, that turns subreg insert/extract instruction into register copies. This ensures correct code gen if the coalescer isn't able to remove all subreg instructions.
llvm-svn: 40521
2007-07-26 08:18:32 +00:00
Christopher Lamb
08bcd5c0f8 Teach DAG scheduling how to properly emit subreg insert/extract machine instructions. PR1350
llvm-svn: 40520
2007-07-26 08:12:07 +00:00
Christopher Lamb
73c3cd47cc Add selection DAG nodes for subreg insert/extract. PR1350
llvm-svn: 40516
2007-07-26 07:34:40 +00:00
Christopher Lamb
cb63a77a51 Remove subreg index from MachineInstr's and also keep vregs as unsigned when adding operands.
llvm-svn: 40514
2007-07-26 07:00:46 +00:00
Christopher Lamb
b178ecbbc0 Fix infinite recursion for when extract_vector_elt is legal. Unfortunately no public targets use this code-path, so no test.
llvm-svn: 40510
2007-07-26 03:33:13 +00:00
Evan Cheng
4b747bb6a0 EmitAlignment() also emits optional fill value.
llvm-svn: 40500
2007-07-25 23:35:07 +00:00
Anton Korobeynikov
e0344393bb Minor cleanup:
- Split EH and debug infiormation
 - Make DwarfWriter more verbose in some cases

llvm-svn: 40481
2007-07-25 00:06:28 +00:00
Dan Gohman
1444c5840b Add const to CanBeFoldedBy, CheckAndMask, and CheckOrMask.
llvm-svn: 40480
2007-07-24 23:00:27 +00:00
Dan Gohman
54b8032d64 Fix some uses of dyn_cast to be uses of cast.
llvm-svn: 40443
2007-07-23 20:24:29 +00:00
Dan Gohman
ac8ccab48f Don't assume that only Uses can be kills. Defs are marked as kills initially
when there are no uses. This fixes a dangling-pointer bug, where pointers to
deleted instructions were not removed from kills lists. More info here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-July/009749.html

llvm-svn: 40131
2007-07-20 23:17:34 +00:00
Evan Cheng
cdb4e7949f Added -print-emitted-asm to print out JIT generated asm to cerr.
llvm-svn: 40123
2007-07-20 21:56:13 +00:00
Duncan Sands
840594467f As pointed out by g++-4.2, the original code didn't do
what it thought it was doing.

llvm-svn: 40044
2007-07-19 07:31:58 +00:00
Evan Cheng
5dd17373c5 Add comment.
llvm-svn: 40022
2007-07-18 23:34:48 +00:00
Dan Gohman
4c140b7128 It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment.

llvm-svn: 40004
2007-07-18 16:29:46 +00:00
Evan Cheng
6ad7064bdf Dead code.
llvm-svn: 39979
2007-07-17 20:01:19 +00:00
Dan Gohman
0ba554c0c8 Fix comments about vectors to use the current wording.
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Nick Lewycky
05e4170839 Fix the build. Patch from Holger Schurig.
llvm-svn: 39856
2007-07-14 15:11:14 +00:00
Anton Korobeynikov
5635277c36 Long live the exception handling!
This patch fills the last necessary bits to enable exceptions
handling in LLVM. Currently only on x86-32/linux.

In fact, this patch adds necessary intrinsics (and their lowering) which
represent really weird target-specific gcc builtins used inside unwinder.

After corresponding llvm-gcc patch will land (easy) exceptions should be
more or less workable. However, exceptions handling support should not be 
thought as 'finished': I expect many small and not so small glitches
everywhere.

llvm-svn: 39855
2007-07-14 14:06:15 +00:00
Dan Gohman
44771cf8e8 Fix the comment for LegalizeOp to more accurately reflect what it does.
llvm-svn: 39827
2007-07-13 20:14:11 +00:00
Dan Gohman
1f4580ceb4 Don't call SimplifyVBinOp for non-vector operations, following earlier review
feedback. This theoretically makes the common (scalar) case more efficient.

llvm-svn: 39823
2007-07-13 20:03:40 +00:00
Dale Johannesen
1a9d304c35 Modify previous patch per review comments.
llvm-svn: 39817
2007-07-13 17:31:29 +00:00
Dale Johannesen
469ed8e17e Skeleton of post-RA scheduler; doesn't do anything yet.
Change name of -sched option and DEBUG_TYPE to
pre-RA-sched; adjust testcases.

llvm-svn: 39816
2007-07-13 17:13:54 +00:00
Duncan Sands
b2a18dc10b The type ids making up a filter are unsigned, and
should be output as unsigned values.  Checked against
gcc.

llvm-svn: 39775
2007-07-12 13:51:39 +00:00
Evan Cheng
c7216b3a86 Missed a couple of places where new instructions are added due to spill / restore.
llvm-svn: 39748
2007-07-11 19:17:18 +00:00
Duncan Sands
bfbe683782 Exception handling has been implemented.
llvm-svn: 39732
2007-07-11 16:59:20 +00:00
Duncan Sands
aa83dc9037 If assertions are not enabled, we should return False here.
llvm-svn: 38535
2007-07-11 08:47:55 +00:00
Evan Cheng
2791a7ea6d No longer need to track last def / use.
llvm-svn: 38534
2007-07-11 08:47:44 +00:00
Evan Cheng
c42a2e03f1 Fix for PR1545: Revamp code that update kill information due to register reuse.
llvm-svn: 38525
2007-07-11 05:28:39 +00:00
David Greene
8d77dcca00 Make this work with GLIBCXX_DEBUG.
llvm-svn: 38516
2007-07-10 22:00:30 +00:00
Dan Gohman
629311ca52 Change the peep for EXTRACT_VECTOR_ELT of BUILD_PAIR to look for
the new CONCAT_VECTORS node type instead, as that's what legalize
uses now. And add a peep for EXTRACT_VECTOR_ELT of INSERT_VECTOR_ELT.

llvm-svn: 38503
2007-07-10 18:20:44 +00:00
Evan Cheng
d80c2821af If the operand is marked M_OPTIONAL_DEF_OPERAND, then it's a def.
llvm-svn: 38496
2007-07-10 17:52:20 +00:00
Evan Cheng
87e735c4be Somehow this wasn't committed last time. M_CLOBBERS_PRED is gone.
llvm-svn: 38495
2007-07-10 17:50:43 +00:00
Dan Gohman
bd0ff28e1c Fix a bug in the folding of binary operators to undef.
Thanks to Lauro for spotting this!

llvm-svn: 38491
2007-07-10 15:19:29 +00:00
Dan Gohman
6b21e11f1c Fix the folding of undef in several binary operators to recognize
undef in either the left or right operand.

llvm-svn: 38489
2007-07-10 14:20:37 +00:00
Evan Cheng
cf3b1c89a9 When a node value is only used by a CopyToReg, use the user's dest. This should not be restricted to nodes that produce only a single value.
llvm-svn: 38485
2007-07-10 07:08:32 +00:00
Evan Cheng
23dc96f640 Move DenseMapKeyInfo<SDOperand> from LegalizeDAG.cpp to SelectionDAGNodes.h
llvm-svn: 38484
2007-07-10 06:59:55 +00:00
Dan Gohman
150487b166 Preserve volatililty and alignment information when lowering or
simplifying loads and stores.

llvm-svn: 38473
2007-07-09 22:18:38 +00:00
Dan Gohman
81cfdc2f19 Change getCopyToParts and getCopyFromParts to always use target-endian
register ordering, for both physical and virtual registers. Update the PPC
target lowering for calls to expect registers for the call result to
already be in target order.

llvm-svn: 38471
2007-07-09 20:59:04 +00:00
Dan Gohman
be352027e6 Initialize the IndexedModeActions array with memset before
updating it with calls to setIndexedLoadAction/setIndexedStoreAction,
which only update a few bits at a time. This avoids ostensible
undefined behavior of operationg on values which may be
trap-representations, and as a practical matter fixes errors from
valgrind, which doesn't track uninitialized memory with bit
granularity.

llvm-svn: 38468
2007-07-09 20:49:44 +00:00
Chris Lattner
aff9a84b7a Fix this warning:
DAGCombiner.cpp: In member function 'llvm::SDOperand<unnamed>::DAGCombiner::visitOR(llvm::SDNode*)':
DAGCombiner.cpp:1608: warning: passing negative value '-0x00000000000000001' for argument 1 to 'llvm::SDOperand llvm::SelectionDAG::getConstant(uint64_t, llvm::MVT::ValueType, bool)'

oiy.

llvm-svn: 38458
2007-07-09 16:16:34 +00:00
Gabor Greif
89919e17b4 fix typos
llvm-svn: 38453
2007-07-09 12:00:59 +00:00
Evan Cheng
4c7b04f24d Teach if-conversion about instructions that were already predicated, e.g. conditional move.
llvm-svn: 37964
2007-07-06 23:24:39 +00:00
Duncan Sands
f926a3080c The exception handling intrinsics return values,
so must be lowered to a value, not nothing at all.
Subtle point: I made eh_selector return 0 and
eh_typeid_for return 1.  This means that only
cleanups (destructors) will be run as the exception
unwinds [if eh_typeid_for returned 0 then it would
be as if the first catch always matched, and the
corresponding handler would be run], which is
probably want you want in the CBE.

llvm-svn: 37947
2007-07-06 14:46:23 +00:00
Duncan Sands
404336eb55 Indexes into the list of filter ids cannot be output
directly: they need to be turned into byte offsets
(often the same, but may not be if there are many
type infos).

llvm-svn: 37942
2007-07-06 12:46:24 +00:00
Rafael Espindola
7b3de98989 Add the byval attribute
llvm-svn: 37940
2007-07-06 10:57:03 +00:00
Duncan Sands
7e50c11edd Remove propagateEHRegister in favour of a more limited
fix, that is adequate while PR1508 remains unresolved.

llvm-svn: 37938
2007-07-06 09:18:59 +00:00
Duncan Sands
e7650d2b1e Remove ExtractGlobalVariable - use StripPointerCasts
instead.

llvm-svn: 37937
2007-07-06 09:10:03 +00:00
Evan Cheng
bae19254f0 Workaround of getCopyToRegs and getCopyFromRegs bugs for big-endian machines.
llvm-svn: 37935
2007-07-06 01:47:35 +00:00
Evan Cheng
22957164aa Change CalculateHeights and CalculateDepths to be non-recursive.
llvm-svn: 37934
2007-07-06 01:37:28 +00:00
Dan Gohman
cd6f6a0a58 Make the debug string for ISD::MERGE_VALUES consistent with the others.
llvm-svn: 37922
2007-07-05 20:15:43 +00:00
Dan Gohman
90c6b87b31 Add a parameter to getCopyToParts and getCopyFromParts to specify whether
endian swapping should be done, and update the code to use it. This fixes
some register ordering issues on big-endian systems, such as PowerPC,
introduced by the recent illegal by-val arguments changes.

llvm-svn: 37921
2007-07-05 20:12:34 +00:00
Gabor Greif
5f705671e4 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Duncan Sands
eca2fa295b Make sure only one copy of a filter is placed in the
exception handling table if we encounter it multiple
times.  Filters could be folded harder than this, but
that would mean a lot more work for not much gain.

llvm-svn: 37908
2007-07-05 15:15:01 +00:00
Evan Cheng
0c037f4ee0 Better assertion messages.
llvm-svn: 37890
2007-07-05 07:05:38 +00:00
Duncan Sands
4441eff1ac Extend eh.selector to support both catches and filters.
Drop the eh.filter intrinsic.

llvm-svn: 37875
2007-07-04 20:52:51 +00:00
Dan Gohman
d2d18267e6 Fix several over-aggressive folds for undef nodes in dagcombine, to
follow the rules for undef used in instcombine.

llvm-svn: 37851
2007-07-03 14:03:57 +00:00
Dale Johannesen
7af19491d3 Fix for PR 1505 (and 1489). Rewrite X87 register
model to include f32 variants.  Some factoring
improvments forthcoming.

llvm-svn: 37847
2007-07-03 00:53:03 +00:00
Dan Gohman
68f0cbccfb Replace ExpandScalarFormalArgs and ExpandScalarCallArgs with the newly
refactored getCopyFromParts and getCopyToParts, which are more general.
This effectively adds support for lowering illegal by-val vector call
arguments.

llvm-svn: 37843
2007-07-02 16:18:06 +00:00
Dan Gohman
5fe8266d04 Teach GetNegatedExpression to negate 0-B to B in UnsafeFPMath mode, and
visitFSUB to fold 0-B to -B in UnsafeFPMath mode. Also change visitFNEG
to use isNegatibleForFree/GetNegatedExpression instead of doing a subset
of the same thing manually.

This fixes test/CodeGen/X86/negative-sin.ll.

llvm-svn: 37842
2007-07-02 15:48:56 +00:00
Evan Cheng
a1a06d1763 Only do FNEG xform when the vector type is a floating point type.
llvm-svn: 37818
2007-06-29 21:44:35 +00:00
David Greene
75e58e2207 Remove unused variables.
llvm-svn: 37816
2007-06-29 21:42:03 +00:00
Evan Cheng
a6add260b3 Fix a vector FP constant CSE bug.
llvm-svn: 37814
2007-06-29 21:36:04 +00:00
David Greene
0942edd414 Remove unnecessary attributions in comments.
llvm-svn: 37799
2007-06-29 03:42:23 +00:00
David Greene
df6a87ea1c Fix reference to cached end iterator invalidated by an erase operation.
Uncovered by _GLIBCXX_DEBUG.

llvm-svn: 37795
2007-06-29 02:49:11 +00:00
David Greene
244fb44f6b Remove the "special tie breaker" because it resulted in inconsistent
ordering and thus violated the strict weak ordering requirement of
priority_queue.  Uncovered by _GLIBCXX_DEBUG.

llvm-svn: 37794
2007-06-29 02:48:09 +00:00
David Greene
ad230f223f Fix misue of iterator pointing to erased object. Uncovered by
_GLIBCXX_DEBUG.

llvm-svn: 37793
2007-06-29 02:45:24 +00:00
Dan Gohman
ad9cbaba40 Fix an assertion failure in legalizing bitcast operators on targets where
vectors are split down to single elements as part of legalization.

llvm-svn: 37785
2007-06-29 00:09:08 +00:00
Dan Gohman
c6bdcfa8c0 Add new TargetLowering code to provide the final register type that an
illegal value type will be transformed to, for code that needs the
register type after all transformations instead of just after the first
transformation.

Factor out the code that uses this information to do copy-from-regs and
copy-to-regs for various purposes into separate functions so that they
are done consistently.

llvm-svn: 37781
2007-06-28 23:29:44 +00:00
Evan Cheng
e67385d712 If a livein is not used in the block. It's live through.
llvm-svn: 37764
2007-06-27 18:47:28 +00:00
Evan Cheng
26542e347a Partial fix for PR1502: If a EH register is needed in a successor of landing pad, add it as livein to all the blocks in the paths between the landing pad and the specified block.
llvm-svn: 37763
2007-06-27 18:45:32 +00:00
Dan Gohman
cb89e19a6d Rename ("shrinkify") MVT::isExtendedValueType to MVT::isExtendedVT.
llvm-svn: 37758
2007-06-27 16:08:04 +00:00
Dan Gohman
c1c4b0972f Use getVectorTypeBreakdown in FunctionLoweringInfo::CreateRegForValue
to compute the number and type of registers needed for vector values
instead of computing it manually. This fixes PR1529.

llvm-svn: 37755
2007-06-27 14:34:07 +00:00
Dan Gohman
69a6154359 Make the comment for ScalarizeVectorOp mention that it is only for use
with single-element vectors.

llvm-svn: 37752
2007-06-27 14:06:22 +00:00
Duraid Madina
d32d8b9726 ok, this is something of a dirty hack, but it seems to work. (fixes e.g.
the SPASS miscompilation)

llvm-svn: 37750
2007-06-27 09:01:14 +00:00
Duraid Madina
73b0d188c8 ok, this much doesn't seem to bork anything
llvm-svn: 37749
2007-06-27 08:31:07 +00:00
Duraid Madina
94cd67290b revert evan's fixes (and my doofusness) since they had a huge code
quality hit. will look at this soon.

llvm-svn: 37748
2007-06-27 08:11:59 +00:00
Duraid Madina
c0d3c96333 pull evan's fixes - should help the nightly tester (but there are still
some issues)

llvm-svn: 37747
2007-06-27 07:07:13 +00:00
Evan Cheng
480cd89fa1 Replace std::set with SmallPtrSet.
llvm-svn: 37746
2007-06-27 05:23:00 +00:00
Evan Cheng
f74e333161 Fix an obvious bug. Old code only worked for the entry block.
llvm-svn: 37743
2007-06-27 01:16:36 +00:00
Evan Cheng
5c0f03bce4 Correctly handle implcit def / use operands.
llvm-svn: 37740
2007-06-26 21:05:13 +00:00
Evan Cheng
0eaa723739 Properly handle kills of a physical register which has sub-registers that are read by later instructions.
llvm-svn: 37739
2007-06-26 21:03:35 +00:00
Duraid Madina
c4b17f9a08 tidy this file up a bit
llvm-svn: 37725
2007-06-26 00:21:58 +00:00
Duraid Madina
1d8c70bf83 A bunch of fixes to the BigBlock allocator improve compile-time by ~20%
and code quality by ~2% on my tests.

A big thank you to Roman Levenstein for this patch! See
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070618/050717.html
for more details.

llvm-svn: 37724
2007-06-25 23:46:54 +00:00
Dan Gohman
354f02e03d Generalize MVT::ValueType and associated functions to be able to represent
extended vector types. Remove the special SDNode opcodes used for pre-legalize
vector operations, and the special MVT::Vector type used with them. Adjust
lowering and legalize to work with the normal SDNode kinds instead, and to
use the normal MVT functions to work with vector types instead of using the
two special operands that the pre-legalize nodes held.

This allows pre-legalize and post-legalize DAGs, and the code that operates
on them, to be more consistent. Pre-legalize vector operators can be handled
more consistently with scalar operators. And, -view-dag-combine1-dags and
-view-legalize-dags now look prettier for vector code.

llvm-svn: 37719
2007-06-25 16:23:39 +00:00
Dan Gohman
a62327ea40 Move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBits from
TargetLowering to SelectionDAG so that they have more convenient
access to the current DAG, in preparation for the ValueType routines
being changed from standalone functions to members of SelectionDAG for
the pre-legalize vector type changes.

llvm-svn: 37704
2007-06-22 14:59:07 +00:00
Duraid Madina
fe6e41b4f9 check in the BigBlock local register allocator
llvm-svn: 37703
2007-06-22 08:27:12 +00:00
Evan Cheng
85169b9b40 std::set is really really terrible. Switch to SmallPtrSet to reduce compile time. For Duraid's example. The overall isel time is reduced from 0.6255 sec to 0.1876 sec.
llvm-svn: 37701
2007-06-22 01:35:51 +00:00
Dan Gohman
72af1305fb Tidy up ValueType names in comments.
llvm-svn: 37688
2007-06-21 14:48:26 +00:00
Dan Gohman
1815e9bdb3 Rename TargetLowering::getNumElements and friends to
TargetLowering::getNumRegisters and similar, to avoid confusion with
the actual number of elements for vector types.

llvm-svn: 37687
2007-06-21 14:42:22 +00:00
Evan Cheng
f26fc091ac Xforms:
(add (select cc, 0, c), x) -> (select cc, x, (add, x, c))
(sub x, (select cc, 0, c)) -> (select cc, x, (sub, x, c))

llvm-svn: 37685
2007-06-21 07:39:16 +00:00
Evan Cheng
5e2aabd3ad Avoid if-converting simple block that ends with unconditional branch or fallthrough unless it branches / falls to the 'false' block. Not profitable, may end up increasing code size.
llvm-svn: 37660
2007-06-19 21:45:13 +00:00
Dan Gohman
485cb57eab Pass a SelectionDAG into SDNode::dump everywhere it's used, in prepration
for needing the DAG node to print pre-legalize extended value types, and
to get better debug messages with target-specific nodes.

llvm-svn: 37656
2007-06-19 14:13:56 +00:00
Chris Lattner
653c0ccfbe document and hide two options.
llvm-svn: 37651
2007-06-19 05:47:49 +00:00
Dan Gohman
b60d8a92c9 Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.

llvm-svn: 37644
2007-06-19 01:48:05 +00:00
Evan Cheng
12b3002673 Replace TargetInstrInfo::CanBeDuplicated() with a M_NOT_DUPLICABLE bit.
llvm-svn: 37643
2007-06-19 01:26:51 +00:00
Chris Lattner
68f9f9fa3b add isVarArg to CCState
llvm-svn: 37640
2007-06-19 00:11:09 +00:00
Evan Cheng
b752a87db1 Fix some fragile code wrt CFG edge updating.
llvm-svn: 37634
2007-06-18 22:44:57 +00:00
Evan Cheng
978058bcd7 Move CorrectExtraCFGEdges() from BranchFolding.cpp to a MachineBasicBlock method.
llvm-svn: 37633
2007-06-18 22:43:58 +00:00
Chris Lattner
5b93ff84b9 make ComputeTopDownOrdering significantly faster and use less stack space
by making it non-recursive

llvm-svn: 37629
2007-06-18 21:28:10 +00:00
Dan Gohman
46f036ccb0 Make chain dependencies blue, in addition to being dashed.
llvm-svn: 37626
2007-06-18 15:30:16 +00:00
Evan Cheng
b3cefc0824 Properly remove duplicate instructions as result of diamond if-conversion. Other bug fixes.
llvm-svn: 37623
2007-06-18 08:37:25 +00:00
Evan Cheng
1732a41371 Really turn if-converter loose:
1. Consider all possible ifcvt cases at once. No longer restricted to bottom
   up iterative approach.
2. Sort all possible cases based on a cost function. Perform the most profitable
   ones first invalidate others that target the same blocks.
3. Fixed a number of bugs related to block duplication.

llvm-svn: 37613
2007-06-16 09:34:52 +00:00
Tanya Lattner
4c078c1ace Codegen support (stripped out) for the annotate attribute.
llvm-svn: 37608
2007-06-15 22:26:58 +00:00
Evan Cheng
759b3cca3c Not every predicable block can be safely duplicated.
llvm-svn: 37607
2007-06-15 21:18:05 +00:00
Chris Lattner
c08e8abb53 Fix CodeGen/X86/inline-asm-x-scalar.ll:test4, by retaining regclass info
for tied register constraints.

llvm-svn: 37601
2007-06-15 19:11:01 +00:00
Evan Cheng
88c463eb8c MachineInstr::isPredicable() is no longer needed.
llvm-svn: 37599
2007-06-15 19:06:07 +00:00
Duncan Sands
deef6fe78b Workaround for PR1508.
llvm-svn: 37597
2007-06-15 19:04:19 +00:00
Evan Cheng
a6504bc2e0 Extra edges are deleted later if needed.
llvm-svn: 37593
2007-06-15 17:34:48 +00:00
Evan Cheng
f4d3d695b2 Allow small blocks to be duplicated to enable if-conversion.
llvm-svn: 37590
2007-06-15 07:36:12 +00:00
Evan Cheng
6f348e1c75 No really, clear predcessors states.
llvm-svn: 37581
2007-06-14 23:34:09 +00:00
Evan Cheng
b1b1914582 If BB is predicated, invalidate its predecessor(s) which would if-convert it. It needs to be re-analyzed.
llvm-svn: 37580
2007-06-14 23:13:19 +00:00
Dan Gohman
2fd7d26df8 Rename MVT::getVectorBaseType to MVT::getVectorElementType.
llvm-svn: 37579
2007-06-14 22:58:02 +00:00
Evan Cheng
26d68261ae Fix typo.
llvm-svn: 37577
2007-06-14 21:26:08 +00:00
Dan Gohman
35f2b4d716 Add a target hook to allow loads from constant pools to be rematerialized, and an
implementation for x86.

llvm-svn: 37576
2007-06-14 20:50:44 +00:00
Evan Cheng
a2c2479e22 Fix some stupid bugs that have effectively disabled if-conversion.
llvm-svn: 37575
2007-06-14 20:28:52 +00:00
Duncan Sands
51e6294637 Only correctly lower exception handing intrinsics if exception handling is
turned on.  Likewise for scanning of invokes to mark landing pads.

llvm-svn: 37570
2007-06-13 16:53:21 +00:00
Dan Gohman
6415b2548e Introduce new SelectionDAG node opcodes VEXTRACT_SUBVECTOR and
VCONCAT_VECTORS. Use these for CopyToReg and CopyFromReg legalizing in
the case that the full register is to be split into subvectors instead
of scalars. This replaces uses of VBIT_CONVERT to present values as
vector-of-vector types in order to make whole subvectors accessible via
BUILD_VECTOR and EXTRACT_VECTOR_ELT.

This is in preparation for adding extended ValueType values, where
having vector-of-vector types is undesirable.

llvm-svn: 37569
2007-06-13 15:12:02 +00:00
Dan Gohman
3bc1455d49 When creating CopyFromReg nodes, always use legal types. And use the
correct types for the result vector, even though it is currently bitcasted
to a different type immediately.

llvm-svn: 37568
2007-06-13 14:55:16 +00:00
Duncan Sands
32eaa9b30a The fix that was applied for PR1224 stops the compiler
crashing but breaks exception handling.  The problem
described in PR1224 is that invoke is a terminator that
can produce a value.  The value may be needed in other
blocks.  The code that writes to registers values needed
in other blocks runs before terminators are lowered (in
this case invoke) so asserted because the value was not
yet available.  The fix that was applied was to do invoke
lowering earlier, before writing values to registers.

The problem this causes is that the code to copy values
to registers can be output after the invoke call.  If
an exception is raised and control is passed to the
landing pad then this copy-code will never execute.  If
the value is needed in some code path reached via the
landing pad then that code will get something bogus.

So revert the original fix and simply skip invoke values
in the general copying to registers code.  Instead copy
the invoke value to a register in the invoke lowering code.

llvm-svn: 37567
2007-06-13 05:51:31 +00:00
Evan Cheng
d4e9443a78 Typo
llvm-svn: 37566
2007-06-13 00:04:00 +00:00
Evan Cheng
d5aaab210c Now if-converting all 4 variants of triangles.
llvm-svn: 37565
2007-06-12 23:54:05 +00:00
Lauro Ramos Venancio
c9a156f041 Fix a typo in bswap lowering.
llvm-svn: 37544
2007-06-11 23:16:16 +00:00
Evan Cheng
d6740b478b Restructure code to reduce ifcvt compile time cost.
llvm-svn: 37543
2007-06-11 22:26:22 +00:00
Reid Spencer
0c11f4ebd8 Fix the build.
llvm-svn: 37537
2007-06-10 00:19:17 +00:00
Evan Cheng
859dab4bda Don't change CFG during analysis stage. Do so during ifcvt and invalidate predecessors accordingly.
llvm-svn: 37531
2007-06-09 01:03:43 +00:00
Evan Cheng
7996fc5d23 Carefully remove extraneous CFG edges after each ifcvt.
llvm-svn: 37529
2007-06-08 22:01:07 +00:00
Evan Cheng
515e2537d7 Correct transfer predicate information.
llvm-svn: 37524
2007-06-08 19:17:12 +00:00
Evan Cheng
49720a7312 Hidden options to help debugging ifcvt issues.
llvm-svn: 37523
2007-06-08 19:10:51 +00:00
David Greene
6b14050d1e Factor live variable analysis so it does not do register coalescing
simultaneously.  Move that pass to SimpleRegisterCoalescing.

This makes it easier to implement alternative register allocation and
coalescing strategies while maintaining reuse of the existing live
interval analysis.

llvm-svn: 37520
2007-06-08 17:18:56 +00:00
Evan Cheng
a41764f141 Allow more cmp / bcc to be predicated; clean up triangle ifcvt checking code.
llvm-svn: 37518
2007-06-08 09:36:04 +00:00
Duncan Sands
f31e17574a Use more realistically sized vectors. Reserve capacity if we know in advance
how much will be used.

llvm-svn: 37515
2007-06-08 08:59:11 +00:00
Dale Johannesen
74ffb6ffb3 Make throttle a hidden parameter, per review.
llvm-svn: 37511
2007-06-08 01:08:52 +00:00
Dale Johannesen
0903dd4e52 Throttle tail merging; handling blocks with large numbers of predecessors
is too slow.

llvm-svn: 37509
2007-06-08 00:34:27 +00:00
Evan Cheng
2b9e9abed1 Only remove the edge from entry to false if false block is merged.
llvm-svn: 37503
2007-06-07 22:31:28 +00:00
Dale Johannesen
0f3c011fd5 Do not change the size of function arguments. PR 1489.
llvm-svn: 37496
2007-06-07 21:07:15 +00:00
Evan Cheng
4f73706838 ifcvt a triangle: don't merge ifcvt block with rejoin block if it can fall through to it. If merged, the resulting block is not a candidate for iterative ifcvting since it contains both predicated and non-predicated code.
llvm-svn: 37487
2007-06-07 08:13:00 +00:00
Evan Cheng
d440a235a1 Lots of bug fixes. Now finally in a reasonable state.
llvm-svn: 37485
2007-06-07 02:12:15 +00:00
Owen Anderson
b333dd064e Quick patch to fix the build, based on what it appears Evan meant to write.
Evan, please check that this is in fact correct.

llvm-svn: 37471
2007-06-06 16:22:00 +00:00
Duncan Sands
9bef60ea1a Fold the exception actions table harder: if two typeid lists start the
same, only output one copy of the common part.

llvm-svn: 37470
2007-06-06 15:37:31 +00:00
Evan Cheng
aeccfbef8b Lots of bug fixes.
llvm-svn: 37467
2007-06-06 10:16:17 +00:00
Duncan Sands
484bdb927b Additional fix for PR1422: make sure the landing pad label is placed in the
correct machine basic block - do not rely on the eh.exception intrinsic
being in the landing pad: the loop optimizers can move it out.

llvm-svn: 37463
2007-06-06 10:05:18 +00:00
Evan Cheng
4c42a30bad If a unconditional branch is added to branch to the false path during ifcvt, the predicated block cannot be iteratively ifcvted.
llvm-svn: 37456
2007-06-06 02:08:52 +00:00
Evan Cheng
cc7186df2b Minor statistics counting bug.
llvm-svn: 37451
2007-06-06 01:12:44 +00:00
Evan Cheng
2eefb6f4c3 Fix a couple of typos and be smarter about order of blocks when ifcvt a diamond.
llvm-svn: 37449
2007-06-06 00:57:55 +00:00
Evan Cheng
3db28ad9f2 Fix diamond shape ifcvt bugs.
llvm-svn: 37444
2007-06-05 23:46:14 +00:00
Evan Cheng
acf719bf83 ReplaceUsesOfBlockWith() can modify the predecessors list.
llvm-svn: 37441
2007-06-05 22:03:53 +00:00
Evan Cheng
f2a2a5a025 Do not ifcvt if either true / false path is a backedge. Not profitable in almost all cases.
llvm-svn: 37440
2007-06-05 20:38:42 +00:00
Evan Cheng
d495b2f9b9 I had a senior moment.
llvm-svn: 37433
2007-06-05 07:05:25 +00:00
Evan Cheng
a7f7c92dc9 If the predicated block requires an early exit, end the block there and add a unconditional branch to false block. AnalyzeBranch() does not understand early exits.
llvm-svn: 37430
2007-06-05 01:31:40 +00:00
Evan Cheng
7b113514d4 Fix some subtle bugs: bug during succeessor copying; incorrectly updating states of ifcvted blocks.
llvm-svn: 37429
2007-06-05 00:07:37 +00:00
Dale Johannesen
a68662e4a4 Tail merging wasn't working for predecessors of landing pads. PR 1496.
llvm-svn: 37427
2007-06-04 23:52:54 +00:00
Evan Cheng
8728a6c3fd Global ctors / dtors alignment shouldn't be hard-coded at 4. e.g. It could be 8 for 64-bit targets.
llvm-svn: 37421
2007-06-04 20:39:18 +00:00
Evan Cheng
79f53ff66d Forgot to check for if iterator reached the end.
llvm-svn: 37420
2007-06-04 20:33:36 +00:00
Dan Gohman
e6c827b537 Pass the DAG to SDNode::dump to let it do more detailed dumps in some cases.
llvm-svn: 37413
2007-06-04 16:17:33 +00:00
Dan Gohman
b69321ca1d Resolve implicit alignment before computing the FoldingSet information so
that the CSE map always contains explicit alignment information. This allows
more loads to be CSE'd when there is a mix of explicit-alignment loads and
implicit-alignment loads.

Also, in SelectionDAG::FindModifiedNodeSlot, add the operands to the
FoldingSetNodeID before the load/store information instead of after, so
that it matches what is done elsewhere.

llvm-svn: 37411
2007-06-04 15:49:41 +00:00
Evan Cheng
c86e3086da Let IfConverter loose. Allow more aggressive subsumptions; reorder basic blocks to expose more ifcvt opportunities; code clean up and fixes.
llvm-svn: 37409
2007-06-04 06:47:22 +00:00
Evan Cheng
0dbe4d04db Move ReplaceUsesOfBlockWith() out of BranchFolding into a MachineBasicBlock general facility.
llvm-svn: 37408
2007-06-04 06:44:01 +00:00
Duncan Sands
f37bc8207e The semantics of invoke require that we always jump to the unwind block
(landing pad) when an exception unwinds through the call.  This doesn't
quite match the way the dwarf unwinder works: by default it only jumps to
the landing pad if the catch or filter specification matches, and otherwise
it keeps on unwinding.  There are two ways of specifying to the unwinder
that it should "always" (more on why there are quotes here later) jump to
the landing pad: follow the specification by a 0 typeid, or follow it by
the typeid for the NULL typeinfo.  GCC does the first, and this patch makes
LLVM do the same as gcc.  However there is a problem: the unwinder performs
optimizations based on C++ semantics (it only expects destructors to be
run if the 0 typeid fires - known as "cleanups"), meaning it assumes that no
exceptions will be raised and that the raised exception will be reraised
at the end of the cleanup code.  So if someone writes their own LLVM code
using the exception intrinsics they will get a nasty surprise if they don't
follow these rules.  The other possibility of using the typeid corresponding
to NULL (catch-all) causes the unwinder to make no assumptions, so this is
probably what we should use in the long-run.  However since we are still
having trouble getting exception handling working properly, for the moment
it seems best to closely imitate GCC.

llvm-svn: 37399
2007-06-02 17:16:06 +00:00
Duncan Sands
37925d3f39 Integrate exception filter support and exception catch support. This
simplifies the code in DwarfWriter, allows for multiple filters and
makes it trivial to specify filters accompanied by cleanups or catch-all
specifications (see next patch).  What a deal!  Patch blessed by Anton.

llvm-svn: 37398
2007-06-02 16:53:42 +00:00
Zhou Sheng
60714d7922 Make LowerCTPOP() support arbitrary bitwidth integer type.
llvm-svn: 37397
2007-06-02 04:10:33 +00:00
Dale Johannesen
63d49a09aa Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets.
llvm-svn: 37394
2007-06-02 00:08:15 +00:00
Dale Johannesen
071dbb1f87 Fancier algorithm in tail-merge comment implemented, so remove comment.
llvm-svn: 37393
2007-06-01 23:04:28 +00:00
Dale Johannesen
fd7f1ad2f7 Implement smarter algorithm for choosing which blocks to tail-merge.
See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well;
shaves another 10K off our favorite benchmark.  I was hesitant about
this because of compile speed, but seems to do OK on a bootstrap.

llvm-svn: 37392
2007-06-01 23:02:45 +00:00
Evan Cheng
d7793e4561 Correctly mark early-exit on the false path.
llvm-svn: 37387
2007-06-01 20:29:21 +00:00
Duncan Sands
b1cc3f9881 Since TypeInfos are passed as i8 pointers, a NULL TypeInfo should be passed
as a null i8 pointer not as a 0 i32.

llvm-svn: 37383
2007-06-01 08:18:30 +00:00
Evan Cheng
ce6bae7667 Ifcvt triangle: don't ifcvt 'true' BB if it has other predecessors; don't merge 'false' BB if it has other predecessors.
llvm-svn: 37382
2007-06-01 07:41:07 +00:00
Evan Cheng
8e188afada Remove a bogus check. Even terminators in a ifcvt need to be predicated. Unconditional branches can usually be converted to conditional ones.
llvm-svn: 37380
2007-06-01 00:55:26 +00:00
Evan Cheng
7c081d0d02 Allow multiple ifcvt candidates to share children blocks; add some debugging code.
llvm-svn: 37379
2007-06-01 00:12:12 +00:00
Dale Johannesen
4ca6f07cf0 Arrange for only 1 of multiple branches to landing pad to be kept.
Do not remove empty landing pads (EH table needs to be updated)

llvm-svn: 37375
2007-05-31 21:54:00 +00:00
Evan Cheng
7a6edf8eab Fix a typo.
llvm-svn: 37374
2007-05-31 20:53:33 +00:00
Chris Lattner
72e07238ba Fix the asmprinter so that a globalvalue can specify an explicit alignment
smaller than the preferred alignment, but so that the target can actually
specify a minimum alignment if needed.  This fixes some objc protocol
failures Devang tracked down.

llvm-svn: 37373
2007-05-31 18:57:45 +00:00
Lauro Ramos Venancio
b5186a0078 Fix PR1424.
When a function has FP, the register scavenging spill slot offset already
was calculated.

llvm-svn: 37371
2007-05-31 18:27:58 +00:00
Evan Cheng
c9c6bbd273 Change traversal order to bottom up in preparation for more aggressive if-conversion.
llvm-svn: 37365
2007-05-30 19:49:19 +00:00
Chris Lattner
14bcacb40b Fix CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll, and PR1473.
llvm-svn: 37362
2007-05-30 16:30:06 +00:00
Dale Johannesen
b306dfb861 Changed per review comment.
llvm-svn: 37355
2007-05-30 00:32:01 +00:00
Dale Johannesen
1ba04f7d87 Make stable_sort in tail merging actually be stable (it never was, but didn't
matter until my last change).  Reenable tail merging by default.

llvm-svn: 37354
2007-05-29 23:47:50 +00:00
Evan Cheng
a1300649ba Don't merge in tail block of a diamond if it has more than one predecessors after if-conversion.
llvm-svn: 37353
2007-05-29 23:37:20 +00:00
Evan Cheng
b1ba206831 If there is an empty block between a source and its successor block, it still requires a unconditional branch.
llvm-svn: 37344
2007-05-29 22:31:16 +00:00
Evan Cheng
d8b25a2091 Add missing const qualifiers.
llvm-svn: 37341
2007-05-29 18:35:22 +00:00
Zhou Sheng
3e018c3e3e Correct the logic in LowerPartSet which cleared the bits from 0 to low-1.
llvm-svn: 37331
2007-05-26 03:43:13 +00:00
Chris Lattner
5161203d52 tighten up recursion depth again
llvm-svn: 37330
2007-05-25 02:19:06 +00:00
Evan Cheng
36164f93fd Silly boog.
llvm-svn: 37328
2007-05-25 00:59:01 +00:00
Dale Johannesen
86fb3a132a Blocks that cond-br and uncond-br/fallthrough to same block should have
only one successor.

llvm-svn: 37324
2007-05-24 18:31:55 +00:00
Dale Johannesen
ecaa8a0fb4 Fix for PR1444: do not create two successors to the same block.
Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll
by exposing an unrelated latent problem; working on that.

llvm-svn: 37323
2007-05-24 17:39:32 +00:00
Dan Gohman
2c5d31ee81 Minor comment cleanups.
llvm-svn: 37321
2007-05-24 14:36:04 +00:00
Dan Gohman
1b1932dda5 Add explicit qualification for namespace MVT members.
llvm-svn: 37320
2007-05-24 14:33:05 +00:00
Evan Cheng
439bf58dc2 Fix a typo that caused combiner to create mal-formed pre-indexed store where value store is the same as the base pointer.
llvm-svn: 37318
2007-05-24 02:35:39 +00:00
Dale Johannesen
d0b7bbe261 Two tail merging improvements:
When considering blocks with more than 2 predecessors, merge the block with
the largest number of matching insns, rather than the first block found.
Considering that 1 matching insn is enough to show a win for candidates that
already end with a branch.

llvm-svn: 37315
2007-05-23 21:07:20 +00:00
Anton Korobeynikov
0f184e86ab Mark all calls as "could throw", when exceptions are enabled. Emit necessary LP info too. This fixes PR1439
llvm-svn: 37311
2007-05-23 11:08:31 +00:00
Chris Lattner
d540c6429f prevent exponential recursion in isNegatibleForFree
llvm-svn: 37310
2007-05-23 07:35:22 +00:00
Evan Cheng
3f44824179 Preliminary iterative if-conversion support.
llvm-svn: 37309
2007-05-23 07:23:16 +00:00
Dale Johannesen
738f94210c name change requested by review of previous patch
llvm-svn: 37289
2007-05-22 18:31:04 +00:00
Owen Anderson
fd5693fcc4 Silence a warning.
llvm-svn: 37288
2007-05-22 18:13:40 +00:00
Dale Johannesen
fe0fe14411 Make tail merging the default, except on powerPC. There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.

llvm-svn: 37285
2007-05-22 17:14:46 +00:00
Evan Cheng
d395b14837 If-convert early exit blocks (returns, etc.); bug fixes, etc.
llvm-svn: 37270
2007-05-21 22:22:58 +00:00
Duncan Sands
05d340bbd1 Only emit one entry in the exception action table for each action, even if
it occurs for multiple landing pads.

llvm-svn: 37267
2007-05-21 18:50:28 +00:00
Chris Lattner
27b469b945 same patch as the previous one, but the symmetric case
llvm-svn: 37249
2007-05-19 00:46:51 +00:00
Chris Lattner
2430b7c4aa Disable the (A == (B-A)) -> 2*A == B xform when the sub has multiple uses (in
this case, the xform introduces an extra operation).  This compiles
PowerPC/compare-duplicate.ll into:

_test:
        subf r2, r3, r4
        cmplw cr0, r2, r3
        bne cr0, LBB1_2 ;F

instead of:

_test:
        slwi r2, r3, 1
        subf r3, r3, r4
        cmplw cr0, r4, r2
        bne cr0, LBB1_2 ;F

This is target independent of course.

llvm-svn: 37246
2007-05-19 00:43:44 +00:00
Evan Cheng
ca7bc898aa Clean up.
llvm-svn: 37237
2007-05-18 19:32:08 +00:00
Evan Cheng
ad9ce3c5b2 Change to depth-first traversal.
llvm-svn: 37236
2007-05-18 19:26:33 +00:00
Dale Johannesen
09b2912ab7 Document an inefficiency in tail merging.
llvm-svn: 37235
2007-05-18 18:46:40 +00:00
Dan Gohman
b593ad9fb0 Qualify calls to getTypeForValueType with MVT:: too.
llvm-svn: 37233
2007-05-18 18:41:29 +00:00
Evan Cheng
1ed1741260 Some restructuring in preparation for most aggressive if-conversion.
llvm-svn: 37231
2007-05-18 18:14:37 +00:00
Dan Gohman
d6a33914fb Qualify several calls to functions in the MVT namespace, for consistency.
llvm-svn: 37230
2007-05-18 17:52:13 +00:00
Evan Cheng
234f07808b Watch out for blocks that end with a return.
llvm-svn: 37227
2007-05-18 17:06:53 +00:00
Evan Cheng
40eecb3d06 If true / false blocks fallthrough before ifcvt, add unconditional branches to ifcvt'd block.
llvm-svn: 37200
2007-05-18 01:55:58 +00:00
Dale Johannesen
ca37006ffb Remove some unneeded branches. (spotted by Evan, thanks)
llvm-svn: 37198
2007-05-18 01:28:58 +00:00
Evan Cheng
c6aa69557a Make use of target specific block size limits; bug fixes.
llvm-svn: 37195
2007-05-18 00:20:58 +00:00
Evan Cheng
b4cc6606d5 Move isSuccessor() offline, change it to use std::find.
llvm-svn: 37190
2007-05-17 23:58:53 +00:00
Chris Lattner
910abfbfd1 disable MaskedValueIsZero, ComputeMaskedBits, and SimplifyDemandedBits for
i128 integers.  The 64-bit masks are not wide enough to represent the results.
These should be converted to APInt someday.

llvm-svn: 37169
2007-05-17 18:19:23 +00:00
Chris Lattner
d441344214 add expand support for ADDC/SUBC/ADDE/SUBE so we can codegen 128-bit add/sub on 32-bit (or less) targets
llvm-svn: 37168
2007-05-17 18:15:41 +00:00
Evan Cheng
3163b77d5e Add target hook to specify block size limit for if-conversion.
llvm-svn: 37134
2007-05-16 23:45:53 +00:00
Dale Johannesen
cc99a6fc32 Don't fold bitconvert(load) for preinc/postdec loads. Likewise stores.
llvm-svn: 37130
2007-05-16 22:45:30 +00:00
Evan Cheng
ab88e91c81 isBlockPredicable() always ignore terminal instructions; add comments.
llvm-svn: 37126
2007-05-16 21:54:37 +00:00
Evan Cheng
6f761adecb Rename M_PREDICATED to M_PREDICABLE; Moved isPredicable() to MachineInstr.
llvm-svn: 37121
2007-05-16 20:56:08 +00:00
Duncan Sands
3296999dbb Output exception call-sites in address order, as required by the unwinding
runtime.

llvm-svn: 37104
2007-05-16 12:12:23 +00:00
Chris Lattner
a18b36cf45 Use a ptr set instead of a linear search to unique TokenFactor operands.
This fixes PR1423

llvm-svn: 37102
2007-05-16 06:37:59 +00:00
Evan Cheng
3fb34a4fdd Devang points out that we need an assertion here.
llvm-svn: 37097
2007-05-16 05:11:10 +00:00
Evan Cheng
a781c7788a Bug fix: should check ABI alignment, not pref. alignment.
llvm-svn: 37094
2007-05-16 02:04:50 +00:00
Evan Cheng
aafca4d4a2 Initial commit of (very basic) if converter.
llvm-svn: 37092
2007-05-16 02:00:57 +00:00
Dale Johannesen
78ae2e1acb Remove extra CFG edges before doing these passes; it makes them happier.
llvm-svn: 37089
2007-05-15 21:19:17 +00:00
Lauro Ramos Venancio
251ea5ab65 Fix an infinite recursion in GetNegatedExpression.
llvm-svn: 37086
2007-05-15 17:05:43 +00:00
Duncan Sands
eddbb07561 The index into the actions table is a ULEB128 not a SLEB128.
llvm-svn: 37084
2007-05-15 13:54:14 +00:00
Reid Spencer
b1ac506546 Un-brain-dead-ify the lowering of part set for the reverse case.
llvm-svn: 37071
2007-05-15 02:26:52 +00:00
Chris Lattner
ba648e0d45 Fix some subtle issues handling immediate values. This fixes
test/CodeGen/ARM/2007-05-14-InlineAsmCstCrash.ll

llvm-svn: 37069
2007-05-15 01:33:58 +00:00
Evan Cheng
eea85a767e Added getNumExplicitOperands and findFirstPredOperand.
llvm-svn: 37064
2007-05-15 01:26:09 +00:00
Chris Lattner
eba1b74df3 implement a simple fneg optimization/propagation thing. This compiles:
CodeGen/PowerPC/fneg.ll into:

_t4:
        fmul f0, f3, f4
        fmadd f1, f1, f2, f0
        blr

instead of:

_t4:
        fneg f0, f3
        fmul f0, f0, f4
        fmsub f1, f1, f2, f0
        blr

llvm-svn: 37054
2007-05-14 22:04:50 +00:00
Evan Cheng
9645be8cf5 Only worry about intervening kill if there are more than one live ranges in the interval.
llvm-svn: 37052
2007-05-14 21:23:51 +00:00
Evan Cheng
e9e48bcf28 Fix for PR1406:
v1 =
r2 = move v1
   = op r2<kill>
...
r2 = move v1
   = op r2<kill>

Clear the first r2 kill if v1 and r2 are joined.

llvm-svn: 37050
2007-05-14 21:10:05 +00:00
Evan Cheng
bb876d7323 When marking a register as being implicitly defined, make sure to clear its partial use info as well.
llvm-svn: 37046
2007-05-14 20:39:18 +00:00
Reid Spencer
afe2314bb0 Give names to the final result values of the part_set computations. This
just aids in readability and debugability of the output. No functional change.

llvm-svn: 37037
2007-05-14 17:21:17 +00:00
Anton Korobeynikov
ad0dd14386 Emit function debug frames in one atom. This will prevent us from generating incorrect assembler in case of both
debug information & exception information presented.

llvm-svn: 37019
2007-05-13 17:30:11 +00:00
Anton Korobeynikov
100919126f Emit multiple common EH frames for multiple (including blank) personality
functions. This partly fixes PR1414: now we're restricted only to one
personality function per eh frame, not per module. Further work on
"multiple personalities" topic needs representative example.

llvm-svn: 37018
2007-05-13 15:42:26 +00:00
Anton Korobeynikov
7daaf71b29 More DWARF-related things cleanup:
1. Fix PR1380
2. Apply Duncan's patch from PR1410
3. Insert workaround for "one personality function per module" as noted in PR1414
4. Emit correct debug frames for x86/linux. This partly fixes DebugInfo/2006-11-06-StackTrace.cpp: stack trace is
shown correctly, but arguments for function on top of stack are displayed incorrectly.

llvm-svn: 37015
2007-05-12 22:36:25 +00:00
Reid Spencer
e7a70b7212 Get the size of auto arrays right, regardless of its changing size.
llvm-svn: 37006
2007-05-12 11:07:40 +00:00
Devang Patel
c611adb5b7 Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049516.html
llvm-svn: 36998
2007-05-11 23:14:43 +00:00
Anton Korobeynikov
5754e67b1a Perform correct actions numbers/sizes computation
llvm-svn: 36988
2007-05-11 08:47:35 +00:00
Anton Korobeynikov
2d2a44b71f Fix action No calculation in multiple-invoke-one-LP mode
llvm-svn: 36987
2007-05-11 08:23:57 +00:00
Dale Johannesen
2f28ffc5fd Do not generate branches to entry block. This fixes several test suite
failures on PPC (can happen only when prologue code is null)

llvm-svn: 36979
2007-05-10 23:59:23 +00:00
Anton Korobeynikov
5ba99a95e8 Ooops. Some debugging stuff :)
llvm-svn: 36978
2007-05-10 22:38:46 +00:00
Anton Korobeynikov
0a29b65e0c Allow multiple invokes per landing pad. This (probably) fixes PR1410.
llvm-svn: 36977
2007-05-10 22:34:59 +00:00
Duncan Sands
828ef09f10 Later computations assume we are aligned at this point.
llvm-svn: 36975
2007-05-10 18:40:24 +00:00
Anton Korobeynikov
a25bb3a0ff TypeIds are indexed by j, not i
llvm-svn: 36974
2007-05-10 15:10:34 +00:00
Dale Johannesen
4f9661688c Make tail merging handle many more cases (all it can, I think).
llvm-svn: 36966
2007-05-10 01:01:49 +00:00
Evan Cheng
649f25dad1 Can't fold the bit_convert is the store is a truncating store.
llvm-svn: 36962
2007-05-09 21:49:47 +00:00
Anton Korobeynikov
4423f1a3fd Do not assert, when case range split metric is zero and JTs are not allowed: just emit binary tree in this case. This
fixes PR1403.

llvm-svn: 36959
2007-05-09 20:07:08 +00:00
Bill Wendling
a5f8cb0805 Change names from RA to something unique to get rid of naming conflicts with
certain linkers...

llvm-svn: 36944
2007-05-08 19:02:46 +00:00
Evan Cheng
855b26b72e Eliminate MarkVirtRegAliveInBlock recursion.
llvm-svn: 36943
2007-05-08 19:00:00 +00:00
Evan Cheng
e18b87868d Forgot a check.
llvm-svn: 36910
2007-05-07 21:36:06 +00:00
Evan Cheng
18d994d6d6 Enable a couple of xforms:
- (store (bitconvert v)) -> (store v) if resultant store does not require
higher alignment
- (bitconvert (load v)) -> (load (bitconvert*)v) if resultant load does not
require higher alignment

llvm-svn: 36908
2007-05-07 21:27:48 +00:00
Dale Johannesen
c884abe112 Handle some non-exit blocks in tail merging.
llvm-svn: 36907
2007-05-07 20:57:21 +00:00
Duncan Sands
20a9ed0e20 Parameter attributes on invoke calls were being lost due to the wrong
attribute index being used.  Fix proposed by Anton Korobeynikov, who
asked me to implement and commit it for him.  This is PR1398.

llvm-svn: 36906
2007-05-07 20:49:28 +00:00
Anton Korobeynikov
3765489a61 Detabify
llvm-svn: 36891
2007-05-06 20:14:21 +00:00
Nick Lewycky
c2306ff5b4 Fix typo in comment.
llvm-svn: 36873
2007-05-06 13:37:16 +00:00
Duncan Sands
4459cd664c Use the personality function that was registered with MMI rather than
hardwiring in the C++ one.

llvm-svn: 36789
2007-05-05 20:27:00 +00:00
Chris Lattner
d1534330ee Propagate alignment/volatility in two places.
Implement support for expanding a bitcast from an illegal vector type to
a legal one (e.g. 4xi32 -> 4xf32 in SSE1).  This fixes PR1371 and
CodeGen/X86/2007-05-05-VecCastExpand.ll

llvm-svn: 36787
2007-05-05 19:39:05 +00:00
Duncan Sands
be371cc319 Spelling fix.
llvm-svn: 36781
2007-05-05 16:32:57 +00:00
Anton Korobeynikov
ce48606d7a Emit sections/directives in the proper order. This fixes PR1376. Also,
some small cleanup was made.

llvm-svn: 36780
2007-05-05 09:04:50 +00:00
Duncan Sands
f2323ca89c A bitcast of a global variable may have been constant folded to a GEP -
handle this case too.

llvm-svn: 36745
2007-05-04 17:12:26 +00:00
Evan Cheng
8c8b6ce116 Don't create indexed load / store with zero offset!
llvm-svn: 36716
2007-05-03 23:52:19 +00:00
Chris Lattner
e95894e9f9 Allow i/s to match (gv+c). This fixes CodeGen/PowerPC/2007-05-03-InlineAsm-S-Constraint.ll
and PR1382

llvm-svn: 36672
2007-05-03 16:54:34 +00:00
Devang Patel
cd45427a87 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Anton Korobeynikov
ca71b83e50 Properly set arguments bitwidth of EHSELECT node
llvm-svn: 36654
2007-05-02 22:15:48 +00:00
Devang Patel
8ee9065162 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Lauro Ramos Venancio
57d03e112b Fix build error.
llvm-svn: 36648
2007-05-02 20:37:47 +00:00
Anton Korobeynikov
6e6bfcaf4d Fix couple of bugs connected with eh info:
1. Correct output offsets on Linux
2. Fix "style" of personality function. It shouldn't be indirect.

llvm-svn: 36633
2007-05-01 22:23:12 +00:00
Devang Patel
38a66bc82e Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Evan Cheng
17f967eb52 If call frame is not part of stack frame and no dynamic alloc, eliminateFrameIndex() must adjust SP offset with size of call frames.
llvm-svn: 36625
2007-05-01 09:01:42 +00:00
Evan Cheng
6dc02c2b07 Forgot about chain result; also UNDEF cannot have multiple values.
llvm-svn: 36622
2007-05-01 08:53:39 +00:00
Nate Begeman
767ee95d29 llvm bug #1350, parts 1, 2, and 3.
llvm-svn: 36618
2007-05-01 05:57:02 +00:00
Evan Cheng
248de25fb5 Under normal circumstances, when a frame pointer is not required, we reserve
argument space for call sites in the function immediately on entry to the
current function. This eliminates the need for add/sub sp brackets around call
sites. However, this is not always a good idea. If the "call frame" is large and
the target load / store instructions have small immediate field to encode sp
offset, this can cause poor codegen. In the worst case, this can make it
impossible to scavenge a register if the reserved spill slot is pushed too far
apart from sp / fp.

llvm-svn: 36607
2007-05-01 00:52:08 +00:00
Evan Cheng
fe933cd6ca * Only turn a load to UNDEF if all of its outputs have no uses (indexed loads
produce two results.)
* Do not touch volatile loads.

llvm-svn: 36604
2007-05-01 00:38:21 +00:00
Chris Lattner
8da69f853c Fix PR1228 and CodeGen/Generic/2007-04-30-LandingPadBranchFolding.ll
llvm-svn: 36602
2007-04-30 23:35:00 +00:00
Chris Lattner
c7f45f4572 print isLandingPad() for MBBs
llvm-svn: 36600
2007-04-30 23:12:53 +00:00
Chris Lattner
3b2c717e6a Continue refactoring inline asm code. If there is an earlyclobber output
register, preallocate all input registers and the early clobbered output.

This fixes PR1357 and CodeGen/PowerPC/2007-04-30-InlineAsmEarlyClobber.ll

llvm-svn: 36599
2007-04-30 21:11:17 +00:00
Evan Cheng
5039cf6382 Updates.
llvm-svn: 36594
2007-04-30 18:42:09 +00:00
Chris Lattner
4ac6ba02d1 refactor GetRegistersForValue to take OpInfo as an argument instead of various
pieces of it.  No functionality change.

llvm-svn: 36592
2007-04-30 17:29:31 +00:00
Chris Lattner
e3f7f2afcb refactor some code, no functionality change
llvm-svn: 36590
2007-04-30 17:16:27 +00:00
Chris Lattner
9f10fc6b4c Clean up multi-line asam string printing. Instead of printing:
# InlineAsm Start
        subfc r3,r5,r4
                subfze r4,r3
        # InlineAsm End

print:

        # InlineAsm Start
        subfc r3,r5,r4
        subfze r4,r3
        # InlineAsm End

llvm-svn: 36589
2007-04-30 17:00:18 +00:00
Chris Lattner
087a1aaaab generalize aggregate handling
llvm-svn: 36568
2007-04-29 18:58:03 +00:00
Anton Korobeynikov
cb2004f82c Implement review feedback
llvm-svn: 36564
2007-04-29 18:02:48 +00:00