Commit Graph

3645 Commits

Author SHA1 Message Date
Devang Patel
608f5a6d48 call void @llvm.dbg.declare(metadata !{i32* null}, metadata !1)
is valid, but not useful, when variable  identified by !1 is optimized away by the optimizer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98986 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 21:06:24 +00:00
Gabor Greif
cc52ed0c4f back out r98957, it broke http://smooshlab.apple.com:8010/builders/clang-x86_64-darwin10-fnt/builds/703 in the nightly test suite
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 13:50:02 +00:00
Gabor Greif
f4f10e3779 Recommit r80858 again (which has been backed out in r80871).
This time I did a self-hosted bootstrap on Linux x86-64,
with no problems. Let's see how darwin 64-bit self-hosting
goes. At the first sign of failure I'll back this out.

Maybe the valgrind bots give me a hint of what may be wrong
(it at all).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 11:55:53 +00:00
Chris Lattner
94c484d3b8 add asmprinter suport for unions, fixing Feature/unions.ll to actually
be doing something useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98677 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 21:21:35 +00:00
Chris Lattner
53d00241fb fix some pointless layering violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98460 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 01:56:06 +00:00
Jeffrey Yasskin
eca52b609c Allow types that have been forwarded to to be freed.
Tested: make check-lit && valgrind --dsymutil=yes --leak-check=full unittests/ExecutionEngine/JIT/Debug/JITTests


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98447 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 20:09:55 +00:00
Jeffrey Yasskin
6f555ca2cd Delete MDNodes when LLVMContext is destroyed. Previous attempts: r97918, r97788.
Tested: clang debug bootstrap, llvm-gcc bootstrap, `make check-lit`
after configuring with --with-llvmgccdir (and this did run the
FrontendC* tests this time)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 01:26:15 +00:00
Benjamin Kramer
48ee0bbb72 Remove duplicated code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98156 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 16:04:20 +00:00
Jeffrey Yasskin
6fec233a1e Roll back r97918 again. Just configuring against llvm-gcc wasn't enough to run
the FrontendC* tests. :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97921 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-07 19:26:40 +00:00
Jeffrey Yasskin
92ce42f9fc Reapply r97788 to free MDNodes when the LLVMContext is destroyed. It
bootstraps llvm-gcc this time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-07 18:46:57 +00:00
Nick Lewycky
e20ab4a03c Add verification of union types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97889 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 20:26:48 +00:00
Jeffrey Yasskin
b71a2fcf5e Revert r97788 because it broke test/FrontendC/2010-02-16-DbgVarScope.c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97792 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 06:43:49 +00:00
Jeffrey Yasskin
c8cfa30ca5 Free MDNodes when the LLVMContext is destroyed. Leak found by Valgrind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 05:47:09 +00:00
Jeffrey Yasskin
e5790a432a Stop leaking MDStrings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 23:24:19 +00:00
Erick Tryzelaar
d4076cfc83 Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153.
We need this so can not bake DESTDIR into the O'Caml symlinks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97743 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 20:56:19 +00:00
Nick Lewycky
5bf7f88ea2 Make the 'icmp pred trunc(ext(X)), CST --> icmp pred X, ext(trunc(CST))'
transformation much more careful. Truncating binary '01' to '1' sounds like it's
safe until you realize that it switched from positive to negative under a signed
interpretation, and that depends on the icmp predicate.

Also a few miscellaneous cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97721 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 06:54:10 +00:00
Chris Lattner
c8e14b3d37 fix incorrect folding of icmp with undef, PR6481.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97659 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03 19:46:03 +00:00
Erick Tryzelaar
df7df075b7 Add Module functions in place of module providers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97608 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 23:58:54 +00:00
Erick Tryzelaar
24b3733425 Rename LLVMUseIteratorRef to LLVMUseRef since we don't refer to iterators in llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97585 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 20:32:28 +00:00
Duncan Sands
6d52102b92 Rather than passing "false" for InsertBefore, AddressSpace for ThreadLocal,
and nothing for AddressSpace, pass 0 for InsertBefore, "false" for ThreadLocal
and AddressSpace for AddressSpace.  Spotted by gcc-4.5.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97563 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 11:18:43 +00:00
Erick Tryzelaar
f3d5c91550 Fix looking up MD names to not need a module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 05:32:52 +00:00
Dan Gohman
16b77211cf Don't print "Modified" for passes which haven't modified anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 17:34:28 +00:00
Erick Tryzelaar
8e130b1d0d Add support for global variables in an address space for llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:46:13 +00:00
Erick Tryzelaar
c59286bff1 Add indirect br support to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:46:06 +00:00
Erick Tryzelaar
46c80e0c56 Add metadata functions to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:45:59 +00:00
Erick Tryzelaar
19f047f5f6 Add the new builder arthmetic instructions to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 05:51:43 +00:00
Erick Tryzelaar
1940dd10dd Add the new union arthmetic instructions to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97371 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 05:51:33 +00:00
Erick Tryzelaar
abbcc5ee6f Add generic binary op and cast builder functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 05:51:27 +00:00
Dale Johannesen
350df33d72 Add type printing for Metadata pseudo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97251 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 19:38:59 +00:00
Dan Gohman
9ee0d8a917 Teach the constant folder about union types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 16:45:19 +00:00
Dan Gohman
2440cf1c6f Remove code which assumes it knows how vectors are stored in memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 16:05:33 +00:00
Nick Lewycky
fa0c54e3b8 Dump the presence of attached metadata even if we don't know what it is. This
format is not parsable, even if the module is legal. To get parsable output,
dump the module instead of the function or smaller, since metadata kind are
attached to the module (not the context).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97124 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 06:53:04 +00:00
Dan Gohman
0e488b3d1c Canonicalize ConstantInts to the right operand of commutative
operators.

The test difference is just due to the multiplication operands
being commuted (and thus requiring a more elaborate match). In
optimized code, that expression would be folded.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 22:43:23 +00:00
Dan Gohman
d97439d1e5 Use Instruction::isCommutative instead of duplicating it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96807 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 22:05:18 +00:00
Talin
196c60a571 replaceUsesOfWithOnConstant implementation for unions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 21:43:45 +00:00
Devang Patel
06fdaccc89 Destroy MDNodes gracefully while deleting llvm context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 20:53:16 +00:00
Kenneth Uildriks
f1ac0fd347 Function attributes have index ~0, not 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 19:28:02 +00:00
Duncan Sands
47c5188789 Introduce isOpaqueTy and use it rather than isa<OpaqueType>. Also, move some
methods to try to have the type predicates be more logically positioned.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96349 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 14:50:09 +00:00
Duncan Sands
1df9859c40 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 11:11:14 +00:00
Nick Lewycky
6a7cb63f6f Teach the verifier to check the condition on a branch and ensure that it has
'i1' type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 22:09:09 +00:00
Nick Lewycky
6e5a2bd032 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96275 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 21:52:04 +00:00
Nick Lewycky
c638088d6f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 21:27:56 +00:00
Nick Lewycky
936c43bb23 A function with no Module owner isn't materializable. This fixes F->dump() for
functions not embedded within modules.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 21:27:20 +00:00
Duncan Sands
b0bc6c361d Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 16:12:20 +00:00
Jeffrey Yasskin
cfd3072841 Make PassRegistrar thread-safe since it can be modified by code running in
separate LLVMContexts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 00:03:17 +00:00
Chris Lattner
fdfeb6976f Add support for a union type in LLVM IR. Patch by Talin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 20:49:41 +00:00
Charles Davis
1e063d14df 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 00:31:15 +00:00
Devang Patel
cb419d3c6f revert 95903.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 20:58:56 +00:00
Devang Patel
11dbf8ee69 Destroy MDNodes while destructing llvm context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 19:35:10 +00:00
Jeffrey Yasskin
9233b15d01 Fix some of the memcheck errors found in the JIT unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 06:41:30 +00:00
Dan Gohman
659d1e8bbb Minor whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95801 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 20:42:57 +00:00
Dan Gohman
7a5666e7f3 Add a hook to AssemblyAnnotationWriter to allow custom info comments
to be printed, in place of the familiar "uses=" comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95798 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 20:41:46 +00:00
Dan Gohman
f3b11aa6a7 Fix several comments which had previously been "the the" where a
different word was intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95795 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 20:04:19 +00:00
Dan Gohman
f451cb870e Fix "the the" and similar typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 16:03:48 +00:00
Dan Gohman
a84ffedafc Canonicalize sizeof and alignof on pointer types to a canonical
pointer type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95769 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 06:13:07 +00:00
Kenneth Uildriks
f1f505f85c IntegerValType holds a uint32_t, so its constructor should take a uint32_t. This allows it to be properly initialized with bit widths > 65535
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 00:14:03 +00:00
Nick Lewycky
337c6a8edd Make the destructor for TypeMapBase protected. Spotted by Duncan Sands with
cppcheck!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-07 21:13:46 +00:00
Jakob Stoklund Olesen
570a4a5d9c 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95466 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 01:16:28 +00:00
Duncan Sands
8991d51ddc Adding missing methods for creating Add, Mul, Neg and Sub with NUW.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 12:53:04 +00:00
Dan Gohman
6acb86dcfa Factor out alignof expression folding into a separate function and
generalize it to handle more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 01:41:39 +00:00
Chris Lattner
b29d596072 eliminate a bunch of pointless LLVMContext arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95001 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 20:48:08 +00:00
Duncan Sands
a419b56d89 Fix typo "of" -> "or" and change the way a line was formatted to fit
into 80 columns to match my artistic preferences.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 20:42:02 +00:00
Chris Lattner
6304b0dd63 fix PR6195, a bug constant folding scalar -> vector compares.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 20:04:40 +00:00
Chris Lattner
b63127d435 fix PR6197 - infinite recursion in ipsccp due to block addresses
evaluateICmpRelation wasn't handling blockaddress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94993 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 19:35:08 +00:00
Dan Gohman
4f8eea82d8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94987 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 18:27:38 +00:00
Dan Gohman
d75ff3104c Add a getNUWMul function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94982 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 16:38:14 +00:00
Dan Gohman
2544a1de66 Add a generalized form of ConstantExpr::getOffsetOf which works for
array types as well as struct types, and which accepts arbitrary
Constant indicies.  


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 16:37:38 +00:00
Dan Gohman
4483c7b15a Print a comment next to "materializable" global values, to distinguish
them from values that are not actually defined in the module.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94854 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 23:12:36 +00:00
Benjamin Kramer
5908839ced Convert some users of ftostr to raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94808 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 14:42:22 +00:00
Dan Gohman
8ca83b4111 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 18:08:26 +00:00
Dan Gohman
06ed3e788a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94738 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 02:43:22 +00:00
Dan Gohman
0f5efe5625 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 02:15:55 +00:00
Ted Kremenek
49a43f189b Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94687 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 20:44:12 +00:00
Jeffrey Yasskin
f0356fe140 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 20:34:15 +00:00
Chris Lattner
0b68a009f6 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])
                        ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 21:51:43 +00:00
Dan Gohman
f21107c07a Fix ICmpInst::makeConstantRange to use ConstantRange's API properly
in the case of empty and full ranges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94548 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 16:04:20 +00:00
Victor Hernandez
e685f230b6 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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 02:36:35 +00:00
Bob Wilson
032742972f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 18:26:54 +00:00
Chris Lattner
c0f8a361f5 mark some libraries that currently require RTTI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 20:22:08 +00:00
Chris Lattner
33b1758e16 simplify code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 04:42:42 +00:00
Mon P Wang
e4a0a151a5 InstCombine should not fold sext/zext of a vector and a bitcast to a scalar to a sext/zext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94280 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 04:35:57 +00:00
Devang Patel
bc5201f837 Remove MetadataBase class because it is not adding significant value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94243 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 22:52:10 +00:00
Victor Hernandez
02d574d7a8 Fix/strengthen verification of llvm.dbg.declare
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 19:06:12 +00:00
Chris Lattner
e73a31f667 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 06:49:46 +00:00
Chris Lattner
6eeb7345f2 give PassNameParser a home.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94162 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 06:29:25 +00:00
Chris Lattner
36fe19837c add an out-of-line virtual method to CmpInst to give it a home.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 06:25:37 +00:00
Chris Lattner
476e9bd114 elimiante the dynamic_cast's from opt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 06:03:06 +00:00
Chris Lattner
77c95ed74a eliminate a bunch more unneeded dynamic_cast's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94156 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 05:37:10 +00:00
Chris Lattner
3660ecabbb eliminate a bunch of dynamic_cast's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94155 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 05:24:46 +00:00
Chris Lattner
5e664b8f7c eliminate a bunch of dynamic_cast's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94154 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 04:55:08 +00:00
Chris Lattner
d3a6d90da7 tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 21:01:47 +00:00
Nick Lewycky
401f3258f6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94069 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 07:03:21 +00:00
Victor Hernandez
2ab47098f8 Backout r93990
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93995 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 07:37:49 +00:00
Victor Hernandez
3bcda49b35 Fix/strengthen verification of llvm.dbg.declare
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:57:02 +00:00
Victor Hernandez
6f8694b272 Fix if/else brackets; getFunctionForValue() is to be called for non-metadata values
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93984 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:22:33 +00:00
Chandler Carruth
9520cc2eae Fix the conditions to unambiguously show the logic they represent. This is the
logic enforced in the test case as well, so hopefully it is correct. Please
review Victor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93980 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:01:02 +00:00
Victor Hernandez
8fffff5371 Refactor common parts of MDNode::getFunction() and assertLocalFunction() into getFunctionForValue()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93977 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 04:45:57 +00:00
Victor Hernandez
6cead7879a Add comment that MDNode::getFunction() is not to be used by performance-critical code (currently only used by AsmWriter)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93802 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:55:08 +00:00
Victor Hernandez
54630e1cef Simplify MDNode::getFunction() and assertLocalFunction() by avoiding extra Function* variable and smallptrset since function-local metadata cannot be cyclic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93762 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 20:36:54 +00:00
Chris Lattner
b905b09f21 reject some invalid IR. We already assert and reject this from the
.ll parser, but PR6070 wants it in the verifier too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93756 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 19:50:32 +00:00
Victor Hernandez
38812dff7d Make printing of metadata more robust when function is not found (which is the normal situation for non function-local metadata)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 19:15:57 +00:00
Benjamin Kramer
dbc130f592 Update CMake files for Mangler move.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 22:23:09 +00:00
Chris Lattner
45111d160c move the mangler into libtarget from vmcore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93664 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 21:57:06 +00:00
Chris Lattner
c94c825a40 reapply the mangler gutting patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93656 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 21:08:46 +00:00
Rafael Espindola
0f0c97810c Revert 93648.
Mangler::getMangledName is used from lto
Mangler::setUseQuotes is used in the AsmPrinter
Mangler::setSymbolsCanStartWithDigit is used in the AsmPrinter


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93652 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 20:27:59 +00:00
Chris Lattner
848d0f37d2 Mangler::getMangledName is now dead, remove it and all the other stuff in Mangler that is now transitively dead. woo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93648 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 19:08:51 +00:00
Chris Lattner
61f160a84e add an inefficient version of getNameWithPrefix that returns an std::string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93641 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 18:06:34 +00:00
Eric Christopher
606a1d1f59 Remove the InlineHint attribute. There are no current or planned
users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 21:36:30 +00:00
Victor Hernandez
3a32865d58 Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.
It also strips old llvm.dbg.declare intrinsics that did not pass metadata as the first argument.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 19:04:09 +00:00
Victor Hernandez
5f03238d62 Revert r93504 because older uses of llvm.dbg.declare intrinsics need to be auto-upgraded
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93515 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 17:36:47 +00:00
Victor Hernandez
283ba2fbb4 Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93504 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 03:37:48 +00:00
Victor Hernandez
e05f66ef2e In debug builds, assert that function-local metadata has only 1 parent function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93449 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 20:12:34 +00:00
Victor Hernandez
559588b156 Fix printing of function-local metadata in AsmWriter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93402 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 01:47:37 +00:00
Victor Hernandez
c7650b4d19 Add MDNode::getFunction(), which figures out the metadata's function, if it has function that it is local to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93400 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 01:45:14 +00:00
Benjamin Kramer
b357e06f67 Introduce Twine::toStringRef, a variant of toVector which avoids the copy if the
twine can be represented as a single StringRef. Use the new methode to simplify
some twine users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93317 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 12:45:23 +00:00
Chris Lattner
b74978f8e5 don't add the \1 to the name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 07:50:21 +00:00
Chris Lattner
bf86e5df18 add new isSingleStringRef()/getSingleStringRef() methods to twine,
and use them to avoid a copy of a string in getNameWithPrefix in
the common case.  It seems like Value::setName and other places 
should use this as well?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93301 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 07:12:06 +00:00
Chris Lattner
0e7ab8cb07 ugh, my last patch just sped up a method and changed all the clients
that I want to completely eliminate.  Add fixme's so I remember this
in the future, and add the missing helper that they should be upgraded
to use instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93300 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 07:01:09 +00:00
Chris Lattner
4813035b72 change Mangler::makeNameProper to return its result in a SmallVector
instead of returning it in an std::string.  Based on this change:

1. Change TargetLoweringObjectFileCOFF::getCOFFSection to take a StringRef
2. Change a bunch of targets to call makeNameProper with a smallstring,
   making several of them *much* more efficient.
3. Rewrite Mangler::makeNameProper to not build names and then prepend
   prefixes, not use temporary std::strings, and to avoid other crimes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 06:38:18 +00:00
Chris Lattner
36e69ae3c1 my mistake, Mangler::makeNameProper wants to take a twine, not a stringref!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 05:02:57 +00:00
Chris Lattner
1cb75460b6 change makeNameProper to take a stringref instead of std::string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93295 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 04:55:33 +00:00
Dale Johannesen
5f72a5ebc8 Further progration of metadata operands. The
dumper doesn't really do what I want yet, but
at least it doesn't crash now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 00:00:24 +00:00
Devang Patel
d77fdba573 Use Twine, instead of StringRef, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93249 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 18:57:56 +00:00
Devang Patel
26028f27dd Use ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93247 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 18:34:06 +00:00
Benjamin Kramer
d4f195999a Reimplement getToken and SplitString as "StringRef helper functions"
- getToken is modeled after StringRef::split but it can split on multiple
  separator chars and skips leading seperators.
- SplitString is a StringRef::split variant for more than 2 elements with the
  same behaviour as getToken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 18:03:24 +00:00
Victor Hernandez
5b7e48b56c Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 07:45:19 +00:00
Chris Lattner
859c372e04 fix a buggy assertion, CreateIntegerCast should allow
integer vectors as well as just integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93126 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 20:21:42 +00:00
Mikhail Glushenkov
0d75d874bf Suppress a warning on gcc 4.4.
warning: suggest parentheses around ‘&&’ within ‘||’.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93121 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 18:48:49 +00:00
Victor Hernandez
24e64df7ec Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93108 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 07:14:18 +00:00
Chris Lattner
d686c8e73f "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."
Patch by James Y Knight!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93079 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 22:27:07 +00:00
Devang Patel
87df867fd7 Delete NamedMDSymTable while destrucing Module.
Disable  copy ctor and operator= for NamedMDSymTable. Hide typedef that should be public.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93041 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 01:44:59 +00:00
Devang Patel
8fba578be7 Derive NamedMDNode from Value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 00:30:14 +00:00
Devang Patel
0386f01e06 Use separate namespace for named metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 19:39:36 +00:00
Devang Patel
69d02e0a17 Allow null to be an element of NamedMDNode. e.g. !llvm.stuff = !{!0, !1, null}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:47:32 +00:00
Victor Hernandez
771150accb Fix comment for CheckDebugInfoIntrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:13:46 +00:00
Benjamin Kramer
8c65f6e71c Move remaining stuff to the isInteger predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92771 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:05:54 +00:00
Devang Patel
3e30c2a3c5 NamedMDNode is a collection MDNodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92761 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 20:41:31 +00:00
Benjamin Kramer
11acaa374c Convert a ton of simple integer type equality tests to the new predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 20:07:06 +00:00
Benjamin Kramer
13be48701d Add a new predicate for integer type equality tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92759 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 20:04:48 +00:00
Benjamin Kramer
f012705c7e Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92726 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 13:12:22 +00:00
David Greene
da23d93d9b Fix a build error and change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92669 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:34:26 +00:00
David Greene
9a6c940d7c Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:30:18 +00:00
David Greene
c1bda3b8ff Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92664 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:30:14 +00:00
David Greene
6892c7a92d Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92663 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:30:09 +00:00
David Greene
efc258146d Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:30:06 +00:00
David Greene
840d41e7d1 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92661 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:30:04 +00:00
David Greene
170c48af5a Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92660 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:30:02 +00:00
David Greene
43078d6931 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92659 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:30:00 +00:00
David Greene
ef1894ed7e Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92658 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:29:58 +00:00
David Greene
fc524526e4 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92657 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:29:55 +00:00
David Greene
c0a6a2afcb Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92656 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:29:39 +00:00
David Greene
d865e02ea2 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92652 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:29:26 +00:00
David Greene
d2e63b7fdb Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92650 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:29:19 +00:00
David Greene
4b12168ce5 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92649 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:29:14 +00:00
Devang Patel
44a29e066a Remove dead debug info intrinsics.
Intrinsic::dbg_stoppoint
 Intrinsic::dbg_region_start 
 Intrinsic::dbg_region_end 
 Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92557 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:10:40 +00:00
Dan Gohman
7ba4e17285 Add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-04 18:38:39 +00:00
Chris Lattner
fa5dd977e4 it isn't safe to speculative load from a malloc, it might have
returned null, and may not have been big enough in any case.  
Thanks to Jay Foad for pointing this out!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-03 18:14:24 +00:00
Chris Lattner
5099b31f98 differences between two blockaddress's don't cause a
global variable initializer to require relocations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92450 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-03 18:09:40 +00:00
Chris Lattner
dbe85bffd7 fix refactoro
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 08:23:09 +00:00
Chris Lattner
c65b72ca26 use early exits to reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:33:14 +00:00
Chris Lattner
85b1912dba eliminate another copy of the mdnode printing logic, simplify the
one that remains.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:31:59 +00:00
Chris Lattner
2b4b1e2e60 random tidying for MDNode printing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:27:30 +00:00
Chris Lattner
bd72b3201b eliminate a bunch of useless forwarding functions with one caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:23:35 +00:00
Chris Lattner
307c9893fc make mdnMap type safe, rename accessors for consistency with the rest of llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:20:11 +00:00
Chris Lattner
51ea55f0ec metadata can't be a global var initializer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:15:45 +00:00
Chris Lattner
6e6b1805da simplify mdnode printing logic. Now N->dump() only
dumps one node instead of all of them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92329 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:13:35 +00:00
Chris Lattner
fdb3356477 unify two copies of the NamedMDNode printing code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:54:05 +00:00
Chris Lattner
7d054b385f fix printing of function-local metadata to print all the operands of the
mdnode, not just operand 0 over and over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92326 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:44:44 +00:00
Chris Lattner
4a3d3a54eb simplify printing of mdstring and Argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:41:14 +00:00
Chris Lattner
38cf02ebc9 simplify asmprinting of NamedMDNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:36:50 +00:00
Chris Lattner
183912af79 Remove #include of metadata.h from intrinsicinst.h. The only
method that needs it (DbgValueInst::getValue) has been moved out
of line.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:32:41 +00:00
Chris Lattner
5d0cacdbb6 rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:22:29 +00:00
Chris Lattner
b76359e36e Optimize MDNode to coallocate the operand list immediately
after the MDNode in memory.  This eliminates the operands
pointer and saves a new[] per node.

Note that the code in DIDerivedType::replaceAllUsesWith is wrong
and quite scary.  A MDNode should not be RAUW'd with something
else: this changes all uses of the mdnode, which may not be debug
info related!  Debug info should use something non-mdnode for
declarations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:05:46 +00:00
Chris Lattner
54a1f9f9c1 do not bother reuniquing mdnodes whose operands drop to null. Doing
so can be a huge performance issue when tearing down modules and mdnodes
are not guaranteed to be unique anyway.  This speeds up:
$ time ~/llvm/Release/bin/clang gcc.c -w -S -g

from 72 to 35s, where gcc.c is from:
http://people.csail.mit.edu/smcc/projects/single-file-programs/



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-30 21:42:11 +00:00
Chris Lattner
83738a20dd remove some misleading comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-30 20:25:09 +00:00
Chris Lattner
837eda93ee Do not crash when .ll printing metadata that smells like debug info, but isn't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 21:17:33 +00:00
Chris Lattner
081134741b Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 09:01:33 +00:00
Chris Lattner
b17f65829c privatize another interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 07:56:15 +00:00
Chris Lattner
44f3d23b60 the only call to this function (from clang) has been removed, zap it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 07:50:09 +00:00
Chris Lattner
508b19a5a4 remove some unneeded Metadata interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 07:44:16 +00:00
Chris Lattner
4ee93c4303 tidy up debug info comments, use ->isVoidTy() where reasonable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 07:25:48 +00:00
Chris Lattner
a43a3f2379 When doing v1->RAUW(v2), don't do anything to metadata. We don't know
why one was replaced with the other.  Even in the specific case of 
debug information, it doesn't make sense to transfer the location over,
this will just result in jumbled loc info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 02:53:52 +00:00
Chris Lattner
b2406d9895 sink the Instruction::HasMetadata bit into SubclassData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 02:46:09 +00:00
Chris Lattner
cafe9bba32 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 02:14:09 +00:00
Chris Lattner
3990b121cf This is a major cleanup of the instruction metadata interfaces that
I asked Devang to do back on Sep 27.  Instead of going through the
MetadataContext class with methods like getMD() and getMDs(), just
ask the instruction directly for its metadata with getMetadata()
and getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about 
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 23:41:32 +00:00
Chris Lattner
0f15a59862 add IRBuilder.cpp to cmake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 21:52:41 +00:00
Chris Lattner
2ad32752b9 remove #include of Function.h from IRBuilder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 21:50:56 +00:00
Chris Lattner
43469b6957 move debug info stuff out of line, allowing two #includes
to go away from IRBuilder.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 21:45:40 +00:00
Chris Lattner
a53cfd16f0 split code that doesn't need to be templated out of IRBuilder into a new
non-templated IRBuilderBase class.  Move that large CreateGlobalString
out of line, eliminating the need to #include GlobalVariable.h in IRBuilder.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 21:28:46 +00:00
Chris Lattner
0eb419800a rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
doesn't exist already, eliminate registerMDKind.  Tidy up a bunch
of random stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 20:45:51 +00:00
Chris Lattner
7d05c46d60 rename getHandlerNames to getMDKindNames, simplify its interface
and simplify all the clients that use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 20:10:43 +00:00
Chris Lattner
06ac32cc86 tidy up and delete a dead smallvector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 19:49:00 +00:00
Chris Lattner
df58389ef1 avoid a completely unneeded linear walk.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92221 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 09:32:10 +00:00
Chris Lattner
496425774e Eliminate two bits of ugliness in MDNode::replaceElement:
eliminate the temporary smallvector, and only do FindNodeOrInsertPos
twice if the first one succeeds and we delete a node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92220 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 09:24:53 +00:00
Chris Lattner
f2410180d0 rearrange some methods, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92219 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 09:12:35 +00:00
Chris Lattner
1d880e5114 avoid temporary CallbackVH's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 09:10:16 +00:00
Chris Lattner
b241b37031 Rewrite the function-local validation logic for MDNodes (most of r91708).
Among other benefits, this doesn't leak the SmallPtrSet, has the verifier
code in the verifier pass, actually does the verification at the end,
and is considerably simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92217 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 09:07:21 +00:00
Chris Lattner
dfdb5dcf56 rename MDNode instance variables to something meaningful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92216 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 08:48:12 +00:00
Chris Lattner
5e9cd43423 snip one more #include from Metadata.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92214 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 08:30:43 +00:00
Chris Lattner
37da0ad07b prune some #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 08:24:16 +00:00