Commit Graph

83074 Commits

Author SHA1 Message Date
Anders Carlsson edea1de7c4 Change CXXConstructExpr::Create to take a ConstructionKind.
llvm-svn: 102884
2010-05-02 23:53:04 +00:00
Anders Carlsson 4d205ba87f Pass ForVirtualBase all the way to GetVTTParameter.
llvm-svn: 102883
2010-05-02 23:33:10 +00:00
Anders Carlsson f8a71f08d1 Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
llvm-svn: 102882
2010-05-02 23:29:11 +00:00
Anders Carlsson e11f9ce9dc Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.
llvm-svn: 102881
2010-05-02 23:20:53 +00:00
Anders Carlsson 4c638f1217 Pass the construction kind down to EmitCXXConstructorCall.
llvm-svn: 102880
2010-05-02 23:01:10 +00:00
Anders Carlsson bcc066b659 Add an enum to CXXConstructExpr so we can determine if the construction expression constructs a non-virtual or virtual base.
llvm-svn: 102879
2010-05-02 22:54:08 +00:00
Anders Carlsson 245820b9d9 Remove another unused function.
llvm-svn: 102871
2010-05-02 18:13:35 +00:00
Anders Carlsson 54eb4843b1 Remove an unused function.
llvm-svn: 102870
2010-05-02 18:12:22 +00:00
Duncan Sands 211427bda9 Remove the -enable-sjlj-eh option, which doesn't do anything.
Remove the -enable-eh option which is only used by the JIT,
and replace it with -jit-enable-eh.

llvm-svn: 102865
2010-05-02 15:36:26 +00:00
Benjamin Kramer 2718b4d757 CodeGen: Shrink RValue. 4 words -> 2 words.
llvm-svn: 102863
2010-05-02 14:59:10 +00:00
David Chisnall ff5f88c38e As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller.
llvm-svn: 102862
2010-05-02 13:41:58 +00:00
Douglas Gregor b139cd5843 Complete reimplementation of the synthesis for implicitly-defined copy
assignment operators. 

Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.

This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:

  - For a class subobject, call the appropriate copy-assignment
    operator, after overload resolution has determined what that is.
  - For an array of scalar types or an array of class types that have
    trivial copy assignment operators, construct a call to
    __builtin_memcpy.
  - For an array of class types with non-trivial copy assignment
    operators, synthesize a (possibly nested!) for loop whose inner
    statement calls the copy constructor.
  - For a scalar type, use built-in assignment.

This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.

Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.

llvm-svn: 102853
2010-05-01 20:49:11 +00:00
Chris Lattner 2094488d81 fix some inconsistent line endings, patch by Jakub Staszak!
llvm-svn: 102852
2010-05-01 17:36:49 +00:00
Chris Lattner ef8c6e8ba7 fix a broken link, diagnostickinds.td was fissioned.
llvm-svn: 102851
2010-05-01 17:35:19 +00:00
Chris Lattner b49a622fe9 revert r102831. We already delete dead readonly calls in
other places, killing a valid transformation is not the right
answer.

llvm-svn: 102850
2010-05-01 17:19:38 +00:00
Anders Carlsson b136e626ea Simplify EmitCopyCtorCall.
llvm-svn: 102849
2010-05-01 17:07:40 +00:00
Anders Carlsson aab3b57359 Simplify EmitClassAggrMemberwiseCopy.
llvm-svn: 102848
2010-05-01 17:02:18 +00:00
Douglas Gregor 1af7cc2830 Bump default template instantiation depth to 1024, as required by C++0x
llvm-svn: 102847
2010-05-01 16:59:21 +00:00
Anders Carlsson ab826ad169 Clean up EmitClassMemberwiseCopy further.
llvm-svn: 102846
2010-05-01 16:54:05 +00:00
Anders Carlsson 820022c55c Get rid of a parameter from EmitClassMemberwiseCopy.
llvm-svn: 102845
2010-05-01 16:49:43 +00:00
Dale Johannesen 1ebb395cee Don't count debug info as instructions. This was
preventing the emission of the NOP on Darwin for a
function with no actual code.  From timberwolfmc
with TEST=optllcdbg.

llvm-svn: 102843
2010-05-01 16:41:11 +00:00
Anders Carlsson 7911150a3d When defining implicit copy constructors, use SetBaseOrMemberInitializers to initialize the bases.
llvm-svn: 102842
2010-05-01 16:39:01 +00:00
David Chisnall f4b87f191b Added a variant of InlineCostAnalyzer::getInlineCost() that takes the called function as an explicit argument, for use when inlining function pointers.
llvm-svn: 102841
2010-05-01 15:47:41 +00:00
Douglas Gregor a57478e8f6 Added an RAII object that helps set up/tear down the Sema context
information required to implicitly define a C++ special member
function. Use it rather than explicitly setting CurContext on entry
and exit, which is fragile. 

Use this RAII object for the implicitly-defined default constructor,
copy constructor, copy assignment operator, and destructor.

llvm-svn: 102840
2010-05-01 15:04:51 +00:00
David Chisnall c0cf422d56 Attach message send metadata to the lookup as well as to the call (GNU runtime).
llvm-svn: 102839
2010-05-01 12:56:56 +00:00
Anton Korobeynikov 737718d4f4 Insert ANY_EXTEND node instead of invalid truncate during DAG Combining (X & 1),
when needed. This fixes PR7001

llvm-svn: 102838
2010-05-01 12:52:34 +00:00
David Chisnall ea529a43d4 Make super message lookups cacheable (GNUstep Runtime)
llvm-svn: 102837
2010-05-01 12:37:16 +00:00
Anton Korobeynikov 319d71f44f Do folding for indirect branches, where possible
llvm-svn: 102836
2010-05-01 12:28:21 +00:00
Anton Korobeynikov ebbdfef2fc Implement indirect branches on MSP430
llvm-svn: 102835
2010-05-01 12:04:32 +00:00
Anton Korobeynikov 6fbff44893 Long branch target oparands are not pc-rel.
This should fix PR6603.

llvm-svn: 102834
2010-05-01 12:04:22 +00:00
David Chisnall 9eecafa480 Tweaked EmitCall() to permit the caller to provide some metadata to attach to the call site.
Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining.

llvm-svn: 102833
2010-05-01 11:15:56 +00:00
Benjamin Kramer 8a855e1f7f Remove empty directory.
llvm-svn: 102832
2010-05-01 10:30:16 +00:00
Owen Anderson 550986ea90 Disable the call-deletion transformation introduced in r86975. Without
halting analysis, it is illegal to delete a call to a read-only function.
The correct solution is almost certainly to add a "must halt" attribute and
only allow deletions in its presence.

XFAIL the relevant testcase for now.

llvm-svn: 102831
2010-05-01 08:34:28 +00:00
Chris Lattner 532112b98a fix PR5009 by making CGSCCPM realize that a call was devirtualized
if an indirect call site was removed and a direct one was added, not
just if an indirect call site was modified to be direct.

llvm-svn: 102830
2010-05-01 06:38:43 +00:00
Chris Lattner c3bc80a082 rename test
llvm-svn: 102829
2010-05-01 06:34:13 +00:00
Dan Gohman ec74444d3e Remove the code for special-casing byval for fast-isel. SelectionDAG
handles argument lowering anyway, so there's no need for special
casing here.

llvm-svn: 102828
2010-05-01 02:44:23 +00:00
Dan Gohman effa3e5689 Fix an ancient FIXME.
llvm-svn: 102827
2010-05-01 02:43:10 +00:00
Dan Gohman 4959cf19b2 Re-disable kill flags, as there is more trouble.
llvm-svn: 102826
2010-05-01 01:57:56 +00:00
Chris Lattner 036078ca76 with recent optimizer changes, these all get devirtualized.
llvm-svn: 102825
2010-05-01 01:42:06 +00:00
Chris Lattner c2432b9d44 rename InlineInfo.DevirtualizedCalls -> InlinedCalls to
reflect that it includes all inlined calls now, not just
devirtualized ones.

llvm-svn: 102824
2010-05-01 01:26:13 +00:00
Chris Lattner fc8d9ee6c3 Implement rdar://6295824 and PR6724 with two tiny changes
that can have a big effect :).  The first is to enable the
iterative SCC passmanager juice that kicks in when the
scc passmgr detects that a function pass has devirtualized
a call.  In this case, it will rerun all the passes it 
manages on the SCC, up to the iteration count limit (4). This
is useful because a function pass may devirualize a call, and
we want the inliner to inline it, or pruneeh to infer stuff
about it, etc.

The second patch is to add *all* call sites to the 
DevirtualizedCalls list the inliner uses.  This list is
about to get renamed, but the jist of this is that the 
inliner now reconsiders *all* inlined call sites as candidates
for further inlining.  The intuition is this that in cases 
like this:

f() { g(1); }     g(int x) { h(x); }

We analyze this bottom up, and may decide that it isn't 
profitable to inline H into G.  Next step, we decide that it is
profitable to inline G into F, and do so, which means that F 
now calls H.  Even though the call from G -> H may not have been
profitable to inline, the call from F -> H may be (in this case
because a constant allows folding etc).

In my spot checks, this doesn't have a big impact on code.  For
example, the LLC output for 252.eon grew from 0.02% (from
317252 to 317308) and 176.gcc actually shrunk by .3% (from 1525612
to 1520964 bytes).  252.eon never iterated in the SCC Passmgr,
176.gcc iterated at most 1 time.

llvm-svn: 102823
2010-05-01 01:15:56 +00:00
Chris Lattner e8262675a3 The inliner has traditionally not considered call sites
that appear due to inlining a callee as candidates for
futher inlining, but a recent patch made it do this if
those call sites were indirect and became direct.

Unfortunately, in bizarre cases (see testcase) doing this
can cause us to infinitely inline mutually recursive
functions into callers not in the cycle.  Fix this by
keeping track of the inline history from which callsite
inline candidates got inlined from.

This shouldn't affect any "real world" code, but is required
for a follow on patch that is coming up next.

llvm-svn: 102822
2010-05-01 01:05:10 +00:00
Dan Gohman 77ef6f6a17 Re-enable kill flags from SelectionDAGISel, with a fix: don't
try to put a kill flag on a DBG_INFO instruction.

llvm-svn: 102820
2010-05-01 00:50:53 +00:00
Dale Johannesen 3dca8f3da3 Fix a bug where debug info affected stack slot coloring.
Seen in SingleSrc/Benchmarks/Misc/flops with TEST=optllcdbg.
7929951.

llvm-svn: 102819
2010-05-01 00:41:15 +00:00
John McCall 0b66eb38c7 It turns out that basically every caller to RequireCompleteDeclContext
already knows what context it's looking in.  Just pass that context in
instead of (questionably) recalculating it.

llvm-svn: 102818
2010-05-01 00:40:08 +00:00
Dan Gohman 096619eb52 Fix whitespace.
llvm-svn: 102817
2010-05-01 00:33:28 +00:00
Dan Gohman 63f31115cd Don't pass SDValues by non-const reference unless they may be
modified.

llvm-svn: 102816
2010-05-01 00:33:16 +00:00
Evan Cheng 66561537f5 Add a pseudo instruction REG_SEQUENCE that takes a list of registers and
sub-register indices and outputs a single super register which is formed from
a consecutive sequence of registers.

This is used as register allocation / coalescing aid and it is useful to
represent instructions that output register pairs / quads. For example,
v1024, v1025 = vload <address>
where v1024 and v1025 forms a register pair.

This really should be modelled as
v1024<3>, v1025<4> = vload <address>
but it would violate SSA property before register allocation is done.

Currently we use insert_subreg to form the super register:
v1026 = implicit_def
v1027 - insert_subreg v1026, v1024, 3
v1028 = insert_subreg v1027, v1025, 4
...
      = use v1024
      = use v1028

But this adds pseudo live interval overlap between v1024 and v1025.

We can now modeled it as
v1024, v1025 = vload <address>
v1026 = REG_SEQUENCE v1024, 3, v1025, 4
...
      = use v1024
      = use v1026

After coalescing, it will be
v1026<3>, v1025<4> = vload <address>
...
      = use v1026<3>
      = use v1026

llvm-svn: 102815
2010-05-01 00:28:44 +00:00
Dan Gohman 5d059718c9 Reorgnaize more switch code lowering to clean up some tricky
code, and to eliminate the need for the SelectionDAGBuilder
state to be live during CodeGenAndEmitDAG calls.

Call SDB->clear() before CodeGenAndEmitDAG calls instead of
before it, and move the CurDAG->clear() out of SelectionDAGBuilder,
which doesn't own the DAG, and into CodeGenAndEmitDAG.

llvm-svn: 102814
2010-05-01 00:25:44 +00:00
Bill Wendling 02bc6787ca Test failing too much on too many platforms.
llvm-svn: 102812
2010-05-01 00:12:33 +00:00