1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

151 Commits

Author SHA1 Message Date
Reid Spencer
2e158ac2a0 Separate the get and getTy functions for ICmp and FCmp into getCompare
and getCompareTy. Also, fix some incorrect comments.

llvm-svn: 32199
2006-12-04 21:34:17 +00:00
Reid Spencer
2d2a26767e 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
b45bf0421e For PR950: Provide an isCompare method for detection of ICmp and FCmp constant expressions. Change interfaces to allow for ICmp and FCmp predicate values.
llvm-svn: 32167
2006-12-04 05:19:02 +00:00
Reid Spencer
4cb4234c17 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
a468638458 Implement creation of ICmp and FCmp constant expressions.
llvm-svn: 32147
2006-12-03 05:48:19 +00:00
Chris Lattner
497c976859 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
992d9788b3 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
Reid Spencer
da1f5b882a 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
1abf69e923 For PR950:
Replace the REM instruction with UREM, SREM and FREM.

llvm-svn: 31369
2006-11-02 01:53:59 +00:00
Evan Cheng
9d0bfecda6 Add isCString() - returns true if a ConstantArray is a CString.
llvm-svn: 31201
2006-10-26 19:15:05 +00:00
Reid Spencer
6833ffe8b8 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
82347acc95 Fix a comment to be accurate.
llvm-svn: 31064
2006-10-20 07:24:55 +00:00
Reid Spencer
d414793dbc 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
155e6b8403 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
93bc6e881f fix typo
llvm-svn: 30453
2006-09-18 04:58:06 +00:00
Reid Spencer
741140980f For PR797:
Remove exception throwing/handling from lib/Bytecode, and adjust its users
to compensate for changes in the interface.

llvm-svn: 29875
2006-08-25 17:43:11 +00:00
Chris Lattner
cff735d69e Add another helper method.
llvm-svn: 29147
2006-07-14 22:19:18 +00:00
Chris Lattner
b78b91260b Add a new method for bugpoint to use.
llvm-svn: 29142
2006-07-14 19:37:01 +00:00
Reid Spencer
1e1cfbb6fe 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
a79b2a00c1 Properly document the second form of ConstArray::get()
llvm-svn: 28553
2006-05-30 08:26:13 +00:00
Reid Spencer
ce05d51e82 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
Reid Spencer
574d4e6992 For PR786:
Minor tweaks in public headers and a few .cpp files so that LLVM can build
successfully with -pedantic and projects using LLVM with -pedantic don't
get warnings from LLVM. There's still more -pedantic warnings to fix.

llvm-svn: 28453
2006-05-24 19:21:13 +00:00
Chris Lattner
e2d0c1084a Add a new shufflevector instruction
llvm-svn: 27507
2006-04-08 01:15:18 +00:00
Chris Lattner
0c8352628d add a new Type::getIntegralTypeMask() method, which is useful for clients that
want to do bitwise inspection of integer types.

llvm-svn: 26032
2006-02-07 06:17:10 +00:00
Robert Bocchino
a5ec2815a1 Instruction and constant expression definitions for the insertelement
operation.

llvm-svn: 25402
2006-01-17 20:05:59 +00:00
Robert Bocchino
1088fb019d Added an instruction and constant expression for the extractelement
operation.

llvm-svn: 25176
2006-01-10 19:04:13 +00:00
Chris Lattner
536a465ceb Change the signature of replaceUsesOfWithOnConstant to take a Use* and not
take the bool.  The bool is always true dynamically.

llvm-svn: 23625
2005-10-04 18:12:13 +00:00
Chris Lattner
92616caa1a Split SimpleConstantVal up into its components, so each Constant subclass gets
a 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: 23466
2005-09-27 06:08:32 +00:00
Chris Lattner
808a5d8750 Add long-overdue helpers for getting constants with known upper bits
llvm-svn: 23426
2005-09-24 22:57:28 +00:00
Jim Laskey
5f57048c62 Move code dependency for MathExtras.h out of Constants.h.
llvm-svn: 22840
2005-08-17 20:06:22 +00:00
Jim Laskey
61e3d7bca5 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
3f0aa3dbf8 Remove trailing whitespace
llvm-svn: 21408
2005-04-21 20:19:05 +00:00
Alkis Evlogimenos
19bea8930f Add new function getPtrPtrFromArrayPtr().
llvm-svn: 20684
2005-03-19 11:40:31 +00:00
Chris Lattner
9b289130f7 Eliminate the explicit opcode field in ConstantExpr, using the SubclassData
field to hold it instead.  This shrinks memory usage for 176.gcc from
57628728 to 57598144 bytes, a small reduction of about 30K.

llvm-svn: 20047
2005-02-05 02:00:12 +00:00
Chris Lattner
d8266ae3dd Adjust to changes in the User class.
llvm-svn: 19888
2005-01-29 00:33:00 +00:00
Chris Lattner
79c3a57af7 Change this method to return ulong, not uint, for 64-bit targets.
llvm-svn: 18906
2004-12-13 19:48:51 +00:00
Alkis Evlogimenos
f57d029464 Use getOperand() and remove getElementAt() function.
llvm-svn: 18612
2004-12-08 03:45:20 +00:00
Alkis Evlogimenos
806fb993fe Add accessors for Constants in a ConstantStruct.
llvm-svn: 18550
2004-12-05 20:09:18 +00:00
Misha Brukman
dd92de83ca Fix grammar in comments to getSizeOf()
llvm-svn: 17200
2004-10-24 03:18:30 +00:00
Alkis Evlogimenos
75aa7bdf21 Improve comments and wrap to 80 columns.
llvm-svn: 17198
2004-10-24 03:01:32 +00:00
Alkis Evlogimenos
a893aad8fb Add ConstantExpr::getSizeOf(Type*).
llvm-svn: 17196
2004-10-24 01:41:10 +00:00
Chris Lattner
1217610926 Add new UndefValue class
llvm-svn: 17035
2004-10-16 18:05:25 +00:00
Chris Lattner
aa3facb3fe Update doco, make doxygen more, use standard dividers.
llvm-svn: 16948
2004-10-13 04:44:53 +00:00
Chris Lattner
63ba63bb56 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
Reid Spencer
c4abcbefb1 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
01636f4e0f Packed types, brought to you by Brad Jones
llvm-svn: 15938
2004-08-20 06:00:58 +00:00
Chris Lattner
c53f15303d Move method out of line
llvm-svn: 15497
2004-08-04 18:49:52 +00:00
Alkis Evlogimenos
f846e483bb Remove uneeded getValues() functions.
llvm-svn: 15488
2004-08-04 08:47:21 +00:00
Chris Lattner
a81b270e18 Add a special version of getType for ConstantPointerNull, exposing the fact
that all Null pointers have pointer type

llvm-svn: 15458
2004-08-04 02:42:17 +00:00
Misha Brukman
ab7bc6af0d Convert tabs to spaces; fix name of function in assert() description.
llvm-svn: 15009
2004-07-19 21:11:45 +00:00
Chris Lattner
5a4eaff632 inline classof implementations, eliminate use of virtual methods.
classof<ConstantXXX> is now MUCH faster than it used to be.

llvm-svn: 14986
2004-07-19 00:58:47 +00:00
Reid Spencer
51fd2506ad ****** ABOLISH ConstantPointerRef *****
llvm-svn: 14919
2004-07-17 23:26:57 +00:00
Chris Lattner
10686c55cc Add a helper method. The StructType element is completely redundant in most
cases

llvm-svn: 14777
2004-07-12 20:36:08 +00:00
Chris Lattner
3a8e3bce6c 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
0185a86e38 Add some helpers
llvm-svn: 13737
2004-05-25 05:32:13 +00:00
Chris Lattner
eb1caeca2a Add ConstantExpr::get(Sign|Zero)Extend methods
llvm-svn: 12648
2004-04-04 23:20:30 +00:00
Chris Lattner
7f5d56b43a 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
e77ff566cb Add support for select constant exprs
llvm-svn: 12309
2004-03-12 05:50:39 +00:00
Chris Lattner
363cd9e4b8 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
0f819b9523 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
f5812885e3 Correct the method I just added to actually return false sometimes
llvm-svn: 11069
2004-02-02 18:53:04 +00:00
Chris Lattner
990f40f069 Add a new method to ConstantFP
llvm-svn: 11068
2004-02-02 18:40:29 +00:00
Chris Lattner
7e93bb1d9e The first half of a fix for PR218 & test/Regression/Assembler/2004-02-01-NegativeZero.llx
llvm-svn: 11063
2004-02-01 22:48:09 +00:00
Chris Lattner
599ab961c4 Add new ConstantArray::isString(), as the conditions for using getString()
are complex enough to check that it should be a seperate method.

While I'm here, improve ConstantArray::getNullValue a bit, though the
FIXME is still quite valid.

llvm-svn: 10850
2004-01-14 17:06:21 +00:00
Chris Lattner
cf1d9df549 The getShift method is no obsolete
llvm-svn: 10797
2004-01-12 19:37:26 +00:00
Chris Lattner
1f762c7571 The ConstantPointer class is now gone.
llvm-svn: 10057
2003-11-17 19:47:21 +00:00
Chris Lattner
9995768f47 Fixes for PR114: Thanks to Reid Spencer!
llvm-svn: 10029
2003-11-16 20:21:15 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
John Criswell
16c6cda9d5 Added LLVM copyright header (for lack of a better term).
llvm-svn: 9304
2003-10-20 20:19:47 +00:00
Chris Lattner
cb5dd5ba25 Add some new methods to forward to
llvm-svn: 8852
2003-10-05 00:13:28 +00:00
Chris Lattner
2e3f124f10 These methods are dead, remove them
llvm-svn: 8839
2003-10-03 18:39:40 +00:00
Chris Lattner
4e4c763dfc Standardize header file comments
llvm-svn: 8782
2003-09-30 18:37:50 +00:00
Chris Lattner
51f4550b50 Allow for "unsafe" replaceAllUsesWith operatations, for use during type resolution
llvm-svn: 8208
2003-08-29 05:36:05 +00:00
Chris Lattner
913c260d94 Add more doxygen comments, add new ConstantInt::getRawValue method
llvm-svn: 7244
2003-07-23 14:49:06 +00:00
Chris Lattner
6c12776232 Remove a ton of extraneous #includes
llvm-svn: 6842
2003-06-22 03:08:05 +00:00
John Criswell
4781723de6 Included assert.h so that the code compiles under newer versions of GCC.
llvm-svn: 6682
2003-06-11 14:01:36 +00:00
Chris Lattner
9cdb6fdeaa Remove some cruft, add some methods to allow implementation of bugfix for
Bug: Linker/2003-04-26-NullPtrLinkProblem.ll

llvm-svn: 6313
2003-05-23 20:02:05 +00:00
Chris Lattner
e7c3c48fb4 Minor rewording/cleanups
llvm-svn: 6311
2003-05-23 17:13:15 +00:00
Chris Lattner
1358ad783e New method
llvm-svn: 6259
2003-05-21 17:49:08 +00:00
Chris Lattner
0619ee9f39 Add some methods to make type safety a bit easier
llvm-svn: 6198
2003-05-14 17:49:52 +00:00
Chris Lattner
bb00f755ed Change the interface to constant expressions to allow automatic folding
llvm-svn: 5793
2003-04-16 22:40:51 +00:00
Chris Lattner
5e5950b7e0 Fix ConstantUInt::isAllOnesValue
llvm-svn: 5734
2003-03-10 22:39:02 +00:00
Chris Lattner
07a7a75331 Extend struct and array constants to support isNullValue
llvm-svn: 5719
2003-03-06 21:02:43 +00:00
Chris Lattner
5b41b28fb6 - 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
0acdba0025 - 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
cc9d7e01c9 Add support for turning an array of characters into a string.
llvm-svn: 3509
2002-08-26 17:53:56 +00:00
Chris Lattner
8f4f2153e5 - 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: 3378
2002-08-18 00:39:59 +00:00
Chris Lattner
6a9d88347a 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
3e63ddad5b - Rename ConstantGenericIntegral -> ConstantIntegral
- Add new methods to ConstantIntegral: getMaxValue, getMinValue,
   getAllOnesValue

llvm-svn: 3298
2002-08-13 17:50:18 +00:00
Chris Lattner
4fbca59155 - 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
12b9a2a7e6 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: 3160
2002-07-30 18:54:22 +00:00
Chris Lattner
4ad0749487 Make getelementptr ConstExpr take a vector of constants not values
llvm-svn: 2943
2002-07-18 00:11:08 +00:00
Vikram S. Adve
9c2c68687e Ensure ConstExpr constants are unique.
llvm-svn: 2910
2002-07-15 18:20:50 +00:00
Vikram S. Adve
79b72a8298 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.   This is why isConstantExpr() is needed.

llvm-svn: 2891
2002-07-14 22:47:54 +00:00
Chris Lattner
321a8cf4ba Split ConstantVals.h into Constant.h and Constants.h
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner
c5db0cc189 Rename getNullConstant to getNullValue
llvm-svn: 2321
2002-04-27 02:22:42 +00:00
Chris Lattner
bfad09f50d Remove getStrValue method from Constant implementations. The AssemblyWriter
now knows how to write out a constant, not the constants themselves.  This is
fixed due to the move of the AsmWriter to the VMcore library.

llvm-svn: 2297
2002-04-18 18:51:39 +00:00
Chris Lattner
6bdd1d2e3f * Add virtual print methods
* s/Method/Function

llvm-svn: 2172
2002-04-08 21:56:02 +00:00
Chris Lattner
3dc9a2a61f Changes to build successfully with GCC 3.02
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner
c717d96290 Constants KNOW they are of a derived type
llvm-svn: 1439
2001-12-13 00:38:57 +00:00