summaryrefslogtreecommitdiff
path: root/lib/Analysis/SparsePropagation.cpp
Commit message (Collapse)AuthorAge
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-22
| | | | | | | | | | definition below all the header #include lines, lib/Analysis/... edition. This one has a bit extra as there were *other* #define's before #include lines in addition to DEBUG_TYPE. I've sunk all of them as a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206843 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-15
| | | | | | instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206243 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires a number of steps. 1) Move value_use_iterator into the Value class as an implementation detail 2) Change it to actually be a *Use* iterator rather than a *User* iterator. 3) Add an adaptor which is a User iterator that always looks through the Use to the User. 4) Wrap these in Value::use_iterator and Value::user_iterator typedefs. 5) Add the range adaptors as Value::uses() and Value::users(). 6) Update *all* of the callers to correctly distinguish between whether they wanted a use_iterator (and to explicitly dig out the User when needed), or a user_iterator which makes the Use itself totally opaque. Because #6 requires churning essentially everything that walked the Use-Def chains, I went ahead and added all of the range adaptors and switched them to range-based loops where appropriate. Also because the renaming requires at least churning every line of code, it didn't make any sense to split these up into multiple commits -- all of which would touch all of the same lies of code. The result is still not quite optimal. The Value::use_iterator is a nice regular iterator, but Value::user_iterator is an iterator over User*s rather than over the User objects themselves. As a consequence, it fits a bit awkwardly into the range-based world and it has the weird extra-dereferencing 'operator->' that so many of our iterators have. I think this could be fixed by providing something which transforms a range of T&s into a range of T*s, but that *can* be separated into another patch, and it isn't yet 100% clear whether this is the right move. However, this change gets us most of the benefit and cleans up a substantial amount of code around Use and User. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203364 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:Stepan Dyatkovskiy2012-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*". ConstCaseIt is just a read-only iterator. CaseIt is read-write iterator; it allows to change case successor and case value. Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters. Main way of iterator usage looks like this: SwitchInst *SI = ... // intialize it somehow for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) { BasicBlock *BB = i.getCaseSuccessor(); ConstantInt *V = i.getCaseValue(); // Do something. } If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method. If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method. There are also related changes in llvm-clients: klee and clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8
* SwitchInst refactoring.Stepan Dyatkovskiy2012-02-01
| | | | | | | | | | | | | | | | | | | | The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want. What was done: 1. Changed semantics of index inside the getCaseValue method: getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous. 2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned. 3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment. 4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst. 4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor. 4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor. Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149481 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove all remaining uses of Value::getNameStr().Benjamin Kramer2011-11-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144648 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert debug messages to use dbgs(). Generally this meansDavid Greene2009-12-23
| | | | | | | s/errs/dbgs/g except for certain special cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92068 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate unnecessary LLVMContexts.Dan Gohman2009-12-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91729 91177308-0d34-0410-b5e6-96231b3b80d8
* rename indbr -> indirectbr to appease the residents of #llvm.Chris Lattner2009-10-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85351 91177308-0d34-0410-b5e6-96231b3b80d8
* make the build build.Chris Lattner2009-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85319 91177308-0d34-0410-b5e6-96231b3b80d8
* Random updates to passes for indbr, I need blockaddress before I can do much ↵Chris Lattner2009-10-27
| | | | | | more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85316 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment explaining why you would ever want to do this.Nick Lewycky2009-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82319 91177308-0d34-0410-b5e6-96231b3b80d8
* Lett users of sparse propagation do their own thing with phi nodes if they wantNick Lewycky2009-09-19
| | | | | | | | to. This can be combined with LCSSA or SSI form to store more information on a PHINode than can be computed by looking at its incoming values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82317 91177308-0d34-0410-b5e6-96231b3b80d8
* Add newlines.Nick Lewycky2009-09-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82206 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate the "Value" printing methods that print to a std::ostream.Chris Lattner2009-08-23
| | | | | | | This required converting a bunch of stuff off DOUT and other cleanups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79819 91177308-0d34-0410-b5e6-96231b3b80d8
* Move getTrue() and getFalse() to 2.5-like APIs.Owen Anderson2009-07-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77685 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove Value::getName{Start,End}, the last of the old Name APIs.Daniel Dunbar2009-07-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77152 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getConstantInt{True|False} to get{True|False} at Chris' behest.Owen Anderson2009-07-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76598 91177308-0d34-0410-b5e6-96231b3b80d8
* Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's ↵Owen Anderson2009-07-06
| | | | | | through the ValueTracking API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74873 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Print callable from a pass's print method: add const qualifier. NoTorok Edwin2009-03-11
| | | | | | | functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66700 91177308-0d34-0410-b5e6-96231b3b80d8
* "This patch adds a virtual call to AbstractLatticeFunction to derive a Chris Lattner2008-08-09
| | | | | | | | | | | type lattice value for an Argument*, giving clients the opportunity to use something other than Top for it if they choose to." Patch by John McCall! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54589 91177308-0d34-0410-b5e6-96231b3b80d8
* Use Function::getEntryBlock instead of Function::begin, for clarity.Dan Gohman2008-05-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51613 91177308-0d34-0410-b5e6-96231b3b80d8
* Print debug output when any edge becomes executable, includingDan Gohman2008-05-27
| | | | | | | the first visited edge. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51612 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a bool to isEdgeFeasible that tells it whether to treat unknownChris Lattner2008-05-20
| | | | | | | value as undef or untracked. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51295 91177308-0d34-0410-b5e6-96231b3b80d8
* prune #includes.Chris Lattner2008-05-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50962 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new SparsePropagation analysis utility, which allows you to doChris Lattner2008-05-12
SCCP like sparse lattice analysis with relative ease. Just pick your lattice function and implement the transfer function and you're good. Just make sure you don't break monotonicity ;-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50961 91177308-0d34-0410-b5e6-96231b3b80d8