Commit Graph

185 Commits

Author SHA1 Message Date
Dan Gohman
950a4c40b8 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:06:05 +00:00
Chris Lattner
58d74910c6 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 17:45:29 +00:00
Chris Lattner
461edd937e when the bitcode reader is referencing a paramattr, make sure to bump its refcount.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48276 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 02:25:52 +00:00
Anton Korobeynikov
91342d8873 Be backward compatible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48268 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 00:49:19 +00:00
Anton Korobeynikov
f8342b9866 Honour aliases visibility when reading from/writing to bitcode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 21:40:17 +00:00
Nick Lewycky
fc82fabe00 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-02 02:48:09 +00:00
Devang Patel
f4511cd8fb Use SmallVector while constructing ReturnInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 19:38:17 +00:00
Devang Patel
9a8a88b72d Remove debugging help.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 01:42:38 +00:00
Devang Patel
d9d99ff8e8 Update bitcode reader and writer to handle multiple return values.
Take 2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 01:29:32 +00:00
Evan Cheng
1df439773c Backing out r47521 for now. This has broken a number of tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 19:32:32 +00:00
Devang Patel
e9fabd94ab Properly read and write bitcodes for multiple return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 01:44:55 +00:00
Ted Kremenek
57daefa187 Fixed buffer overflow reported by Argiris Kirtzidis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47517 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 01:11:40 +00:00
Dale Johannesen
22c3979fca Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 22:17:59 +00:00
Devang Patel
197be3de7f Read and write getresult.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 02:49:49 +00:00
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