1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

3575 Commits

Author SHA1 Message Date
Chris Lattner
b27da4e9b4 switch IRBuilder to use NewDebugLoc for locations instead
of raw mdnodes.  This allows frontends to specify debug
locations without ever creating an MDNode for the DILocation.

This requires a corresponding clang/llvm-gcc change which
I'll try to commit as simultaneously as possible.

llvm-svn: 100095
2010-04-01 06:31:45 +00:00
Chris Lattner
96eb1c7f8f Switch the representation of the location in instruction from
being a TrackingVH<MDNode> to a NewDebugLoc, shrinking 
sizeof(Instruction) a lot, and providing clients the ability
to deal with locations in terms of NewDebugLoc instead of
having to deal with Metadata.  This is still fully compatible
with all clients that *do* use MDNodes for everything of
course.

No functionality change.

llvm-svn: 100088
2010-04-01 05:23:13 +00:00
Chris Lattner
ff4e2688f5 fix a bug in DebugRecVH::deleted/allUsesReplacedWith. If an
entry in the Scope+InlinedAt drops to a non-canonical form,
we need to reset the idx member of both VH's to 0.

llvm-svn: 100084
2010-04-01 05:12:07 +00:00
Chris Lattner
a913028fc0 add a method to decode a DILocation into a NewDebugLoc.
llvm-svn: 100081
2010-04-01 03:55:42 +00:00
Chris Lattner
012fc38ef5 update cmakefile.
llvm-svn: 100074
2010-04-01 01:02:19 +00:00
Chris Lattner
b19f7964ea Add a new "NewDebugLoc" class which will eventually replace DebugLoc,
and will replace the 'DbgInfo' member in Instruction.

The benefit of NewDebugLoc is that it is compact (8 bytes vs 12/24 
bytes for the DbgInfo member in Instruction on a 32/64 bit system),
it means that we will end up not having to allocate MDNodes to 
represent the "DILocations" in common cases of -O0 -g, and it is
much more efficient to get things out of than the MDNode.

llvm-svn: 100072
2010-04-01 00:37:44 +00:00
Benjamin Kramer
e006100c19 Bump SmallString size a bit to avoid malloc trashing.
llvm-svn: 100010
2010-03-31 16:04:26 +00:00
Chris Lattner
c02045830c make irbuilder use the new optimized debug info accessors.
llvm-svn: 99984
2010-03-31 04:09:11 +00:00
Chris Lattner
27c9cacb63 add new apis for getting/setting !dbg metadata on
instructions.  In addition to being a convenience,
they are faster than the old apis, particularly when
not going from an MDKindID like people should be
doing.

llvm-svn: 99982
2010-03-31 03:34:40 +00:00
Chris Lattner
9ab48420db Fix a major source of compile-time slowness at -O0 -g by optimizing
the storage of !dbg metadata kinds in the instruction themselves.
The on-the-side hash table works great for metadata that not-all
instructions get, or for metadata that only exists when optimizing.
But when compile-time is everything, it isn't great.

I'm not super thrilled with the fact that this plops a TrackingVH in
Instruction, because it grows it by 3 words.  I'm investigating 
alternatives, but this should be a step in the right direction in any
case.

llvm-svn: 99957
2010-03-30 23:03:27 +00:00
Bob Wilson
aae933cc81 Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
llvm-svn: 99948
2010-03-30 22:27:04 +00:00
Mon P Wang
9351ea594a Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
A update of langref will occur in a subsequent checkin.

llvm-svn: 99928
2010-03-30 20:55:56 +00:00
Chris Lattner
542ebce5fa move some method definitions to files that make sense.
llvm-svn: 99927
2010-03-30 20:48:48 +00:00
Eric Christopher
4c3a3208e3 Remove the pmulld intrinsic and autoupdate it as a vector multiply.
Rewrite the pmulld patterns, and make sure that they fold in loads of
arguments into the instruction.

llvm-svn: 99910
2010-03-30 18:49:01 +00:00
Chris Lattner
4424043996 reapply my timer rewrite with a change for PassManager to store
timers by pointer instead of by-value.

llvm-svn: 99871
2010-03-30 04:03:22 +00:00
Chris Lattner
bbb637bacc revert r99862 which is causing FNT failures.
llvm-svn: 99870
2010-03-30 03:57:00 +00:00
Chris Lattner
65efe21d42 fairly major rewrite of various timing related stuff.
llvm-svn: 99862
2010-03-30 02:38:19 +00:00
Chris Lattner
f21a1afe81 add support for zero initialized unions, patch by Tim Northover!
llvm-svn: 99818
2010-03-29 17:36:02 +00:00
Jeffrey Yasskin
727548a580 Oops, r98447 dropped the reference to ForwardType in the wrong place in
Type::destroy(), so it got skipped for FunctionTypes, StructTypes, and
UnionTypes.  This fixes the resulting leaks in test/Feature/opaquetypes.ll and
test/Integer/opaquetypes_bt.ll.

llvm-svn: 99732
2010-03-28 01:03:47 +00:00
Gabor Greif
c637593cda rename pred_const_iterator to const_pred_iterator for consistency's sake
llvm-svn: 99567
2010-03-25 23:25:28 +00:00
Gabor Greif
df5013e4d8 rename use_const_iterator to const_use_iterator for consistency's sake
llvm-svn: 99564
2010-03-25 23:06:16 +00:00
Devang Patel
f4b5d152ee Include isFunctionLocal while calculating folding node set profile for a MDNode.
llvm-svn: 99490
2010-03-25 06:04:47 +00:00
Devang Patel
aa891ccfaf Include isFunctionLocal while calculating folding node set provide for a MDNode.
llvm-svn: 99484
2010-03-25 05:36:13 +00:00
Eric Christopher
b3abae8852 Reapply r99451 with a fix to move the NoInline check to the cost functions
instead of InlineFunction.

llvm-svn: 99483
2010-03-25 04:49:10 +00:00
Eric Christopher
e293604548 Temporarily revert this, it's causing an issue with an internal project.
llvm-svn: 99451
2010-03-24 23:35:21 +00:00
Gabor Greif
624a31f2eb Finally land the InvokeInst operand reordering.
I have audited all getOperandNo calls now, fixing
hidden assumptions. CallSite related uglyness will
be eliminated successively.

Note this patch has a long and griveous history,
for all the back-and-forths have a look at
CallSite.h's log.

llvm-svn: 99399
2010-03-24 13:21:49 +00:00
Chris Lattner
a9eb6a6987 add some accessors to callsite/callinst/invokeinst to check
for the noinline attribute, and make the inliner refuse to
inline a call site when the call site is marked noinline even
if the callee isn't.  This fixes PR6682.

llvm-svn: 99341
2010-03-23 22:59:07 +00:00
Chris Lattner
5808510db7 fix an infinite loop in Module::getEndianness, PR6684
patch by Alex Mac!

llvm-svn: 99330
2010-03-23 21:48:41 +00:00
Gabor Greif
adb193f366 add assert in argpromotion, which cannot trigger
if Function::hasAddressTaken works as advertised

also included some cosmetic cleanups

llvm-svn: 99276
2010-03-23 14:40:20 +00:00
Gabor Greif
652eabfbb0 word-o
llvm-svn: 99275
2010-03-23 13:45:54 +00:00
Chris Lattner
c4be1194e5 Change intrinsic result type for void to store it as an empty list
instead of as a single element list with VoidTy.  Now with a fix
for the verifier.

llvm-svn: 99206
2010-03-22 20:56:36 +00:00
Gabor Greif
ef64581628 backing out r99170 because it still fails on clang-x86_64-darwin10-fnt
llvm-svn: 99171
2010-03-22 09:11:00 +00:00
Gabor Greif
04f7f381ae Now that hopefully all direct accesses to InvokeInst operands are fixed
we can reapply the InvokeInst operand reordering patch. (see r98957).

llvm-svn: 99170
2010-03-22 08:28:00 +00:00
Jeffrey Yasskin
94ecd53a3a Free all Constants in ~LLVMConstantImpl. We avoid assertion failures
by dropping all references from all constants that can use other
constants before trying to destroy any of them.

I also had to free bugpoint's Module in ~BugDriver().

llvm-svn: 99160
2010-03-22 05:23:37 +00:00
Jeffrey Yasskin
f4aab98729 Re-add the Metadata.h include to LLVMContextImpl.h so that MDNode is complete
where FoldingSet<MDNode> is instantiated.  Clang and MSVC complain; gcc
doesn't.

llvm-svn: 99147
2010-03-21 22:08:41 +00:00
Jeffrey Yasskin
98a4091e4a Move the LLVMContextImpl implementation into a .cpp file.
llvm-svn: 99146
2010-03-21 21:17:34 +00:00
Jeffrey Yasskin
50a0593887 Memoize InlineAsms into the LLVMContext and delete them on shutdown.
Fixes PR803.

llvm-svn: 99143
2010-03-21 20:37:19 +00:00
Devang Patel
72d0d6e368 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.

llvm-svn: 98986
2010-03-19 21:06:24 +00:00
Gabor Greif
0bfed2dc4e back out r98957, it broke http://smooshlab.apple.com:8010/builders/clang-x86_64-darwin10-fnt/builds/703 in the nightly test suite
llvm-svn: 98958
2010-03-19 13:50:02 +00:00
Gabor Greif
953702b8e6 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).

llvm-svn: 98957
2010-03-19 11:55:53 +00:00
Chris Lattner
b51960824f add asmprinter suport for unions, fixing Feature/unions.ll to actually
be doing something useful.

llvm-svn: 98677
2010-03-16 21:21:35 +00:00
Chris Lattner
72761c4e3d fix some pointless layering violations.
llvm-svn: 98460
2010-03-14 01:56:06 +00:00
Jeffrey Yasskin
c57043834c 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
llvm-svn: 98447
2010-03-13 20:09:55 +00:00
Jeffrey Yasskin
819ce89d8f 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)

llvm-svn: 98410
2010-03-13 01:26:15 +00:00
Benjamin Kramer
adf47face1 Remove duplicated code. No functionality change.
llvm-svn: 98156
2010-03-10 16:04:20 +00:00
Jeffrey Yasskin
82f0356671 Roll back r97918 again. Just configuring against llvm-gcc wasn't enough to run
the FrontendC* tests. :(

llvm-svn: 97921
2010-03-07 19:26:40 +00:00
Jeffrey Yasskin
daae74ff0d Reapply r97788 to free MDNodes when the LLVMContext is destroyed. It
bootstraps llvm-gcc this time.

llvm-svn: 97918
2010-03-07 18:46:57 +00:00
Nick Lewycky
711ead8deb Add verification of union types.
llvm-svn: 97889
2010-03-06 20:26:48 +00:00
Jeffrey Yasskin
ec7d47ec83 Revert r97788 because it broke test/FrontendC/2010-02-16-DbgVarScope.c.
llvm-svn: 97792
2010-03-05 06:43:49 +00:00
Jeffrey Yasskin
a526081ebf Free MDNodes when the LLVMContext is destroyed. Leak found by Valgrind.
llvm-svn: 97788
2010-03-05 05:47:09 +00:00
Jeffrey Yasskin
5bdd4796e4 Stop leaking MDStrings.
llvm-svn: 97763
2010-03-04 23:24:19 +00:00
Erick Tryzelaar
4e7593750d Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153.
We need this so can not bake DESTDIR into the O'Caml symlinks.

llvm-svn: 97743
2010-03-04 20:56:19 +00:00
Nick Lewycky
58ab63e179 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.

llvm-svn: 97721
2010-03-04 06:54:10 +00:00
Chris Lattner
9e230fb6b2 fix incorrect folding of icmp with undef, PR6481.
llvm-svn: 97659
2010-03-03 19:46:03 +00:00
Erick Tryzelaar
66bf49241f Add Module functions in place of module providers.
llvm-svn: 97608
2010-03-02 23:58:54 +00:00
Erick Tryzelaar
0d0b778d8b Rename LLVMUseIteratorRef to LLVMUseRef since we don't refer to iterators in llvm-c.
llvm-svn: 97585
2010-03-02 20:32:28 +00:00
Duncan Sands
5a60a368dd 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.

llvm-svn: 97563
2010-03-02 11:18:43 +00:00
Erick Tryzelaar
24ec58b50b Fix looking up MD names to not need a module.
llvm-svn: 97550
2010-03-02 05:32:52 +00:00
Dan Gohman
4fc1d1236f Don't print "Modified" for passes which haven't modified anything.
llvm-svn: 97446
2010-03-01 17:34:28 +00:00
Erick Tryzelaar
c6e78e3503 Add support for global variables in an address space for llvm-c and ocaml.
llvm-svn: 97377
2010-02-28 09:46:13 +00:00
Erick Tryzelaar
08d9f8e8fe Add indirect br support to llvm-c and ocaml.
llvm-svn: 97376
2010-02-28 09:46:06 +00:00
Erick Tryzelaar
9401ea01cc Add metadata functions to llvm-c and ocaml.
llvm-svn: 97375
2010-02-28 09:45:59 +00:00
Erick Tryzelaar
f7bbb83b17 Add the new builder arthmetic instructions to llvm-c and ocaml.
llvm-svn: 97372
2010-02-28 05:51:43 +00:00
Erick Tryzelaar
9c6bd15491 Add the new union arthmetic instructions to llvm-c and ocaml.
llvm-svn: 97371
2010-02-28 05:51:33 +00:00
Erick Tryzelaar
b405437c48 Add generic binary op and cast builder functions.
llvm-svn: 97370
2010-02-28 05:51:27 +00:00
Dale Johannesen
53dbd67b19 Add type printing for Metadata pseudo.
llvm-svn: 97251
2010-02-26 19:38:59 +00:00
Dan Gohman
a15e497d94 Teach the constant folder about union types.
llvm-svn: 97142
2010-02-25 16:45:19 +00:00
Dan Gohman
f42f098d1d Remove code which assumes it knows how vectors are stored in memory.
llvm-svn: 97141
2010-02-25 16:05:33 +00:00
Nick Lewycky
c443274bc1 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).

llvm-svn: 97124
2010-02-25 06:53:04 +00:00
Dan Gohman
97481fb5e0 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.

llvm-svn: 96816
2010-02-22 22:43:23 +00:00
Dan Gohman
0a0f1d2ee2 Use Instruction::isCommutative instead of duplicating it.
llvm-svn: 96807
2010-02-22 22:05:18 +00:00
Talin
cd8428c41f replaceUsesOfWithOnConstant implementation for unions.
llvm-svn: 96616
2010-02-18 21:43:45 +00:00
Devang Patel
5c67cb332e Destroy MDNodes gracefully while deleting llvm context.
llvm-svn: 96609
2010-02-18 20:53:16 +00:00
Kenneth Uildriks
13195c9525 Function attributes have index ~0, not 0
llvm-svn: 96370
2010-02-16 19:28:02 +00:00
Duncan Sands
e9a13a3c60 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
1b33dd3c83 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
b38ae458a4 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
a21f060918 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
1dcde6b319 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
1357e1c99a 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
2acaf3609c 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
963eee9ee1 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
2265d6280b 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
d69c12ecc6 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
c83d8c3ccf revert 95903.
llvm-svn: 95918
2010-02-11 20:58:56 +00:00
Devang Patel
b41ff23af9 Destroy MDNodes while destructing llvm context.
llvm-svn: 95903
2010-02-11 19:35:10 +00:00
Jeffrey Yasskin
ad23983452 Fix some of the memcheck errors found in the JIT unittests.
llvm-svn: 95856
2010-02-11 06:41:30 +00:00
Dan Gohman
296f6e4952 Minor whitespace cleanups.
llvm-svn: 95801
2010-02-10 20:42:57 +00:00
Dan Gohman
f2323826d2 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
efb42fa7c7 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
92b6122204 Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Dan Gohman
ff8027e33a 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
d9026b3fa4 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
866c48ae12 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
83ebc265b3 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
364e9510fb 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
dd6702be8f 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
af2e10ddef eliminate a bunch of pointless LLVMContext arguments.
llvm-svn: 95001
2010-02-01 20:48:08 +00:00
Duncan Sands
6737709951 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
18e6b4eb6b fix PR6195, a bug constant folding scalar -> vector compares.
llvm-svn: 94997
2010-02-01 20:04:40 +00:00
Chris Lattner
8e4042108e 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
0b2c2769ba 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
d1d30c5ec2 Add a getNUWMul function.
llvm-svn: 94982
2010-02-01 16:38:14 +00:00
Dan Gohman
9026a494ae 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
c5a2b73589 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
cae092b08b Convert some users of ftostr to raw_ostream.
llvm-svn: 94808
2010-01-29 14:42:22 +00:00
Dan Gohman
0dc9176f36 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
4319402eb0 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
1eb6920a2f 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
7c93f74ed0 Update CMake build.
llvm-svn: 94687
2010-01-27 20:44:12 +00:00
Jeffrey Yasskin
fb10587e50 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
c2717878e8 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
332216f73c 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
ab3ebb1a4a 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
1882fba746 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
397d34f06b mark some libraries that currently require RTTI.
llvm-svn: 94377
2010-01-24 20:22:08 +00:00
Chris Lattner
7223430983 simplify code a bit.
llvm-svn: 94281
2010-01-23 04:42:42 +00:00
Mon P Wang
b7fce13b78 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
81f0fa06d7 Remove MetadataBase class because it is not adding significant value.
llvm-svn: 94243
2010-01-22 22:52:10 +00:00
Victor Hernandez
b2ccd2be93 Fix/strengthen verification of llvm.dbg.declare
llvm-svn: 94195
2010-01-22 19:06:12 +00:00
Chris Lattner
276811b58a 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
437827ceb5 give PassNameParser a home.
llvm-svn: 94162
2010-01-22 06:29:25 +00:00
Chris Lattner
cb9776c350 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
Chris Lattner
c07d7f41e3 elimiante the dynamic_cast's from opt.
llvm-svn: 94160
2010-01-22 06:03:06 +00:00
Chris Lattner
f683d7d909 eliminate a bunch more unneeded dynamic_cast's.
llvm-svn: 94156
2010-01-22 05:37:10 +00:00
Chris Lattner
1bd9c3ec88 eliminate a bunch of dynamic_cast's.
llvm-svn: 94155
2010-01-22 05:24:46 +00:00
Chris Lattner
997ad42b6d eliminate a bunch of dynamic_cast's.
llvm-svn: 94154
2010-01-22 04:55:08 +00:00
Chris Lattner
7d29f831ea tidy up
llvm-svn: 94100
2010-01-21 21:01:47 +00:00
Nick Lewycky
938b8b195c 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
Victor Hernandez
871f27928b Backout r93990
llvm-svn: 93995
2010-01-20 07:37:49 +00:00
Victor Hernandez
78168a7fa6 Fix/strengthen verification of llvm.dbg.declare
llvm-svn: 93990
2010-01-20 06:57:02 +00:00
Victor Hernandez
78e1b5625a Fix if/else brackets; getFunctionForValue() is to be called for non-metadata values
llvm-svn: 93984
2010-01-20 06:22:33 +00:00
Chandler Carruth
9129b5c2b9 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.

llvm-svn: 93980
2010-01-20 06:01:02 +00:00
Victor Hernandez
d8a7839c7b Refactor common parts of MDNode::getFunction() and assertLocalFunction() into getFunctionForValue()
llvm-svn: 93977
2010-01-20 04:45:57 +00:00
Victor Hernandez
edcdd08463 Add comment that MDNode::getFunction() is not to be used by performance-critical code (currently only used by AsmWriter)
llvm-svn: 93802
2010-01-18 22:55:08 +00:00
Victor Hernandez
247ec55125 Simplify MDNode::getFunction() and assertLocalFunction() by avoiding extra Function* variable and smallptrset since function-local metadata cannot be cyclic
llvm-svn: 93762
2010-01-18 20:36:54 +00:00
Chris Lattner
4104b0bccd reject some invalid IR. We already assert and reject this from the
.ll parser, but PR6070 wants it in the verifier too.

llvm-svn: 93756
2010-01-18 19:50:32 +00:00
Victor Hernandez
b1b145fed9 Make printing of metadata more robust when function is not found (which is the normal situation for non function-local metadata)
llvm-svn: 93748
2010-01-18 19:15:57 +00:00
Benjamin Kramer
58787e4d0b Update CMake files for Mangler move.
llvm-svn: 93665
2010-01-16 22:23:09 +00:00
Chris Lattner
51e8abe640 move the mangler into libtarget from vmcore.
llvm-svn: 93664
2010-01-16 21:57:06 +00:00
Chris Lattner
6efe5156eb reapply the mangler gutting patch.
llvm-svn: 93656
2010-01-16 21:08:46 +00:00
Rafael Espindola
d6c021a8d7 Revert 93648.
Mangler::getMangledName is used from lto
Mangler::setUseQuotes is used in the AsmPrinter
Mangler::setSymbolsCanStartWithDigit is used in the AsmPrinter

llvm-svn: 93652
2010-01-16 20:27:59 +00:00
Chris Lattner
16324d20f6 Mangler::getMangledName is now dead, remove it and all the other stuff in Mangler that is now transitively dead. woo.
llvm-svn: 93648
2010-01-16 19:08:51 +00:00
Chris Lattner
c88095b986 add an inefficient version of getNameWithPrefix that returns an std::string.
llvm-svn: 93641
2010-01-16 18:06:34 +00:00
Eric Christopher
3c5d9dc0e3 Remove the InlineHint attribute. There are no current or planned
users.

llvm-svn: 93558
2010-01-15 21:36:30 +00:00
Victor Hernandez
c1b5223e76 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.

llvm-svn: 93531
2010-01-15 19:04:09 +00:00
Victor Hernandez
97d7107d5e Revert r93504 because older uses of llvm.dbg.declare intrinsics need to be auto-upgraded
llvm-svn: 93515
2010-01-15 17:36:47 +00:00
Victor Hernandez
aee71b4e81 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.

llvm-svn: 93504
2010-01-15 03:37:48 +00:00
Victor Hernandez
ff4f0aa119 In debug builds, assert that function-local metadata has only 1 parent function
llvm-svn: 93449
2010-01-14 20:12:34 +00:00
Victor Hernandez
36a22e479a Fix printing of function-local metadata in AsmWriter
llvm-svn: 93402
2010-01-14 01:47:37 +00:00
Victor Hernandez
cc00507183 Add MDNode::getFunction(), which figures out the metadata's function, if it has function that it is local to.
llvm-svn: 93400
2010-01-14 01:45:14 +00:00
Benjamin Kramer
5db856d384 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.

llvm-svn: 93317
2010-01-13 12:45:23 +00:00
Chris Lattner
ba8b3ed4f1 don't add the \1 to the name.
llvm-svn: 93304
2010-01-13 07:50:21 +00:00
Chris Lattner
9c1ca33ac3 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?

llvm-svn: 93301
2010-01-13 07:12:06 +00:00
Chris Lattner
951cfb6b8b 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.

llvm-svn: 93300
2010-01-13 07:01:09 +00:00
Chris Lattner
3c2fad1fc6 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.

llvm-svn: 93298
2010-01-13 06:38:18 +00:00
Chris Lattner
23127baf26 my mistake, Mangler::makeNameProper wants to take a twine, not a stringref!
llvm-svn: 93296
2010-01-13 05:02:57 +00:00
Chris Lattner
b8f828a848 change makeNameProper to take a stringref instead of std::string.
llvm-svn: 93295
2010-01-13 04:55:33 +00:00
Dale Johannesen
1738d7d11a Further progration of metadata operands. The
dumper doesn't really do what I want yet, but
at least it doesn't crash now.

llvm-svn: 93272
2010-01-13 00:00:24 +00:00
Devang Patel
1d9c156df2 Use Twine, instead of StringRef, for consistency.
llvm-svn: 93249
2010-01-12 18:57:56 +00:00
Devang Patel
2a6c413df3 Use ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.
llvm-svn: 93247
2010-01-12 18:34:06 +00:00
Benjamin Kramer
cdbc36f961 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.

llvm-svn: 93161
2010-01-11 18:03:24 +00:00
Victor Hernandez
832bd4fd2d Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().

llvm-svn: 93149
2010-01-11 07:45:19 +00:00
Chris Lattner
56e327711b fix a buggy assertion, CreateIntegerCast should allow
integer vectors as well as just integers.

llvm-svn: 93126
2010-01-10 20:21:42 +00:00
Mikhail Glushenkov
e141fc9e1c Suppress a warning on gcc 4.4.
warning: suggest parentheses around ‘&&’ within ‘||’.
llvm-svn: 93121
2010-01-10 18:48:49 +00:00
Victor Hernandez
f4272b50d6 Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().

llvm-svn: 93108
2010-01-10 07:14:18 +00:00
Chris Lattner
953394de82 "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!

llvm-svn: 93079
2010-01-09 22:27:07 +00:00
Devang Patel
bd58ff3f60 Delete NamedMDSymTable while destrucing Module.
Disable  copy ctor and operator= for NamedMDSymTable. Hide typedef that should be public.

llvm-svn: 93041
2010-01-09 01:44:59 +00:00
Devang Patel
ea208bf99c Derive NamedMDNode from Value.
llvm-svn: 93032
2010-01-09 00:30:14 +00:00
Devang Patel
10ee76f7f4 Use separate namespace for named metadata.
llvm-svn: 92931
2010-01-07 19:39:36 +00:00
Devang Patel
311b5584e5 Allow null to be an element of NamedMDNode. e.g. !llvm.stuff = !{!0, !1, null}
llvm-svn: 92783
2010-01-05 21:47:32 +00:00
Victor Hernandez
173518e4ae Fix comment for CheckDebugInfoIntrinsics
llvm-svn: 92774
2010-01-05 21:13:46 +00:00
Benjamin Kramer
0ba7479f2c Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Devang Patel
ab66612f1b NamedMDNode is a collection MDNodes.
llvm-svn: 92761
2010-01-05 20:41:31 +00:00
Benjamin Kramer
c233521d45 Convert a ton of simple integer type equality tests to the new predicate.
llvm-svn: 92760
2010-01-05 20:07:06 +00:00
Benjamin Kramer
6a11532b00 Add a new predicate for integer type equality tests.
llvm-svn: 92759
2010-01-05 20:04:48 +00:00
Benjamin Kramer
e90a3c66c4 Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
llvm-svn: 92726
2010-01-05 13:12:22 +00:00
David Greene
a2eb2bde9e Fix a build error and change errs() to dbgs().
llvm-svn: 92669
2010-01-05 01:34:26 +00:00
David Greene
2f3bd270a0 Change errs() to dbgs().
llvm-svn: 92665
2010-01-05 01:30:18 +00:00
David Greene
1ee15299b7 Change errs() to dbgs().
llvm-svn: 92664
2010-01-05 01:30:14 +00:00
David Greene
da24eb426d Change errs() to dbgs().
llvm-svn: 92663
2010-01-05 01:30:09 +00:00
David Greene
38e8cf6313 Change errs() to dbgs().
llvm-svn: 92662
2010-01-05 01:30:06 +00:00
David Greene
b4caa095f9 Change errs() to dbgs().
llvm-svn: 92661
2010-01-05 01:30:04 +00:00
David Greene
3a9e6e8827 Change errs() to dbgs().
llvm-svn: 92660
2010-01-05 01:30:02 +00:00
David Greene
36abd30d2e Change errs() to dbgs().
llvm-svn: 92659
2010-01-05 01:30:00 +00:00
David Greene
f8d868e805 Change errs() to dbgs().
llvm-svn: 92658
2010-01-05 01:29:58 +00:00
David Greene
446bde822e Change errs() to dbgs().
llvm-svn: 92657
2010-01-05 01:29:55 +00:00
David Greene
6ad48aba1c Change errs() to dbgs().
llvm-svn: 92656
2010-01-05 01:29:39 +00:00
David Greene
5008e561e3 Change errs() to dbgs().
llvm-svn: 92652
2010-01-05 01:29:26 +00:00
David Greene
8637fd7d59 Change errs() to dbgs().
llvm-svn: 92650
2010-01-05 01:29:19 +00:00
David Greene
053abe1bdb Change errs() to dbgs().
llvm-svn: 92649
2010-01-05 01:29:14 +00:00
Devang Patel
3b08c33f33 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.

llvm-svn: 92557
2010-01-05 01:10:40 +00:00
Dan Gohman
4a8e4ee52a Add a comment.
llvm-svn: 92492
2010-01-04 18:38:39 +00:00
Chris Lattner
80802043f4 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!

llvm-svn: 92452
2010-01-03 18:14:24 +00:00
Chris Lattner
7246a69d2b 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
af22bc2328 fix refactoro
llvm-svn: 92349
2009-12-31 08:23:09 +00:00
Chris Lattner
f9012cc497 use early exits to reduce indentation.
llvm-svn: 92335
2009-12-31 02:33:14 +00:00
Chris Lattner
db243bdde8 eliminate another copy of the mdnode printing logic, simplify the
one that remains.

llvm-svn: 92334
2009-12-31 02:31:59 +00:00
Chris Lattner
81c909630f random tidying for MDNode printing.
llvm-svn: 92333
2009-12-31 02:27:30 +00:00
Chris Lattner
4776298748 eliminate a bunch of useless forwarding functions with one caller.
llvm-svn: 92332
2009-12-31 02:23:35 +00:00