Commit Graph

56065 Commits

Author SHA1 Message Date
Chris Lattner 99cc133710 generalize the previous code to use the full generality of LEA
for i32/i64 expressions (we could also do i16 on cpus where
i16 lea is fast, but I didn't add this).  On the example, we now
generate:

_test:
	movl	4(%esp), %eax
	cmpl	$42, (%eax)
	setl	%al
	movzbl	%al, %eax
	leal	4(%eax,%eax,8), %eax
	ret

instead of:

_test:
	movl	4(%esp), %eax
	cmpl	$41, (%eax)
	movl	$4, %ecx
	movl	$13, %eax
	cmovg	%ecx, %eax
	ret

llvm-svn: 66869
2009-03-13 05:53:31 +00:00
Chris Lattner 4be6df5d86 optimize the case of cond ? 42 : 41 and friends. This compiles the
example to:

_test:
	movl	4(%esp), %eax
	cmpl	$41, (%eax)
	setg	%al
	movzbl	%al, %eax
	orl	$4294967294, %eax
	ret

instead of:

        movl    4(%esp), %eax
        cmpl    $41, (%eax)
	movl	$4294967294, %ecx
	movl	$4294967295, %eax
	cmova	%ecx, %eax
	ret

which is smaller in code size and faster. rdar://6668608

llvm-svn: 66868
2009-03-13 05:22:11 +00:00
Bill Wendling fa54bc2052 Oops...I committed too much.
llvm-svn: 66867
2009-03-13 04:39:26 +00:00
Bill Wendling b02eadf660 Temporarily XFAIL this test.
llvm-svn: 66866
2009-03-13 04:37:11 +00:00
Dan Gohman a1d92423cf Enhance address-mode folding of ISD::ADD to handle cases where the
operands can't both be fully folded at the same time. For example,
in the included testcase, a global variable is being added with
an add of two values. The global variable wants RIP-relative
addressing, so it can't share the address with another base
register, but it's still possible to fold the initial add.

llvm-svn: 66865
2009-03-13 02:25:09 +00:00
Chris Lattner 44219f3e58 implement a new -fprint-source-range-info option, which
defaults to off.  When enabled, it emits range info along
with the file/line/col information for a diagnostic.  This
allows tools that textually parse the output of clang to know
where the ranges are, even if they span multiple lines.  For 
example, with:

$ clang exprs.c -fprint-source-range-info

We now produce:

exprs.c:21:11:{21:12-21:13}: warning: use of unary operator that may be intended as compound assignment (+=)
      var =+ 5;  // expected-warning {{use of unary operator that may be intended as compound assignment (+=)}}
          ^~
exprs.c:22:11:{22:12-22:13}: warning: use of unary operator that may be intended as compound assignment (-=)
      var =- 5;  // expected-warning {{use of unary operator that may be intended as compound assignment (-=)}}
          ^~
exprs.c:36:13:{36:3-36:12}: error: assignment to cast is illegal, lvalue casts are not supported
  (float*)X = P;   // expected-error {{assignment to cast is illegal, lvalue casts are not supported}}
  ~~~~~~~~~ ^
exprs.c:41:4:{41:3-41:4}: error: called object type 'int' is not a function or function pointer
  X();  // expected-error {{called object type 'int' is not a function or function pointer}}
  ~^
exprs.c:45:15:{45:8-45:14}{45:17-45:24}: error: invalid operands to binary expression ('int *' and '_Complex float')
   P = (P-42) + Gamma*4;  // expected-error {{invalid operands to binary expression ('int *' and '_Complex float')}}
       ~~~~~~ ^ ~~~~~~~
exprs.c:61:7:{61:16-61:22}: error: invalid application of '__alignof' to bitfield
  R = __alignof(P->x);  // expected-error {{invalid application of '__alignof' to bitfield}} expected-warning {{extension used}}
      ^        ~~~~~~

Note the range info after the column in the initial diagnostic.

This is obviously really annoying if you're not a tool parsing the 
output of clang, which is why it is off by default.

llvm-svn: 66862
2009-03-13 01:08:23 +00:00
Chris Lattner f0db0aed67 fix typo
llvm-svn: 66860
2009-03-13 01:05:57 +00:00
Dale Johannesen cecfa6e08d Fix one more place where debug info affected
codegen (speculative execution).

llvm-svn: 66859
2009-03-13 01:05:24 +00:00
Daniel Dunbar 0f35a026a9 Driver: Ignore empty arguments.
llvm-svn: 66858
2009-03-13 01:01:44 +00:00
Daniel Dunbar 5e0f6af190 Driver: Handle "immediate" options.
Also, add some FIXMEs, improve doxygen & comments.

llvm-svn: 66857
2009-03-13 00:51:18 +00:00
Fariborz Jahanian 54e6d924ff Fix test.
llvm-svn: 66856
2009-03-13 00:43:34 +00:00
Ted Kremenek 4d4d2277a9 Update checker build.
llvm-svn: 66855
2009-03-13 00:43:31 +00:00
Fariborz Jahanian 1b074a3eb7 Fixed an ir-gen bug related to strong-cast generation of
source being a non-pointer.

llvm-svn: 66854
2009-03-13 00:42:52 +00:00
Mike Stump a1e619330f Fix spelling error, and add target triplet to header.
llvm-svn: 66853
2009-03-13 00:41:24 +00:00
Douglas Gregor d2b7ef6ece Improve the representation of operator expressions like "x + y" within
C++ templates. In particular, keep track of the overloaded operators
that are visible from the template definition, so that they can be
merged with those operators visible via argument-dependent lookup at
instantiation time. 

Refactored the lookup routines for argument-dependent lookup and for
operator name lookup, so they can be called without immediately adding
the results to an overload set.

Instantiation of these expressions is completely wrong. I'll work on
that next.

llvm-svn: 66851
2009-03-13 00:33:25 +00:00
Chris Lattner b858c0eba0 just initialize the first element, we don't need to set the rest to zeros.
llvm-svn: 66850
2009-03-13 00:24:01 +00:00
Mike Stump 39eaa7bc67 When testing with VERBOSE=0, report results in the ISO format. We
include the triplet so that people that run multiple targets in
parallel, say i386 and x86_64 can distinguish between the two.

llvm-svn: 66849
2009-03-13 00:21:49 +00:00
Daniel Dunbar 34c4187152 ccc/Driver: Mark {dump{machine,specs,version},
print-{multi-{directory,lib,os-directory}, search-dirs} as unsupported
instead of handling separately.

llvm-svn: 66848
2009-03-13 00:17:48 +00:00
Chris Lattner 0bf186906b Eliminate a 9640 byte static mutable initialized data item by moving it
to the stack.  This shrinks all llvm tools by 9k, and improves reentrancy.

llvm-svn: 66847
2009-03-13 00:03:51 +00:00
Argyrios Kyrtzidis c3e39c0149 Bring in std::string to fix compilation on GCC 4.3
llvm-svn: 66846
2009-03-13 00:01:07 +00:00
Chris Lattner 9170209603 static functions don't need an anonymous namespace.
llvm-svn: 66845
2009-03-12 23:59:55 +00:00
Daniel Dunbar bfeec7443f Driver: Determine which compilation stages to run.
llvm-svn: 66844
2009-03-12 23:55:14 +00:00
Dan Gohman a19c662a83 Fix a typo in a comment.
llvm-svn: 66843
2009-03-12 23:55:10 +00:00
Ted Kremenek e413a76004 Use the correct data structures!
ExplodedGraph::TrimGraph:
- Just do a DFS both ways instead of BFS-DFS. We're just determining what subset
  of the nodes are reachable from the root and reverse-reachable from the bug
  nodes.  DFS is more efficient for this task.
  
BugReporter:
- MakeReportGraph: Do a reverse-BFS instead of a reverse-DFS to determine the
  approximate shortest path through the simulation graph. We were seeing some
  weird cases where too many loops were being reported for simple bugs. Possibly
  we will need to replace this with actually computing the shortest path in
  terms of line numbers.

llvm-svn: 66842
2009-03-12 23:41:59 +00:00
Dale Johannesen ed6f5a8253 Previous debug info fix to this code wasn't quite
right; did the wrong thing when there are exactly 11
non-debug instructions, followed by debug info.
Remove a FIXME since it's apparently been fixed along the way.

llvm-svn: 66840
2009-03-12 23:18:09 +00:00
Gabor Greif af76c34b4b cosmetic change, in preparation of future change
llvm-svn: 66839
2009-03-12 23:13:03 +00:00
Evan Cheng 50a839e61f Add this test back.
llvm-svn: 66838
2009-03-12 23:01:35 +00:00
Douglas Gregor 0f60e9a4af Eliminate some unused default cases in switches on the binary operator kind
llvm-svn: 66837
2009-03-12 22:51:37 +00:00
Fariborz Jahanian 1bf7288529 More objc2's ivar layout bitmap.
bitmap generation for basic ivars seem to
work now. This is work in progress.

llvm-svn: 66836
2009-03-12 22:50:49 +00:00
Douglas Gregor 6873f9c521 Implement template instantiation for builtin binary operators
llvm-svn: 66835
2009-03-12 22:46:12 +00:00
Fariborz Jahanian 36ce7e17d7 Use paropery's setter attribute name as
the selector for the property setter.

llvm-svn: 66834
2009-03-12 22:34:11 +00:00
Douglas Gregor b970d0ca9d Store the type of the integral value within a TemplateArgument, so that we can more efficiently reconstruct an IntegerLiteral from it during template instantiation
llvm-svn: 66833
2009-03-12 22:20:26 +00:00
Ted Kremenek dd772264f4 Fix crash when using TypedViewRegions and ObjCQualifiedIdTypes (TypedViewRegion::getLValueType() was not implemented).
llvm-svn: 66830
2009-03-12 22:15:08 +00:00
Daniel Dunbar db948ffaf0 raw_ostream: unbuffered streams weren't being immediately flushed on
single character writes.

llvm-svn: 66827
2009-03-12 22:02:44 +00:00
Duncan Sands 1f853d6a2a Revert commit 66140 since it caused several failures
in the Ada testcase.  Reverting this only covers up
the real problem, which is a nasty conceptual difficulty
in the phi elimination pass: when eliminating phi nodes
in landing pads, the register copies need to come before
the invoke, not at the end of the basic block which is
too late...  See PR3784.

llvm-svn: 66826
2009-03-12 21:13:42 +00:00
Scott Michel b1a830abf0 Darwin 10.4.x: "-rpath" is unnecessary when linking shared libraries.
llvm-svn: 66825
2009-03-12 21:03:53 +00:00
Dale Johannesen 7f99d22f2f There already was a class to force deterministic
sorting of ConstantInt's; unreinvent wheel.

llvm-svn: 66824
2009-03-12 21:01:11 +00:00
Bob Wilson e4467e46a5 Fix an inconsistent use of LLVMGCCDIR. In all other cases, this directory
refers to the "prefix" directory, i.e., one level above "bin".  LLVMGCCPATH
is used as the directory containing the llvm-gcc executable, so add a "/bin"
suffix to get from LLVMGCCDIR to LLVMGCCPATH.

llvm-svn: 66823
2009-03-12 19:47:24 +00:00
Ted Kremenek 77158a4b99 Add file I forgot to commit in previous commit.
llvm-svn: 66820
2009-03-12 18:42:19 +00:00
Daniel Dunbar 92c2af76c4 Driver: Value initialization is nicer than memset.
- Who wouldn't want correctness to hang critically on two easily
   ignored characters?

Thanks Doug!

llvm-svn: 66819
2009-03-12 18:42:02 +00:00
Ted Kremenek 9d1ce8faae PathDiagnostics:
- PathDiagnosticControlFlowPiece now consists of a "start" and "end" location
  to indicating the branch location and where the branch goes.

BugReporter:
- Updated BugReporter to construct PathDiagnosticControlFlowPiece objects with
  "end" locations.

PlistDiagnostics:
- Plists now contain the bug "type" (not just bug "category")
- Plists now encode control-flow pieces differently than events; now the
  "start" and "end" locations are recorded

llvm-svn: 66818
2009-03-12 18:41:53 +00:00
Daniel Dunbar f479c1293e Driver: Add majority of driver-driver implementation.
- Compare to driverdriver.c if bored; not completely fair since the
   driver gets a bit more code in other places to handle binding archs
   (for Xarch) but not completely unfair either.

Fear not, extra Action classes will have a happy home for their
vtables soon.

llvm-svn: 66817
2009-03-12 18:40:18 +00:00
Douglas Gregor c92208333f Use StmtVisitor to handle the decoding of expressions for
instantiation. This is roughly the structure we want to expression
instantiation.

llvm-svn: 66816
2009-03-12 18:36:18 +00:00
Gabor Greif c91aa9b857 Rearrange operands of the BranchInst, to be able to
access each with a fixed negative index from op_end().

This has two important implications:
- getUser() will work faster, because there are less iterations
  for the waymarking algorithm to perform. This is important
  when running various analyses that want to determine callers
  of basic blocks.
- getSuccessor() now runs faster, because the indirection via OperandList
  is not necessary: Uses corresponding to the successors are at fixed
  offset to "this".

The price we pay is the slightly more complicated logic in the operator
User::delete, as it has to pick up the information whether it has to free
the memory of an original unconditional BranchInst or a BranchInst that
was originally conditional, but has been shortened to unconditional.
I was not able to come up with a nicer solution to this problem. (And
rest assured, I tried *a lot*).

Similar reorderings will follow for InvokeInst and CallInst. After that
some optimizations to pred_iterator and CallSite will fall out naturally.

llvm-svn: 66815
2009-03-12 18:34:49 +00:00
Ted Kremenek 7398059c84 API fix: All "bodies" for functions, Objective-C methods, blocks, are assumed to
be CompoundStmts. I think this is a valid assumption, and felt that the API
should reflect it. Others please validate this assumption to make sure I didn't
break anything.

llvm-svn: 66814
2009-03-12 18:33:24 +00:00
Daniel Dunbar 57fc0194a8 Driver: Drop some unnecessary uses of clang namespace.
llvm-svn: 66813
2009-03-12 18:31:08 +00:00
Daniel Dunbar 446f684332 Driver: Introduce ActionList typedef, tweak some constness.
llvm-svn: 66809
2009-03-12 18:24:49 +00:00
Daniel Dunbar 208f0269e7 Driver: Add types::canLipoType helper method.
llvm-svn: 66807
2009-03-12 18:21:41 +00:00
Daniel Dunbar d5f7d2509b Driver: Add some HostInfo accessors.
llvm-svn: 66806
2009-03-12 18:20:49 +00:00
Daniel Dunbar 7c8d653a2c Driver: Add ArgList support for synthesizing arguments.
llvm-svn: 66805
2009-03-12 18:20:18 +00:00