aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineCSE.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-01-03Use a RecyclingAllocator to allocate values for MachineCSE's ScopedHashTable forCameron Zwarich1-3/+7
a 28% speedup of MachineCSE time on 403.gcc. llvm-svn: 122735
2010-12-15Teach machine cse to commute instructions.Evan Cheng1-2/+19
llvm-svn: 121903
2010-10-29Teach machine cse to eliminate instructions with multiple physreg uses and ↵Evan Cheng1-50/+45
defs. rdar://8610857. llvm-svn: 117745
2010-10-19Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson1-1/+3
exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
2010-10-12Begin adding static dependence information to passes, which will allow us toOwen Anderson1-1/+5
perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. llvm-svn: 116334
2010-10-07Now with fewer extraneous semicolons!Owen Anderson1-1/+1
llvm-svn: 115996
2010-10-06Add MachineRegisterInfo::constrainRegClass and use it in MachineCSE.Jakob Stoklund Olesen1-7/+2
This function is intended to be used when inserting a machine instruction that trivially restricts the legal registers, like LEA requiring a GR32_NOSP argument. llvm-svn: 115875
2010-09-17Machine CSE was forgetting to clear some data structures.Evan Cheng1-0/+7
llvm-svn: 114222
2010-09-17Fix a potential bug that can cause miscomparison with and without debug info.Evan Cheng1-1/+1
llvm-svn: 114220
2010-08-17Machine CSE preserves CFG. Pass manager was freeing machineloopinfo after ↵Evan Cheng1-0/+1
machine cse before. llvm-svn: 111281
2010-08-06Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson1-1/+1
llvm-svn: 110460
2010-08-06Revert r110396 to fix buildbots.Owen Anderson1-1/+1
llvm-svn: 110410
2010-08-05Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson1-1/+1
address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
2010-07-21Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson1-2/+2
llvm-svn: 109045
2010-07-16Remove many calls to TII::isMoveInstr. Targets should be producing COPY anyway.Jakob Stoklund Olesen1-30/+4
TII::isMoveInstr is going tobe completely removed. llvm-svn: 108507
2010-07-08Convert EXTRACT_SUBREG to COPY when emitting machine instrs.Jakob Stoklund Olesen1-0/+22
EXTRACT_SUBREG no longer appears as a machine instruction. Use COPY instead. Add isCopy() checks in many places using isMoveInstr() and isExtractSubreg(). The isMoveInstr hook will be removed later. llvm-svn: 107879
2010-07-03Detect and handle COPY in many places.Jakob Stoklund Olesen1-2/+2
This code is transitional, it will soon be possible to eliminate isExtractSubreg, isInsertSubreg, and isMoveInstr in most places. llvm-svn: 107547
2010-06-04Re-apply 105308 with fix.Evan Cheng1-7/+13
llvm-svn: 105502
2010-06-03Revert 105308.Bob Wilson1-1/+4
llvm-svn: 105399
2010-06-02Enable machine cse of instructions which define physical registers.Evan Cheng1-4/+1
llvm-svn: 105308
2010-05-21Make this LookAheadLimit, not the uninitialized LookAheadLeft.Eric Christopher1-1/+1
Evan please verify! llvm-svn: 104408
2010-05-21Allow machine cse to cse instructions which define physical registers. ↵Evan Cheng1-27/+81
Controlled by option -machine-cse-phys-defs. llvm-svn: 104385
2010-05-13Add a utility function for conservatively clearing kill flags, and makeDan Gohman1-1/+4
use of it in MachineCSE. llvm-svn: 103726
2010-04-21Rewrite machine cse to avoid recursion.Evan Cheng1-11/+85
llvm-svn: 101964
2010-04-20Typo.Evan Cheng1-1/+1
llvm-svn: 101914
2010-04-02After trivial coalescing, the MI being visited may have become a copy. Avoid ↵Evan Cheng1-1/+5
adding it to CSE hash table since copies aren't being considered for CSE and they may be deleted. rdar://7819990 llvm-svn: 100170
2010-03-24dbg_value may end a block.Evan Cheng1-4/+4
llvm-svn: 99378
2010-03-23Code clean up.Evan Cheng1-6/+6
llvm-svn: 99319
2010-03-11Fix debug_value handling.Dale Johannesen1-2/+6
llvm-svn: 98224
2010-03-10Add a couple more heuristics to neuter machine cse some more.Evan Cheng1-13/+57
1. Be careful with cse "cheap" expressions. e.g. constant materialization. Only cse them when the common expression is local or in a direct predecessor. We don't want cse of cheap instruction causing other expressions to be spilled. 2. Watch out for the case where the expression doesn't itself uses a virtual register. e.g. lea of frame object. If the common expression itself is used by copies (common for passing addresses to function calls), don't perform the cse. Since these expressions do not use a register, it creates a live range but doesn't close any, we want to be very careful with increasing register pressure. Note these are heuristics so machine cse doesn't make register allocator unhappy. Once we have proper live range splitting and re-materialization support in place, these should be evaluated again. Now machine cse is almost always a win on llvm nightly tests on x86 and x86_64. llvm-svn: 98121
2010-03-09Allow more cross-rc coalescing.Evan Cheng1-10/+13
llvm-svn: 98048
2010-03-09Don't do illegal cross-class coalescing.Jakob Stoklund Olesen1-1/+1
llvm-svn: 98044
2010-03-09- Make the machine cse dumb coalescer (as opposed to the more awesome simpleEvan Cheng1-13/+57
coalescer) handle sub-register classes. - Add heuristics to avoid non-profitable cse. Given the current lack of live range splitting, avoid cse when an expression has PHI use and the would be new use is in a BB where the expression wasn't already being used. llvm-svn: 98043
2010-03-08Don't waste time trying to CSE labels, phis, inline asm. Definitely avoid ↵Evan Cheng1-0/+4
cse implicit-def for obvious performance reason. llvm-svn: 98009
2010-03-08Restrict machine cse to really trivial coalescing. Leave the heavy lifting ↵Evan Cheng1-0/+3
to a real coalescer. llvm-svn: 98007
2010-03-06Don't update physical register def.Evan Cheng1-2/+3
llvm-svn: 97861
2010-03-04Avoid cse load instructions unless they are known to be invariant loads.Evan Cheng1-10/+36
llvm-svn: 97747
2010-03-04Look ahead a bit to determine if a physical register def that is not marked ↵Evan Cheng1-6/+61
dead is really alive. This is necessary to catch a lot of common cse opportunities for targets like x86. llvm-svn: 97706
2010-03-03Fix a logic error. An instruction that has a live physical register def ↵Evan Cheng1-2/+5
cannot be CSE'ed, but it *can* be used to replace a common subexpression. llvm-svn: 97688
2010-03-03Re-apply r97667 but with a little bit of thought put into the patch. This ↵Evan Cheng1-65/+3
implements a special DenseMapInfo trait for DenseMap<MachineInstr*> that compare the value of the MachineInstr rather than the pointer value. Since the hashing and equality test functions ignore defs it's useful for doing CSE kind optimization. llvm-svn: 97678
2010-03-03Revert 97667. It broke a bunch of tests.Dan Gohman1-0/+63
llvm-svn: 97673
2010-03-03Move DenseMapInfo for MachineInstr* to MachineInstr.hEvan Cheng1-63/+0
llvm-svn: 97667
2010-03-03Machine CSE work in progress. It's doing some CSE now. But implicit def of ↵Evan Cheng1-24/+61
physical registers are getting in the way. llvm-svn: 97664
2010-03-03Work in progress. Finding some cse now.Evan Cheng1-4/+88
llvm-svn: 97635
2010-03-02Fix typo.Evan Cheng1-1/+1
llvm-svn: 97577
2010-03-02Add skeleton of a machine level cse pass.Evan Cheng1-0/+124
llvm-svn: 97543