summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
* DI: Rewrite the DIBuilder local variable APIDuncan P. N. Exon Smith2015-07-311-3/+23
| | | | | | | | | | | | Replace the general `createLocalVariable()` with two more specific functions: `createParameterVariable()` and `createAutoVariable()`, and rewrite the documentation. Besides cleaning up the API, this avoids exposing the fake DWARF tags `DW_TAG_arg_variable` and `DW_TAG_auto_variable` to frontends, and is preparation for removing them completely. llvm-svn: 243764
* [opaque pointers] Remove use of PointerType::getElementType in favor of ↵David Blaikie2015-07-291-4/+1
| | | | | | GEPOperator::getSourceElementType llvm-svn: 243566
* [Statepoints] Let patchable statepoints have a symbolic call target.Sanjoy Das2015-07-281-6/+0
| | | | | | | | | | | | | | | | | | | | Summary: As added initially, statepoints required their call targets to be a constant pointer null if ``numPatchBytes`` was non-zero. This turns out to be a problem ergonomically, since there is no way to mark patchable statepoints as calling a (readable) symbolic value. This change remove the restriction of requiring ``null`` call targets for patchable statepoints, and changes PlaceSafepoints to maintain the symbolic call target through its transformation. Reviewers: reames, swaroop.sridhar Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11550 llvm-svn: 243502
* Remove unnecessary const_casts. NFCCraig Topper2015-07-281-6/+4
| | | | llvm-svn: 243380
* [opaque pointer type] Avoid using pointee types to retrieve InlineAsm's ↵David Blaikie2015-07-282-19/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | function type As a stop-gap, retrieving the InlineAsm's function type was done via the pointee type of its (pointer) Value type. Instead, pass down and store the FunctionType in the InlineAsm object. The only wrinkle with this is the ConstantUniqueMap, which then needs to ferry the FunctionType down through the InlineAsmKeyType. This could be done a bit differently if the ConstantInfo trait were broadened a bit to provide an extension point for access to the TypeClass object from the ValType objects, so that the ConstantUniqueMap<InlineAsm> would then be keyed on FunctionTypes instead of PointerTypes that point to FunctionTypes. This drops the number of IR tests that don't roundtrip through bitcode* without calling PointerType::getElementType from 416 to 8 (out of 10733). 3 of those crash when roundtripping at ToT anyway. * modulo various unavoidable uses of pointer types when validating IR (for now) and in the way globals are parsed, unfortunately. These cases will either go away (because such validation will no longer be necessary or possible when pointee types are opaque), or have to be made simultaneously with the removal of pointee types. llvm-svn: 243356
* IR: Expose the method 'getLocalSlot' in the module slot tracker.Alex Lorenz2015-07-271-0/+5
| | | | | | | | | | | This commit publicly exposes the method 'getLocalSlot' in the 'ModuleSlotTracker' class. This change is useful for MIR serialization, to serialize the unnamed basic block and unnamed alloca references. Reviewers: Duncan P. N. Exon Smith llvm-svn: 243336
* Revert "Add const to a bunch of Type* in DataLayout. NFC."Pete Cooper2015-07-271-13/+13
| | | | | | | | This reverts commit r243135. Feedback from Craig Topper and David Blaikie was that we don't put const on Type as it has no mutable state. llvm-svn: 243283
* DI/Verifier: Fix argument bitrot in DILocalVariableDuncan P. N. Exon Smith2015-07-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | Add a verifier check that `DILocalVariable`s of tag `DW_TAG_arg_variable` always have a non-zero 'arg:' field, and those of tag `DW_TAG_auto_variable` always have a zero 'arg:' field. These are the only configurations that are properly understood by the backend. (Also, fix the bad examples in LangRef and test/Assembler, and fix the bug in Kaleidoscope Ch8.) A large number of testcases seem to have bitrotted their way forward from some ancient version of the debug info hierarchy that didn't have `arg:` parameters. If you have out-of-tree testcases that start failing in the verifier and you don't care enough to get the `arg:` right, you may have some luck just calling: sed -e 's/, arg: 0/, arg: 1/' or some such, but I hand-updated the ones in tree. llvm-svn: 243183
* Use make_range(rbegin(), rend()) to allow foreach loops. NFC.Pete Cooper2015-07-241-2/+1
| | | | | | | | | | | Instead of the pattern for (auto I = x.rbegin(), E = x.end(); I != E; ++I) we can use make_range to construct the reverse range and iterate using that instead. llvm-svn: 243163
* DI: Remove unnecessary DICompositeTypeBaseDuncan P. N. Exon Smith2015-07-241-2/+1
| | | | | | | | | | | | Remove unnecessary and confusing common base class for `DICompositeType` and `DISubroutineType`. While at a high-level `DISubroutineType` is a sort of composite of other types, it has no shared code paths, and its fields are completely disjoint. This relationship was left over from the old debug info hierarchy. llvm-svn: 243160
* DI: Simplify DebugInfoFinder::processType(), NFCDuncan P. N. Exon Smith2015-07-241-7/+9
| | | | | | | | | | | Handle `DISubroutineType` up-front rather than as part of a branch for `DICompositeTypeBase`. The only shared code path was looking through the base type, but `DISubroutineType` can never have a base type. This also removes the last use of `DICompositeTypeBase`, since we can strengthen the cast to `DICompositeType`. llvm-svn: 243159
* DI: Remove dead code: getDICompositeType()Duncan P. N. Exon Smith2015-07-241-15/+0
| | | | llvm-svn: 243158
* DI: Remove DIDerivedTypeBaseDuncan P. N. Exon Smith2015-07-241-13/+11
| | | | | | | | | Remove an unnecessary (and confusing) common subclass for `DIDerivedType` and `DICompositeType`. These classes aren't really related, and even in the old debug info hierarchy, there was a long-standing FIXME to separate them. llvm-svn: 243152
* Verifier: Sink filename check into visitMDCompositeType(), NFCDuncan P. N. Exon Smith2015-07-241-19/+6
| | | | | | | | We really only want to check this for unions and classes (all the other tags have been ruled out), so simplify the check and move it to the right place. llvm-svn: 243150
* Verifier: Remove unnecessary references to DW_TAG_subroutine_type, NFCDuncan P. N. Exon Smith2015-07-241-2/+0
| | | | | | | | | Remove unnecessary references to `DW_TAG_subroutine_type` in `visitDICompositeType()` and `visitDIDerivedTypeBase()`, since `visitDISubroutineType()` doesn't call either of those (and shouldn't, since subroutine types are really quite special). llvm-svn: 243149
* DI: Strengthen some dyn_casts to DIDerivedType, NFCDuncan P. N. Exon Smith2015-07-241-2/+2
| | | | | | | | The surrounding code proves in both cases that these must be `DIDerivedType` if they're `DIDerivedTypeBase`, so strengthen the `dyn_cast`s to the more specific type. llvm-svn: 243143
* Add const to a bunch of Type* in DataLayout. NFC.Pete Cooper2015-07-241-13/+13
| | | | | | | | Almost all methods in DataLayout took mutable pointers but didn't need to. These were only accessing constant methods of the types, or using the Type* to key a map. Neither of these needs a mutable pointer. llvm-svn: 243135
* Fix -Wextra-semi warnings.Hans Wennborg2015-07-221-1/+1
| | | | | | | | Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D11400 llvm-svn: 242930
* IR: Extract a function 'printLLVMNameWithoutPrefix' from 'PrintLLVMName'. NFC.Alex Lorenz2015-07-211-14/+26
| | | | | | | | | | | | | This commit extracts the code that prints out a name of an LLVM value without a prefix from a function 'PrintLLVMName' into a publicly accessible function named 'printLLVMNameWithoutPrefix'. This change would be useful for MIR serialization, as it would allow the MIR printer to reuse this function to print out the names of the external symbol machine operands. Reviewers: Duncan P. N. Exon Smith llvm-svn: 242803
* fix formatting; NFCSanjay Patel2015-07-211-2/+2
| | | | llvm-svn: 242796
* Revert "Update LLVM bindings after r239940. ..."Reid Kleckner2015-07-161-1/+8
| | | | | | | | | | | Revert the changes to the C API LLVMBuildLandingPad that were part of the personality function move. We now set the personality on the parent function when the C API attempts to construct a landingpad with a personality. This reverts commit r240010. llvm-svn: 242372
* Debug Info: Add basic support for external types references.Adrian Prantl2015-07-151-0/+12
| | | | | | | | | | | | | | This is a necessary prerequisite for bootstrapping the emission of debug info inside modules. - Adds a FlagExternalTypeRef to DICompositeType. External types must have a unique identifier. - External type references are emitted using a forward declaration with a DW_AT_signature([DW_FORM_ref_sig8]) based on the UID. http://reviews.llvm.org/D9612 llvm-svn: 242302
* Add capability to get and set the personalitty function from the C APIAndrew Wilkins2015-07-141-0/+8
| | | | | | | | | | | | | | | Summary: The capability was lost with D10429 where the personality function was set at function level rather than landing pad level. Now there is no way to get/set the personality function from the C API. That is a problem. Note that the whole thing could be avoided by improving the C API testing, as started by D10725 Reviewers: chandlerc, bogner, majnemer, andrew.w.kaylor, rafael, rnk, axw Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D10946 llvm-svn: 242104
* Remove macro guards for extern template instantiations.Benjamin Kramer2015-07-131-12/+8
| | | | | | | This is a C++11 feature that both GCC and MSVC have supported as ane extension long before C++11 was approved. llvm-svn: 242042
* Add argmemonly attribute.Igor Laevsky2015-07-112-4/+12
| | | | | | | | This change adds new attribute called "argmemonly". Function marked with this attribute can only access memory through it's argument pointers. This attribute directly corresponds to the "OnlyAccessesArgumentPointees" ModRef behaviour in alias analysis. Differential Revision: http://reviews.llvm.org/D10398 llvm-svn: 241979
* Cleanup a couple of comments in DIBuilder.cppAdrian Prantl2015-07-101-3/+3
| | | | llvm-svn: 241966
* [IR] Switch static const to an enum to silence MSVC linker warningsDavid Majnemer2015-07-101-2/+0
| | | | | | | Integral class statics are handled oddly in MSVC, we don't need them in this case, use an enum instead. llvm-svn: 241958
* Revert the new EH instructionsDavid Majnemer2015-07-105-547/+6
| | | | | | This reverts commits r241888-r241891, I didn't mean to commit them. llvm-svn: 241893
* Tighten the verifier check for catchblock.David Majnemer2015-07-101-3/+4
| | | | llvm-svn: 241891
* Address Joseph's review comments.David Majnemer2015-07-102-1/+76
| | | | llvm-svn: 241890
* Address Reid's review feedback.David Majnemer2015-07-101-2/+2
| | | | llvm-svn: 241889
* New EH representation for MSVC compatibilityDavid Majnemer2015-07-105-4/+469
| | | | | | | | | | | | | | | Summary: This introduces new instructions neccessary to implement MSVC-compatible exception handling support. Most of the middle-end and none of the back-end haven't been audited or updated to take them into account. Reviewers: rnk, JosephTremoulet, reames, nlewycky, rjmccall Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11041 llvm-svn: 241888
* Extended syntax of vector version of getelementptr instruction.Elena Demikhovsky2015-07-091-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | The justification of this change is here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/082989.html According to the current GEP syntax, vector GEP requires that each index must be a vector with the same number of elements. %A = getelementptr i8, <4 x i8*> %ptrs, <4 x i64> %offsets In this implementation I let each index be or vector or scalar. All vector indices must have the same number of elements. The scalar value will mean the splat vector value. (1) %A = getelementptr i8, i8* %ptr, <4 x i64> %offsets or (2) %A = getelementptr i8, <4 x i8*> %ptrs, i64 %offset In all cases the %A type is <4 x i8*> In the case (2) we add the same offset to all pointers. The case (1) covers C[B[i]] case, when we have the same base C and different offsets B[i]. The documentation is updated. http://reviews.llvm.org/D10496 llvm-svn: 241788
* Rename llvm.frameescape and llvm.framerecover to localescape and localrecoverReid Kleckner2015-07-071-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Initially, these intrinsics seemed like part of a family of "frame" related intrinsics, but now I think that's more confusing than helpful. Initially, the LangRef specified that this would create a new kind of allocation that would be allocated at a fixed offset from the frame pointer (EBP/RBP). We ended up dropping that design, and leaving the stack frame layout alone. These intrinsics are really about sharing local stack allocations, not frame pointers. I intend to go further and add an `llvm.localaddress()` intrinsic that returns whatever register (EBP, ESI, ESP, RBX) is being used to address locals, which should not be confused with the frame pointer. Naming suggestions at this point are welcome, I'm happy to re-run sed. Reviewers: majnemer, nicholas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11011 llvm-svn: 241633
* Revert "Revert r241570, it caused PR24053"David Majnemer2015-07-071-29/+22
| | | | | | | | This reverts commit r241602. We had a latent bug in SCCP where we would make a basic block empty and then proceed to ask questions about it's terminator. llvm-svn: 241616
* Revert r241570, it caused PR24053Nico Weber2015-07-071-22/+29
| | | | llvm-svn: 241602
* [IR] Make getFirstNonPHI return null if the BB is emptyDavid Majnemer2015-07-071-29/+22
| | | | | | | | | | | | getFirstNonPHI's documentation states that it returns null if there is no non-PHI instruction. However, it instead returns a pointer to the end iterator. The implementation of getFirstNonPHI claims that dereferencing the iterator will result in an assertion failure but this doesn't occur. Instead, machinery like getFirstInsertionPt will attempt to isa<> this invalid memory which results in unpredictable behavior. Instead, make getFirst* return null if no such instruction exists. llvm-svn: 241570
* DIBuilder: Don't rauw null pointers with empty arrays in finalize().Adrian Prantl2015-07-061-6/+12
| | | | | | This makes the IR a little easier to read. llvm-svn: 241470
* Use an early exit in DIBuilder::finalize() to improve readability.Adrian Prantl2015-07-061-28/+32
| | | | llvm-svn: 241465
* Verifier: Forbid comdats on linker declarations.Peter Collingbourne2015-07-051-0/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D10945 llvm-svn: 241414
* Remove always-true comparison, NFC.Filipe Cabecinhas2015-07-031-9/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: Looking at r241279, I noticed that UpgradedIntrinsics only gets written to in the following code: if (UpgradeIntrinsicFunction(&F, NewFn)) UpgradedIntrinsics[&F] = NewFn; Looking through UpgradeIntrinsicFunction, we always return false OR NewFn will be set to a different function from our source. This patch pulls the F != NewFn into UpgradeIntrinsicFunction as an assert, and removes the check from callers of UpgradeIntrinsicFunction. Reviewers: rafael, chandlerc Subscribers: llvm-commits-list Differential Revision: http://reviews.llvm.org/D10915 llvm-svn: 241369
* DIBuilder: Now that DICompileUnit is distinct, stop using temporary nodesAdrian Prantl2015-07-021-40/+33
| | | | | | for the arrays. llvm-svn: 241308
* Add functions for adding and testing string attributes to CallInst. NFC.Akira Hatanaka2015-07-021-8/+6
| | | | | | | This change is needed later when I make changes to attach string function attributes to llvm.trap and llvm.debugtrap. llvm-svn: 241304
* Fix a fixme and make DICompileUnit a distinct node. Tested via clang.Adrian Prantl2015-06-301-3/+1
| | | | llvm-svn: 241097
* Add a DIModule metadata node to the IR.Adrian Prantl2015-06-296-0/+83
| | | | | | | | | | | | | | | | | | | It is meant to be used to record modules @imported by the current compile unit, so a debugger an import the same modules to replicate this environment before dropping into the expression evaluator. DIModule is a sibling to DINamespace and behaves quite similarly. In addition to the name of the module it also records the module configuration details that are necessary to uniquely identify the module. This includes the configuration macros (e.g., -DNDEBUG), the include path where the module.map file is to be found, and the isysroot. The idea is that the backend will turn this into a DW_TAG_module. http://reviews.llvm.org/D9614 rdar://problem/20965932 llvm-svn: 241017
* IR: Expose ModuleSlotTracker in Value::print()Duncan P. N. Exon Smith2015-06-271-10/+29
| | | | | | | | | | | | | | | | | | | Allow callers of `Value::print()` and `Metadata::print()` to pass in a `ModuleSlotTracker`. This allows them to pay only once for calculating module-level slots (such as Metadata). This is related to PR23865, where there was a huge cost for `MachineFunction::print()`. Although I don't have a *particular* user in mind for this new code, I have hit big slowdowns before when running `opt -debug`, and I think this will be useful. Going forward, if someone hits a big slowdown with `print()` statements, they can create a `ModuleSlotTracker` and send it through. Similarly, adding support to `Value::dump()` and `Metadata::dump()` should be trivial. I added unit tests to be sure the `print()` functions actually behave the same way with and without the slot tracker. llvm-svn: 240867
* Plug a leak introduced by r240848Duncan P. N. Exon Smith2015-06-271-2/+5
| | | | | | | | | Apparently this obvious leak was never exercised before, but r240848 exposed it. Plug it. http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/5075 llvm-svn: 240865
* CodeGen: Push the ModuleSlotTracker through MetadataDuncan P. N. Exon Smith2015-06-261-11/+19
| | | | | | | | For another 1% speedup on the testcase in PR23865, push the `ModuleSlotTracker` through to metadata-related printing in `MachineBasicBlock::print()`. llvm-svn: 240848
* Minor style cleanup after 240843 [NFC]Philip Reames2015-06-261-8/+7
| | | | | | Use a for-each loop in one case and rename the function to reflect it's new usage. llvm-svn: 240847
* [Verifier] Follow on to 240836Philip Reames2015-06-261-81/+79
| | | | | | Address one missed review comment and do the rename I left out of that patch to make it reviewable. llvm-svn: 240843
OpenPOWER on IntegriCloud