Commit Graph

303 Commits

Author SHA1 Message Date
Chris Lattner
33522d4f25 Remove -debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10917 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-18 22:26:53 +00:00
Chris Lattner
cf3e67f70a Add support for writing bytecode files with compactiontables for bytecode files.
This shrinks the bytecode file for 176.gcc by about 200K (10%), and 254.gap by
about 167K, a 25% reduction.  There is still a lot of room for improvement in
the encoding of the compaction table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10915 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-18 21:08:52 +00:00
Chris Lattner
89e025387e Add support for reading bytecode files with compactiontables for bytecode files.
This shrinks the bytecode file for 176.gcc by about 200K (10%), and 254.gap by
about 167K, a 25% reduction.  There is still a lot of room for improvement in
the encoding of the compaction table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10914 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-18 21:08:15 +00:00
Chris Lattner
614cdcd002 Add support for building the compactiontable for bytecode files. This shrinks
the bytecode file for 176.gcc by about 200K (10%), and 254.gap by about 167K,
a 25% reduction.  There is still a lot of room for improvement in the encoding
of the compaction table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10913 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-18 21:07:07 +00:00
Chris Lattner
af894e963b Add support for representing the "compaction table"
Change protected members to private.  Nothing should subclass SlotCalculator


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10912 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-18 21:03:49 +00:00
Chris Lattner
80b97343ec Bytecode format for LLVM 1.2 no longer explicitly encodes zeros in primitive
type planes.  This saves about 5k on 176.gcc, and is needed for a subsequent
patch of mine I'm working on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10908 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-17 23:25:43 +00:00
Chris Lattner
0baa0af861 If these blocks are empty, there is no reason to even emit the bytecode blocks.
This saves about 15K in 176.gcc, coupled with another patch that I'm working on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10889 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 21:06:57 +00:00
Chris Lattner
d5c59d5c84 Cleanups & efficiency improvements
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10888 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 20:24:09 +00:00
Chris Lattner
8c202cdbda The bcwriter does not want ConstantPointerRef's to be indexed, and the asmwriter never did!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10885 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 18:47:15 +00:00
Chris Lattner
7be08bfae1 ConstantPointerRef's are no longer emitted. This saves 20028 bytes in the
bytecode files when compiling 176.gcc, but more importantly will make it
easier to eliminate CPR's in the future (no new .bc revision will be
required to support them)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10884 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 18:46:56 +00:00
Chris Lattner
933619912b Allow bytecode files to refer directly to global values as constants, instead
of forcing them to go through ConstantPointerRef's.  This allows bytecode
files to mirror .ll files, allows more efficient encoding, and makes it easier
to eventually eliminate CPR's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10883 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 18:45:25 +00:00
Chris Lattner
ff47e7d02e Fix more breakage with string change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10882 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 18:39:06 +00:00
Chris Lattner
f4c0e7f587 Fix PR73: bytecode format inconsistent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10876 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 17:55:09 +00:00
Chris Lattner
44d0eebc13 Fix PR73
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10875 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 17:55:01 +00:00
Chris Lattner
570fb1cbd8 Fix brokenness in my last checking
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10874 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 16:56:15 +00:00
Chris Lattner
7969dc2bec Change all of the bytecode reader primitives to throw exceptions instead of
returning error codes.  Because they don't return an error code, they can
return the value read, which simplifies the code and makes the reader more
efficient (yaay!).

Also eliminate the special case code for little endian machines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10871 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 06:13:09 +00:00
Chris Lattner
c8434e3d71 Remove the optimization that depends on ENDIAN_LITTLE: it's not worth it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10870 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-15 06:11:30 +00:00
Chris Lattner
7851e1b328 Improve comments, add support for remembering the constants strings that
are to be emitted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10866 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 23:37:43 +00:00
Chris Lattner
83bb3d2f4e The new bytecode format supports emitting strings a special case. This is
intended to save size (and does on small programs), but on big programs it
actually increases the size of the program slightly.  The deal is that many
functions end up using the characters that the string contained, and the
characters are no longer in the global constant table, so they have to be
emitted in function specific constant pools.

This pessimization will be fixed in subsequent patches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10864 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 23:36:54 +00:00
Chris Lattner
9e893e8a3d Version 1.2 now supports encoding strings as a special case, to avoid having
to emit all of those sbyte constants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10863 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 23:35:21 +00:00
Chris Lattner
dcea63026f When emitting bytecode, handle strings specially. Do not add the characters
that make up the strings to the slotcalculator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10862 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 23:34:39 +00:00
Chris Lattner
4e8683664d Like output_data, it's obvious that input_data was only used with 1 character
data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10861 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 23:03:22 +00:00
Chris Lattner
0a3a27b0ae It is obvious that this has never been used for outputing more than a single
byte, it's totally endian incorrect!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10857 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 18:50:28 +00:00
Chris Lattner
44e38034d5 Be const correct
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10856 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 18:41:38 +00:00
Chris Lattner
d6942d7633 Ok, I can't handle it. This is a temporary checkin of a ton of statistics that
i'm using in my work to reduce the bytecode file sizes.  These will eventually
be removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10849 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 16:54:21 +00:00
Chris Lattner
c08912f917 Remove support for the pre-1.0 bytecode version #1. This will become
the bytecode revision generated by LLVM 1.2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10848 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 16:44:44 +00:00
Chris Lattner
277bafbff7 Toggle sense of flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10838 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 02:50:16 +00:00
Chris Lattner
8ce750145d The only clients of the slot calculator are now the asmwriter and bcwriter.
Since this really only makes sense for these two, change hte instance variable
to reflect whether we are writing a bytecode file or not.  This makes it
reasonable to add bcwriter specific stuff to it as necessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10837 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 02:49:34 +00:00
Chris Lattner
b16689b647 Don't use ConstantExpr::getShift anymore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10791 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 19:08:43 +00:00
Chris Lattner
92fa44c1cf Urg, remove testing code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10757 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-11 23:30:03 +00:00
Chris Lattner
9380297bc0 Fix a regression that I introduced yesterday. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-11 23:29:26 +00:00
Chris Lattner
a14b0d441d Check in two changes:
The first change (which is disabled) compactifies all of the function constant
pools into the global constant pool, in an attempt to reduce the amount of
duplication and overhead.  Unfortunately, as the comment indicates, this is
not yet a win, so it is disabled.

The second change sorts the typeid's so that those types that can be used
by instructions in the program appear earlier in the table than those that
cannot (such as structures and arrays).  This causes the instructions to
be able to use the dense encoding more often, saving about 5K on 254.gap.
This is only a .65% savings though, unfortunately. :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10754 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-10 23:46:13 +00:00
Chris Lattner
737d3cd719 Do not bother to emit a BytecodeBlock for an empty symbol table. This commonly
occurs when the symbol table for a module has been stripped, making all of the
function local symbols go away.

This saves 6728 bytes in the stripped bytecode file of 254.gap (which obviously
has 841 functions), which isn't a ton, but helps and was easy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10750 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-10 19:56:59 +00:00
Chris Lattner
32abce6e3a Err, we don't need Config/*.h files for things that are standard C++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10742 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-10 19:10:01 +00:00
Chris Lattner
1499934c64 minor comment tweaks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10741 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-10 19:07:06 +00:00
Chris Lattner
3446ae8337 * finegrainify namespacification of ArchiveReader.cpp
* Refactor reader stuff out of include/llvm/Bytecode/Primitives.h.  This is
  internal implementation details for the reader, not public interfaces!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10739 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-10 19:00:15 +00:00
Chris Lattner
4443019b7d Refactor writer stuff out of include/llvm/Bytecode/Primitives.h. This is
internal implementation details for the writer, not public interfaces!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10738 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-10 18:56:59 +00:00
Chris Lattner
44f549b4eb Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10737 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-10 18:49:43 +00:00
Chris Lattner
258b5375b4 Inching our way towards fixing PR82
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10721 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-09 05:42:34 +00:00
Chris Lattner
f63aeece6f remove some useless #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10654 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-30 07:55:21 +00:00
Chris Lattner
b70abe1c5a Use new getFileSize function instead of sys/stat.h directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10650 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-30 07:40:35 +00:00
Chris Lattner
2d6481cc2a Factor FDHandle out of the bytecode reader into the FileUtilities.h support
routines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10642 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-29 21:35:05 +00:00
Chris Lattner
ddceeb720d minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10612 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 06:16:00 +00:00
John Criswell
9059158b56 Reverted back to revision 1.11. The previous fix doesn't really fix
anything; it just causes the bug to go dormant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10585 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-22 16:22:49 +00:00
John Criswell
1118d0fd94 Fix PR#193.
Modified ReadArchiveBuffer() so that it dynamically allocates the
std::string object used to hold the bytecode object file's name.  This is
necessary because it is passed by reference to the new Module that is
allocated to represent the bytecode object, and previously we were
using a std::string that disappeared on function exit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10565 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 22:37:29 +00:00
Brian Gaeke
6ca5b8f5f4 Make getObjectType() smarter about ranlibbed Mac OS X archives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10493 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-17 00:18:18 +00:00
Brian Gaeke
27b40bcc9c Throw better error messages, by calling strerror(errno) when we
get an error inside the bytecode reader.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10415 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-12 00:47:44 +00:00
Brian Gaeke
3c09636588 In getObjectType(), doxygenify comment, and take a pointer to the
beginning of the archive member data as an argument.

Get rid of ParseLongFilenameSection(), which is dead.

In ReadArchiveBuffer(), implement support for 4.4BSD/MacOSX long filenames.
This is kind of invasive, because they prepend the long filename to the archive
member data, and then lie about the size. So we have to keep track of the real
size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10392 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-11 00:38:04 +00:00
Chris Lattner
8d1dbd2134 Emit & read more compressed bytecode by not emitting a bytecodeblock for
each basic block in function.  Instead, just emit a stream of instructions,
chopping up basic blocks based on when we find terminator instructions.  This
saves a fairly substantial chunk of bytecode space.  In stripped, sample
cases, for example, we get this reduction in size:

197.parser: 163036 -> 137180:  18.8% reduction
254.gap   : 844936 -> 689392:  22.6%
255.vortex: 621724 -> 528444:  17.7%

...

Not bad for something this simple.  :)  Note that this doesn't require a new
bytecode version number at all, though version 1.1 should not need to support
the old format.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10280 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-01 07:05:31 +00:00
Chris Lattner
31f8499e83 Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10131 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 20:23:48 +00:00