Commit Graph

431 Commits

Author SHA1 Message Date
Chris Lattner
a4477f9b31 stop making PATypeHolder's so crazily.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:17:12 +00:00
Chris Lattner
62a81a1eba 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:00:18 +00:00
Chris Lattner
56539659eb bail out sooner if we have two concrete but different types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 20:03:01 +00:00
Chris Lattner
9ddf2c898f simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:55:40 +00:00
Chris Lattner
849dcd928a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:48:08 +00:00
Chris Lattner
f6f4f7a149 handle vectors. Any integers that got here would necessarily be different already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:27:53 +00:00
Chris Lattner
bc1c82a0f7 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:19:05 +00:00
Chris Lattner
371ca83d8b simplify RecursiveResolveTypes and ResolveTypes by pulling the naming out of
ResolveTypes into the one place that needs it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:11:40 +00:00
Chris Lattner
822143e6f7 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:47:34 +00:00
Chris Lattner
8246849829 minor changes to short circuit the 'no linkage' case earlier for
function bodies.  We now don't try to unify types or handling type
mismatches if when linking an internal foo to an external foo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:36:11 +00:00
Chris Lattner
bc3d1c7e4c simplify function visibility handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:25:28 +00:00
Duncan Sands
28c3cff825 Factor code to copy global value attributes like
the section or the visibility from one global
value to another: copyAttributesFrom.  This is
particularly useful for duplicating functions:
previously this was done by explicitly copying
each attribute in turn at each place where a
new function was created out of an old one, with
the result that obscure attributes were regularly
forgotten (like the collector or the section).
Hopefully now everything is uniform and nothing
is forgotten.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51567 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 19:58:59 +00:00
Gabor Greif
b1dbcd886a Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 10:04:30 +00:00
Dale Johannesen
aafce77b17 Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences
in some cases on Darwin, so we need both.  The intent
is that "common" will behave identically to "weak" unless
somebody changes their target to do something else.
No functional change as yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51118 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 20:12:51 +00:00
Anton Korobeynikov
caa8ae8125 Fix linking of internal aliases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50950 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-10 14:41:43 +00:00
Anton Korobeynikov
0b12ecf6ff Turn StripPointerCast() into a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 22:54:15 +00:00
Anton Korobeynikov
149a315369 If weak GlobalVariable was bitcast'ed to different type during linking
we will need to strip all casts for intializer lookup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 22:52:54 +00:00
Owen Anderson
6bc41e8a74 Revert r49614. As Dan pointed out, some of these aren't correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:38:21 +00:00
Owen Anderson
386ea355e7 Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2),
which is significantly more efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49614 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 19:15:17 +00:00
Gabor Greif
051a950000 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 20:25:17 +00:00
Chris Lattner
038112a4e0 Change the MemoryBuffer::getFile* methods to take just a pointer to the
start of a filename, not a filename+length.  All clients can produce a
null terminated name, and the system api's require null terminated 
strings anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49041 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 18:04:03 +00:00
Anton Korobeynikov
5241957b1f Ultimately resolve aliases during linking, if possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 22:51:09 +00:00
Anton Korobeynikov
7fcb6b65c9 Fix thinko: alias always defines new symbol. Even is aliasee itself is undefined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48203 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 00:24:53 +00:00
Anton Korobeynikov
ed61c0bc76 Add sanity checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:36:53 +00:00
Anton Korobeynikov
b8cdaf7099 Typo: 'function' => 'alias'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48183 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:36:35 +00:00
Anton Korobeynikov
817bf2aeb2 Syntactic sugar'ify stuff :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48182 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:36:08 +00:00
Anton Korobeynikov
aeb09967fd Always run 'make check' :) Fix fallout from prev. commit: query for possible
alias destination only if we don't have anything to link to


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:35:31 +00:00
Anton Korobeynikov
1438b9dd82 Make error messages to have common style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:34:46 +00:00
Anton Korobeynikov
01f6939935 Properly link globals with aliases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:34:28 +00:00
Anton Korobeynikov
968e39a5ab Remove the LinkGlobal weirderness in common linking phase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:33:53 +00:00
Anton Korobeynikov
2b48ef0450 Typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48176 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 22:33:22 +00:00
Ted Kremenek
58d5e05157 Fix some compilation errors on msvc:
- "Redefinition of I" (iterator masks previous definition)
- include missing header file

Patch by Argiris Kirtzidis!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48115 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 18:32:50 +00:00
Anton Korobeynikov
75c7915c3a Clarify some important bits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48010 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 18:34:50 +00:00
Anton Korobeynikov
e20c814518 Small cleanup: propagate thread-localness via generic routine.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 18:32:18 +00:00
Anton Korobeynikov
9f2ee70366 Missed patch from my last commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 23:21:39 +00:00
Anton Korobeynikov
3db9191baf Resolve aliases to aliasees, where possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47975 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 23:08:47 +00:00
Anton Korobeynikov
b5a4bd86df Handle functions as targets during linking of aliases as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47974 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 23:08:16 +00:00
Anton Korobeynikov
58887bc593 Try hard to link aliases. Checks can be too strict by now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47968 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 22:22:46 +00:00
Anton Korobeynikov
4fb2873bb4 Remember the source->dest mapping when copying aliases. This fixes PR2054
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47945 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 15:27:21 +00:00
Anton Korobeynikov
1c01a72d4d Clarify the state-of-the-art
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47944 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 15:11:00 +00:00
Anton Korobeynikov
eba0415600 Properly populate lists of defined/undefined symbols in presence of aliases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 20:16:11 +00:00
Lauro Ramos Venancio
6b0f14b96a Emit an error when a library is not found. It is the GNU ld behavior and it is expected by the configure scripts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 17:20:32 +00:00
Anton Korobeynikov
a27694d7aa And final pack of warnings silencing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 11:27:04 +00:00
Chris Lattner
f27dfcb210 random cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 18:49:08 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Chris Lattner
fc643c5e88 remove attribution from lib Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:09:26 +00:00
Anton Korobeynikov
650d5053bf Ignore functions with internal linkages during linking. This snipped mimics the
behaviour of LinkGlobals() function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45375 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 23:21:57 +00:00
Gordon Henriksen
194c90ed2a Fixing several transforms which would drop the collector attribute
when copying functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45356 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-25 22:16:06 +00:00
Duncan Sands
dc024674ff Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Dan Gohman
c318329a10 Use correct parentheses with the '&& "..."' idiom in an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42750 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 15:13:30 +00:00
Chris Lattner
97f8b0900a Fix PR1611 - Visibility should be ignored for a declaration
when a definition's visibility is different.  Likewise, the
visibility of two declarations mismatching is not an error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41174 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-19 22:22:54 +00:00
Reid Spencer
49068bf311 Improve error handling in the linker by:
1. Eliminate redundant error messages. LinkInFile and LinkInArchive
   already call the error() method in each case so there's no use
   telling the user again that an item couldn't be linked in.

2. Improve the formatting of error messages (separating content).

3. Change the wording for the warning about unrecognized files. Make
   it clear that the file is being ignored.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41121 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 07:47:30 +00:00
Reid Spencer
af11dc00a0 Ensure that error messages a propagated from calls to LinkInModule so they get
reported to the end user.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41117 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 07:23:37 +00:00
Reid Spencer
53424ad141 Allow the filename "-" to be a place holder for stdin. This allows directing
stdin through llvm-ld and llvm-link.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 19:52:29 +00:00
Reid Spencer
858dd546bb Report an error if one occurs in releaseModule.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40405 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22 21:39:37 +00:00
Gabor Greif
e75ca3d809 eliminate residual cruft related to recognizing bytecode
files.
bitcode files are the only LLVM format left.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37945 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 13:38:17 +00:00
Gabor Greif
a99be51bf5 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:07:56 +00:00
Lauro Ramos Venancio
00d8a84b44 Fix a bug in my previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37778 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 20:06:38 +00:00
Lauro Ramos Venancio
31ed0fb804 When linking two modules, we should copy the alias.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 19:02:54 +00:00
Lauro Ramos Venancio
9613e871d2 Propagate alignment, section name and visibility when linking "appending
global values".
Fix noinline linkage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37482 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 22:01:12 +00:00
Chris Lattner
4bcca0f2ac switch this to bitcode instead of bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36867 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 09:29:13 +00:00
Chris Lattner
1a019e5ffd add bitcode support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36855 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 06:02:13 +00:00
Reid Spencer
c9a83e4f19 If an archive is not recognized as an LLVM bytecode archive then declare
that it is native so that the linker will pass it on downstream. This avoids
a problem where the native link line fails because there is both a .so and
a .a file. The .a file gets processed as bytecode and then dropped from the
command line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36584 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-30 00:29:39 +00:00
Reid Spencer
126b1b8683 Dependent libraries could be native too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-30 00:00:10 +00:00
Anton Korobeynikov
9cd3ccf506 Implement visibility checking during linking. Also implement protected
visibility support for bitcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36577 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 20:56:48 +00:00
Lauro Ramos Venancio
c763552299 Implement the "thread_local" keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35950 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-12 18:32:50 +00:00
Reid Spencer
18da072088 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35877 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 02:44:20 +00:00
Reid Spencer
c07cfdda02 For PR1302:
Use local variable names that match the function parameter name that it
is passed to so the code is more clear, to wit: is_bytecode -> is_native


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-04 06:44:18 +00:00
Reid Spencer
c8539731bd For PR1302:
Implement file tests for both LinkInLibrary and LinkInFile to determine if
the file is native. Don't generate warnings if the file is native.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35653 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-04 06:33:17 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Chris Lattner
33f294930e simplify this code by using value::takename
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34172 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 00:39:38 +00:00
Chris Lattner
f2e292ce58 push bytecode decompressor out through APIs. Now the bytecode reader
api's look like this:

ModuleProvider *getBytecodeModuleProvider(
  const std::string &Filename,  ///< Name of file to be read
  BCDecompressor_t *BCDC = Compressor::decompressToNewBuffer,
  std::string* ErrMsg = 0,      ///< Optional error message holder
  BytecodeHandler* H = 0        ///< Optional handler for reader events
);

This is ugly, but allows a client to say:

  getBytecodeModuleProvider("foo", 0);

If they do this, there is no dependency on the compression libraries, saving
codesize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34012 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 21:41:02 +00:00
Reid Spencer
688b0490e2 For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33922 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:19:13 +00:00
Reid Spencer
ef9b9a7939 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 20:47:22 +00:00
Reid Spencer
619f024cc3 Fix some comments and other minor sundry things.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33873 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-04 04:43:17 +00:00
Reid Spencer
471feac1b2 Ensure that visibility and section are properly propagated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33872 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-04 04:30:33 +00:00
Reid Spencer
8bef0373f1 Back out last revision which was committed by accident.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33871 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-04 04:29:21 +00:00
Reid Spencer
3dad8dc367 Make sure that section and visibility are properly propagated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33870 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-04 04:28:18 +00:00
Andrew Lenharth
5dfbaf1fe3 preserve sections of globals
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 17:12:54 +00:00
Reid Spencer
5cbf985dcb For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:08:39 +00:00
Chris Lattner
ec9bfdc152 Read from the right place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33611 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 02:18:13 +00:00
Chris Lattner
c36357c406 Fix PR1139
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33610 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 00:21:34 +00:00
Reid Spencer
26f238589f For PR761:
The Module::setEndianness and Module::setPointerSize methods have been
removed. Instead you can get/set the DataLayout. Adjust thise accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33530 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 08:11:39 +00:00
Reid Spencer
a54b7cbd45 For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.

This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
   bits in an integer. The Type classes SubclassData field is used to
   store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
   64-bit integers. These are replaced with just IntegerType which is not
   a primitive any more.
3. Adjust the rest of LLVM to account for this change.

Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types.  Future increments
will rectify this situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33113 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 07:05:14 +00:00
Reid Spencer
78d033e086 For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32956 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 07:24:44 +00:00
Andrew Lenharth
8753c447a5 extern_weak linkage. fixes PR1038
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32603 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-15 17:35:32 +00:00
Reid Spencer
4da49122f3 Change inferred getCast into specific getCast. Passes all tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32469 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 05:05:00 +00:00
Bill Wendling
1a097e30d3 Don't use <sstream> in Streams.h but <iosfwd> instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32340 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 23:41:45 +00:00
Bill Wendling
e81561909d Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 01:30:32 +00:00
Anton Korobeynikov
78ee7b78c3 Introducing external weak linkage. Darwin codegen should be added later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32052 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-01 00:25:12 +00:00
Bill Wendling
41edad7e4b Removed #include <iostream> and replaced with llvm_* streams.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31936 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-27 10:09:12 +00:00
Reid Spencer
0288d18bb6 Remvoe a do-nothing else block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31687 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-11 20:27:49 +00:00
Reid Spencer
4952143236 For PR998:
Fix an infinite loop in the Linker and a few other assorted link problems.

Patch contributed by Scott Michel. Thanks, Scott!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31680 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-11 11:54:25 +00:00
Chris Lattner
b324bd735f silence warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31587 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-09 05:18:12 +00:00
Reid Spencer
3ed469ccd7 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-02 20:25:50 +00:00
Anton Korobeynikov
b74ed07bfd Adding dllimport, dllexport and external weak linkage types.
DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30374 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-14 18:23:27 +00:00
Chris Lattner
501d529ccc Remove a redundant syscall.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29405 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 22:52:11 +00:00
Chris Lattner
27d672136a eliminate some ugly code, using ConstantExpr::getWithOperands instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29149 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-14 22:21:31 +00:00
Reid Spencer
8d8a7ffe58 Finish removal of EH usage from the Archive library. The REQUIRES_EH flag
in lib/Bytecode/Archive/Makefile is now removed. One small step closer to
a smaller LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29067 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-07 20:56:50 +00:00
Chris Lattner
1127315562 Fix Regression/Linker/2006-06-15-GlobalVarAnment.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28812 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-16 01:24:04 +00:00
Chris Lattner
620fd68b10 Fix linking of inline asm objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28640 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-01 19:14:22 +00:00
Chris Lattner
9273b0403e Add shufflevector support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27515 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-08 01:19:47 +00:00
Evan Cheng
39c61fd527 Add code to RemapOperand() to handle Instruction::ExtractElement and
Instruction::InsertElement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27477 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-07 01:27:42 +00:00
Chris Lattner
6631601eed Rename method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25571 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-24 04:14:29 +00:00
Chris Lattner
e1b2e14f92 Add support for linking inline asm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25560 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-23 23:08:37 +00:00
Chris Lattner
a88eb9287e add support for ConstantPacked to the linker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25467 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 23:15:58 +00:00
John Criswell
43da9c65f2 Fixed style of curly brace. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25414 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-17 22:01:57 +00:00
Reid Spencer
f4484f3e16 For PR521:
With these patches we implement the ability for the Linker library to
keep track of which libraries were actually bytecode files (not archives)
and cause their users to remove such files from the list of libraries to
pass to the native linker.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25169 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-10 03:14:40 +00:00
Reid Spencer
3e5e127f29 Be a little more explanatory in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25168 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-10 03:12:29 +00:00
Reid Spencer
328ead9fce Adjust the constructor to the Linker class to take an argument that names
the module being constructed. This is used to correctly name the module.
Previously the name of the linker tool was used which produces confusing
output when the module identifier is used in an error message.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24699 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-13 20:00:37 +00:00
Chris Lattner
ed74a4ef3b Fix test/Regression/Linker/2005-12-06-AppendingZeroLengthArrays.ll and
PR662.  Thanks to Markus for providing me with a ton of files to
reproduce the problem!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24619 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-06 17:30:58 +00:00
Chris Lattner
f36aeedaa3 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23940 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-24 02:26:13 +00:00
Reid Spencer
dd04df0ec3 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 23:21:43 +00:00
Reid Spencer
c7f083297c For PR495:
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22345 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 18:21:42 +00:00
Chris Lattner
cb9048a6e8 Preserve CC's when linking modules
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21799 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 01:09:39 +00:00
Misha Brukman
f976c856fc Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:55:34 +00:00
Chris Lattner
c72e57314a fix some 80 column violations
Add support for programs that define main in a .a file, such as f2c'd programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20631 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 23:03:34 +00:00
Chris Lattner
fc82ef6797 consolidate LinkFiles into LinkItems, use lib_* iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20630 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 22:55:17 +00:00
Chris Lattner
ad988f397d consolidate LinkLibraries into LinkItems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20629 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 22:51:40 +00:00
Chris Lattner
e4d5c441e0 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 04:54:21 +00:00
Chris Lattner
97716a47a1 Add support for ".so" files compiled with LLVM which contain LLVM bytecode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20253 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-19 18:30:29 +00:00
Chris Lattner
b9476d9b45 Eliminate silly warnings from the linker of the form:
WARNING: Type conflict between types named 'union.._604.'.
    Src=' %union.._604.'.
   Dest=' %union.._604.'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20252 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-19 17:52:37 +00:00
Chris Lattner
12945acd4a Minor cleanup. No need to explicitly tell the compiler the template arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20153 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 17:50:16 +00:00
Chris Lattner
50c301b9bb Print something useful for gccld -v with an archive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20148 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 15:26:14 +00:00
Chris Lattner
e6f8c5a716 Allow globals to be of different const'nesses when we link.
This finally resolves PR502, PR450,
and test/Regression/Linker/2005-02-12-ConstantGlobals{,-2}.ll correctly


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20135 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-12 19:20:28 +00:00
Reid Spencer
4ca8e71068 Remove un-needed #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19061 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 04:15:44 +00:00
Reid Spencer
a834f5d793 Fix a compile error. config.h is now needed because DataTypes.h doesn't
include it any more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18993 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-16 19:19:24 +00:00
Reid Spencer
903f21dd39 * Fix header block.
* Fix loop style per standards
* Don't create a new Module when the Linker's module is released.
* Add/fix function comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18871 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:50:50 +00:00
Reid Spencer
ff5f3ab9fe Add missing space in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18870 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:23:13 +00:00
Reid Spencer
04f5412496 Fix header and function comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18867 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:13:18 +00:00
Reid Spencer
de4cedca14 This file contains basic Linker facilities needed by all tools
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18860 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:28 +00:00
Reid Spencer
0ba9e211be Make LinkModules a static member function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18859 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:16 +00:00
Reid Spencer
7a87ce043b This file contains only the Linker's library linking support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18858 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:04 +00:00
Reid Spencer
e84de29663 For PR351: \
* Remove redundant static function LinkOneLibrary. \
* Remove unneded #includes \
* Convert FileSupport usage to sys::Path instead


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18857 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:59:52 +00:00
Reid Spencer
3ece6397cb This file contains only the Linker's file linking support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18856 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:59:41 +00:00
Reid Spencer
7dde0e3b05 For PR351: \
* Convert functions to Linker:: methods. \
* Remove unneeded #includes \
* Utilize sys::Path utilities not FileSupport utilities \
* Move File & Library linking functions to other source files


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18855 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:59:29 +00:00
Chris Lattner
152f19ac65 Make sure to link the target-triple as well, so it ends up in the .llvm.bc file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18774 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 20:26:15 +00:00
Chris Lattner
b2abb26fe1 Turn this error back into a warning, fixing the povray regression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18655 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 20:01:10 +00:00
Chris Lattner
d37a75b9be Revert this disgusting hack, John has a much nicer solution
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18611 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 03:31:14 +00:00
Chris Lattner
a6a2bdd0e0 Add a disgusting hack to work around a libstdc++ issue. This code should
be removed when PR400 is resolved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18610 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 03:28:51 +00:00
Reid Spencer
4bdf1c9855 Fix PR139: \
Implement LinkItems and BuildLinkItems interfaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18547 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-05 19:14:55 +00:00
Chris Lattner
c8ef1edc63 Fix linkage of mismatched weak globals. This unbreaks 300.twolf
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18494 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-04 18:54:48 +00:00
Chris Lattner
aee38ea569 Significantly rework linker support for global variables, allowing it to
correctly link globals whose LLVM types do not match.

This fixes several of the F2C SPEC FP benchmarks, which were failing this
due to the implementation of common blocks used by f2c.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18465 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-03 22:18:41 +00:00
Reid Spencer
be0b356593 PR466:
* Make the linker find lib*.bca files now instead of lib*.bc since those
  are what the makefiles now generate for bytecode archives.
* Make sure the linker only links archives when LinkLibraries is called.
  Previously if it found a lib*.bc file and that file was a bytecode file,
  it would link in the entire bytecode. This could make -lc -lc fail with
  duplicate symbols error but it shouldn't as searching multiple libraries,
  even the same one more than once, is permitted.
* Now that the above problems are corrected, implement the dependent libs
  feature. After the module is linked with all specified libraries, the
  LinkLibraries function will obtain the set of dependent libraries from
  the linked modules and attemp to find and link against those libraries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18428 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 09:52:10 +00:00
Reid Spencer
0022b83491 Revert version 1.39. It breaks the ordering of the library processing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18399 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 22:54:48 +00:00
Reid Spencer
a564845f83 Shared library extension is now in LTDL_SHLIB_EXT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18353 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-29 12:40:21 +00:00
Reid Spencer
53c4c5672c Implement dependent library linking. It is no longer required that -lstdc++
-lstdsup++ no -lc be passed on the command line to llvm linkers if the
progam being linked was compiled with the C/C++ Front End or Stacker.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18243 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 09:32:08 +00:00
Reid Spencer
719012d625 Remove blank comment lines for uniformity.
Make sure lines don't exceed 80 cols.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18242 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 09:29:44 +00:00
Reid Spencer
b9371ce552 Eliminate unsightly ;;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17979 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 03:27:05 +00:00
Reid Spencer
3cf2c32202 Reduce the amount of work in LinkInArchive by not searching the archive for
symbols it has already identified as not defining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17975 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 03:13:25 +00:00
Chris Lattner
a63acbfeab Don't increment a dead iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17904 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 19:04:40 +00:00
Chris Lattner
0033baf94e Simplify the remapper by only needing one map, since the body of the functions
being linked do not need to be remapped any longer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17900 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 17:12:38 +00:00
Chris Lattner
4bbfbff119 Take advantage of the fact that we are allowed to clobber the input module
by splicing function bodies from the src module to the destination module.

This speeds up linking quite a bit, e.g. gccld time on 176.gcc from 26s -> 20s
when forming the .rbc file, with a profile build.  One of the really strange
but cool effects of this patch is that it speeds up the optimizers as well,
from 12s -> 10.7s, presumably because of better locality???

In any case, this is just a first step.  We can trivially get rid of the
LocalMap now and do other simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17893 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 07:31:51 +00:00
Reid Spencer
99d3604acf Per code review:\
* Adjust indentation\
* Ensure memory do not leak if exceptions happen (std::auto_ptr use)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17885 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:47:41 +00:00
Chris Lattner
242e525edc The second arg may be clobbered by this function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17880 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:41:36 +00:00
Chris Lattner
a4d0c6fb94 use an autoptr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17875 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:40:54 +00:00
Reid Spencer
6238a85e4f Remove a forgotten debug output line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17810 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:49:55 +00:00
Reid Spencer
7cc371a795 Linker.h moved to include/llvm from include/llvm/Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:27:04 +00:00
Reid Spencer
605b9e2c5b Linker.h has a new home.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17801 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:00:08 +00:00
Reid Spencer
a455cca62f Don't bother with a re-linked library, ensure archive library is built.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17773 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:03:14 +00:00
Reid Spencer
8bbb17abe6 *Adjust prototypes for public interface. *Rewrite LinkInArchive to use symbol tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17772 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:02:27 +00:00
Reid Spencer
5c911ab6f1 Makefile for lib/Linker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17695 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 20:38:45 +00:00
Reid Spencer
7f49602e5a This file originated in lib/VMCore/Linker.cpp but now lives in
lib/Linker/LinkModules.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17694 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 20:37:43 +00:00
Reid Spencer
c408c45900 This file originated in tools/gccld/Linker.cpp but now lives in
lib/Linker/LinkArchives.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17693 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 20:34:32 +00:00
Misha Brukman
669b524399 Output the program name (in this case, gccld) with warning about invalid files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17638 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 04:24:59 +00:00
Misha Brukman
eda20f933b Don't silently ignore invalid files: tell the user!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17633 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-08 22:03:10 +00:00
Reid Spencer
07adb2836b Stop propagating method names that violate the coding standard
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17498 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 22:15:36 +00:00
Chris Lattner
b976e66816 Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17041 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:08:06 +00:00
Chris Lattner
d4984cca0e Make sure the const bit gets inherited correctly when linking declarations
of disagreeing constness.  This fixes
test/Regression/Linker/ConstantGlobals[123].ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16692 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-05 02:28:11 +00:00
Reid Spencer
57a0efa322 Implement support for dependent libraries. The "source" module's dependent
libraries list is merged into the "destination" module's list. Also, if the
source module is one of the dependent libraries, it is removed from the
list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16282 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-11 04:25:17 +00:00
Reid Spencer
551ccae044 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-01 22:55:40 +00:00
Chris Lattner
72cf7df6a3 Fix a nasty bug that Nate ran into. In particular, instead of emitting a 2+MB
error message, print out:

llvm-link: error linking in 'g.2.rbc': Global Variable Collision on
' %struct.D_Reduction* %d_reduction_10_gram' - External linkage globals have
different initializers

That's a bit more concise, huh?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15958 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-21 00:50:59 +00:00
Chris Lattner
aad2deb17c Fix another minor problem that exists if you ahve multiple functions with
nonunifiable types but the same name.  Down with PR411!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15511 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 22:39:54 +00:00
Chris Lattner
82b5b219dd Fix a typeo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15510 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 22:29:05 +00:00
Chris Lattner
868bbf35b0 Fix a major regression in my previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15486 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 08:30:43 +00:00
Alkis Evlogimenos
cc7ba49d85 Stop using getValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15485 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 08:08:13 +00:00
Chris Lattner
5a837defff FindGlobalNamed used to take 2.92s out of 8.39s running a profile build of
gccld -disable-opt on 252.eon.

This patch deletes it and replaces it with a map.  The proper fix for this
is to fix PR411, but this will do in the short term.

gccld on eon now takes 5.51s, which is 50% faster than before this patch. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15480 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 07:44:58 +00:00
Chris Lattner
7b0c84dcf5 I swear I compiled this, really I did.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15467 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 07:28:06 +00:00
Chris Lattner
c003628a61 Factor some code out, no substantial change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15466 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 07:05:54 +00:00
Chris Lattner
fe41069070 Concisify some code
Do not call FindGlobalNamed when we know we will ignore the result (because
we are not going to link a static symbol anyway).  This speeds up
gccld -disable-opt on 252.eon from 8.63s to 8.39s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15465 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 06:05:47 +00:00
Misha Brukman
47b14a4a6a Fix #includes of i*.h => Instructions.h as per PR403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15334 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 17:30:56 +00:00
Reid Spencer
00dc479613 bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14930 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-17 23:50:57 +00:00
Reid Spencer
c28a224c68 - #include <iostream> since its not in Value.h any more.
- constify use of Type* returned from symbol table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14615 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 11:52:49 +00:00
Misha Brukman
008248f2c0 Linker.h moved to include/llvm/Support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14351 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-23 17:33:09 +00:00
Misha Brukman
c837dd93cd Linker.h moved to include/llvm/Support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14349 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-23 17:24:31 +00:00
Chris Lattner
f70c22b019 Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 18:19:28 +00:00
Chris Lattner
0ebee7410f Move some functions out of gccld.cpp to GenerateCode.cpp. This allows us
to reduce the inter-file interface in the gccld tool and gets some
uninteresting code out of gccld.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13942 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-02 00:22:24 +00:00
Chris Lattner
bed85ff010 Header file moved
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13813 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 05:41:36 +00:00
Reid Spencer
567bc2cc1e Convert to SymbolTable's new lookup and iteration interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13751 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-25 08:52:20 +00:00
Misha Brukman
7a46e4c62b Don't use invalid HTML in a doxygen comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12962 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-15 15:23:45 +00:00
Chris Lattner
1438102576 Fix linking of constant expr casts due to type resolution changes. With
this and the other patches 253.perlbmk links again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12565 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-31 02:58:28 +00:00
Alkis Evlogimenos
c38aa6dd79 Include Config/config.h for SHLIBEXT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11779 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 22:42:51 +00:00
Chris Lattner
57cb9883aa Fix PR245: Linking weak and strong global variables is dependent on link order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11565 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 21:56:04 +00:00
Chris Lattner
de512b5b2e Adjustments to support the new ConstantAggregateZero class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11474 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:55:15 +00:00
John Criswell
7f7d16b62f Fixes for PR214. Use the SHLIBEXT variable instead of hardcoding .so into
every file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10976 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-26 20:59:41 +00:00
Chris Lattner
c6646ebdb9 Remove use of ConstantExpr::getShift
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10792 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 19:10:58 +00:00
Chris Lattner
f7703df496 Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10727 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-09 06:12:26 +00:00
John Criswell
368751f2b7 Modified the logic so that library objects with main() are only linked in
if the program currently has main undefined.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10597 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-23 20:27:14 +00:00
John Criswell
1715ce00e4 Modified the linker so that it always links in an object from an archive
that defines the symbol "main."  This is a hack that ensures that programs
that place their main function in a library and then link it in
(i.e. Apache 2.x) get their main function linked in.

There is probably a more correct way to do this, but this works for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10594 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-23 17:37:06 +00:00
Chris Lattner
6cc8ca9229 * The return value of LinkLibraries is ignored, so remove it.
* Finegrainify namespacification of Linker.cpp
* If linking a library in fails, do not STOP LINKING IN LIBRARIES AND
  CONTINUE ANYWAY!  Instead, just output the warning, and keep going. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10249 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-28 07:44:09 +00:00