Commit Graph

9072 Commits

Author SHA1 Message Date
Evan Cheng
a054ae02fd Move DenseMapInfo for MachineInstr* to MachineInstr.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97667 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 21:47:16 +00:00
Dan Gohman
a72d2a210c Fix a bug in SelectionDAG's ReplaceAllUsesWith in the case where
CSE and recursive RAUW calls delete a node from the use list,
invalidating the use list iterator. There's currently no known
way to reproduce this in an unmodified LLVM, however there's no
fundamental reason why a SelectionDAG couldn't be formed which
would trigger this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 21:33:37 +00:00
Evan Cheng
16b48b8a05 Machine CSE work in progress. It's doing some CSE now. But implicit def of physical registers are getting in the way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97664 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 21:20:05 +00:00
Evan Cheng
1423c70b8f Add MachineRegisterInfo::hasOneUse and hasOneNonDBGUse.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97663 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 21:18:38 +00:00
Bill Wendling
fec8657351 Revert...
--- Reverse-merging r97592 into '.':
U    lib/CodeGen/TargetLoweringObjectFileImpl.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97657 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 19:31:05 +00:00
Chris Lattner
da828e3c8c add some of the more obscure predicate types to the
Scope accelerator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97652 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 07:46:25 +00:00
Chris Lattner
f1b7c7d476 speed up scope node processing: if the first element of a scope
entry we're about to process is obviously going to fail, don't
bother pushing a scope only to have it immediately be popped.
This avoids a lot of scope stack traffic in common cases.

Unfortunately, this requires duplicating some of the predicate
dispatch.  To avoid duplicating the actual logic I pulled each
predicate out to its own static function which gets used in
both places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 07:31:15 +00:00
Chris Lattner
cfe2eab744 introduce a new SwitchTypeMatcher node (which is analogous to
SwitchOpcodeMatcher) and have DAGISelMatcherOpt form it.  This
speeds up selection, particularly for X86 which has lots of 
variants of instructions with only type differences.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97645 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 06:28:15 +00:00
Evan Cheng
6ba9554988 Work in progress. Finding some cse now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97635 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 02:48:20 +00:00
Bill Wendling
32f9eb2bc3 Use APInt instead of zext value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97631 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 01:58:01 +00:00
Evan Cheng
506049f29f - Change MachineInstr::isIdenticalTo to take a new option that determines whether it should skip checking defs or at least virtual register defs. This subsumes part of the TargetInstrInfo::isIdentical functionality.
- Eliminate TargetInstrInfo::isIdentical and replace it with produceSameValue. In the default case, produceSameValue just checks whether two machine instructions are identical (except for virtual register defs). But targets may override it to check for unusual cases (e.g. ARM pic loads from constant pools).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97628 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 01:44:33 +00:00
Evan Cheng
d89347cb49 Add an option to enable machine cse (it's not doing anything yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97627 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 01:38:35 +00:00
Bill Wendling
7d9f2b93a3 This test case:
long test(long x) { return (x & 123124) | 3; }

Currently compiles to:

_test:
        orl     $3, %edi
        movq    %rdi, %rax
        andq    $123127, %rax
        ret

This is because instruction and DAG combiners canonicalize

  (or (and x, C), D) -> (and (or, D), (C | D))

However, this is only profitable if (C & D) != 0. It gets in the way of the
3-addressification because the input bits are known to be zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 00:35:56 +00:00
Chris Lattner
d1b7382983 Fix some issues in WalkChainUsers dealing with
CopyToReg/CopyFromReg/INLINEASM.  These are annoying because
they have the same opcode before an after isel.  Fix this by
setting their NodeID to -1 to indicate that they are selected,
just like what automatically happens when selecting things that
end up being machine nodes.

With that done, give IsLegalToFold a new flag that causes it to
ignore chains.  This lets the HandleMergeInputChains routine be
the one place that validates chains after a match is successful,
enabling the new hotness in chain processing.  This smarter
chain processing eliminates the need for "PreprocessRMW" in the
X86 and MSP430 backends and enables MSP to start matching it's
multiple mem operand instructions more aggressively.

I currently #if out the dead code in the X86 backend and MSP 
backend, I'll remove it for real in a follow-on patch.

The testcase changes are:
  test/CodeGen/X86/sse3.ll: we generate better code
  test/CodeGen/X86/store_op_load_fold2.ll: PreprocessRMW was 
      miscompiling this before, we now generate correct code
      Convert it to filecheck while I'm at it.
  test/CodeGen/MSP430/Inst16mm.ll: Add a testcase for mem/mem
      folding to make anton happy. :)




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97596 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 22:20:06 +00:00
Bill Wendling
d556155afd Okay. One last attempt:
Place the LSDA into the TEXT section on Mach-O. This saves space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 21:50:35 +00:00
Chris Lattner
00592ec857 run HandleMergeInputChains even if we only have one input chain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97581 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 19:34:59 +00:00
Evan Cheng
ac1abde05b Swap parameters of isSafeToMove and isSafeToReMat for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97578 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 19:03:01 +00:00
Evan Cheng
c5bbba1e49 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 19:02:27 +00:00
Devang Patel
1eac3e7d1e Fix grammar.
Thanks Duncan!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97572 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 17:58:15 +00:00
Chris Lattner
82dd3d38d9 Fix the xfail I added a couple of patches back. The issue
was that we weren't properly handling the case when interior
nodes of a matched pattern become dead after updating chain
and flag uses.  Now we handle this explicitly in 
UpdateChainsAndFlags.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 07:50:03 +00:00
Chris Lattner
61c97f6932 I was confused about this, it turns out that MorphNodeTo
*does* delete ex-operands that become dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 07:14:49 +00:00
Chris Lattner
3ff1e4db78 factor node morphing out to its own helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 06:55:04 +00:00
Chris Lattner
7c306da505 Sink InstructionSelect() out of each target into SDISel, and rename it
DoInstructionSelection.  Inline "SelectRoot" into it from DAGISelHeader.
Sink some other stuff out of DAGISelHeader into SDISel.

Eliminate the various 'Indent' stuff from various targets, which dates
to when isel was recursive.

 17 files changed, 114 insertions(+), 430 deletions(-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 06:34:30 +00:00
Eric Christopher
7b2c9e6a30 Add file to CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:49:43 +00:00
Evan Cheng
c6fe333688 Add skeleton of a machine level cse pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:38:24 +00:00
Chris Lattner
6183fbd726 Use the right induction variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:37:23 +00:00
Chris Lattner
c6d7ad3c7d Rewrite chain handling validation and input TokenFactor handling
stuff now that we don't care about emulating the old broken 
behavior of the old isel.  This eliminates the 
'CheckChainCompatible' check (along with IsChainCompatible) which
did an incorrect and inefficient scan *up* the chain nodes which
happened as the pattern was being formed and does the validation
at the end in HandleMergeInputChains when it forms a structural 
pattern.  This scans "down" the graph, which means that it is
quickly bounded by nodes already selected.  This also handles
token factors that get "trapped" in the dag.

Removing the CheckChainCompatible nodes also shrinks the 
generated tables by about 6K for X86 (down to 83K).

There are two pieces remaining before I can nuke PreprocessRMW:
1. I xfailed a test because we're now producing worse code in a 
   case that has nothing to do with the change: it turns out that
   our use of MorphNodeTo will leave dead nodes in the graph
   which (depending on how the graph is walked) end up causing
   bogus uses of chains and blocking matches.  This is really 
   bad for other reasons, so I'll fix this in a follow-up patch.

2. CheckFoldableChainNode needs to be improved to handle the TF.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:22:10 +00:00
Dan Gohman
5b870aff81 Fix several places to handle vector operands properly.
Based on a patch by Micah Villmow for PR6438.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:14:38 +00:00
Bill Wendling
46ada19645 Remove dead parameter passing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 01:55:18 +00:00
Devang Patel
6b506cbce0 Constructors and operators for anonymous aggregates does not names. Do not force empty AT_name attribute in such cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97533 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 01:26:20 +00:00
Chris Lattner
319ef94030 remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97529 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 00:40:26 +00:00
Chris Lattner
6b30792d2d refactor some code out of OPC_EmitMergeInputChains into a
new helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97525 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 00:00:03 +00:00
Chris Lattner
df51247725 remove all but one version of SelectionDAG::MorphNodeTo
(the most general) the others are dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97511 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 22:20:05 +00:00
Jakob Stoklund Olesen
e5d90416ee Use methods to determine if a LiveInterval is spillable.
Don't accidentally produce unspillable intervals for deeply nested loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97496 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 20:59:38 +00:00
Chris Lattner
7390eebd49 Accelerate isel dispatch for tables that start with a top-level
OPC_SwitchOpcode to use a table lookup instead of having to go
through the interpreter for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97469 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 18:47:11 +00:00
Dan Gohman
042919c0c5 Fix optimization of ISD::TRUNCATE on vector operands. Based on a patch
by Micah Villmow for PR6335.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97461 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 17:59:21 +00:00
Chris Lattner
7d892d6e6d some trivial microoptimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 07:43:08 +00:00
Chris Lattner
fa342faef9 eliminate the CheckMultiOpcodeMatcher code and have each
ComplexPattern at the root be generated multiple times, once
for each opcode they are part of.  This encourages factoring
because the opcode checks get treated just like everything
else in the matcher.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 07:17:40 +00:00
Chris Lattner
eb66921adb add a new OPC_SwitchOpcode which is semantically equivalent
to a scope where every child starts with a CheckOpcode, but
executes more efficiently.  Enhance DAGISelMatcherOpt to 
form it.

This also fixes a bug in CheckOpcode: apparently the SDNodeInfo
objects are not pointer comparable, we have to compare the
enum name.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97438 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 06:59:22 +00:00
Chris Lattner
14df8dc680 eliminate GetInt1/2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97426 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 22:38:43 +00:00
Chris Lattner
2a49d57d2d hoist the new isel interpreter out of DAGISelHeader.h
(which gets #included into the middle of each 
target's DAGISel class) into a .cpp file where it is
only compiled once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 22:37:22 +00:00
Chris Lattner
21221e357c enhance the new isel to handle the 'node already exists'
case of MorphNodeTo directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97417 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 21:36:14 +00:00
Chris Lattner
25d5837889 simplify this code, return only ever has zero or one operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 18:53:13 +00:00
Dan Gohman
6ac33b4533 Don't try to replace physical registers when doing CSE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 01:33:43 +00:00
Dan Gohman
8772f5041c Add a flag to addPassesToEmit* to disable the Verifier pass run
after LSR, so that clients can opt in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97357 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 00:41:59 +00:00
Dan Gohman
a363a9b71a Don't unconditionally suppress hoisting of instructions with implicit
defs or uses. The regular def and use checking below covers them, and
can be more precise. It's safe to hoist an instruction with a dead
implicit def if the register isn't live into the loop header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97352 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 00:08:44 +00:00
Evan Cheng
2c755ba12a Re-apply 97040 with fix. This survives a ppc self-host llvm-gcc bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 07:36:59 +00:00
Bill Wendling
4933a373a7 The TType is always absptr on Mach-O...at least for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97295 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 01:05:51 +00:00
Bill Wendling
1869ac8b71 A much cleaner (and less code!) way of inserting the correct amount of padding
for alignment into the LSDA. If the TType base offset is emitted, then put the
padding there. Otherwise, put it in the call site table length. There will be no
conflict between the two sites when placing the padding in one place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97277 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 22:17:52 +00:00
Bill Wendling
6507eca124 Comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97269 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 21:31:01 +00:00