1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

305 Commits

Author SHA1 Message Date
Michael J. Spencer
90f807fda5 Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632

Conflicts:

	cmake/modules/AddLLVM.cmake

llvm-svn: 113819
2010-09-13 23:59:48 +00:00
Michael J. Spencer
98ad3f2ea7 CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
Chris Lattner
118bf38c3f dead code patrol
llvm-svn: 112713
2010-09-01 16:06:39 +00:00
Dan Gohman
8088d5e31d Reapply r112091 and r111922, support for metadata linking, with a
fix: add a flag to MapValue and friends which indicates whether
any module-level mappings are being made. In the common case of
inlining, no module-level mappings are needed, so MapValue doesn't
need to examine non-function-local metadata, which can be very
expensive in the case of a large module with really deep metadata
(e.g. a large C++ program compiled with -g).

This flag is a little awkward; perhaps eventually it can be moved
into the ClonedCodeInfo class.

llvm-svn: 112190
2010-08-26 15:41:53 +00:00
Daniel Dunbar
aeb8abb0e0 Revert r112091, "Remap metadata attached to instructions when remapping
individual ...", which depends on r111922, which I am reverting.

llvm-svn: 112157
2010-08-26 03:48:08 +00:00
Dan Gohman
d19a0a49d1 Remap metadata attached to instructions when remapping individual
instructions, not when remapping modules.

llvm-svn: 112091
2010-08-25 21:36:50 +00:00
Bill Wendling
9e3d8d1a60 - Add the LinkerPrivateWeakDefAutoLinkage to the Ada bindings.
- Support the LinkerWeak*Linkage types in llvm-nm and in LinkModules.cpp.

llvm-svn: 111952
2010-08-24 20:00:52 +00:00
Dan Gohman
2dfd959d32 Link NamedMDNodes after linking GlobalValues, so that MDNodes
which reference GlobalValues are properly remapped.

llvm-svn: 111949
2010-08-24 19:37:11 +00:00
Dan Gohman
dbd04d0886 When linking NamedMDNodes, remap their operands.
llvm-svn: 111948
2010-08-24 19:31:04 +00:00
Dan Gohman
30fd721e48 Use MapValue in the Linker instead of having a private function
which does the same thing. This eliminates redundant code and
handles MDNodes better. MDNode linking still doesn't fully
work yet though.

llvm-svn: 111941
2010-08-24 18:50:07 +00:00
Dan Gohman
c4d5e30436 Don't cast away qualifiers with C-style casts.
llvm-svn: 111933
2010-08-24 18:09:44 +00:00
Argyrios Kyrtzidis
75b69c1de3 Revert r111082. No warnings for this common pattern.
llvm-svn: 111102
2010-08-15 10:27:23 +00:00
Argyrios Kyrtzidis
70b248e3ac Add ATTRIBUTE_UNUSED to methods that are not supposed to be used.
llvm-svn: 111082
2010-08-14 21:35:10 +00:00
Dan Gohman
859ffd353e Make NamedMDNode not be a subclass of Value, and simplify the interface
for creating and populating NamedMDNodes.

llvm-svn: 109061
2010-07-21 23:38:33 +00:00
Bill Wendling
59ef9bcc6d Revert r107205 and r107207.
llvm-svn: 107215
2010-06-29 22:34:52 +00:00
Bill Wendling
05a4c0b1f2 Introducing the "linker_weak" linkage type. This will be used for Objective-C
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:

       .globl l_objc_msgSend_fixup_alloc
       .weak_definition l_objc_msgSend_fixup_alloc
       .section __DATA, __objc_msgrefs, coalesced
       .align 3
l_objc_msgSend_fixup_alloc:
        .quad   _objc_msgSend_fixup
        .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

llvm-svn: 107205
2010-06-29 21:24:00 +00:00
Dan Gohman
9789093ab7 Add basic error checking to MemoryBuffer::getSTDIN.
llvm-svn: 104855
2010-05-27 17:31:51 +00:00
Dan Gohman
018b11555d Use the return value of getMagicNumber instead of using a
separate canRead() call.

llvm-svn: 104853
2010-05-27 17:18:38 +00:00
Duncan Sands
e9a13a3c60 Introduce isOpaqueTy and use it rather than isa<OpaqueType>. Also, move some
methods to try to have the type predicates be more logically positioned.

llvm-svn: 96349
2010-02-16 14:50:09 +00:00
Victor Hernandez
157da4b794 Linker should not remap null operands of metadata
llvm-svn: 95468
2010-02-06 01:31:55 +00:00
Victor Hernandez
8bef667691 Need to recurse for all operands of function-local metadata; and handle Instructions (which map to themselves)
llvm-svn: 94691
2010-01-27 22:03:03 +00:00
Jeffrey Yasskin
fb10587e50 Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Chris Lattner
3b984e1b99 merge two ifs
llvm-svn: 94650
2010-01-27 02:18:21 +00:00
Victor Hernandez
db86c7d1a0 Linker needs to do deep-copy of function-local metadata to update references to function arguments
llvm-svn: 94632
2010-01-27 00:30:42 +00:00
Chris Lattner
5a57121631 make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Devang Patel
81f0fa06d7 Remove MetadataBase class because it is not adding significant value.
llvm-svn: 94243
2010-01-22 22:52:10 +00:00
Chris Lattner
276811b58a Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
David Chisnall
edfb3fc27c Fixed linking of modules containing aliases to constant bitcasts. Existing behaviour first tried to replace the aliases with the global that they aliased (rather than the bitcast), causing a crash on an assert because the types didn't match. When this was fixed, it then did the same thing creating the new alias (creating an alias with a different type to its aliasee).
Linking modules containing aliases to GEPs is still not quite right.  GEPs that are equivalent to bitcasts will be replaced by bitcasts, GEPs that are not will just break.  Aliases to GEPs that are not equivalent to bitcasts are horribly broken anyway (it might be worth adding an assert when creating the alias to prevent these being created; they just cause problems later).

llvm-svn: 93052
2010-01-09 16:27:31 +00:00
David Greene
2f13cc8277 Change this back to errs().
llvm-svn: 92674
2010-01-05 01:55:22 +00:00
David Greene
fa8721709e Change errs() to dbgs().
llvm-svn: 92628
2010-01-05 01:27:59 +00:00
David Greene
771bfcd4c5 Change errs() to dbgs().
llvm-svn: 92626
2010-01-05 01:27:53 +00:00
Chris Lattner
c12382b7c8 rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.

llvm-svn: 92322
2009-12-31 01:22:29 +00:00
Bill Wendling
3f3f9a1bc8 Remove dead store.
llvm-svn: 92192
2009-12-28 01:54:15 +00:00
Daniel Dunbar
886e51b5c1 Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.

llvm-svn: 86630
2009-11-10 00:43:58 +00:00
Chris Lattner
6c38ec917d random tidy
llvm-svn: 86511
2009-11-09 04:18:23 +00:00
Chris Lattner
c7f4a1df29 remove a redundant printout, LinkInArchive prints this as well.
llvm-svn: 86510
2009-11-09 04:15:28 +00:00
Daniel Dunbar
4daaf9d3f4 Pass StringRef by value.
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Chris Lattner
e3b5cc7fe6 implement linker support for BlockAddress.
llvm-svn: 85700
2009-11-01 02:46:39 +00:00
Dan Gohman
d7a57a70f3 Remove unnecessary #include.
llvm-svn: 81636
2009-09-12 22:24:25 +00:00
Devang Patel
8e274bafa9 There is not any need to copy metadata while merging modules.
llvm-svn: 80941
2009-09-03 20:35:57 +00:00
Chris Lattner
3203639c35 Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.

This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
   for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
   clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
   instead.
4. Weans llvm-db off <iostream>

sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.

llvm-svn: 79869
2009-08-23 22:45:37 +00:00
Chris Lattner
01dae858b6 eliminate the "Value" printing methods that print to a std::ostream.
This required converting a bunch of stuff off DOUT and other cleanups.

llvm-svn: 79819
2009-08-23 04:37:46 +00:00
Devang Patel
df6d338da2 Link NamedMDNodes.
llvm-svn: 78696
2009-08-11 18:01:24 +00:00
Devang Patel
c8a9584200 Link metadata.
llvm-svn: 78652
2009-08-11 06:46:31 +00:00
Owen Anderson
1dc40e205b Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.

llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson
881d928f9b Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Benjamin Kramer
da986c3fc9 Remove now unused Context variables.
llvm-svn: 77495
2009-07-29 19:14:17 +00:00
Owen Anderson
0ce2151b36 Move ConstantExpr to 2.5 API.
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Owen Anderson
390e9778d4 Return ConstantVector to 2.5 API.
llvm-svn: 77366
2009-07-28 21:19:26 +00:00
Owen Anderson
aa8c94b051 Change ConstantArray to 2.5 API.
llvm-svn: 77347
2009-07-28 18:32:17 +00:00
Owen Anderson
d729f993b8 Move ConstantStruct back to 2.5 API.
llvm-svn: 77266
2009-07-27 22:29:26 +00:00
Daniel Dunbar
038a7f0d35 Remove Value::{isName, getNameRef}.
Also, change MDString to use a StringRef.

llvm-svn: 77098
2009-07-25 23:55:21 +00:00
Daniel Dunbar
9f50ab3c49 Finish migrating VMCore to StringRef/Twine based APIs.
llvm-svn: 77051
2009-07-25 06:02:13 +00:00
Daniel Dunbar
251177c96e Initial update to VMCore to use Twines for string arguments.
- The only meat here is in Value.{h,cpp} the rest is essential 'const
   std::string &' -> 'const Twine &'.

llvm-svn: 77048
2009-07-25 04:41:11 +00:00
Daniel Dunbar
4499c47ea4 Switch ValueSymbolTable to StringRef based API.
llvm-svn: 76894
2009-07-23 18:52:12 +00:00
Owen Anderson
cc287b28c9 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Bill Wendling
1a10a060cb Add plumbing for the `linker_private' linkage type. This type is meant for
"private" symbols which the assember shouldn't strip, but which the linker may
remove after evaluation. This is mostly useful for Objective-C metadata.

This is plumbing, so we don't have a use of it yet. More to come, etc.

llvm-svn: 76385
2009-07-20 01:03:30 +00:00
Torok Edwin
f955a6ef49 llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin
ae8a3ff177 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Owen Anderson
332aae685b Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Owen Anderson
7a1f69e433 Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson
64d037fba9 LLVM Context-ification.
llvm-svn: 74948
2009-07-07 21:07:14 +00:00
Owen Anderson
4fa7e54329 Make the use of const with respect to LLVMContext sane. Hopefully this is the last time, for the
moment, that I will need to make far-reaching changes.

llvm-svn: 74655
2009-07-01 23:13:44 +00:00
Owen Anderson
cf112e59c3 Hold the LLVMContext by reference rather than by pointer.
llvm-svn: 74640
2009-07-01 21:22:36 +00:00
Owen Anderson
81b8dabb53 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Chris Lattner
c1bfdc9bb2 Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.

llvm-svn: 68940
2009-04-13 05:44:34 +00:00
Duncan Sands
26ab759672 Apply ODR linkage changes accidentally dropped during
final cleaning.  This fixes a bunch of testsuite failures.

llvm-svn: 66380
2009-03-08 13:35:23 +00:00
Duncan Sands
5ab54d488f Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Mikhail Glushenkov
a4a724f737 Oops.
llvm-svn: 65942
2009-03-03 10:04:23 +00:00
Mikhail Glushenkov
1d23d4e16b 80-column violation + trailing whitespace.
llvm-svn: 65936
2009-03-03 07:22:23 +00:00
Rafael Espindola
0aba6c9435 Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Misha Brukman
71c7e40966 Removed trailing whitespace from Makefiles.
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Dan Gohman
64431fe1db Make comments and code for QuietWarnings and QuietErrors
actually correspond to what their names suggest.

llvm-svn: 58146
2008-10-25 17:57:20 +00:00
Anton Korobeynikov
e322e95ecd Also properly handle linking of strong alias and weak global
llvm-svn: 57595
2008-10-15 20:10:50 +00:00
Anton Korobeynikov
d514695f79 Properly handle linking of strong alias with weak function, this fixes PR2883
llvm-svn: 57594
2008-10-15 20:10:08 +00:00
Duncan Sands
651eeb4be2 Rename isWeakForLinker to mayBeOverridden. Use it
instead of hasWeakLinkage in a bunch of optimization
passes.

llvm-svn: 56782
2008-09-29 11:25:42 +00:00
Oscar Fuentes
0f25988689 Initial support for the CMake build system.
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Anton Korobeynikov
6ad8b060d0 Make safer variant of alias resolution routine to be default
llvm-svn: 56005
2008-09-09 20:05:04 +00:00
Anton Korobeynikov
3a24741034 Fix incorrect linker behaviour: we shouldn't resolve weak aliases.
llvm-svn: 55997
2008-09-09 18:23:48 +00:00
Chris Lattner
ef7178406b Reimplement LinkFunctionProtos in terms of GetLinkageResult. This fixes
the second half of link-global-to-func.ll and causes some minor changes in
messages.

There are two TODOs here.  First, this causes a regression in 
2008-07-06-AliasWeakDest.ll, which is now failing (so I xfailed it).  Anton,
I would really appreciate it if you could take a look at this.  It should be
a matter of adding proper alias support to GetLinkageResult, and was probably
already a latent bug that would manifest with globals.

The second todo is to reimplement LinkAlias in the same pattern as 
function and global linking.  This should be pretty straight-forward for 
someone who knows aliases, but isn't a requirement for correctness.

llvm-svn: 53548
2008-07-14 07:23:24 +00:00
Chris Lattner
0b95d5f57d don't do any linkage, not even type resolution, of symbols that have
internal linkage.

llvm-svn: 53547
2008-07-14 06:52:19 +00:00
Chris Lattner
d31cacb5d6 implement linking of globals to functions, in one direction
(replacing a function with a global).  This is needed when building
llvm itself with LTO on darwin, because of the EXPLICIT_SYMBOL hack
in lib/system/DynamicLibrary.cpp.

Implementation of linking the other way will need to wait for a 
cleanup of LinkFunctionProtos.

llvm-svn: 53546
2008-07-14 06:49:45 +00:00
Chris Lattner
c68c953e71 wrap long lines, remove some code from a non-assert build.
llvm-svn: 53545
2008-07-14 05:52:33 +00:00
Chris Lattner
6d7c5fa8dc The source and dest of an alias are *not* required to have the same type,
though that would be nice and make sense :).  Patch by Nathan Keynes!

llvm-svn: 53387
2008-07-10 01:09:33 +00:00
Dan Gohman
c97817aac3 Make DenseMap's insert return a pair, to more closely resemble std::map.
llvm-svn: 53177
2008-07-07 17:46:23 +00:00
Anton Korobeynikov
47e1a76977 Add convenient helper for checking whether global is weak in linker sense
having weak or linkonce or common or extweak LLVM linkage.

llvm-svn: 53158
2008-07-05 23:48:30 +00:00
Anton Korobeynikov
302db24cf1 Override weak stuff during linking of aliases. This fixes PR2463.
llvm-svn: 53156
2008-07-05 23:33:22 +00:00
Anton Korobeynikov
3593f9f7f1 Properly link alias and function decls. This fixes PR2146
llvm-svn: 53154
2008-07-05 23:03:21 +00:00
Chris Lattner
f40ef5f964 when linking globals, make sure to preserve the address space of the global.
llvm-svn: 52810
2008-06-27 03:10:24 +00:00
Chris Lattner
9ab7735924 Fix an error handling redefinition of linkonce functions where the
types differ.  Patch by Nathan Keynes!

llvm-svn: 52527
2008-06-20 05:29:39 +00:00
Chris Lattner
468adb09d7 Add a missing ~ (dtor became ctor) which caused crashes on a bunch of stuff.
llvm-svn: 52374
2008-06-16 23:06:51 +00:00
Chris Lattner
6782f56054 stop making PATypeHolder's so crazily.
llvm-svn: 52364
2008-06-16 21:17:12 +00:00
Chris Lattner
3dfc439a87 use a real associative container for type association instead of using
a vector with a linear search.  This speeds up the linking testcase 
in PR1860 from 0.965s to 0.385s on my system.

llvm-svn: 52357
2008-06-16 21:00:18 +00:00
Chris Lattner
f87729aa1f bail out sooner if we have two concrete but different types.
llvm-svn: 52351
2008-06-16 20:03:01 +00:00
Chris Lattner
896c38c96a simplify some code.
llvm-svn: 52350
2008-06-16 19:55:40 +00:00
Chris Lattner
fe3ddf06a8 Apply a patch from Nathan Keynes, which speeds up llvm-link on
the testcases in PR1860 from taking more than 1 hour (when I killed it)
to taking 1s.

llvm-svn: 52347
2008-06-16 19:48:08 +00:00
Chris Lattner
1a604edf16 handle vectors. Any integers that got here would necessarily be different already.
llvm-svn: 52341
2008-06-16 18:27:53 +00:00
Chris Lattner
c24aba4724 Simplify ResolveTypes by pulling the null case out into the one
client that cares and simplifying its control flow.

Remove the DestST argument to ResolveTypes and RecursiveResolveTypes*
which are dead now.

llvm-svn: 52340
2008-06-16 18:19:05 +00:00
Chris Lattner
cebf7d79b3 simplify RecursiveResolveTypes and ResolveTypes by pulling the naming out of
ResolveTypes into the one place that needs it.

llvm-svn: 52338
2008-06-16 18:11:40 +00:00
Chris Lattner
96dec66124 use 'continue' to make the function linker simpler. When linking a strong
function into a weak function, zap the weak function body so that the
strong one overrides it.  This fixes PR2410

llvm-svn: 52135
2008-06-09 07:47:34 +00:00