Commit Graph

724 Commits

Author SHA1 Message Date
Dmitri Gribenko
5c332dbd30 Add ArrayRef constructor from None, and do the cleanups that this constructor enables
Patch by Robert Wilhelm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181138 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05 00:40:33 +00:00
Filip Pizlo
40be1e8566 This patch breaks up Wrap.h so that it does not have to include all of
the things, and renames it to CBindingWrapping.h.  I also moved 
CBindingWrapping.h into Support/.

This new file just contains the macros for defining different wrap/unwrap 
methods.

The calls to those macros, as well as any custom wrap/unwrap definitions 
(like for array of Values for example), are put into corresponding C++ 
headers.

Doing this required some #include surgery, since some .cpp files relied 
on the fact that including Wrap.h implicitly caused the inclusion of a 
bunch of other things.

This also now means that the C++ headers will include their corresponding 
C API headers; for example Value.h must include llvm-c/Core.h.  I think 
this is harmless, since the C API headers contain just external function 
declarations and some C types, so I don't believe there should be any 
nasty dependency issues here.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180881 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01 20:59:00 +00:00
Eric Christopher
3e39731e88 Move C++ code out of the C headers and into either C++ headers
or the C++ files themselves. This enables people to use
just a C compiler to interoperate with LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180063 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 22:47:22 +00:00
Joe Abbey
ef7964c1b7 Whitespace cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178454 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-01 02:28:07 +00:00
Jakub Staszak
c61e83e6de Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175501 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19 09:48:30 +00:00
Bill Wendling
48fbcfe6b9 Have the bitcode writer and reader handle the new attribute references.
The bitcode writer emits a reference to the attribute group that the object at
the given index refers to. The bitcode reader is modified to read this in and
map it back to the attribute group.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174952 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12 08:13:50 +00:00
Bill Wendling
105ea3d49d Use the AttributeSet as the 'key' to the map instead of the 'raw' pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174950 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12 08:01:22 +00:00
Bill Wendling
e9229a6a96 Rename AttributeSets to AttributeGroups so that it's more meaningful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174911 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11 22:33:26 +00:00
Bill Wendling
04ef4be048 Use a std::map so that we record the group ID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174910 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11 22:32:29 +00:00
Kostya Serebryany
ab39afa9d9 [tsan/msan] adding thread_safety and uninitialized_checks attributes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174864 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11 08:13:54 +00:00
David Blaikie
f12b379448 Fix unnecessary removal of const through cast machinery
I have some uncommitted changes to the cast code that catch this sort of thing
at compile-time but I still need to do some other cleanup before I can enable
it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174853 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11 01:16:51 +00:00
Bill Wendling
c3ba0a821b Add support in the bitcode reader to read the attribute groups.
This reads the attribute groups. It currently doesn't do anything with them.

NOTE: In the commit to the bitcode writer, the format *may* change in the near
future. Which means that this code would also change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174849 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 23:24:25 +00:00
Bill Wendling
0f715c26bd Add code for emitting the attribute groups.
This is some initial code for emitting the attribute groups into the bitcode.

NOTE: This format *may* change! Do not rely upon the attribute groups' bitcode
not changing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174845 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 23:09:32 +00:00
Bill Wendling
8c2e77f895 Add support for attribute groups in the value enumerator.
Attribute groups are essentially all AttributeSets which are used by the
program. Enumerate them here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174844 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 23:06:02 +00:00
Chris Lattner
b24f5b7c08 Fix the underlying problem that was causing read(0) to be called: sometimes the
bitcode writer would generate abbrev records saying that the abbrev should be
filled with fixed zero-bit bitfields (this happens in the .bc writer when 
the number of types used in a module is exactly one, since log2(1) == 0).

In this case, just handle it as a literal zero.  We can't "just fix" the writer
without breaking compatibility with existing bc files, so have the abbrev reader
do the substitution.

Strengthen the assert in read to reject reads of zero bits so we catch such 
crimes in the future, and remove the special case designed to handle this.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-09 07:07:29 +00:00
Joe Abbey
acb6194f93 Code Custodian (trivial whitespace cleanup)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174550 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 22:14:06 +00:00
Michael Gottesman
a2de37c897 Added LLVM Asm/Bitcode Reader/Writer support for new IR keyword externally_initialized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174340 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 05:57:38 +00:00
Bill Wendling
f9271ea159 Initial cleanups of the param-attribute code in the bitcode reader/writer.
Rename the PARAMATTR_CODE_ENTRY to PARAMATTR_CODE_ENTRY_OLD. It will be replaced
by another encoding. Keep around the current LLVM attribute encoder/decoder
code, but move it to the bitcode directories so that no one's tempted to use
them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174335 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04 23:32:23 +00:00
Bill Wendling
8232ece5c1 Use an AttrBuilder to generate the correct AttributeSet.
We no longer accept an encoded integer as representing all of the
attributes. Convert this via the AttrBuilder class into an AttributeSet with the
correct representation (an AttributeSetImpl that holds a list of Attribute
objects).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173750 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 01:43:29 +00:00
Bill Wendling
0c2f0ff9cc Use the AttributeSet instead of AttributeWithIndex object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173598 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 00:36:48 +00:00
Bill Wendling
8e47daf285 Remove some introspection functions.
The 'getSlot' function and its ilk allow introspection into the AttributeSet
class. However, that class should be opaque. Allow access through accessor
methods instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173522 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 23:09:36 +00:00
Bill Wendling
85875647d6 Use the new 'getSlotIndex' method to retrieve the attribute's slot index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173499 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 21:46:52 +00:00
Tim Northover
0a29cb0454 Make APFloat constructor require explicit semantics.
Previously we tried to infer it from the bit width size, with an added
IsIEEE argument for the PPC/IEEE 128-bit case, which had a default
value. This default value allowed bugs to creep in, where it was
inappropriate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173138 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 09:46:31 +00:00
Chris Lattner
69582cf6c4 Fix a heinous inefficiency introduced in r149918, wherein reading each byte of a
BLOB (i.e., large, performance intensive data) in a bitcode file was switched to
invoking one virtual method call per byte read.  Now we do one virtual call per
BLOB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173065 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 18:24:49 +00:00
Chris Lattner
47543a8a66 wean Blob handling logic off of banging on NextChar directly. Instead, make
it reason about the current bit position, which is always independent of the
underlying cursors word size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173063 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 18:18:25 +00:00
Chris Lattner
fd0543d9be rename "SkipToWord" to "SkipToFourByteBoundary" since a word is not always 4 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173062 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 18:04:19 +00:00
Chris Lattner
1ca114a66b trivial micro-optimization: lazily call the virtual method instead of eagerly calling it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172953 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 02:54:05 +00:00
Chris Lattner
5a4251c767 convert the bitstream reader itself and the IR .bc file parser to use the new advance() APIs,
simplifying things and making a bunch of details more private to BitstreamCursor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172947 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 02:13:19 +00:00
Chris Lattner
194ef24dfe stringref'ize readRecord and properly capitalize it. Add a compatibility method to easy
the transition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172940 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 01:06:48 +00:00
Chris Lattner
f9147c41d8 move some private methods out of line, add a skipRecord() method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172931 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 00:00:00 +00:00
Chris Lattner
63246aa04f Add a new BitstreamEntry concept, and add two helper methods for walking
through a BitstreamCursor that produce it: advance() and 
advanceSkippingSubblocks(), representing the two most common ways clients
want to walk through bitcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172919 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 21:35:24 +00:00
Chris Lattner
312c7d9dc1 BitstreamReader hasn't aged well. It's been hacked on by various people and
has past the point of making sense.  Lets tidy things up: first step, moving
a ton of big functions out of line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172904 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 18:19:39 +00:00
Bill Wendling
1db9b6957c Revert s/Raw/getBitMask/g name change. This is possibly causing LTO test hangings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172020 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 23:36:50 +00:00
Chandler Carruth
0b8c9a80f2 Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 11:36:10 +00:00
Bill Wendling
c966e08a98 s/Raw/getBitMask/g to be more in line with current naming conventions. This method won't be sticking around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171244 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-30 01:05:42 +00:00
Bill Wendling
034b94b170 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 07:18:57 +00:00
Michael Ilseman
1638b83909 Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 21:12:04 +00:00
Michael Ilseman
855d0255d0 Have the bitcode reader/writer just use FPMathOperator's fast math enum directly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169710 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 20:23:16 +00:00
Bill Wendling
99faa3b4ec s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169651 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-07 23:16:57 +00:00
Chandler Carruth
a1514e24cc Sort includes for all of the .h files under the 'lib' tree. These were
missed in the first pass because the script didn't yet handle include
guards.

Note that the script is now able to handle all of these headers without
manual edits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169224 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 07:12:27 +00:00
Michael Ilseman
cb66b5dd7a Minor tweaking to SmallVector static size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169176 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 22:57:47 +00:00
Michael Ilseman
dbd7b95ed4 Since this SmallVector immediately grows on the next line, don't waste stack space. SmallVector is still needed due to existing APIs growing their arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169157 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 21:29:36 +00:00
Chandler Carruth
d04a8d4b33 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 16:50:05 +00:00
Bill Wendling
3defc0bfa6 Add back support for reading and parsing 'deplibs'.
This is for backwards compatibility for pre-3.x bc files. The code reads the
code, but does nothing with it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168779 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 08:41:48 +00:00
Bill Wendling
efd08d413c Remove the dependent libraries feature.
The dependent libraries feature was never used and has bit-rotted. Remove it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168694 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 09:55:56 +00:00
Joe Abbey
eaac37ece1 Code pretification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168661 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 01:20:22 +00:00
Michael Ilseman
495d10ad56 Fast-math flags for the bitcode
Added in bitcode enum for the serializing of fast-math flags. Added in the reading/writing of fast-math flags from the OptimizationFlags record for BinaryOps.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168646 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:43:38 +00:00
Joe Abbey
170a15e98d Code Custodian:
- Widespread trailing space removal
  - A dash of OCD spacing to block align enums
  - joined a line that probably needed 80 cols a while back



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-25 15:23:39 +00:00
Bill Wendling
0976e00fd1 Make the AttrListPtr object a part of the LLVMContext.
When code deletes the context, the AttributeImpls that the AttrListPtr points to
are now invalid. Therefore, instead of keeping a separate managed static for the
AttrListPtrs that's reference counted, move it into the LLVMContext and delete
it when deleting the AttributeImpls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168354 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-20 05:09:20 +00:00
Joe Abbey
e46b14acab 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168318 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 19:22:55 +00:00
Michael Ilseman
407a6169b7 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168103 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 22:34:00 +00:00
Duncan Sands
2333e29be4 Relax the restrictions on vector of pointer types, and vector getelementptr.
Previously in a vector of pointers, the pointer couldn't be any pointer type,
it had to be a pointer to an integer or floating point type.  This is a hassle
for dragonegg because the GCC vectorizer happily produces vectors of pointers
where the pointer is a pointer to a struct or whatever.  Vector getelementptr
was restricted to just one index, but now that vectors of pointers can have
any pointer type it is more natural to allow arbitrary vector getelementptrs.
There is however the issue of struct GEPs, where if each lane chose different
struct fields then from that point on each lane will be working down into
unrelated types.  This seems like too much pain for too little gain, so when
you have a vector struct index all the elements are required to be the same.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167828 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 12:59:33 +00:00
Bill Wendling
702cc91aa1 Move the Attributes::Builder outside of the Attributes class and into its own class named AttrBuilder. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165960 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15 20:35:56 +00:00
Bill Wendling
cb3de0bc80 Attributes Rewrite
Convert the internal representation of the Attributes class into a pointer to an
opaque object that's uniqued by and stored in the LLVMContext object. The
Attributes class then becomes a thin wrapper around this opaque
object. Eventually, the internal representation will be expanded to include
attributes that represent code generation options, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165917 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15 04:46:55 +00:00
Sean Silva
ed84062812 Remove unnecessary classof()'s
isa<> et al. automatically infer when the cast is an upcast (including a
self-cast), so these are no longer necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165767 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 23:30:49 +00:00
Jan Wen Voung
7b8d94933d Fix some typos 165739, spotted by Duncan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165753 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 21:45:16 +00:00
Jan Wen Voung
d9a3bad448 Change encoding of instruction operands in bitcode binaries to be relative
to the instruction position.  The old encoding would give an absolute
ID which counts up within a function, and only resets at the next function.

I.e., Instead of having:

... = icmp eq i32 n-1, n-2
br i1 ..., label %bb1, label %bb2

it will now be roughly:

... = icmp eq i32 1, 2
br i1 1, label %bb1, label %bb2

This makes it so that ids remain relatively small and can be encoded
in fewer bits.

With this encoding, forward reference operands will be given
negative-valued IDs.  Use signed VBRs for the most common case
of forward references, which is phi instructions.

To retain backward compatibility we bump the bitcode version
from 0 to 1 to distinguish between the different encodings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165739 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 20:20:40 +00:00
Bill Wendling
47a3395d1d Use method to query if there are attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165213 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-04 07:19:46 +00:00
Bill Wendling
2039a8f834 Move remaining methods inside the Attributes class. Merge the 'Attribute' namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164631 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 20:57:48 +00:00
Benjamin Kramer
122f5e5a5b BitcodeReader: Correctly insert blockaddress constant referring to a already parsed function.
We inserted a placeholder that was never replaced because the function was
already visited. Assert that all placeholders have been resolved when tearing
down the bitcode reader.

Fixes PR13895.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164369 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-21 14:34:31 +00:00
Craig Topper
86a1c32e67 Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163974 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-15 17:09:36 +00:00
Roman Divacky
5177b3a8c4 Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163324 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 15:42:13 +00:00
Chad Rosier
581600bfc3 [ms-inline asm] Enumerate the InlineAsm dialects and rename the nsdialect to
inteldialect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163231 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05 19:00:49 +00:00
Chad Rosier
27b25c2076 Add a FIXME that assumes we maintain backward compatibility until the next major release.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163195 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05 06:28:52 +00:00
Chad Rosier
f16ae58891 [ms-inline asm] Add support for the nsdialect keyword in the Bitcode
Reader/Writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163185 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05 00:56:20 +00:00
Bill Wendling
32811bef95 Change the linker_private_weak_def_auto' linkage to linkonce_odr_auto_hide' to
make it more consistent with its intended semantics.

The `linker_private_weak_def_auto' linkage type was meant to automatically hide
globals which never had their addresses taken. It has nothing to do with the
`linker_private' linkage type, which outputs the symbols with a `l' (ell) prefix
among other things.

The intended semantic is more like the `linkonce_odr' linkage type.

Change the name of the linkage type to `linkonce_odr_auto_hide'. And therefore
changing the semantics so that it produces the correct output for the linker.

Note: The old linkage name `linker_private_weak_def_auto' will still parse but
is not a synonym for `linkonce_odr_auto_hide'. This should be removed in 4.0.
<rdar://problem/11754934>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162114 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17 18:33:14 +00:00
Bill Wendling
2127c9b93a Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160479 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 00:15:11 +00:00
NAKAMURA Takumi
d5c407d2d0 llvm/lib: [CMake] Add explicit dependency to intrinsics_gen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159112 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-24 13:32:01 +00:00
Hans Wennborg
ce718ff9f4 Extend the IL for selecting TLS models (PR9788)
This allows the user/front-end to specify a model that is better
than what LLVM would choose by default. For example, a variable
might be declared as

  @x = thread_local(initialexec) global i32 42

if it will not be used in a shared library that is dlopen'ed.

If the specified model isn't supported by the target, or if LLVM can
make a better choice, a different model may be used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159077 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-23 11:37:03 +00:00
Stepan Dyatkovskiy
47cbc4e0ee Optimized usage of new SwitchInst case values (IntegersSubset type) in Local.cpp, Execution.cpp and BitcodeWriter.cpp.
I got about 1% of compile-time improvement on my machines (Ubuntu 11.10 i386 and Ubuntu 12.04 x64).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159076 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-23 10:58:58 +00:00
Stepan Dyatkovskiy
43eb31bfae PR1255: case ranges.
IntRange converted from struct to class. So main change everywhere is replacement of ".Low/High" with ".getLow/getHigh()"



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157884 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-02 09:42:43 +00:00
Stepan Dyatkovskiy
0aa32d5d0f ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to IntegersSubsetMapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157612 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-29 12:26:47 +00:00
David Blaikie
21280e48c0 Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157586 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-28 18:23:36 +00:00
Meador Inge
e99f8be067 PR12696: Attribute bits above 1<<30 are not encoded in bitcode
Attribute bits above 1<<30 are now encoded correctly.  Additionally,
the encoding/decoding functionality has been hoisted to helper functions
in Attributes.h in an effort to help the encoding/decoding to stay in
sync with the Attribute bitcode definitions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157581 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-28 15:45:43 +00:00
Benjamin Kramer
f52aea8bc2 Random BitcodeReader cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157577 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-28 14:10:31 +00:00
Stepan Dyatkovskiy
484fc93eff PR1255: Case Ranges
Implemented IntItem - the wrapper around APInt. Why not to use APInt item directly right now?
1. It will very difficult to implement case ranges as series of small patches. We got several large and heavy patches. Each patch will about 90-120 kb. If you replace ConstantInt with APInt in SwitchInst you will need to changes at the same time all Readers,Writers and absolutely all passes that uses SwitchInst.
2. We can implement APInt pool inside and save memory space. E.g. we use several switches that works with 256 bit items (switch on signatures, or strings). We can avoid value duplicates in this case.
3. IntItem can be easyly easily replaced with APInt.
4. Currenly we can interpret IntItem both as ConstantInt and as APInt. It allows to provide SwitchInst methods that works with ConstantInt for non-updated passes.

Why I need it right now? Currently I need to update SimplifyCFG pass (EqualityComparisons). I need to work with APInts directly a lot, so peaces of code
ConstantInt *V = ...;
if (V->getValue().ugt(AnotherV->getValue()) {
  ...
}
will look awful. Much more better this way:
IntItem V = ConstantIntVal->getValue();
if (AnotherV < V) {
}

Of course any reviews are welcome.

P.S.: I'm also going to rename ConstantRangesSet to IntegersSubset, and CRSBuilder to IntegersSubsetMapping (allows to map individual subsets of integers to the BasicBlocks).
Since in future these classes will founded on APInt, it will possible to use them in more generic ways.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157576 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-28 12:39:09 +00:00
Chris Lattner
d509d0b532 switch AttrListPtr::get to take an ArrayRef, simplifying a lot of clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157556 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-28 01:47:44 +00:00
Nuno Lopes
ee8100d70a revert r156383: removal of TYPE_CODE_FUNCTION_OLD
Apparently LLVM only stopped emitting this after LLVM 3.0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 15:19:39 +00:00
Stepan Dyatkovskiy
734dde8e05 SwitchInst cosmetics: renamed "Hash" method to "hash"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156757 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-14 08:26:31 +00:00
Stepan Dyatkovskiy
1cce5bf8ef Recommited r156374 with critical fixes in BitcodeReader/Writer:
Ordinary patch for PR1255.
Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object.
Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156704 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-12 10:48:17 +00:00
Nuno Lopes
006c7b969a remove autoupgrade code for old function attributes format.
I still left another fixme regarding alignment, because I'm unsure how to remove that code without breaking things

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156387 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08 17:07:35 +00:00
Nuno Lopes
f647c1b777 remove TYPE_CODE_FUNCTION_OLD type code. it is no longer in use and it was marked for removal in 3.0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156383 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08 16:16:20 +00:00
Stepan Dyatkovskiy
1f9838347f Rejected r156374: Ordinary PR1255 patch. Due to clang-x86_64-debian-fnt buildbot failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156377 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08 08:33:21 +00:00
Stepan Dyatkovskiy
85a4406959 Ordinary patch for PR1255.
Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object.
Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156374 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08 06:36:08 +00:00
Stepan Dyatkovskiy
3d3abe0852 llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152532 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 06:09:17 +00:00
Stepan Dyatkovskiy
c10fa6c801 Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 07:06:20 +00:00
Daniel Dunbar
acbceeae4d BitstreamWriter: Change primary output buffer to be a SmallVector instead of an
std::vector.
 - Good for 1-2% speedup on writing PCH for Cocoa.h.
 - Clang side API match to follow shortly, there wasn't an easy way to make this
   non-breaking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151750 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 20:31:09 +00:00
Daniel Dunbar
02a248afe3 BitcodeWriter: Expose less implementation details -- make BackpatchWord private
and remove getBuffer().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151748 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 20:31:01 +00:00
Daniel Dunbar
fdc8f785cd Bitcode: Don't expose WriteBitcodeToStream to clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151747 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 20:30:56 +00:00
Derek Schuff
0ffe698429 Fix PR12080 by ensuring that MaterializeModule actually reads all the bitcode
in the streaming case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 00:07:09 +00:00
Derek Schuff
2ea93875b2 Enable streaming of bitcode
This CL delays reading of function bodies from initial parse until
materialization, allowing overlap of compilation with bitcode download.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-06 22:30:29 +00:00
Bill Wendling
3e9719e1f3 [unwind removal] Don't write out the dead 'unwind' instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149905 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-06 21:30:37 +00:00
Bill Wendling
e185fada9b [unwind removal] Remove the 'unwind' instruction parsing bits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149897 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-06 20:50:27 +00:00
Derek Schuff
fccf0623ee Test commit; also removes some trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149887 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-06 19:03:04 +00:00
Chris Lattner
2237f84735 Improve the bitcode reader's handling of constant strings to use
ConstantDataArray::getString direction, instead of "boxing" each
byte into a ConstantInt and using ConstantArray::get.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149805 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 02:41:35 +00:00
Chris Lattner
18c7f80b3e reapply the patches reverted in r149470 that reenable ConstantDataArray,
but with a critical fix to the SelectionDAG code that optimizes copies
from strings into immediate stores: the previous code was stopping reading
string data at the first nul.  Address this by adding a new argument to
llvm::getConstantStringInfo, preserving the behavior before the patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149800 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 02:29:43 +00:00
Stepan Dyatkovskiy
24473120a2 SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 07:49:51 +00:00
Argyrios Kyrtzidis
91766fe066 Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail.
These are:

r149348
r149351
r149352
r149354
r149356
r149357
r149361
r149362
r149364
r149365

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149470 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 04:51:17 +00:00
Chris Lattner
1b2f643753 with recent changes, ConstantArray is never a "string". Remove the associated
methods and constant fold the clients to false.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149362 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 06:05:00 +00:00
Chris Lattner
41b9920a13 fix a major oversight that is breaking some llvm-test tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149230 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30 07:36:01 +00:00