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

4550 Commits

Author SHA1 Message Date
Jim Grosbach
0ff473d68a hook ISD::STACKADDR to an intrinsic
llvm-svn: 104869
2010-05-27 18:52:11 +00:00
Bill Wendling
a874b6d45a Add FIXME comment to remove this.
llvm-svn: 104749
2010-05-26 21:53:50 +00:00
Bill Wendling
49b19ff2c3 Add "setjmp_syscall", "savectx", "qsetjmp", "vfork", "getcontext" to the list of
usual suspects that could "return twice".

llvm-svn: 104737
2010-05-26 20:39:00 +00:00
Jim Grosbach
bb4860d2a2 Adjust eh.sjlj.setjmp to properly have a chain and to have an opcode entry in
ISD::. No functional change.

llvm-svn: 104734
2010-05-26 20:22:18 +00:00
Devang Patel
2ea3f77515 Update debug info when live-in reg is copied into a vreg.
llvm-svn: 104732
2010-05-26 20:18:50 +00:00
Bill Wendling
fbe85886bb Move the check for "calls setjmp" to SelectionDAGISel so that it can be used by
more than just the stack slot coloring algorithm.

llvm-svn: 104722
2010-05-26 19:46:12 +00:00
Dan Gohman
616845c384 Eliminate the use of PriorityQueue and just use a std::vector,
implementing pop with a linear search for a "best" element. The priority
queue was a neat idea, but in practice the comparison functions depend
on dynamic information.

llvm-svn: 104718
2010-05-26 18:52:00 +00:00
Dan Gohman
a4a49b2108 Delete an unused function.
llvm-svn: 104716
2010-05-26 18:34:12 +00:00
Eric Christopher
13ac28ede3 Temporarily revert r104655 as it's breaking the bots.
llvm-svn: 104664
2010-05-26 01:59:55 +00:00
Dan Gohman
59cddd1327 Change push_all to a non-virtual function and implement it in the
base class, since all the implementations are the same.

llvm-svn: 104659
2010-05-26 01:10:55 +00:00
Dan Gohman
ff4bf1aacf Trim #include.
llvm-svn: 104657
2010-05-26 00:55:59 +00:00
Bill Wendling
04fbdac5ac Dale and Evan suggested putting the "check for setjmp" much earlier in the
machine code generation. That's a good idea, so I made it so.

llvm-svn: 104655
2010-05-26 00:32:40 +00:00
Dan Gohman
803cd02b11 Do one map lookup instead of two.
llvm-svn: 104645
2010-05-25 21:59:42 +00:00
Dale Johannesen
8fd73c1910 Fix another variant of PR 7191. Also add a testcase
Mon Ping provided; unfortunately bugpoint failed to
reduce it, but I think it's important to have a test for
this in the suite.  8023512.

llvm-svn: 104624
2010-05-25 18:47:23 +00:00
Dale Johannesen
42c91e9024 Fix PR 7191. I have been unable to create a .ll file that fails, sorry.
(oye, a word which should be better known to people writing tree
traversals, means grandchild.)

llvm-svn: 104619
2010-05-25 17:50:03 +00:00
Jim Grosbach
b6cc69c655 Implement eh.sjlj.longjmp for ARM. Clean up the intrinsic a bit.
Followups: docs patch for the builtin and eh.sjlj.setjmp cleanup to match
longjmp.

llvm-svn: 104419
2010-05-22 01:06:18 +00:00
Bob Wilson
3994f42952 Clean up extra whitespace.
llvm-svn: 104410
2010-05-21 23:53:55 +00:00
Bob Wilson
586811b244 Change CodeGen/ARM/2009-11-02-NegativeLane.ll to use 16-bit vector elements
so that it will continue to test what it was meant to test when I commit a
separate change for better support of BUILD_VECTOR and VECTOR_SHUFFLE for Neon.
Fix a DAG combiner crash exposed by this test change.

llvm-svn: 104380
2010-05-21 21:05:32 +00:00
Evan Cheng
1faccbd51a Rename -pre-RA-sched=hybrid to -pre-RA-sched=list-hybrid.
llvm-svn: 104306
2010-05-21 00:42:32 +00:00
Evan Cheng
b5de7de4ce Allow targets more controls on what nodes are scheduled by reg pressure, what for latency in hybrid mode.
llvm-svn: 104293
2010-05-20 23:26:43 +00:00
Evan Cheng
0d88ad2de1 Add a hybrid bottom up scheduler that reduce register usage while avoiding
pipeline stall. It's useful for targets like ARM cortex-a8. NEON has a lot
of long latency instructions so a strict register pressure reduction
scheduler does not work well.
Early experiments show this speeds up some NEON loops by over 30%.

llvm-svn: 104216
2010-05-20 06:13:19 +00:00
Bob Wilson
2dbe0d9886 Optimize away insertelement of an undef value. This shows up in
test/Codegen/ARM/reg_sequence.ll but it doesn't affect the generated code
because the coalescer cleans it up.  Radar 7998853.

llvm-svn: 104185
2010-05-19 23:42:58 +00:00
Evan Cheng
9fe8c861bf Code clean up.
llvm-svn: 104173
2010-05-19 22:42:23 +00:00
Evan Cheng
46e08acfa5 Code refactoring: pull SchedPreference enum from TargetLowering.h to TargetMachine.h and put it in its own namespace.
llvm-svn: 104147
2010-05-19 20:19:50 +00:00
Bob Wilson
ae9655920b When expanding a vector_shuffle, the element type may not be legal and may
need to be promoted.  The BUILD_VECTOR and EXTRACT_VECTOR_ELT nodes generated
here already allow the promoted type to be used without further changes, so
just do the promotion.  This fixes part of pr7167.

llvm-svn: 104141
2010-05-19 18:48:32 +00:00
Evan Cheng
632cb17357 Intrinsics which do a vector compare (results are all zero or all ones) are modeled as icmp / fcmp + sext. This is turned into a vsetcc by dag combine (yes, not a good long term solution). The targets can then isel the vsetcc to the appropriate instruction.
The trouble arises when the result of a vector cmp + sext is then and'ed with all ones. Instcombine will turn it into a vector cmp + zext, dag combiner will miss turning it into a vsetcc and hell breaks loose after that.

Teach dag combine to turn a vector cpm + zest into a vsetcc + and 1. This fixes rdar://7923010.

llvm-svn: 104094
2010-05-19 01:08:17 +00:00
Evan Cheng
e2980af336 Sink dag combine's post index load / store code that swap base ptr and index into the target hook. Only the target knows whether the swap is safe. In Thumb2 mode, the offset must be an immediate. rdar://7998649
llvm-svn: 104060
2010-05-18 21:31:17 +00:00
Evan Cheng
dae4e9e4bc Continuously refine the register class of REG_SEQUENCE def with all the source registers and sub-register indices.
llvm-svn: 104051
2010-05-18 20:07:47 +00:00
Evan Cheng
9fc34e676d Fix PR7162: Use source register classes and sub-indices to determine the correct register class of the definitions of REG_SEQUENCE.
llvm-svn: 104050
2010-05-18 20:03:28 +00:00
Evan Cheng
39b5115e93 FIX PR7158. SimplifyVBinOp was asserting when it fails to constant fold (op (build_vector), (build_vector)).
llvm-svn: 104004
2010-05-18 00:03:40 +00:00
Bill Wendling
5a1c9f8d06 - Set the "HasCalls" flag after instruction selection is finished.
- Change the logic DisableFramePointerElim() to check for the
  -disable-non-leaf-fp-elim before -disable-fp-elim.

llvm-svn: 103990
2010-05-17 23:09:50 +00:00
Dale Johannesen
82dfdcdde7 Fix uint64->{float, double} conversion to do rounding correctly in 32-bit.
The implementation in LegalizeIntegerTypes to handle this as 
sint64->float + appropriate power of 2 is subject to double rounding,
considered incorrect by numerics people.  Use this implementation only
when it is safe.  This leads to using library calls in some cases
that produced inline code before, but it's correct now.
(EVTToAPFloatSemantics belongs somewhere else, any suggestions?)

Add a correctly rounding (though not particularly fast) conversion
that uses X87 80-bit computations for x86-32.

7885399, 5901940.  This shows up in gcc.c-torture/execute/ieee/rbug.c
in the gcc testsuite on some platforms.

llvm-svn: 103883
2010-05-15 18:51:12 +00:00
Dale Johannesen
d093363ea5 Improve assertion messages.
llvm-svn: 103882
2010-05-15 18:38:02 +00:00
Dan Gohman
4049434a04 Fast ISel trivially coalesces away no-op casts, so check for this when
setting kill flags.

llvm-svn: 103832
2010-05-14 22:53:18 +00:00
Dan Gohman
97d22ade75 Don't set kill flags for instructions which the scheduler has cloned.
llvm-svn: 103827
2010-05-14 22:01:14 +00:00
Bill Wendling
e346a38ed4 Rename "HasCalls" in MachineFrameInfo to "AdjustsStack" to better describe what
the variable actually tracks.

N.B., several back-ends are using "HasCalls" as being synonymous for something
that adjusts the stack. This isn't 100% correct and should be looked into.

llvm-svn: 103802
2010-05-14 21:14:32 +00:00
Dale Johannesen
9f19b6a761 Implement a correct ui64->f32 conversion. The old
one was subject to double rounding in extreme cases.

llvm-svn: 103744
2010-05-13 23:50:42 +00:00
Dan Gohman
d7b4c5b82e An Instruction has a trivial kill only if its use is in the same
basic block.

llvm-svn: 103725
2010-05-13 19:19:32 +00:00
Dan Gohman
03e407ed83 Add initial kill flag support to FastISel.
llvm-svn: 103529
2010-05-11 23:54:07 +00:00
Dan Gohman
2ace137eb9 Don't set kill flags on uses of CopyFromReg nodes. InstrEmitter doesn't
create separate virtual registers for CopyFromReg values, so uses of
them don't necessarily kill the value.

llvm-svn: 103519
2010-05-11 21:59:14 +00:00
Duncan Sands
7d5e4152c3 I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename it
to LLVM_LIBRARY_VISIBILITY and introduce LLVM_GLOBAL_VISIBILITY, which is
the opposite, for future use by dragonegg.

llvm-svn: 103495
2010-05-11 20:16:09 +00:00
Dan Gohman
ca2df906ae Trim #includes and forward declarations.
llvm-svn: 103489
2010-05-11 19:11:43 +00:00
Dan Gohman
fb6f4da0e0 Implement a bunch more TargetSelectionDAGInfo infrastructure.
Move EmitTargetCodeForMemcpy, EmitTargetCodeForMemset, and
EmitTargetCodeForMemmove out of TargetLowering and into
SelectionDAGInfo to exercise this.

llvm-svn: 103481
2010-05-11 17:31:57 +00:00
Douglas Gregor
2f2491405a Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!
llvm-svn: 103457
2010-05-11 06:17:44 +00:00
Evan Cheng
de3482f4af Indentation.
llvm-svn: 103441
2010-05-10 23:08:19 +00:00
Evan Cheng
df350445c6 Be careful with operand promotion. For a binary operation, the source operands may be the same. PR7018. rdar://7939869.
llvm-svn: 103419
2010-05-10 19:03:57 +00:00
Duncan Sands
83c7bda62e Add an assertion to catch attempts to access off the end of the array.
Based on a patch by Javier Martinez.

llvm-svn: 103391
2010-05-10 04:54:28 +00:00
Dan Gohman
95040c18f4 SDDbgValues are apparently not being legalized. Fix a symptom of the problem,
and not the real problem itself, by dropping debug info for i128 values.
rdar://7958162.

llvm-svn: 103310
2010-05-07 22:19:08 +00:00
Devang Patel
3c2f4664fc Verify variable directly.
llvm-svn: 103305
2010-05-07 22:04:20 +00:00
Dale Johannesen
1ee37ac5d4 Fix PR 7087, and probably other things, by extending
getConstantFP to accept the two supported long double
target types.  This was not the original intent, but
there are other places that assume this works and it's
easy enough to do.

llvm-svn: 103299
2010-05-07 21:35:53 +00:00
Dan Gohman
4d75cfcc09 Transfer debug location information from PHI nodes to resulting
lowered copies.

llvm-svn: 103228
2010-05-07 01:10:20 +00:00
Dan Gohman
6650aa28f1 Print debug information for SDNodes.
llvm-svn: 103227
2010-05-07 01:09:21 +00:00
Dan Gohman
497e752655 Add a DebugLoc argument to TargetInstrInfo::copyRegToReg, so that it
doesn't have to guess.

llvm-svn: 103194
2010-05-06 20:33:48 +00:00
Dan Gohman
f7bc83b2ed In bottom-up mode, defer the materialization of local constant values.
llvm-svn: 103139
2010-05-06 00:02:14 +00:00
Dan Gohman
180422793f Add an "IsBottomUp" member function to FastISel, which will be used to
support a new bottom-up mode.

llvm-svn: 103138
2010-05-05 23:58:35 +00:00
Devang Patel
041a8fa086 Use getValue() for PHINodes when direct NodeMap access does not work.
llvm-svn: 103126
2010-05-05 22:29:00 +00:00
Evan Cheng
66ef3ff9c7 Instruction selection optimizations may have moved the def of a function argument out of the entry block. rdar://7937489
llvm-svn: 102993
2010-05-04 00:58:39 +00:00
Evan Cheng
f7b5c86a0b Teach scheduler about REG_SEQUENCE.
llvm-svn: 102984
2010-05-04 00:22:40 +00:00
Dan Gohman
50b08bfbc8 Re-enable isel kill flags, now that the local allocator is ignoring them.
llvm-svn: 102981
2010-05-04 00:12:15 +00:00
Dan Gohman
8bfd5f99b5 Factor out FastISel's code for materializing constants and other values
in registers into a separate function to de-couple it from the
top-down-specific logic in getRegForValue.

llvm-svn: 102975
2010-05-03 23:36:34 +00:00
Anton Korobeynikov
a3726088fa Insert ANY_EXTEND node instead of invalid truncate during DAG Combining (X & 1),
when needed. This fixes PR7001

llvm-svn: 102838
2010-05-01 12:52:34 +00:00
Dan Gohman
ada97c52fe Remove the code for special-casing byval for fast-isel. SelectionDAG
handles argument lowering anyway, so there's no need for special
casing here.

llvm-svn: 102828
2010-05-01 02:44:23 +00:00
Dan Gohman
fb5d6a5d70 Re-disable kill flags, as there is more trouble.
llvm-svn: 102826
2010-05-01 01:57:56 +00:00
Dan Gohman
5fc96b81ec Re-enable kill flags from SelectionDAGISel, with a fix: don't
try to put a kill flag on a DBG_INFO instruction.

llvm-svn: 102820
2010-05-01 00:50:53 +00:00
Dan Gohman
1a6c7dfb3e Fix whitespace.
llvm-svn: 102817
2010-05-01 00:33:28 +00:00
Dan Gohman
37fe41a8c0 Don't pass SDValues by non-const reference unless they may be
modified.

llvm-svn: 102816
2010-05-01 00:33:16 +00:00
Dan Gohman
0561bd78d0 Reorgnaize more switch code lowering to clean up some tricky
code, and to eliminate the need for the SelectionDAGBuilder
state to be live during CodeGenAndEmitDAG calls.

Call SDB->clear() before CodeGenAndEmitDAG calls instead of
before it, and move the CurDAG->clear() out of SelectionDAGBuilder,
which doesn't own the DAG, and into CodeGenAndEmitDAG.

llvm-svn: 102814
2010-05-01 00:25:44 +00:00
Dan Gohman
d59de31ce2 Delete the EdgeMapping variable itself.
llvm-svn: 102810
2010-05-01 00:02:20 +00:00
Dan Gohman
68f04d06c8 Get rid of the EdgeMapping map. Instead, just check for BasicBlock
changes before doing phi lowering for switches.

llvm-svn: 102809
2010-05-01 00:01:06 +00:00
Bill Wendling
95a4929ac7 EXTRACT_VECTOR_ELT of an INSERT_VECTOR_ELT may have the same index, but the
indexes could be of a different value type. Or not even using the same SDNode
for the constant (weird, I know). Compare the actual values instead of the
pointers.

llvm-svn: 102791
2010-04-30 22:19:17 +00:00
Dan Gohman
e980525516 Remove this debug output. The MachineFunction will be printed once all of
instruction selection is done; it's confusing to see parts of it printed,
while other parts are omitted, along the way.

llvm-svn: 102771
2010-04-30 21:21:21 +00:00
Dan Gohman
066b8d3640 EmitDbgValue doesn't need its EdgeMapping argument.
llvm-svn: 102742
2010-04-30 19:35:33 +00:00
Dan Gohman
e9ff394082 Apply a patch from Jan Sjodin to fix a compiler abort on vector
comparisons sign-extended to a different bitwidth than the
comparison operands.

llvm-svn: 102721
2010-04-30 17:19:19 +00:00
Dan Gohman
140e0899ad Temporarily disable SelectionDAG kill flags, which are causing trouble.
llvm-svn: 102680
2010-04-30 00:32:51 +00:00
Dan Gohman
1534ad2d28 Set register kill flags on the SelectionDAG path, at least in the
easy cases.

llvm-svn: 102678
2010-04-30 00:08:21 +00:00
Devang Patel
bdfc01f418 Refactor.
llvm-svn: 102661
2010-04-29 20:40:36 +00:00
Devang Patel
1e28f36308 DO not push DBG_VALUE machine instructions for inlined fuction arguments in entry block.
llvm-svn: 102653
2010-04-29 18:50:36 +00:00
Evan Cheng
b9fe4fd40c Add comment.
llvm-svn: 102606
2010-04-29 06:58:53 +00:00
Evan Cheng
ba7dcad569 Re-enable 102565 with fixes.
llvm-svn: 102602
2010-04-29 06:33:38 +00:00
Evan Cheng
3e9545cfb4 Temporarily disable my changes to unbreak the build.
llvm-svn: 102590
2010-04-29 03:34:19 +00:00
Evan Cheng
053000f3f5 Do not generate duplicate dbg_value instructions for function arguments.
llvm-svn: 102585
2010-04-29 01:40:30 +00:00
Dan Gohman
ec9e1d8a88 Fix missing #include.
llvm-svn: 102584
2010-04-29 01:39:13 +00:00
Evan Cheng
801b8e5530 Avoid emitting a dbg_value machineinstr that's not going to be inserted into entry block.
llvm-svn: 102581
2010-04-29 01:23:55 +00:00
Evan Cheng
d08e8f2b24 Check Reg against zero.
llvm-svn: 102573
2010-04-29 00:59:34 +00:00
Devang Patel
84e3ddd87c tidy up.
llvm-svn: 102558
2010-04-28 23:24:13 +00:00
Evan Cheng
a02c9072fc Replace r102368 with code that's less fragile. This creates DBG_VALUE instructions for function arguments early and insert them after instruction selection is done.
llvm-svn: 102554
2010-04-28 23:08:54 +00:00
Devang Patel
181c86e4e7 While lowering dbg_declare, emit DBG_VALUE machine instruction if alloca matching llvm.dbg.declare intrinsic is missing.
llvm-svn: 102513
2010-04-28 19:27:33 +00:00
Evan Cheng
4561d60a2b Try operation promotion only if regular dag combine and target-specific ones failed to do anything.
llvm-svn: 102492
2010-04-28 07:10:39 +00:00
Devang Patel
8b3c1ffb8b Ignore DBG_VALUE instructions that points to undef values.
llvm-svn: 102463
2010-04-27 20:54:45 +00:00
Evan Cheng
94bcca7004 - When legal, promote a load to zextload rather than ext load.
- Catch more further dag combine opportunities as result of operand promotion, e.g. (i32 anyext (i16 trunc (i32 x))) -> (i32 x)

llvm-svn: 102455
2010-04-27 19:48:13 +00:00
Dale Johannesen
244d2bdb24 Revert a small part of 102372; this fixes at least one
of the dbg testsuite regressions.  I don't think this is
really the right fix; this change exposed an existing problem
upstream somewhere.

llvm-svn: 102410
2010-04-27 02:10:05 +00:00
Bob Wilson
6547515094 Avoid adding a null MD node operand, which crashes with "-debug" when trying
to print the operand.

llvm-svn: 102395
2010-04-26 22:56:56 +00:00
Dale Johannesen
2f1de9e0c1 Remove crufty comments.
llvm-svn: 102380
2010-04-26 20:48:54 +00:00
Dale Johannesen
4327f03110 Add DBG_VALUE handling for byval parameters; this
produces a comment on targets that support it, but
the Dwarf writer is not hooked up yet.

llvm-svn: 102372
2010-04-26 20:06:49 +00:00
Evan Cheng
dc0ce1eae8 - Move TargetLowering::EmitTargetCodeForFrameDebugValue to TargetInstrInfo and rename it to emitFrameIndexDebugValue.
- Teach spiller to modify DBG_VALUE instructions to reference spill slots.

llvm-svn: 102323
2010-04-26 07:38:55 +00:00
Dale Johannesen
d27eedab6d Stop abusing EmitInstrWithCustomInserter for target-dependent
form of DEBUG_VALUE, as it doesn't have reasonable default
behavior for unsupported targets.  Add a new hook instead.
No functional change.

llvm-svn: 102320
2010-04-25 21:33:54 +00:00
Dale Johannesen
d33a5ec459 Add comment re byval args. Doesn't actually work this way yet.
xs

llvm-svn: 102316
2010-04-25 21:03:54 +00:00
Evan Cheng
3eedf18f4c When a load operand is promoted to an extload, replace other uses with uses of extload result truncated.
llvm-svn: 102236
2010-04-24 04:43:44 +00:00
Dan Gohman
42c3d3fe44 Apply a fix for a vector setcc dagcombine from Jan Sjodin. No
testcase yet, as the testcase now fails downstream.

llvm-svn: 102228
2010-04-24 01:17:30 +00:00
Evan Cheng
34f01afb97 Code refactoring.
llvm-svn: 102202
2010-04-23 19:10:30 +00:00
Dan Gohman
6680b97d89 Move FastISel's HandlePHINodesInSuccessorBlocks call down into FastISel
itself too.

llvm-svn: 102176
2010-04-23 15:29:50 +00:00
Dan Gohman
391423b743 Sink SelectionDAGBuilder's HandlePHINodesInSuccessorBlocks down
into SelectionDAGBuilder itself.

llvm-svn: 102128
2010-04-22 20:55:53 +00:00
Dan Gohman
d819e7fc95 Move HandlePHINodesInSuccessorBlocks functions out of SelectionDAGISel
and into SelectionDAGBuilder and FastISel.

llvm-svn: 102123
2010-04-22 20:46:50 +00:00
Evan Cheng
da832d5c85 - It's not safe to promote rotates (at least not trivially).
- Some code refactoring.

llvm-svn: 102111
2010-04-22 20:19:46 +00:00
Dan Gohman
56b517480e Fix a comment.
llvm-svn: 102110
2010-04-22 20:06:42 +00:00
Dan Gohman
a177e59e3e Move PHINodesToUpdate out of SelectionDAGBuilder and into
FunctionLoweringInfo, as it isn't SelectionDAG-specific. This isn't
completely natural, as PHI node state is not per-function but rather
per-basic-block, however there's currently no other convenient
per-basic-block state to group it with.

llvm-svn: 102109
2010-04-22 19:55:20 +00:00
Dan Gohman
4ff2d817a3 Add more const qualifiers on TargetMachine and friends.
llvm-svn: 101977
2010-04-21 01:34:56 +00:00
Dan Gohman
1d3532d925 Move several SelectionDAG-independent utility functions out of the
SelectionDAG directory and into a new Analysis.cpp file.

llvm-svn: 101975
2010-04-21 01:22:34 +00:00
Dan Gohman
570b621976 Add another variant of this test which found a place where
CodeGen's ComputeMaskedBits was being over-conservative when computing
bits for an ADD.

llvm-svn: 101963
2010-04-21 00:19:28 +00:00
Dale Johannesen
510282d54b Because of the EMMS problem, right now we have to support
user-defined operations that use MMX register types, but
the compiler shouldn't generate them on its own.  This adds
a Synthesizable abstraction to represent this, and changes
the vector widening computation so it won't produce MMX types.
(The motivation is to remove noise from the ABI compatibility
part of the gcc test suite, which has some breakage right now.)

llvm-svn: 101951
2010-04-20 22:34:09 +00:00
Dan Gohman
44ab9ed9b8 Sink the CopyToExportRegsIfNeeded calls out of SelectionDAGISel
into SelectionDAGBuilder. This avoids a separate pass over the
instructions, and has the side effect of providing debug location
information to the copy.

llvm-svn: 101906
2010-04-20 15:03:56 +00:00
Dan Gohman
3915c2cc7c Don't send PHI nodes down to SelectionDAGBuilder of FastISel, since
they end up doing nothing.

llvm-svn: 101904
2010-04-20 15:00:41 +00:00
Dan Gohman
0c1f92afe1 Sink this use_empty() check into isUsedOutsideOfDefiningBlock.
llvm-svn: 101902
2010-04-20 14:50:13 +00:00
Dan Gohman
c276def9e9 If a PHI node somehow has debug info, propogate it to the MachineInstr PHI.
llvm-svn: 101901
2010-04-20 14:48:02 +00:00
Dan Gohman
47859e6848 Don't iterate through the whole block just to find the PHI nodes.
llvm-svn: 101900
2010-04-20 14:46:25 +00:00
Dan Gohman
5f8489396e Delete a redundant return statement.
llvm-svn: 101860
2010-04-20 01:58:20 +00:00
Bill Wendling
887dac2aa6 The visitXOR method can return the same SDNode. If so, we don't want to delete
it as it's not dead.

llvm-svn: 101855
2010-04-20 01:25:01 +00:00
Dan Gohman
5d47f180a2 Remove this debug output; it isn't that useful, and it's incomplete
in the case where a basic block is split.

llvm-svn: 101850
2010-04-20 00:56:44 +00:00
Dan Gohman
e8387b1250 Sink DebugLoc handling out of SelectionDAGISel into FastISel and
SelectionDAGBuilder, where it doesn't have to be as complicated.

llvm-svn: 101848
2010-04-20 00:48:35 +00:00
Dan Gohman
c64745ba43 Remove MachineFunction's DefaultDebugLoc member, and make DwarfDebug.cpp
responsible for figuring out what that's supposed to be on its own.

llvm-svn: 101844
2010-04-20 00:37:27 +00:00
Dan Gohman
1d05054dc1 Reapply the removal of SelectionDAGISel's BB, with a fix for the case
where multiple blocks are emitted; functions which do this need to return
the new BB so that their callers can stay current.

llvm-svn: 101843
2010-04-20 00:29:35 +00:00
Dan Gohman
744e2b34b0 Revert 101825, which is causing trouble.
llvm-svn: 101832
2010-04-19 23:34:15 +00:00
Dan Gohman
94383f9d34 Eliminate SelectionDAGISel's "current block" member. Just pass it as
an argument to things that need it.

llvm-svn: 101825
2010-04-19 22:51:14 +00:00
Dan Gohman
b02e2f6c92 Eliminate the CurMBB member from SelectionDAGBuilder. For places that
need it, just pass around the parent block of the current instruction
explicitly.

llvm-svn: 101822
2010-04-19 22:41:47 +00:00
Evan Cheng
8efe9e0351 More progress on promoting i16 operations to i32 for x86. Work in progress.
llvm-svn: 101808
2010-04-19 19:29:22 +00:00
Dan Gohman
6bcd9dabb7 Give SelectionDAG a TargetMachine too, rather than having it
fetch one from the MachineFunction.

llvm-svn: 101807
2010-04-19 19:22:07 +00:00
Evan Cheng
d65a23c1e6 More 80 col violation.
llvm-svn: 101806
2010-04-19 19:17:44 +00:00
Dan Gohman
f1f21fb3c6 Code that needs a TargetMachine should have access to one directly, rather
than just getting one through a TargetLowering.

llvm-svn: 101802
2010-04-19 19:05:59 +00:00
Dan Gohman
3c58144bfd Move isInTailCallPosition out of SelectionDAGBuilder, as it isn't
SelectionDAG-specific.

llvm-svn: 101801
2010-04-19 18:41:46 +00:00
Dan Gohman
fba34ef042 Fix -Wcast-qual warnings.
llvm-svn: 101655
2010-04-17 17:42:52 +00:00
Dan Gohman
6065ff317b Delete now-unnecessary const_casts.
llvm-svn: 101637
2010-04-17 15:32:28 +00:00
Dan Gohman
a0f855157e Use const qualifiers with TargetLowering. This eliminates several
const_casts, and it reinforces the design of the Target classes being
immutable.

SelectionDAGISel::IsLegalToFold is now a static member function, because
PIC16 uses it in an unconventional way. There is more room for API
cleanup here.

And PIC16's AsmPrinter no longer uses TargetLowering.

llvm-svn: 101635
2010-04-17 15:26:15 +00:00
Evan Cheng
6442d111dd More work to allow dag combiner to promote 16-bit ops to 32-bit.
llvm-svn: 101621
2010-04-17 06:13:15 +00:00
Evan Cheng
aa2f3449c4 Another 80 col violation.
llvm-svn: 101620
2010-04-17 06:12:32 +00:00
Eric Christopher
e78496e5f1 Revert 101465, it broke internal OpenGL testing.
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.

llvm-svn: 101579
2010-04-16 23:37:20 +00:00
Evan Cheng
b55929892f (i32 sext_in_reg (i32 aext (i16 x)), i16) -> (i32 sext x). No known test case until -promote-16bit is enabled.
llvm-svn: 101551
2010-04-16 22:26:19 +00:00
Dan Gohman
b3afc2a215 Create a new TargetSelectionDAGInfo class. This will eventually acquire
SelectionDAG-specific parts of TargetLowering.

llvm-svn: 101537
2010-04-16 21:12:11 +00:00
Dan Gohman
2912cb780f Commit this, which should have accompanied 101531.
llvm-svn: 101532
2010-04-16 20:22:43 +00:00
Evan Cheng
80afc6964c 80 col.
llvm-svn: 101501
2010-04-16 17:58:41 +00:00
Evan Cheng
e541446e11 80 col.
llvm-svn: 101500
2010-04-16 17:57:59 +00:00
Dan Gohman
e9683c52da Avoid creating virtual registers for unused values.
llvm-svn: 101480
2010-04-16 17:15:02 +00:00
Dan Gohman
30de6c2b1c Fix an assertion string.
llvm-svn: 101478
2010-04-16 16:55:18 +00:00
Dan Gohman
cb1d4ed9d0 Fix a comment.
llvm-svn: 101477
2010-04-16 16:52:37 +00:00
Gabor Greif
e7d6812008 reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101465
2010-04-16 15:33:14 +00:00
Evan Cheng
d143bfe0a4 Adding support for dag combiner to promote operations for profit. This requires target specific queries. For example, x86 should promote i16 to i32 when it does not impact load folding.
x86 support is off by default. It can be enabled with -promote-16bit.

Work in progress.

llvm-svn: 101448
2010-04-16 06:14:10 +00:00
Dan Gohman
01d4af69bf Refine further the scope where the global DebugLoc value is active.
llvm-svn: 101443
2010-04-16 05:06:56 +00:00
Gabor Greif
cd116e8c6a back out r101423 and r101397, they break llvm-gcc self-host on darwin10
llvm-svn: 101434
2010-04-16 01:16:20 +00:00
Gabor Greif
2e18d34d80 reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101397
2010-04-15 20:51:13 +00:00
Dan Gohman
d48633d340 Fix a bunch of namespace polution.
llvm-svn: 101376
2010-04-15 17:08:50 +00:00
Gabor Greif
6022150477 back out r101364, as it trips the linux nightlybot on some clang C++ tests
llvm-svn: 101368
2010-04-15 12:46:56 +00:00
Gabor Greif
428ca23bbd rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101364
2010-04-15 10:49:53 +00:00
Chris Lattner
1b7ecfdf60 enhance the load/store narrowing optimization to handle a
tokenfactor in between the load/store.  This allows us to 
optimize test7 into:

_test7:                                 ## @test7
## BB#0:                                ## %entry
	movl	(%rdx), %eax
                                        ## kill: SIL<def> ESI<kill>
	movb	%sil, 5(%rdi)
	ret

instead of:

_test7:                                 ## @test7
## BB#0:                                ## %entry
	movl	4(%esp), %ecx
	movl	$-65281, %eax           ## imm = 0xFFFFFFFFFFFF00FF
	andl	4(%ecx), %eax
	movzbl	8(%esp), %edx
	shll	$8, %edx
	addl	%eax, %edx
	movl	12(%esp), %eax
	movl	(%eax), %eax
	movl	%edx, 4(%ecx)
	ret

llvm-svn: 101355
2010-04-15 06:10:49 +00:00
Chris Lattner
8c5a5c9094 teach codegen to turn trunc(zextload) into load when possible.
This doesn't occur much at all, it only seems to formed in the case
when the trunc optimization kicks in due to phase ordering.  In that
case it is saves a few bytes on x86-32.

llvm-svn: 101350
2010-04-15 05:40:59 +00:00
Chris Lattner
510d19e597 add a simple dag combine to replace trivial shl+lshr with
and.  This happens with the store->load narrowing stuff.

llvm-svn: 101348
2010-04-15 05:28:43 +00:00
Chris Lattner
3282f3d34f Implement rdar://7860110 (also in target/readme.txt) narrowing
a load/or/and/store sequence into a narrower store when it is
safe.  Daniel tells me that clang will start producing this sort
of thing with bitfields, and this does  trigger a few dozen times
on 176.gcc produced by llvm-gcc even now.

This compiles code like CodeGen/X86/2009-05-28-DAGCombineCrash.ll 
into:

        movl    %eax, 36(%rdi)

instead of:

        movl    $4294967295, %eax       ## imm = 0xFFFFFFFF
        andq    32(%rdi), %rax
        shlq    $32, %rcx
        addq    %rax, %rcx
        movq    %rcx, 32(%rdi)

and each of the testcases into a single store.  Each of them used
to compile into craziness like this:

_test4:
	movl	$65535, %eax            ## imm = 0xFFFF
	andl	(%rdi), %eax
	shll	$16, %esi
	addl	%eax, %esi
	movl	%esi, (%rdi)
	ret

llvm-svn: 101343
2010-04-15 04:48:01 +00:00
Dan Gohman
64a84ceb3f Add more const qualifiers for LLVM IR pointers in CodeGen.
llvm-svn: 101342
2010-04-15 04:33:49 +00:00
Dan Gohman
0e0b8cf9fd Add const qualifiers to CodeGen's use of LLVM IR constructs.
llvm-svn: 101334
2010-04-15 01:51:59 +00:00
Evan Cheng
8249affa3b More 80 violations.
llvm-svn: 101330
2010-04-15 01:25:27 +00:00
Evan Cheng
263c547804 80 col violations.
llvm-svn: 101325
2010-04-15 01:01:55 +00:00
Dan Gohman
1b67547226 Delete unneeeded arguments.
llvm-svn: 101276
2010-04-14 20:17:22 +00:00
Dan Gohman
d5d199da5f Delete unused arguments.
llvm-svn: 101275
2010-04-14 20:05:00 +00:00
Dan Gohman
c64d1d02a3 Factor out EH landing pad code into a separate function, and constify
a bunch of stuff to support it.

llvm-svn: 101273
2010-04-14 19:53:31 +00:00
Dan Gohman
c94abce286 Reset the debug location even if the instruction was a terminator.
llvm-svn: 101272
2010-04-14 19:30:02 +00:00
Dan Gohman
2d61a3f384 Refine #includes.
llvm-svn: 101269
2010-04-14 18:49:17 +00:00
Dan Gohman
b0b1974ddd Pull utility routines with no SelectionDAG dependence out of
SelectionDAGBuilder. FunctionLoweringInfo isn't an ideal place for
them to live, but it's better than SelectionDAGBuilder for now.

llvm-svn: 101267
2010-04-14 18:31:02 +00:00
Dan Gohman
64582fc238 Fix typos in comments.
llvm-svn: 101266
2010-04-14 18:24:06 +00:00
Dan Gohman
60b5b8fa20 Delete an obsolete comment.
llvm-svn: 101264
2010-04-14 17:40:25 +00:00
Dan Gohman
4fd4153d52 Delete an unused function.
llvm-svn: 101263
2010-04-14 17:22:02 +00:00
Dan Gohman
45b0642839 Clear the FunctionLoweringInfo object before doing other things that
don't need it.

llvm-svn: 101262
2010-04-14 17:13:16 +00:00
Dan Gohman
3738dc7587 Move this assert out of SelectionDAGISel into FunctionLoweringInfo, and
drop the redundant #ifndef NDEBUG.

llvm-svn: 101261
2010-04-14 17:11:23 +00:00
Dan Gohman
4374fdf868 Add a comment.
llvm-svn: 101260
2010-04-14 17:09:37 +00:00
Dan Gohman
d0c66476e1 Move the code for initialing the entry block livein set out of
SelectionDAGISel.

llvm-svn: 101258
2010-04-14 17:05:00 +00:00
Dan Gohman
859cb3eea9 Reorgnaize this code to be more tidy and readable.
llvm-svn: 101256
2010-04-14 17:02:07 +00:00
Dan Gohman
a1656764cc Trim #includes.
llvm-svn: 101255
2010-04-14 16:54:39 +00:00
Dan Gohman
2c09c272ff Move the code for emitting livein copies out of SelectionDAGISel.
llvm-svn: 101254
2010-04-14 16:51:49 +00:00
Dan Gohman
6471bcb1fd Sink landing-pad marking code out of
SelectionDAGISel::runOnMachineFunction into FunctionLowering.

llvm-svn: 101252
2010-04-14 16:32:56 +00:00
Dan Gohman
625913100a It's not necessary to recompute EB here.
llvm-svn: 101251
2010-04-14 16:30:40 +00:00
Dan Gohman
1158c51fe0 Generalize this code to handle Instructions in addition to ConstantExprs.
llvm-svn: 101210
2010-04-14 02:33:23 +00:00
Dan Gohman
f3d8d6ef18 Reorder the methods of this class to be a little more organized.
llvm-svn: 101206
2010-04-14 02:09:45 +00:00
Dan Gohman
a400b6eca8 Add a few comments.
llvm-svn: 101148
2010-04-13 17:07:06 +00:00
Dan Gohman
5c9f7ed9aa Remove unnecessary parens.
llvm-svn: 101010
2010-04-12 02:24:01 +00:00
Dan Gohman
127f5c53e1 Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
llvm-svn: 100824
2010-04-08 23:03:40 +00:00
Ted Kremenek
141d32b7e9 Fix -Wsign-compare warning (issued by clang++).
llvm-svn: 100799
2010-04-08 18:49:30 +00:00
Benjamin Kramer
0fb23008bb Use twines to simplify calls to report_fatal_error. For code size and readability.
llvm-svn: 100756
2010-04-08 10:44:28 +00:00
Evan Cheng
3fa0b6fb03 Avoid using f64 to lower memcpy from constant string. It's cheaper to use i32 store of immediates.
llvm-svn: 100751
2010-04-08 07:37:57 +00:00
Chris Lattner
579e7eb423 convert a report_fatal_error that I was able to trigger into a nice error
so the user at least knows what inline asm is a problem.  For example:

error: inline asm not supported yet: don't know how to handle tied indirect register inputs
pr8788-1.c:14:10: note: generated from here
    asm ("\n" : "+r" (stack->regs)
         ^

Instead of:
fatal error: error in backend: Don't know how to handle tied indirect register inputs yet!

llvm-svn: 100731
2010-04-08 00:09:16 +00:00
Chris Lattner
f9fbc74e40 minor tidying.
llvm-svn: 100725
2010-04-07 23:50:38 +00:00
Chris Lattner
96ed85d7ab use assertions instead of unreachable for logic errors.
llvm-svn: 100724
2010-04-07 23:47:51 +00:00
Chris Lattner
80b41881bc rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Chris Lattner
f520500a06 fix 80 col violation, patch by Alastair Lynn
llvm-svn: 100639
2010-04-07 18:13:33 +00:00
Chris Lattner
122572e13a Have the inst emitter add the !srcloc mdnode to the machine instr.
Have the asmprinter use the mdnode to scavenge a source location if
present.  Document this nonsense in langref.

llvm-svn: 100607
2010-04-07 05:38:05 +00:00
Chris Lattner
dde7376e9d Three changes:
1. Introduce some enums and accessors in the InlineAsm class
   that eliminate a ton of magic numbers when handling inline
   asm SDNode.
2. Add a new MDNodeSDNode selection dag node type that holds
   a MDNode (shocking!)
3. Add a new argument to ISD::INLINEASM nodes that hold !srcloc
   metadata, propagating it to the instruction emitter, which
   drops it.

No functionality change.

llvm-svn: 100605
2010-04-07 05:20:54 +00:00
Dale Johannesen
c0f9c29448 Move printing of target-indepedent DEBUG_VALUE comments
into AsmPrinter.  Target-dependent form is still generated
by FastISel and still handled in X86 code.

llvm-svn: 100596
2010-04-07 01:15:14 +00:00
Dale Johannesen
fef6eb4076 Allow for the possibility that a debug-value points
to a SDNode that didn't have code generated for it.

llvm-svn: 100566
2010-04-06 21:59:56 +00:00
Mon P Wang
c0da8af5c3 Remove assert to treat memmove and memset like memcpy
llvm-svn: 100521
2010-04-06 08:27:51 +00:00
Evan Cheng
c6dc63d62c Fix an obvious copy-n-paste bug. It's not known to cause any miscompilation.
llvm-svn: 100494
2010-04-05 23:33:29 +00:00
Dan Gohman
302746a632 Add a comment.
llvm-svn: 100459
2010-04-05 20:24:08 +00:00
Chris Lattner
7d609ea6cb lowering a volatile llvm.memcpy to a libc memcpy is ok.
PR6779

llvm-svn: 100457
2010-04-05 20:11:45 +00:00
Chris Lattner
aa58ed7c00 remove the now-redundant MMI pointer in SelectionDAG.
llvm-svn: 100419
2010-04-05 06:19:28 +00:00
Chris Lattner
097a332684 remove some redundant MMI arguments.
llvm-svn: 100417
2010-04-05 06:10:13 +00:00
Chris Lattner
6f3c3f60ce unthread MMI from FastISel
llvm-svn: 100416
2010-04-05 06:05:26 +00:00
Chris Lattner
248e65ec05 trim some spurious references to DwarfWriter. SDIsel really doesn't
need it anymore, so don't addRequire it.

llvm-svn: 100400
2010-04-05 04:09:20 +00:00
Chris Lattner
c930f73b4d selection dag doesn't need DwarfWriter, remove some tendrils.
llvm-svn: 100382
2010-04-05 02:23:33 +00:00
Chris Lattner
1fda8b3a8b fastisel doesn't need DwarfWriter, remove some tendricles.
llvm-svn: 100381
2010-04-05 02:19:28 +00:00
Mon P Wang
484bbe6aa9 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)

llvm-svn: 100304
2010-04-04 03:10:48 +00:00
Benjamin Kramer
88e421e531 Fix anachronism.
llvm-svn: 100225
2010-04-02 20:47:05 +00:00
Chris Lattner
9da2b8a955 fix the llvm-x86_64-linux buildbot.
llvm-svn: 100223
2010-04-02 20:36:25 +00:00
Chris Lattner
0da97990f6 stop using DebugLoc::getUnknownLoc()
llvm-svn: 100215
2010-04-02 20:17:23 +00:00
Chris Lattner
305c84b8ee Switch the code generator (except the JIT) onto the new DebugLoc
representation.  This eliminates the 'DILocation' MDNodes for 
file/line/col tuples from -O0 -g codegen.

This remove the old DebugLoc class, making it a typedef for DebugLoc,
I'll rename NewDebugLoc next.

I didn't update the JIT to use the new apis, so it will continue to
work, but be as slow as before.  Someone should eventually do this
or, better yet, rip out the JIT debug info stuff and build the JIT
on top of MC.

llvm-svn: 100209
2010-04-02 19:42:39 +00:00
Evan Cheng
5d825988d0 Correctly lower memset / memcpy of undef. It should be a nop. PR6767.
llvm-svn: 100208
2010-04-02 19:36:14 +00:00
Mon P Wang
0ccf050ca3 Revert r100191 since it breaks objc in clang
llvm-svn: 100199
2010-04-02 18:43:02 +00:00
Mon P Wang
a01350755e Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)

llvm-svn: 100191
2010-04-02 18:04:15 +00:00
Evan Cheng
9307af84c2 Skip checking preferred alignment of GVs defined in other translation units all together.
llvm-svn: 100133
2010-04-01 20:13:28 +00:00
Evan Cheng
8728924812 - Avoid using floating point stores to implement memset unless the value is zero.
- Do not try to infer GV alignment unless its type is sized. It's not possible to infer alignment if it has opaque type.

llvm-svn: 100118
2010-04-01 18:19:11 +00:00
Evan Cheng
562bb43207 Fix sdisel memcpy, memset, memmove lowering:
1. Makes it possible to lower with floating point loads and stores.
2. Avoid unaligned loads / stores unless it's fast.
3. Fix some memcpy lowering logic bug related to when to optimize a
   load from constant string into a constant.
4. Adjust x86 memcpy lowering threshold to make it more sane.
5. Fix x86 target hook so it uses vector and floating point memory
   ops more effectively.
rdar://7774704

llvm-svn: 100090
2010-04-01 06:04:33 +00:00
Chris Lattner
1d2ea2510d use the optimized debug info apis in sdisel.
llvm-svn: 99986
2010-03-31 04:24:50 +00:00
Chris Lattner
27c9cacb63 add new apis for getting/setting !dbg metadata on
instructions.  In addition to being a convenience,
they are faster than the old apis, particularly when
not going from an MDKindID like people should be
doing.

llvm-svn: 99982
2010-03-31 03:34:40 +00:00
Bob Wilson
aae933cc81 Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
llvm-svn: 99948
2010-03-30 22:27:04 +00:00
Mon P Wang
9351ea594a Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
A update of langref will occur in a subsequent checkin.

llvm-svn: 99928
2010-03-30 20:55:56 +00:00
Evan Cheng
6286e43067 Funky indentation.
llvm-svn: 99901
2010-03-30 18:08:53 +00:00
Evan Cheng
b1ddb193c7 Fix PR4975. Avoid referencing empty vector.
llvm-svn: 99840
2010-03-29 21:27:30 +00:00
Evan Cheng
aafcb722f9 Pool allocate SDDbgValue nodes.
llvm-svn: 99836
2010-03-29 20:48:30 +00:00
Chris Lattner
24b8a8bebd add a statistic for the # times isel has to backtrack.
llvm-svn: 99774
2010-03-28 19:46:56 +00:00
Chris Lattner
5ad69fe4b6 finally remove the immAllOnesV_bc/immAllZerosV_bc patterns
and those derived from them.  These are obnoxious because
they were written as: PatLeaf<(bitconvert).  Not having an
argument was foiling adding better type checking for operand
count matching up with what was required (in this case,
bitconvert always requires an operand!)

llvm-svn: 99759
2010-03-28 08:43:23 +00:00
Chris Lattner
78dc3c322f comply with the wishes of a fixme.
llvm-svn: 99742
2010-03-28 05:55:17 +00:00
Chris Lattner
918dd19018 now that (parallel) is gone and a variety of bugs in targets
are cleaned up, we can remove an old fixme.

llvm-svn: 99741
2010-03-28 05:54:03 +00:00
Chris Lattner
3f060e3216 add an optimized form of OPC_EmitMergeInputChains for the 1, 0 and
1, 1 cases which are by-far the most frequent.  This shrinks the X86
isel table from 77014 -> 74657 bytes.

llvm-svn: 99740
2010-03-28 05:50:16 +00:00
Chris Lattner
bacf4edba3 don't add nodes to the now-dead nodes list multiple times, this
can cause a crash on crazy situations in msp430 when morph-node-to
is disabled.

llvm-svn: 99739
2010-03-28 05:28:31 +00:00
Chris Lattner
bb65543f01 don't add flag nodes with chain results to the NowDeadNodes
list multiple times when MorphNodeTo can't be applied.

llvm-svn: 99735
2010-03-28 04:54:33 +00:00
Chris Lattner
85756c913d improve -debug-only=isel comments for cases when we don't enter a
scope due to obviously false predicate.

llvm-svn: 99723
2010-03-27 18:54:50 +00:00
Bill Wendling
3f00f8044f Forgot the part where we handle the ".llvm.eh.catch.all.value".
llvm-svn: 99697
2010-03-27 01:24:30 +00:00
Anton Korobeynikov
add7caa0f3 Add few missed libcalls and correct names for others.
llvm-svn: 99656
2010-03-26 21:32:14 +00:00
Evan Cheng
1f419ac4da LiveVariables should clear kill / dead markers first. This allows us to remove a hack in the scheduler.
llvm-svn: 99597
2010-03-26 02:12:24 +00:00
Chris Lattner
bea905d2e9 fix a valgrind error on copy-constructor-synthesis.cpp, which is caused when
the custom insertion hook deletes the instruction, then we try to set dead
flags on it.  Neither the code that I added nor the code that was there 
before was safe.

llvm-svn: 99538
2010-03-25 18:49:10 +00:00
Evan Cheng
8c19404e5c Scheduler assumes SDDbgValue nodes are in source order. That's true currently. But add an assertion to verify it.
llvm-svn: 99501
2010-03-25 07:16:57 +00:00
Chris Lattner
13f444cdf1 Change tblgen to emit FOOISD opcode names as two
bytes instead of one byte.  This is important because
we're running up to too many opcodes to fit in a byte
and it is aggrevated by FIRST_TARGET_MEMORY_OPCODE
making the numbering sparse.  This just bites the
bullet and bloats out the table.  In practice, this
increases the size of the x86 isel table from 74.5K
to 76K.  I think we'll cope :)

This fixes rdar://7791648

llvm-svn: 99494
2010-03-25 06:33:05 +00:00
Evan Cheng
0ad874a05c Remove a fixme that doesn't make sense any more.
llvm-svn: 99489
2010-03-25 06:02:53 +00:00
Evan Cheng
0917f4a575 Make sure SDDbgValue.Invalid is initialized to false by all the constructors.
llvm-svn: 99487
2010-03-25 05:50:26 +00:00
Chris Lattner
391902aa30 Make the NDEBUG assertion stronger and more clear what is
happening.

Enhance scheduling to set the DEAD flag on implicit defs
more aggressively.  Before, we'd set an implicit def operand
to dead if it were present in the SDNode corresponding to
the machineinstr but had no use.  Now we do it in this case
AND if the implicit def does not exist in the SDNode at all.

This exposes a couple of problems: one is the FIXME, which
causes a live intervals crash on CodeGen/X86/sibcall.ll.
The second is that it makes machinecse and licm more 
aggressive (which is a good thing) but also exposes a case
where licm hoists a set0 and then it doesn't get resunk.

Talking to codegen folks about both these issues, but I need
this patch in in the meantime.

llvm-svn: 99485
2010-03-25 05:40:48 +00:00
Chris Lattner
7382099e8f reapply 99444/99445, which I speculatively reverted in
r99453.

llvm-svn: 99482
2010-03-25 04:41:16 +00:00
Evan Cheng
abefdb6d68 Change how dbg_value sdnodes are converted into machine instructions. Their placement should be determined by the relative order of incoming llvm instructions. The scheduler will now use the SDNode ordering information to determine where to insert them. A dbg_value instruction is inserted after the instruction with the last highest source order and before the instruction with the next highest source order. It will optimize the placement by inserting right after the instruction that produces the value if they have consecutive order numbers.
Here is a theoretical example that illustrates why the placement is important.

tmp1 = 
store tmp1 -> x
...
tmp2 = add ...
...
call
...
store tmp2 -> x

Now mem2reg comes along:

tmp1 = 
dbg_value (tmp1 -> x)
...
tmp2 = add ...
...
call
...
dbg_value (tmp2 -> x)

When the debugger examine the value of x after the add instruction but before the call, it should have the value of tmp1.

Furthermore, for dbg_value's that reference constants, they should not be emitted at the beginning of the block (since they do not have "producers").

This patch also cleans up how SDISel manages DbgValue nodes. It allow a SDNode to be referenced by multiple SDDbgValue nodes. When a SDNode is deleted, it uses the information to find the SDDbgValues and invalidate them. They are not deleted until the corresponding SelectionDAG is destroyed.

llvm-svn: 99469
2010-03-25 01:38:16 +00:00
Chris Lattner
0bbe76ccc4 revert 99444/99445. This doesn't cause the failure of
2006-07-19-stwbrx-crash.ll for me, but it's the only likely
patch in the blame list of several bots.  Lets see if this
fixes it.

llvm-svn: 99453
2010-03-24 23:41:19 +00:00
Chris Lattner
c7a6ab89fb remove dead argument.
llvm-svn: 99445
2010-03-24 22:47:12 +00:00
Chris Lattner
d581e0398e split EmitNode in half to reduce indentation.
llvm-svn: 99444
2010-03-24 22:45:47 +00:00
Dan Gohman
56a90ff2a1 Remove the ConvertActions table and associated code, which is unused.
llvm-svn: 99372
2010-03-24 00:53:38 +00:00
Dan Gohman
ce6d4394a8 Revert 99335. getTypeToExpandTo's iterative behavior is actually
needed here.

llvm-svn: 99339
2010-03-23 22:44:42 +00:00
Dan Gohman
7814ddee81 Remove getTypeToExpandTo, since it isn't adding much value
beyond just calling getTypeToTransformTo.

llvm-svn: 99335
2010-03-23 22:15:31 +00:00
Mon P Wang
005a544af8 Fixed a widening bug where we were not using the correct size for the load
llvm-svn: 98920
2010-03-19 01:19:52 +00:00
Anton Korobeynikov
23c07f492e Get rid of target-specific nodes for fp16 <-> fp32 conversion.
llvm-svn: 98888
2010-03-18 22:35:37 +00:00
Dan Gohman
ff37afdc4b Define placement new wrappers for BumpPtrAllocator and
RecyclingAllocator to allow client code to be simpler, and
simplify several clients.

llvm-svn: 98847
2010-03-18 18:49:47 +00:00