Commit Graph

104 Commits

Author SHA1 Message Date
Bill Wendling
383da6ba55 Remove redundant code.
It was creating a new AttrBuilder when we could just fill in the AttrBuilder
we're building.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173975 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 21:22:59 +00:00
Eli Bendersky
f578c89dc6 Clean up whitespace and indentation a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173960 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 19:24:23 +00:00
Bill Wendling
254aed5e22 Attempt to fix dragonegg. Use the number of slots to determine if the AttributeSet has attributes or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173902 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 06:54:41 +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
9f175f8819 s/Data/Kind/g. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173827 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 20:37:10 +00:00
NAKAMURA Takumi
3ba51cefb7 AttributeSet::get(): Fix a valgrind error. It doesn't affect actual behavior, though.
Don't touch I->first on the end iterator, I == E!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173804 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 15:18:16 +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
8fbc0c296e Convert the AttrBuilder into a list of Attributes instead of one Attribute object that holds all of its attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173742 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 01:02:03 +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
e2501f56a6 Remove another use of AttributeWithIndex, using the AttributeSetImpl accessors instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173644 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 01:11:42 +00:00
Bill Wendling
70cdaaae92 Remove another use of AttributeWithIndex, using the AttributeSetImpl accessors instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173642 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 00:46:02 +00:00
Bill Wendling
73bc452bcd Remove a use of AttributeWithIndex.
We want to remove AttributeWithIndex because it provides a non-encapsulated view
of the AttributeSetImpl object. Instead, use accessor methods and iterators.

Eventually, this code can be simplified because the Attribute object will hold
only one attribute instead of multiple attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173641 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 00:21:34 +00:00
Bill Wendling
49716e5d84 Improve the debug output a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173640 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 23:53:56 +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
5f33912f91 Use proper return type for attribute index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173638 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 23:49: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
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
1cc0d5a431 Privitize some the copy c'tor and assignment operator of uniquified objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173632 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 21:38:03 +00:00
Bill Wendling
893eac1648 Add some helpful comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173631 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 21:32:11 +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
a5372d2708 Start using more of the AttrNode in the AttributeSetImpl class.
Also add some asserts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 21:20:06 +00:00
Bill Wendling
6a325cc46d In the AttributeSetImpl c'tor, fill in the AttrNodes data structure with the attributes being passed in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173618 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 12:50:02 +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
09dda440ba Remove dead methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173611 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 09:55:44 +00:00
Bill Wendling
32a5795822 Convert BuildLibCalls.cpp to using the AttributeSet methods instead of AttributeWithIndex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173536 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-26 00:03:11 +00:00
Bill Wendling
483bbd36b8 Remove dead method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173524 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 23:14:36 +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
Bill Wendling
e1f95db480 Add an accessor method to get the slot's index. This will limit the use of AttributeWithIndex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173495 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 21:30:53 +00:00
Reid Kleckner
f86c9321fc Fix MSVC 2012 warning about a 32-bit shift that should be 64-bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173454 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 15:35:56 +00:00
Bill Wendling
a3bb665c65 Use the AttributeSet query instead of the Attribute query.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173434 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 08:08:54 +00:00
Bill Wendling
bb08593980 Add a profile for uniquifying the AttributeSet with the AttributeSetNodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173313 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 01:01:34 +00:00
Bill Wendling
8b1f2f3b70 Cleanup the AttributeSetNodes that we create.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173311 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 00:14:46 +00:00
Bill Wendling
3467e30edf Create a new class: AttributeSetNode.
This is a helper class for the AttributeSetImpl class. It holds a set of
attributes that apply to a single element: function, return type, or
parameter.

These are uniqued.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173310 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 00:06:56 +00:00
Bill Wendling
a8ab5fc772 Push down the conversion of the alignment from the bit mask to a real number into the attribute implementation class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173304 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 23:00:05 +00:00
Bill Wendling
2915a691b9 Remove dead methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173302 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 22:38:33 +00:00
Bill Wendling
114baee1fa Add the IR attribute 'sspstrong'.
SSPStrong applies a heuristic to insert stack protectors in these situations:

* A Protector is required for functions which contain an array, regardless of
  type or length.

* A Protector is required for functions which contain a structure/union which
  contains an array, regardless of type or length.  Note, there is no limit to
  the depth of nesting.

* A protector is required when the address of a local variable (i.e., stack
  based variable) is exposed. (E.g., such as through a local whose address is
  taken as part of the RHS of an assignment or a local whose address is taken as
  part of a function argument.)

This patch implements the SSPString attribute to be equivalent to
SSPRequired. This will change in a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173230 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 06:41:41 +00:00
Bill Wendling
28d65722d6 Remove the last of uses that use the Attribute object as a collection of attributes.
Collections of attributes are handled via the AttributeSet class now. This
finally frees us up to make significant changes to how attributes are structured.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173228 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 06:14:59 +00:00
Bill Wendling
8246df61f6 Use the AttributeSet when removing multiple attributes. Use Attribute::AttrKind
when removing one attribute. This further encapsulates the use of the attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173214 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 00:45:55 +00:00
Bill Wendling
70d2ca0725 Use the AttributeSet when adding multiple attributes and an Attribute::AttrKind
when adding a single attribute to the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173210 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 00:20:53 +00:00
Bill Wendling
defaca00b8 More encapsulation work.
Use the AttributeSet when we're talking about more than one attribute. Add a
function that adds a single attribute. No functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173196 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 21:15:51 +00:00