1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

292 Commits

Author SHA1 Message Date
Chris Lattner
ac7e143979 add a new Blob encoding abbreviation for bitcode files that emits
elements in a form that is efficient for the reader to just get a
pointer in memory and start reading.  APIs to do efficient reading
and writing are still todo.

llvm-svn: 68465
2009-04-06 21:50:39 +00:00
Chris Lattner
c67eb55ed2 split ReadAbbreviatedLiteral out of ReadAbbreviatedField.
llvm-svn: 68463
2009-04-06 21:37:10 +00:00
Chris Lattner
44a17471be reduce indentation with early-out
llvm-svn: 68462
2009-04-06 21:34:58 +00:00
Chris Lattner
5a3ece0cff simplify code a bit.
llvm-svn: 68461
2009-04-06 21:20:01 +00:00
Chris Lattner
07fdd28798 simplify to reduce indentation.
llvm-svn: 68460
2009-04-06 21:12:29 +00:00
Chris Lattner
7e2c9be68e Teach llvm-bcanalyzer to skip over the header we use on LLVM IR files.
llvm-svn: 68458
2009-04-06 20:54:32 +00:00
Nick Lewycky
eea5412e19 Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.

llvm-svn: 68420
2009-04-04 07:22:01 +00:00
Dan Gohman
770f4158e5 Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented
calculations from target-oriented calculations.

llvm-svn: 68227
2009-04-01 18:45:54 +00:00
Misha Brukman
5cfd666bde Removed trailing whitespace.
llvm-svn: 65199
2009-02-20 23:04:06 +00:00
Nate Begeman
8b548c0a9e Add suppport for ConstantExprs of shufflevectors whose result type is not equal to the
type of the vectors being shuffled.

llvm-svn: 64401
2009-02-12 21:28:33 +00:00
Chris Lattner
7819d9c8be Add support for writing LLVM IR to a specified BitstreamWriter.
Patch by Lukasz Janyst!

llvm-svn: 61251
2008-12-19 18:37:59 +00:00
Daniel Dunbar
287cf9f1f7 Add raw_ostream versions of WriteBitcodeToFile and BitcodeWriterPass.
- The old versions are still hanging around, but should be migrated
   away from.

llvm-svn: 57989
2008-10-22 17:39:14 +00:00
Zhongxing Xu
b187adcf5a Fix a calculation error in comments.
llvm-svn: 57619
2008-10-16 01:21:44 +00:00
Devang Patel
64dd7a2e89 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.

llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Dan Gohman
c325e16787 Update the comment to reflect the new name.
llvm-svn: 56496
2008-09-23 18:27:53 +00:00
Dan Gohman
54ef20348e Re-enables the new vector select in the bitcode reader, by modifying the
bitcode reader/writer as follows:

- add and use new bitcode FUNC_CODE_INST_VSELECT to handle the llvm
select opcode using either i1 or [N x i1] as the selector.
- retain old BITCODE FUNC_CODE_INST_SELECT in the bitcode reader to
handle select on i1 for backwards compatibility with existing bitcode
files.
- re-enable the vector-select.ll test program.

Also, rename the recently added bitcode opcode FUNC_CODE_INST_VCMP to
FUNC_CODE_INST_CMP2 and make the bitcode writer use it to handle
fcmp/icmp on scalars or vectors. In the bitcode writer, use
FUNC_CODE_INST_CMP for vfcmp/vicmp only. In the bitcode reader, have
FUNC_CODE_INST_CMP handle icmp/fcmp returning bool, for backwards
compatibility with existing bitcode files.

Patch by Preston Gurd!

llvm-svn: 56233
2008-09-16 01:01:33 +00:00
Dan Gohman
3e79d697f3 Extend the vcmp/fcmp LLVM IR instructions to take vectors as arguments
and, if so, to return a vector of boolean as a result;

Extend the select LLVM IR instruction to allow you to specify a result
type which is a vector of boolean, in which case the result will be an
element-wise selection instead of choosing one vector or the other; and

Update LangRef.html to describe these changes.

This patch was contributed by Preston Gurd!

llvm-svn: 55969
2008-09-09 01:02:47 +00:00
Gordon Henriksen
2cc861a6c1 Rename some GC classes so that their roll will hopefully be clearer.
In particular, Collector was confusing to implementors. Several
thought that this compile-time class was the place to implement
their runtime GC heap. Of course, it doesn't even exist at runtime.
Specifically, the renames are:

  Collector               -> GCStrategy
  CollectorMetadata       -> GCFunctionInfo
  CollectorModuleMetadata -> GCModuleInfo
  CollectorRegistry       -> GCRegistry
  Function::getCollector  -> getGC (setGC, hasGC, clearGC)

Several accessors and nested types have also been renamed to be
consistent. These changes should be obvious.

llvm-svn: 54899
2008-08-17 18:44:35 +00:00
Dan Gohman
9653b21dc2 Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.

Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.

Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.

llvm-svn: 54146
2008-07-28 21:51:04 +00:00
Dan Gohman
6564581be0 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.

llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Dan Gohman
183bd17a66 InsertValue and ExtractValue constant expressions are always
folded. Remove code that handled the case where they aren't
folded, and remove bitcode reader/writer support for them.

llvm-svn: 53887
2008-07-21 23:30:30 +00:00
Chris Lattner
b650adae49 Add a little wrapper header that is put around bc files when emitting
bc files for modules with a target triple that indicates they are for
darwin.  The reader unconditionally handles this, and the writer could
turn this on for more targets if we care.

This change has two benefits for darwin:

1) it allows us to encode the cpu type of the file in an easy to read
   place that doesn't require decoding the bc file.
2) it works around a bug (IMO) in darwin's AR where it is incapable of
   handling files that are not a multiple of 8 bytes long.  BC files
   are only guaranteed to be multiples of 4 bytes long.

llvm-svn: 53275
2008-07-09 05:14:23 +00:00
Anton Korobeynikov
f77142326f For PR1338: rename include/llvm/ADT/ilist and friends to end with ".h"
llvm-svn: 51687
2008-05-29 17:41:17 +00:00
Dan Gohman
c7007dd0dc Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.

llvm-svn: 51468
2008-05-23 01:55:30 +00:00
Evan Cheng
d9353009b7 Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Ted Kremenek
9d8f6a05b6 Initialize a local variable.
llvm-svn: 50527
2008-05-01 17:08:00 +00:00
Nick Lewycky
1f831c0f57 Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.

llvm-svn: 50265
2008-04-25 16:53:59 +00:00
Sam Bishop
41916aad58 Added support for Create() calls that take an argument besides the
deserializer.

llvm-svn: 49350
2008-04-07 21:36:46 +00:00
Ted Kremenek
2184f6cc1d Add member template version of SerializeTrait<T>::Create that also accepts
an optional argument for us by T's Create method.

llvm-svn: 49169
2008-04-03 16:44:37 +00:00
Chris Lattner
5ba3ea7b4c change the archive stuff to use MemoryBuffer instead of mappedfile.
MemoryBuffer is higher level and more closely matches the model
needed.

llvm-svn: 49029
2008-04-01 04:26:46 +00:00
Chris Lattner
b04ab612bf remove extraneous #include
llvm-svn: 49021
2008-04-01 03:01:15 +00:00
Sam Bishop
752e0f8fad Make a note of the fact that EmitOwnedPtr() has nothing to do with the
OwningPtr<> class.

llvm-svn: 48763
2008-03-25 04:41:18 +00:00
Nick Lewycky
b02fe64d8b Add an unwind_to field to basic blocks, making them Users instead of Values.
This is the first checkin for PR1269, the new EH infrastructure.

llvm-svn: 47802
2008-03-02 02:48:09 +00:00
Devang Patel
8ae63af4b1 Read and write getresult.
llvm-svn: 47471
2008-02-22 02:49:49 +00:00
Chris Lattner
e0b1ee937a Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)

llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Ted Kremenek
200bc2d387 Added some sectioning comments to Serialize.h.
Added additional serialization functors for use with std::foreach.

llvm-svn: 45162
2007-12-18 18:25:55 +00:00
Ted Kremenek
28a75d4674 Modified Deserializer::ReadCStr to allow C-strings to be read into a
std::vector<char> starting from any index in the vector.

llvm-svn: 45129
2007-12-17 22:25:12 +00:00
Christopher Lamb
6d12d7c0fe Implement part of review feedback for address spaces.
llvm-svn: 44933
2007-12-12 08:44:39 +00:00
Christopher Lamb
7368604860 Implement address space attribute for LLVM pointer types. Address spaces are
regions of memory that have a target specific relationship, as described in the 
Embedded C Technical Report. 

This also implements the 2007-12-11-AddressSpaces test, 
which demonstrates how address space attributes can be used in LLVM IR.

In addition, this patch changes the bitcode signature for stores (in a backwards 
compatible manner), such that the pointer type, rather than the pointee type, is 
encoded. This permits type information in the pointer (e.g. address space) to be 
preserved for stores.

LangRef updates are forthcoming.

llvm-svn: 44858
2007-12-11 08:59:05 +00:00
Gordon Henriksen
5d201e0bcc Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.

llvm-svn: 44769
2007-12-10 03:18:06 +00:00
Ted Kremenek
f1c4beda54 Added "Emitter" functor to allow easy emitting of elements of a container
using std::for_each.

llvm-svn: 44589
2007-12-05 00:13:07 +00:00
Ted Kremenek
74fcbb87af Fixed subtle bug in Deserializer::JumpTo when jumping when the block-nesting
information matching did not exactly match the underlying stream's scoping
information.

llvm-svn: 44470
2007-11-30 22:45:05 +00:00
Ted Kremenek
994b0d4b1a Fixed potential bug where CurWord is not zeroed out in JumpToBit.
llvm-svn: 44469
2007-11-30 22:39:46 +00:00
Dan Gohman
760d574313 Add explicit keywords.
llvm-svn: 44234
2007-11-19 15:30:20 +00:00
Ted Kremenek
54e9239a36 Reverted patch 44199:
http://llvm.org/viewvc/llvm-project?rev=44199&view=rev

This patch completely broke serialization due to an invariant I assumed but
did not hold. The assumed invariant was that all pointer IDs emitted by a call
to BatchEmitOwnedPtrs would be consecutive. This is only the case if there has
been no forward references to an owned pointer (and hence already registered
with the Serializer object).

llvm-svn: 44203
2007-11-17 03:34:33 +00:00
Ted Kremenek
e22cf73dfc Changed implementation of Serialize::EmitDiffPtrID and
Deserialize::ReadDiffPtrID to read and emit bools instead of unsigned
integers. This should result in a nice space optimization once we have
"auto-abbreviation" generation in place.

llvm-svn: 44200
2007-11-17 00:45:37 +00:00
Ted Kremenek
20b4c84cfa Implemented optimization for BatchEmitOwnedPtrs that we only emit one complete
SerializedPtrID, followed by the *differences* in IDs. The big idea is that
most IDs will be just be 1 off from the previous (either that or NULL, which
we encode as a difference if 0), so this will greatly reduce the encoding
space for extra IDs to just 1 bit per pointer.

So far this optimization reduces serialization of Carbon.h by only 1%, but
we aren't using any abbreviations now in the Bitcode file to properly take
advantage of this optimization.

llvm-svn: 44199
2007-11-17 00:40:45 +00:00
Ted Kremenek
f9bee1e089 Fixed serious bug in BatchReadOwnedPtrs where in a chain of calls to
deserialize objects if BatchReadOwnedPtrs was called more than once in the
same call chain then the second call would overwrite the SerializedPtrIDs
being used by the first call. Solved this problem by making the vector that
holds the pointer IDs local to a function call. Now BatchReadOwnedPtrs is
reentrant.

llvm-svn: 44152
2007-11-15 00:05:03 +00:00
Ted Kremenek
0f3c05d800 Added two new overloaded versions of BatchEmitOwnedPtrs and
BatchReadOwnedPtrs.

llvm-svn: 44105
2007-11-14 08:05:03 +00:00
Ted Kremenek
4bca0b284d Renamed serialization method "Materialize" to "Create". This is an API change.
llvm-svn: 44034
2007-11-13 00:25:08 +00:00
Ted Kremenek
9b762fbd2b Fixed bug with inconsistent serialization/deserialization in matching
calls to BatchEmitOwnedPtrs and BatchReadOwnedPtrs.

llvm-svn: 44032
2007-11-13 00:13:57 +00:00
Ted Kremenek
960f531bbe Added versions of ReadPtr that takes an explicit SerializedPtrID. This allows
clients of the Deserializer to read the pointer ID before they are ready
to deserialize the object (which can mean registering a pointer reference
with the backpatcher).

Changed some methods that took an argument "SerializedPtrID" to "const SerializedPtrID&" (pass-by-reference).  This is to accommodate a future
revision of SerializedPtrID where it may be much fatter than an unsigned
integer.

llvm-svn: 44021
2007-11-12 19:11:15 +00:00
Ted Kremenek
b16c8aac59 Fixed a bug introduced by my last patch. Now we properly clear out the BatchIDVec
vector before reusing it.

llvm-svn: 43984
2007-11-10 19:33:26 +00:00
Ted Kremenek
72b9e78ab1 Fixed hack in BatchReadOwnedPtrs to no longer use the array of pointers passed in for
deserialization as a temporary location for storing serialized pointer identifiers. The
definition of SerializedPtrID will likely change significantly in the future, and the
current implementation caused compilation errors on some 64-bit machines.

llvm-svn: 43983
2007-11-10 19:28:49 +00:00
Ted Kremenek
107cb494e2 Added "random access" to the Deserializer to allow a client to jump to any
serialized block in the bitstream, including a block in an entirely different
nesting than the current block. This is useful for deserializing objects from
a bitstream in an order different from the order that they were serialized.

llvm-svn: 43973
2007-11-10 02:02:34 +00:00
Ted Kremenek
93329cbed2 Made Deserializer a friend class of BitstreamReader.
Moved some of the logic in BitstreamReader::ExitBlock into a utility function
BitstreamReader::PopBlockScope. The latter is a private method. It will also
be called by Deserializer to manipulate the current "block scope."

llvm-svn: 43972
2007-11-10 02:00:38 +00:00
Ted Kremenek
43cd07be2c Updated Deserializer class to provide more information about the current
block that is being visited in the bitstream.  The client can also now
skip blocks before reading them, and query the current abbreviation number
as seen from the perspective of the Deserializer.  This allows the client
to be more interactive in the deserialization process (if they so choose).

llvm-svn: 43916
2007-11-09 00:43:51 +00:00
Ted Kremenek
4457e36ffe Added typedef "SerializedPtrID" to represent the pointer handle written to disk
instead of just using "unsigned".  This gives us more flexibility in changing
the definition of the handle later, and is more self-documenting.

Added tracking of block stack in the Deserializer.  Now clients can query
if they are still within a block using the methods GetCurrentBlockLocation()
and FinishedBlock().

llvm-svn: 43903
2007-11-08 19:50:46 +00:00
Ted Kremenek
93c65108de Revised BatchEmitOwnedPtrs to work better with constant pointers.
llvm-svn: 43861
2007-11-08 00:55:31 +00:00
Ted Kremenek
eaafbccdd8 Revised implementation of BatchReadOwnedPtrs() that deserializes an
array of pointers to not allocate a second array to contain the pointer ids.

Fixed bug in the same member function where deserialized pointers were
not being registered with the backpatcher.

llvm-svn: 43855
2007-11-08 00:04:50 +00:00
Ted Kremenek
076d1903ec Fixed bug where we did not properly serialize owned objects due to a missing
dereference.

llvm-svn: 43853
2007-11-07 23:32:06 +00:00
Ted Kremenek
bd19c49b62 Added version of BatchEmitOwnedPtrs and BatchReadOwnedPtrs that emits/reads
an array of pointers of the same type.

llvm-svn: 43852
2007-11-07 23:18:40 +00:00
Ted Kremenek
28ffec0b56 Added methods to batch emit and deserialize owned pointers. This allows
to group the pointer IDs together in the bitstream before their referenced
contents (which will lend itself to more efficient encoding).

llvm-svn: 43845
2007-11-07 22:30:29 +00:00
Ted Kremenek
f4bc385d1b Implemented serialization of signed integers.
llvm-svn: 43828
2007-11-07 18:24:34 +00:00
Ted Kremenek
ac282bd929 Added special version of ReadPtr() that returns a deserialized pointer
by value.  This version prohibits backpatching of pointers, so it
useful when a pointee is always known to be deserialized beforehand.

llvm-svn: 43799
2007-11-07 00:47:33 +00:00
Ted Kremenek
8dedf8270e Serializer no longer automatically emits a root-level block in the bitstream.
llvm-svn: 43784
2007-11-06 22:22:25 +00:00
Ted Kremenek
844153d465 Augmented ReadPtr and ReadOwnedPtr to control whether or not a pointer is allowed to be backpatched
or can be registered with the deserializer to backpatch other pointers.

llvm-svn: 43783
2007-11-06 22:21:14 +00:00
Ted Kremenek
3609f43f5c Renamed "Flush()" to "FlushRecord()".
llvm-svn: 43772
2007-11-06 19:49:50 +00:00
Ted Kremenek
16a9212602 Added support for processing abbreviations in the Deserializer.
Added some #ifdef-controlled messages for debugging backpatching.

llvm-svn: 43771
2007-11-06 19:49:16 +00:00
Ted Kremenek
7c710e0210 Added support in serializer and deserializer to create arbitrary blocks.
Added detection of end-of-stream in deserializer.

llvm-svn: 43736
2007-11-05 21:36:35 +00:00
Ted Kremenek
dbc286177c Added default creation of root-level block by bitstream serializer.
llvm-svn: 43732
2007-11-05 20:47:27 +00:00
Ted Kremenek
8250360a77 Fixed bug where tombstone key and empty key for DenseMap used for
pointer backpatching in deserializer were improperly created and
resulted in an assertion failure.

llvm-svn: 43721
2007-11-05 18:13:03 +00:00
Ted Kremenek
0501d830a5 Added overloaded version of Deserializer::ReadOwnedPtr which allows
the target pointer to be passed by reference.  This can result in less
typing, as the object to be deserialized can be inferred from the
argument.

llvm-svn: 43647
2007-11-02 18:04:20 +00:00
Ted Kremenek
d2f2a98e09 Removed ReadVal from SerializeTrait<T>, and also removed it from
Deserializer.

There were issues with Visual C++ barfing when instantiating
SerializeTrait<T> when "T" was an abstract class AND
SerializeTrait<T>::ReadVal was *never* called:

template <typename T>
struct SerializeTrait {
 <SNIP>
  static inline T ReadVal(Deserializer& D) { T::ReadVal(D); }
 <SNIP>
};

Visual C++ would complain about "T" being an abstract class, even
though ReadVal was never instantiated (although one of the other
member functions were).

Removing this from the trait is not a big deal.  It was used hardly
ever, and users who want "read-by-value" deserialization can simply
call the appropriate methods directly instead of relying on
trait-based-dispatch.  The trait dispatch for
serialization/deserialization is simply sugar in many cases (like this
one).

llvm-svn: 43624
2007-11-01 22:23:34 +00:00
Ted Kremenek
88302abf8a Rewrote backpatcher. Backpatcher now stores the "has final pointer"
flag in the **key** of the backpatch map, as opposed to the mapped
value which contains either the final pointer, or a pointer to a chain
of pointers that need to be backpatched.  The bit flag was moved to
the key because we were erroneously assuming that the backpatched
pointers would be at an alignment of >= 2 bytes, which obviously
doesn't work for character strings.  Now we just steal the bit from the key.

llvm-svn: 43595
2007-11-01 00:57:37 +00:00
Ted Kremenek
b94840e211 constified several pointer arguments for methods in the Deserializer.
llvm-svn: 43583
2007-10-31 22:42:03 +00:00
Ted Kremenek
deeab7cc87 Implemented deserialization of references. References are handled
just like pointers, except that they cannot be backpatched.  This
means that references are essentially non-owning pointers where the
referred object must be deserialized prior to the reference being
deserialized.  Because of the nature of references, this ordering of
objects is always possible.

Fixed a bug in backpatching code (returning the backpatched pointer
would accidentally include a bit flag).

llvm-svn: 43570
2007-10-31 19:58:32 +00:00
Ted Kremenek
f6f2eb1c4f Added Serializer::EmitRef to deal with emitting arbitrary references.
Modified Serializer::EmitPtr to handle const pointers.

llvm-svn: 43565
2007-10-31 18:23:21 +00:00
Ted Kremenek
27c96e0d86 Updated backpatching logic during object deserialization to perform
eager backpatching instead of waithing until all objects have been
deserialized.  This allows us to reduce the memory footprint needed
for backpatching.

llvm-svn: 43422
2007-10-28 21:17:59 +00:00
Ted Kremenek
254ef9c99c Fixed bug where default SerializeTrait<>::Materialize would not return the materialized object pointer.
llvm-svn: 43413
2007-10-26 23:44:59 +00:00
Ted Kremenek
87e1cadc06 Added default implementation of SerializeTrait<> that dispatches to
calling member functions of the target type to perform type-specific
serialization.
                         
Added version of ReadPtr that allows passing references to uintptr_t
(useful for smart pointers).

llvm-svn: 43396
2007-10-26 20:23:27 +00:00
Ted Kremenek
2bfb73a3f4 Updated backpatching during object deserialization to support "smart"
pointers that employ unused bits in a pointer to store extra data.

llvm-svn: 43373
2007-10-25 23:40:35 +00:00
Ted Kremenek
d29fe31fcd Added special treatment of serializing NULL pointers.
llvm-svn: 43357
2007-10-25 18:42:52 +00:00
Ted Kremenek
9749790ef5 Created header file to include minimal forward references needed for
object serialization.

llvm-svn: 43352
2007-10-25 18:19:29 +00:00
Ted Kremenek
195382dce2 Implemented prototype serialization of pointers, including support
for backpatching.

Added Deserialize::ReadVal.

llvm-svn: 43319
2007-10-25 00:10:21 +00:00
Ted Kremenek
b3085f2d74 Split Serialization.h into separate headers: Serialize.h and
Deserialize.h Serialization.h now includes trait speciailizations for
unsigned long, etc.

llvm-svn: 43307
2007-10-24 19:06:40 +00:00
Hartmut Kaiser
b72a8fcf9c Silenced a VC++ warning.
llvm-svn: 43276
2007-10-24 00:06:31 +00:00
Ted Kremenek
bb85c21ffc Added "ReadEnum" and "WriteEnum" to serialization classes.
llvm-svn: 43265
2007-10-23 22:17:03 +00:00
Ted Kremenek
72fe268f74 Added preliminary implementation of generic object serialization to bitcode.
llvm-svn: 43261
2007-10-23 21:29:33 +00:00
Dan Gohman
7fa473514d Add explicit keywords.
llvm-svn: 42747
2007-10-08 15:08:41 +00:00
Reid Spencer
3e54e72ef1 Fix minor doxygen nits.
llvm-svn: 40854
2007-08-05 20:06:04 +00:00
Dale Johannesen
dda00eb44d Long double, part 1 of N. Support in IR.
llvm-svn: 40774
2007-08-03 01:03:46 +00:00
Gabor Greif
018330fd12 finishing touches of bytecode -> bitcode changes. also unbreak Windows
llvm-svn: 37950
2007-07-06 20:28:40 +00:00
Gabor Greif
f5e225a756 eliminate residual cruft related to recognizing bytecode
files.
bitcode files are the only LLVM format left.

llvm-svn: 37945
2007-07-06 13:38:17 +00:00
Gabor Greif
5f705671e4 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Chris Lattner
114dad2f8f update comments, no functionality change
llvm-svn: 36929
2007-05-08 05:38:32 +00:00
Chris Lattner
6cfc34329b Move this here from Bytecode/Archive.h
llvm-svn: 36865
2007-05-06 09:14:53 +00:00
Chris Lattner
87753518a9 allow zero-length arrays
llvm-svn: 36863
2007-05-06 08:22:10 +00:00
Chris Lattner
37779a0b4c we aren't at the end of stream until we've consumed all the bytes AND all
the bits in those bytes.

llvm-svn: 36861
2007-05-06 08:12:09 +00:00
Jeff Cohen
0b108b4f29 Make code more 64-bit aware.
llvm-svn: 36833
2007-05-06 03:24:19 +00:00
Jeff Cohen
ce844b2aaa Unbreak VC++.
llvm-svn: 36831
2007-05-06 03:12:47 +00:00
Chris Lattner
bf23240f44 add a new CreateBitcodeWriterPass method, which creates a bitcode writer as
a pass

llvm-svn: 36828
2007-05-06 02:30:12 +00:00
Chris Lattner
c9ca38fedf add inline asm code
llvm-svn: 36826
2007-05-06 01:50:11 +00:00
Chris Lattner
2753e54f7b Fix a subtle bug that prevented round-tripping 470.lbm
llvm-svn: 36825
2007-05-06 01:43:38 +00:00
Chris Lattner
6d0c5eb739 add a denser encoding for null terminated strings, add a 6-bit abbrev as
well.  This shrinks kc++ from 2724088 to 2717360 bytes.

llvm-svn: 36821
2007-05-06 00:53:07 +00:00
Chris Lattner
34b256e1a6 implement the 'string constant' optimization. This shrinks kc.bit from
2878544 to 2815788

llvm-svn: 36818
2007-05-06 00:35:24 +00:00
Chris Lattner
9818d0a7e6 fix a bug I introduced when I merged some code together
llvm-svn: 36813
2007-05-05 23:40:48 +00:00
Chris Lattner
7d16cb364d minor bugfix
llvm-svn: 36777
2007-05-05 07:20:34 +00:00
Chris Lattner
cedc5577f2 add a 6-bit encoding type for strings.
llvm-svn: 36770
2007-05-05 01:15:42 +00:00
Chris Lattner
eca2bb1334 Implement support for globally associating abbrevs with block IDs, which
relieves us from having to emit the abbrevs into each instance of the block.
This shrinks kc.bit from 3368K to 3333K, but will be a more significant win
once instructions are abbreviated.

The VST went from:

  Block ID #14 (VALUE_SYMTAB):
      Num Instances: 2345
         Total Size: 1.29508e+07b/1.61885e+06B/404713W
       Average Size: 5522.73b/690.342B/172.585W
          % of file: 48.0645
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 7035/3
    Tot/Avg Records: 120924/51.5667
      % Abbrev Recs: 100

to:

  Block ID #14 (VALUE_SYMTAB):
      Num Instances: 2345
         Total Size: 1.26713e+07b/1.58391e+06B/395978W
       Average Size: 5403.53b/675.442B/168.86W
          % of file: 47.5198
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 0/0
    Tot/Avg Records: 120924/51.5667
      % Abbrev Recs: 100

because we didn't emit the same 3 abbrevs 2345 times :)

llvm-svn: 36767
2007-05-05 00:17:00 +00:00
Chris Lattner
e2b2272c53 use a template to eliminate manual code duplication
llvm-svn: 36757
2007-05-04 20:40:50 +00:00
Chris Lattner
75b84adf6b add support for array abbreviations.
llvm-svn: 36754
2007-05-04 20:33:47 +00:00
Chris Lattner
a4aa2e9b7a eliminate lengths from record bodies
llvm-svn: 36751
2007-05-04 19:10:48 +00:00
Chris Lattner
4e0c6003b7 minor cleanups. Add provisions for a new standard BLOCKINFO_BLOCK
block type.

llvm-svn: 36748
2007-05-04 18:25:49 +00:00
Chris Lattner
f0086ffafa refcount BitCodeAbbrev objects
llvm-svn: 36747
2007-05-04 17:35:19 +00:00
Chris Lattner
bb8d1755f6 remove unused code
llvm-svn: 36727
2007-05-04 03:01:46 +00:00
Chris Lattner
2d0c97d9a1 add new codes
llvm-svn: 36725
2007-05-04 03:00:00 +00:00
Chris Lattner
43c70c8404 add a new code
llvm-svn: 36703
2007-05-03 22:16:11 +00:00
Chris Lattner
79333821da update to reflect reality
llvm-svn: 36643
2007-05-02 05:47:22 +00:00
Chris Lattner
21e0d64a6e several bitfixes to JumpToBit
llvm-svn: 36616
2007-05-01 05:51:32 +00:00
Chris Lattner
eb2a5f5f99 add JumpToBit, an explicit init method, and a default ctor.
llvm-svn: 36613
2007-05-01 04:59:06 +00:00
Chris Lattner
92eca49c3f add missing opcode.
llvm-svn: 36608
2007-05-01 02:12:05 +00:00
Chris Lattner
31d1dec66d add some helpers
llvm-svn: 36580
2007-04-29 21:49:05 +00:00
Chris Lattner
8a40d39a8e compute this value correctly
llvm-svn: 36575
2007-04-29 19:49:58 +00:00
Chris Lattner
d61ccde429 add a method
llvm-svn: 36571
2007-04-29 19:17:32 +00:00
Chris Lattner
8308e85781 make this file self-contained
llvm-svn: 36555
2007-04-29 08:05:07 +00:00
Chris Lattner
eee1022086 Switch the bitcode reader interface to take a MemoryBuffer instead of knowing
anything about disk I/O itself.  This greatly simplifies its interface -
eliminating the need for the ReaderWrappers.cpp file.

This adds a new option to llvm-dis (-bitcode) which instructs it to read
the input file as bitcode.  Until/unless the bytecode reader is taught to
read from MemoryBuffer, there is no way to handle stdin reading without it.

I don't plan to switch the bytecode reader over, I'd rather delete it :),
so the option will stay around temporarily.

llvm-svn: 36554
2007-04-29 07:54:31 +00:00
Chris Lattner
e1248f05f2 start defining codes for instructions
llvm-svn: 36471
2007-04-26 05:53:04 +00:00
Chris Lattner
4721ac3ee0 add a new code
llvm-svn: 36462
2007-04-26 03:26:26 +00:00
Chris Lattner
4a0785ffcd add alias support to bitcode
llvm-svn: 36460
2007-04-26 02:46:23 +00:00
Chris Lattner
61f8d0e81c comentate
llvm-svn: 36395
2007-04-24 15:54:42 +00:00
Chris Lattner
5ae162a9d2 add records for constant exprs
llvm-svn: 36393
2007-04-24 07:03:08 +00:00
Chris Lattner
ea07262cc5 add codes for constants table
llvm-svn: 36382
2007-04-23 23:29:59 +00:00
Chris Lattner
8f45aa08fa Fix a bug in bitstream writer handling abbrevs, add value symtab
llvm-svn: 36373
2007-04-23 20:34:46 +00:00
Chris Lattner
193294e642 implement reading of abbrevs
llvm-svn: 36366
2007-04-23 18:57:58 +00:00
Chris Lattner
38568c7454 minor cleanups
llvm-svn: 36365
2007-04-23 18:57:32 +00:00
Chris Lattner
69a8eda44d finish implementation of basic abbrev writing.
llvm-svn: 36364
2007-04-23 17:43:52 +00:00
Chris Lattner
5510ac5a56 first part of implementation of abbrevs. The writer isn't fully there yet and the
reader doesn't handle them at all yet.

llvm-svn: 36363
2007-04-23 16:04:05 +00:00
Chris Lattner
1aa0ae26a8 promote this to being a public header.
llvm-svn: 36357
2007-04-23 01:01:15 +00:00
Reid Spencer
bcf9c262e7 Terminate with newline.
llvm-svn: 36345
2007-04-22 16:31:22 +00:00
Jeff Cohen
2cf2830f4d Teach Visual Studio about Bitcode.
llvm-svn: 36341
2007-04-22 15:00:52 +00:00
Chris Lattner
97852839f7 Define the content-independent interfaces to read/write bitcode files and
the high-level interface to read/write LLVM IR bitcode files.

This is a work in progress.

llvm-svn: 36329
2007-04-22 06:22:05 +00:00