aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Simplify (and warn about) right shifts that result in zeroLinus Torvalds2008-04-241-1/+56
| | | | | | | | ..due to limited source sizes. Yeah, should do this for left shifts too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* simplify.c: Declare delete_pseudo_user_list_entry staticJosh Triplett2007-04-201-1/+1
| | | | Signed-off-by: Josh Triplett <josh@freedesktop.org>
* Fix typos in commentsJosh Triplett2007-03-091-3/+3
| | | | Signed-off-by: Josh Triplett <josh@freedesktop.org>
* Add a return in the last case of a switch; redundant but less error-prone.Josh Triplett2007-01-161-0/+1
| | | | Signed-off-by: Josh Triplett <josh@freedesktop.org>
* Update usage chain for dead instructionsChristopher Li2007-01-161-0/+5
| | | | | | This patch address some of the dead instructions left in the usage chain. Signed-Off-By: Christopher Li <sparse@chrisli.org>
* Add instruction to pseudo user tracking.Christopher Li2007-01-161-15/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way of tracking pseudo register user is by keeping a list of the address of the pseudo_t member. This address can be in part of the instruction member, the worse case is in the argument list of the call instruction. As the comment for address_taken() said, using the container to get instruction pointer is wrong. It use to work with instruction that relate to symbol address. But that is not true any more. Even worse, it is very hard to track the pseudo usage other than symbol address. The only reason symbol address used to works for call instruction is because call instruction did not directly use the symbol address. I bit the bullet and just add the instruction pointer to pair with the pseudo user pointer. So it will work with the case that the user instruction is call as well. Testing: I compare the linearize result with/without the patch on a few sparse source file it self. The linearize generate exactly the same result except the symbol address changes. Which is predictable different because the pseudo user structure allocate memory. Singed-Off-By: Christopher Li <sparse@chrisli.org>
* Typo fixesPavel Roskin2006-11-061-1/+1
| | | | | Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Josh Triplett <josh@freedesktop.org>
* Simplify some more instructionsLinus Torvalds2005-11-201-2/+28
| | | | Constant casts, and some boolean ops with constants.
* Fix typo (duplicate src2 should be src3) in simplify_rangeLinus Torvalds2005-04-071-1/+1
| | | | Noted by Jeff Muizelaar
* Use the new per-instruction position information for betterLinus Torvalds2005-04-071-2/+2
| | | | error reporting.
* Make range check code a bit more readable (and more easily extensible).Linus Torvalds2005-04-071-5/+16
|
* Add compile-time "range-check" infrastructure to sparseLinus Torvalds2005-04-071-4/+32
|
* Make simplification remove casts that change neither size nor sign.Linus Torvalds2005-04-071-1/+12
|
* Split OP_CAST into signed, unsigned and FP casts.Linus Torvalds2005-04-071-2/+4
| | | | | Otherwise we lose the information what the target type is (we only have the bit-size of the target).
* Simplify OP_CAST of OP_AND.Linus Torvalds2005-04-071-7/+21
| | | | We can remove the cast if the AND made it unnecessary.
* Make constant instruction simplification take the sign of theLinus Torvalds2005-04-071-20/+29
| | | | instruction into account now that we have it.
* Split the binops where signedness matters into unsigned and signed.Linus Torvalds2005-04-071-16/+23
| | | | | | | This is OP_MUL/OP_DIV/OP_MOD/OP_SHR. We actually do the constant simplifications still wrong, but now the information is all there.
* Don't try to recursively check for an associative insn.Linus Torvalds2005-04-071-0/+2
| | | | This should only happen for a buggy case anyway, but..
* Simplify OP_PTRCAST ops too for now.Linus Torvalds2005-04-071-1/+1
| | | | | | Some day we migth do a type-based alias cast, and then we might do something else, but for now simplification is better than leaving them in and making analysis harder.
* Split OP_SETVAL into OP_SETVAL (fp expressions and labels) and OP_SYMADDRLinus Torvalds2005-04-071-6/+4
| | | | | | | (symbol addresses). They are pretty different. Symbol addresses have special meaning during various phases, from symbol simplification to CSE.
* Simplify conditional on cast-to-larger-size to conditional on original.Linus Torvalds2005-04-071-0/+8
|
* Oops. Didn't remember about BINCMP ops when doing the commutativeLinus Torvalds2005-04-071-0/+5
| | | | | | | work. Equality tests are commutative. The others aren't (well, they need to switch the sense around).
* Teach simplification about associative operators.Linus Torvalds2005-04-071-3/+39
|
* Make commutative operations use a canonical order.Linus Torvalds2005-04-071-1/+40
| | | | | This improves CSE, and simplifies code generation. Keep the "simpler" argument in "src2".
* Remove OP_SETVAL after symbol-pseudo simplification.Linus Torvalds2005-04-071-1/+1
| | | | | | | | We can just replace all users with the symbol pseudo directly. This means that we can no longer re-do symbol simplification after CSE, and we need to rely on the generic memop simplification.
* Make OP_PHISOURCE track the OP_PHI instructions that it defines.Linus Torvalds2005-04-071-1/+1
| | | | | | | | This allows us to always see which pseudos are nonlocally affected by the phi source. We can only do this after the instruction flow is fixed, together with the OP_DEATHNOTE phase.
* Simplify constant unopsLinus Torvalds2005-04-071-1/+18
|
* Fix conditional branch to same target simplification.Linus Torvalds2005-04-071-0/+12
| | | | | | | | | We should clear out "insn->cond" when turning it into an unconditional branch, anything else will confuse us later (kill_use() will set it to VOID, that's not good enough). Move it to simplify.c at the same time.
* Oops. OP_SEL simplification tried to kill the wrong pseudo ;)Linus Torvalds2005-04-071-1/+1
|
* Follow OP_SEL -> OP_BR flow and simplify the branch.Linus Torvalds2005-04-071-0/+23
|
* Remove OP_SETCC, make OP_SEL bigger instead.Linus Torvalds2005-04-071-30/+22
| | | | | | | This was originally done so that "struct instruction" would be smaller, but it has since grown anyway (for the memops), so splitting OP_SEL into two instructions no longer makes sense, and makes it harder on CSE.
* When simplifying memops, follow the whole chain of adds/subs.Linus Torvalds2005-04-071-2/+18
| | | | | | | This means we find multiple cases faster, but more importantly, it also means that if the chain is infinite, we can trivially notice. We used to just notice immediate recursive uses, not the more complex cases.
* Simplify seteq/setne $0 + conditional branch.Linus Torvalds2005-04-071-3/+37
|
* Don't try to share parenthood fn between phi node removal and Linus Torvalds2005-04-071-12/+2
| | | | | | | | regular CSE. The CSE case is totally different: since both children use the same pseudos, there can be no question that a common parent wouldn't have that pseudo live.
* Simplify "setcc + select $0<->$1" into "setne/seteq".Linus Torvalds2005-04-071-7/+29
| | | | It's a common idiom, keep it in common format.
* Move constant switch simplification to the instructionLinus Torvalds2005-04-071-0/+27
| | | | simplification phase.
* Cleanup. Move the OP_SEL and OP_BR simplification out intoLinus Torvalds2005-04-071-18/+29
| | | | | | | their own functions. This makes ready for moving the OP_BR phi-following to the instruction simplification phase.
* Simplify trivial casts (and handle pointers specially).Linus Torvalds2005-04-071-0/+19
| | | | | | | | | | | | This does trivial simplification of casting to the same typesize. HOWEVER. We split casts up into whether they cast to a dereferencable pointer type or not, and we don't simplify pointer casts. This should mean that if we ever want to do type-based alias analysis, we can still avoid casted accesses. (If we do type-based alias analysis, we'll also need to make a union access do a cast. Which we probably should do anyway).
* Don't go off into infinite loops when some undefined programLinus Torvalds2005-04-071-0/+7
| | | | | | updates a variable where the only def is the update itself. Testcase from Alexey Dobriyan
* Start using instruction sizes properly.Linus Torvalds2005-04-071-1/+1
| | | | | | | | | | We should drop symbol types by now, and base things on just raw sizes. Anything else just doesn't work from a CSE standpoint. Some things may care about actual types later, notably the type- based alias analysis. Those types still exist in the cast nodes. Also, make the printout be more readable.
* Make list-ptr remove/replace take a count.Linus Torvalds2005-04-071-3/+1
| | | | | | It will assrt if it can't find that many entries. Zero means "all the ones you can find", aka old behaviour.
* Expose the "trivial common parent" logic that we use for phiLinus Torvalds2005-04-071-2/+12
| | | | | | node re-writing. We'll want to do it for CSE too.
* Teach 'memop' simplification about offsetting.Linus Torvalds2005-04-071-0/+19
| | | | | Handle simple constant offsets and fold them into the memop offset.
* Simplify constant subtraction into addition.Linus Torvalds2005-04-071-1/+8
| | | | | We're much better at simplifying addition, so let's try to fix it up.
* Add some more trivial constant simplifications.Linus Torvalds2005-04-071-0/+14
|
* Clean up the tests for "pseudo has use list", since add/removeLinus Torvalds2005-04-071-1/+1
| | | | has to agree on it or bad things happen.
* Make the CSE "repeat" logic be more fine-grained than justLinus Torvalds2005-04-071-15/+26
| | | | | | | | repeating CSE itself. In particular, some symbol address simplifications imply that we should repeat symbol simplification, since things may have improved.
* Handle killing of usage chains.Linus Torvalds2005-04-071-18/+46
| | | | | | | | When done carefully, this allows us to rewrite pseudo usage, as long as we make sure to fix up all the usage chains. In particular, we can now simplify memops and turn an access of a symbol through a pointer into a direct symbol access.
* More instruction kill care, making sure the use chainsLinus Torvalds2005-04-071-2/+5
| | | | | | | are emptied, allowing us to kill yet more instructions. This should get rid of a number of remaining orphan phi-source instructions.
* Be more thorough about killing unreachable instructions.Linus Torvalds2005-04-071-6/+6
| | | | | We want to make sure that we kill them properly, so that any pseudos they depended on or generated are also killed.