oota-llvm.git
14 years agoallow this to work on linux hosts.
Chris Lattner [Sat, 2 Jan 2010 00:22:15 +0000 (00:22 +0000)]
allow this to work on linux hosts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92407 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTeach codegen to handle:
Chris Lattner [Sat, 2 Jan 2010 00:00:03 +0000 (00:00 +0000)]
Teach codegen to handle:
 (X != null) | (Y != null) --> (X|Y) != 0
 (X == null) & (Y == null) --> (X|Y) == 0

so that instcombine can stop doing this for pointers.  This is part of PR3351,
which is a case where instcombine doing this for pointers (inserting ptrtoint)
is pessimizing code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92406 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename file.
Chris Lattner [Fri, 1 Jan 2010 23:55:04 +0000 (23:55 +0000)]
rename file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92405 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agowhitespace cleanup
Chris Lattner [Fri, 1 Jan 2010 23:37:34 +0000 (23:37 +0000)]
whitespace cleanup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92404 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd a simple instcombine xform, simplify another one to use hasAllZeroIndices()
Chris Lattner [Fri, 1 Jan 2010 23:09:08 +0000 (23:09 +0000)]
add a simple instcombine xform, simplify another one to use hasAllZeroIndices()
instead of hand rolling a loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92403 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agogeneralize the pointer difference optimization to handle
Chris Lattner [Fri, 1 Jan 2010 22:42:29 +0000 (22:42 +0000)]
generalize the pointer difference optimization to handle
a constantexpr gep on the 'base' side of the expression.
This completes comment #4 in PR3351, which comes from
483.xalancbmk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92402 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoteach instcombine to optimize pointer difference idioms involving constant
Chris Lattner [Fri, 1 Jan 2010 22:29:12 +0000 (22:29 +0000)]
teach instcombine to optimize pointer difference idioms involving constant
expressions.  This is a step towards comment #4 in PR3351.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92401 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agouse 'match' to simplify some code.
Chris Lattner [Fri, 1 Jan 2010 22:12:03 +0000 (22:12 +0000)]
use 'match' to simplify some code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92400 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoimplement the transform requested in PR5284
Chris Lattner [Fri, 1 Jan 2010 18:34:40 +0000 (18:34 +0000)]
implement the transform requested in PR5284

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92398 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix a warning on gcc 4.4.
Mikhail Glushenkov [Fri, 1 Jan 2010 04:41:36 +0000 (04:41 +0000)]
Fix a warning on gcc 4.4.

SelectionDAGBuilder.cpp:4294: warning: suggest explicit braces to avoid
ambiguous ‘else’

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92395 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTrailing whitespace, 80-col violations.
Mikhail Glushenkov [Fri, 1 Jan 2010 04:41:22 +0000 (04:41 +0000)]
Trailing whitespace, 80-col violations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92394 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMinor simplifactions.
Mikhail Glushenkov [Fri, 1 Jan 2010 04:41:10 +0000 (04:41 +0000)]
Minor simplifactions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92393 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTypo.
Mikhail Glushenkov [Fri, 1 Jan 2010 04:40:54 +0000 (04:40 +0000)]
Typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92392 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake CheckForSuperfluousOptions handle list form of 'switch_on' correctly.
Mikhail Glushenkov [Fri, 1 Jan 2010 03:51:02 +0000 (03:51 +0000)]
Make CheckForSuperfluousOptions handle list form of 'switch_on' correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92391 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMinor simplifications.
Mikhail Glushenkov [Fri, 1 Jan 2010 03:50:51 +0000 (03:50 +0000)]
Minor simplifications.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92390 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoBetter error message.
Mikhail Glushenkov [Fri, 1 Jan 2010 03:50:34 +0000 (03:50 +0000)]
Better error message.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92389 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTeach codegen to lower llvm.powi to an efficient (but not optimal)
Chris Lattner [Fri, 1 Jan 2010 03:32:16 +0000 (03:32 +0000)]
Teach codegen to lower llvm.powi to an efficient (but not optimal)
multiply sequence when the power is a constant integer.  Before, our
codegen for std::pow(.., int) always turned into a libcall, which was
really inefficient.

This should also make many gfortran programs happier I'd imagine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92388 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake this more likely to generate a libcall.
Chris Lattner [Fri, 1 Jan 2010 03:26:51 +0000 (03:26 +0000)]
Make this more likely to generate a libcall.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92387 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd missing line.
Chris Lattner [Fri, 1 Jan 2010 01:54:08 +0000 (01:54 +0000)]
add missing line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92384 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd a few trivial instcombines for llvm.powi.
Chris Lattner [Fri, 1 Jan 2010 01:52:15 +0000 (01:52 +0000)]
add a few trivial instcombines for llvm.powi.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92383 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoupdate this. To take the next step, llvm.powi should be generalized to work
Chris Lattner [Fri, 1 Jan 2010 01:29:26 +0000 (01:29 +0000)]
update this.  To take the next step, llvm.powi should be generalized to work
on integers as well and codegen should lower them to branch trees.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92382 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen factoring multiply expressions across adds, factor both
Chris Lattner [Fri, 1 Jan 2010 01:13:15 +0000 (01:13 +0000)]
When factoring multiply expressions across adds, factor both
positive and negative forms of constants together.  This
allows us to compile:

int foo(int x, int y) {
    return (x-y) + (x-y) + (x-y);
}

into:

_foo:                                                       ## @foo
subl %esi, %edi
leal (%rdi,%rdi,2), %eax
ret

instead of (where the 3 and -3 were not factored):

_foo:
        imull   $-3, 8(%esp), %ecx
        imull   $3, 4(%esp), %eax
        addl    %ecx, %eax
        ret

this started out as:
    movl    12(%ebp), %ecx
    imull   $3, 8(%ebp), %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    ret

This comes from PR5359.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92381 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotest case we alredy get right.
Chris Lattner [Fri, 1 Jan 2010 00:50:00 +0000 (00:50 +0000)]
test case we alredy get right.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92380 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove old header.
Ted Kremenek [Fri, 1 Jan 2010 00:04:49 +0000 (00:04 +0000)]
Remove old header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92378 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoclean up some comments.
Chris Lattner [Fri, 1 Jan 2010 00:04:26 +0000 (00:04 +0000)]
clean up some comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92377 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoswitch from std::map to DenseMap for rank data structures.
Chris Lattner [Fri, 1 Jan 2010 00:01:34 +0000 (00:01 +0000)]
switch from std::map to DenseMap for rank data structures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92375 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove derelict serialization code.
Ted Kremenek [Thu, 31 Dec 2009 23:40:17 +0000 (23:40 +0000)]
Remove derelict serialization code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92374 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoreuse negates where possible instead of always creating them from scratch.
Chris Lattner [Thu, 31 Dec 2009 20:34:32 +0000 (20:34 +0000)]
reuse negates where possible instead of always creating them from scratch.
This allows us to optimize test12 into:

define i32 @test12(i32 %X) {
  %factor = mul i32 %X, -3                        ; <i32> [#uses=1]
  %Z = add i32 %factor, 6                         ; <i32> [#uses=1]
  ret i32 %Z
}

instead of:

define i32 @test12(i32 %X) {
  %Y = sub i32 6, %X                              ; <i32> [#uses=1]
  %C = sub i32 %Y, %X                             ; <i32> [#uses=1]
  %Z = sub i32 %C, %X                             ; <i32> [#uses=1]
  ret i32 %Z
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92373 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agowe don't need a smallptrset to detect duplicates, the values are
Chris Lattner [Thu, 31 Dec 2009 19:49:01 +0000 (19:49 +0000)]
we don't need a smallptrset to detect duplicates, the values are
sorted, so we can just do a linear scan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92372 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomake reassociate more careful about not leaving around dead mul's
Chris Lattner [Thu, 31 Dec 2009 19:34:45 +0000 (19:34 +0000)]
make reassociate more careful about not leaving around dead mul's

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92370 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove debug
Chris Lattner [Thu, 31 Dec 2009 19:25:19 +0000 (19:25 +0000)]
remove debug

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92369 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoteach reassociate to factor x+x+x -> x*3. While I'm at it,
Chris Lattner [Thu, 31 Dec 2009 19:24:52 +0000 (19:24 +0000)]
teach reassociate to factor x+x+x -> x*3.  While I'm at it,
fix RemoveDeadBinaryOp to actually do something.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92368 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agochange reassociate to use SmallVector for its key datastructures
Chris Lattner [Thu, 31 Dec 2009 18:40:32 +0000 (18:40 +0000)]
change reassociate to use SmallVector for its key datastructures
instead of std::vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92366 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agochange an if to an assert, fix comment.
Chris Lattner [Thu, 31 Dec 2009 18:18:46 +0000 (18:18 +0000)]
change an if to an assert, fix comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92364 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomove the rest of the add optimization code out to OptimizeAdd,
Chris Lattner [Thu, 31 Dec 2009 18:17:13 +0000 (18:17 +0000)]
move the rest of the add optimization code out to OptimizeAdd,
improve some comments, simplify a bit of code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92363 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofactor statistic updating better.
Chris Lattner [Thu, 31 Dec 2009 17:51:05 +0000 (17:51 +0000)]
factor statistic updating better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92362 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSilence compiler warning.
Benjamin Kramer [Thu, 31 Dec 2009 16:27:13 +0000 (16:27 +0000)]
Silence compiler warning.

warning: comparison between signed and unsigned integer expressions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92359 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosimple fix for an incorrect factoring which causes a
Chris Lattner [Thu, 31 Dec 2009 08:33:49 +0000 (08:33 +0000)]
simple fix for an incorrect factoring which causes a
miscompilation, PR5458.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92354 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomerge some more tests in.
Chris Lattner [Thu, 31 Dec 2009 08:32:22 +0000 (08:32 +0000)]
merge some more tests in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92353 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofilecheckize
Chris Lattner [Thu, 31 Dec 2009 08:29:56 +0000 (08:29 +0000)]
filecheckize

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92352 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix refactoro
Chris Lattner [Thu, 31 Dec 2009 08:23:09 +0000 (08:23 +0000)]
fix refactoro

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92349 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofactor code out into helper functions.
Chris Lattner [Thu, 31 Dec 2009 07:59:34 +0000 (07:59 +0000)]
factor code out into helper functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92347 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoswitch some std::vector's to smallvector. Reduce nesting.
Chris Lattner [Thu, 31 Dec 2009 07:48:51 +0000 (07:48 +0000)]
switch some std::vector's to smallvector.  Reduce nesting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92346 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agouse more modern datastructures.
Chris Lattner [Thu, 31 Dec 2009 07:33:14 +0000 (07:33 +0000)]
use more modern datastructures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92344 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoclean up -debug output.
Chris Lattner [Thu, 31 Dec 2009 07:17:37 +0000 (07:17 +0000)]
clean up -debug output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92343 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDocument the edit-distance algorithm used in StringRef, switch it over
Douglas Gregor [Thu, 31 Dec 2009 04:24:34 +0000 (04:24 +0000)]
Document the edit-distance algorithm used in StringRef, switch it over
to SmallVector, and add a unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92340 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agothis #include is ok.
Chris Lattner [Thu, 31 Dec 2009 03:02:42 +0000 (03:02 +0000)]
this #include is ok.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92338 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix Analysis/DebugInfo.h to not include Metadata.h. Do this
Chris Lattner [Thu, 31 Dec 2009 03:02:08 +0000 (03:02 +0000)]
fix Analysis/DebugInfo.h to not include Metadata.h.  Do this
by moving one method out of line and eliminating redundant checks
from other methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92337 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd some basic named MD tests.
Chris Lattner [Thu, 31 Dec 2009 03:00:49 +0000 (03:00 +0000)]
add some basic named MD tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92336 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agouse early exits to reduce indentation.
Chris Lattner [Thu, 31 Dec 2009 02:33:14 +0000 (02:33 +0000)]
use early exits to reduce indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92335 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoeliminate another copy of the mdnode printing logic, simplify the
Chris Lattner [Thu, 31 Dec 2009 02:31:59 +0000 (02:31 +0000)]
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

14 years agorandom tidying for MDNode printing.
Chris Lattner [Thu, 31 Dec 2009 02:27:30 +0000 (02:27 +0000)]
random tidying for MDNode printing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92333 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoeliminate a bunch of useless forwarding functions with one caller.
Chris Lattner [Thu, 31 Dec 2009 02:23:35 +0000 (02:23 +0000)]
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

14 years agomake mdnMap type safe, rename accessors for consistency with the rest of llvm.
Chris Lattner [Thu, 31 Dec 2009 02:20:11 +0000 (02:20 +0000)]
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

14 years agometadata can't be a global var initializer.
Chris Lattner [Thu, 31 Dec 2009 02:15:45 +0000 (02:15 +0000)]
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

14 years agosimplify mdnode printing logic. Now N->dump() only
Chris Lattner [Thu, 31 Dec 2009 02:13:35 +0000 (02:13 +0000)]
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

14 years agodon't unittest mdnode printing, we have disassembler tests for this.
Chris Lattner [Thu, 31 Dec 2009 02:12:13 +0000 (02:12 +0000)]
don't unittest mdnode printing, we have disassembler tests for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92328 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agounify two copies of the NamedMDNode printing code.
Chris Lattner [Thu, 31 Dec 2009 01:54:05 +0000 (01:54 +0000)]
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

14 years agofix printing of function-local metadata to print all the operands of the
Chris Lattner [Thu, 31 Dec 2009 01:44:44 +0000 (01:44 +0000)]
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

14 years agosimplify printing of mdstring and Argument.
Chris Lattner [Thu, 31 Dec 2009 01:41:14 +0000 (01:41 +0000)]
simplify printing of mdstring and Argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92325 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosimplify asmprinting of NamedMDNode
Chris Lattner [Thu, 31 Dec 2009 01:36:50 +0000 (01:36 +0000)]
simplify asmprinting of NamedMDNode

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92324 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove #include of metadata.h from intrinsicinst.h. The only
Chris Lattner [Thu, 31 Dec 2009 01:32:41 +0000 (01:32 +0000)]
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

14 years agorename "elements" of metadata to "operands". "Elements" are
Chris Lattner [Thu, 31 Dec 2009 01:22:29 +0000 (01:22 +0000)]
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

14 years agoOptimize MDNode to coallocate the operand list immediately
Chris Lattner [Thu, 31 Dec 2009 01:05:46 +0000 (01:05 +0000)]
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

14 years agotidy
Chris Lattner [Thu, 31 Dec 2009 00:51:46 +0000 (00:51 +0000)]
tidy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92320 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agodo not bother reuniquing mdnodes whose operands drop to null. Doing
Chris Lattner [Wed, 30 Dec 2009 21:42:11 +0000 (21:42 +0000)]
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

14 years agoremove some misleading comments.
Chris Lattner [Wed, 30 Dec 2009 20:25:09 +0000 (20:25 +0000)]
remove some misleading comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92311 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement edit distance for StringRef
Douglas Gregor [Wed, 30 Dec 2009 17:23:44 +0000 (17:23 +0000)]
Implement edit distance for StringRef

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92309 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove some fixme's
Chris Lattner [Wed, 30 Dec 2009 06:00:36 +0000 (06:00 +0000)]
remove some fixme's

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92304 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix two bogus tests that the asmparser now rejects.
Chris Lattner [Wed, 30 Dec 2009 05:54:51 +0000 (05:54 +0000)]
fix two bogus tests that the asmparser now rejects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92303 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agonow that instruction metadata is only parsed in one place, eliminate the
Chris Lattner [Wed, 30 Dec 2009 05:48:36 +0000 (05:48 +0000)]
now that instruction metadata is only parsed in one place, eliminate the
parser-global MDsOnInst vector and make ParseInstructionMetadata return
its result by-ref through an argument like the entire rest of the parser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92302 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoreimplement ParseOptionalInfo as ParseOptionalCommaAlign, correctly
Chris Lattner [Wed, 30 Dec 2009 05:44:30 +0000 (05:44 +0000)]
reimplement ParseOptionalInfo as ParseOptionalCommaAlign, correctly
handle the comma case for metadata.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92301 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename ParseOptionalCustomMetadata -> ParseInstructionMetadata,
Chris Lattner [Wed, 30 Dec 2009 05:31:19 +0000 (05:31 +0000)]
rename ParseOptionalCustomMetadata -> ParseInstructionMetadata,
and make it non-optional.  This fixes the bug where we'd accept
and ignore a spurious comma after some instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92300 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoconvert 4 more instructions over.
Chris Lattner [Wed, 30 Dec 2009 05:27:33 +0000 (05:27 +0000)]
convert 4 more instructions over.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92299 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd facilities to start factoring instruction metadata parsing
Chris Lattner [Wed, 30 Dec 2009 05:23:43 +0000 (05:23 +0000)]
add facilities to start factoring instruction metadata parsing
out of each opcode's handler.  Change ret over so far.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92298 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoreimplement insertvalue/extractvalue metadata handling to not blindly
Chris Lattner [Wed, 30 Dec 2009 05:14:00 +0000 (05:14 +0000)]
reimplement insertvalue/extractvalue metadata handling to not blindly
accept invalid input.  Actually add a testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92297 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove two bogus calls that accepted metadata in the middle of insert/extract value
Chris Lattner [Wed, 30 Dec 2009 05:04:46 +0000 (05:04 +0000)]
remove two bogus calls that accepted metadata in the middle of insert/extract value
*constant exprs*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92296 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename NamedOrCustomMD -> MetadataVar to follow conventions of all the rest of the...
Chris Lattner [Wed, 30 Dec 2009 05:02:06 +0000 (05:02 +0000)]
rename NamedOrCustomMD -> MetadataVar to follow conventions of all the rest of the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92295 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename lltok::Metadata -> lltok::exclaim. We name tokens
Chris Lattner [Wed, 30 Dec 2009 04:56:59 +0000 (04:56 +0000)]
rename lltok::Metadata -> lltok::exclaim.  We name tokens
after their syntactic form, not their semantic form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92294 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename MetadataCache -> NumberedMetadata to follow the convention
Chris Lattner [Wed, 30 Dec 2009 04:51:58 +0000 (04:51 +0000)]
rename MetadataCache -> NumberedMetadata to follow the convention
used by other things.  Convert it to a vector since it is a dense
numbering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92293 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorewrite ParseMDNodeVector to follow the normal patter used in the .ll parser.
Chris Lattner [Wed, 30 Dec 2009 04:42:57 +0000 (04:42 +0000)]
rewrite ParseMDNodeVector to follow the normal patter used in the .ll parser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92292 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename ParseMDNode -> ParseMDNodeID, since it parses !42, not !{... } as you'd expect.
Chris Lattner [Wed, 30 Dec 2009 04:15:23 +0000 (04:15 +0000)]
rename ParseMDNode -> ParseMDNodeID, since it parses !42, not !{... } as you'd expect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92291 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix parsing of mdstring values.
Chris Lattner [Wed, 30 Dec 2009 04:13:37 +0000 (04:13 +0000)]
fix parsing of mdstring values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92290 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove the code added in r90497. It has several major issues and no tests.
Chris Lattner [Wed, 30 Dec 2009 02:20:07 +0000 (02:20 +0000)]
remove the code added in r90497.  It has several major issues and no tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92288 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosplit t_Metadata into t_MDNode and t_MDString, eliminating some unsafe casting.
Chris Lattner [Wed, 30 Dec 2009 02:11:14 +0000 (02:11 +0000)]
split t_Metadata into t_MDNode and t_MDString, eliminating some unsafe casting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92287 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofactor code even more.
Chris Lattner [Tue, 29 Dec 2009 22:40:21 +0000 (22:40 +0000)]
factor code even more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92280 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosimplify some code and unbreak the build by not consuming an
Chris Lattner [Tue, 29 Dec 2009 22:35:39 +0000 (22:35 +0000)]
simplify some code and unbreak the build by not consuming an
extra token.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92279 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove a really wrong parenthesis.
Benjamin Kramer [Tue, 29 Dec 2009 22:17:06 +0000 (22:17 +0000)]
remove a really wrong parenthesis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92277 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoclean up some really strange code.
Chris Lattner [Tue, 29 Dec 2009 22:01:50 +0000 (22:01 +0000)]
clean up some really strange code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92275 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agochange ParseMDString and ParseMDNode to take arguments of the right type.
Chris Lattner [Tue, 29 Dec 2009 21:53:55 +0000 (21:53 +0000)]
change ParseMDString and ParseMDNode to take arguments of the right type.
This exposed a raft of other problems, which I'll deal with in subsequent
patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92273 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoswitch to TrackingVH instead of WeakVH, since these can never
Chris Lattner [Tue, 29 Dec 2009 21:43:58 +0000 (21:43 +0000)]
switch to TrackingVH instead of WeakVH, since these can never
be RAUW'd and go to null.  This also gets us some sorely lacking
type safety.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92272 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEach instruction is allowed to have *multiple* different
Chris Lattner [Tue, 29 Dec 2009 21:25:40 +0000 (21:25 +0000)]
Each instruction is allowed to have *multiple* different
metadata objects on them.  Though the entire compiler supports this,
the asmparser didn't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92270 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDo not crash when .ll printing metadata that smells like debug info, but isn't.
Chris Lattner [Tue, 29 Dec 2009 21:17:33 +0000 (21:17 +0000)]
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

14 years agofix indentation, fit in 80 cols.
Chris Lattner [Tue, 29 Dec 2009 21:09:57 +0000 (21:09 +0000)]
fix indentation, fit in 80 cols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92267 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReplace a few more SmallVectors with arrays.
Benjamin Kramer [Tue, 29 Dec 2009 16:57:26 +0000 (16:57 +0000)]
Replace a few more SmallVectors with arrays.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92265 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse an array instead of a SmallVector.
Benjamin Kramer [Tue, 29 Dec 2009 11:04:52 +0000 (11:04 +0000)]
Use an array instead of a SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92264 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove a bunch of unneeded functions.
Chris Lattner [Tue, 29 Dec 2009 09:32:19 +0000 (09:32 +0000)]
remove a bunch of unneeded functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92263 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomajor cleanups, much of this file was incorrectly indented.
Chris Lattner [Tue, 29 Dec 2009 09:22:47 +0000 (09:22 +0000)]
major cleanups, much of this file was incorrectly indented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92262 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoone pass of cleanup over DebugInfo.h. Much more is still needed.
Chris Lattner [Tue, 29 Dec 2009 09:15:46 +0000 (09:15 +0000)]
one pass of cleanup over DebugInfo.h.  Much more is still needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92261 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoprune #includes.
Chris Lattner [Tue, 29 Dec 2009 09:12:29 +0000 (09:12 +0000)]
prune #includes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92260 91177308-0d34-0410-b5e6-96231b3b80d8