Commit Graph

262 Commits

Author SHA1 Message Date
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Nate Begeman
6fd90ce2ee Fix build breakage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50986 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 19:23:22 +00:00
Nate Begeman
ac80ade158 Add two new instructions to the llvm IR, vicmp and vfcmp. see updated LangRef
for details.  CodeGen support coming in a follow up patch


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 19:01:56 +00:00
Gabor Greif
efe65369a7 merge of use-diet branch to trunk
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-10 08:32:32 +00:00
Chris Lattner
288e78fbe7 add a simplified accessor for creating an fp constant of a
particular value but variable type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49416 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 06:38:30 +00:00
Chris Lattner
4592230265 add a version of ConstantFP::get that doesn't take a redundant Type* value,
start migrating code over to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49413 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 00:45:01 +00:00
Gabor Greif
c024cbca22 fix a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49282 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 21:42:13 +00:00
Gabor Greif
051a950000 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 20:25:17 +00:00
Duncan Sands
66a1a05c86 Fix comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48967 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-30 19:38:55 +00:00
Dan Gohman
b3f5cfc670 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 02:30:40 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Christopher Lamb
43ad6b3e0d Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:12:55 +00:00
Christopher Lamb
fe63fb986d Implement address space attribute for LLVM pointer types. Address spaces are
regions of memory that have a target specific relationship, as described in the 
Embedded C Technical Report. 

This also implements the 2007-12-11-AddressSpaces test, 
which demonstrates how address space attributes can be used in LLVM IR.

In addition, this patch changes the bitcode signature for stores (in a backwards 
compatible manner), such that the pointer type, rather than the pointee type, is 
encoded. This permits type information in the pointer (e.g. address space) to be 
preserved for stores.

LangRef updates are forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 08:59:05 +00:00
Gordon Henriksen
afba8fe662 Reverting dtor devirtualization patch.
_sabre_: it has a major problem: by the time ~Value is run, all of the "parts" of the derived classes have been destroyed
_sabre_: the vtable lives to fight another day

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44760 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 02:14:30 +00:00
Gordon Henriksen
ed455c8fa2 Devirtualizing Value destructor (PR889). Patch by Pawel Kunio!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 22:46:10 +00:00
Nate Begeman
b348d18caf Add support for vectors to int <-> float casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44204 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-17 03:58:34 +00:00
Chris Lattner
e41dcdc964 Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
(in hindsight) infinite recursion.  Simplify the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 02:30:35 +00:00
Chris Lattner
b7daa84a35 this doesn't need dynamic_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43133 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 16:26:24 +00:00
Dan Gohman
3b7cf0aaba Define a helper function ConstantVector::getSplatValue for testing for
and working with broadcasted constants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17 17:51:30 +00:00
Dale Johannesen
a471c2ecda Next PPC long double bits. First cut at constants.
No compile-time support for constant operations yet,
just format transformations.  Make readers and
writers work.  Split constants into 2 doubles in
Legalize.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42865 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 18:07:22 +00:00
Gordon Henriksen
4647569fe7 Adding C and Ocaml bindings for ConstantExpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42696 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 14:29:36 +00:00
Chris Lattner
76c1b97e40 Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42042 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 18:34:04 +00:00
Dale Johannesen
9e3d3abd93 Remove the assumption that FP's are either float or
double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41967 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 22:26:36 +00:00
Dale Johannesen
9d5f456077 Revise previous patch per review comments.
Next round of x87 long double stuff.
Getting close now, basically works.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41875 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12 03:30:33 +00:00
Dale Johannesen
43421b3dd7 Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double.  Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06 18:13:44 +00:00
David Greene
b8f74793b9 Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41697 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-04 15:46:09 +00:00
Dale Johannesen
f04afdbb48 Change LegalFPImmediates to use APFloat.
Add APFloat interfaces to ConstantFP, SelectionDAG.
Fix integer bit in double->APFloat conversion.
Convert LegalizeDAG to use APFloat interface in
ConstantFPSDNode uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41587 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30 00:23:21 +00:00
Dale Johannesen
12595d7b16 Poison APFloat::operator==. Replace existing uses with bitwiseIsEqual.
This means backing out the preceding change to Constants.cpp, alas.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41378 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 22:09:56 +00:00
Dale Johannesen
d3b51fd170 Revised per review feedback from previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41353 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 05:08:11 +00:00
Dale Johannesen
343e770983 Change internal representation of ConstantFP to use APFloat.
Interface to rest of the compiler unchanged, as yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41348 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 00:56:33 +00:00
Chris Lattner
5498405e2d Fix potentially N^2 behavior handling arrays with many of the
same value which get RAUW'd.  This speeds up reading the .bc
file in PR1616 from 852s to 0.19s on my G5 with a debug build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41209 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 00:55:23 +00:00
Dale Johannesen
ebbc95da49 Patch 10 for long double. Doing constants right needs expanding ConstantFP
to handle values bigger than double.  If we assume host==target and host
long double works correctly, this is not too bad, but we don't want to
have that limitation longterm.  I could implement accepting double
constants as long double or something like that, which would lead to
incorrect codegen with no errors; the more I think about that the worse
it seems.  Rather than do such a hack that would be backed out later,
I'm settling for giving reasonable error messages, for now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 22:51:36 +00:00
Chris Lattner
cef4b53a3e add a Constant::getAllOnesValue helper function, which works on integers
AND vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37586 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 06:10:53 +00:00
Dan Gohman
fa73ea2d9f Minor comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37321 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 14:36:04 +00:00
Reid Spencer
7fc44c8c5f Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as a
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
2007-03-19 20:39:08 +00:00
Evan Cheng
afe1581557 Added ContainsRelocations() to check if a constant might only be resolvable at load time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35014 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 00:59:12 +00:00
Reid Spencer
0050c737c5 Drop the ConstantInt(const Type&, const APInt&) constructor. It is
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
2007-03-01 19:30:34 +00:00
Reid Spencer
f57fc81fae Implement a convenience method to construct a ConstantInt directly from an
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
2007-02-28 19:50:21 +00:00
Reid Spencer
80f8481ef0 Remove some redundancy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34702 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 23:27:26 +00:00
Reid Spencer
8374db81a8 Correct the implelmentation of ConstantInt::getAllOnesValue() for bit
widths > 64 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 07:57:53 +00:00
Chris Lattner
92f6feaf79 ConstantFolding.cpp/h -> ConstantFold.cpp/h to avoid confusion with
lib/Analysis/ConstantFolding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34653 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 03:05:06 +00:00
Reid Spencer
532d0ce208 For PR1205:
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
2007-02-26 23:54:03 +00:00
Evan Cheng
e811636f33 This cast broke lots of tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 21:30:56 +00:00
Chris Lattner
9b4ee0c1bd switch ConstantFP's from ValueMap to DenseMap, which is much faster to query
and is more memory efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 07:17:17 +00:00
Chris Lattner
6b6f6ba66c cleanup ConstantInt to use a single DenseMap for uniquing instead of the
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
2007-02-20 06:39:57 +00:00
Chris Lattner
d1afbd02ef Make ConstantInt::getTrue/getFalse be llvm_shutdown safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 06:11:36 +00:00
Chris Lattner
eb41bddfdf Clean up the internals of the ConstantInt machinery
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:55:46 +00:00
Chris Lattner
e0e769607c simplify some code that was not llvm_shutdown safe
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34440 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:46:39 +00:00
Chris Lattner
f9021ff740 llvm-gcc issue fixed, revert reversal :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34425 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 20:01:23 +00:00
Evan Cheng
e02e5e465b Temporarily reverting the patch. It's breaking llvm-gcc build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34423 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 19:23:41 +00:00