Commit Graph

118 Commits

Author SHA1 Message Date
Chris Lattner
fcdd82e4a9 Change this method to return ulong, not uint, for 64-bit targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18906 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 19:48:51 +00:00
Reid Spencer
574cdb32a0 Revert the recent patches to "fix" ConstantFP::isValueValidForType. None
of them seem to work everywhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18598 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-07 07:38:08 +00:00
Reid Spencer
e2432596ac Provide a missing header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18597 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-07 07:08:08 +00:00
Reid Spencer
79457c791e Fix some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18596 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-07 07:06:47 +00:00
Alkis Evlogimenos
eb61d60e1b Fix check for valid floats. Also use and HUGE_VALF instead
of std::numeric_limits, because they work in more platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18593 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-07 06:46:50 +00:00
Reid Spencer
b9ce8b3f1b For PR409: \
Test the range of float constants to ensure we are not attempting to create a \
float constant using a double value that is out of range for a float


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18585 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-06 22:18:37 +00:00
Chris Lattner
8a7ad2d2c5 Add hooks to free all memory allocated by the singleton factories in these
files.  Patch contributed by Morten Ofstad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17995 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 16:39:44 +00:00
Alkis Evlogimenos
56a2468b68 Gep indices must be of int, uint, long or ulong type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17313 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-28 06:43:38 +00:00
Alkis Evlogimenos
6edde961e2 Make this actually work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17199 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-24 03:02:16 +00:00
Alkis Evlogimenos
60ab140298 Add ConstantExpr::getSizeOf(Type*).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17196 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-24 01:41:10 +00:00
Chris Lattner
b9f18592a6 Implement UndefValue class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17040 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:07:16 +00:00
Chris Lattner
7fa6e666ec Allow creation of GEP constantexprs with a vector of value* operands as
well as a vector of constant*'s.  It turns out that this is more efficient
and all of the clients want to do that, so we should cater to them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16923 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 22:52:25 +00:00
Alkis Evlogimenos
e0de1d64be When creating constant arrays check that the initializer vector is the
same size as the one in the array type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16354 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-15 02:32:15 +00:00
Alkis Evlogimenos
cad90ad162 Add assertion descriptiosn on type mismatches when creating
ConstantArray and ConstantPacked objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16261 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-10 04:16:59 +00:00
Reid Spencer
551ccae044 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-01 22:55:40 +00:00
Brian Gaeke
715c90ba52 Packed types, brought to you by Brad Jones
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15938 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-20 06:00:58 +00:00
Chris Lattner
91b362bba9 Check constant expression validity more strictly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15883 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-17 17:28:46 +00:00
Chris Lattner
d2da229ce3 Add a hack to work around a problem my changes exposed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15509 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 22:26:13 +00:00
Chris Lattner
c3d12f0823 Fix a latent bug exposed by my recent changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15498 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 18:50:09 +00:00
Alkis Evlogimenos
9e4c681354 Stop using getValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15482 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 08:02:59 +00:00
Chris Lattner
6823c9f9ff Implement a FIXME, by not searching linearly through a map to remove an
element.  This speeds up the bytecode reader from 12.86s to 8.72s on 252.eon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15463 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 04:48:01 +00:00
Misha Brukman
47b14a4a6a Fix #includes of i*.h => Instructions.h as per PR403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15334 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 17:30:56 +00:00
Chris Lattner
ab4c19ec3e classof implementations are now inlined
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14987 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-19 00:59:10 +00:00
Reid Spencer
1c9c8e64d2 bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
- Delete ConstantPointerRef member function implementations


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14928 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-17 23:48:33 +00:00
Chris Lattner
b370c7a41a implement new helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14776 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:35:11 +00:00
Reid Spencer
57f6efc095 #include <iostream> since its not in Value.h any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14614 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 11:51:24 +00:00
Chris Lattner
c2dfb8bb90 Make ConstantBool act like a 1 bit ConstantInt, in order to simplify client
code.  Patch contributed by Vladimir Prus.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14280 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-21 12:12:12 +00:00
Chris Lattner
f70c22b019 Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 18:19:28 +00:00
Chris Lattner
2a5020150c Workaround or a VS miscompilation bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14078 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-08 23:21:39 +00:00
Chris Lattner
20924bc3dd Delete some unreachable code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14031 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-04 23:52:36 +00:00
Chris Lattner
c971025b01 Implement some helpers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13738 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-25 05:32:43 +00:00
Chris Lattner
d144f42a5a Add ConstantExpr::get(Sign|Zero)Extend methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12648 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-04 23:20:30 +00:00
Chris Lattner
4b2f08a3a9 Add support for constant expr casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12564 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-31 02:56:11 +00:00
Chris Lattner
92e84229e1 Fix a latent bug in select constantexpr handling that was broke 253.perlbmk
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12562 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-30 22:51:03 +00:00
Chris Lattner
d25e3ecb3c Handle -0.0 correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12530 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-29 19:51:24 +00:00
Chris Lattner
4dcb5401e4 Add a bunch of methods that should have been added a long time ago.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12526 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-29 02:37:53 +00:00
Chris Lattner
08a45cc2ff Add support for select constant expressions. Use reserve a bit more to avoid
memory wasteage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12323 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:54:04 +00:00
Chris Lattner
2296ec0ce9 Eliminate nightmarish API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12214 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-08 06:11:10 +00:00
Chris Lattner
2e9bb1a88e Move the folding of gep null, 0, 0, 0 to a place where it can be shared and
enjoyed by all, fixing a fixme.  Add an assert


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11505 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 20:46:13 +00:00
Chris Lattner
40bbeb5d07 Add a new ConstantAggregateZero class, to fix PR239. This makes zero
initializers for constant structs and arrays take constant space, instead of
space proportinal to the number of elements.  This reduces the memory usage of
the LLVM compiler by hundreds of megabytes when compiling some nasty SPEC95
benchmarks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11470 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:53:04 +00:00
Chris Lattner
ca705fa31d ConstantArray::get and ConstantStruct::get now just return pointers to
'Constant', instead of specific subclass pointers.  In the future, these will
return an instance of ConstantAggregateZero if all of the inputs are zeros.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11467 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:14:47 +00:00
Chris Lattner
04d1fb6df9 Remove dependence on return type of ConstantStruct::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11466 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:07:32 +00:00
Chris Lattner
371064481a Remove dependence on the return type of ConstantArray::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11463 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:05:58 +00:00
Chris Lattner
aab54da21c Keep a cache of non-abstract null arrays and structs. This speeds up llvm-dis
from 16.57 -> 13.46s on 129.compress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11462 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 02:46:46 +00:00
Chris Lattner
d21cd809b6 Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11228 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 04:37:31 +00:00
Chris Lattner
cfdf2419bc Second half of a fix for PR218 & test/Regression/Assembler/2004-02-01-NegativeZero.llx.
Basically we store floating point values as their integral components, instead of relying
on the semantics of floating point < to differentiate between values.  This is likely to
make the map search be faster anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-01 22:49:04 +00:00
Chris Lattner
90fb19ed2c Fix a problem brian ran into with the bytecode reader asserting. It turns
out that the problem was actually the writer writing out a 'null' value
because it didn't normalize it.  This fixes:
test/Regression/Assembler/2004-01-22-FloatNormalization.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10967 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-23 00:55:21 +00:00
Chris Lattner
7aa162b29b Fix bug in previous checkin: Demorgan would be ashamed of me, I need to
lay off the crack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10855 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 17:51:53 +00:00
Chris Lattner
13cfdea1ef Implement ConstantArray::isString
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10851 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 17:06:38 +00:00
Chris Lattner
cbfd406541 Rename ConstantHandling.* -> ConstantFolding.*
Move a bunch of (now) private stuff from ConstantFolding.h into
ConstantFolding.cpp.

This _finally_ gets us to a place where we have a sane constant folder.  The
rules are:

1. LLVM clients now use ConstantExpr::get* methods to fold constants.  If they
   cannot be folded, a constantexpr is created, so these methods always return
   valid Constant*'s.
2. The implementation of ConstantExpr::get* uses the functions exposed by
   ConstantFolding.h to try to fold constants.  If they cannot be folded,
   they should return a null pointer.
3. The implementation of ConstantFolding can do whatever it wants, and only
   has one client (Constants.cpp)

This cuts down on the wierd dependencies, and eliminates the two interfaces.
The old constanthandling interface was especially bad for clients to use
because almost none of them took the failure condition into consideration,
thus leading to obscure problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 21:13:12 +00:00