Commit Graph

440 Commits

Author SHA1 Message Date
Benjamin Kramer 6f88fcb16b Apparently APFloat::getZero doesn't like PPCDoubleDoubles.
llvm-svn: 120909
2010-12-04 14:43:08 +00:00
Benjamin Kramer 8ceebfaa04 Simplify code. No functionality change.
llvm-svn: 120907
2010-12-04 14:22:24 +00:00
Benjamin Kramer ddd1b7b801 Simplify code. No change in functionality.
llvm-svn: 119908
2010-11-20 18:43:35 +00:00
Chris Lattner 13ee795c42 remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended.

llvm-svn: 112356
2010-08-28 04:09:24 +00:00
Oscar Fuentes 40b31ad3ee Prefix `next' iterator operation with `llvm::'.
Fixes potential ambiguity problems on VS 2010.

Patch by nobled!

llvm-svn: 110029
2010-08-02 06:00:15 +00:00
Benjamin Kramer 3d4af4e91e Preallocate vector, avoid unnecessary vector growth.
llvm-svn: 109971
2010-08-01 11:43:26 +00:00
Chris Lattner 718da70ca2 Fix PR7658, a problem where type refinement can trigger
constant replacement which was botching its handling of
types.  Use of getType() instead of getRawType() was causing
the type map in constant folding to be updated wrong.

llvm-svn: 108610
2010-07-17 06:13:52 +00:00
Dan Gohman a2414ea190 Remove the API compatibility layer which converted add, sub, and mul
to fadd, fsub, and fmul, when used with a floating-point type. LLVM
has supported the new instructions since 2.6, so it's time to get
on board.

llvm-svn: 102971
2010-05-03 22:44:19 +00:00
Dan Gohman 3cdcc3f728 Simplify this code.
llvm-svn: 101074
2010-04-12 22:12:29 +00:00
Chris Lattner a3b94ba2c5 move some method definitions to files that make sense.
llvm-svn: 99927
2010-03-30 20:48:48 +00:00
Chris Lattner 61f3bd6772 add support for zero initialized unions, patch by Tim Northover!
llvm-svn: 99818
2010-03-29 17:36:02 +00:00
Gabor Greif c78d720f02 rename use_const_iterator to const_use_iterator for consistency's sake
llvm-svn: 99564
2010-03-25 23:06:16 +00:00
Talin 1feba3c980 replaceUsesOfWithOnConstant implementation for unions.
llvm-svn: 96616
2010-02-18 21:43:45 +00:00
Duncan Sands 19d0b47b1f There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy().  Convert most instances of the first form to the second form.
Requested by Chris.

llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Duncan Sands 9dff9bec31 Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Chris Lattner 392be58cad Add support for a union type in LLVM IR. Patch by Talin!
llvm-svn: 96011
2010-02-12 20:49:41 +00:00
Duncan Sands fa5f5965de Adding missing methods for creating Add, Mul, Neg and Sub with NUW.
llvm-svn: 95086
2010-02-02 12:53:04 +00:00
Chris Lattner f5edeebd8c eliminate a bunch of pointless LLVMContext arguments.
llvm-svn: 95001
2010-02-01 20:48:08 +00:00
Dan Gohman de047f2051 Add a getNUWMul function.
llvm-svn: 94982
2010-02-01 16:38:14 +00:00
Dan Gohman ede94e6850 Add a generalized form of ConstantExpr::getOffsetOf which works for
array types as well as struct types, and which accepts arbitrary
Constant indicies.  

llvm-svn: 94981
2010-02-01 16:37:38 +00:00
Dan Gohman a9be73929f Make getAlignOf return an i64, for consistency with getSizeOf and
getOffsetOf, and remove the comment about assuming i8 is byte-aligned,
which is no longer applicable.

llvm-svn: 94738
2010-01-28 02:43:22 +00:00
Dan Gohman cf9138307d Remove SCEVAllocSizeExpr and SCEVFieldOffsetExpr, and in their place
use plain SCEVUnknowns with ConstantExpr::getSizeOf and
ConstantExpr::getOffsetOf constants. This eliminates a bunch of
special-case code.

Also add code for pattern-matching these expressions, for clients that
want to recognize them.

Move ScalarEvolution's logic for expanding array and vector sizeof
expressions into an element count times the element size, to expose
the multiplication to subsequent folding, into the regular constant
folder.

llvm-svn: 94737
2010-01-28 02:15:55 +00:00
Chris Lattner 37bc78a5e2 fix CastInst::castIsValid to reject aggregate types, fixing PR6153:
llvm-as: t.ll:1:25: error: invalid cast opcode for cast from '[4 x i8]' to '[1 x i32]'
@x = constant [1 x i32] bitcast ([4 x i8] c"abcd" to [1 x i32])
                        ^

llvm-svn: 94595
2010-01-26 21:51:43 +00:00
Nick Lewycky 9e26c1cc0c Fix a crasher trying to fold each element in a comparison between two vectors
if one of the vectors didn't have elements (such as undef). Fixes PR 6096.

Fix an issue in the constant folder where fcmp (<2 x %ty>, <2 x %ty>) would
have <2 x i1> type if constant folding was successful and i1 type if it wasn't.
This exposed a related issue in the bitcode reader.

llvm-svn: 94069
2010-01-21 07:03:21 +00:00
Benjamin Kramer d2564e3afb Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Benjamin Kramer a81a6dff0d Convert a ton of simple integer type equality tests to the new predicate.
llvm-svn: 92760
2010-01-05 20:07:06 +00:00
David Greene 1e27a13838 Change errs() to dbgs().
llvm-svn: 92650
2010-01-05 01:29:19 +00:00
Chris Lattner a7cfc43af8 differences between two blockaddress's don't cause a
global variable initializer to require relocations.

llvm-svn: 92450
2010-01-03 18:09:40 +00:00
Chris Lattner 09660c9b06 remove some misleading comments.
llvm-svn: 92311
2009-12-30 20:25:09 +00:00
Chris Lattner b9c8651b8c add a layer of accessors around the Value::SubClassData member, and use
a convention (shadowing the setter with private forwarding function) to
prevent subclasses from accidentally using it.

This exposed some bogosity in ConstantExprs, which was propaging the
opcode of the constant expr into the NUW/NSW/Exact field in the
getWithOperands/getWithOperandReplaced methods.

llvm-svn: 92239
2009-12-29 02:14:09 +00:00
Dan Gohman 4e3b29e309 Add utility routines for NSW multiply.
llvm-svn: 91664
2009-12-18 03:10:26 +00:00
Dan Gohman 4ab4420d7a Add utility routines for creating integer negation operators with NSW set.
Integer negation only overflows with INT_MIN, but that's an important case.

llvm-svn: 91662
2009-12-18 02:58:50 +00:00
Chris Lattner ff09559a8f whitespace cleanup
llvm-svn: 90834
2009-12-08 05:31:46 +00:00
Daniel Dunbar ad36e8aceb Pass StringRef by value.
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Chris Lattner 37536b90e1 remove a bunch of locking from LLVMContextImpl. Since only one thread
can be banging on a context at a time, this isn't needed.  Owen, please
review.

llvm-svn: 85728
2009-11-01 18:42:03 +00:00
Chris Lattner 253bc77513 the verifier shouldn't modify the IR.
llvm-svn: 85722
2009-11-01 18:11:50 +00:00
Chris Lattner c559a9f686 Fix BlockAddress::replaceUsesOfWithOnConstant to correctly
maintain the block use count in SubclassData.

llvm-svn: 85701
2009-11-01 03:03:03 +00:00
Chris Lattner aa99c94e2a Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)".  Eliminate it
for simplicity.

llvm-svn: 85699
2009-11-01 01:27:45 +00:00
Chris Lattner b2c0e243c5 Make blockaddress(@func, null) be valid, and make 'deleting a basic
block with a blockaddress still referring to it' replace the invalid 
blockaddress with a new blockaddress(@func, null) instead of a 
inttoptr(1).

This changes the bitcode encoding format, and still needs codegen 
support (this should produce a non-zero value, referring to the entry
block of the function would also be quite reasonable).

llvm-svn: 85678
2009-10-31 20:08:37 +00:00
Chris Lattner 74eb5d71a3 make hasAddressTaken() constant time by storing a refcount in BB's subclass data.
llvm-svn: 85625
2009-10-30 22:33:29 +00:00
Chris Lattner a91a563530 Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand.
This doesn't permute much, because if you have a ConstantExpr (or
anything more specific than Constant) we still know the operand has
to be a Constant.

llvm-svn: 85375
2009-10-28 05:14:34 +00:00
Chris Lattner 2cb85b4020 'static const void *X = &&y' can only be put in the
readonly section if a reference to the containing function
is valid in the readonly section.

llvm-svn: 85370
2009-10-28 04:12:16 +00:00
Chris Lattner 31b132c0b7 IR support for the new BlockAddress constant kind. This is
untested and there is no way to use it, next up: doing battle
with asmparser.

llvm-svn: 85349
2009-10-28 00:01:44 +00:00
Owen Anderson 5dab84ca9c Banish ConstantsLock. It's serving no purpose other than slowing things down
at the moment.

llvm-svn: 84529
2009-10-19 20:11:52 +00:00
Chris Lattner fdd8790718 strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a
pointer comparison.  Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.

llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Nick Lewycky ae4617c974 Requires element types in a constant initializer to match the element types of
of the constant. This reverts r6544 and r7428.

llvm-svn: 83270
2009-10-03 19:30:43 +00:00
Jeffrey Yasskin 8ce67f83bc Assert that ConstantArrays are created with correctly-typed elements.
llvm-svn: 83168
2009-09-30 21:08:08 +00:00
Duncan Sands 129de48982 For the NSWSub support in the builder to actually be useable,
there need to be corresponding changes to the constant folders,
done in this patch.

llvm-svn: 82862
2009-09-26 15:35:35 +00:00
Dan Gohman 394468dc8e Rename ConstantFP's getInf to getInfinity.
llvm-svn: 82823
2009-09-25 23:40:21 +00:00
Dan Gohman feb5021134 Add a ConstantFP::getInf utility function for creating infinity ConstantFPs.
llvm-svn: 82818
2009-09-25 23:00:48 +00:00