Commit Graph

159 Commits

Author SHA1 Message Date
Chris Lattner
7ed47a1335 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:42 +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
Bill Wendling
651dfd1ff8 Get rid of compilation warning during release builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43608 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 08:24:40 +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
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
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
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
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
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
Reid Spencer
181b6c9cb5 Fix minor doxygen nits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40854 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 20:06:04 +00:00
Dan Gohman
07a96765da Fix comments about vectors to use the current wording.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 14:29:03 +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
Dan Gohman
a1a702cdd2 Rename Value::getValueType to getValueID, to avoid confusion with
other things named getValueType.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35964 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-13 18:12:09 +00:00
Chris Lattner
99b1b38818 getLimitedValue now just forward to APInt's getLimitedValue. Mark it const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35861 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 06:44:12 +00:00
Chris Lattner
e51f2a59d9 add a helper function to constantint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35610 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-03 01:41:34 +00:00
Zhou Sheng
4ac93f9fa3 Make sure this method just return value equal or less than Limit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35509 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-30 16:50:28 +00:00
Zhou Sheng
0642f75836 Rename and correct the method "greaterOrEqual".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35502 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-30 05:10:59 +00:00
Zhou Sheng
b422d2d9e5 Add two utility methods into ConstantInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35501 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-30 03:22:55 +00:00
Dan Gohman
423c2260f9 Add the 'explicit' keyword to several constructors that accept one
argument that don't appear intended as implicit-conversion operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35280 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 18:44:11 +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
Reid Spencer
34da0ac28f Add a non-virtual test for zero, isZero, and rename isUnitValue isOne.
These will be used in upcoming patches to avoid virtual function call when
the client knows it is a ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34820 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 00:27:06 +00:00
Reid Spencer
dbf6d37b0b Remove virtual keyword from method that doesn't need to be virtual.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 23:20:52 +00:00
Reid Spencer
37eeaa729b Add an isUnitValue method for comparison against 1. This just follows a
common pattern with isNullValue, isAllOnesValue, etc. It also helps to
prevent things like getZExtValue() == 1, which could assert for large
bitwidths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34813 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 21:50:41 +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
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
Chris Lattner
f543f748c3 eliminate some dead friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34447 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 07:18:01 +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
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
Chris Lattner
32980699c0 remove dead methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34419 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:44:24 +00:00
Chris Lattner
df7490a273 add alternate version of constant ctors that don't take a vector. For now
this offers no performance advantage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:23:24 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Reid Spencer
832254e1c2 Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types.  This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
   shl i32 %X, 1
instead of
   shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 02:16:23 +00:00
Chris Lattner
fb11053815 Revise APIs for creating constantexpr GEPs to not require the use of
vectors.  This allows us to eliminate many temporary vectors, and their
associated malloc/free pairs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33691 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 04:39:29 +00:00
Reid Spencer
24d6da5fed For PR970:
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-21 00:29:26 +00:00
Reid Spencer
c10305743c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 21:13:56 +00:00
Jim Laskey
569cc890e8 virtual not needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33161 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 23:39:50 +00:00
Jim Laskey
fa30182eb8 Allow isAllOnesValue testing on packed constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33146 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 22:39:14 +00:00
Reid Spencer
579dca12c2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 04:24:46 +00:00
Reid Spencer
4fe16d607d Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 18:21:29 +00:00
Zhou Sheng
9c799ffbbe Fixed a bug in ConstantInt::Inverted().
Modified comment of that method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33074 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 14:31:10 +00:00
Zhou Sheng
6b6b6ef167 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 12:24:14 +00:00
Chris Lattner
58513aa1c2 Add a new ConstantPacked::getAllOnesValue method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-04 01:49:26 +00:00
Reid Spencer
e4d87aa2de 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 06:05:41 +00:00
Reid Spencer
6d0483a7a3 Correct the description of ConstantInt::isValueValidForType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32664 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 01:34:39 +00:00
Reid Spencer
9b11d518ae 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32663 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 01:28:19 +00:00