summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGBuilder.h
Commit message (Collapse)AuthorAgeFilesLines
* [opaque pointer types] Cleanup CGBuilder's Create*GEP.James Y Knight2019-02-091-56/+18
| | | | | | | | | | | | | | The various EltSize, Offset, DataLayout, and StructLayout arguments are all computable from the Address's element type and the DataLayout which the CGBuilder already has access to. After having previously asserted that the computed values are the same as those passed in, now remove the redundant arguments from CGBuilder's Create*GEP functions. Differential Revision: https://reviews.llvm.org/D57767 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353629 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer types] Cleanup CGBuilder's Create*GEP.James Y Knight2019-02-081-0/+50
| | | | | | | | | | | | | | | | | | | | | | | Some of these functions take some extraneous arguments, e.g. EltSize, Offset, which are computable from the Type and DataLayout. Add some asserts to ensure that the computed values are consistent with the passed-in values, in preparation for eliminating the extraneous arguments. This also asserts that the Type is an Array for the calls named "Array" and a Struct for the calls named "Struct". Then, correct a couple of errors: 1. Using CreateStructGEP on an array type. (this causes the majority of the test differences, as struct GEPs are created with i32 indices, while array GEPs are created with i64 indices) 2. Passing the wrong Offset to CreateStructGEP in TargetInfo.cpp on x86-64 NACL (which uses 32-bit pointers). Differential Revision: https://reviews.llvm.org/D57766 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353529 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor cleanup: remove CGBuild::CreateConst*ByteGEP overloads taking a Value*.James Y Knight2019-02-051-11/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353197 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338291 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: specify alignment + inbounds for automatic variable initializationJF Bastien2018-07-131-0/+15
| | | | | | | | | | Summary: Automatic variable initialization was generating default-aligned stores (which are deprecated) instead of using the known alignment from the alloca. Further, they didn't specify inbounds. Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D49209 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337041 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-2/+2
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. 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 for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331834 91177308-0d34-0410-b5e6-96231b3b80d8
* Change memcpy/memove/memset to have dest and source alignment attributes.Daniel Neilson2018-01-281-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change is step three in the series of changes to remove alignment argument from memcpy/memmove/memset in favour of alignment attributes. Steps: Step 1) Remove alignment parameter and create alignment parameter attributes for memcpy/memmove/memset. ( rL322965, rC322964, rL322963 ) Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing source and dest alignments. ( rL323597 ) Step 3) Update Clang to use the new IRBuilder API. Step 4) Update Polly to use the new IRBuilder API. Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API, and those that use use MemIntrinsicInst::[get|set]Alignment() to use getDestAlignment() and getSourceAlignment() instead. Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the MemIntrinsicInst::[get|set]Alignment() methods. Reference http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html Reviewers: rjmccall Subscribers: jyknight, nemanjai, nhaehnle, javed.absar, sbc100, aheejin, kbarton, fedor.sergeev, cfe-commits Differential Revision: https://reviews.llvm.org/D41677 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323617 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Handle address space conversion while setting type alignment.Anastasia Stulova2017-09-271-0/+7
| | | | | | | | | | | Added missing addrspacecast case in alignment computation logic of pointer type emission in IR generation. Differential Revision: https://reviews.llvm.org/D37804 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314304 91177308-0d34-0410-b5e6-96231b3b80d8
* IRGen: Remove an unused overload of CreateAlignedLoad.Peter Collingbourne2016-12-051-5/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288629 91177308-0d34-0410-b5e6-96231b3b80d8
* IRGen: Remove all uses of CreateDefaultAlignedLoad.Peter Collingbourne2016-11-281-13/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D27157 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288083 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove compile time PreserveName in favor of a runtime cc1 ↵Mehdi Amini2016-03-131-15/+4
| | | | | | | | | | | | | | | | | | | | | -discard-value-names option Summary: This flag is enabled by default in the driver when NDEBUG is set. It is forwarded on the LLVMContext to discard all value names (but GlobalValue) for performance purpose. This an improved version of D18024 Reviewers: echristo, chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18127 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263394 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily revert these patches:Eric Christopher2016-03-121-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 60d9845f6a037122d9be9a6d92d4de617ef45b04 Author: Mehdi Amini <mehdi.amini@apple.com> Date: Fri Mar 11 18:48:02 2016 +0000 Fix clang crash: when CodeGenAction is initialized without a context, use the member and not the parameter From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263273 91177308-0d34-0410-b5e6-96231b3b80d8 commit af7ce3bf04a75ad5124b457b805df26006bd215b Author: Mehdi Amini <mehdi.amini@apple.com> Date: Fri Mar 11 17:32:58 2016 +0000 Fix build: use -> with pointers and not . Silly typo. From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263267 91177308-0d34-0410-b5e6-96231b3b80d8 commit d0eea119192814954e7368c77d0dc5a9eeec1fbb Author: Mehdi Amini <mehdi.amini@apple.com> Date: Fri Mar 11 17:15:44 2016 +0000 Remove compile time PreserveName switch based on NDEBUG Summary: Following r263086, we are now relying on a flag on the Context to discard Value names in release builds. Reviewers: chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18024 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263257 91177308-0d34-0410-b5e6-96231b3b80d8 until we can fix the Release builds. This reverts commits 263257, 263267, 263273 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263320 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove compile time PreserveName switch based on NDEBUGMehdi Amini2016-03-111-15/+4
| | | | | | | | | | | | | | | | Summary: Following r263086, we are now relying on a flag on the Context to discard Value names in release builds. Reviewers: chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18024 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263257 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a coerce-and-expand ABIArgInfo as a generalization of someJohn McCall2016-03-111-0/+7
| | | | | | | | of the things we do with Expand / Direct. NFC for now, but this will be used by swiftcall expansion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263192 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Change memcpy/memset/memmove to have dest and source alignments."Pete Cooper2015-11-191-6/+6
| | | | | | | | | | This reverts commit r253512. This likely broke the bots in: http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202 http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253542 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix debian build after r253512."Pete Cooper2015-11-191-4/+3
| | | | | | | | | | This reverts commit r253519. This likely broke the bots in http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202 http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253541 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix debian build after r253512.Pete Cooper2015-11-181-3/+4
| | | | | | | | | | | The conversion from QuantityType to the (temporary) IntegerAlignment class was ambiguous. For now add in explicit conversion to unsigned to satisfy the clang-x86_64-debian-fast bot. I'll remove the explicit conversion when I remove the IntegerAlignment class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253519 91177308-0d34-0410-b5e6-96231b3b80d8
* Change memcpy/memset/memmove to have dest and source alignments.Pete Cooper2015-11-181-6/+6
| | | | | | | | | | | | | | | | | | | | | | This is a follow on from a similar LLVM commit: r253511. Note, this was reviewed (and more details are in) http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html These intrinsics currently have an explicit alignment argument which is required to be a constant integer. It represents the alignment of the source and dest, and so must be the minimum of those. This change allows source and dest to each have their own alignments by using the alignment attribute on their arguments. The alignment argument itself is removed. The only code change to clang is hidden in CGBuilder.h which now passes both dest and source alignment to IRBuilder, instead of taking the minimum of dest and source alignments. Reviewed by Hal Finkel. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253512 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary braces; this resolves against aJohn McCall2015-09-081-2/+2
| | | | | | single-pointer overload instead of the ArrayRef one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246988 91177308-0d34-0410-b5e6-96231b3b80d8
* Compute and preserve alignment more faithfully in IR-generation.John McCall2015-09-081-1/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246985 91177308-0d34-0410-b5e6-96231b3b80d8
* Wdeprecated: CGBuilderInserter is copy constructed in some contexts - remove ↵David Blaikie2015-08-121-5/+3
| | | | | | | | | the unnecessarily disabling copy assignment to enable this The object has very simple state, there seems no reason to disallow all the usual value semantic operations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244831 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-1/+1
| | | | | | requiring the macro. NFC; Clang edition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229339 91177308-0d34-0410-b5e6-96231b3b80d8
* typoSanjay Patel2014-09-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217517 91177308-0d34-0410-b5e6-96231b3b80d8
* Header guard canonicalization, clang part.Benjamin Kramer2014-08-131-2/+2
| | | | | | Modifications made by clang-tidy with minor tweaks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215557 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch adds a helper class (CGLoopInfo) for marking memory instructions ↵Alexander Musman2014-05-221-2/+29
| | | | | | | | | | | | with llvm.mem.parallel_loop_access metadata. It also adds a simple initial version of codegen for pragma omp simd (it will change in the future to support all the clauses). Differential revision: http://reviews.llvm.org/D3644 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209411 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-1/+1
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171369 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang to reflect the new home of IRBuilder.h as of r159421.Chandler Carruth2012-06-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159422 91177308-0d34-0410-b5e6-96231b3b80d8
* Make CGBuilderTy a typedef again; its functionality has been rolled backJohn McCall2010-07-061-49/+2
| | | | | | | | into IRBuilder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107687 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide convenience routines to save and restore the current insertionJohn McCall2010-07-031-3/+52
| | | | | | | | point. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107570 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable generation of basic block names in NDEBUG mode.Daniel Dunbar2008-11-121-1/+5
| | | | | | | | Revert to enabling generation of instruction names when not in NDEBUG mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59094 91177308-0d34-0410-b5e6-96231b3b80d8
* don't preserve names on IR instructions. This matches llvm-gcc's behavior andChris Lattner2008-11-101-1/+2
| | | | | | | speeds up the compiler by ~8% at -emit-llvm -O0. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58977 91177308-0d34-0410-b5e6-96231b3b80d8
* Move IRBuilder type definition to common file.Daniel Dunbar2008-11-011-0/+21
- No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58546 91177308-0d34-0410-b5e6-96231b3b80d8