Commit Graph

83 Commits

Author SHA1 Message Date
Benjamin Kramer
c835b8c301 Turn the enum attributes DenseSet in AttrBuilder into a set of bits.
Avoids malloc and is a lot denser. We lose iteration over target independent
attributes, but that's a strange interface anyways and didn't have any users
outside of AttrBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175370 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-16 19:13:18 +00:00
Bill Wendling
0e9d5d059c Add some accessor and query methods for retrieving Attribute objects and such.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175046 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-13 08:42:21 +00:00
Bill Wendling
ad19d9c422 Add a default empty string to the 'value' of a string attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175016 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12 23:14:31 +00:00
Bill Wendling
b29ce26ea6 Add support for printing out the attribute groups.
This emits the attribute groups that are used by the functions. (It currently
doesn't print out return type or parameter attributes within attribute groups.)

Note: The functions still retrieve their attributes from the "old" bitcode
format (using the deprecated 'Raw()' method). This means that string attributes
within an attribute group will not show up during a disassembly. This will be
addressed in a future commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174867 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11 08:43:33 +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
Bill Wendling
87de71cb9f Add 'empty' query methods to the builder and use them in the verifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174832 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 10:12:06 +00:00
Bill Wendling
85b3fbecdf Add accessor for the LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174824 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 05:00:40 +00:00
Bill Wendling
16274258d1 Add a DenseMapInfo class for the AttributeSet.
We are going to place the AttributeSet into a DenseMap during assembly writing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174812 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-09 15:42:51 +00:00
Bill Wendling
c3662eeaa4 Improve comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174536 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 20:05:44 +00:00
Bill Wendling
c342d9d345 Add a 'StringRef' version of hasAttribute.
Fix the 'operator==' and 'hasAttributes' queries to take into account
target-dependent attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174481 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 01:33:42 +00:00
Bill Wendling
85df6b4340 Add methods to merge an AttrBuilder into another builder.
This is useful when parsing an object that references multiple attribute groups.

N.B. If both builders have alignments specified, then they should match!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174480 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 01:16:00 +00:00
Bill Wendling
64754f4990 Add the target-dependent (string) attributes from the AttrBuilder to the AttributeSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174467 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 23:48:36 +00:00
Bill Wendling
8c74ecfbdd Convert to storing the attribute's internals as enums, integers, and strings.
The stuff we're handing are all enums (Attribute::AttrKind), integers and
strings. Don't convert them to Constants, which is an unnecessary step here. The
rest of the changes are mostly mechanical.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174456 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:37:24 +00:00
Bill Wendling
ea59f896a6 Add target-dependent versions of addAttribute/removeAttribute to AttrBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174356 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 08:09:32 +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
fca0ed28c8 Remove AttrBuilder::Raw().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174251 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02 00:52:44 +00:00
Bill Wendling
5a4041e728 Change the AttributeImpl to hold a single Constant* for the values.
This Constant could be an aggregate to represent multiple values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174228 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01 22:32:30 +00:00
Bill Wendling
f715dbd263 Remove one of the odious 'Raw' methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174130 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01 00:48:14 +00:00
Bill Wendling
16c4b3cf29 Add iterators to the AttributeSet class so that we can access the Attributes in a nice way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174120 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 23:53:05 +00:00
Bill Wendling
39da078977 s/AttrBuilder::addAttributes/AttrBuilder::addAttribute/g because that's more descriptive of what it actually is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174116 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 23:38:01 +00:00
Bill Wendling
169d527075 Remove the AttrBuilder form of the Attribute::get creators.
The AttrBuilder is for building a collection of attributes. The Attribute object
holds only one attribute. So it's not really useful for the Attribute object to
have a creator which takes an AttrBuilder.

This has two fallouts:

1. The AttrBuilder no longer holds its internal attributes in a bit-mask form.
2. The attributes are now ordered alphabetically (hence why the tests have changed).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174110 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 23:16:25 +00:00
Bill Wendling
82aea644c6 Remove the Attribute::hasAttributes() function.
That function doesn't make sense anymore because there's only one attribute per
Attribute object now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 06:22:35 +00:00
NAKAMURA Takumi
eddab1550e Revert r174026, "Remove Attribute::hasAttributes() and make Attribute::hasAttribute() private."
It broke many hosts to crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174035 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 03:47:28 +00:00
Bill Wendling
85238aae1a Remove Attribute::hasAttributes() and make Attribute::hasAttribute() private.
The Attribute::hasAttributes() is kind of meaningless since an Attribute can
have only one attribute. And we would rather people use the 'operator=='
instead of Attribute::hasAttribute().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174026 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 02:18:19 +00:00
Bill Wendling
8ed701da9a Make the AttrBuilder creation method of Attribute private so that people won't use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174023 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 01:51:27 +00:00
Bill Wendling
b96129dd48 Revert for now:
--- Reverse-merging r174010 into '.':
U    include/llvm/IR/Attributes.h
U    lib/IR/Verifier.cpp
U    lib/IR/Attributes.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174012 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 01:04:51 +00:00
Bill Wendling
c6077eff8b Remove the AttrBuilder version of the Attribute::get function.
The AttrBuilder is there to build up multiple attributes. The Attribute class
represents only one attribute at a time. So remove this unnecessary builder
creator method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174010 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 00:53:21 +00:00
Bill Wendling
73dee180c8 Make sure that the Attribute object represents one attribute only.
Several places were still treating the Attribute object as respresenting
multiple attributes. Those places now use the AttributeSet to represent
multiple attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174003 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 00:29:54 +00:00
Bill Wendling
ac72eb264c Remove addRetAttributes and addFnAttributes, which aren't useful abstractions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173992 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 23:40:31 +00:00
Bill Wendling
e74365462a Convert typeIncompatible to return an AttributeSet.
There are still places which treat the Attribute object as a collection of
attributes. I'm systematically removing them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173990 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 23:07:40 +00:00
Bill Wendling
aa57893e84 Use the number of 'slots' in the AttributeSetImpl being 0 to indicate that the AttributeSet is empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173962 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 19:39:21 +00:00
Bill Wendling
6dc3781d44 Add a couple of accessor methods to get the kind and values of an attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173828 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 20:45:34 +00:00
Bill Wendling
606c8e36df Convert getAttributes() to return an AttributeSetNode.
The AttributeSetNode contains all of the attributes. This removes one (hopefully
last) use of the Attribute class as a container of multiple attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173761 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 03:20:31 +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
817abdd8b0 S'more small non-functional changes in comments and #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173738 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 00:48:16 +00:00
Bill Wendling
c22f4aa886 Reorder some functions and add comments. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173733 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 00:34:06 +00:00
Bill Wendling
6bdbf061c3 Try to appease some broken compilers by using 'unsigned' instead of 'uint64_t'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173725 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 22:33:39 +00:00
Bill Wendling
87e10dfefa Remove the AttributeWithIndex class.
The AttributeWithIndex class exposed the interior structure of the AttributeSet
class. That was gross. Remove it and all of the code that relied upon it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173722 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 21:55:20 +00:00
Bill Wendling
19d815c04f Mid-air collision. reapply r173656.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173661 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 05:51:40 +00:00
Bill Wendling
98b92f3bf5 Rewrite the removeAttr() method.
This now uses the AttributeSet object instead of the Attribute /
AttributeWithIndex objects. It's fairly simple now. It goes through all of the
subsets before the one we're modifying, adds them to the new set. It then adds
the modified subset (with the requested attributes removed). And then adds the
rest of the subsets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173660 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 05:44:14 +00:00
Bill Wendling
49f6060f16 Rewrite the addAttr() method.
This now uses the AttributeSet object instead of the Attribute /
AttributeWithIndex objects. It's fairly simple now. It goes through all of the
subsets before the one we're modifying, adds them to the new set. It then adds
the modified subset. And then adds the rest of the subsets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173659 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 05:23:28 +00:00
NAKAMURA Takumi
53ff78b201 Revert r173646, "Use proper type for the index."
Unfortunately, msvc miscompiles it. Investigating.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173656 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 04:29:01 +00:00
Bill Wendling
a9b9f0ad80 Use proper type for the index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173646 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 01:30:29 +00:00
Bill Wendling
3e3e789aed Use proper return type for attribute index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173639 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 23:50:44 +00:00
Bill Wendling
d05204aea4 Push the calculation of the 'Raw' attribute mask down into the implementation. It in turn uses the correct list for calculating the 'Raw' value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173637 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 23:41:29 +00:00
Bill Wendling
2d5be6c313 Don't erase these methods. They're used during testing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173636 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 22:46:17 +00:00
Bill Wendling
c08a5ef658 Add special 'get' methods to create an Attribute with an alignment. Also do some random cleanup. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173635 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 22:43:04 +00:00
Bill Wendling
ec2589863b s/AttrList/pImpl/g in AttributeSet. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173628 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 21:23:46 +00:00
Bill Wendling
16f95669ec Fix miscompile. Add back the use of the ArrayRef version of the ::get method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173613 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 10:28:39 +00:00
Bill Wendling
08c11d3023 Rearrange some deckchairs. Moving the class before it's use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173612 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 10:00:13 +00:00