Commit Graph

39839 Commits

Author SHA1 Message Date
Ted Kremenek 05ecfddfc3 Fixed bug in 'LiveVariables' analysis where we incorrectly marked a variable
dead at an assignment without taking into account if the variable was used in
the RHS of the assignment.

llvm-svn: 46153
2008-01-18 00:40:21 +00:00
Steve Naroff b716fbab44 Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for tentative definitions with incomplete types. Touch up all test cases that are effected.
llvm-svn: 46152
2008-01-18 00:39:39 +00:00
Ted Kremenek 1989d2569b Changed DataflowSolver to always associated recorded dataflow values with
the position *before* a statement, regardless of whether we are doing a
forward or backwards analysis.

llvm-svn: 46151
2008-01-18 00:38:55 +00:00
Ted Kremenek ab405774b6 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.

llvm-svn: 46150
2008-01-18 00:38:04 +00:00
Dale Johannesen 8ef89eabc2 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.

llvm-svn: 46147
2008-01-17 23:36:04 +00:00
Dale Johannesen 60a9855799 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.

llvm-svn: 46144
2008-01-17 23:04:07 +00:00
Ted Kremenek 85be7cf8ca Modified the notion of "Block-level expressions" in CFGs to include Stmt*. This
is because GNU-style Statement-expressions cause the last statement in the
statement-expression to act like an expression.

We now have two notions: block-level statements and block-level expressions.

The former are all Stmt* that appear in the list of statements in CFGBlocks. The
latter is the subset of the former; these block-level statements are used as
subexpressions somewhere in the AST. CFG::isBlockExpr() returns true for the
latter, not the former (previously isBlockExpr() always returned true for
non-Expr Stmt*).

Modified the LiveVariables analysis to also track liveness state for block-level
expressions (using the updated definition of block-level expressions).

Modified the dataflow solver so that when it records values for block-level
statements, it records the dataflow value *before* the transfer function for a
Stmt* is evaluated (not after). This is more in sync in what clients will want.

Modified CFGStmtVisitor to record the current block-level statement.

llvm-svn: 46143
2008-01-17 20:48:37 +00:00
Scott Michel e4d3e3c0e7 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.

llvm-svn: 46142
2008-01-17 20:38:41 +00:00
Fariborz Jahanian 9a5124a67e Don't ICE on missing interface declaration when declaring one of its protocols.
llvm-svn: 46141
2008-01-17 20:33:24 +00:00
Chris Lattner 1ea55cf816 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

llvm-svn: 46140
2008-01-17 19:59:44 +00:00
Chris Lattner 9f7fed1c1b new testcase.
llvm-svn: 46139
2008-01-17 19:47:23 +00:00
Steve Naroff e7ea2f43bf Improve diagnostic wording...
llvm-svn: 46138
2008-01-17 19:24:05 +00:00
Ted Kremenek b4b65e6319 Added support to dataflow solver to (when requested) also record dataflow
values for the block-level expressions.

Modified 'LiveVariables' to provide the option to clients to record
liveness information for block-level expressions (using the above feature).

Modified 'DeadStores' to conform to the new interface of 'LiveVariables'.

Modified 'GRConstants' to compute liveness information for block-level
expressions.

llvm-svn: 46137
2008-01-17 18:25:22 +00:00
Nate Begeman 1c075a1c9d Match change in EmitCallExpr
llvm-svn: 46136
2008-01-17 18:06:09 +00:00
Nate Begeman d5b534e16f Fix for EmitCallExpr changed in OverloadExpr patch
llvm-svn: 46135
2008-01-17 18:03:22 +00:00
Ted Kremenek 32a3358eab Fixed typo introduced by r46133 that caused -Wfloat-equal to break.
llvm-svn: 46134
2008-01-17 17:55:13 +00:00
Ted Kremenek f1dae23b68 Removed FindDeclRef, and used Expr::IgnoreParens instead (code refactoring).
llvm-svn: 46133
2008-01-17 17:50:49 +00:00
Nate Begeman 1e36a85f64 Implement basic overload support via a new builtin, __builtin_overload.
__builtin_overload takes 2 or more arguments:
0) a non-zero constant-expr for the number of arguments the overloaded 
   functions will take
1) the arguments to pass to the matching overloaded function
2) a list of functions to match.

The return type of __builtin_overload is inferred from the function whose args
match the types of the arguments passed to the builtin.  For example:

float a;
float sinf(float);
int   sini(int);

float b = __builtin_overload(1, a, sini, sinf);

Says that we are overloading functions that take one argument, and trying to 
pass an argument of the same type as 'a'.  sini() does not match since it takes
and argument of type int.  sinf does match, so at codegen time this will turn
into float b = sinf(a);

llvm-svn: 46132
2008-01-17 17:46:27 +00:00
Fariborz Jahanian ad134b987e Renamed getSynthesizedSelectorSize to getSynthesizedMethodSize. Compute method name
size in accordance with how rewriter synthesizes method name.

llvm-svn: 46131
2008-01-17 17:37:26 +00:00
Ted Kremenek 2b8b71c148 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.

llvm-svn: 46130
2008-01-17 17:36:49 +00:00
Ted Kremenek fff70962bb Added method Expr::IgnoreParens(), which returns the first non-ParenExpr Expr*.
Refactored the use of this method into both the Sema module and Analysis module,
which were using their own static functions that did the same thing.

llvm-svn: 46129
2008-01-17 16:57:34 +00:00
Chris Lattner 686dfe829e add some helper methods.
llvm-svn: 46128
2008-01-17 07:30:38 +00:00
Evan Cheng 9a93dc9565 Test case for varargs parameter attribute issue I just fixed.
llvm-svn: 46127
2008-01-17 07:26:31 +00:00
Chris Lattner 7eabed3521 code cleanups, no functionality change.
llvm-svn: 46126
2008-01-17 07:20:38 +00:00
Chris Lattner 72733e573b * 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.

llvm-svn: 46125
2008-01-17 07:00:52 +00:00
Chris Lattner 89126bde19 add testcase that has been sitting in my tree for awhile.
llvm-svn: 46124
2008-01-17 06:54:09 +00:00
Tanya Lattner 64318772f6 Update license for current year.
llvm-svn: 46120
2008-01-17 05:57:59 +00:00
Tanya Lattner 45746fb284 Update version to 2.3svn
Regenerate configure with 2.60. 

llvm-svn: 46119
2008-01-17 05:57:22 +00:00
Evan Cheng 04af661b1f DAE bug fix. Don't lose parameter attributes on vararg arguments.
llvm-svn: 46113
2008-01-17 04:18:54 +00:00
Devang Patel 16808a32f4 Enable CBE
llvm-svn: 46112
2008-01-17 02:10:08 +00:00
Evan Cheng 54c20b559e 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.

llvm-svn: 46111
2008-01-17 02:08:17 +00:00
Fariborz Jahanian 386699515b Computed length of a __func__ identifier used in an objective-c method correctly,
when creating its type.

llvm-svn: 46109
2008-01-17 01:36:09 +00:00
Chris Lattner 5630c4f217 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.

llvm-svn: 46108
2008-01-17 01:17:03 +00:00
Seo Sanghyeon 15051b4caf Ignore --param
llvm-svn: 46107
2008-01-17 01:08:43 +00:00
Ted Kremenek e780f408b1 Added some experimental optimizations to remove dead values from the
state.

llvm-svn: 46106
2008-01-17 00:52:48 +00:00
Steve Naroff 1aa1941889 Declarator::clear(): Null out variable after it's been deleted.
This avoids a double free (which is good:-)

Bug submitted by Eli.

llvm-svn: 46105
2008-01-17 00:36:28 +00:00
Evan Cheng dc5b4c57d7 Replace std::vector<bool> with BitVector.
llvm-svn: 46104
2008-01-17 00:35:26 +00:00
Steve Naroff d8583eb993 Simplify comment.
llvm-svn: 46103
2008-01-16 23:56:32 +00:00
Steve Naroff 8a0abea999 Type::isArithmeticType(): disallow incomplete enum decls.
Bug submitted by Eli.

llvm-svn: 46102
2008-01-16 23:54:22 +00:00
Ted Kremenek 506e507508 Changed sorting criteria for DSPtr to put sub-expressions first in the value
map. This will allow us to quickly prune them from maps without searching the
entire map.

llvm-svn: 46101
2008-01-16 23:35:31 +00:00
Ted Kremenek 692b01b0be Changed sorting criteria for DSPtr to sort Decl* before Expr*, and
to sort sub-expressions before Block-level expressions.

llvm-svn: 46100
2008-01-16 23:33:44 +00:00
Evan Cheng 7be1528004 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.

llvm-svn: 46099
2008-01-16 23:11:54 +00:00
Duncan Sands 32b0ff6814 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!

llvm-svn: 46098
2008-01-16 22:55:25 +00:00
Ted Kremenek a14396d51d IntegerLiterals are no longer evaluated to create separate nodes; their
values are determined when evaluating the parent expression.

llvm-svn: 46096
2008-01-16 22:28:08 +00:00
Ted Kremenek 493444fc19 Fixed bug where we performed addition instead of subtraction during
constant propagation.

llvm-svn: 46095
2008-01-16 22:20:36 +00:00
Ted Kremenek e914bb8183 Fixed iterator bug in ExplodedNodeImpl::NodeGroup::end(); we would improperly
handle the case where the number of nodes was 0.

Fixed bug in GREngineImpl where we did not proceed to the next statement
when processing a PostStmt location.

llvm-svn: 46093
2008-01-16 22:13:19 +00:00
Ted Kremenek ac886cb835 Added initial graph visualization support for the GRConstants analysis.
llvm-svn: 46092
2008-01-16 21:46:15 +00:00
Ted Kremenek 873bbd53a4 Fixed invalid typedefs in the root and eop iterators for ExplodedGraph.
llvm-svn: 46091
2008-01-16 21:45:54 +00:00
Chris Lattner 39f156183d Handle attribute(used) global variables that are i8.
llvm-svn: 46090
2008-01-16 21:35:43 +00:00
Dale Johannesen ed20366706 Do not mark EH tables no-dead-strip unless the
associated function is so marked.

llvm-svn: 46088
2008-01-16 19:59:28 +00:00