Commit Graph

626 Commits

Author SHA1 Message Date
Misha Brukman
72a9caa260 Align comments together for consistency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21368 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 03:52:59 +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
001d16aa9c Fix an apparent ambiguity compiling on PPC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20507 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-07 02:59:36 +00:00
Chris Lattner
af4a9bb2ba simplify and speed up some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20472 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06 02:32:00 +00:00
Chris Lattner
7acff25f7f second argument to Value::setName is now gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20463 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-05 19:05:20 +00:00
Chris Lattner
da895d6337 Fix spelling, patch contributed by Gabor Greif!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20343 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27 06:18:25 +00:00
Reid Spencer
eaa06bb979 Implement an isBytecodeArchive method to determine if an archive contains
bytecode file members or not.
Patch Contributed By Adam Treat


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20338 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-26 22:00:32 +00:00
Chris Lattner
7e6182319d use more specific cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20297 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-24 05:26:04 +00:00
Reid Spencer
818827d734 Make the check for global variables the same as the one for functions. In
both cases they are looking for non-external variables/functions that do
not have internal linkage. Using "!isExternal()" is a little more
understandable than "hasInitializer()"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20155 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 18:12:20 +00:00
Chris Lattner
b52f1c2950 Make sure to clear the LazyFunctionLoadMap after we ParseAllFunctionBodies.
Otherwise, clients who call ParseAllFunctionBodies will attempt to parse
the function bodies twice, which is (uh) very very bad (tm).

This fixes gccld on python.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20152 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 17:48:18 +00:00
Chris Lattner
e5cea5eb89 Do not put internal symbols into the symbol table. This shrinks the symbol
table for archives in common cases, and prevents trying to resolve a
external reference with an internal reference.  This shrinks the libpython.a
symbol table from 126302 to 19770 bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20151 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 17:42:11 +00:00
Chris Lattner
613233230b Fix the regressions my User changes introduced. Apparently some parts of
LLVM make the very reasonable assumption that constant expressions will
have at least one operand! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19943 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31 01:11:13 +00:00
Chris Lattner
cad28bd3a0 Adjust to changes in User class and minor changes in instruction ctors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19894 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 00:36:19 +00:00
Jeff Cohen
d19d89a04c Properly close mapped files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19863 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 01:17:07 +00:00
Jeff Cohen
5fb6ed4ae6 Use binary mode for reading/writing bytecode files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19751 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 17:36:17 +00:00
Reid Spencer
56127624e7 Remove potential platform portability issue with size of "int".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19172 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-29 01:20:24 +00:00
Reid Spencer
0a834720db For PR351:
Remove unix specific code (use of errno and read) from the reader.
Thanks to Jeff Cohen for pointing this out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19081 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-21 07:51:33 +00:00
Reid Spencer
7904c4ffe4 Remove the #include of llvm/Config/unistd.h as it is no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19067 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 04:52:04 +00:00
Jeff Cohen
e133721047 Fix problems uncovered by VC++ (first time compiled by VC++)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19056 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 03:23:46 +00:00
Reid Spencer
cda985e191 For PR351:
* Remove #inclusion of FileUtilities.h, not needed any more.
* Convert getUniqueFilename -> sys::Pat::makeUnique()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18948 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 01:51:56 +00:00
Reid Spencer
9153f8f476 For PR351:
Use sys::MappedFile instead of ReadFileIntoAddressSpace and
UnmapFileFromAddressSpace. sys::MappedFile has the nice property that it
cleans up after itself so exception handling can be removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18902 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 18:25:27 +00:00
Reid Spencer
518ec2ea1f Make sure the Archive gets deleted if there's an error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18869 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:22:31 +00:00
Reid Spencer
5af46883f2 Implement error handling in OpenAndLoad* functions so the Linker can handle it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18853 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:59:03 +00:00
Reid Spencer
1fce09125c Path::get -> Path::toString
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18785 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 00:14:15 +00:00
Chris Lattner
389bd04b96 Remove a dead field, make the map go to integer type ID to hash better and
avoid a getType.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18691 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-09 06:19:44 +00:00
Chris Lattner
0aed01d43a Remove #include inadvertently added
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18686 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-09 04:53:17 +00:00
Chris Lattner
c4d6916508 Eliminate this ugly hack. This was put back in when replaceAllUsesOf used
a different algorithm that was extremely inefficient for instructions with
many operands.

This reduces the time of this code snippet from .23s for 176.gcc to 0.03s
in a debug build, which speeds up total llvm-dis time just barely.

It's more of a code cleanup than a speedup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18685 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-09 04:51:50 +00:00
Reid Spencer
3c39127b72 Provide more information in the error message that occurs when there are
unresolved constants remaining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18502 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-04 22:19:53 +00:00
Chris Lattner
129baf69bc Check in some patches for better assertions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18500 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-04 21:28:47 +00:00
Chris Lattner
02dce169c8 Do not allow bytecode files with unresolved references to be read. Doing
so lets wierd ConstantPlaceholder objects sneak into the system which
confuses it greatly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18487 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-04 05:28:27 +00:00
Chris Lattner
3af4b4fe78 RevisionNum is read by error(), initialize it early.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18386 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 16:58:18 +00:00
Reid Spencer
8dde18fc50 Compute the firstFileOffset correctly after reading the LLVM symbol table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18300 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-28 03:13:02 +00:00
Reid Spencer
84472d6e3c Adjust to Compressor interface change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18249 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 19:38:05 +00:00
Reid Spencer
84b9cedf91 Allow reading of member names that begin with an _ character.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18179 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-23 22:35:39 +00:00
Reid Spencer
93ee7dc430 Fix a comment to imply the correct semantics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18097 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 02:58:47 +00:00
Reid Spencer
9a29db43a7 Distinguish between BSD4.4 and SVR4 symbol tables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18044 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 07:29:40 +00:00
Reid Spencer
6405c9ec9f Correct the computation of when to add the padding. It is not based on the
member's size. It is based on the oddness/evenness of the file pointer.
This fixes a bug with llvm-ar not being able to read archives produced by
llvm-ranlib when there are members with odd long file name lengths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17997 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 17:08:00 +00:00
Chris Lattner
638c381ef7 Add note that this is for old bytecode files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17991 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 16:24:05 +00:00
Reid Spencer
57646ec44e Don't save an iterator, just use post-increment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17981 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 03:44:10 +00:00
Reid Spencer
7783e8ad69 Make findModulesDefiningSymbols modify its symbols argument so we can \
eliminate symbols defined by the archive efficiently


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17976 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 03:18:22 +00:00
Reid Spencer
d4543da9b0 Fix some things for Mac OSX archives:
* ensure trailing spaces are eliminated so they don't factor into the
  length of a member's name.
* make sure all the bytes of a name are written even if the name ends in
  multiple null characters (bug in OSX ar)
* make sure we provide the full member name when searching for symbols so
  the module name is not accidentally duplicated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17918 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-17 18:28:29 +00:00
Reid Spencer
6ab7a4f9ef Make sure we parse bytecode with a module identifier that reflects the full
name of the module: "Archive.a(object.o)"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17917 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-17 18:25:21 +00:00
Reid Spencer
96ce335f4e Adjust long file name writing to match BSD 4.4 and Mac OSX style archives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17910 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-17 16:14:21 +00:00
Reid Spencer
dd95e8d71e Despite documentation to the contrary, Mac OSX and BSD 4.4 archive formats
*do* include the length of the long file in the length of the member and
they are *not* null terminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17909 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-17 16:13:11 +00:00
Reid Spencer
30e4056a5d Fix typeo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17892 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 07:05:16 +00:00
Reid Spencer
87f90729d6 Per code review:\
* Make the numVbrBytes function more efficient and better documented \
* Fix a bug in name truncation \
* Add comments before functions \
* Get rid of functions that are now inlined into the header \
* Do not have Archive doing symbol table printing \
* Put assert comments into the assert so they print out \
* Make sure foreign symbol tables are written


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17884 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:47:30 +00:00
Reid Spencer
4a980d1813 Per code review:\
* Make sure we write out the foreign symbol table if we read one \
* Make the padding calculation more efficiently and avoid Solaris warnings


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17883 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:47:19 +00:00
Reid Spencer
1f465809cd Per code review:\
* Make sure all members are initialized upon construction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17882 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:47:07 +00:00
Reid Spencer
5a88578249 Per code review:\
* Get rid of memory leaks on exception \
* Provide better comments of how the memory handling works


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17876 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:41:05 +00:00
Chris Lattner
d6e431f45e Do not emit FunctionBlock blocks for external functions. This shrinks
bytecode files by about 8 bytes per external function


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17859 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 22:39:49 +00:00
Chris Lattner
97fbc500a7 Use a per-function flag bit to indicate whether or not there is a function
body for the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17858 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 22:38:52 +00:00
Chris Lattner
fd7f8fea65 Disable this change, it was premature
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17857 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 21:56:33 +00:00
Chris Lattner
3bdad6923e Make *SURE* to null out the pointer before throwing an exception, otherwise
the dtor for the BytecodeReader class will try to free it again!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17856 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 21:55:33 +00:00
Chris Lattner
1992522abd Cleanups. Null out pointer after freeing it for paranoia
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17855 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 21:55:06 +00:00
Chris Lattner
86c9365761 If a function is external, do not output a FunctionBlock for the function
AT ALL.  This saves 11 bytes per external function from the bytecode file,
and is also required to make GhostLinkage work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17854 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 21:46:40 +00:00
Chris Lattner
18549c25d6 Make functions default to having external linkage if they have no
FunctionBlock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17853 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 21:43:03 +00:00
Reid Spencer
b323113b93 * Make sure the string table gets read even if there isn't a foreign
symbol table.
* Make sure we update the file pointer for each member when rebuilding the
  symbol table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17812 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 01:40:20 +00:00
Reid Spencer
766b793143 Changes necessary to enable linking of archives without LLVM symbol tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17811 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 01:20:11 +00:00
Reid Spencer
ce2bc2b28f Moved to lib/Bytecode/Archive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17800 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:38:32 +00:00
Reid Spencer
a70d84d40a Simplify compression code by using the high level interface to the Compressor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17771 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:01:41 +00:00
Reid Spencer
565ff3d448 Add wrappers to get defined symbols from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17770 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:00:48 +00:00
Reid Spencer
d3539b8a5e Simplify handling of decompression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17769 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:00:09 +00:00
Reid Spencer
61aaf2e0af Simplify decompression code by using the high level interface to the Compressor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17768 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 21:59:21 +00:00
Reid Spencer
f9d7a51c44 Completely rewritten to allow reading of archives and symbol table lookup in a more efficient manner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17767 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 21:58:33 +00:00
Reid Spencer
bc9fc845a0 Implementation declarations for Archive
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17766 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 21:57:46 +00:00
Reid Spencer
cf6afc6239 First working version
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17765 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 21:56:59 +00:00
Reid Spencer
5544b5e50b Add the Archive library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17764 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 21:55:27 +00:00
Misha Brukman
a3e6ad62f3 Mark an unmaterialized function as having GhostLinkage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17748 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 21:02:55 +00:00
Reid Spencer
9577667822 Moved to lib/Bytecode/Archive in preparation for re-write.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17742 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 19:59:40 +00:00
John Criswell
b5810282ee Recognize compressed LLVM bytecode files.
This should fix the problem of not being able to link compressed LLVM
bytecode files from LLVM libraries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17648 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 19:37:07 +00:00
Reid Spencer
f0c977cbac * Comments & cleanup per CL code review.
* Accept 'llvc' as signature for compressed bytecode


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17579 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 18:20:55 +00:00
Reid Spencer
36eea80616 Add comments per CL code review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17578 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 18:19:00 +00:00
Reid Spencer
83296f5496 * Add comments and cleanup per CL code review
* Make signature for compressed bytecode llvc instead of unreadable
* Make the CompressionContext have a constructor and destructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17576 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 18:17:38 +00:00
Reid Spencer
17f52c5c46 Add support for compressed bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17535 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-06 23:17:23 +00:00
Reid Spencer
2bcfcbe795 Implement the GetBytecodeSymbols interface function to extract just the
externally visible defined symbols from a bytecode file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17503 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-06 08:56:40 +00:00
Reid Spencer
cdb21a9e49 Makefile for the LLVMArchive library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17500 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-06 08:52:36 +00:00
Reid Spencer
362cbf0d74 First kinda/sorta working version of the Archive library. Reading is not
yet supported but writing works. Way too early to review this. More to come


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17499 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-06 08:51:45 +00:00
Reid Spencer
06aada9ebd Fix library name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17305 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-28 05:32:01 +00:00
Reid Spencer
e55bd78e80 Fix name of library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17304 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-28 05:30:54 +00:00
Chris Lattner
236ca4467f Fix the previous bug the correct way. This fixes ptrdist/bc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-24 04:27:59 +00:00
Chris Lattner
5fd2ab3518 Fix a bug that Brian brought to my attention. This corrects:
Assembler/2004-10-22-BCWriterUndefBug.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17177 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-23 03:10:23 +00:00
Reid Spencer
cac731ecbe We won't use automake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17155 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-22 03:35:04 +00:00
Reid Spencer
86d341b204 Initial automake generated Makefile template
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17136 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 23:55:41 +00:00
Chris Lattner
2e7ec128f9 Do not erroneously accept revision 6 bytecode files when the format hasn't
been defined yet!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17063 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:56:02 +00:00
Chris Lattner
a79e7cca0d Add support for undef, unreachable, and function flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17054 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:18:16 +00:00
Chris Lattner
f91d68be8d There is no reason not to build these in parallel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17023 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 23:22:15 +00:00
Chris Lattner
4a8167fe5c Don't print a bunch of metrics that are meaningless for external functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17017 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 19:40:31 +00:00
Chris Lattner
f74acc7669 Today is not my day. Fix broken #
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16967 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 02:31:35 +00:00
Chris Lattner
823cacc276 unbreak previous checkin :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16966 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 02:06:48 +00:00
Chris Lattner
84d1ced4a9 Add back a missing paren
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16965 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:57:28 +00:00
Chris Lattner
1c765b0037 Fit to 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16964 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:49:34 +00:00
Chris Lattner
f9d7178ba8 Wrap to 80 cols, delete some seriously old debugging printouts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16963 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:46:07 +00:00
Chris Lattner
4a242b32f6 Fit in 80 columns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16962 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:39:18 +00:00
Chris Lattner
b0bf6643b0 Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16961 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 01:35:17 +00:00
Reid Spencer
d96cb6eaa0 Update to reflect changes in Makefile rules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16950 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-13 11:46:52 +00:00
Reid Spencer
9f41a5fe85 Initial version of automake Makefile.am file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16885 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 20:43:57 +00:00
Misha Brukman
44666b15b1 Fix doxygen comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16542 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 16:57:46 +00:00
Chris Lattner
56bc894d06 The system ranlib on darwin occasionally adds two extra newlines to the
end of files, breaking the CFE build.  As a gross hack around this,
ignore any trailing garbage on bytecode files.  Thanks to Brian for digging
in and identifying the problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16525 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-27 16:59:06 +00:00
Reid Spencer
2da5c3dda6 Convert code to compile with vc7.1.
Patch contributed by Paolo Invernizzi. Thanks Paolo!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16368 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-15 17:06:42 +00:00
Misha Brukman
5adf0ca0b2 Unbreak doxygen, according to Reid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16298 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-12 20:56:38 +00:00
Misha Brukman
7df0074db5 Fix code spacing/alignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16297 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-12 20:47:33 +00:00
Reid Spencer
46a981c3e2 Change interface to use correct typedef so it will always compile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16281 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-11 04:22:58 +00:00
Reid Spencer
3ee8eed034 Print the dependent libraries when dumping bytecode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16275 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-11 04:14:07 +00:00
Alkis Evlogimenos
20aa474f8f Fixes to make LLVM compile with vc7.1.
Patch contributed by Paolo Invernizzi!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16152 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-03 18:19:51 +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
Reid Spencer
488d73a8b7 Correctly compute the number of compaction tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-27 00:43:51 +00:00
Reid Spencer
0033c18c47 Prevent an empty compaction table from being written to the bytecode file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16063 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-27 00:38:44 +00:00
Reid Spencer
07ea1917d0 Add the CompactionTableIsEmpty function so that we can determine if a
CompactionTable really needs to be emitted. This is not a straight forward
computation, hence the need for a member function here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16062 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-26 22:32:00 +00:00
Reid Spencer
e0cf59e52f Add a wrapper for extraction of the dependent libraries from a bytecode
file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16037 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-24 22:46:20 +00:00
Reid Spencer
3120e714e6 Rearrange output a little to make it nicer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16036 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-24 22:45:32 +00:00
Reid Spencer
911ec6d1c0 Bytecode Analyzer Cleanup:
- Rearrange output order to make more sense
- Make only the function level output count as "detailed"
- Output dump output directly to stream, don't buffer it.
- Fix counting of block sizes
- Implement new handlers for number of types, dependent libs, target triple
- Compute the size of block headers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15985 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-21 20:58:19 +00:00
Reid Spencer
af073bdee6 Get rid of an extraneous local variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15984 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-21 20:53:56 +00:00
Reid Spencer
4542c43761 Two Changes:
- Pass the output stream to the analyzer so it can write its output there
  directly instead of buffering it.
- Don't pass a boolean to ParseBytecode because its not needed any more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15983 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-21 20:52:03 +00:00
Reid Spencer
572c256519 Add boolean file format flags in preparation for version 5 bytecode.
Remove the "processFunctions" boolean from ParseBytecode as it is no
longer needed. This is part of avoiding double reading of functions
when analyzing bytecode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15982 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-21 20:50:49 +00:00
Reid Spencer
5b472d9879 Bytecode Reader Cleanup:
- provide the correct conversion for ModuleBlockID in read_block (a potential
  bug but not actually exploited because reading module block ids doesn't
  use read_block).
- install support for handleTypeList handler
- install support for handleDependentLibrary handler
- install support for handleTargetTriple handler
- clean up comments, output strings,
- ensure that processing function arguments doesn't SIGSEGV if one of the
  arguments is a null pointer (yeah, it happened .. weird)
- prepare for version 5 bytecode by documenting what will change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15981 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-21 20:49:23 +00:00
Brian Gaeke
715c90ba52 Packed types, brought to you by Brad Jones
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15938 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-20 06:00:58 +00:00
Reid Spencer
38d54be85b Bytecode File Format Changes:
- File format version number bumped to 4
- Writer will now align nothing
- Reader now only expects alignment for version 3 or earlier


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15875 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-17 07:45:14 +00:00
Reid Spencer
250c4184c7 Correct the comments in the symbol table writer to reflect reality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15848 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-17 02:59:02 +00:00
Reid Spencer
9a7e0c5366 Turn a use of intptr_t into a reinterpret_cast<uint64_t> instead to get
rid of compilation warnings on some platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15512 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 22:56:46 +00:00
Alkis Evlogimenos
15876bb28c Stop using getValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15487 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 08:44:43 +00:00
Chris Lattner
2c6c14d1a5 Make getGlobalTableValue not use getTypeSlot, this speeds up the bc reader
by 5% on eon


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15452 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 00:19:23 +00:00
Chris Lattner
45b5dd2918 Do not do a linear std::find to reconstruct information we had, but later threw
away.  This speeds up by .bc reader by 30% in a profile build on 252.eon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15450 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-03 23:41:28 +00:00
Alkis Evlogimenos
eb62bc77b6 Merge i*.h headers into Instructions.h as part of bug403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15325 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 12:17:34 +00:00
Chris Lattner
bcb11cf132 Simplify code and silence warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15255 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 02:34:49 +00:00
Chris Lattner
1d78516c65 Fix a serious bug in the double constant reader. In particular, because
(At[3] << 24) is an int type and it is being coerced to uint64_t, it was
getting sign extended, causing us to get FFFFFFFFxxxxxxxx constants all of
the time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15224 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 23:15:44 +00:00
Reid Spencer
ada1618afa Always write FP values correctly.
Adjust for new Module.h interface for dependent libraries.
Excise unused backwards compatibility flag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15220 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 21:36:26 +00:00
Reid Spencer
7d146e1107 Don't create a backwards compatibility flag for something that was a
regression bug introduced in release 1.2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15219 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 21:32:51 +00:00
Reid Spencer
5ac8812c54 Adjust to new Module.h interface for dependent libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15218 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 21:32:02 +00:00
Reid Spencer
ad89bd6a1a bug 263:
- encode/decode target triple and dependent libraries
bug 401:
- fix encoding/decoding of FP values to be little-endian only
bug 402:
- initial (compatible) cut at 24-bit types instead of 32-bit
- reduce size of block headers by 50%
Other:
- cleanup Writer by consolidating to one compilation unit, rem. other files
- use a std::vector instead of std::deque so the buffer can be allocated
  in multiples of 64KByte chunks rather than in multiples of some smaller
  (default) number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15210 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 18:07:36 +00:00
Reid Spencer
e840434755 bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14942 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:18:30 +00:00
Reid Spencer
e0125b6785 bug 122:
- Correct ordering of tests because for GlobalValue isa Constant


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14941 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:16:21 +00:00
Reid Spencer
89fc0e3ce0 User ValueListTy as the type of the ValueList. This avoides the ValueList
from being treated like a Function which can cause the contents of the list
to be come invalidated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14940 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:13:12 +00:00
Reid Spencer
a86037e4d9 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@14939 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:12:03 +00:00
Reid Spencer
3c90f9fd12 bug 122:
- Update for BytecodeHandler interface change resuing from CPRs going away


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14938 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:10:36 +00:00
Chris Lattner
f51c7f56ca Fix for PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14845 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 02:40:04 +00:00
Brian Gaeke
fe2102b61d Actually set the endian/pointersize flags on the module being read in!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14826 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 20:33:13 +00:00
Brian Gaeke
0859e52582 Fix warning on SparcV9, where sizeof (int) != sizeof (void *).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14786 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 07:37:43 +00:00
Chris Lattner
aec6dd5bbc Fix unused var warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14775 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:29:52 +00:00
Reid Spencer
46b002cd9b Various cleanups:
- Remove tabs
- Standardize use of space around ( and ).
- Consolidate the ConstantPlaceHolder class
- Rename two methods to be more meaningful (ParseType, ParseTypes)
- Correct indentation of blocks
- Add documentation
- Convert input dependent asserts to error(...) so it throws instead.
Provide placeholder implementations of read_float and read_double that
still read in platform-specific endianess. When I figure out how to do
this without knowing the endianess of the platform, it will get implemented
correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14765 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:28:43 +00:00
Reid Spencer
66906518ed - Rename two methods to give them more meaning
- Add read_float and read_double in preparation for a correct
  implementation of bytecode floating point support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14764 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:24:05 +00:00
Reid Spencer
1d9349a783 Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14763 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:22:51 +00:00
Reid Spencer
87bc418334 Prepare the writer for a non-broken implementation of writing floating
point values. This will be fixed when I figure out how to do it correctly
without depending on knowing the endianess of a platform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14762 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:22:07 +00:00
Reid Spencer
9cb5242574 Make the VBRSavings percentage make sense (as a fraction of the total
expanded size instead of the file size). Thanks Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14731 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-10 08:04:13 +00:00
Reid Spencer
2439972a61 Error Handling Cleanup:
- get rid of PARSE_ERROR macro
- add error(std::string) function
- use error(std::string) for all errors
- make input dependent asserts call error(std::string) instead
- ensure asserts are only for logic bugs, not input discrepancies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14729 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-09 22:21:33 +00:00
Reid Spencer
011bed5ef8 Fix a backwards compatibility bug found by Tanya. In version 1.2, the
global type plane starts with a length and the TypeTyID value to identify
the type plane has having type definitions. This doesn't happen in 1.3
because the types are read from a known position in the file. However, the
TypeTyID must be read in (and ignored) if its a 1.2 bytecode file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14728 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-09 21:13:53 +00:00
Reid Spencer
ba466362c4 Remove definition and use of OtherVal enumerator. This just fixes a thinko.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14634 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-06 01:30:36 +00:00
Reid Spencer
5c15fe5cf8 Finalize bytecode dumping. The "handleFinish" method was getting called
too soon so the function data was not getting dumped (it was generated
after the call handleFinish). Also cleaned up the output format for
proper indentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14627 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-05 00:57:50 +00:00
Reid Spencer
d57da4b27d Implementation of SlotTable went into header file. Note that this header
is currently not being used but is retained because it will be the basis
for a clean up of the SlotCalculator class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14612 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 11:47:22 +00:00
Reid Spencer
0852c80e38 Remove Tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14611 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 11:46:15 +00:00
Reid Spencer
cb3595c3d1 Implement new output functions for types and compacted type planes. Also
remove use of Type::TypeTyID and Type::TypeTy since Type no longer inherits
Value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14610 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 11:45:47 +00:00