summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instructions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Relax the restrictions on vector of pointer types, and vector getelementptr.Duncan Sands2012-11-131-10/+1
| | | | | | | | | | | | | | | Previously in a vector of pointers, the pointer couldn't be any pointer type, it had to be a pointer to an integer or floating point type. This is a hassle for dragonegg because the GCC vectorizer happily produces vectors of pointers where the pointer is a pointer to a struct or whatever. Vector getelementptr was restricted to just one index, but now that vectors of pointers can have any pointer type it is more natural to allow arbitrary vector getelementptrs. There is however the issue of struct GEPs, where if each lane chose different struct fields then from that point on each lane will be working down into unrelated types. This seems like too much pain for too little gain, so when you have a vector struct index all the elements are required to be the same. llvm-svn: 167828
* Remove a weird static helper from the GEP instruction and just directlyChandler Carruth2012-11-011-12/+0
| | | | | | | | | compute the address space in the one place it was used. Also write the getPointerAddressSpace member in terms of the getPointerOperandType member. llvm-svn: 167226
* Revert the series of commits starting with r166578 which introduced theChandler Carruth2012-11-011-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getIntPtrType support for multiple address spaces via a pointer type, and also introduced a crasher bug in the constant folder reported in PR14233. These commits also contained several problems that should really be addressed before they are re-committed. I have avoided reverting various cleanups to the DataLayout APIs that are reasonable to have moving forward in order to reduce the amount of churn, and minimize the number of commits that were reverted. I've also manually updated merge conflicts and manually arranged for the getIntPtrType function to stay in DataLayout and to be defined in a plausible way after this revert. Thanks to Duncan for working through this exact strategy with me, and Nick Lewycky for tracking down the really annoying crasher this triggered. (Test case to follow in its own commit.) After discussing with Duncan extensively, and based on a note from Micah, I'm going to continue to back out some more of the more problematic patches in this series in order to ensure we go into the LLVM 3.2 branch with a reasonable story here. I'll send a note to llvmdev explaining what's going on and why. Summary of reverted revisions: r166634: Fix a compiler warning with an unused variable. r166607: Add some cleanup to the DataLayout changes requested by Chandler. r166596: Revert "Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this! r166591: Delete a directory that wasn't supposed to be checked in yet. r166578: Add in support for getIntPtrType to get the pointer type based on the address space. llvm-svn: 167221
* Fix isEliminableCastPair to work correctly in the presence of pointersDuncan Sands2012-10-301-5/+6
| | | | | | with different sizes. llvm-svn: 167018
* Add in support for getIntPtrType to get the pointer type based on the ↵Micah Villmow2012-10-241-0/+11
| | | | | | | | | address space. This checkin also adds in some tests that utilize these paths and updates some of the clients. llvm-svn: 166578
* Add an enum for the return and function indexes into the AttrListPtr object. ↵Bill Wendling2012-10-151-4/+6
| | | | | | This gets rid of some magic numbers. llvm-svn: 165924
* Remove the bitwise assignment OR operator from the Attributes class. Replace ↵Bill Wendling2012-10-141-2/+2
| | | | | | it with the equivalent from the builder class. llvm-svn: 165895
* Remove the bitwise NOT operator from the Attributes class. Replace it with ↵Bill Wendling2012-10-141-2/+2
| | | | | | the equivalent from the builder class. llvm-svn: 165892
* Use the attribute enums to query if a function has an attribute.Bill Wendling2012-10-091-92/+6
| | | | llvm-svn: 165551
* Use the attribute enums to query if a parameter has an attribute.Bill Wendling2012-10-091-118/+6
| | | | llvm-svn: 165550
* Create enums for the different attributes.Bill Wendling2012-10-091-60/+62
| | | | | | | We use the enums to query whether an Attributes object has that attribute. The opaque layer is responsible for knowing where that specific attribute is stored. llvm-svn: 165488
* Remove some dead methods.Bill Wendling2012-10-091-16/+0
| | | | llvm-svn: 165485
* Remove more uses of the attribute enums by supplying appropriate query ↵Bill Wendling2012-10-091-0/+100
| | | | | | | | methods for them. No functionality change intended. llvm-svn: 165466
* Add method to query for NoCapture attribute.Bill Wendling2012-10-041-0/+16
| | | | llvm-svn: 165212
* Add method to query for 'NoAlias' attribute on call/invoke instructions.Bill Wendling2012-10-041-0/+16
| | | | llvm-svn: 165208
* Add methods which query for the specific attribute instead of using theBill Wendling2012-10-031-0/+96
| | | | | | enums. This allows for better encapsulation of the Attributes class. llvm-svn: 165132
* Add LLVM_OVERRIDE to methods that override their base classes.Craig Topper2012-09-231-1/+1
| | | | llvm-svn: 164471
* PHINode::hasConstantValue(): return undef if the PHI is fully recursive.Nuno Lopes2012-07-031-0/+2
| | | | | | Thanks Duncan for the idea llvm-svn: 159687
* improve PHINode::hasConstantValue() to detect recursive cases like %phi = ↵Nuno Lopes2012-07-031-2/+6
| | | | | | phi(%phi,42) as constant llvm-svn: 159666
* Fixed r158979.Stepan Dyatkovskiy2012-06-221-3/+17
| | | | | | | | | | Original message: Performance optimizations: - SwitchInst: case values stored separately from Operands List. It allows to make faster access to individual case value numbers or ranges. - Optimized IntItem, added APInt value caching. - Optimized IntegersSubsetGeneric: added optimizations for cases when subset is single number or when subset consists from single numbers only. llvm-svn: 158997
* Revert commit 158979 (dyatkovskiy) since it is causing several buildbots toDuncan Sands2012-06-221-11/+2
| | | | | | | | | | | | | fail. Original commit message: Performance optimizations: - SwitchInst: case values stored separately from Operands List. It allows to make faster access to individual case value numbers or ranges. - Optimized IntItem, added APInt value caching. - Optimized IntegersSubsetGeneric: added optimizations for cases when subset is single number or when subset consists from single numbers only. On my machine these optimizations gave about 4-6% of compile-time improvement. llvm-svn: 158986
* Performance optimizations:Stepan Dyatkovskiy2012-06-221-2/+11
| | | | | | | | | | - SwitchInst: case values stored separately from Operands List. It allows to make faster access to individual case value numbers or ranges. - Optimized IntItem, added APInt value caching. - Optimized IntegersSubsetGeneric: added optimizations for cases when subset is single number or when subset consists from single numbers only. On my machine these optimizations gave about 4-6% of compile-time improvement. llvm-svn: 158979
* ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to ↵Stepan Dyatkovskiy2012-05-291-5/+5
| | | | | | IntegersSubsetMapping. llvm-svn: 157612
* PR1255: Case RangesStepan Dyatkovskiy2012-05-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Implemented IntItem - the wrapper around APInt. Why not to use APInt item directly right now? 1. It will very difficult to implement case ranges as series of small patches. We got several large and heavy patches. Each patch will about 90-120 kb. If you replace ConstantInt with APInt in SwitchInst you will need to changes at the same time all Readers,Writers and absolutely all passes that uses SwitchInst. 2. We can implement APInt pool inside and save memory space. E.g. we use several switches that works with 256 bit items (switch on signatures, or strings). We can avoid value duplicates in this case. 3. IntItem can be easyly easily replaced with APInt. 4. Currenly we can interpret IntItem both as ConstantInt and as APInt. It allows to provide SwitchInst methods that works with ConstantInt for non-updated passes. Why I need it right now? Currently I need to update SimplifyCFG pass (EqualityComparisons). I need to work with APInts directly a lot, so peaces of code ConstantInt *V = ...; if (V->getValue().ugt(AnotherV->getValue()) { ... } will look awful. Much more better this way: IntItem V = ConstantIntVal->getValue(); if (AnotherV < V) { } Of course any reviews are welcome. P.S.: I'm also going to rename ConstantRangesSet to IntegersSubset, and CRSBuilder to IntegersSubsetMapping (allows to map individual subsets of integers to the BasicBlocks). Since in future these classes will founded on APInt, it will possible to use them in more generic ways. llvm-svn: 157576
* Recommited r156374 with critical fixes in BitcodeReader/Writer:Stepan Dyatkovskiy2012-05-121-1/+8
| | | | | | | | Ordinary patch for PR1255. Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object. Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported. llvm-svn: 156704
* Rejected r156374: Ordinary PR1255 patch. Due to clang-x86_64-debian-fnt ↵Stepan Dyatkovskiy2012-05-081-8/+1
| | | | | | buildbot failure. llvm-svn: 156377
* Ordinary patch for PR1255.Stepan Dyatkovskiy2012-05-081-1/+8
| | | | | | | Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object. Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported. llvm-svn: 156374
* Remove support for the special 'fast' value for fpmath accuracy for the moment.Duncan Sands2012-04-161-24/+3
| | | | llvm-svn: 154850
* Make it possible to indicate relaxed floating point requirements at the IR levelDuncan Sands2012-04-161-0/+38
| | | | | | | | | through the use of 'fpmath' metadata. Currently this only provides a 'fpaccuracy' value, which may be a number in ULPs or the keyword 'fast', however the intent is that this will be extended with additional information about NaN's, infinities etc later. No optimizations have been hooked up to this so far. llvm-svn: 154822
* Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:Stepan Dyatkovskiy2012-03-081-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 152297
* Remove dead code. Improve llvm_unreachable text. Simplify some control flow.Ahmed Charles2012-02-191-13/+4
| | | | llvm-svn: 150918
* [unwind removal] Remove all of the code for the dead 'unwind' instruction. ThereBill Wendling2012-02-061-33/+2
| | | | | | | were no 'unwind' instructions being generated before this, so this is in effect a no-op. llvm-svn: 149906
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-051-21/+13
| | | | llvm-svn: 149849
* SwitchInst refactoring.Stepan Dyatkovskiy2012-02-011-11/+9
| | | | | | | | | | | | | | | | | 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. llvm-svn: 149481
* continue making the world safe for ConstantDataVector. At this point,Chris Lattner2012-01-271-4/+2
| | | | | | | we should (theoretically optimize and codegen ConstantDataVector as well as ConstantVector. llvm-svn: 149116
* eliminate the Constant::getVectorElements method. There are better (andChris Lattner2012-01-261-8/+8
| | | | | | | more robust) ways to do what it was doing now. Also, add static methods for decoding a ShuffleVector mask. llvm-svn: 149028
* fix pasto in the new (and still unused) ShuffleVectorInst::getShuffleMask ↵Chris Lattner2012-01-261-1/+1
| | | | | | method. llvm-svn: 149005
* add some helper methods to ShuffleVectorInst and enhance itsChris Lattner2012-01-251-28/+55
| | | | | | | "isValidOperands" and "getMaskValue" methods to allow ConstantDataSequential. llvm-svn: 148998
* use ConstantVector::getSplat in a few places.Chris Lattner2012-01-251-23/+4
| | | | llvm-svn: 148929
* Remove the Type::getNumElements() method, which is only called in 4 places,Chris Lattner2012-01-251-2/+8
| | | | | | | did something extremely surprising, and shadowed actually useful implementations that had completely different behavior. llvm-svn: 148898
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-7/+2
| | | | llvm-svn: 148578
* Add support for vectors of pointers.Nadav Rotem2011-12-051-3/+31
| | | | llvm-svn: 145801
* Add some missing anchors.David Blaikie2011-12-011-0/+2
| | | | llvm-svn: 145578
* The bitcode reader can create an shuffle with a place holder mask which it willMon P Wang2011-10-261-3/+10
| | | | | | | fix up later. For this special case, allow such a mask to be considered valid. <rdar://problem/8622574> llvm-svn: 142992
* Add a routine to swap branch instruction operands, and update anyChandler Carruth2011-10-171-0/+21
| | | | | | | | | | | | profile metadata at the same time. Use it to preserve metadata attached to a branch when re-writing it in InstCombine. Add metadata to the canonicalize_branch InstCombine test, and check that it is tranformed correctly. Reviewed by Nick Lewycky! llvm-svn: 142168
* Change:Richard Trieu2011-09-211-12/+12
| | | | | | | | | | | | assert(!"error message"); To: assert(0 && "error message"); which is more consistant across the code base. llvm-svn: 140234
* Fixes following the CR by Chris and Duncan:Nadav Rotem2011-08-291-8/+11
| | | | | | | Optimize chained bitcasts of the form A->B->A. Undo r138722 and change isEliminableCastPair to allow this case. llvm-svn: 138756
* Initial commit of the 'landingpad' instruction.Bill Wendling2011-08-121-0/+89
| | | | | | | | | | | | This implements the 'landingpad' instruction. It's used to indicate that a basic block is a landing pad. There are several restrictions on its use (see LangRef.html for more detail). These restrictions allow the exception handling code to gather the information it needs in a much more sane way. This patch has the definition, implementation, C interface, parsing, and bitcode support in it. llvm-svn: 137501
* Whitespace.Eli Friedman2011-08-101-1/+1
| | | | llvm-svn: 137226
* Representation of 'atomic load' and 'atomic store' in IR.Eli Friedman2011-08-091-12/+88
| | | | llvm-svn: 137170
OpenPOWER on IntegriCloud