summaryrefslogtreecommitdiff
path: root/lib/IR/Attributes.cpp
Commit message (Collapse)AuthorAge
* Add a new attribute called 'jumptable' that creates jump-instruction tables ↵Tom Roeder2014-06-05
| | | | | | | | | | | | | for functions marked with this attribute. It includes a pass that rewrites all indirect calls to jumptable functions to pass through these tables. This also adds backend support for generating the jump-instruction tables on ARM and X86. Note that since the jumptable attribute creates a second function pointer for a function, any function marked with jumptable must also be marked with unnamed_addr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210280 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'nonnull', a new parameter and return attribute which indicates that the ↵Nick Lewycky2014-05-20
| | | | | | pointer is not null. Instcombine will elide comparisons between these and null. Patch by Luqman Aden! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209185 91177308-0d34-0410-b5e6-96231b3b80d8
* IR: Cleanup AttributeSet::get for AttrBuilderDavid Majnemer2014-05-03
| | | | | | | We don't modify the AttrBuilder in AttributeSet::get, make the reference argument const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207924 91177308-0d34-0410-b5e6-96231b3b80d8
* Retire llvm::array_endof in favor of non-member std::end.Benjamin Kramer2014-04-12
| | | | | | While there make array_lengthof constexpr if we have support for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206112 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-09
| | | | | | check instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205831 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[C++11] Replace LLVM atomics with std::atomic."Benjamin Kramer2014-03-03
| | | | | | | Breaks the MSVC build. DataStream.cpp(44): error C2552: 'llvm::Statistic::Value' : non-aggregates cannot be initialized with initializer list git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202731 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace LLVM atomics with std::atomic.Benjamin Kramer2014-03-03
| | | | | | | | | | | With C++11 we finally have a standardized way to specify atomic operations. Use them to replace the existing custom implemention. Sadly the translation is not entirely trivial as std::atomic allows more fine-grained control over the atomicity. I tried to preserve the old semantics as well as possible. Differential Revision: http://llvm-reviews.chandlerc.com/D2915 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202730 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin adding docs and IR-level support for the inalloca attributeReid Kleckner2013-12-19
| | | | | | | | | | | | | | | | | | | The inalloca attribute is designed to support passing C++ objects by value in the Microsoft C++ ABI. It behaves the same as byval, except that it always implies that the argument is in memory and that the bytes are never copied. This attribute allows the caller to take the address of an outgoing argument's memory and execute arbitrary code to store into it. This patch adds basic IR support, docs, and verification. It does not attempt to implement any lowering or fix any possibly broken transforms. When this patch lands, a complete description of this feature should appear at http://llvm.org/docs/InAlloca.html . Differential Revision: http://llvm-reviews.chandlerc.com/D2173 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197645 91177308-0d34-0410-b5e6-96231b3b80d8
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-19
| | | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r194865 and r194874.Alexey Samsonov2013-11-18
| | | | | | | | | | | | | This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-15
| | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8
* Add function attribute 'optnone'.Andrea Di Biagio2013-08-23
| | | | | | | | | | This function attribute indicates that the function is not optimized by any optimization or code generator passes with the exception of interprocedural optimization passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189101 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a AttributeSetImpl::dump function.Peter Collingbourne2013-08-02
| | | | | | | This is for the benefit of those of us with inferior debuggers which do not permit member function calls on value types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187685 91177308-0d34-0410-b5e6-96231b3b80d8
* Make one of the AttributeSet ctors maintain the invariant that thePeter Collingbourne2013-08-02
| | | | | | | | attribute list is ordered by index. Differential Revision: http://llvm-reviews.chandlerc.com/D1265 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187682 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a way to add a kind-value string pair to an attribute.Bill Wendling2013-07-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187138 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the "NoFramePointerElimNonLeaf" target option with a function attribute.Bill Wendling2013-07-25
| | | | | | | | | There's no need to specify a flag to omit frame pointer elimination on non-leaf nodes...(Honestly, I can't parse that option out.) Use the function attribute stuff instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187093 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce the number of indirections in the attributes implementation.Benjamin Kramer2013-07-11
| | | | | | | | | | | - Coallocate entires for AttributeSetImpls and Nodes after the class itself. - Remove mutable iterators from immutable classes. - Remove unused context field from AttributeImpl. - Derive Enum/Align/String attribute implementations from AttributeImpl instead of having a whole new inheritance tree for them. - Derive AlignAttributeImpl from EnumAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186075 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend 'readonly' and 'readnone' to work on function arguments as well asNick Lewycky2013-07-06
| | | | | | | | functions. Make the function attributes pass add it to known library functions and when it can deduce it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185735 91177308-0d34-0410-b5e6-96231b3b80d8
* Added support for the Builtin attribute.Michael Gottesman2013-06-27
| | | | | | | | The Builtin attribute is an attribute that can be placed on function call site that signal that even though a function is declared as being a builtin, rdar://problem/13727199 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185049 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new function attribute 'cold' to functions.Diego Novillo2013-05-24
| | | | | | | | | | | Other than recognizing the attribute, the patch does little else. It changes the branch probability analyzer so that edges into blocks postdominated by a cold function are given low weight. Added analysis and code generation tests. Added documentation for the new attribute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182638 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that the underlying issue is fixed, revert r180750 and r180722.Rafael Espindola2013-05-01
| | | | | | | | | | | The cause of the windows failures was fixed by r180791. Revert to the state after Sabre's original revert. Original message: revert r179735, it has no testcases, and doesn't really make sense. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180844 91177308-0d34-0410-b5e6-96231b3b80d8
* Change getSlotIndex to return unsigned.Rafael Espindola2013-04-30
| | | | | | | | | | | The actual storage was already using unsigned, but the interface was using uint64_t. This is wasteful on 32 bits and looks to be the root causes of a miscompilation on Windows where a value was being sign extended to 64bits to compare with the result of getSlotIndex. Patch by Pasi Parviainen! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180791 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the command line option patch. However, keep the part that makes this ↵Bill Wendling2013-04-29
| | | | | | pass on Windows. I.e., we don't emit the target dependent attributes in a comment before the function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180750 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "revert r179735, it has no testcases, and doesn't really make sense."Reid Kleckner2013-04-29
| | | | | | | | | | This un-reverts r179735 and reverts commit r180574. This fixes assertion failures for me locally and should fix the failures on Windows reported widely on llvm-dev. We should check if the bots caught this and if so why not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180722 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r179735, it has no testcases, and doesn't really make sense.Chris Lattner2013-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180574 91177308-0d34-0410-b5e6-96231b3b80d8
* Add CodeGen support for functions that always return arguments via a new ↵Stephen Lin2013-04-20
| | | | | | parameter attribute 'returned', which is taken advantage of in target-independent tail call opportunity detection and in ARM call lowering (when placed on an integral first parameter). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179925 91177308-0d34-0410-b5e6-96231b3b80d8
* Attributes: Don't print trailing whitespace on the function attribute comment.Benjamin Kramer2013-04-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179849 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the TargetIndependent flag have the right boolean value.Bill Wendling2013-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179798 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup patch:Bill Wendling2013-04-18
| | | | | | | | | | | | | | | | Semantics of parameters named Index and Idx were inconsistent between "include/llvm/IR/Attributes.h", "lib/IR/AttributeImpl.h" and "lib/IR/Attributes.cpp": sometimes these were fixed 1-based indexes of IR parameters (or AttributeSet::ReturnIndex for IR return values or AttributeSet::FunctionIndex for IR functions), other times they were the internal slot for storage in the underlying AttributeSetImpl. I renamed usage of the former to "Index" and usage of the latter to "Slot" ("Slot" was already being used consistently for the latter in a subset of cases) Patch by Stephen Lin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179791 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch addresses two cleanup issues:Bill Wendling2013-04-18
| | | | | | | | | | | | | | | | | 1. Verify::VerifyParameterAttrs in "lib/IR/Verifier.cpp" and AttrBuilder::removeFunctionOnlyAttrs in "lib/IR/Attributes.cpp" (only called by Verify::VerifyFunctionAttrs) separately maintained a list of function-only attribute types. I've consolidated the logic into a new function used for both cases in "lib/IR/Verifier.cpp", so this logic is in one place (other than the AsmParser front-end) 2. Various functions in "lib/IR/Verifier.cpp" passed AttributeSet around by reference needlessly, as it's just a handle to an immutable pimpl body. Patch by Stephen Lin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179790 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an option `-enable-old-style-attr-syntax' to print out function ↵Bill Wendling2013-04-17
| | | | | | | | | | | attributes in the "old" style. It's sometimes beneficial to emit a testcase with the old style attribute syntax. Allow someone to do this. <rdar://problem/13563209> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179735 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some additonal attribute helper functions. Test will be on followReed Kotler2013-03-13
| | | | | | | | up putback to clang for mips16. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176968 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't add an attribute that already exists and don't remove an attribute ↵Bill Wendling2013-02-28
| | | | | | that doesn't exist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176289 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify clang/llvm attributes for asan/tsan/msan (LLVM part)Kostya Serebryany2013-02-26
| | | | | | | | | | | | | | | | | | | | 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
* Remove warning about default covering no cases.Bill Wendling2013-02-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175846 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a bitmask for NoBuiltin. This should *not* be used.Bill Wendling2013-02-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175843 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the NoBuiltin attribute.Bill Wendling2013-02-22
| | | | | | | | | 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
* Futureproof AttrBuild if we ever have more than 64 attr enum values.Benjamin Kramer2013-02-18
| | | | | | | 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
* GCC doesn't like ++ on enums.Benjamin Kramer2013-02-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175373 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn the enum attributes DenseSet in AttrBuilder into a set of bits.Benjamin Kramer2013-02-16
| | | | | | | | 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
* Simplify the 'operator<' for the attribute object.Bill Wendling2013-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175252 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Simplify the attributes '<' comparison function."Anna Zaks2013-02-15
| | | | | | This reverts commit 82c101153fe7b35bce48781fab038e1b8f31a7bd. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175250 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify the attributes '<' comparison function.Bill Wendling2013-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175235 91177308-0d34-0410-b5e6-96231b3b80d8
* Use array_pod_sort.Bill Wendling2013-02-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175048 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some accessor and query methods for retrieving Attribute objects and such.Bill Wendling2013-02-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175046 91177308-0d34-0410-b5e6-96231b3b80d8
* Support string attributes in the AttrBuilder.Bill Wendling2013-02-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174948 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for printing out the attribute groups.Bill Wendling2013-02-11
| | | | | | | | | | | | | 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
* [tsan/msan] adding thread_safety and uninitialized_checks attributesKostya Serebryany2013-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174864 91177308-0d34-0410-b5e6-96231b3b80d8
* The 'Raw' method cannot handle 'string' attributes. Don't even try.Bill Wendling2013-02-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174848 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle string attributes in the AttrBuilder.Bill Wendling2013-02-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174834 91177308-0d34-0410-b5e6-96231b3b80d8