summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AttributeImpl.h
Commit message (Collapse)AuthorAgeFilesLines
* [Alignment][NFC] Attributes use Align/MaybeAlignGuillaume Chatelet2019-10-221-2/+2
| | | | | | | | | | | | | | | | | Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: jholewinski, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69278 llvm-svn: 375495
* Fix analyzer TypeAttributeImpl::anchor() override.Simon Pilgrim2019-09-251-1/+1
| | | | | | TypeAttributeImpl inherits from EnumAttributeImpl which already defines anchor() as a virtual, so we should override this instead of redeclaring it. llvm-svn: 372877
* Extend function attributes bitset size from 64 to 96.Evgeniy Stepanov2019-07-131-6/+6
| | | | | | | | | | | | | | Summary: We are going to add a function attribute number 64. Reviewers: pcc, jdoerfert, lebedev.ri Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64663 llvm-svn: 365980
* Reapply: IR: add optional type to 'byval' function parametersTim Northover2019-05-301-3/+29
| | | | | | | | | | | | | | | | | When we switch to opaque pointer types we will need some way to describe how many bytes a 'byval' parameter should occupy on the stack. This adds a (for now) optional extra type parameter. If present, the type must match the pointee type of the argument. The original commit did not remap byval types when linking modules, which broke LTO. This version fixes that. Note to front-end maintainers: if this causes test failures, it's probably because the "byval" attribute is printed after attributes without any parameter after this change. llvm-svn: 362128
* Revert "IR: add optional type to 'byval' function parameters"Tim Northover2019-05-291-29/+3
| | | | | | | The IRLinker doesn't delve into the new byval attribute when mapping types, and this breaks LTO. llvm-svn: 362029
* IR: add optional type to 'byval' function parametersTim Northover2019-05-291-3/+29
| | | | | | | | | | | | | | When we switch to opaque pointer types we will need some way to describe how many bytes a 'byval' parameter should occupy on the stack. This adds a (for now) optional extra type parameter. If present, the type must match the pointee type of the argument. Note to front-end maintainers: if this causes test failures, it's probably because the "byval" attribute is printed after attributes without any parameter after this change. llvm-svn: 362012
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-9/+9
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* [IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).Eugene Zelenko2017-06-191-1/+4
| | | | llvm-svn: 305755
* [IR] Switch AttributeList to use an array for O(1) accessReid Kleckner2017-05-231-38/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this change, AttributeLists stored a pair of index and AttributeSet. This is memory efficient if most arguments do not have attributes. However, it requires doing a search over the pairs to test an argument or function attribute. Profiling shows that this loop was 0.76% of the time in 'opt -O2' of sqlite3.c, because LLVM constantly tests values for nullability. This was worth about 2.5% of mid-level optimization cycles on the sqlite3 amalgamation. Here are the full perf results: https://reviews.llvm.org/P7995 Here are just the before and after cycle counts: ``` $ perf stat -r 5 ./opt_before -O2 sqlite3.bc -o /dev/null 13,274,181,184 cycles # 3.047 GHz ( +- 0.28% ) $ perf stat -r 5 ./opt_after -O2 sqlite3.bc -o /dev/null 12,906,927,263 cycles # 3.043 GHz ( +- 0.51% ) ``` This patch *does not* change the indices used to query attributes, as requested by reviewers. Tracking whether an index is usable for array indexing is a huge pain that affects many of the internal APIs, so it would be good to come back later and do a cleanup to remove this internal adjustment. Reviewers: pete, chandlerc Subscribers: javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D32819 llvm-svn: 303654
* [IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).Eugene Zelenko2017-05-151-7/+11
| | | | llvm-svn: 303119
* Make getSlotAttributes return an AttributeSet instead of a wrapper listReid Kleckner2017-04-241-10/+5
| | | | | | | | Remove the temporary, poorly named getSlotSet method which did the same thing. Also remove getSlotNode, which is a hold-over from when we were dealing with AttributeSetNode* instead of AttributeSet. llvm-svn: 301267
* [IR] Add AttributeSet to hide AttributeSetNode* again, NFCReid Kleckner2017-04-121-17/+74
| | | | | | | | | | | | | | | | | Summary: For now, it just wraps AttributeSetNode*. Eventually, it will hold AvailableAttrs as an inline bitset, and adding and removing enum attributes will be super cheap. This sinks AttributeSetNode back down to lib/IR/AttributeImpl.h. Reviewers: pete, chandlerc Subscribers: llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D31940 llvm-svn: 300014
* [IR] Sink some AttributeListImpl methods out of headers NFCReid Kleckner2017-04-111-41/+3
| | | | llvm-svn: 299906
* Reland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"Reid Kleckner2017-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This re-lands r299875. I introduced a bug in Clang code responsible for replacing K&R, no prototype declarations with a real function definition with a prototype. The bug was here: // Collect any return attributes from the call. - if (oldAttrs.hasAttributes(llvm::AttributeList::ReturnIndex)) - newAttrs.push_back(llvm::AttributeList::get(newFn->getContext(), - oldAttrs.getRetAttributes())); + newAttrs.push_back(oldAttrs.getRetAttributes()); Previously getRetAttributes() carried AttributeList::ReturnIndex in its AttributeList. Now that we return the AttributeSetNode* directly, it no longer carries that index, and we call this overload with a single node: AttributeList::get(LLVMContext&, ArrayRef<AttributeSetNode*>) That aborted with an assertion on x86_32 targets. I added an explicit triple to the test and added CHECKs to help find issues like this in the future sooner. llvm-svn: 299899
* Revert "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"Reid Kleckner2017-04-101-1/+1
| | | | | | | This reverts r299875. A Linux bot came back with a test failure: http://bb.pgr.jp/builders/test-clang-i686-linux-RA/builds/741/steps/test_clang/logs/Clang%20%3A%3A%20CodeGen__2006-05-19-SingleEltReturn.c llvm-svn: 299878
* [IR] Make AttributeSetNode public, avoid temporary AttributeList copiesReid Kleckner2017-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: AttributeList::get(Fn|Ret|Param)Attributes no longer creates a temporary AttributeList just to hide the AttributeSetNode type. I've also added a factory method to create AttributeLists from a parallel array of AttributeSetNodes. I think this simplifies construction of AttributeLists when rewriting function prototypes. Previously we would test if a particular index had attributes, and conditionally add a temporary attribute list to a vector. Now the attribute set vector is parallel to the argument vector already that these passes already construct. My long term vision is to wrap AttributeSetNode* inside an AttributeSet type that holds the enum attributes, but that will come in a follow up change. I haven't done any performance measurements for this change because profiling hasn't shown that any of the affected code is hot. Reviewers: pete, chandlerc, sanjoy, hfinkel Reviewed By: pete Subscribers: jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D31198 llvm-svn: 299875
* Rename AttributeSet to AttributeListReid Kleckner2017-03-211-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class is a list of AttributeSetNodes corresponding the function prototype of a call or function declaration. This class used to be called ParamAttrListPtr, then AttrListPtr, then AttributeSet. It is typically accessed by parameter and return value index, so "AttributeList" seems like a more intuitive name. Rename AttributeSetImpl to AttributeListImpl to follow suit. It's useful to rename this class so that we can rename AttributeSetNode to AttributeSet later. AttributeSet is the set of attributes that apply to a single function, argument, or return value. Reviewers: sanjoy, javed.absar, chandlerc, pete Reviewed By: pete Subscribers: pete, jholewinski, arsenm, dschuff, mehdi_amini, jfb, nhaehnle, sbc100, void, llvm-commits Differential Revision: https://reviews.llvm.org/D31102 llvm-svn: 298393
* [ADT, IR] Fix some Clang-tidy modernize-use-equals-delete and Include What ↵Eugene Zelenko2016-12-071-18/+24
| | | | | | You Use warnings; other minor fixes (NFC). llvm-svn: 288989
* Kill deprecated attribute APIAmaury Sechet2016-11-061-6/+0
| | | | | | | | | | | | | | | Summary: This kill various depreacated API related to attribute : - The deprecated C API attribute based on LLVMAttribute enum. - The Raw attribute set format (planned to be removed in 4.0). Reviewers: bkramer, echristo, mehdi_amini, void Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23039 llvm-svn: 286062
* Expose AttributeSetNode, use it to provide aggregate getter for attribute in ↵Amaury Sechet2016-07-211-68/+1
| | | | | | | | | | | | | | the C API. Summary: See D19181 for context. Reviewers: whitequark, Wallbraker, jyknight, echristo, bkramer, void Subscribers: mehdi_amini Differential Revision: http://reviews.llvm.org/D21265 llvm-svn: 276236
* Apply clang-tidy's modernize-loop-convert to most of lib/IR.Benjamin Kramer2016-06-261-7/+6
| | | | | | Only minor manual fixes. No functionality change intended. llvm-svn: 273813
* Rename AttributeSetImpl::NumAttrs and AttributeSetImpl::getNumAttributes to ↵Amaury Sechet2016-06-141-13/+15
| | | | | | | | | | | | reflect that they work on slots rather than attributes. NFC Summary: The current naming not only doesn't convey the meaning of what this does, but worse, it convey the wrong meaning. This was a major source of confusion understanding the code, so I'm applying the boy scout rule here and making it better after I leave. Reviewers: void, bkramer, whitequark Differential Revision: http://reviews.llvm.org/D21264 llvm-svn: 272725
* Make sure we have a Add/Remove/Has function for various thing that can have ↵Amaury Sechet2016-06-121-0/+3
| | | | | | | | | | | | | | attribute. Summary: This also deprecated the get attribute function familly. Reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael, jyknight Subscribers: axw, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19181 llvm-svn: 272504
* Add the allocsize attribute to LLVM.George Burgess IV2016-04-121-1/+4
| | | | | | | | | | | | | | | | `allocsize` is a function attribute that allows users to request that LLVM treat arbitrary functions as allocation functions. This patch makes LLVM accept the `allocsize` attribute, and makes `@llvm.objectsize` recognize said attribute. The review for this was split into two patches for ease of reviewing: D18974 and D14933. As promised on the revisions, I'm landing both patches as a single commit. Differential Revision: http://reviews.llvm.org/D14933 llvm-svn: 266032
* Remove TrailingObjects::operator delete. It's still suffering fromRichard Smith2016-02-091-2/+2
| | | | | | | | | compiler-specific issues. Instead, repeat an 'operator delete' definition in each derived class that is actually deleted, and give up on the static type safety of an error when sized delete is accidentally used on a type derived from TrailingObjects. llvm-svn: 260190
* Re-commit r259942 (reverted in r260053) with a different workaround for the ↵Richard Smith2016-02-091-0/+4
| | | | | | | | | | | | | | | MSVC bug. This fixes undefined behavior in C++14 due to the size of the object being deleted being different from sizeof(dynamic type) when it is allocated with trailing objects. MSVC seems to have several bugs around using-declarations changing the access of a member inherited from a base class, so use forwarding functions instead of using-declarations to make TrailingObjects::operator delete accessible where desired. llvm-svn: 260180
* Revert 259942, r259943, r259948.Nico Weber2016-02-071-4/+0
| | | | | | | | | | | | | | | | The Windows bots have been failing for the last two days, with: FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe -c LLVMContextImpl.cpp D:\buildslave\clang-x64-ninja-win7\llvm\lib\IR\LLVMContextImpl.cpp(137) : error C2248: 'llvm::TrailingObjects<llvm::AttributeSetImpl, llvm::IndexAttrPair>::operator delete' : cannot access private member declared in class 'llvm::AttributeSetImpl' TrailingObjects.h(298) : see declaration of 'llvm::TrailingObjects<llvm::AttributeSetImpl, llvm::IndexAttrPair>::operator delete' AttributeImpl.h(213) : see declaration of 'llvm::AttributeSetImpl' llvm-svn: 260053
* Attempt#2 to work around MSVC rejects-valid.Richard Smith2016-02-051-2/+2
| | | | llvm-svn: 259948
* More workarounds for undefined behavior exposed when compiling in C++14 withRichard Smith2016-02-051-0/+4
| | | | | | | | -fsized-deallocation. Disable sized deallocation for all objects derived from TrailingObjects, as we expect the storage allocated for these objects to be larger than the size of their dynamic type. llvm-svn: 259942
* Use Support/DataTypes.h instead of cstdintMatthias Braun2016-01-301-1/+1
| | | | llvm-svn: 259282
* Fix the MSVC build by moving static asserts into constructorsReid Kleckner2016-01-291-5/+5
| | | | | | | Apparently MSVC won't allow you to ask for the sizeof() a data member at class scope. llvm-svn: 259257
* Need #include <cstdint> for uint64_tMatthias Braun2016-01-291-1/+2
| | | | llvm-svn: 259255
* Need #include <climit> for CHAR_BITMatthias Braun2016-01-291-0/+1
| | | | llvm-svn: 259254
* AttributeSetImpl: Summarize existing function attributes in a bitset.Matthias Braun2016-01-291-1/+27
| | | | | | | | | | | The majority of attribute queries checks for the existence of an enum attribute in the FunctionIndex slot. We only have 48 of those and can therefore summarize them in an uint64_t bitset which measurably improves compile time. Differential Revision: http://reviews.llvm.org/D16618 llvm-svn: 259252
* AttributeSetNode: Summarize existing attributes in a bitset.Matthias Braun2016-01-291-2/+15
| | | | | | | | | | | The majority of queries just checks for the existince of an enum attribute. We only have 48 of those and can summaryiz them in an uint64_t bitfield so we can avoid searching the list. This improves "opt" compile time by 1-4% in my measurements. Differential Revision: http://reviews.llvm.org/D16617 llvm-svn: 259251
* llvm/lib/IR/AttributeImpl.h: Move comment block not to cover typedef, ↵NAKAMURA Takumi2015-08-061-2/+2
| | | | | | introduced in r244164. [-Wdocumentation] llvm-svn: 244204
* Add a TrailingObjects template class.James Y Knight2015-08-051-18/+19
| | | | | | | | | | This is intended to help support the idiom of a class that has some other objects (or multiple arrays of different types of objects) appended on the end, which is used quite heavily in clang. Differential Revision: http://reviews.llvm.org/D11272 llvm-svn: 244164
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-1/+1
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-1/+1
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Tweak wording of alignment static_assert messages.James Y Knight2015-06-171-6/+7
| | | | llvm-svn: 239907
* Fix alignment issues in LLVM.James Y Knight2015-06-171-2/+11
| | | | | | | | | | | | | | | | | | Adds static_asserts to ensure alignment of concatenated objects is correct, and fixes them where they are not. Also changes the definition of AlignOf to use constexpr, except on MSVC, to avoid enum comparison warnings from GCC. (There's not too much of this in llvm itself, most of the fun is in clang). This seems to make LLVM actually work without Bus Error on 32bit sparc. Differential Revision: http://reviews.llvm.org/D10271 llvm-svn: 239872
* Add missing dereferenceable_or_null gettersSanjoy Das2015-05-061-0/+1
| | | | | | | | | | | | | | | | | Summary: Add missing dereferenceable_or_null getters required for http://reviews.llvm.org/D9253 change. Separated from the D9253 review. Patch by Artur Pilipenko! Reviewers: sanjoy Reviewed By: sanjoy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9499 llvm-svn: 236615
* [IR] Introduce a dereferenceable_or_null(N) attribute.Sanjoy Das2015-04-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If a pointer is marked as dereferenceable_or_null(N), LLVM assumes it is either `null` or `dereferenceable(N)` or both. This change only introduces the attribute and adds a token test case for the `llvm-as` / `llvm-dis`. It does not hook up other parts of the optimizer to actually exploit the attribute -- those changes will come later. For pointers in address space 0, `dereferenceable(N)` is now exactly equivalent to `dereferenceable_or_null(N)` && `nonnull`. For other address spaces, `dereferenceable(N)` is potentially weaker than `dereferenceable_or_null(N)` && `nonnull` (since we could have a null `dereferenceable(N)` pointer). The motivating case for this change is Java (and other managed languages), where pointers are either `null` or dereferenceable up to some usually known-at-compile-time constant offset. Reviewers: rafael, hfinkel Reviewed By: hfinkel Subscribers: nicholas, llvm-commits Differential Revision: http://reviews.llvm.org/D8650 llvm-svn: 235132
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-6/+6
| | | | | | requiring the macro. NFC; LLVM edition. llvm-svn: 229340
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-131-2/+2
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* Add a dereferenceable attributeHal Finkel2014-07-181-1/+3
| | | | | | | | | This attribute indicates that the parameter or return pointer is dereferenceable. Practically speaking, loads from such a pointer within the associated byte range are safe to speculatively execute. Such pointer parameters are common in source languages (C++ references, for example). llvm-svn: 213385
* Rename AlignAttribute to IntAttributeHal Finkel2014-07-181-9/+9
| | | | | | | | | | | | Currently the only kind of integer IR attributes that we have are alignment attributes, and so the attribute kind that takes an integer parameter is called AlignAttr, but that will change (we'll soon be adding a dereferenceable attribute that also takes an integer value). Accordingly, rename AlignAttribute to IntAttribute (class names, enums, etc.). No functionality change intended. llvm-svn: 213352
* [C++11] Add 'override' keyword to IR library.Craig Topper2014-03-051-1/+1
| | | | llvm-svn: 202939
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-191-0/+3
| | | | | | | | | | | | 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 llvm-svn: 195064
OpenPOWER on IntegriCloud