Commit Graph

40003 Commits

Author SHA1 Message Date
Ted Kremenek 8a025806a4 Some minor restructuring around LValue and RValue types. The value "kind"
information is not separated into a "base" and "sub" type. Eventually the
value-tracking logic will know about LValues and RValues, but not about
specialized LValues and RValues; separating the "kind" information into bits
indicating whether an ExprValue is an LValue or an RValue from the bits that
specify the actual value type makes this separation easier.

llvm-svn: 46329
2008-01-24 23:19:54 +00:00
Steve Naroff d9d581fc7b Exclude vectors from Type::isScalar() predicate.
llvm-svn: 46328
2008-01-24 22:55:05 +00:00
Ted Kremenek f3d6d668b6 enum value name change.
llvm-svn: 46327
2008-01-24 22:44:24 +00:00
Ted Kremenek 3e742f9184 More cleanups to pretty-printing of states in GraphViz output.
llvm-svn: 46326
2008-01-24 22:27:20 +00:00
Ted Kremenek 053527478b Added transfer function for DeclStmt.
llvm-svn: 46323
2008-01-24 20:55:43 +00:00
Ted Kremenek 1fba169ce0 Adjusted storage of values for Stmt* so that we need only query if
a Stmt* is a block-level expression when we INSERT a value into the map, and
not also when we QUERY a value.

llvm-svn: 46321
2008-01-24 19:43:37 +00:00
Chris Lattner 8d83271b25 Don't dump the function!
llvm-svn: 46320
2008-01-24 19:28:11 +00:00
Ted Kremenek fa8062c162 Fixed a bug where the values of block-level expressions were being recorded in
the value map as if the expressions were non-block-level expressions.

llvm-svn: 46319
2008-01-24 19:28:01 +00:00
Chris Lattner 23dd05514e getUnderlyingObject can return null, handle this.
llvm-svn: 46318
2008-01-24 19:07:10 +00:00
Ted Kremenek 286f030911 Minor tweaks in the transfer functions for pre- and post- ++/-- where
we falsely constructed an APInt to represent the constant '1' instead of
using an APSInt (which has a sign).

llvm-svn: 46317
2008-01-24 19:00:57 +00:00
Ted Kremenek f5601e2169 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.

llvm-svn: 46316
2008-01-24 18:59:52 +00:00
Chris Lattner 9104d71269 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.

llvm-svn: 46315
2008-01-24 18:00:32 +00:00
Chris Lattner e30f09d0c5 Add hasByValAttr() and hasNoAliasAttr() methods to the Argument class.
llvm-svn: 46314
2008-01-24 17:47:11 +00:00
Chris Lattner 34ed27c46d clarify a comment, thanks Duncan.
llvm-svn: 46313
2008-01-24 17:10:01 +00:00
Ted Kremenek c9052ff8fd Added support for unary operator '-' for equality sets.
Added some workarounds for loss of signess information on some APSInt
operations. Considering the best route to integrate these into APSInt directly.
(FIXME's in GRConstants.cpp).

llvm-svn: 46310
2008-01-24 08:20:02 +00:00
Chris Lattner a91f77eaac 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.

llvm-svn: 46307
2008-01-24 08:07:48 +00:00
Chris Lattner e97fa8cdf0 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.

llvm-svn: 46306
2008-01-24 07:57:06 +00:00
Chris Lattner d66eac62fd 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.

llvm-svn: 46305
2008-01-24 07:18:21 +00:00
Chris Lattner 0feb1b0f84 fold fp_round(fp_round(x)) -> fp_round(x).
llvm-svn: 46304
2008-01-24 06:45:35 +00:00
Chris Lattner 001d781c41 take these with a pr #
llvm-svn: 46303
2008-01-24 06:35:44 +00:00
Gordon Henriksen 520981b62f Fixing the stack walker.
llvm-svn: 46302
2008-01-24 05:16:36 +00:00
Ted Kremenek 1c91a67086 Added transfer functions for pre- and post- increment/decrement operators.
llvm-svn: 46300
2008-01-24 02:28:56 +00:00
Ted Kremenek 33d8285b8d Added passing "ASTContext" to both GREngine and GRConstants.
Added initial support for integer casting operations to GRConstants.

llvm-svn: 46298
2008-01-24 02:02:54 +00:00
Anton Korobeynikov a4f27608bc Fix potential buffer overflow
llvm-svn: 46296
2008-01-24 01:20:48 +00:00
Owen Anderson 2a8a485630 Move some functionality for adding flags to MachineInstr's into methods on MachineInstr rather than LiveVariables.
llvm-svn: 46295
2008-01-24 01:10:07 +00:00
Ted Kremenek 4f1da522ca Minor tweak in GetValue to avoid an extra check for ParenExprs.
llvm-svn: 46294
2008-01-24 00:50:08 +00:00
Evan Cheng ec3da554e6 Forgot these.
llvm-svn: 46292
2008-01-24 00:22:01 +00:00
Ted Kremenek 2517423c3c Implemented value tracking support for '*' and '*='.
Added "multiplication" support for equality sets.

llvm-svn: 46289
2008-01-23 23:42:27 +00:00
Ted Kremenek 5e02dc1b46 Implemented value tracking support for '+=' and '-='.
llvm-svn: 46288
2008-01-23 23:38:00 +00:00
Chris Lattner 2dd606839d add some assertions so that the rewriter dies violently with a useful
error instead of subtly with a mysterious one.

llvm-svn: 46287
2008-01-23 23:37:15 +00:00
Evan Cheng 35abd840a6 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.
llvm-svn: 46286
2008-01-23 23:17:41 +00:00
Ted Kremenek cefae084a3 Removed extra GraphViz node attributes for GRConstants, as some of them were
causing problems with Dot.

llvm-svn: 46285
2008-01-23 22:54:57 +00:00
Ted Kremenek 930191c011 some prettying of the GraphViz visualization of GRConstants analysis results.
llvm-svn: 46284
2008-01-23 22:30:44 +00:00
Ted Kremenek 9e7a112377 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.

llvm-svn: 46283
2008-01-23 22:29:58 +00:00
Duncan Sands 95d46ef887 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.

llvm-svn: 46280
2008-01-23 20:39:46 +00:00
Fariborz Jahanian 60a901621f Fixed a nasty bug which took a while to come up with a test case,
diagnose, and took even longer to fix. It has to do with rewriting of a message
receiver which is an 'ivar' reference. Fix, however, is to remove a code which
was not doing the right thing and no longer needed.

llvm-svn: 46279
2008-01-23 20:34:40 +00:00
Ted Kremenek 0a8d3767a3 Major "architectural" changes to the GRConstants analysis. We now reason about
abstract "L-values" and "R-values" when doing value tracking, and expanding
constant tracking to encompass tracking disjunctive sets of possible constants.
Further, the tree-walking is more efficient, as we don't blindly recurse the
tree if we won't generate new states.

llvm-svn: 46278
2008-01-23 19:59:44 +00:00
Ted Kremenek 9d21a0cb07 Added "getRoot()" to ImmutableSet.
Made ImmutableSet::ImmutableSet(ImutAVLTree* Root) public. (this allows handy
casting between trees and sets).

llvm-svn: 46277
2008-01-23 19:57:33 +00:00
Chris Lattner 7238225c28 add support for -Wundef.
llvm-svn: 46274
2008-01-23 17:19:46 +00:00
Fariborz Jahanian 54e42318c0 Missing ObjC stuff. Patch by Mike Stump.
llvm-svn: 46268
2008-01-23 01:34:33 +00:00
Dale Johannesen 7f1ff5fedd Honor explicit section information on Darwin.
llvm-svn: 46267
2008-01-23 00:58:14 +00:00
Owen Anderson 7fe0bb2b43 Fix an iterator invalidation issue.
llvm-svn: 46263
2008-01-22 23:58:54 +00:00
Evan Cheng 1e0d4d2aa8 SSE varargs arguments are passed in memory.
llvm-svn: 46262
2008-01-22 23:26:53 +00:00
Fariborz Jahanian 0a71ad2e07 Problem with ObjC's type-encoding of nested structs causing infinit recursion.
llvm-svn: 46260
2008-01-22 22:44:46 +00:00
Lauro Ramos Venancio db449040aa Fix a typo.
llvm-svn: 46259
2008-01-22 22:38:35 +00:00
Lauro Ramos Venancio 09af71c2a6 Implement bitfield write.
llvm-svn: 46258
2008-01-22 22:36:45 +00:00
Lauro Ramos Venancio 2ddcb25a3b Implement bitfield read.
llvm-svn: 46257
2008-01-22 20:17:04 +00:00
Chris Lattner 97ff7763dc Fix PR1936, a crash on malformed #if. Thanks to Neil for
noticing this!

llvm-svn: 46256
2008-01-22 19:34:51 +00:00
Lauro Ramos Venancio 0ae6cd5219 Fix two bugs in bitfield codegen.
llvm-svn: 46255
2008-01-22 19:15:30 +00:00
Chris Lattner 1671361c5c 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.

llvm-svn: 46254
2008-01-22 19:09:33 +00:00