oota-llvm.git
16 years agoNew test.
Devang Patel [Thu, 24 Jan 2008 23:55:34 +0000 (23:55 +0000)]
New test.

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

16 years agoDon't dump the function!
Chris Lattner [Thu, 24 Jan 2008 19:28:11 +0000 (19:28 +0000)]
Don't dump the function!

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

16 years agogetUnderlyingObject can return null, handle this.
Chris Lattner [Thu, 24 Jan 2008 19:07:10 +0000 (19:07 +0000)]
getUnderlyingObject can return null, handle this.

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

16 years agoAdded additional overloaded operators for APSInt to match the operators of
Ted Kremenek [Thu, 24 Jan 2008 18:59:52 +0000 (18:59 +0000)]
Added additional overloaded operators for APSInt to match the operators of
APInt.

While some operators were already specifically overloaded for APSInt, others
resulted in using the overloaded operator methods in APInt, which would result
in the signedness bit being lost.

Modified the APSInt(APInt&) constructor to be "explicit" and to take an
extra (optional) flag to indicate the signedness.  Making the ctor explicit
will catch any implicit conversations between APSInt -> APInt -> APSInt that
results in the signedness flag being lost.

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

16 years agoTeach basicaa that 'byval' arguments define a new memory location that
Chris Lattner [Thu, 24 Jan 2008 18:00:32 +0000 (18:00 +0000)]
Teach basicaa that 'byval' arguments define a new memory location that
can't be aliased to other known objects.  This allows us to know that byval
pointer args don't alias globals, etc.

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

16 years agoAdd hasByValAttr() and hasNoAliasAttr() methods to the Argument class.
Chris Lattner [Thu, 24 Jan 2008 17:47:11 +0000 (17:47 +0000)]
Add hasByValAttr() and hasNoAliasAttr() methods to the Argument class.

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

16 years agoclarify a comment, thanks Duncan.
Chris Lattner [Thu, 24 Jan 2008 17:10:01 +0000 (17:10 +0000)]
clarify a comment, thanks Duncan.

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

16 years agoSignificantly simplify and improve handling of FP function results on x86-32.
Chris Lattner [Thu, 24 Jan 2008 08:07:48 +0000 (08:07 +0000)]
Significantly simplify and improve handling of FP function results on x86-32.
This case returns the value in ST(0) and then has to convert it to an SSE
register.  This causes significant codegen ugliness in some cases.  For
example in the trivial fp-stack-direct-ret.ll testcase we used to generate:

_bar:
subl $28, %esp
call L_foo$stub
fstpl 16(%esp)
movsd 16(%esp), %xmm0
movsd %xmm0, 8(%esp)
fldl 8(%esp)
addl $28, %esp
ret

because we move the result of foo() into an XMM register, then have to
move it back for the return of bar.

Instead of hacking ever-more special cases into the call result lowering code
we take a much simpler approach: on x86-32, fp return is modeled as always
returning into an f80 register which is then truncated to f32 or f64 as needed.
Similarly for a result, we model it as an extension to f80 + return.

This exposes the truncate and extensions to the dag combiner, allowing target
independent code to hack on them, eliminating them in this case.  This gives
us this code for the example above:

_bar:
subl $12, %esp
call L_foo$stub
addl $12, %esp
ret

The nasty aspect of this is that these conversions are not legal, but we want
the second pass of dag combiner (post-legalize) to be able to hack on them.
To handle this, we lie to legalize and say they are legal, then custom expand
them on entry to the isel pass (PreprocessForFPConvert).  This is gross, but
less gross than the code it is replacing :)

This also allows us to generate better code in several other cases.  For
example on fp-stack-ret-conv.ll, we now generate:

_test:
subl $12, %esp
call L_foo$stub
fstps 8(%esp)
movl 16(%esp), %eax
cvtss2sd 8(%esp), %xmm0
movsd %xmm0, (%eax)
addl $12, %esp
ret

where before we produced (incidentally, the old bad code is identical to what
gcc produces):

_test:
subl $12, %esp
call L_foo$stub
fstpl (%esp)
cvtsd2ss (%esp), %xmm0
cvtss2sd %xmm0, %xmm0
movl 16(%esp), %eax
movsd %xmm0, (%eax)
addl $12, %esp
ret

Note that we generate slightly worse code on pr1505b.ll due to a scheduling
deficiency that is unrelated to this patch.

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

16 years agoFix this buggy transformation. Two observations:
Chris Lattner [Thu, 24 Jan 2008 07:57:06 +0000 (07:57 +0000)]
Fix this buggy transformation.  Two observations:
1. we already know the value is dead, so don't bother replacing
   it with undef.
2. The very case the comment describes actually makes the load
   live which asserts in deletenode.  If we do the replacement
   and the node becomes live, just treat it as new.  This fixes
   a failure on X86/2008-01-16-InvalidDAGCombineXform.ll with
   some local changes in my tree.

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

16 years agoThe dag combiner is missing revisiting nodes that it really should, and thus leaving
Chris Lattner [Thu, 24 Jan 2008 07:18:21 +0000 (07:18 +0000)]
The dag combiner is missing revisiting nodes that it really should, and thus leaving
dead stuff around.  This gets fed into the isel pass and causes certain foldings from
happening because nodes have extraneous uses floating around.  For example, if we turned
foo(bar(x)) -> baz(x), we sometimes left bar(x) around.

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

16 years agofold fp_round(fp_round(x)) -> fp_round(x).
Chris Lattner [Thu, 24 Jan 2008 06:45:35 +0000 (06:45 +0000)]
fold fp_round(fp_round(x)) -> fp_round(x).

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

16 years agotake these with a pr #
Chris Lattner [Thu, 24 Jan 2008 06:35:44 +0000 (06:35 +0000)]
take these with a pr #

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

16 years agoFixing the stack walker.
Gordon Henriksen [Thu, 24 Jan 2008 05:16:36 +0000 (05:16 +0000)]
Fixing the stack walker.

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

16 years agoFix potential buffer overflow
Anton Korobeynikov [Thu, 24 Jan 2008 01:20:48 +0000 (01:20 +0000)]
Fix potential buffer overflow

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

16 years agoMove some functionality for adding flags to MachineInstr's into methods on MachineIns...
Owen Anderson [Thu, 24 Jan 2008 01:10:07 +0000 (01:10 +0000)]
Move some functionality for adding flags to MachineInstr's into methods on MachineInstr rather than LiveVariables.

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

16 years agoForgot these.
Evan Cheng [Thu, 24 Jan 2008 00:22:01 +0000 (00:22 +0000)]
Forgot these.

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

16 years agoLet each target decide byval alignment. For X86, it's 4-byte unless the aggregare...
Evan Cheng [Wed, 23 Jan 2008 23:17:41 +0000 (23:17 +0000)]
Let each target decide byval alignment. For X86, it's 4-byte unless the aggregare contains SSE vector(s). For x86-64, it's max of 8 or alignment of the type.

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

16 years agoAdded special escape sequences "\{", "\}", and "\|" when processing
Ted Kremenek [Wed, 23 Jan 2008 22:29:58 +0000 (22:29 +0000)]
Added special escape sequences "\{", "\}", and "\|" when processing
getNodeLabel(); these sequences allow the user to specify the characters '{',
'}', and '|' in the label, which facilitate breaking the label into multiple
record segments.

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

16 years agoThe last pieces needed for loading arbitrary
Duncan Sands [Wed, 23 Jan 2008 20:39:46 +0000 (20:39 +0000)]
The last pieces needed for loading arbitrary
precision integers.  This won't actually work
(and most of the code is dead) unless the new
legalization machinery is turned on.  While
there, I rationalized the handling of i1, and
removed some bogus (and unused) sextload patterns.
For i1, this could result in microscopically
better code for some architectures (not X86).
It might also result in worse code if annotating
with AssertZExt nodes turns out to be more harmful
than helpful.

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

16 years agoAdded "getRoot()" to ImmutableSet.
Ted Kremenek [Wed, 23 Jan 2008 19:57:33 +0000 (19:57 +0000)]
Added "getRoot()" to ImmutableSet.

Made ImmutableSet::ImmutableSet(ImutAVLTree* Root) public. (this allows handy
casting between trees and sets).

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

16 years agoHonor explicit section information on Darwin.
Dale Johannesen [Wed, 23 Jan 2008 00:58:14 +0000 (00:58 +0000)]
Honor explicit section information on Darwin.

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

16 years agoFix an iterator invalidation issue.
Owen Anderson [Tue, 22 Jan 2008 23:58:54 +0000 (23:58 +0000)]
Fix an iterator invalidation issue.

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

16 years agoSSE varargs arguments are passed in memory.
Evan Cheng [Tue, 22 Jan 2008 23:26:53 +0000 (23:26 +0000)]
SSE varargs arguments are passed in memory.

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

16 years agoSimplify SelectionDAG::getNode so that a big switch stmt is not #ifndef
Chris Lattner [Tue, 22 Jan 2008 19:09:33 +0000 (19:09 +0000)]
Simplify SelectionDAG::getNode so that a big switch stmt is not #ifndef
NDEBUG.  This is in response to a really nasty bug I introduced that
Dale tracked down, hopefully this won't happen in the future.
Many thanks Dale.

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

16 years agoSilence a warning. Should we turn this into configure-time check?
Anton Korobeynikov [Tue, 22 Jan 2008 11:01:23 +0000 (11:01 +0000)]
Silence a warning. Should we turn this into configure-time check?

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

16 years agoAdd interator interface to DAGInit also
Anton Korobeynikov [Tue, 22 Jan 2008 11:00:07 +0000 (11:00 +0000)]
Add interator interface to DAGInit also

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

16 years agoThe final piece needed for storing arbitrary precision
Duncan Sands [Tue, 22 Jan 2008 07:17:34 +0000 (07:17 +0000)]
The final piece needed for storing arbitrary precision
integers.  Handle truncstore of a legal type to an unusual
number of bits.  Most of this code is not reachable unless
the new legalize infrastructure is turned on.

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

16 years agoEnable the fix I just checked in, silly me.
Nick Lewycky [Tue, 22 Jan 2008 05:42:02 +0000 (05:42 +0000)]
Enable the fix I just checked in, silly me.

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

16 years agoupdate this test to pass with duncan's change.
Chris Lattner [Tue, 22 Jan 2008 05:31:58 +0000 (05:31 +0000)]
update this test to pass with duncan's change.

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

16 years agoOne too many )'s breaks 'make clean' with certain versions of make.
Chris Lattner [Tue, 22 Jan 2008 05:19:26 +0000 (05:19 +0000)]
One too many )'s breaks 'make clean' with certain versions of make.
This fixes PR1927

This should be pulled into llvm 2.2.

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

16 years agoMultiply can be evaluated in a different type, so long as the target type has
Nick Lewycky [Tue, 22 Jan 2008 05:08:48 +0000 (05:08 +0000)]
Multiply can be evaluated in a different type, so long as the target type has
a smaller bitwidth.

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

16 years agoTrivial patch to fix two warnings, please pull into llvm 2.2
Chris Lattner [Tue, 22 Jan 2008 04:47:47 +0000 (04:47 +0000)]
Trivial patch to fix two warnings, please pull into llvm 2.2

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

16 years agoFixed buggy caching of the hash value of an ImutAVLTree node.
Ted Kremenek [Mon, 21 Jan 2008 22:54:46 +0000 (22:54 +0000)]
Fixed buggy caching of the hash value of an ImutAVLTree node.

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

16 years agoMoved method call within a conditional branch because its effects will
Ted Kremenek [Mon, 21 Jan 2008 22:51:35 +0000 (22:51 +0000)]
Moved method call within a conditional branch because its effects will
be ignored on the false branch.

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

16 years agoAdjusted ImutAVLTree::ComputeHash to compute a hash value that is based on a
Ted Kremenek [Mon, 21 Jan 2008 22:50:37 +0000 (22:50 +0000)]
Adjusted ImutAVLTree::ComputeHash to compute a hash value that is based on a
clearer sequence of hashing compositions.

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

16 years agoAdded "clear" method to FoldingSetNodeID to allow a FoldingSetNodeID object
Ted Kremenek [Mon, 21 Jan 2008 22:49:22 +0000 (22:49 +0000)]
Added "clear" method to FoldingSetNodeID to allow a FoldingSetNodeID object
to be reused to compute multiple object profiles.

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

16 years agoReplaced (FoldingSet) profiling of ImutAVLTree with a hashing based scheme. The
Ted Kremenek [Mon, 21 Jan 2008 22:33:30 +0000 (22:33 +0000)]
Replaced (FoldingSet) profiling of ImutAVLTree with a hashing based scheme. The
problem was that we previously hashed based on the pointers of the left and
right children, but this is bogus: we can easily have different trees that
represent the same set. Now we use a hashing based scheme that compares the
*contents* of the trees, but not without having to do a full scan of a tree. The
only caveat is that with hashing is that we may have collisions, which result in
two different trees being falsely labeled as equivalent. If this becomes a
problem, we can add extra data to the profile to hopefully resolve most
collisions.

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

16 years agoProvide iterator access to ListInit contents
Anton Korobeynikov [Mon, 21 Jan 2008 22:30:26 +0000 (22:30 +0000)]
Provide iterator access to ListInit contents

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

16 years agoFix the failures in the PPC JIT by marking relocation entries for
Chris Lattner [Mon, 21 Jan 2008 22:27:27 +0000 (22:27 +0000)]
Fix the failures in the PPC JIT by marking relocation entries for
external symbols (e.g. 'fmod') as needing a stub.  This regression
was introduced by Evan's jit patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071231/056749.html

With this fixed, the two ExecutionEngine failures are passing on ppc,
and the ppc jit works on freebench and olden.

This should be pulled into the 2.2 release branch.

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

16 years agoNew test.
Devang Patel [Mon, 21 Jan 2008 22:15:58 +0000 (22:15 +0000)]
New test.

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

16 years agoClarify a deviation from the original algorithm.
Owen Anderson [Mon, 21 Jan 2008 22:03:00 +0000 (22:03 +0000)]
Clarify a deviation from the original algorithm.

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

16 years agoImprove a few comments.
Owen Anderson [Mon, 21 Jan 2008 22:01:01 +0000 (22:01 +0000)]
Improve a few comments.

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

16 years agoIt turns out that in C++ it is legal to declare functions
Duncan Sands [Mon, 21 Jan 2008 21:37:41 +0000 (21:37 +0000)]
It turns out that in C++ it is legal to declare functions
that return an opaque type by value, as long as you don't
call it or provide a body (you can take the address of it).
So it is wrong to insist that sret parameters not be an
opaque*.  And I guess it is really up to codegen to complain
if someone tries to call such a function.  I'm also removing
the analogous check from byval parameters, since I don't
see why we shouldn't allow them as long as no-one tries to
call the function or give it a body.

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

16 years agoNew test.
Devang Patel [Mon, 21 Jan 2008 19:28:13 +0000 (19:28 +0000)]
New test.

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

16 years agoCheck that sret is only used on pointers to types
Duncan Sands [Mon, 21 Jan 2008 11:28:49 +0000 (11:28 +0000)]
Check that sret is only used on pointers to types
with a size, like byval.

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

16 years agoBe consistent with other attribute methods, and
Duncan Sands [Mon, 21 Jan 2008 11:27:55 +0000 (11:27 +0000)]
Be consistent with other attribute methods, and
check the callee also if it is known.

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

16 years agoMove DAG-changing code out of #ifndef NDEBUG.
Dale Johannesen [Mon, 21 Jan 2008 01:00:34 +0000 (01:00 +0000)]
Move DAG-changing code out of #ifndef NDEBUG.

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

16 years agoMake sure the caller doesn't use freed memory.
Duncan Sands [Sun, 20 Jan 2008 16:51:46 +0000 (16:51 +0000)]
Make sure the caller doesn't use freed memory.
Fixes PR1935.

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

16 years agoHonour ByVal parameter attribute for name decoration
Anton Korobeynikov [Sun, 20 Jan 2008 14:00:07 +0000 (14:00 +0000)]
Honour ByVal parameter attribute for name decoration

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

16 years agoRemove Darwin'ism
Anton Korobeynikov [Sun, 20 Jan 2008 13:59:37 +0000 (13:59 +0000)]
Remove Darwin'ism

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

16 years agoEnable PIC codegen on x86-64/linux
Anton Korobeynikov [Sun, 20 Jan 2008 13:58:16 +0000 (13:58 +0000)]
Enable PIC codegen on x86-64/linux

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

16 years agoInitializing an unsigned with ~0UL causes the compiler
Duncan Sands [Sun, 20 Jan 2008 10:49:23 +0000 (10:49 +0000)]
Initializing an unsigned with ~0UL causes the compiler
to complain on x86-64 (gcc 4.1).  Use ~0U instead.

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

16 years agoDo not generate a FP_ROUND of f64 to f64.
Dale Johannesen [Sun, 20 Jan 2008 01:18:38 +0000 (01:18 +0000)]
Do not generate a FP_ROUND of f64 to f64.

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

16 years agoChanged argument name for 'Profile' method to potentially fix a name conflict
Ted Kremenek [Sat, 19 Jan 2008 17:21:43 +0000 (17:21 +0000)]
Changed argument name for 'Profile' method to potentially fix a name conflict
reported in pr1929 (http://llvm.org/PR1929).

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

16 years agoNeed to handle any 'nest' parameter before integer
Duncan Sands [Sat, 19 Jan 2008 16:42:10 +0000 (16:42 +0000)]
Need to handle any 'nest' parameter before integer
parameters, since otherwise it won't be passed in
the right register.  With this change trampolines
work on x86-64 (thanks to Luke Guest for providing
access to an x86-64 box).

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

16 years agoModified ImmutableSet/ImmutableMap to use FoldingSet profiling using
Ted Kremenek [Sat, 19 Jan 2008 04:51:55 +0000 (04:51 +0000)]
Modified ImmutableSet/ImmutableMap to use FoldingSet profiling using
FoldingSetTrait instead of directly calling a 'Profile' method.

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

16 years agoAdded FoldingSet style 'profiling' support for APSInt.
Ted Kremenek [Sat, 19 Jan 2008 04:31:12 +0000 (04:31 +0000)]
Added FoldingSet style 'profiling' support for APSInt.

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

16 years agoAdded FoldingSet style 'profiling' support for APInt.
Ted Kremenek [Sat, 19 Jan 2008 04:23:33 +0000 (04:23 +0000)]
Added FoldingSet style 'profiling' support for APInt.

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

16 years agoMade 'FoldingSetNodeID' a proper class instead of a nested class in
Ted Kremenek [Sat, 19 Jan 2008 04:22:50 +0000 (04:22 +0000)]
Made 'FoldingSetNodeID' a proper class instead of a nested class in
'FoldingSetNodeImpl' (previously 'FoldingSetNodeID' was a typedef of
'FoldingSetNodeImpl::NodeID').

Why?  Clients can now easily forward declare 'FoldingSetNodeID' without having
to include FoldingSet.h.

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

16 years agoMade 'profiling' of objects in a FoldingSet trait-based using FoldingSetTrait
Ted Kremenek [Sat, 19 Jan 2008 03:58:00 +0000 (03:58 +0000)]
Made 'profiling' of objects in a FoldingSet trait-based using FoldingSetTrait
instead of always assuming that the stored objects had a method called
'Profile'. The default behavior is to dispatch to a 'Profile' method (as
before), but via template specialization this behavior can now be overridden by
clients.

Added templated class 'FoldingSetNodeWrapper', a generic wrapper class that
allows one to insert objects into a FoldingSet that do not directly inherit from
FoldingSetNode. This is useful for inserting objects that do not always need to
pay the overhead of inheriting from FoldingSetNode, or were designed with that
behavior in mind.

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

16 years agoFix makefiles to enable Apply style debug build.
Evan Cheng [Fri, 18 Jan 2008 21:01:00 +0000 (21:01 +0000)]
Fix makefiles to enable Apply style debug build.

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

16 years agoImplement flt_rounds for PowerPC.
Dale Johannesen [Fri, 18 Jan 2008 19:55:37 +0000 (19:55 +0000)]
Implement flt_rounds for PowerPC.

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

16 years agoremove extraneous &&'s from tests, as Scott is apparently not going to.
Chris Lattner [Fri, 18 Jan 2008 19:53:43 +0000 (19:53 +0000)]
remove extraneous &&'s from tests, as Scott is apparently not going to.

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

16 years agoTest is correct again for the moment.
Dale Johannesen [Fri, 18 Jan 2008 19:53:31 +0000 (19:53 +0000)]
Test is correct again for the moment.

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

16 years agoremove extraneous &'s.
Chris Lattner [Fri, 18 Jan 2008 19:36:20 +0000 (19:36 +0000)]
remove extraneous &'s.

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

16 years agodon't form an std::string with a null pointer, it aborts.
Chris Lattner [Fri, 18 Jan 2008 18:54:31 +0000 (18:54 +0000)]
don't form an std::string with a null pointer, it aborts.

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

16 years agoget symbolic information for ppc ldbl nodes.
Chris Lattner [Fri, 18 Jan 2008 18:51:16 +0000 (18:51 +0000)]
get symbolic information for ppc ldbl nodes.

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

16 years agoremove magic numbers.
Chris Lattner [Fri, 18 Jan 2008 17:13:03 +0000 (17:13 +0000)]
remove magic numbers.

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

16 years agoFix a latent bug exposed by my truncstore patch. We compiled stfiwx-2.ll to:
Chris Lattner [Fri, 18 Jan 2008 16:54:56 +0000 (16:54 +0000)]
Fix a latent bug exposed by my truncstore patch.  We compiled stfiwx-2.ll to:

_test:
fctiwz f0, f1
stfiwx f0, 0, r4
blr

instead of:

_test:
fctiwz f0, f1
stfd f0, -8(r1)
nop
nop
lwz r2, -4(r1)
stb r2, 0(r4)
blr

The former is not correct (stores 4 bytes, not 1).

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

16 years agomake a method public
Chris Lattner [Fri, 18 Jan 2008 06:52:41 +0000 (06:52 +0000)]
make a method public

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

16 years agoReverted implementation of ImmutableMap::find() to return a TreeTy* instead of
Ted Kremenek [Fri, 18 Jan 2008 00:38:04 +0000 (00:38 +0000)]
Reverted implementation of ImmutableMap::find() to return a TreeTy* instead of
an iterator, since the implementation returned an iterator that pointed to a
different node! Renamed this implementation to SlimFind() so that users do not
expect it to return an iterator (it is a more efficient implementation than
returning an iterator if the user just wants to find the value of a key).

Added a FIXME to implement ImmutableMap::find() that returns an iterator.

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

16 years agoRevert the part of 45849 that treated weak globals
Dale Johannesen [Thu, 17 Jan 2008 23:36:04 +0000 (23:36 +0000)]
Revert the part of 45849 that treated weak globals
as weak globals rather than commons.  While not wrong,
this change tickled a latent bug in Darwin's strip,
so revert it for now as a workaround.

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

16 years agoRevert the part of 45848 that treated weak globals
Dale Johannesen [Thu, 17 Jan 2008 23:04:07 +0000 (23:04 +0000)]
Revert the part of 45848 that treated weak globals
as weak globals rather than commons.  While not wrong,
this change tickled a latent bug in Darwin's strip,
so revert it for now as a workaround.

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

16 years agoForward progress: crtbegin.c now compiles successfully!
Scott Michel [Thu, 17 Jan 2008 20:38:41 +0000 (20:38 +0000)]
Forward progress: crtbegin.c now compiles successfully!

Fixed CellSPU's A-form (local store) address mode, so that all globals,
externals, constant pool and jump table symbols are now wrapped within
a SPUISD::AFormAddr pseudo-instruction. This now identifies all local
store memory addresses, although it requires a bit of legerdemain during
instruction selection to properly select loads to and stores from local
store, properly generating "LQA" instructions.

Also added mul_ops.ll test harness for exercising integer multiplication.

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

16 years agoThis commit changes:
Chris Lattner [Thu, 17 Jan 2008 19:59:44 +0000 (19:59 +0000)]
This commit changes:

1. Legalize now always promotes truncstore of i1 to i8.
2. Remove patterns and gunk related to truncstore i1 from targets.
3. Rename the StoreXAction stuff to TruncStoreAction in TLI.
4. Make the TLI TruncStoreAction table a 2d table to handle from/to conversions.
5. Mark a wide variety of invalid truncstores as such in various targets, e.g.
   X86 currently doesn't support truncstore of any of its integer types.
6. Add legalize support for truncstores with invalid value input types.
7. Add a dag combine transform to turn store(truncate) into truncstore when
   safe.

The later allows us to compile CodeGen/X86/storetrunc-fp.ll to:

_foo:
fldt 20(%esp)
fldt 4(%esp)
faddp %st(1)
movl 36(%esp), %eax
fstps (%eax)
ret

instead of:

_foo:
subl $4, %esp
fldt 24(%esp)
fldt 8(%esp)
faddp %st(1)
fstps (%esp)
movl 40(%esp), %eax
movss (%esp), %xmm0
movss %xmm0, (%eax)
addl $4, %esp
ret

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

16 years agonew testcase.
Chris Lattner [Thu, 17 Jan 2008 19:47:23 +0000 (19:47 +0000)]
new testcase.

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

16 years agoImplemented "FIXME" in ImutAVLTree: isEqual() now also compares the *data* value
Ted Kremenek [Thu, 17 Jan 2008 17:36:49 +0000 (17:36 +0000)]
Implemented "FIXME" in ImutAVLTree: isEqual() now also compares the *data* value
and not just the key value when comparing trees. To do this we added data_type
and data_type_ref to the ImutContainerInfo trait classes. For values stored in
the tree that do not have separate key and data components, data_type is simply
a typedef of bool, and isDataEqual() always evaluates to true. This allows us to
support both ImmutableSet and ImmutableMap using the same underlying logic.

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

16 years agoadd some helper methods.
Chris Lattner [Thu, 17 Jan 2008 07:30:38 +0000 (07:30 +0000)]
add some helper methods.

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

16 years agoTest case for varargs parameter attribute issue I just fixed.
Evan Cheng [Thu, 17 Jan 2008 07:26:31 +0000 (07:26 +0000)]
Test case for varargs parameter attribute issue I just fixed.

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

16 years agocode cleanups, no functionality change.
Chris Lattner [Thu, 17 Jan 2008 07:20:38 +0000 (07:20 +0000)]
code cleanups, no functionality change.

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

16 years ago* Introduce a new SelectionDAG::getIntPtrConstant method
Chris Lattner [Thu, 17 Jan 2008 07:00:52 +0000 (07:00 +0000)]
* Introduce a new SelectionDAG::getIntPtrConstant method
  and switch various codegen pieces and the X86 backend over
  to using it.

* Add some comments to SelectionDAGNodes.h

* Introduce a second argument to FP_ROUND, which indicates
  whether the FP_ROUND changes the value of its input. If
  not it is safe to xform things like fp_extend(fp_round(x)) -> x.

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

16 years agoadd testcase that has been sitting in my tree for awhile.
Chris Lattner [Thu, 17 Jan 2008 06:54:09 +0000 (06:54 +0000)]
add testcase that has been sitting in my tree for awhile.

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

16 years agoUpdate license for current year.
Tanya Lattner [Thu, 17 Jan 2008 05:57:59 +0000 (05:57 +0000)]
Update license for current year.

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

16 years agoUpdate version to 2.3svn
Tanya Lattner [Thu, 17 Jan 2008 05:57:22 +0000 (05:57 +0000)]
Update version to 2.3svn
Regenerate configure with 2.60.

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

16 years agoDAE bug fix. Don't lose parameter attributes on vararg arguments.
Evan Cheng [Thu, 17 Jan 2008 04:18:54 +0000 (04:18 +0000)]
DAE bug fix. Don't lose parameter attributes on vararg arguments.

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

16 years agoEnable CBE
Devang Patel [Thu, 17 Jan 2008 02:10:08 +0000 (02:10 +0000)]
Enable CBE

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

16 years agoWhen a live virtual register is being clobbered by an implicit def, it is spilled
Evan Cheng [Thu, 17 Jan 2008 02:08:17 +0000 (02:08 +0000)]
When a live virtual register is being clobbered by an implicit def, it is spilled
and the spill is its kill. However, if the local allocator has determined the
register has not been modified (possible when its value was reloaded), it would
not issue a restore. In that case, mark the last use of the virtual register as
kill.

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

16 years agoFix arg promotion to propagate the correct attrs on the calls to
Chris Lattner [Thu, 17 Jan 2008 01:17:03 +0000 (01:17 +0000)]
Fix arg promotion to propagate the correct attrs on the calls to
promoted functions.  This is important for varargs calls in
particular.  Thanks to duncan for providing a great testcase.

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

16 years agoReplace std::vector<bool> with BitVector.
Evan Cheng [Thu, 17 Jan 2008 00:35:26 +0000 (00:35 +0000)]
Replace std::vector<bool> with BitVector.

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

16 years agoFixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.
Evan Cheng [Wed, 16 Jan 2008 23:11:54 +0000 (23:11 +0000)]
Fixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.

It's not safe to use the two value CombineTo variant to combine away a dead load.
e.g.
v1, chain2 = load chain1, loc
v2, chain3 = load chain2, loc
v3         = add v2, c
Now we replace use of v1 with undef, use of chain2 with chain1.
ReplaceAllUsesWith() will iterate through uses of the first load and update operands:
v1, chain2 = load chain1, loc
v2, chain3 = load chain1, loc
v3         = add v2, c
Now the second load is the same as the first load, SelectionDAG cse will ensure
the use of second load is replaced with the first load.
v1, chain2 = load chain1, loc
v3         = add v1, c
Then v1 is replaced with undef and bad things happen.

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

16 years agoTrampoline support for x86-64. This looks like
Duncan Sands [Wed, 16 Jan 2008 22:55:25 +0000 (22:55 +0000)]
Trampoline support for x86-64.  This looks like
it should work, but I have no machine to test
it on.  Committed because it will at least
cause no harm, and maybe someone can test it
for me!

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

16 years agoHandle attribute(used) global variables that are i8.
Chris Lattner [Wed, 16 Jan 2008 21:35:43 +0000 (21:35 +0000)]
Handle attribute(used) global variables that are i8.

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

16 years agoDo not mark EH tables no-dead-strip unless the
Dale Johannesen [Wed, 16 Jan 2008 19:59:28 +0000 (19:59 +0000)]
Do not mark EH tables no-dead-strip unless the
associated function is so marked.

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

16 years agoadd testcase for regression
Chris Lattner [Wed, 16 Jan 2008 18:03:52 +0000 (18:03 +0000)]
add testcase for regression

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

16 years agoFix a ppc long double regression I introduced yesterday due to a
Chris Lattner [Wed, 16 Jan 2008 17:59:31 +0000 (17:59 +0000)]
Fix a ppc long double regression I introduced yesterday due to a
simplification.  This fixes automotive-basicmath on PPC.

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

16 years agomerge a few pieces of code that do the store/load to stack
Chris Lattner [Wed, 16 Jan 2008 07:51:34 +0000 (07:51 +0000)]
merge a few pieces of code that do the store/load to stack
pattern to use EmitStackConvert now.

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

16 years agorename ExpandBIT_CONVERT to EmitStackConvert, generalizing
Chris Lattner [Wed, 16 Jan 2008 07:45:30 +0000 (07:45 +0000)]
rename ExpandBIT_CONVERT to EmitStackConvert, generalizing
it to allow it to emit different load and store kinds.

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

16 years agosimplify a bunch of code by using SelectionDAG::CreateStackTemporary
Chris Lattner [Wed, 16 Jan 2008 07:03:22 +0000 (07:03 +0000)]
simplify a bunch of code by using SelectionDAG::CreateStackTemporary
instead of inlining its body.

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

16 years agoChange legalizeop of FP_ROUND and FP_EXTEND to not fall through
Chris Lattner [Wed, 16 Jan 2008 06:57:07 +0000 (06:57 +0000)]
Change legalizeop of FP_ROUND and FP_EXTEND  to not fall through
into the ANY_EXTEND/ZERO_EXTEND/SIGN_EXTEND code to simplify it.

Unmerge the code for FP_ROUND and FP_EXTEND from each other to
make each one simpler.

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

16 years agomake sure to use a cpu that has sse.
Chris Lattner [Wed, 16 Jan 2008 06:32:02 +0000 (06:32 +0000)]
make sure to use a cpu that has sse.

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