Commit Graph

305 Commits

Author SHA1 Message Date
Chris Lattner 6705883ad8 use Constant::getAggregateElement to simplify a bunch of code.
llvm-svn: 148934
2012-01-25 06:48:06 +00:00
Chris Lattner 00245f420a add more support for ConstantDataSequential
llvm-svn: 148802
2012-01-24 13:41:11 +00:00
Rafael Espindola abf456e320 The iteration order over a std::set<Module*> depends on the addresses of the
modules. Avoid that to make the order the linker sees the modules deterministic.

llvm-svn: 148676
2012-01-23 03:41:53 +00:00
Rafael Espindola 23f8d64b58 Link symbols with different visibilities according to the rules in the
System V Application Binary Interface. This lets us use
-fvisibility-inlines-hidden with LTO.
Fixes PR11697.

llvm-svn: 147624
2012-01-05 23:02:01 +00:00
Mon P Wang 5d44a4332a When not destroying the source, the linker is not remapping the types. Added support
to CloneFunctionInto to allow remapping for this case.

llvm-svn: 147217
2011-12-23 02:18:32 +00:00
Dylan Noblesmith 9e5b178ecc drop unneeded config.h includes
llvm-svn: 147197
2011-12-22 23:04:07 +00:00
Chris Lattner eaf9b7629a Fix a nasty bug in the type remapping stuff that I added that is breaking kc++ on
the build bot in some cases.  The basic issue happens when a source module contains
both a "%foo" type and a "%foo.42" type.  It will see the later one, check to see if
the destination module contains a "%foo" type, and it will return true... because
both the source and destination modules are in the same LLVMContext.  We don't want
to map source types to other source types, so don't do the remapping if the mapped
type came from the source module.

Unfortunately, I've been unable to reduce a decent testcase for this, kc++ is 
pretty great that way.

llvm-svn: 147010
2011-12-20 23:14:57 +00:00
Chris Lattner 9eb3f00406 Now that PR11464 is fixed, reapply the patch to fix PR11464,
merging types by name when we can.  We still don't guarantee type name linkage
but we do it when obviously the right thing to do.  This makes LTO type names 
easier to read, for example.

llvm-svn: 146932
2011-12-20 00:12:26 +00:00
Chris Lattner 5e3bd9727a fix PR11464 by preventing the linker from mapping two different struct types from the source module onto the same opaque destination type. An opaque type can only be resolved to one thing or another after all.
llvm-svn: 146929
2011-12-20 00:03:52 +00:00
Chad Rosier 5e5bee4c52 Revert 146728 as it's causing failures on some of the external bots as well as
internal nightly testers.  Original commit message:

By popular demand, link up types by name if they are isomorphic and one is an
autorenamed version of the other.   This makes the IR easier to read, because
we don't end up with random renamed versions of the types after LTO'ing a large
app.

llvm-svn: 146838
2011-12-17 22:19:53 +00:00
Chris Lattner 3fdf98c60f By popular demand, link up types by name if they are isomorphic and one is an
autorenamed version of the other.   This makes the IR easier to read, because
we don't end up with random renamed versions of the types after LTO'ing a large app.

llvm-svn: 146728
2011-12-16 08:36:07 +00:00
Daniel Dunbar 27a7489a03 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
Daniel Dunbar 539d0a8a09 build/CMake: Finish removal of add_llvm_library_dependencies.
llvm-svn: 145420
2011-11-29 19:25:30 +00:00
Daniel Dunbar bf9bba47a1 build: Add initial cut at LLVMBuild.txt files.
llvm-svn: 143634
2011-11-03 18:53:17 +00:00
Tanya Lattner 0a48b877c6 Add support to the linker to lazily link in functions. This change only links functions marked with specific linkage (internal, private, linker_private, linker_private_weak, linker_private_weak_def_auto, linkonce, linkonce_odr, and available_externally) if they have uses in the destination module. Instead of automatically linking, these functions are placed onto a worklist to be processed in the final stage of linking. We iterate over the list and if any functions on the list have uses in the destination module, we link them in and repeat the process until no changes in the state (uses) has changed. This means that any functions in the LazilyLink worklist that have a use in the destination module will be linked in and none that don't.
llvm-svn: 143524
2011-11-02 00:24:56 +00:00
Peter Collingbourne 8bb15d8276 Teach ModuleLinker::getLinkageResult about materialisable functions
llvm-svn: 143316
2011-10-30 17:46:34 +00:00
Tanya Lattner ea166d44e7 Allow the source module to be materialized during the linking process.
llvm-svn: 142010
2011-10-14 22:17:46 +00:00
Tanya Lattner cbb9140806 Make it possible to use the linker without destroying the source module. This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before.
This line, and those below, will be ignored--

M    include/llvm/Linker.h
M    tools/bugpoint/Miscompilation.cpp
M    tools/bugpoint/BugDriver.cpp
M    tools/llvm-link/llvm-link.cpp
M    lib/Linker/LinkModules.cpp

llvm-svn: 141606
2011-10-11 00:24:54 +00:00
Ivan Krasin 5227ea6028 lib/Linker: add support of deps which does not end with ".so".
It happens (for example) when you want to have a dependency on the .so
with the specific version, like liblzma.so.1.0.0 or
libcrypto.so.0.9.8.

llvm-svn: 140201
2011-09-20 22:52:35 +00:00
Chris Lattner 44f7ab4544 switch to the new struct api.
llvm-svn: 137482
2011-08-12 18:07:26 +00:00
Devang Patel 6ddbb2e277 Linke NamedMDNodes after linking global values as comment suggests.
llvm-svn: 136909
2011-08-04 19:44:28 +00:00
Chandler Carruth 9d7feab3e0 Rewrite the CMake build to use explicit dependencies between libraries,
specified in the same file that the library itself is created. This is
more idiomatic for CMake builds, and also allows us to correctly specify
dependencies that are missed due to bugs in the GenLibDeps perl script,
or change from compiler to compiler. On Linux, this returns CMake to
a place where it can relably rebuild several targets of LLVM.

I have tried not to change the dependencies from the ones in the current
auto-generated file. The only places I've really diverged are in places
where I was seeing link failures, and added a dependency. The goal of
this patch is not to start changing the dependencies, merely to move
them into the correct location, and an explicit form that we can control
and change when necessary.

This also removes a serialization point in the build because we don't
have to scan all the libraries before we begin building various tools.
We no longer have a step of the build that regenerates a file inside the
source tree. A few other associated cleanups fall out of this.

This isn't really finished yet though. After talking to dgregor he urged
switching to a single CMake macro to construct libraries with both
sources and dependencies in the arguments. Migrating from the two macros
to that style will be a follow-up patch.

Also, llvm-config is still generated with GenLibDeps.pl, which means it
still has slightly buggy dependencies. The internal CMake
'llvm-config-like' macro uses the correct explicitly specified
dependencies however. A future patch will switch llvm-config generation
(when using CMake) to be based on these deps as well.

This may well break Windows. I'm getting a machine set up now to dig
into any failures there. If anyone can chime in with problems they see
or ideas of how to solve them for Windows, much appreciated.

llvm-svn: 136433
2011-07-29 00:14:25 +00:00
Frits van Bommel 717d7edd3e Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting.

llvm-svn: 135390
2011-07-18 12:00:32 +00:00
Devang Patel d2d49862fc Link NamedMDNode before linking function bodies.
llvm-svn: 135204
2011-07-14 22:13:07 +00:00
Chris Lattner 0c134b52b9 simplify this logic now that GlobalAlias::isDeclaration is fixed.
llvm-svn: 135183
2011-07-14 20:23:05 +00:00
Chris Lattner b1ed91f397 Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM.  One way to look at it
is through diffstat:
 109 files changed, 3005 insertions(+), 5906 deletions(-)

Removing almost 3K lines of code is a good thing.  Other advantages
include:

1. Value::getType() is a simple load that can be CSE'd, not a mutating
   union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
   uniques them.  This means that the compiler doesn't merge them structurally
   which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
   struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
   in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead 
   "const Type *" everywhere.

Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.  
"LLVM 3.0" is the right time to do this.

There are still some cleanups pending after this, this patch is large enough
as-is.

llvm-svn: 134829
2011-07-09 17:41:24 +00:00
Bill Wendling 46a2b5b3b7 Set the unnamed_addr only when we're creating a new GV in the dest module.
llvm-svn: 128507
2011-03-29 23:31:06 +00:00
Bill Wendling cfb2036689 Revert r128501. It caused test failures.
llvm-svn: 128506
2011-03-29 23:28:02 +00:00
Bill Wendling 985bef24d1 We need to copy over the unnamed_addr attribute.
llvm-svn: 128501
2011-03-29 23:05:41 +00:00
Rafael Espindola 4a9b18d07b Correctly merge available_externally and regular definitions when they have
different visibilities.

llvm-svn: 124650
2011-02-01 05:33:52 +00:00
Rafael Espindola 489e505adf Allow unnamed_addr on declarations.
llvm-svn: 123529
2011-01-15 08:15:00 +00:00
Rafael Espindola 9ebe8ce68c Keep unnamed_addr when linking.
llvm-svn: 123364
2011-01-13 05:12:34 +00:00
Chris Lattner 43f8d16482 Revamp the ValueMapper interfaces in a couple ways:
1. Take a flags argument instead of a bool.  This makes
   it more clear to the reader what it is used for.
2. Add a flag that says that "remapping a value not in the
   map is ok".
3. Reimplement MapValue to share a bunch of code and be a lot
   more efficient.  For lookup failures, don't drop null values
   into the map.
4. Using the new flag a bunch of code can vaporize in LinkModules
   and LoopUnswitch, kill it.

No functionality change.

llvm-svn: 123058
2011-01-08 08:15:20 +00:00
Chris Lattner e240995e41 include the module identifier when emitting this warning, PR8865.
llvm-svn: 122637
2010-12-30 02:49:45 +00:00
Chris Lattner 1556522a34 print the right string, thanks for Frits for noticing.
llvm-svn: 122636
2010-12-30 01:07:20 +00:00
Chris Lattner bd530a8e83 improve warning message to at least say what the triples are.
llvm-svn: 122632
2010-12-29 22:41:18 +00:00
Michael J. Spencer fce1fe16e0 Fix whitespace.
llvm-svn: 122158
2010-12-18 22:23:15 +00:00
Michael J. Spencer ca93d8406d Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
llvm-svn: 122157
2010-12-18 22:23:07 +00:00
Owen Anderson c15ab07cff Revert r122143 through r122140, which collectively broke the LLVMC tests on
the buildbots.

llvm-svn: 122149
2010-12-18 07:37:18 +00:00
Michael J. Spencer 01cf728ea9 Fix whitespace.
llvm-svn: 122142
2010-12-18 04:13:46 +00:00
Michael J. Spencer 4f63507d05 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
llvm-svn: 122141
2010-12-18 04:13:36 +00:00
Michael J. Spencer 39a0ffc394 MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
llvm-svn: 121958
2010-12-16 03:29:14 +00:00
Michael J. Spencer 7b6fef82d4 Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
llvm-svn: 121379
2010-12-09 17:36:48 +00:00
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Mikhail Glushenkov 2c3991acf3 GetDLLSuffix: Remove the leading dot from LTDL_SHLIB_EXT.
This allows using GetDLLSuffix() with appendSuffix().

llvm-svn: 118051
2010-11-02 20:32:59 +00:00
Mikhail Glushenkov f26f4a0535 Trailing whitespace.
llvm-svn: 118050
2010-11-02 20:32:52 +00:00
Rafael Espindola e73bc89093 Fix PR8300 by remembering to keep the bitcast in all cases.
llvm-svn: 116788
2010-10-19 02:02:57 +00:00
Bill Wendling 5ed50b6151 Revert "RequiresUnique" patch. This should be handled at a lower level.
llvm-svn: 115827
2010-10-06 20:18:44 +00:00
Bill Wendling 10f60fa411 Change RequiresMerge to RequiresUnique. It's a better description of what this
fix is trying to accomplish.

This code could still use some polishing.

llvm-svn: 115759
2010-10-06 07:03:52 +00:00
Bill Wendling cd8fe46d4b If the destination module all ready has a copy of the global coming from the
source module *and* it must be merged (instead of simply replaced or appended
to), then merge instead of replacing or adding another global.

The ObjC __image_info section was being appended to because of this
failure. This caused a crash because the linker expects the image info section
to be a specific size.

<rdar://problem/8198537>

llvm-svn: 115753
2010-10-06 06:16:30 +00:00