summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Constants.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* For the NSWSub support in the builder to actually be useable,Duncan Sands2009-09-261-0/+5
| | | | | | | there need to be corresponding changes to the constant folders, done in this patch. llvm-svn: 82862
* Rename ConstantFP's getInf to getInfinity.Dan Gohman2009-09-251-1/+1
| | | | llvm-svn: 82823
* Add a ConstantFP::getInf utility function for creating infinity ConstantFPs.Dan Gohman2009-09-251-0/+6
| | | | llvm-svn: 82818
* When a constant's type is refined, update the constant in placeDan Gohman2009-09-151-50/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | instead of cloning and RAUWing it. - Make AbstractTypeUser a friend of Value so that it can offer its subclasses a way to update a Value's type in place. This is better than a universally visible setType method on Value, and it's sufficient for the immediate need. - Eliminate the constant "convert" functions. This eliminates a lot of logic duplication, and fixes a complicated bug where a constant can't actually be cloned during the type refinement process because some of the types that its folder needs are half-destroyed, being in the middle of refinement themselves. - Move the getValType functions from being static overloaded functions in Constants.cpp to be members of class template specializations in ConstantsContext.h. This means that the code ends up getting instantiated twice, however it also makes it possible to eliminate all "convert" functions, so it's not a big net code size increase. And if desired, the duplicate instantiations could be eliminated with some reorganization. llvm-svn: 81861
* Teach lib/VMCore/ConstantFold.cpp how to set the inbounds keyword andDan Gohman2009-09-111-2/+4
| | | | | | | | | | | | | how to fold notionally-out-of-bounds array getelementptr indices instead of just doing these in lib/Analysis/ConstantFolding.cpp, because it can be done in a fairly general way without TargetData, and because not all constants are visited by lib/Analysis/ConstantFolding.cpp. This enables more constant folding. Also, set the "inbounds" flag when the getelementptr indices are one-past-the-end. llvm-svn: 81483
* Factor out the code for checking that all indices in a getelementptr areDan Gohman2009-09-101-0/+26
| | | | | | | | | within the notional bounds of the static type of the getelementptr (which is not the same as "inbounds") from GlobalOpt into a utility routine, and use it in ConstantFold.cpp to check whether there are any mis-behaved indices. llvm-svn: 81478
* Reappy r80998, now that the GlobalOpt bug that it exposed on MiniSAT is fixed.Dan Gohman2009-09-071-29/+60
| | | | llvm-svn: 81172
* Revert "Include optional subclass flags, such as inbounds, nsw, etc., ...", thisDaniel Dunbar2009-09-061-60/+29
| | | | | | breaks MiniSAT on x86_64. llvm-svn: 81098
* Include optional subclass flags, such as inbounds, nsw, etc., in theDan Gohman2009-09-041-29/+60
| | | | | | | | | | | | | | | | | Constant uniquing tables. This allows distinct ConstantExpr objects with the same operation and different flags. Even though a ConstantExpr "a + b" is either always overflowing or never overflowing (due to being a ConstantExpr), it's still necessary to be able to represent it both with and without overflow flags at the same time within the IR, because the safety of the flag may depend on the context of the use. If the constant really does overflow, it wouldn't ever be safe to use with the flag set, however the use may be in code that is never actually executed. This also makes it possible to merge all the flags tests into a single test. llvm-svn: 80998
* Revert 80959. It isn't sufficient to solve the full problem. And itDan Gohman2009-09-031-0/+35
| | | | | | introduced regressions in the Ocaml bindings tests. llvm-svn: 80969
* Remove the API for creating ConstantExprs with the nsw, nuw, inbounds,Dan Gohman2009-09-031-35/+0
| | | | | | | | | | | | | | | and exact flags. Because ConstantExprs are uniqued, creating an expression with this flag causes all expressions with the same operands to have the same flag, which may not be safe. Add, sub, mul, and sdiv ConstantExprs are usually folded anyway, so the main interesting flag here is inbounds, and the constant folder already knows how to set the inbounds flag automatically in most cases, so there isn't an urgent need for the API support. This can be reconsidered in the future, but for now just removing these API bits eliminates a source of potential trouble with little downside. llvm-svn: 80959
* Now Bitcode reader bug is fixed. Reapply 80839.Devang Patel2009-09-031-2/+2
| | | | | | | | Use CallbackVH, instead of WeakVH, to hold MDNode elements. Use FoldingSetNode to unique MDNodes in a context. Use CallbackVH hooks to update context's MDNodeSet appropriately. llvm-svn: 80868
* Revert 80839 for now. It causes test failures.Devang Patel2009-09-021-2/+2
| | | | llvm-svn: 80841
* Use CallbackVH, instead of WeakVH, to hold MDNode elements. Devang Patel2009-09-021-2/+2
| | | | | | | Use FoldingSetNode to unique MDNodes in a context. Use CallbackVH hooks to update context's MDNodeSet appropriately. llvm-svn: 80839
* switch a couple things off std::ostreamChris Lattner2009-08-231-5/+7
| | | | llvm-svn: 79816
* Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrapDan Gohman2009-08-201-1/+1
| | | | | | and hasNoSignedWrap, for consistency with the nuw and nsw properties. llvm-svn: 79539
* Add helper functions to ConstantInt and ConstantFP to accept strings.Erick Tryzelaar2009-08-161-0/+21
| | | | llvm-svn: 79212
* Add a getOffsetOf, for building a target-independent expression forDan Gohman2009-08-161-0/+12
| | | | | | offsetof, similar to getSizeOf for sizeof. llvm-svn: 79208
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-32/+39
| | | | llvm-svn: 78948
* Add convenience functions for creating nsw add operators.Dan Gohman2009-08-111-0/+9
| | | | llvm-svn: 78707
* Don't set the isexact flag if an sdiv operator has been folded intoDan Gohman2009-08-111-1/+4
| | | | | | something else. llvm-svn: 78702
* Simplify ConstantExpr::getInBoundsGetElementPtr and fix a possible crash, ifDaniel Dunbar2009-08-111-8/+5
| | | | | | | constant folding eliminated the GEP instruction. - clang was hitting this on its test suite (for x86_64, at least). llvm-svn: 78698
* Add convenience functions for creating inbounds GEPs.Dan Gohman2009-08-111-0/+20
| | | | llvm-svn: 78695
* Add convenience functions for creating exact sdiv operators, andDan Gohman2009-08-111-0/+6
| | | | | | use them in CreatePtrDiff. llvm-svn: 78682
* Change the MDNode uniquing to a ValueMap, at Devang's request.Owen Anderson2009-08-101-2/+2
| | | | llvm-svn: 78577
* Privatize the StructType table, which unfortunately involves routing ↵Owen Anderson2009-08-051-5/+8
| | | | | | contexts through a number of APIs. llvm-svn: 78258
* Privatize the last bit of Constant-creation state.Owen Anderson2009-08-041-425/+29
| | | | llvm-svn: 78097
* Add a new Constant::getIntegerValue helper function, and convert aDan Gohman2009-08-031-0/+17
| | | | | | | few places in InstCombine to use it, to fix problems handling pointer types. This fixes the recent llvm-gcc bootstrap error. llvm-svn: 78005
* Privatize all but one of the remaining constant tables.Owen Anderson2009-07-311-55/+4
| | | | llvm-svn: 77748
* Move a few more APIs back to 2.5 forms. The only remaining ones left to ↵Owen Anderson2009-07-311-10/+48
| | | | | | | | change back are metadata related, which I'm waiting on to avoid conflicting with Devang. llvm-svn: 77721
* Move getTrue() and getFalse() to 2.5-like APIs.Owen Anderson2009-07-311-13/+31
| | | | llvm-svn: 77685
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-8/+19
| | | | llvm-svn: 77635
* Move types back to the 2.5 API.Owen Anderson2009-07-291-1/+1
| | | | llvm-svn: 77516
* Move ConstantExpr to 2.5 API.Owen Anderson2009-07-291-0/+121
| | | | llvm-svn: 77494
* Rename MDNode.h header. It defines MDnode and other metadata classes.Devang Patel2009-07-281-30/+0
| | | | | | New name is Metadata.h. llvm-svn: 77370
* Return ConstantVector to 2.5 API.Owen Anderson2009-07-281-7/+54
| | | | llvm-svn: 77366
* Change ConstantArray to 2.5 API.Owen Anderson2009-07-281-5/+132
| | | | llvm-svn: 77347
* Move ConstantStruct back to 2.5 API.Owen Anderson2009-07-271-4/+94
| | | | llvm-svn: 77266
* Unbreak build.Daniel Dunbar2009-07-271-2/+0
| | | | llvm-svn: 77256
* Move ConstantFP construction back to the 2.5-ish API.Owen Anderson2009-07-271-0/+81
| | | | llvm-svn: 77247
* Revert the ConstantInt constructors back to their 2.5 forms where possible, ↵Owen Anderson2009-07-241-269/+67
| | | | | | thanks to contexts-on-types. More to come. llvm-svn: 77011
* make Constant::getRelocationInfo return an enum, as suggested by Duncan.Chris Lattner2009-07-241-11/+12
| | | | llvm-svn: 76938
* Privatize the ConstantVector tables.Owen Anderson2009-07-241-57/+3
| | | | llvm-svn: 76922
* Privatize the ConstantStruct table.Owen Anderson2009-07-231-92/+4
| | | | llvm-svn: 76912
* Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into ↵Devang Patel2009-07-231-9/+2
| | | | | | METADATA_BLOCK in bitcode file. llvm-svn: 76834
* Introduce MetadataBase, a base class for MDString and MDNode.Devang Patel2009-07-221-12/+0
| | | | | | | Derive MDString directly from MetadataBase. Introduce new bitcode block to hold metadata. llvm-svn: 76759
* reimplement Constant::ContainsRelocations as Chris Lattner2009-07-221-23/+24
| | | | | | | | | Constant::getRelocationInfo(), which has a much simpler to use API. It still should not be part of libvmcore, but is better than it was. Also teach it to be smart about hidden visibility. llvm-svn: 76700
* Privatize the ConstantArray table.Owen Anderson2009-07-211-121/+5
| | | | llvm-svn: 76639
* Privatize the first of the value maps.Owen Anderson2009-07-211-44/+7
| | | | llvm-svn: 76634
* Move a bit more state over to the LLVMContext.Owen Anderson2009-07-211-22/+0
| | | | llvm-svn: 76533
OpenPOWER on IntegriCloud