summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-096-69/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires a number of steps. 1) Move value_use_iterator into the Value class as an implementation detail 2) Change it to actually be a *Use* iterator rather than a *User* iterator. 3) Add an adaptor which is a User iterator that always looks through the Use to the User. 4) Wrap these in Value::use_iterator and Value::user_iterator typedefs. 5) Add the range adaptors as Value::uses() and Value::users(). 6) Update *all* of the callers to correctly distinguish between whether they wanted a use_iterator (and to explicitly dig out the User when needed), or a user_iterator which makes the Use itself totally opaque. Because #6 requires churning essentially everything that walked the Use-Def chains, I went ahead and added all of the range adaptors and switched them to range-based loops where appropriate. Also because the renaming requires at least churning every line of code, it didn't make any sense to split these up into multiple commits -- all of which would touch all of the same lies of code. The result is still not quite optimal. The Value::use_iterator is a nice regular iterator, but Value::user_iterator is an iterator over User*s rather than over the User objects themselves. As a consequence, it fits a bit awkwardly into the range-based world and it has the weird extra-dereferencing 'operator->' that so many of our iterators have. I think this could be fixed by providing something which transforms a range of T&s into a range of T*s, but that *can* be separated into another patch, and it isn't yet 100% clear whether this is the right move. However, this change gets us most of the benefit and cleans up a substantial amount of code around Use and User. =] llvm-svn: 203364
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-0816-98/+99
| | | | | | class. llvm-svn: 203339
* DebugInfo: Use DW_FORM_data4 for DW_AT_high_pc in DW_TAG_lexical_blocksDavid Blaikie2014-03-081-2/+1
| | | | | | Suggested by Adrian Prantl in code review for r203187 llvm-svn: 203323
* Add support for hashing location information for CU level hashes.Eric Christopher2014-03-083-6/+43
| | | | | | | Add a testcase based on sret.cpp where we can now hash the entire compile unit. llvm-svn: 203319
* [DAGCombiner] Distribute TRUNC through AND in rotation amountAdam Nemet2014-03-071-0/+16
| | | | | | | | | | | | | | | | This is already done for shifts. Allow it for rotations as well. E.g.: (rotl:i32 x, (trunc (and y, 31))) -> (rotl:i32 x, (and (trunc y), 31)) Use the newly factored-out distributeTruncateThroughAnd. With this patch and some X86.td tweaks we should be able to remove redundant masking of the rotation amount like in the example above. HW implicitly performs this masking. The testcase will be added as part of the X86 patch. llvm-svn: 203316
* [DAGCombiner] Recognize another rotation idiomAdam Nemet2014-03-071-0/+8
| | | | | | | | | | | | | | | | This is the new idiom: x<<(y&31) | x>>((0-y)&31) which is recognized as: x ROTL (y&31) The change refines matchRotateSub. In Neg & (OpSize - 1) == (OpSize - Pos) & (OpSize - 1), if Pos is Pos' & (OpSize - 1) we can just use Pos' instead of Pos. llvm-svn: 203315
* [DAGCombiner] Slightly improve readability of matchRotateSubAdam Nemet2014-03-071-8/+9
| | | | | | | | | | Slightly change the wording in the function comment. Originally, it can be misunderstood as we turned the input into two subsequent rotates. Better connect the comment which talks about Mask and the code which used LoBits. Renamed variable to MaskLoBits. llvm-svn: 203314
* ISel: Make VSELECT selection terminate in cases where the condition type has toArnold Schwaighofer2014-03-071-0/+11
| | | | | | | | | | | | | | | be split and the result type widened. When the condition of a vselect has to be split it makes no sense widening the vselect and thereby widening the condition. We end up in an endless loop of widening (vselect result type) and splitting (condition mask type) doing this. Instead, split both the condition and the vselect and widen the result. I ran this over the test suite with i686 and mattr=+sse and saw no regressions. Fixes PR18036. llvm-svn: 203311
* Remove unnecessary test for Darwin and update testcase to be a little lessAdrian Prantl2014-03-071-1/+1
| | | | | | | horrible/fragile. rdar://problem/16264854 llvm-svn: 203309
* Add a virtual destructor to quiet a warning.Eric Christopher2014-03-071-0/+2
| | | | llvm-svn: 203307
* Actually add the header file.Eric Christopher2014-03-071-0/+69
| | | | llvm-svn: 203305
* Two part patch:Eric Christopher2014-03-073-102/+104
| | | | | | | | | | | | | | | First: refactor out the emission of entries into the .debug_loc section into its own routine. Second: add a new class ByteStreamer that can be used to either emit using an AsmPrinter or hash using DIEHash the series of bytes that would be emitted. Use this in all of the location emission routines for the .debug_loc section. No functional change intended outside of a few additional comments in verbose assembly. llvm-svn: 203304
* Add include guards and make public a few routines that add valuesEric Christopher2014-03-071-1/+11
| | | | | | to the hash. llvm-svn: 203303
* Revert "Remove unnecessary check for Darwin. rdar://problem/16264854"Adrian Prantl2014-03-071-1/+1
| | | | | | This breaks linux buildbots. Go figure. llvm-svn: 203300
* Remove unnecessary check for Darwin. rdar://problem/16264854Adrian Prantl2014-03-071-1/+1
| | | | llvm-svn: 203297
* DebugInfo: Use DW_FORM_data4 for DW_AT_high_pc in inlined functionsDavid Blaikie2014-03-071-2/+1
| | | | | | Suggested by Adrian Prantl in code review for r203187. llvm-svn: 203296
* [C++11] Convert sort predicates into lambdas.Benjamin Kramer2014-03-073-28/+9
| | | | | | No functionality change. llvm-svn: 203288
* Fix up formatting.Eric Christopher2014-03-071-9/+8
| | | | llvm-svn: 203286
* [C++11] DwarfDebug: Turn single-use functors into lambdas.Benjamin Kramer2014-03-071-25/+16
| | | | | | No functionality change. llvm-svn: 203276
* [C++11] DwarfDebug: Use range-based for loops.Benjamin Kramer2014-03-071-245/+116
| | | | | | It has a lot of them with complex types. C++11 really shines here. llvm-svn: 203270
* DebugInfo: Refactor high_pc/low_pc construction into reusable functionDavid Blaikie2014-03-072-6/+13
| | | | | | | For incoming improvements to inlined functions and lexical blocks suggested by Adrian Prantl in review of r203187. llvm-svn: 203263
* DebugInfo: Restrict DW_AT_high_pc encoding as data4 offset to DWARF 4 as per ↵David Blaikie2014-03-071-1/+1
| | | | | | | | spec Code review feedback to r203187 from Oliver Stannard. Thanks! llvm-svn: 203256
* CodeGenPrep: sink extends of illegal types into use block.Tim Northover2014-03-071-34/+58
| | | | | | | | | This helps the instruction selector to lower an i64 * i64 -> i128 multiplication into a single instruction on targets which support it. Patch by Manuel Jacob. llvm-svn: 203230
* Remove unused method.Craig Topper2014-03-071-2/+0
| | | | llvm-svn: 203221
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-0750-177/+178
| | | | | | class. llvm-svn: 203220
* MC: Remove superfluous section attribute flag definitionsDavid Majnemer2014-03-071-9/+9
| | | | | | | | | | | | | | | | | | | Summary: llvm/MC/MCSectionMachO.h and llvm/Support/MachO.h both had the same definitions for the section flags. Instead, grab the definitions out of support. No functionality change. Reviewers: grosbach, Bigcheese, rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2998 llvm-svn: 203211
* Replace PROLOG_LABEL with a new CFI_INSTRUCTION.Rafael Espindola2014-03-078-27/+26
| | | | | | | | | | | | | | | | | | | | | | | The old system was fairly convoluted: * A temporary label was created. * A single PROLOG_LABEL was created with it. * A few MCCFIInstructions were created with the same label. The semantics were that the cfi instructions were mapped to the PROLOG_LABEL via the temporary label. The output position was that of the PROLOG_LABEL. The temporary label itself was used only for doing the mapping. The new CFI_INSTRUCTION has a 1:1 mapping to MCCFIInstructions and points to one by holding an index into the CFI instructions of this function. I did consider removing MMI.getFrameInstructions completelly and having CFI_INSTRUCTION own a MCCFIInstruction, but MCCFIInstructions have non trivial constructors and destructors and are somewhat big, so the this setup is probably better. The net result is that we don't create temporary labels that are never used. llvm-svn: 203204
* DebugInfo: Limit r203187 to non-darwin as lldb can't handle this yetDavid Blaikie2014-03-071-2/+5
| | | | llvm-svn: 203192
* Move some dwarf emission routines to AsmPrinterDwarf.cpp.Eric Christopher2014-03-072-156/+157
| | | | llvm-svn: 203191
* 80-column fixups.Eric Christopher2014-03-071-6/+8
| | | | llvm-svn: 203190
* DebugInfo: Emit DW_TAG_subprogram's DW_AT_high_pc as an offset from the low_pcDavid Blaikie2014-03-073-1/+12
| | | | | | | This removes a relocation from each subprogram, reducing link times, etc. llvm-svn: 203187
* Remove shouldEmitUsedDirectiveFor.Rafael Espindola2014-03-062-19/+1
| | | | | | Clang now uses llvm.compiler.used for these cases. llvm-svn: 203174
* [X86] Teach the DAGCombiner how to fold a OR of two shufflevector nodes.Andrea Di Biagio2014-03-061-0/+54
| | | | | | | | | | | | | | | | | | | | | | This patch teaches the DAGCombiner how to fold a binary OR between two shufflevector into a single shuffle vector when possible. The rules are: 1. fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask1) 2. fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf B, A, Mask2) The DAGCombiner can take advantage of the fact that OR is commutative and compute two possible shuffle masks (Mask1 and Mask2) for the resulting shuffle node. Before folding a dag according to either rule 1 or 2, DAGCombiner verifies that the resulting shuffle mask is legal for the target. DAGCombiner would firstly try to fold according to 1.; If not possible then it will try to fold according to 2. If both Mask1 and Mask2 are illegal then we conservatively don't fold the OR instruction. llvm-svn: 203156
* Constify a few things with DotDebugLocEntry.Eric Christopher2014-03-062-4/+4
| | | | llvm-svn: 203150
* Move DIEEntry handling inside the main switch statement.Eric Christopher2014-03-061-10/+6
| | | | | | No functional change. llvm-svn: 203142
* R600: Fix extloads from i8 / i16 to i64.Matt Arsenault2014-03-061-0/+15
| | | | | | | This appears to only be working for global loads. Private and local break for other reasons. llvm-svn: 203135
* Micro optimization: this code only needs to look at eh labels.Rafael Espindola2014-03-061-1/+1
| | | | llvm-svn: 203127
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-0611-37/+27
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* DebugInfo: Tag units as having been indexed in GNU pubnames by using a ↵David Blaikie2014-03-061-7/+1
| | | | | | | | | | DW_AT_GNU_pubnames of DW_FORM_flag(_present) rather than sec_offsets to the pubnames/types sections This is consistent with GDB ToT and reduces the number of relocations in (type and compile) units, substantially reducing relocations and debug size in fission + type units builds. llvm-svn: 203082
* DebugInfo: Shrink pubnames/pubtypes in the presence of type units by only ↵David Blaikie2014-03-062-10/+10
| | | | | | emitting pub sections for compile units llvm-svn: 203057
* Add some helpful comments on DIEValue types that we expect to hash.Eric Christopher2014-03-061-1/+4
| | | | llvm-svn: 203055
* [Layering] Move DebugInfo.h into the IR library where its implementationChandler Carruth2014-03-0618-18/+18
| | | | | | already lives. llvm-svn: 203046
* Rewrite the attribute hashing algorithm to use the type of the valueEric Christopher2014-03-061-32/+36
| | | | | | | | pointed to by the attribute, rather than the form as a first step to determining how to hash the values. No functional change intended. llvm-svn: 203044
* [Layering] Move DIBuilder.h into the IR library where its implementationChandler Carruth2014-03-063-3/+3
| | | | | | already lives. llvm-svn: 203038
* Remove the last of the special case code for emitting attributes.Eric Christopher2014-03-063-39/+26
| | | | | | | | This works by moving the existing code into the DIEValue hierarchy and using the DwarfDebug pointer off of the AsmPrinter to access any global information we need. llvm-svn: 203033
* constify a few accessors.Eric Christopher2014-03-061-3/+3
| | | | llvm-svn: 203032
* Remove special case in the DIEValue printing since it only existedEric Christopher2014-03-061-9/+5
| | | | | | for verbose asm. llvm-svn: 203031
* Add a DIELocList class to handle pointers into the location list.Eric Christopher2014-03-056-14/+81
| | | | | | | | This enables us to figure out where in the debug_loc section our locations are so that we can eventually hash them. It also helps remove some special case code in emission. No functional change. llvm-svn: 203018
* Always print the implicit .text at the start of an asm file.Rafael Espindola2014-03-051-1/+1
| | | | | | | | | | | | | | | | | Before llvm-mc would print it, but llc was assuming that it would produce another section changing directive before one was needed. That assumption is false with inline asm. Fixes PR19049. Another option would be to always create the section, but in the asm printer avoid printing sections changes during initialization. That would work, but * We do use the fact that llvm-mc prints it in testing. The tests can be changed if needed. * A quick poll on IRC suggest that most developers prefer the implicit .text to be printed. llvm-svn: 203001
* [Layering] Move DebugLoc.h into the IR library. The implementationChandler Carruth2014-03-054-4/+4
| | | | | | | | | | | already lived there and it is where it belongs -- this is the in-memory debug location representation. This is just cleanup -- Modules can actually cope with this, but that doesn't make it right. After chatting with folks that have out-of-tree stuff, going ahead and moving the rest of the headers seems preferable. llvm-svn: 202960
OpenPOWER on IntegriCloud