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