Commit Graph

111 Commits

Author SHA1 Message Date
Bill Wendling
1abc00b6d1 Don't add an attribute that already exists and don't remove an attribute that doesn't exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176289 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 19:17:40 +00:00
Kostya Serebryany
8eec41fc77 Unify clang/llvm attributes for asan/tsan/msan (LLVM part)
These are two related changes (one in llvm, one in clang).
LLVM: 
- rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode)
- rename thread_safety => sanitize_thread
- rename no_uninitialized_checks -> sanitize_memory

CLANG: 
- add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis))
- add __attribute__((no_sanitize_thread))
- add __attribute__((no_sanitize_memory))

for S in address thread memory
If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not
set llvm attribute sanitize_S


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176075 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 06:58:09 +00:00
Bill Wendling
bd2acfab4a Remove warning about default covering no cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175846 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 00:50:09 +00:00
Bill Wendling
d18e0b94bf Add a bitmask for NoBuiltin. This should *not* be used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175843 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 00:40:12 +00:00
Bill Wendling
143d46476c Implement the NoBuiltin attribute.
The 'nobuiltin' attribute is applied to call sites to indicate that LLVM should
not treat the callee function as a built-in function. I.e., it shouldn't try to
replace that function with different code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175835 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 00:12:35 +00:00
Benjamin Kramer
3f213e7b3a Futureproof AttrBuild if we ever have more than 64 attr enum values.
Currently we're at 34. Bitset should compile into virtually the same code as
uint64_t here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175437 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-18 12:09:51 +00:00
Benjamin Kramer
7c1461252b GCC doesn't like ++ on enums.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175373 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-16 19:22:28 +00:00
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
94328f4ff3 Simplify the 'operator<' for the attribute object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175252 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15 05:25:26 +00:00
Anna Zaks
a7e4409bb2 Revert "Simplify the attributes '<' comparison function."
This reverts commit 82c101153fe7b35bce48781fab038e1b8f31a7bd.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175250 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15 04:15:55 +00:00
Bill Wendling
0ec707a4e5 Simplify the attributes '<' comparison function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175235 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15 00:55:08 +00:00
Bill Wendling
f107e6ca9b Use array_pod_sort.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175048 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-13 09:26:26 +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
74fe825ca5 Support string attributes in the AttrBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174948 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12 07:56:49 +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
2153691a8b The 'Raw' method cannot handle 'string' attributes. Don't even try.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174848 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 23:18:05 +00:00
Bill Wendling
09ed9101c8 Handle string attributes in the AttrBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174834 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-10 10:13:23 +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
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
bdcbccc710 Use the AttributeSet's iterators.
Use the AttributeSet's iterators in AttrBuilder::hasAttributes() when
determining of the intersection of the AttrBuilder and AttributeSet is non-null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174250 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02 00:42:06 +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
7beee28767 Remove some dead code, improve some asserts, and other assorted changes. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174132 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01 01:04:27 +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
30d2c76800 Use iterators instead of relying upon a bitmask of attributes to remove attributes from an AttrBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174123 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01 00:13:50 +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
14292a6be5 Add support for emitting a string attribute.
Attributes that are strings are typically target-dependent attributes. They are
of this form in the IR:

   "attr"
   "attr" = "val"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174090 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 20:59:05 +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
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
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
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
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