summaryrefslogtreecommitdiff
path: root/include/llvm/Constants.h
Commit message (Collapse)AuthorAge
* In various places throughout the code generator, there were specialUlrich Weigand2012-10-29
| | | | | | | | | | checks to avoid performing compile-time arithmetic on PPCDoubleDouble. Now that APFloat supports arithmetic on PPCDoubleDouble, those checks are no longer needed, and we can treat the type like any other. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166958 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary classof()'sSean Silva2012-10-11
| | | | | | | isa<> et al. automatically infer when the cast is an upcast (including a self-cast), so these are no longer necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165767 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-27
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164768 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164767 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark constructors, destructors, and operator new commented as 'do not ↵Craig Topper2012-09-18
| | | | | | implement' with LLVM_DELETED_FUNCTION instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164091 91177308-0d34-0410-b5e6-96231b3b80d8
* When linearizing a multiplication, return at once if we see a factor of zero,Duncan Sands2012-06-13
| | | | | | | | | | since then the entire expression must equal zero (similarly for other operations with an absorbing element). With this in place a bunch of reassociate code for handling constants is dead since it is all taken care of when linearizing. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158398 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that Reassociate's LinearizeExprTree can look through arbitrary expressionDuncan Sands2012-06-12
| | | | | | | | | | | | | | | | | | topologies, it is quite possible for a leaf node to have huge multiplicity, for example: x0 = x*x, x1 = x0*x0, x2 = x1*x1, ... rapidly gives a value which is x raised to a vast power (the multiplicity, or weight, of x). This patch fixes the computation of weights by correctly computing them no matter how big they are, rather than just overflowing and getting a wrong value. It turns out that the weight for a value never needs more bits to represent than the value itself, so it is enough to represent weights as APInts of the same bitwidth and do the right overflow-avoiding dance steps when computing weights. As a side-effect it reduces the number of multiplies needed in some cases of large powers. While there, in view of external uses (eg by the vectorizer) I made LinearizeExprTree static, pushing the rank computation out into users. This is progress towards fixing PR13021. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158358 91177308-0d34-0410-b5e6-96231b3b80d8
* Efficient Constant Uniquing.Talin2012-02-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149848 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply the patches reverted in r149470 that reenable ConstantDataArray,Chris Lattner2012-02-05
| | | | | | | | | | | but with a critical fix to the SelectionDAG code that optimizes copies from strings into immediate stores: the previous code was stopping reading string data at the first nul. Address this by adding a new argument to llvm::getConstantStringInfo, preserving the behavior before the patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149800 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert Chris' commits up to r149348 that started causing VMCoreTests unit ↵Argyrios Kyrtzidis2012-02-01
| | | | | | | | | | | | | | | | | | | test to fail. These are: r149348 r149351 r149352 r149354 r149356 r149357 r149361 r149362 r149364 r149365 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149470 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate the "string" form of ConstantArray::get, usingChris Lattner2012-01-31
| | | | | | | ConstantDataArray::getString instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149365 91177308-0d34-0410-b5e6-96231b3b80d8
* with recent changes, ConstantArray is never a "string". Remove the associatedChris Lattner2012-01-31
| | | | | | | methods and constant fold the clients to false. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149362 91177308-0d34-0410-b5e6-96231b3b80d8
* Various improvements suggested by DuncanChris Lattner2012-01-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149255 91177308-0d34-0410-b5e6-96231b3b80d8
* initialize the Next field to nullChris Lattner2012-01-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149217 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a ConstantDataVector::getSplatValue() method, for parity withChris Lattner2012-01-26
| | | | | | | | | | | ConstantVector. Fix some outright bugs in the implementation of ConstantArray and Constant struct, which would cause us to not make one big UndefValue when asking for an array/struct with all undef elements. Enhance Constant::isAllOnesValue to work with ConstantDataVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149021 91177308-0d34-0410-b5e6-96231b3b80d8
* constify some methods and add a new Constant::getAggregateElementChris Lattner2012-01-25
| | | | | | | | helper method for the common operation of extracting an element out of a constant aggregate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148931 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply r148901 with a crucial fix.Chris Lattner2012-01-25
| | | | | | | | "Introduce a new ConstantVector::getSplat constructor function to simplify a really common case." git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148924 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r148901 because it crashes llvm tests.Argyrios Kyrtzidis2012-01-25
| | | | | | | | Original log: Introduce a new ConstantVector::getSplat constructor function to simplify a really common case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148906 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new ConstantVector::getSplat constructor function to Chris Lattner2012-01-25
| | | | | | | simplify a really common case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148901 91177308-0d34-0410-b5e6-96231b3b80d8
* Rearrange argument order of ::get methods so that LLVMContext comes first,Chris Lattner2012-01-24
| | | | | | | | | add a ConstantDataArray::getString method that corresponds to the (to be removed) StringRef version of ConstantArray::get, but is dramatically more efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148804 91177308-0d34-0410-b5e6-96231b3b80d8
* add more support for ConstantDataSequentialChris Lattner2012-01-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148802 91177308-0d34-0410-b5e6-96231b3b80d8
* Add AsmPrinter (aka MCLowering) support for ConstantDataSequential, Chris Lattner2012-01-24
| | | | | | | | | and clean up some other misc stuff. Unlike ConstantArray, we will prefer to emit .fill directives for "String" arrays that all have the same value, since they are denser than emitting a .ascii git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148793 91177308-0d34-0410-b5e6-96231b3b80d8
* Add various "string" methods to ConstantDataSequential, which have theChris Lattner2012-01-24
| | | | | | | | | same semantics as ConstantArray's but much more efficient because they don't have to return std::string's. The ConstantArray methods will eventually be removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148792 91177308-0d34-0410-b5e6-96231b3b80d8
* teach valuetracking about ConstantDataSequentialChris Lattner2012-01-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148790 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some accessor methods to CAZ and UndefValue that help simplify clients.Chris Lattner2012-01-24
| | | | | | | Make some CDS methods public. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148785 91177308-0d34-0410-b5e6-96231b3b80d8
* implement the ConstantDataSequential accessor methods.Chris Lattner2012-01-24
| | | | | | | No need for 'getOperand' :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148778 91177308-0d34-0410-b5e6-96231b3b80d8
* start the implementation of a new ConstantDataVector and ConstantDataArrayChris Lattner2012-01-23
| | | | | | | | classes, per PR1324. Not all of their helper functions are implemented, nothing creates them, and the rest of the compiler doesn't handle them yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148741 91177308-0d34-0410-b5e6-96231b3b80d8
* Unweaken vtables as per ↵David Blaikie2011-12-20
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146960 91177308-0d34-0410-b5e6-96231b3b80d8
* Fold ConstantVector::isAllOnesValue into Constant::isAllOnesValue and ↵Benjamin Kramer2011-11-14
| | | | | | simplify it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144555 91177308-0d34-0410-b5e6-96231b3b80d8
* Constify ComparisonDavid Greene2011-08-25
| | | | | | Make ConstantInt::uge() const so it may be used in const contexts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138579 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api.Nadav Rotem2011-08-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138469 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS, folding itsJay Foad2011-08-22
| | | | | | | | functionality into DEFINE_TRANSPARENT_OPERAND_ACCESSORS. A side-effect of this is that the operand accessors for Constants will tolerate NULL operands, fixing PR10663. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138230 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ArrayRef in the (protected) constructors of ConstantArray, ↵Jay Foad2011-07-25
| | | | | | ConstantStruct and ConstantVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135905 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert ConstantExpr::getGetElementPtr andJay Foad2011-07-21
| | | | | | | ConstantExpr::getInBoundsGetElementPtr to use ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135673 91177308-0d34-0410-b5e6-96231b3b80d8
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
* devirtualize Constant::isNullValue:Chris Lattner2011-07-15
| | | | | | | | 4 files changed, 15 insertions(+), 60 deletions(-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135252 91177308-0d34-0410-b5e6-96231b3b80d8
* add CFP::isNegative() and ConstnatInt::isNegative() methods.Chris Lattner2011-07-15
| | | | | | | | Devirtualize the isNegativeZeroValue method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135249 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135040 91177308-0d34-0410-b5e6-96231b3b80d8
* the various ConstantExpr::get*Ty methods existed to work with issues aroundChris Lattner2011-07-09
| | | | | | | type refinement. Zap them now that type refinement is toast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134837 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10210: New method ConstantArray::getAsCString(). Use it in LTO toJay Foad2011-06-28
| | | | | | | avoid getting embedded trailing null bytes in std::strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133999 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the existing forms of ConstantArray::get() with a single formJay Foad2011-06-22
| | | | | | that takes an ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133615 91177308-0d34-0410-b5e6-96231b3b80d8
* Make ConstantVector::get() always take an ArrayRef, never a std::vector.Jay Foad2011-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133614 91177308-0d34-0410-b5e6-96231b3b80d8
* Revamp the "ConstantStruct::get" methods. Previously, these were scatteredChris Lattner2011-06-20
| | | | | | | | | | | | | | | | | all over the place in different styles and variants. Standardize on two preferred entrypoints: one that takes a StructType and ArrayRef, and one that takes StructType and varargs. In cases where there isn't a struct type convenient, we now add a ConstantStruct::getAnon method (whose name will make more sense after a few more patches land). It would be "really really nice" if the ConstantStruct::get and ConstantVector::get methods didn't make temporary std::vectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133412 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9214: Convert ConstantExpr::getIndices() to return an ArrayRef, plusJay Foad2011-04-13
| | | | | | related tweaks to ExprMapKeyType. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129443 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some redundant llvm:: prefixes.Jay Foad2011-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129441 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment.Jay Foad2011-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129440 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9214: Convert ConstantExpr::getWithOperands() to use ArrayRef.Jay Foad2011-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129439 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantInt has some getters which return ConstantInt's or ConstantVector's ofNick Lewycky2011-03-06
| | | | | | | | | the value splatted into every element. Extend this to getTrue and getFalse which by providing new overloads that take Types that are either i1 or <N x i1>. Use it in InstCombine to add vector support to some code, fixing PR8469! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127116 91177308-0d34-0410-b5e6-96231b3b80d8
* test commitJin-Gu Kang2011-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127059 91177308-0d34-0410-b5e6-96231b3b80d8