Commit Graph

392 Commits

Author SHA1 Message Date
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
Chris Lattner
29b789befa * Finegrainify namespacification
* Strength reduce several data structures which were left over from the
  "bad old days"
* Minor efficiency improvements
* Major efficiency improvement: In BytecodeParser::insertValue, do not allocate
  a new ValueTab entry just because some value exists with a large type.  This
  dramatically reduces the number of allocations/deallocations performed by the
  bytecode reader, and speeds up parsing of Kimwitu++ from 34s to 17s.  This is
  to help address PR127


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10085 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-19 17:27:18 +00:00
Chris Lattner
8eb49936ae Minor efficiency improvements, finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10084 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-19 17:21:11 +00:00
Chris Lattner
c2f4b11552 In the future, these slabs can be null...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10083 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-19 17:20:42 +00:00
Chris Lattner
ebfb9f487d Minor efficiency improvements all over. Finegrainify Namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10082 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-19 17:17:36 +00:00
Chris Lattner
deab9a7ae5 Fine grainify namespacification, #include file that defines the interface!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10081 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-19 16:06:55 +00:00
Chris Lattner
1c3673b238 Minor speedup to do less linear time searches of information we already have.
speeds up disassembly of kc++ by .6s


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10079 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-19 06:01:12 +00:00
Chris Lattner
02071d08c1 Remove usage of ConstantPointer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10051 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-17 17:28:29 +00:00
Brian Gaeke
2c61d7b240 Implement skeletal support for __.SYMDEF (ranlib) sections in archives.
Correctly parse the Long Filename section of the archive.
When reading in archive members, set their ModuleIDs to
 "ARCHIVENAME(MEMBERNAME)", as is traditional.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10043 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-16 23:08:48 +00:00
Chris Lattner
db9546e324 I can't believe the incompetence of the people I have to deal with around here.
These fools don't even wrap code at 80 columns.

Oh wait, _I_ wrote that.  That explains a lot!!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9999 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-14 16:34:25 +00:00
Chris Lattner
8dc6ba9a12 Fix PR 110: the constant folding code assumes that if something is not a
constant expression, but is of (for example) ubyte type, then it is a
ConstantUInt.  This was not true for placeholders.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9994 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-14 06:38:46 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00
Chris Lattner
095be96096 no need for endl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9736 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 19:53:32 +00:00
Chris Lattner
29e3b2ba77 Add support for constant expr shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9735 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 19:53:03 +00:00
Alkis Evlogimenos
088eb45cf4 Use already existing classes for post order iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9629 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-31 03:02:34 +00:00
Alkis Evlogimenos
74fa84fcef Output types in reverse postorder. This will allow the ByteCode/Reader
to create the minimum number of opaque types for each type with a
cycle in its type graph.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9615 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-30 21:04:44 +00:00
Alkis Evlogimenos
60048b8a66 Put DEBUG_OUTPUT at the top along with TRACE_LEVEL. Also fix the code
inside DEBUG_OUTPUT so that it compiles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9614 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-30 18:33:58 +00:00
Brian Gaeke
bc839b5827 Explicitly cast type, so we aren't passing output_vbr a size_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9590 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-29 20:09:01 +00:00
Alkis Evlogimenos
5d1bdcd6f6 Add more debugging info to help tracing the SlotCalculator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9575 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-29 03:12:12 +00:00
Chris Lattner
2765c41c98 Make sure to add a type for va_next operands, which may not other wise
occur in the module


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9336 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-21 17:40:54 +00:00
Chris Lattner
389dbfbd8b Fix problem which effected linking apache
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9335 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-21 17:39:59 +00:00
John Criswell
856ba76200 Added LLVM copyright header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9321 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-21 15:17:13 +00:00
John Criswell
e488e9360b Added LLVM copyright notice to Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9312 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 22:26:57 +00:00
John Criswell
6fbcc26f14 Added LLVM copyright header (for lack of a better term).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9304 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 20:19:47 +00:00
John Criswell
b576c94c15 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9298 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 19:43:21 +00:00
Chris Lattner
ce439b539f "Function"[0] == 'F', not 'M'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9297 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 19:10:06 +00:00
Chris Lattner
3b237fcd38 Change the Opcode enum for PHI nodes from "Instruction::PHINode" to "Instruction::PHI" to be more consistent with the other instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9269 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-19 21:34:28 +00:00
Chris Lattner
b91d9712e1 Fix warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9236 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-18 19:48:10 +00:00
Chris Lattner
22482a14be add support for new linkage types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9228 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-18 06:30:21 +00:00
Chris Lattner
eff112c6c3 Updated to emit the final 1.0 bytecode format. This supports weak linkage,
more efficient encoding of varargs calls, and the new varargs intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9221 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-18 05:54:48 +00:00
Chris Lattner
cb7e2e2e0f * New revised variable argument handling support
* More dense bytecode encoding for varargs calls (like printf)
* Eliminated the extremely old bytecode format.  rev #0 is now 1.0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9220 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-18 05:54:18 +00:00
Alkis Evlogimenos
60596382aa Eliminate some extraneous code in SlotCalculator::insertVal().
Rename SlotCalculator::getValSlot() to SlotCalculator::getSlot(),
       SlotCalculator::insertValue() to SlotCalculator::getOrCreateSlot(),
       SlotCalculator::insertVal() to SlotCalculator::insertValue(), and
       SlotCalculator::doInsertVal() to SlotCalculator::doInsertValue().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9190 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-17 02:02:40 +00:00
Misha Brukman
9fcdadb08c Add separator between different types of readers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9183 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-16 21:19:54 +00:00
Chris Lattner
6b25242a4b Add support for 'weak' linkage.
For now, we translate linkonce into weak linkage in the bytecode format because
we don't have enough bits to represent it.  We will rev the bytecode version
soon anyways, so this will be fixed in the near future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9170 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-16 18:28:50 +00:00
Chris Lattner
cb18d181d1 Stop using "reverse depth first" order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9081 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 15:21:58 +00:00
Chris Lattner
7dc3a2e631 Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9079 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 14:57:53 +00:00
Chris Lattner
f0d9273af7 Avoid calling getTypeSlot more
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9077 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 14:34:59 +00:00
Chris Lattner
d9113c7db6 This is a header file, thus it needs a -*-C++-*-
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9072 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 04:22:07 +00:00
Chris Lattner
cf3056db0f Regularize header file comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9071 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 03:32:08 +00:00
Chris Lattner
39cacceb55 Ok, the "fix" for this is to do a real associative container. Symbol tables
are ordered by name, not by slot, so the previous solution wasn't any good.
On a large testcase, this reduces time to parse from 2.17s to 1.58s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9002 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-10 05:43:47 +00:00
Chris Lattner
97330cf287 Another 10% performance improvement by not using replaceAllUsesWith
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8994 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 23:10:14 +00:00
Chris Lattner
4c52392ba3 Reserve space for PHI nodes when we read them in. This provides a VERY
tasty 15% speedup on the testcase from Bill.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8993 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 22:46:58 +00:00
Chris Lattner
35d2ca672b Use the version of getValue that takes the type plane instead of the type
if possible.  This provides a consistent 8.5% speedup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8991 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 22:39:30 +00:00
Chris Lattner
6fcf50338e Pass a vector around to reduce dynamic allocation
Throw the RawInst class in an anon namespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8990 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:45:42 +00:00
Chris Lattner
c9456ca64c Change getConstantValue to throw an exception on error, not return null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8988 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:41:16 +00:00
Chris Lattner
9073613d0c Remove potentially N^2 algorithm from symbol table reader. No speedup
in practice though


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8985 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:30:04 +00:00
Chris Lattner
927b185c17 Major refactoring of the bytecode reader. This includes the following
changes:
  * BytecodeReader::getType(...) used to return a null pointer
    on error.  This was only checked about half the time.  Now we convert
    it to throw an exception, and delete the half that checked for error.
    This was checked in before, but psmith crashed and lost the change :(
  * insertValue no longer returns -1 on error, so callers don't need to
    check for it.
  * Substantial rewrite of InstructionReader.cpp, to use more efficient,
    simpler, data structures.  This provides another 5% speedup.  This also
    makes the code much easier to read and understand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8984 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 20:22:47 +00:00
Chris Lattner
3483f54367 Significantly clean up parsing of instructions. This exceptionizes and
simplifies the control flow a bit.  This provides a small (~3%) speedup,
but it's primarily a cleanup exercise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8983 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 18:25:19 +00:00
Chris Lattner
bf43ac6abf Eliminate the instruction placeholder. Simplify a bunch of code.
This results in no significant speedup, but does provide simpler code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8980 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 06:14:26 +00:00
Chris Lattner
8eb10cef39 Eliminate the old LateResolveValues data structure, replacing it with a
new, simpler, ForwardReferences data structure.  This is just the first
simple replacement, subsequent changes will improve the code more.

This simple change improves the performance of loading a file from HDF5
(contributed by Bill) from 2.36s to 1.93s, a 22% improvement.  This
presumably has to do with the fact that we only create ONE placeholder for
a particular forward referenced values, and also may be because the data
structure is much simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8979 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 06:05:40 +00:00
Chris Lattner
13eb87162a Remove a dead method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8978 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-09 05:25:34 +00:00
Chris Lattner
4ee8ef2a5d This patch substantially simplifies and cleans up handling of basic blocks
in the bytecode parser.  Before we tried to shoehorn basic blocks into the
"getValue" code path with other types of values.  For a variety of reasons
this was a bad idea, so this patch separates it out into its own data structure.

This simplifies the code, makes it fit in 80 columns, and is also much faster.
In a testcase provided by Bill, which has lots of PHI nodes, this patch speeds
up bytecode parsing from taking 6.9s to taking 2.32s.  More speedups to
follow later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8977 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 22:52:54 +00:00
Chris Lattner
6e44802ec0 Inline the postResolveValues method. It was poorly named anyway
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8976 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 21:51:46 +00:00
Chris Lattner
36392bc524 Various cleanups and simplifications. This speeds up reading a bytecode file
Bill gave me from 8.69s to 6.90s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8971 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 21:18:57 +00:00
Misha Brukman
7f58de2b99 Destroy allocated resources on exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8969 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 19:55:47 +00:00
Brian Gaeke
378b524ba0 All of our supported operating systems (so far) and FreeBSD technically
want you to include <sys/stat.h> for fstat(), struct stat, and friends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8887 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 03:30:28 +00:00
Chris Lattner
00413e3d63 Rename AbstractModuleProvider -> ModuleProvider, to match the header file name,
and because, while the class used by the interface is abstract, the actual
concept is not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8850 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 20:14:59 +00:00
Chris Lattner
9e460f23bb Transform two methods to return pointers directly instead of returning them
as 'by reference' arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8849 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 20:00:03 +00:00
Chris Lattner
51ca860bda Use V for values, not D.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8848 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 19:29:21 +00:00
Chris Lattner
a983359f59 Do not leak the ModuleProvider if releaseModule() throws.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8847 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 19:19:37 +00:00
Chris Lattner
c7b6f03501 There is no need for BytecodeParser to be an AbstractTypeUser. Instead, it
can just use PATypeHolders


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8832 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 20:26:18 +00:00
Chris Lattner
48486893f4 Standardize header file comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8782 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-30 18:37:50 +00:00
Chris Lattner
b0b7c0d28c Just rethrow previous exception instead of making a new one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8718 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-26 14:44:52 +00:00
Chris Lattner
735289ccf0 Define the instance variable Buffer, not the automatic variable Buffer.
This was causing us to munmap random stuff, which is obviously bad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8709 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-25 04:13:53 +00:00
Chris Lattner
4eed793d5a Fix alignment problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8707 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:34:17 +00:00
Misha Brukman
134aba6a75 Actually assign the string correctly through the std::string pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8704 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:10:47 +00:00
Misha Brukman
34ce14b019 * Eliminate BytecodeBufferReader::Length member variable
* Kill unused ALIN_PTRS #define
* Set the error string if user passed it in to be compatible with former API


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8701 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:04:02 +00:00
John Criswell
4dcbd5e9a2 Added code that ensures that we pass the beginning of the data buffer to
the parsing routines regardless of whether the buffer is re-aligned or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8693 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 21:19:11 +00:00
Misha Brukman
d554ebfcf7 Stop returning bool and pass Instruction by reference;
return std::auto_ptr and use exceptions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8684 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 16:17:50 +00:00
Misha Brukman
e0dd0d47cb Suggestions made by Chris:
* Instead of a #define, use inline function
* Fix the name on the #define, errr... now inline function to be more logical:
  it doesn't CHECK the alignment, it PERFORMS the alignment
* To get string name of a Type*, use getDescription(), not getName()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8683 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 16:15:29 +00:00
Misha Brukman
d57308a33c * Group class definitions & implementations together
* Make sure we align the buffer we're given
* Do not let exceptions propagate when the caller asks for a Module*
* Add doxygenified comments to wrapper functions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8682 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 16:13:28 +00:00
Misha Brukman
5c344415fa * Constantify arguments to copy function
* Stop using a #define, make it an inline if statement


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8678 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 15:09:26 +00:00
Misha Brukman
96f7877d19 Removed no longer used member variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8677 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:58:08 +00:00
Misha Brukman
464537936d Added file header comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8675 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:44:46 +00:00
Chris Lattner
23219d1dcb Update file header for renamed file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8673 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:42:00 +00:00
Misha Brukman
12c29d10bb * Cleaned up code:
- no more passing around a string pointer to set errors
  - no more returning booleans and checking for errors, we use C++ exceptions
* Broke functionality into 2 new classes, one reads from file, one from a stream
* Implemented lazy function streaming - the parser can read in a function at-a-time


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8671 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:38:23 +00:00
Chris Lattner
abe83ae992 Fix a spello Misha made while fixing one of my appostrifications
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8510 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 00:33:20 +00:00
Misha Brukman
37f92e2568 Fixed spelling and grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8489 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 22:34:13 +00:00
Chris Lattner
da73beac20 Fix bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8410 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 19:43:46 +00:00
Chris Lattner
36143fc444 Add support for the unwind instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8408 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:54:55 +00:00
Chris Lattner
dba2b225c8 Read volatile loads/stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8401 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:20:14 +00:00
Chris Lattner
09bd025762 Remove a gross hack that was there to support bytecode files that are over a year old.
If you still have these suckers laying around, you have GOT to rebuild them.  geeze.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8395 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:04:16 +00:00
Chris Lattner
0fe56f42ab Add support for writing volatile load/stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8394 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 17:58:37 +00:00
Chris Lattner
5bea411ad2 Fix reading of invoke instrs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8365 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 18:25:29 +00:00
Chris Lattner
8e2185ea07 Whoa, we were misreading invoke instructions "normal" destinations quite badly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8363 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 05:27:58 +00:00
Chris Lattner
d256ed8954 Non-functional change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8352 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-04 23:47:07 +00:00
Chris Lattner
6c51a36371 Avoid printing meaningless numbers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8342 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-03 20:25:27 +00:00
Chris Lattner
3e80abee49 Follow the pattern of all other atu's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8340 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-03 16:01:54 +00:00
Chris Lattner
d445c6b64a Allow modules to have 'any' pointer size and endianness. Luckily, we had
some space for extra flags, so we don't need to bump the revision number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8118 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 13:47:36 +00:00
Chris Lattner
4354f564c2 Rename SwitchInst::dest_push_back -> addCase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8089 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 23:14:52 +00:00
Misha Brukman
5560c9d49c Spell `necessary' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7944 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-18 14:43:39 +00:00
Chris Lattner
949a362802 Remove redundant const qualifiers from cast<> expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7253 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:30:06 +00:00
Chris Lattner
987cb2c3da Remove explicit const qualifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7245 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 14:54:33 +00:00
Misha Brukman
bc0e998c49 The word separate' only has one e'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7173 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-14 17:20:40 +00:00
John Criswell
7a73b80b90 Merged in autoconf branch. This provides configuration via the autoconf
system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 21:59:07 +00:00
Chris Lattner
893f025262 Detemplatize the PATypeHandle class, which was only really instantiated on 'Type'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6774 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-18 19:22:36 +00:00
Chris Lattner
eaeaad614c Fix bug: Assembler/2003-06-17-InvokeDisassemble.llx
"yes, invoke instructions can have just three arguments"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6736 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 13:31:10 +00:00
Chris Lattner
f69315bd79 Fix bug: Assembler/2003-05-03-BytecodeReaderProblem.llx
by emitting the type planes before any constants (which could be constant
expressions involving undefined types!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6285 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 18:35:38 +00:00
Chris Lattner
a2602f3dfd Do not assert fail or crash when a bytecode parse fails!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6284 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 18:26:48 +00:00
Chris Lattner
12e6465d89 Eliminate the uchar typedef, use unsigned char explicitly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6283 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 18:08:30 +00:00
Chris Lattner
8017a7575e Fix Bug: Assembler/2003-05-12-MinIntProblem.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6123 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 15:13:52 +00:00
Chris Lattner
8f77daef04 Add support for the new va_arg instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6029 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-08 02:44:12 +00:00
Misha Brukman
09ff1509ba Fixed 'prevalent'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5860 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 02:59:05 +00:00
Chris Lattner
76e3896881 Add support for reading and writing pointersize/endianness to and from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5839 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-22 18:15:10 +00:00
Chris Lattner
75f20532ec Preserve module source information in the ModuleID
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5836 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-22 18:02:52 +00:00
Chris Lattner
968cfd0b6e Initial support for reading standard .a files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5820 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-19 21:45:34 +00:00
Chris Lattner
f6099df194 Add support for reading unaligned bytecode buffers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5819 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-19 21:45:17 +00:00
Chris Lattner
869de25380 Fix a big bad bug I checked in yesterday :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5807 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-18 04:11:56 +00:00
Chris Lattner
e3869c83e7 Add support to the bytecode reader/writer for the new linkage types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5790 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-16 21:16:05 +00:00
Chris Lattner
4ad02e726d Add new linkage types to support a real frontend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5786 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-16 20:28:45 +00:00
Chris Lattner
3413d150dc * Change the order that globals and constants are processed in
* Add support for implicit zero initializers


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5750 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-19 20:57:22 +00:00
Chris Lattner
186a1f71e6 Changes to the V2 bytecode format:
- Null values are implicitly encoded instead of explicitly, this makes
    things more compact!
  - More compactly represent ConstantPointerRefs
  - Bytecode files are represented as:
      Header|GlobalTypes|GlobalVars/Function Protos|Constants|Functions|SymTab
    instead of
      Header|GlobalTypes|Constants|GlobalVars/Function Protos|Functions|SymTab
    which makes a lot of things simpler.

Writer changes:
  - We now explictly encode versioning information in the bytecode files.
  - This allows new code to read bytecode files produced by old code, but
    new bytecode files can have enhancements such as the above.  Although this
    makes the reader a bit more complex (having to deal with old formats), the
    writer only needs to be able to produce the most recent version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5749 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-19 20:56:46 +00:00