Chris Lattner
302116a5ec
Revise APIs for creating constantexpr GEPs to not require the use of vectors.
...
This allows us to eliminate many temporary vectors, and theirassociated malloc/free pairs.
llvm-svn: 33692
2007-01-31 04:40:28 +00:00
Reid Spencer
2546b76054
Clean up comments and assert messages that still refer to the old type names.
...
llvm-svn: 33520
2007-01-26 07:37:34 +00:00
Reid Spencer
6598ca8ab1
Whoops, fix typo in last commit.
...
llvm-svn: 33417
2007-01-21 02:29:10 +00:00
Reid Spencer
2eadb5310d
For PR970:
...
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!
llvm-svn: 33415
2007-01-21 00:29:26 +00:00
Reid Spencer
a94d394ad2
For PR1043:
...
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.
llvm-svn: 33370
2007-01-19 21:13:56 +00:00
Chris Lattner
03c4953cdd
rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
...
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! :)
llvm-svn: 33225
2007-01-15 02:27:26 +00:00
Chris Lattner
885433b15b
don't discriminate against i1
...
llvm-svn: 33213
2007-01-15 00:45:50 +00:00
Jim Laskey
f047882b15
Allow isAllOnesValue testing on packed constants
...
llvm-svn: 33146
2007-01-12 22:39:14 +00:00
Reid Spencer
7a9c62baa6
For PR1064:
...
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.
llvm-svn: 33113
2007-01-12 07:05:14 +00:00
Reid Spencer
cddc9dfe97
Implement review feedback for the ConstantBool->ConstantInt merge. Chris
...
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.
llvm-svn: 33110
2007-01-12 04:24:46 +00:00
Reid Spencer
542964f55b
Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
...
llvm-svn: 33076
2007-01-11 18:21:29 +00:00
Zhou Sheng
75b871fb1e
For PR1043:
...
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.
llvm-svn: 33073
2007-01-11 12:24:14 +00:00
Chris Lattner
ecab54cfc0
Add a new ConstantPacked::getAllOnesValue method
...
llvm-svn: 32856
2007-01-04 01:49:26 +00:00
Reid Spencer
8d9336d065
For PR950:
...
Change signed integer type names to unsigned equivalents.
llvm-svn: 32780
2006-12-31 05:26:44 +00:00
Reid Spencer
b15374974d
Fix some comments.
...
llvm-svn: 32758
2006-12-24 18:42:29 +00:00
Reid Spencer
266e42b312
For PR950:
...
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.
llvm-svn: 32751
2006-12-23 06:05:41 +00:00
Reid Spencer
e733472221
Make ConstantInt not care about sign any more. To ensure the AsmParser can
...
still check the validity of signed values an overload to isValueValidForType
was added to allow passing in an int64_t to check.
llvm-svn: 32663
2006-12-19 01:28:19 +00:00
Reid Spencer
4800c38a75
Remove the two-argument (inferred cast) form of ConstantExpr::getCast now
...
that its last uses have been removed.
llvm-svn: 32653
2006-12-18 08:18:46 +00:00
Jeff Cohen
9f46963f11
Partial unbreak of VC++ (stream stuff has no easy fix).
...
llvm-svn: 32614
2006-12-15 21:47:01 +00:00
Reid Spencer
bb65ebf9a1
Replace inferred getCast(V,Ty) calls with more strict variants.
...
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.
llvm-svn: 32514
2006-12-12 23:36:14 +00:00
Reid Spencer
ca104e80ee
Don't create usless casts for same-bith-width floating point casts.
...
llvm-svn: 32475
2006-12-12 05:38:50 +00:00
Reid Spencer
56521c48fe
Implement getIntegerCast and getFPCast for ConstantExpr. These are similar
...
to the createIntegerCast and createFPCast for CastInst instructions.
llvm-svn: 32457
2006-12-12 00:51:07 +00:00
Andrew Lenharth
dcb3c978c4
Packed Structures
...
llvm-svn: 32361
2006-12-08 18:06:16 +00:00
Reid Spencer
fcb0dd3a0f
Provide a getOpcode() method on CmpInst to ensure the opcode is returned
...
as the right type. Use this to shorten some code.
llvm-svn: 32300
2006-12-07 04:18:31 +00:00
Reid Spencer
e51700983a
For PR950:
...
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.
llvm-svn: 32287
2006-12-06 20:30:17 +00:00
Reid Spencer
f37dc65b08
Bail on the getInferredCast idea. Remove the function and convert
...
remaining uses to more specific casts.
llvm-svn: 32231
2006-12-05 19:14:13 +00:00
Reid Spencer
bc245a0190
Implement getPointerCast.
...
llvm-svn: 32211
2006-12-05 03:25:26 +00:00
Reid Spencer
a009d0d59c
Separate getCompare from get and getCompareTy from getTy.
...
llvm-svn: 32200
2006-12-04 21:35:24 +00:00
Reid Spencer
5c14088844
Implement new cast creation functions for both instructions and constant
...
expressions. These will get used to reduce clutter as we replace various
calls to createInferredCast and getCast.
llvm-svn: 32191
2006-12-04 20:17:56 +00:00
Reid Spencer
dba6aa436a
Reduce the size of the ExprMapKeyType class.
...
llvm-svn: 32186
2006-12-04 18:38:05 +00:00
Reid Spencer
ee3c991a6e
For PR950: Fix constant expressions to properly support ICmp and FCmp type expressions.
...
llvm-svn: 32170
2006-12-04 05:19:50 +00:00
Reid Spencer
c4dacf2455
Take a baby step towards getting rid of inferred casts. Provide methods on
...
CastInst and ConstantExpr that allow the signedness to be explicitly passed
in and reliance on signedness removed from getCastOpcode. These are
temporary measures useful during the conversion of inferred casts.
llvm-svn: 32164
2006-12-04 02:43:42 +00:00
Reid Spencer
10fbf0e02f
Implement creation of ICmp and FCmp constant expressions.
...
llvm-svn: 32147
2006-12-03 05:48:19 +00:00
Chris Lattner
f16661c3c6
add a new ConstantIntegral::get method. Simplify the implementation of
...
ConstantInt::get
llvm-svn: 32080
2006-12-01 19:20:02 +00:00
Reid Spencer
6c38f0bb07
For PR950:
...
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.
llvm-svn: 31931
2006-11-27 01:05:10 +00:00
Bill Wendling
6a462f1e99
Removed iostream #includes. Replaced std::cerr with DOUT.
...
llvm-svn: 31814
2006-11-17 08:03:48 +00:00
Reid Spencer
fdff938a7e
For PR950:
...
This patch converts the old SHR instruction into two instructions,
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.
llvm-svn: 31542
2006-11-08 06:47:33 +00:00
Reid Spencer
7eb55b395f
For PR950:
...
Replace the REM instruction with UREM, SREM and FREM.
llvm-svn: 31369
2006-11-02 01:53:59 +00:00
Evan Cheng
e974da6bb7
Speed up isCString()
...
llvm-svn: 31206
2006-10-26 21:48:03 +00:00
Evan Cheng
3763c5b1c4
Add isCString() - returns true if a ConstantArray is a CString.
...
llvm-svn: 31201
2006-10-26 19:15:05 +00:00
Reid Spencer
7e80b0b31e
For PR950:
...
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.
llvm-svn: 31195
2006-10-26 06:15:43 +00:00
Reid Spencer
e0fc4dfc22
For PR950:
...
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.
llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Chris Lattner
23dd1f6325
add a method to determine whether evaluation of a constant can trap.
...
llvm-svn: 31059
2006-10-20 00:27:06 +00:00
Chris Lattner
a84df0a2f1
Eliminate ConstantBool::True and ConstantBool::False. Instead, provide
...
ConstantBool::getTrue() and ConstantBool::getFalse().
llvm-svn: 30666
2006-09-28 23:36:21 +00:00
Chris Lattner
c7d3195254
remove reference to dead method
...
llvm-svn: 30641
2006-09-28 00:38:19 +00:00
Chris Lattner
69edc98b74
Use the new ManagedStatic class to explicitly manage static variables, eliminating static ctors/dtors
...
llvm-svn: 30639
2006-09-28 00:35:06 +00:00
Chris Lattner
e1496fbb33
Add new SetCondInst::isRelational/isEquality methods. Rename
...
Instruction::isRelational to Instruction::isComparison.
llvm-svn: 30444
2006-09-17 19:14:47 +00:00
Chris Lattner
3d27be1333
s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
...
llvm-svn: 29911
2006-08-27 12:54:02 +00:00
Jim Laskey
c03caef847
Reduce the size of Constants.o by 25% by generalizing specific instantiations of
...
std::map.
llvm-svn: 29163
2006-07-17 17:38:29 +00:00
Chris Lattner
227816348c
Add a new helper, simplify ConstantExpr::getWithOperandReplaced at Gabor's
...
request :)
llvm-svn: 29148
2006-07-14 22:20:01 +00:00
Chris Lattner
7c1018aef7
Add a new method for bugpoint to use
...
llvm-svn: 29143
2006-07-14 19:37:40 +00:00
Chris Lattner
02157b0627
Use hidden visibility to reduce the sizes of some .o files. This chops 60K off a release llvm-dis.
...
llvm-svn: 28969
2006-06-28 21:38:54 +00:00
Chris Lattner
bfd0b6d8e4
Add a missing assertion that would have helped out Reid
...
llvm-svn: 28746
2006-06-10 04:16:23 +00:00
Reid Spencer
82ebabafde
Provide a simpler interface for getting a ConstantArray from a character
...
string. Instead of specifying the length, just specify whether the user
wants a terminating null or not. The default is "true" to retain the same
behavior as previously provided by this function.
llvm-svn: 28562
2006-05-30 18:15:07 +00:00
Reid Spencer
6f61453ff8
Adjust the interface to ConstantArray::get. The previous
...
implementation always added a null byte to the end of the string. It turns
out that this is not always wanted. By adding a length parameter we preserve
this behavior when length==0 (default value) but also allow other lengths
(not null terminated) to be created.
llvm-svn: 28552
2006-05-30 08:23:18 +00:00
Chris Lattner
aa2372562e
Patches to make the LLVM sources more -pedantic clean. Patch provided
...
by Anton Korobeynikov! This is a step towards closing PR786.
llvm-svn: 28447
2006-05-24 17:04:05 +00:00
Chris Lattner
a93b4b5866
Add constant replacement for insertelement/vectorshuffle constant exprs
...
llvm-svn: 27532
2006-04-08 05:09:48 +00:00
Chris Lattner
bbe0a4248b
Add shufflevector support, todo, implement better constant folding.
...
llvm-svn: 27510
2006-04-08 01:18:18 +00:00
Evan Cheng
2c5e530430
Doh!
...
llvm-svn: 26705
2006-03-11 00:13:10 +00:00
Evan Cheng
38280c0020
Added a parameter to control whether Constant::getStringValue() would chop
...
off the result string at the first null terminator.
llvm-svn: 26704
2006-03-10 23:52:03 +00:00
Jim Laskey
2698f0de7a
Get rid of the multiple copies of getStringValue. Now a Constant:: method.
...
llvm-svn: 26616
2006-03-08 18:11:07 +00:00
Robert Bocchino
ca27f0320b
VMCore support for the insertelement operation.
...
llvm-svn: 25408
2006-01-17 20:07:22 +00:00
Robert Bocchino
de7f1c9a63
Added constant folding support for the extractelement operation.
...
llvm-svn: 25187
2006-01-10 20:03:46 +00:00
Robert Bocchino
230044839d
Added support for the extractelement operation.
...
llvm-svn: 25181
2006-01-10 19:05:34 +00:00
Chris Lattner
c421a26792
Fix an assertion to allow constant folding of packed values
...
llvm-svn: 25071
2006-01-04 01:01:04 +00:00
Reid Spencer
e4ae72a4e6
Revert previous patch. Additional tests fail.
...
llvm-svn: 24968
2005-12-22 21:46:37 +00:00
Reid Spencer
8f8124edaa
Fix PR409:
...
Implement the suggested check to ensure that out-of-range float constants
don't get accepted by LLVM accidentally. Adjust the supporting test cases
as well.
llvm-svn: 24963
2005-12-22 21:07:29 +00:00
Chris Lattner
20a244577d
add a hack to work around broken VC++ scoping rules. Thx to JeffC for pointing
...
this out to me
llvm-svn: 23655
2005-10-07 05:23:36 +00:00
Chris Lattner
3b793c6521
refactor a bit of code.
...
When moving constant entries in 'Map' if the entry is the representative
constant for the abstractypemap, make sure to update it as well. This
fixes the bcreader failures from last night on several C++ apps.
llvm-svn: 23628
2005-10-04 21:35:50 +00:00
Chris Lattner
dff59118c6
Minor speedup to avoid array searches given a Use*. This speeds up bc reading
...
of the python test from 1:00 to 54s.
llvm-svn: 23627
2005-10-04 18:47:09 +00:00
Chris Lattner
7a1450dbc6
Change the signature of replaceUsesOfWithOnConstant. The bool was always
...
true dynamically. Finally, pass the Use* that replaceAllUsesWith has into
the method for future use.
llvm-svn: 23626
2005-10-04 18:13:04 +00:00
Chris Lattner
935aa922e3
For large constants (e.g. arrays and structs with many elements) just
...
creating the keys and doing comparisons to index into 'Map' takes a lot
of time. For these large constants, keep an inverse map so that 'remove'
and move operations are much faster.
This speeds up a release build of the bc reader on Eric's nasty python
bytecode file from 1:39 to 1:00s.
llvm-svn: 23624
2005-10-04 17:48:46 +00:00
Chris Lattner
5bbf60a5b6
minor cleanup/fastpath for the bcreader. This speeds up the bcreader
...
from 1:41 -> 1:39 on the large python .bc file in a release build.
llvm-svn: 23623
2005-10-04 16:52:46 +00:00
Chris Lattner
8760ec73d8
implement the struct version of the array speedup, speeding up the
...
testcase a bit more from 1:48 -> 1.40.
llvm-svn: 23619
2005-10-04 01:17:50 +00:00
Chris Lattner
b64419ac40
Change ConstantArray::replaceUsesOfWithOnConstant to attempt to update
...
constant arrays in place instead of reallocating them and replaceAllUsesOf'ing
the result. This speeds up a release build of the bcreader from:
136.987u 120.866s 4:24.38
to
49.790u 49.890s 1:40.14
... a 2.6x speedup parsing a large python bc file.
llvm-svn: 23614
2005-10-03 22:51:37 +00:00
Chris Lattner
c4062ba65f
move some methods, no other changes
...
llvm-svn: 23613
2005-10-03 21:58:36 +00:00
Chris Lattner
0144fadc17
minor microoptimizations
...
llvm-svn: 23612
2005-10-03 21:56:24 +00:00
Chris Lattner
e7e139e8e8
Split SimpleConstantVal up into its components, so each Constant subclass getsa different enum value. This allows 'classof' for these to be really simple,not needing to call getType() anymore.
...
This speeds up isa/dyncast/etc for constants, and also makes them smaller.
For example, the text section of a release build of InstCombine.cpp shrinks
from 230037 bytes to 216363 bytes, a 6% reduction.
llvm-svn: 23467
2005-09-27 06:09:08 +00:00
Jim Laskey
8ad8f71447
Move code dependency for MathExtras.h out of Constants.h.
...
llvm-svn: 22840
2005-08-17 20:06:22 +00:00
Jim Laskey
b74c666186
Culling out use of unions for converting FP to bits and vice versa.
...
llvm-svn: 22838
2005-08-17 19:34:49 +00:00
Misha Brukman
b1c9317bb4
Remove trailing whitespace
...
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Alkis Evlogimenos
9160d5fd8b
Add new function getPtrPtrFromArrayPtr().
...
llvm-svn: 20684
2005-03-19 11:40:31 +00:00
Reid Spencer
f064bb2617
Fix a typo in an assertion comment.
...
Patch contributed by Vladimir Merzliakov.
llvm-svn: 20529
2005-03-09 15:19:41 +00:00
Chris Lattner
cdb9bfc150
remove all of the various setName implementations, consolidating them into
...
Value::setName, which is no longer virtual.
llvm-svn: 20464
2005-03-05 19:51:50 +00:00
Chris Lattner
cc77b84fcb
Constants never get names.
...
llvm-svn: 20459
2005-03-05 19:01:59 +00:00
Chris Lattner
d0df99ce86
Adjust to changes in User class. Aggregate constants now must explicitly
...
manage their operands.
llvm-svn: 19890
2005-01-29 00:34:39 +00:00
Misha Brukman
3852f652bf
Fix grammar
...
llvm-svn: 19854
2005-01-27 06:46:38 +00:00
Chris Lattner
1ece6f83ba
Allow getZeroExtend and getSignExtend to work with boolean inputs.
...
llvm-svn: 19210
2005-01-01 15:59:57 +00:00
Chris Lattner
acc4e54552
Change this method to return ulong, not uint, for 64-bit targets.
...
llvm-svn: 18906
2004-12-13 19:48:51 +00:00
Reid Spencer
b95f8ab3ef
Revert the recent patches to "fix" ConstantFP::isValueValidForType. None
...
of them seem to work everywhere.
llvm-svn: 18598
2004-12-07 07:38:08 +00:00
Reid Spencer
ae056bdd36
Provide a missing header file.
...
llvm-svn: 18597
2004-12-07 07:08:08 +00:00
Reid Spencer
744d95e8c7
Fix some comments.
...
llvm-svn: 18596
2004-12-07 07:06:47 +00:00
Alkis Evlogimenos
2b91842092
Fix check for valid floats. Also use and HUGE_VALF instead
...
of std::numeric_limits, because they work in more platforms.
llvm-svn: 18593
2004-12-07 06:46:50 +00:00
Reid Spencer
a8288d93ae
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
llvm-svn: 18585
2004-12-06 22:18:37 +00:00
Chris Lattner
99a669b110
Add hooks to free all memory allocated by the singleton factories in these
...
files. Patch contributed by Morten Ofstad!
llvm-svn: 17995
2004-11-19 16:39:44 +00:00
Alkis Evlogimenos
23e565484a
Gep indices must be of int, uint, long or ulong type.
...
llvm-svn: 17313
2004-10-28 06:43:38 +00:00
Alkis Evlogimenos
ba28dc8c54
Make this actually work.
...
llvm-svn: 17199
2004-10-24 03:02:16 +00:00
Alkis Evlogimenos
da5de05b9b
Add ConstantExpr::getSizeOf(Type*).
...
llvm-svn: 17196
2004-10-24 01:41:10 +00:00
Chris Lattner
d5f67d8ca6
Implement UndefValue class
...
llvm-svn: 17040
2004-10-16 18:07:16 +00:00
Chris Lattner
13128ab8fb
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.
llvm-svn: 16923
2004-10-11 22:52:25 +00:00
Alkis Evlogimenos
0507ffebb1
When creating constant arrays check that the initializer vector is the
...
same size as the one in the array type.
llvm-svn: 16354
2004-09-15 02:32:15 +00:00
Alkis Evlogimenos
cb031d9518
Add assertion descriptiosn on type mismatches when creating
...
ConstantArray and ConstantPacked objects.
llvm-svn: 16261
2004-09-10 04:16:59 +00:00
Reid Spencer
7c16caa336
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/.
llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Brian Gaeke
0220904e7a
Packed types, brought to you by Brad Jones
...
llvm-svn: 15938
2004-08-20 06:00:58 +00:00
Chris Lattner
caf3f3e970
Check constant expression validity more strictly
...
llvm-svn: 15883
2004-08-17 17:28:46 +00:00
Chris Lattner
20a4dab308
Add a hack to work around a problem my changes exposed
...
llvm-svn: 15509
2004-08-04 22:26:13 +00:00
Chris Lattner
29ca2c6f7a
Fix a latent bug exposed by my recent changes
...
llvm-svn: 15498
2004-08-04 18:50:09 +00:00
Alkis Evlogimenos
f0cc814974
Stop using getValues().
...
llvm-svn: 15482
2004-08-04 08:02:59 +00:00
Chris Lattner
3e650aff8b
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.
llvm-svn: 15463
2004-08-04 04:48:01 +00:00
Misha Brukman
63b38bd2ed
Fix #includes of i*.h => Instructions.h as per PR403.
...
llvm-svn: 15334
2004-07-29 17:30:56 +00:00
Chris Lattner
5230e70834
classof implementations are now inlined
...
llvm-svn: 14987
2004-07-19 00:59:10 +00:00
Reid Spencer
1ebe1abe22
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
- Delete ConstantPointerRef member function implementations
llvm-svn: 14928
2004-07-17 23:48:33 +00:00
Chris Lattner
d6108ca27e
implement new helper method
...
llvm-svn: 14776
2004-07-12 20:35:11 +00:00
Reid Spencer
cf394bf2d5
#include <iostream> since its not in Value.h any more.
...
llvm-svn: 14614
2004-07-04 11:51:24 +00:00
Chris Lattner
265eb6469a
Make ConstantBool act like a 1 bit ConstantInt, in order to simplify client
...
code. Patch contributed by Vladimir Prus.
llvm-svn: 14280
2004-06-21 12:12:12 +00:00
Chris Lattner
6b7275996c
Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
...
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Chris Lattner
74248512eb
Workaround or a VS miscompilation bug
...
llvm-svn: 14078
2004-06-08 23:21:39 +00:00
Chris Lattner
42d5b0878b
Delete some unreachable code
...
llvm-svn: 14031
2004-06-04 23:52:36 +00:00
Chris Lattner
db8bdba593
Implement some helpers
...
llvm-svn: 13738
2004-05-25 05:32:43 +00:00
Chris Lattner
dd28474610
Add ConstantExpr::get(Sign|Zero)Extend methods
...
llvm-svn: 12648
2004-04-04 23:20:30 +00:00
Chris Lattner
467cb2bc5d
Add support for constant expr casts
...
llvm-svn: 12564
2004-03-31 02:56:11 +00:00
Chris Lattner
b7897ce431
Fix a latent bug in select constantexpr handling that was broke 253.perlbmk
...
llvm-svn: 12562
2004-03-30 22:51:03 +00:00
Chris Lattner
3cdc27c868
Handle -0.0 correctly
...
llvm-svn: 12530
2004-03-29 19:51:24 +00:00
Chris Lattner
817175f883
Add a bunch of methods that should have been added a long time ago.
...
llvm-svn: 12526
2004-03-29 02:37:53 +00:00
Chris Lattner
6e415c06c2
Add support for select constant expressions. Use reserve a bit more to avoid
...
memory wasteage.
llvm-svn: 12323
2004-03-12 05:54:04 +00:00
Chris Lattner
9f4918ab93
Eliminate nightmarish API
...
llvm-svn: 12214
2004-03-08 06:11:10 +00:00
Chris Lattner
04b60fe5ad
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
llvm-svn: 11505
2004-02-16 20:46:13 +00:00
Chris Lattner
9fba3da879
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.
llvm-svn: 11470
2004-02-15 05:53:04 +00:00
Chris Lattner
015e821279
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.
llvm-svn: 11467
2004-02-15 04:14:47 +00:00
Chris Lattner
37a716fa80
Remove dependence on return type of ConstantStruct::get
...
llvm-svn: 11466
2004-02-15 04:07:32 +00:00
Chris Lattner
c75bf528c1
Remove dependence on the return type of ConstantArray::get
...
llvm-svn: 11463
2004-02-15 04:05:58 +00:00
Chris Lattner
5d56c478ba
Keep a cache of non-abstract null arrays and structs. This speeds up llvm-dis
...
from 16.57 -> 13.46s on 129.compress.
llvm-svn: 11462
2004-02-15 02:46:46 +00:00
Chris Lattner
ac6db755c3
Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
...
llvm-svn: 11228
2004-02-09 04:37:31 +00:00
Chris Lattner
ac80ea4970
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.
llvm-svn: 11064
2004-02-01 22:49:04 +00:00
Chris Lattner
241ed4c500
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
llvm-svn: 10967
2004-01-23 00:55:21 +00:00
Chris Lattner
e8701f690f
Fix bug in previous checkin: Demorgan would be ashamed of me, I need to
...
lay off the crack.
llvm-svn: 10855
2004-01-14 17:51:53 +00:00
Chris Lattner
e8dfccaabd
Implement ConstantArray::isString
...
llvm-svn: 10851
2004-01-14 17:06:38 +00:00
Chris Lattner
5a945e3616
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.
llvm-svn: 10807
2004-01-12 21:13:12 +00:00
Chris Lattner
2361bd02a1
Move ConstantHandling.h into lib/VMCore and out of include/llvm
...
llvm-svn: 10805
2004-01-12 20:48:11 +00:00
Chris Lattner
0bba771f49
Eliminate ConstantFoldShiftInstruction reference
...
llvm-svn: 10801
2004-01-12 20:40:42 +00:00
Chris Lattner
9eb2b527ad
Fix out of date comment, remove use of ConstantExpr::getShift
...
llvm-svn: 10794
2004-01-12 19:12:58 +00:00
Chris Lattner
5645e8a82d
Make ConstantExpr::get work for shifts as well
...
llvm-svn: 10790
2004-01-12 19:04:55 +00:00
Chris Lattner
189d19fb04
Finegrainify namespacification
...
llvm-svn: 10131
2003-11-21 20:23:48 +00:00
Chris Lattner
e120a73166
The ConstantPointer class is now gone.
...
llvm-svn: 10057
2003-11-17 19:47:21 +00:00
Brian Gaeke
960707c335
Put all LLVM code into the llvm namespace, as per bug 109.
...
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner
b36e8a1a2e
Add support for constant expr shifts
...
llvm-svn: 9735
2003-11-05 19:53:03 +00:00
Chris Lattner
8a55262c76
Fix bug: instcombine/2003-10-23-InstcombineNullFail.ll
...
llvm-svn: 9403
2003-10-23 05:21:48 +00:00
Chris Lattner
7267b352fb
Fix problem which effected linking apache
...
llvm-svn: 9335
2003-10-21 17:39:59 +00:00
John Criswell
482202a601
Added LLVM project notice to the top of every C++ source file.
...
Header files will be on the way.
llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
815ae2bfe3
Add a sanity check for constant expression casts
...
llvm-svn: 8951
2003-10-07 22:19:19 +00:00
Chris Lattner
b50d135710
Type tables are now AbstractTypeUsers. This allows them to merge together
...
constants as necessary due to type resolution. With this change, the
following spec benchmarks now link: 176.gcc, 177.mesa, 252.eon,
253.perlbmk, & 300.twolf. IOW, all SPEC INT and FP benchmarks now link.
llvm-svn: 8853
2003-10-05 00:17:43 +00:00
Chris Lattner
3e88ef9f93
Minor random speedup: make Constant::getNullValue only call ConstantFOO::get
...
once!
llvm-svn: 8845
2003-10-03 19:34:51 +00:00
Chris Lattner
29dc65a324
These methods are dead, remove them. Because the bodies will soon be
...
ressurected, just ifdef them out for now.
llvm-svn: 8840
2003-10-03 18:39:57 +00:00
Chris Lattner
22e4ca8863
There is no reason for Value to be an AbstractTypeUser. This just makes things
...
significantly more complete. Instead, just make DerivedType's AbstractTypeUser's,
and make Value contain a PATypeHolder.
llvm-svn: 8828
2003-10-02 19:44:40 +00:00
Chris Lattner
c27038d7b5
Implement "unsafe" replaceAllUsesWWith stuff for use during type resolution.
...
llvm-svn: 8209
2003-08-29 05:36:46 +00:00
Chris Lattner
9f15812e88
Refactor code to make it useful outside of Constants.cpp
...
llvm-svn: 8205
2003-08-29 05:09:37 +00:00
Misha Brukman
be372b91e1
The word `dependent' has no `a'.
...
llvm-svn: 8030
2003-08-21 22:14:26 +00:00
Chris Lattner
ab69ecc6d5
Fix linking bug in xboard
...
llvm-svn: 7952
2003-08-18 16:54:48 +00:00
Chris Lattner
3a5c2826d5
Fix a bug that brian reported
...
llvm-svn: 7428
2003-07-30 19:04:37 +00:00
Chris Lattner
6077c3195f
Simplify code by using ConstantInt::getRawValue instead of checking to see
...
whether the constant is signed or unsigned, then casting
llvm-svn: 7252
2003-07-23 15:22:26 +00:00
Chris Lattner
22ced56476
Fix bug: InstCombine/2003-06-22-ConstantExprCrash.ll
...
llvm-svn: 6857
2003-06-22 20:48:30 +00:00
Chris Lattner
cc7d6ff656
Fix bug: Linker/2003-06-02-TypeResolveProblem2.ll
...
llvm-svn: 6699
2003-06-16 12:11:33 +00:00
Chris Lattner
93c8f14906
* Make assertion message useful
...
* Kill dead conditional
llvm-svn: 6544
2003-06-02 17:42:47 +00:00
Chris Lattner
7fa6783a01
Fix bug: Linker/2003-06-02-TypeResolveProblem.ll
...
llvm-svn: 6542
2003-06-02 17:25:46 +00:00
Chris Lattner
20ec7bc0db
Fix problem with last checkin.
...
llvm-svn: 6328
2003-05-25 16:15:32 +00:00
Chris Lattner
98fa07b1d5
Fix Bug: Linker/2003-04-26-NullPtrLinkProblem.ll
...
This was a problem with constants having their types resolved to some new type,
but there was already a constant of the new type created. Before, these types
were never merged together, now they are.
llvm-svn: 6314
2003-05-23 20:03:32 +00:00
Chris Lattner
38a9bcde76
Add support for shift constant expressions
...
llvm-svn: 6260
2003-05-21 17:49:25 +00:00
Chris Lattner
cb4d26fb95
Fix bug: Assembler/2003-05-15-AssemblerProblem.llx
...
llvm-svn: 6234
2003-05-15 19:37:21 +00:00
Chris Lattner
55ed6561a1
Remove unnecessary casts
...
llvm-svn: 6201
2003-05-14 17:51:05 +00:00
Chris Lattner
2b383d2ef2
Eliminate using declarations
...
llvm-svn: 6179
2003-05-13 21:37:02 +00:00
Chris Lattner
acdbe7158d
Don't build constantexprs that could be folded
...
llvm-svn: 5801
2003-04-17 19:24:48 +00:00
Chris Lattner
46b3d30bf6
Change the interface to constant expressions to allow automatic folding
...
llvm-svn: 5793
2003-04-16 22:40:51 +00:00
Chris Lattner
83e5d39566
Fix ConstantUInt::isAllOnesValue
...
llvm-svn: 5734
2003-03-10 22:39:02 +00:00
Chris Lattner
c33ae67237
Remove #include
...
Extend getNullValue to work with struct and array types
llvm-svn: 5718
2003-03-06 21:02:18 +00:00
Chris Lattner
163b890dfb
- Dramatically simplify the Constant::mutateReferences implementation,
...
allowing it to be called on all constant types (structures/arrays)
llvm-svn: 4160
2002-10-14 03:30:23 +00:00
Chris Lattner
69ce8674b5
- Rename Instruction::First*Op to *OpsBegin, and Num*Ops to *OpsEnd to
...
reflect the fact that it's a range being defined.
llvm-svn: 4147
2002-10-13 19:39:16 +00:00
Chris Lattner
b1dd9bbc68
- Add new Constant::replaceUsesOfWithOnConstant which has an end result
...
similar to User::replaceUsesOfWith but actually does the right thing for
constants.
llvm-svn: 4102
2002-10-09 23:12:25 +00:00
Chris Lattner
0d779712e7
Fix bug: Assembler/2002-10-08-LargeArrayPerformance.ll by using
...
std::vector::reserve when possible
llvm-svn: 4085
2002-10-08 23:33:52 +00:00
Chris Lattner
426752738b
include/llvm/DataTypes.h includes this #define so we don't need it anymore
...
llvm-svn: 3708
2002-09-13 22:24:57 +00:00
Chris Lattner
236c129844
Give better assertion message for error conditions
...
llvm-svn: 3680
2002-09-11 01:21:04 +00:00
Chris Lattner
b0b412e66e
- Renamed Type::isIntegral() to Type::isInteger()
...
- Added new method Type::isIntegral() that is the same as isInteger, but
also accepts bool.
llvm-svn: 3574
2002-09-03 01:08:28 +00:00
Chris Lattner
81fabb05e5
Add support for turning an array of characters into a string.
...
llvm-svn: 3509
2002-08-26 17:53:56 +00:00
Chris Lattner
0c6e0b9042
- ConstantPointerRefs are now automatically removed from the module table
...
when they are destroyed, which makes Constant::destroyConstant an actually
useful external interface. Expose these methods publicly.
- Implement destroyConstant on ConstPointerNull so that destroyConstant can
be used on any derived type constant safely.
llvm-svn: 3379
2002-08-18 00:40:04 +00:00
Chris Lattner
330b7ac76c
Remove support for Not ConstantExpr. This simplifies the unary case to only
...
have to support the cast instruction, so the function is renamed to getCast.
llvm-svn: 3328
2002-08-14 18:24:09 +00:00
Chris Lattner
31408f7a80
Return null on failure, instead of aborting.
...
llvm-svn: 3308
2002-08-14 17:12:13 +00:00
Chris Lattner
b1585a90d9
- Rename ConstantGenericIntegral -> ConstantIntegral
...
- Add new methods to ConstantIntegral: getMaxValue, getMinValue,
getAllOnesValue
llvm-svn: 3299
2002-08-13 17:50:20 +00:00
Chris Lattner
41e99a07f1
- Added a new superclass of ConstantBool/ConstantInt: ConstantGenericIntegral
...
- Moved InstCombine: isMaxValue, isMinValue, isAllOnesValue to Constants.h
llvm-svn: 3293
2002-08-12 21:21:21 +00:00
Chris Lattner
3cd8c56cbb
Cleanup ConstantExpr handling:
...
* Correctly delete TypeHandles in AsmParser. In addition to not leaking
memory, this prevents a bug that could have occurred when a type got
resolved that the constexpr was using
* Check for errors in the AsmParser instead of hitting assertion failures
deep in the code
* Simplify the interface to the ConstantExpr class, removing unneccesary
parameters to the ::get* methods.
* Rename the 'getelementptr' version of ConstantExpr::get to
ConstantExpr::getGetElementPtr
llvm-svn: 3161
2002-07-30 18:54:25 +00:00
Chris Lattner
a82ee2df46
*** empty log message ***
...
llvm-svn: 3065
2002-07-24 22:08:53 +00:00
Chris Lattner
d9f4ac6680
* ConstExpr::getelementptr now takes a vector of Constants not Values
...
* Assert things instead of printing an error and returning null.
llvm-svn: 2949
2002-07-18 00:14:50 +00:00
Anand Shukla
991873fc5c
added std:: to cerr and endl
...
llvm-svn: 2914
2002-07-16 00:02:17 +00:00
Vikram S. Adve
4c48533b57
Ensure ConstExpr constants are unique using a
...
map of <opcode, operands> to ConstExpr.
llvm-svn: 2909
2002-07-15 18:19:33 +00:00
Vikram S. Adve
4e537b27d8
Added subclass ConstantExpr to represent expressions consructed from
...
constants using operators such as cast, getelementptr, add, shl, etc.
Note that a ConstantExpr can be of any type, so classof() in most
other subclasses (that discriminate by type) have to check that it
is also not a ConstantExpr.
llvm-svn: 2901
2002-07-14 23:13:17 +00:00
Chris Lattner
33422fedc2
*** empty log message ***
...
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Anand Shukla
949659c0e2
added include<iostream> for cerr
...
llvm-svn: 2800
2002-06-25 22:04:00 +00:00
Chris Lattner
113f4f4609
MEGAPATCH checkin.
...
For details, See: docs/2002-06-25-MegaPatchInfo.txt
llvm-svn: 2779
2002-06-25 16:13:24 +00:00
Chris Lattner
ca14237696
Split ConstantVals.h into Constant.h and Constants.h
...
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner
a85386f2de
* Change Constant::getNullConstant to Constant::getNullValue
...
* Remove some unused code
llvm-svn: 2324
2002-04-27 02:25:43 +00:00
Chris Lattner
1ce991d6b9
Move asmwriter/getStrValue cruft into AsmWriter.cpp file.
...
llvm-svn: 2300
2002-04-18 18:53:33 +00:00
Chris Lattner
25bf874ff5
Remove unneccesary cast
...
llvm-svn: 2269
2002-04-16 21:36:29 +00:00
Chris Lattner
6915f8fc3c
* Move include/llvm/Analysis/SlotCalculator.h to include/llvm/SlotCalculator.h
...
because the slot calculator is already part of the VMCore library.
* Rename incorporateMethod and purgeMethod to *Function
llvm-svn: 2154
2002-04-07 22:49:37 +00:00
Chris Lattner
e026e92e0e
Remove some gross code by using the VAlue::dump method to do debug dumps
...
llvm-svn: 2149
2002-04-07 22:32:25 +00:00
Chris Lattner
34208394d0
Fix Bug: test/Regression/Other/2002-04-07-InfConstant.ll
...
llvm-svn: 2142
2002-04-07 08:42:53 +00:00
Chris Lattner
9a11be8491
Fix bug: test/Regression/Other/2002-04-07-HexFloatConstants.ll
...
llvm-svn: 2141
2002-04-07 08:37:11 +00:00
Chris Lattner
7f74a56e24
Changes to build successfully with GCC 3.02
...
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner
6d6f01a488
Rename ConstPoolVals.cpp to Constants.cpp
...
llvm-svn: 1471
2001-12-14 16:42:30 +00:00