aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Constants.cpp
Commit message (Collapse)AuthorAgeFilesLines
* add a Constant::getAllOnesValue helper function, which works on integersChris Lattner2007-06-151-0/+5
| | | | | | | AND vectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37586 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor comment cleanups.Dan Gohman2007-05-241-5/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37321 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as aReid Spencer2007-03-191-2/+2
| | | | | | | negative number. This is needed to fix test/Assembler/2007-03-19-NegValue.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35181 91177308-0d34-0410-b5e6-96231b3b80d8
* Added ContainsRelocations() to check if a constant might only be resolvable ↵Evan Cheng2007-03-081-0/+11
| | | | | | at load time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35014 91177308-0d34-0410-b5e6-96231b3b80d8
* Drop the ConstantInt(const Type&, const APInt&) constructor. It isReid Spencer2007-03-011-14/+9
| | | | | | | redundant and more verbose than the ConstantInt(const APInt&) constructor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34792 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a convenience method to construct a ConstantInt directly from anReid Spencer2007-02-281-0/+4
| | | | | | | | APInt. The implied type is the integer type that corresponds to the bit width of the APInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34757 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some redundancy.Reid Spencer2007-02-271-4/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34702 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct the implelmentation of ConstantInt::getAllOnesValue() for bitReid Spencer2007-02-271-1/+1
| | | | | | | widths > 64 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34663 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantFolding.cpp/h -> ConstantFold.cpp/h to avoid confusion withChris Lattner2007-02-271-1/+1
| | | | | | | lib/Analysis/ConstantFolding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34653 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1205:Reid Spencer2007-02-261-16/+49
| | | | | | | | | | | Implement the first step towards arbitrary precision integer support in LLVM. The APInt class provides arbitrary precision arithmetic and value representation. This patch changes ConstantInt to use APInt as its value representation without supporting bit widths > 64 yet. That change will come after ConstantFolding handles bit widths > 64 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34647 91177308-0d34-0410-b5e6-96231b3b80d8
* This cast broke lots of tests.Evan Cheng2007-02-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34457 91177308-0d34-0410-b5e6-96231b3b80d8
* switch ConstantFP's from ValueMap to DenseMap, which is much faster to queryChris Lattner2007-02-201-51/+59
| | | | | | | and is more memory efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34446 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanup ConstantInt to use a single DenseMap for uniquing instead of theChris Lattner2007-02-201-50/+63
| | | | | | | | heavy-weight ValueMap class. This reduces mem usage bc reading kc++ by 29K, even though it only creates 2955 constant ints! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34445 91177308-0d34-0410-b5e6-96231b3b80d8
* Make ConstantInt::getTrue/getFalse be llvm_shutdown safe.Chris Lattner2007-02-201-5/+24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34443 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up the internals of the ConstantInt machineryChris Lattner2007-02-201-9/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34441 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify some code that was not llvm_shutdown safeChris Lattner2007-02-201-36/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34440 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm-gcc issue fixed, revert reversal :)Chris Lattner2007-02-191-20/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34425 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily reverting the patch. It's breaking llvm-gcc build.Evan Cheng2007-02-191-15/+20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34423 91177308-0d34-0410-b5e6-96231b3b80d8
* remove dead methodsChris Lattner2007-02-191-20/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34419 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1195:Reid Spencer2007-02-151-6/+6
| | | | | | | | Change use of "packed" term to "vector" in comments, strings, variable names, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34300 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1195:Reid Spencer2007-02-151-39/+39
| | | | | | | | Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and PackedTyID -> VectorTyID. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
* A value of 64 or fewer bits is valid if the ConstantInt has more then 64 bits.Reid Spencer2007-02-051-4/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33942 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR411:Reid Spencer2007-02-051-1/+1
| | | | | | | | | | | This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
* Changes to support making the shift instructions be true BinaryOperators.Reid Spencer2007-02-021-35/+2
| | | | | | | | | | | | | This feature is needed in order to support shifts of more than 255 bits on large integer types. This changes the syntax for llvm assembly to make shl, ashr and lshr instructions look like a binary operator: shl i32 %X, 1 instead of shl i32 %X, i8 1 Additionally, this should help a few passes perform additional optimizations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
* Revise APIs for creating constantexpr GEPs to not require the use of vectors.Chris Lattner2007-01-311-22/+19
| | | | | | | This allows us to eliminate many temporary vectors, and theirassociated malloc/free pairs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33692 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up comments and assert messages that still refer to the old type names.Reid Spencer2007-01-261-12/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33520 91177308-0d34-0410-b5e6-96231b3b80d8
* Whoops, fix typo in last commit.Reid Spencer2007-01-211-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33417 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR970:Reid Spencer2007-01-211-4/+17
| | | | | | | | Clean up handling of isFloatingPoint() and dealing with PackedType. Patch by Gordon Henriksen! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33415 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1043:Reid Spencer2007-01-191-2/+2
| | | | | | | | | | | | | | | This is the final patch for this PR. It implements some minor cleanup in the use of IntegerType, to wit: 1. Type::getIntegerTypeMask -> IntegerType::getBitMask 2. Type::Int*Ty changed to IntegerType* from Type* 3. ConstantInt::getType() returns IntegerType* now, not Type* This also fixes PR1120. Patch by Sheng Zhou. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
* rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.Chris Lattner2007-01-151-24/+24
| | | | | | | | | | rename Type::getIntegralTypeMask to Type::getIntegerTypeMask. This makes naming much more consistent. For example, there are now no longer any instances of IntegerType that are not considered isInteger! :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
* don't discriminate against i1Chris Lattner2007-01-151-9/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33213 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow isAllOnesValue testing on packed constantsJim Laskey2007-01-121-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33146 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1064:Reid Spencer2007-01-121-45/+50
| | | | | | | | | | | | | | | | | | | | | | | | Implement the arbitrary bit-width integer feature. The feature allows integers of any bitwidth (up to 64) to be defined instead of just 1, 8, 16, 32, and 64 bit integers. This change does several things: 1. Introduces a new Derived Type, IntegerType, to represent the number of bits in an integer. The Type classes SubclassData field is used to store the number of bits. This allows 2^23 bits in an integer type. 2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and 64-bit integers. These are replaced with just IntegerType which is not a primitive any more. 3. Adjust the rest of LLVM to account for this change. Note that while this incremental change lays the foundation for arbitrary bit-width integers, LLVM has not yet been converted to actually deal with them in any significant way. Most optimization passes, for example, will still only deal with the byte-width integer types. Future increments will rectify this situation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33113 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement review feedback for the ConstantBool->ConstantInt merge. ChrisReid Spencer2007-01-121-2/+6
| | | | | | | | | recommended that getBoolValue be replaced with getZExtValue and that get(bool) be replaced by get(const Type*, uint64_t). This implements those changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename BoolTy as Int1Ty. Patch by Sheng Zhou.Reid Spencer2007-01-111-12/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR1043:Zhou Sheng2007-01-111-31/+12
| | | | | | | | Merge ConstantIntegral and ConstantBool into ConstantInt. Remove ConstantIntegral and ConstantBool from LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new ConstantPacked::getAllOnesValue methodChris Lattner2007-01-041-0/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32856 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR950:Reid Spencer2006-12-311-75/+36
| | | | | | | Change signed integer type names to unsigned equivalents. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32780 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some comments.Reid Spencer2006-12-241-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32758 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR950:Reid Spencer2006-12-231-40/+25
| | | | | | | | | This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
* Make ConstantInt not care about sign any more. To ensure the AsmParser canReid Spencer2006-12-191-14/+19
| | | | | | | | still check the validity of signed values an overload to isValueValidForType was added to allow passing in an int64_t to check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32663 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the two-argument (inferred cast) form of ConstantExpr::getCast nowReid Spencer2006-12-181-7/+0
| | | | | | | that its last uses have been removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32653 91177308-0d34-0410-b5e6-96231b3b80d8
* Partial unbreak of VC++ (stream stuff has no easy fix).Jeff Cohen2006-12-151-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32614 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace inferred getCast(V,Ty) calls with more strict variants.Reid Spencer2006-12-121-6/+6
| | | | | | | | Rename getZeroExtend and getSignExtend to getZExt and getSExt to match the the casting mnemonics in the rest of LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32514 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't create usless casts for same-bith-width floating point casts.Reid Spencer2006-12-121-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32475 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement getIntegerCast and getFPCast for ConstantExpr. These are similarReid Spencer2006-12-121-0/+23
| | | | | | | to the createIntegerCast and createFPCast for CastInst instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32457 91177308-0d34-0410-b5e6-96231b3b80d8
* Packed StructuresAndrew Lenharth2006-12-081-3/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32361 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide a getOpcode() method on CmpInst to ensure the opcode is returnedReid Spencer2006-12-071-2/+1
| | | | | | | as the right type. Use this to shorten some code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32300 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR950:Reid Spencer2006-12-061-47/+0
| | | | | | | | | | Remove the getMaxValue and getMinValue functions from ConstantIntegral. They don't make sense for a signless type. Also, for isMaxValue and isMinValue, have the caller provided the signedness rather than obtaining it from the constant's type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32287 91177308-0d34-0410-b5e6-96231b3b80d8
* Bail on the getInferredCast idea. Remove the function and convertReid Spencer2006-12-051-8/+8
| | | | | | | remaining uses to more specific casts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32231 91177308-0d34-0410-b5e6-96231b3b80d8