Commit Graph

9719 Commits

Author SHA1 Message Date
Chris Lattner
b374b90e81 Fix PR4834, a tricky case where the inliner would resolve an
indirect function pointer, inline it, then go to delete the body.
The problem is that the callgraph had other references to the function,
though the inliner had no way to know it, so we got a dangling pointer
and an invalid iterator out of the deal.

The fix to this is pretty simple: stop the inliner from deleting the
function by knowing that there are references to it.  Do this by making
CallGraphNodes contain a refcount.  This requires moving deletion of 
available_externally functions to the module-level cleanup sweep where
it belongs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 03:15:49 +00:00
Chris Lattner
5095e3d1d1 Fix some nasty callgraph dangling pointer problems in
argpromotion and structretpromote.  Basically, when replacing
a function, they used the 'changeFunction' api which changes
the entry in the function map (and steals/reuses the callgraph
node).

This has some interesting effects: first, the problem is that it doesn't
update the "callee" edges in any callees of the function in the call graph.
Second, this covers for a major problem in all the CGSCC pass stuff, which 
is that it is completely broken when functions are deleted if they *don't*
reuse a CGN.  (there is a cute little fixme about this though :).

This patch changes the protocol that CGSCC passes must obey: now the CGSCC 
pass manager copies the SCC and preincrements its iterator to avoid passes
invalidating it.  This allows CGSCC passes to mutate the current SCC.  However
multiple passes may be run on that SCC, so if passes do this, they are now
required to *update* the SCC to be current when they return.

Other less interesting parts of this patch are that it makes passes update
the CG more directly, eliminates changeFunction, and requires clients of
replaceCallSite to specify the new callee CGN if they are changing it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 00:19:58 +00:00
Chris Lattner
23603a61c9 add a dump() method on callgraph.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 22:24:32 +00:00
Daniel Dunbar
4a1fadaf52 Tweak comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80516 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 21:14:05 +00:00
Chris Lattner
8a67ac525e add getPointerAddressSpace() to GEP instruction, use the method
in a few scalar xforms to simplify things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 20:06:40 +00:00
Chris Lattner
a07ae6be66 add a "getPointerAddressSpace" helper method to LoadInst and StoreInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80503 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 19:45:21 +00:00
Chris Lattner
77bc60e77e hopefully unbreak the build by making this-> explicit for dependent
base class lookup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80499 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 17:44:10 +00:00
Torok Edwin
ce0c81e7dd Add regular expression matching support, based on OpenBSD regexec()/regcomp()
implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 08:24:09 +00:00
Daniel Dunbar
7092c7e1dc llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now.
- Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80484 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 06:17:16 +00:00
Chris Lattner
32859c71d6 make DenseMap::clear() early exit if there is nothing to do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80480 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 05:55:04 +00:00
Chris Lattner
0a9ad97b35 some minor cleanups to IRBuilder, factor the insertion
hook out of the main IRBuilder class to allow clients to
override it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80479 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 05:42:59 +00:00
Bill Wendling
8ed211406a Nuke moribund "std::string" version of EOL(..., Encoding).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80466 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 00:28:57 +00:00
Dan Gohman
c34ee42595 Remove some unused fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 23:34:14 +00:00
Bill Wendling
9b35a09e7e - Add target lowering methods to get the preferred format for the FDE and LSDA
encodings.
- Make some of the values emitted by the FDEs dependent upon the pointer
  size. This is in line with how GCC does things. And it has the benefit of
  working for Darwin in 64-bit mode now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 12:20:54 +00:00
Bill Wendling
b5abecded7 Add a form of EOL which emits the text version of a DWARF format encoding. This
doesn't handle all values of the formatting. Those can be added as needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 12:17:53 +00:00
Devang Patel
e4b275610a Reapply 79977.
Use MDNodes to encode debug info in llvm IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 23:24:31 +00:00
Daniel Dunbar
8f4d146c34 llvm-mc: Support .comm emission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 07:08:35 +00:00
Daniel Dunbar
d5a8e98ef6 llvm-mc: Support .zerofill emission.
- I'm still trying to figure out the cleanest way to implement this and match the assembler, currently there are some substantial differences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:49:21 +00:00
Daniel Dunbar
edc670f3f2 llvm-mc: Tweak section alignment and size computation to match 'as' closer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:49:04 +00:00
Daniel Dunbar
e6cdbf2f92 llvm-mc: Emit .lcomm as .zerofill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:48:46 +00:00
Daniel Dunbar
8751b94ffb llvm-mc: Add const to EmitZeroFill section argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:48:22 +00:00
Daniel Dunbar
eccf22528f Add MathExtras.h OffsetToAlignment, like RoundUpToAlignment but returns the
offset to the next aligned integer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:48:04 +00:00
Devang Patel
a1ba269a27 Closure is a very generic name. Use AppleBlock instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 23:51:51 +00:00
Gabor Greif
7362ce08cb eliminate all 80-col violations that I have introduced in my recent checkins (and some others more)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 23:44:33 +00:00
Dan Gohman
c75cd159cd Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:59:08 +00:00
Dan Gohman
1af0513be7 Be somewhat more consistent about const qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:54:15 +00:00
Dan Gohman
5753a4a003 Global Aliases are not identifiable objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:52:56 +00:00
Dan Gohman
846a2f2703 Handle TargetData with const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:51:25 +00:00
Dan Gohman
0aeed044d6 Strip trailing whitespace from blank lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:29:49 +00:00
Gabor Greif
4c75054b01 re-apply r80197, now that iterator.h is not mentioned any more
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 17:07:35 +00:00
Daniel Dunbar
4fac74950a llvm-mc/Mach-O: Add MCCodeEmitter support, for encoding instructions.
- No relocations yet, of course.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 08:17:51 +00:00
Daniel Dunbar
4b770c2077 Add {MCInst,MCOperand}::{print,dump}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 07:57:12 +00:00
Gabor Greif
1e1de49394 the buildbots revealed one more breakage. fix. (why didn't I see this?)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 06:59:20 +00:00
Gabor Greif
f0891be8bd Clean up the minor mess I caused with removing iterator.h. I shall take care of 80-col violations and the FIXME later. (Thanks goodness that I live in another continent, so the monkeypox did not strike me :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 06:41:46 +00:00
Chris Lattner
199ba42cbf Implement a new optimization in the inliner: if inlining multiple
calls into a function and if the calls bring in arrays, try to merge
them together to reduce stack size.  For example, in the testcase
we'd previously end up with 4 allocas, now we end up with 2 allocas.

As described in the comments, this is not really the ideal solution
to this problem, but it is surprisingly effective.  For example, on
176.gcc, we end up eliminating 67 arrays at "gccas" time and another
24 at "llvm-ld" time.

One piece of concern that I didn't look into: at -O0 -g with
forced inlining this will almost certainly result in worse debug
info.  I think this is acceptable though given that this is a case
of "debugging optimized code", and we don't want debug info to
prevent the optimizer from doing things anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 06:29:33 +00:00
Bill Wendling
0141739854 Revert accidental commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 05:35:28 +00:00
Chris Lattner
12f0babca4 reduce header #include'age
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80204 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 04:32:07 +00:00
Chris Lattner
8f2718fbef enhance InlineFunction to be able to optionally return
a the list of static allocas that it inlined.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 04:20:52 +00:00
Chris Lattner
ec1bea0d94 smallvectorize the list of returns built by CloneAndPruneFunctionInto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 04:02:30 +00:00
Chris Lattner
597ef10577 remove CloneTrace, which appears to be dead since 2004.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80201 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 03:56:43 +00:00
Bill Wendling
fffb7266fe --- Reverse-merging r80147 into '.':
A    include/llvm/ADT/iterator.cmake
U    autoconf/configure.ac
--- Reverse-merging r80161 into '.':
U    cmake/config-ix.cmake
--- Reverse-merging r80171 into '.':
U    Makefile
--- Reverse-merging r80173 into '.':
U    configure
U    include/llvm/Config/config.h.in
--- Reverse-merging r80180 into '.':
A    include/llvm/ADT/iterator.h.in

Despite common miscomceptions, iterator.h is alive and well. It broke the build
bots for several hours. And yet no one bothered to look at them.

Gabor and Doug, please review your changes and make sure that they actually
build before resubmitting them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 03:29:26 +00:00
Daniel Dunbar
04baf9094a llvm-mc: Tweak MCCodeEmitter skeleton.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 01:34:22 +00:00
Daniel Dunbar
8dcf700802 Add missing declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 01:15:54 +00:00
Daniel Dunbar
4a0abd80f1 Sketch TargetRegistry support for MCCodeEmitter abstract interface.
- Of course, nothing actually can provide this interface yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 00:51:57 +00:00
Daniel Dunbar
81e400092f Try to make MSVC just a little happier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 00:38:04 +00:00
Gabor Greif
c42afd7946 now that include/llvm/ADT/iterator.h.in is not attempted to be built, its prerequisite can go away too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 23:35:33 +00:00
Douglas Gregor
6047515446 Regenerate configure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80173 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 22:59:05 +00:00
Daniel Dunbar
959fd88334 llvm-mc/Mach-O: Don't put assembler temporary labels in the symbol table.
- I moved section creation back into AsmParser. I think policy decisions like
   this should be pushed higher, not lower, when possible (in addition the
   assembler has flags which change this behavior, for example).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 22:13:22 +00:00
Gabor Greif
a626e16b38 nobody includes llvm/ADT/iterator.h any more,
so get rid of this monstrosity. iterator.h.in is scheduled for deletion in my working copy,
but I wait till I see that configure gets regenerated, as it depends on it. I'll commit
then.
There are still some AC_* tests in the configure.ac dealing with iterators, those can
be zapped probably too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 21:36:59 +00:00
Daniel Dunbar
6009db486e llvm-mc/Mach-O: Set .subsections_via_symbols flag properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80144 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 21:22:22 +00:00