Commit Graph

3352 Commits

Author SHA1 Message Date
Kenneth Uildriks 10e3022b10 Function attributes have index ~0, not 0
llvm-svn: 96370
2010-02-16 19:28:02 +00:00
Duncan Sands cbd43f89ac Introduce isOpaqueTy and use it rather than isa<OpaqueType>. Also, move some
methods to try to have the type predicates be more logically positioned.

llvm-svn: 96349
2010-02-16 14:50:09 +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
Nick Lewycky 1d9a8159df Teach the verifier to check the condition on a branch and ensure that it has
'i1' type.

llvm-svn: 96282
2010-02-15 22:09:09 +00:00
Nick Lewycky 62f864dea3 Fix crash in VerifyType when checking Contexts. Because there may not be a
Module (we were called with verifyFunction and an unowned Function) we can't
rely on Mod->getContext().

llvm-svn: 96275
2010-02-15 21:52:04 +00:00
Nick Lewycky 94e168f09e Don't try to materialize a function that isn't materializable anyways. This
fixes a crash using FPM on a Function that isn't owned by a Module.

llvm-svn: 96273
2010-02-15 21:27:56 +00:00
Nick Lewycky 780d2fe319 A function with no Module owner isn't materializable. This fixes F->dump() for
functions not embedded within modules.

llvm-svn: 96272
2010-02-15 21:27:20 +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
Jeffrey Yasskin 01f88a96c5 Make PassRegistrar thread-safe since it can be modified by code running in
separate LLVMContexts.

llvm-svn: 96051
2010-02-13 00:03:17 +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
Charles Davis be5557e86b Add a new function attribute, 'alignstack'. It will indicate (when the backends
implement support for it) that the stack should be forcibly realigned in the
prologue (and the process reversed in the epilogue).

llvm-svn: 95945
2010-02-12 00:31:15 +00:00
Devang Patel c07f1f4f7b revert 95903.
llvm-svn: 95918
2010-02-11 20:58:56 +00:00
Devang Patel 11ddc679ca Destroy MDNodes while destructing llvm context.
llvm-svn: 95903
2010-02-11 19:35:10 +00:00
Jeffrey Yasskin c660b23075 Fix some of the memcheck errors found in the JIT unittests.
llvm-svn: 95856
2010-02-11 06:41:30 +00:00
Dan Gohman bd11c41b91 Minor whitespace cleanups.
llvm-svn: 95801
2010-02-10 20:42:57 +00:00
Dan Gohman e34890f921 Add a hook to AssemblyAnnotationWriter to allow custom info comments
to be printed, in place of the familiar "uses=" comments.

llvm-svn: 95798
2010-02-10 20:41:46 +00:00
Dan Gohman 97c5902e78 Fix several comments which had previously been "the the" where a
different word was intended.

llvm-svn: 95795
2010-02-10 20:04:19 +00:00
Dan Gohman 4a618827de Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Dan Gohman 183a423af9 Canonicalize sizeof and alignof on pointer types to a canonical
pointer type.

llvm-svn: 95769
2010-02-10 06:13:07 +00:00
Kenneth Uildriks 08f618cd03 IntegerValType holds a uint32_t, so its constructor should take a uint32_t. This allows it to be properly initialized with bit widths > 65535
llvm-svn: 95731
2010-02-10 00:14:03 +00:00
Nick Lewycky b1d5ead9fb Make the destructor for TypeMapBase protected. Spotted by Duncan Sands with
cppcheck!

llvm-svn: 95527
2010-02-07 21:13:46 +00:00
Jakob Stoklund Olesen 74bb06c0f0 Reintroduce the InlineHint function attribute.
This time it's for real! I am going to hook this up in the frontends as well.

The inliner has some experimental heuristics for dealing with the inline hint.
When given a -respect-inlinehint option, functions marked with the inline
keyword are given a threshold just above the default for -O3.

We need some experiments to determine if that is the right thing to do.

llvm-svn: 95466
2010-02-06 01:16:28 +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
Dan Gohman f644af8bbe Factor out alignof expression folding into a separate function and
generalize it to handle more cases.

llvm-svn: 95045
2010-02-02 01:41:39 +00:00
Chris Lattner f5edeebd8c eliminate a bunch of pointless LLVMContext arguments.
llvm-svn: 95001
2010-02-01 20:48:08 +00:00
Duncan Sands dddba06e9e Fix typo "of" -> "or" and change the way a line was formatted to fit
into 80 columns to match my artistic preferences.

llvm-svn: 95000
2010-02-01 20:42:02 +00:00
Chris Lattner 94eb4b285b fix PR6195, a bug constant folding scalar -> vector compares.
llvm-svn: 94997
2010-02-01 20:04:40 +00:00
Chris Lattner 3c46e14137 fix PR6197 - infinite recursion in ipsccp due to block addresses
evaluateICmpRelation wasn't handling blockaddress.

llvm-svn: 94993
2010-02-01 19:35:08 +00:00
Dan Gohman e5e1b7b05a Generalize target-independent folding rules for sizeof to handle more
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.

Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.

Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.

And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.

llvm-svn: 94987
2010-02-01 18:27:38 +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 5ded1424b0 Print a comment next to "materializable" global values, to distinguish
them from values that are not actually defined in the module.

llvm-svn: 94854
2010-01-29 23:12:36 +00:00
Benjamin Kramer b17c58674e Convert some users of ftostr to raw_ostream.
llvm-svn: 94808
2010-01-29 14:42:22 +00:00
Dan Gohman a424b9fbd1 Remove the folding rule
getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1) 
  to
  inttoptr (i64 0 to i8*)
from the VMCore constant folder. It didn't handle sign-extension properly
in the case where the source integer is smaller than a pointer size. And,
it relied on an assumption about sizeof(i8).

The Analysis constant folder still folds these kinds of things; it has
access to TargetData, so it can do them right.

Add a testcase which tests that the VMCore constant folder doesn't
miscompile this, and that the Analysis folder does fold it.

llvm-svn: 94750
2010-01-28 18:08:26 +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
Ted Kremenek 8fafa93092 Update CMake build.
llvm-svn: 94687
2010-01-27 20:44:12 +00:00
Jeffrey Yasskin 091217be6f Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +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
Dan Gohman d86e295f8e Fix ICmpInst::makeConstantRange to use ConstantRange's API properly
in the case of empty and full ranges.

llvm-svn: 94548
2010-01-26 16:04:20 +00:00
Victor Hernandez 7e8ce9afbc Add MDNode::getIfExists(), an efficient way to determine if a value is used by metadata (since metadata does not appear in a value's use list)
llvm-svn: 94492
2010-01-26 02:36:35 +00:00
Bob Wilson fc060e4337 Change Value::getUnderlyingObject to have the MaxLookup value specified as a
parameter with a default value, instead of just hardcoding it in the
implementation.  The limit of MaxLookup = 6 was introduced in r69151 to fix
a performance problem with O(n^2) behavior in instcombine, but the scalarrepl
pass is relying on getUnderlyingObject to go all the way back to an AllocaInst.
Making the limit part of the method signature makes it clear that by default
the result is limited and should help avoid similar problems in the future.
This fixes pr6126.

llvm-svn: 94433
2010-01-25 18:26:54 +00:00
Chris Lattner dec86d7337 mark some libraries that currently require RTTI.
llvm-svn: 94377
2010-01-24 20:22:08 +00:00
Chris Lattner 531732b23c simplify code a bit.
llvm-svn: 94281
2010-01-23 04:42:42 +00:00
Mon P Wang e04b4567f8 InstCombine should not fold sext/zext of a vector and a bitcast to a scalar to a sext/zext
llvm-svn: 94280
2010-01-23 04:35:57 +00:00
Devang Patel ac277eb930 Remove MetadataBase class because it is not adding significant value.
llvm-svn: 94243
2010-01-22 22:52:10 +00:00
Victor Hernandez 016b286758 Fix/strengthen verification of llvm.dbg.declare
llvm-svn: 94195
2010-01-22 19:06:12 +00:00
Chris Lattner 7ba0661f27 Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Chris Lattner 5264fce147 give PassNameParser a home.
llvm-svn: 94162
2010-01-22 06:29:25 +00:00
Chris Lattner aec33da793 add an out-of-line virtual method to CmpInst to give it a home.
llvm-svn: 94161
2010-01-22 06:25:37 +00:00