Commit Graph

171 Commits

Author SHA1 Message Date
Dale Johannesen
8d1433c6fc Support alignment within ParamAttrs in the I/O handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 21:15:19 +00:00
Anton Korobeynikov
ae9f3a3b7c Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 11:08:44 +00:00
Dale Johannesen
0d51e7ec0d Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet).  Clean up
interfaces to reference ParameterAttributes consistently.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 21:38:47 +00:00
Dan Gohman
3035959425 Use empty() instead of comparing size() with zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46514 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 13:02:09 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Chris Lattner
fc643c5e88 remove attribution from lib Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:09:26 +00:00
Gordon Henriksen
da1435f86e Adding bindings for memory buffers and module providers. Switching
to exceptions rather than variants for error handling in Ocaml.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45226 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 22:30:40 +00:00
Evan Cheng
f9b83fcf95 Bring back int_x86_sse2_movl_dq intrinsic for backward compatibility. Make sure
it's auto-upgraded to a shufflevector instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45131 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 22:33:23 +00:00
Ted Kremenek
8f559ef820 Modified Deserializer::ReadCStr to allow C-strings to be read into a
std::vector<char> starting from any index in the vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45129 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 22:25:12 +00:00
Christopher Lamb
43ad6b3e0d Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:12:55 +00:00
Christopher Lamb
d49e18d29f Implement part of review feedback for address spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44933 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 08:44:39 +00:00
Duncan Sands
216b74c20c Fix compilation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 12:20:47 +00:00
Christopher Lamb
fe63fb986d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 08:59:05 +00:00
Gordon Henriksen
bbc6597f02 Adding Ocaml bindings for the bitreader as requested by Sarah
Thompson. Usage should be something like this:

open Llvm
open Llvm_bitreader

match read_bitcode_file fn with
  | Bitreader_failure msg ->
      prerr_endline msg
  | Bitreader_success m -> 
      ...;
      dispose_module m

Compile with: ocamlc llvm.cma llvm_bitreader.cma
              ocamlopt llvm.cmxa llvm_bitreader.cmxa


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44824 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 00:20:48 +00:00
Gordon Henriksen
80a75bfae9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:18:06 +00:00
Gordon Henriksen
94007ec7da Applying Anton's binmode fix to the other ofstream too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44535 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 14:50:37 +00:00
Anton Korobeynikov
3194012664 Sorry, typo :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44534 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 14:35:57 +00:00
Anton Korobeynikov
037dd942c9 Open output file correctly. This is extremely important for
windows-based hosts, where files are opened in text mode by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44533 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 14:28:26 +00:00
Ted Kremenek
f64903b7d8 Fixed subtle bug in Deserializer::JumpTo when jumping when the block-nesting
information matching did not exactly match the underlying stream's scoping
information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 22:45:05 +00:00
Chris Lattner
a1afde77fa Unbreak backwards compatibility with bytecode format. Regression
introduced by this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071126/055824.html



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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Duncan Sands
5e41f65699 In order for parameter attribute uniquing to make
any sense it is important that ParamAttr::None gets
treated the same as not supplying an attribute at
all.  Rather than stripping ParamAttr::None out of
the list of attributes, assert if ParamAttr::None
is seen.  Fix up the bitcode reader which liked to
insert ParamAttr::None all over the place.  Patch
based on one by Török Edwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44250 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 14:09:29 +00:00
Dan Gohman
adf3eab773 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44234 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 15:30:20 +00:00
Ted Kremenek
233b60eced Removed debug #define that was accidentally checked in while debugging
the deserializer.

Fixed assertion when "stream jumping" in the deserializer to properly function
when we have reached the end of the stream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44124 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 17:42:09 +00:00
Ted Kremenek
38afd9e3ac Added two new overloaded versions of BatchEmitOwnedPtrs and
BatchReadOwnedPtrs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44105 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 08:05:03 +00:00
Ted Kremenek
62724da930 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44021 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12 19:11:15 +00:00
Ted Kremenek
5d1f2cc644 Updated method signature to conform with the typedef in the method prototype.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43982 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-10 19:19:32 +00:00
Ted Kremenek
1a8a08a690 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43973 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-10 02:02:34 +00:00
Ted Kremenek
48a396948f 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43916 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 00:43:51 +00:00
Ted Kremenek
ec8cd06555 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43903 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 19:50:46 +00:00
Ted Kremenek
c47dfdde24 Implemented generic serialization of APFloat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-07 18:39:22 +00:00
Ted Kremenek
2e6452ca0c Implemented serialization of signed integers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43828 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-07 18:24:34 +00:00
Ted Kremenek
68dd3fbe5b Serializer no longer automatically emits a root-level block in the bitstream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43784 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 22:22:25 +00:00
Ted Kremenek
b12a82dbf4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43783 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 22:21:14 +00:00
Ted Kremenek
730c273d42 Renamed "Flush()" to "FlushRecord()".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43772 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 19:49:50 +00:00
Ted Kremenek
26e25b3bf0 Added support for processing abbreviations in the Deserializer.
Added some #ifdef-controlled messages for debugging backpatching.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43771 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 19:49:16 +00:00
Ted Kremenek
0a6d98e10e Added support in serializer and deserializer to create arbitrary blocks.
Added detection of end-of-stream in deserializer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43736 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 21:36:35 +00:00
Dale Johannesen
eb57ea7ea2 Make labels work in asm blocks; allow labels as
parameters.  Rename ValueRefList to ParamList
in AsmParser, since its only use is for parameters.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 21:20:28 +00:00
Ted Kremenek
14ac17e2df Added default creation of root-level block by bitstream serializer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43732 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 20:47:27 +00:00
Gordon Henriksen
bd76d66194 Deleting -emitbitcode option which did nothing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43683 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-04 20:28:31 +00:00
Ted Kremenek
ff37ccc570 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43624 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 22:23:34 +00:00
Ted Kremenek
066ff5b7f2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43595 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 00:57:37 +00:00
Ted Kremenek
a7963a59b3 constified several pointer arguments for methods in the Deserializer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43583 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 22:42:03 +00:00
Ted Kremenek
eb9409dbb9 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43570 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 19:58:32 +00:00
Ted Kremenek
8aac61cff0 Added Serializer::EmitRef to deal with emitting arbitrary references.
Modified Serializer::EmitPtr to handle const pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43565 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 18:23:21 +00:00
Ted Kremenek
8308a48536 Fixed warning concerning implicit conversion from a NULL pointer
constant to an unsigned int.  We now just directly assign the literal 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43459 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 18:43:39 +00:00
Ted Kremenek
adc9b9c317 Fixed assertion in Deserializer::~Deserializer that checks for
pointers that were not backpatched (previously checked the wrong invariant).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43425 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-28 23:38:38 +00:00
Ted Kremenek
5973ef40ca 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43422 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-28 21:17:59 +00:00
Ted Kremenek
1a43e5ffe1 Added serialization support for APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43405 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 21:50:10 +00:00
Ted Kremenek
3bd9dcc08f Updated backpatching during object deserialization to support "smart"
pointers that employ unused bits in a pointer to store extra data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43373 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 23:40:35 +00:00