summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePassesMatthias Braun2016-08-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | Re-apply this commit with the deletion of a MachineFunction delegated to a separate pass to avoid use after free when doing this directly in AsmPrinter. This patch removes the MachineFunctionAnalysis. Instead we keep a map from IR Function to MachineFunction in the MachineModuleInfo. This allows the insertion of ModulePasses into the codegen pipeline without breaking it because the MachineFunctionAnalysis gets dropped before a module pass. Peak memory should stay unchanged without a ModulePass in the codegen pipeline: Previously the MachineFunction was freed at the end of a codegen function pipeline because the MachineFunctionAnalysis was dropped; With this patch the MachineFunction is freed after the AsmPrinter has finished. Differential Revision: http://reviews.llvm.org/D23736 llvm-svn: 279564
* Revert "(HEAD -> master, origin/master, origin/HEAD) CodeGen: Remove ↵Matthias Braun2016-08-231-7/+0
| | | | | | | | | | MachineFunctionAnalysis => Enable (Machine)ModulePasses" Reverting while tracking down a use after free. This reverts commit r279502. llvm-svn: 279503
* CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePassesMatthias Braun2016-08-231-0/+7
| | | | | | | | | | | | | | | | | | | This patch removes the MachineFunctionAnalysis. Instead we keep a map from IR Function to MachineFunction in the MachineModuleInfo. This allows the insertion of ModulePasses into the codegen pipeline without breaking it because the MachineFunctionAnalysis gets dropped before a module pass. Peak memory should stay unchanged without a ModulePass in the codegen pipeline: Previously the MachineFunction was freed at the end of a codegen function pipeline because the MachineFunctionAnalysis was dropped; With this patch the MachineFunction is freed after the AsmPrinter has finished. Differential Revision: http://reviews.llvm.org/D23736 llvm-svn: 279502
* Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-172-17/+17
| | | | | | Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
* Support the DW_AT_noreturn DWARF flag.Adrian Prantl2016-08-171-0/+3
| | | | | | | | | | | This is used to mark functions with the C++11 [[ noreturn ]] or C11 _Noreturn attributes. Patch by Victor Leschuk! https://reviews.llvm.org/D23167 llvm-svn: 278940
* Use the range variant of find instead of unpacking begin/endDavid Majnemer2016-08-112-3/+3
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433
* Use range algorithms instead of unpacking begin/endDavid Majnemer2016-08-113-9/+7
| | | | | | No functionality change is intended. llvm-svn: 278417
* Improve virtual register handling when computing debug informationDominic Chen2016-08-111-7/+16
| | | | | | | | | | | | Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered. Reviewers: dexonsmith, dschuff, aprantl Subscribers: yurydelendik, llvm-commits, jfb, sunfish Differential Revision: https://reviews.llvm.org/D22590 llvm-svn: 278371
* [MC] Delete use of *structors_used.Davide Italiano2016-08-081-12/+0
| | | | | | | Jim Grosbach and Kevin Enderby think those are not used anymore. Originally submitted by: Rafael Espindola llvm-svn: 277973
* Move helpers into anonymous namespaces. NFC.Benjamin Kramer2016-08-062-3/+1
| | | | llvm-svn: 277916
* [CodeView] Decouple record deserialization from visitor dispatch.Zachary Turner2016-08-051-36/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, our use case for the visitor has been to take a stream of bytes representing a type stream, deserialize the records in sequence, and do something with them, where "something" is determined by how the user implements a particular set of callbacks on an abstract class. For actually writing PDBs, however, we want to do the reverse. We have some kind of description of the list of records in their in-memory format, and we want to process each one. Perhaps by serializing them to a byte stream, or perhaps by converting them from one description format (Yaml) to another (in-memory representation). This was difficult in the current model because deserialization and invoking the callbacks were tightly coupled. With this patch we change this so that TypeDeserializer is itself an implementation of the particular set of callbacks. This decouples deserialization from the iteration over a list of records and invocation of the callbacks. TypeDeserializer is initialized with another implementation of the callback interface, so that upon deserialization it can pass the deserialized record through to the next set of callbacks. In a sense this is like an implementation of the Decorator design pattern, where the Deserializer is a decorator. This will be useful for writing Pdbs from yaml, where we have a description of the type records in Yaml format. In this case, the visitor implementation would have each visitation callback method implemented in such a way as to extract the proper set of fields from the Yaml, and it could maintain state that builds up a list of these records. Finally at the end we can pass this information through to another set of callbacks which serializes them into a byte stream. Reviewed By: majnemer, ruiu, rnk Differential Revision: https://reviews.llvm.org/D23177 llvm-svn: 277871
* [msf] Resubmit "Rename Msf -> MSF".Zachary Turner2016-07-292-3/+3
| | | | | | | | | | | | | Previously this change was submitted from a Windows machine, so changes made to the case of filenames and directory names did not survive the commit, and as a result the CMake source file names and the on-disk file names did not match on case-sensitive file systems. I'm resubmitting this patch from a Linux system, which hopefully allows the case changes to make it through unfettered. llvm-svn: 277213
* Revert "[msf] Rename Msf to MSF."Zachary Turner2016-07-292-3/+3
| | | | | | This reverts commit 4d1557ffac41e079bcb1abbcf04f512474dcd6fe. llvm-svn: 277194
* [msf] Rename Msf to MSF.Zachary Turner2016-07-292-3/+3
| | | | | | | | In a previous patch, it was suggested to use all caps instead of rolling caps for initialisms, so this patch changes everything to do this. llvm-svn: 277190
* [ConstnatFolding] Teach the folder how to fold ConstantVectorDavid Majnemer2016-07-291-2/+2
| | | | | | | | | | | A ConstantVector can have ConstantExpr operands and vice versa. However, the folder had no ability to fold ConstantVectors which, in some cases, was an optimization barrier. Instead, rephrase the folder in terms of Constants instead of ConstantExprs and teach callers how to deal with failure. llvm-svn: 277099
* [pdb] Refactor library to more clearly separate reading/writingZachary Turner2016-07-281-1/+1
| | | | | | | Reviewed By: amccarth, ruiu Differential Revision: https://reviews.llvm.org/D22693 llvm-svn: 277019
* MachineFunction: Return reference for getFrameInfo(); NFCMatthias Braun2016-07-282-8/+8
| | | | | | | getFrameInfo() never returns nullptr so we should use a reference instead of a pointer. llvm-svn: 277017
* [CodeView] Don't crash on functions without subprogramsDavid Majnemer2016-07-281-7/+6
| | | | | | | | | A function may have instructions annotated with debug info without having a subprogram. This fixes PR28747. llvm-svn: 276956
* Remove MCAsmInfo.h include from TargetOptions.hReid Kleckner2016-07-271-0/+1
| | | | | | | | | TargetOptions wants the ExceptionHandling enum. Move that to MCTargetOptions.h to avoid transitively including Dwarf.h everywhere in clang. Now you can add a DWARF tag without a full rebuild of clang semantic analysis. llvm-svn: 276883
* [msf] Create LLVMDebugInfoMsfZachary Turner2016-07-222-2/+4
| | | | | | | | | | | | | | This provides a better layering of responsibilities among different aspects of PDB writing code. Some of the MSF related code was contained in CodeView, and some was in PDB prior to this. Further, we were often saying PDB when we meant MSF, and the two are actually independent of each other since in theory you can have other types of data besides PDB data in an MSF. So, this patch separates the MSF specific code into its own library, with no dependencies on anything else, and DebugInfoCodeView and DebugInfoPDB take dependencies on DebugInfoMsf. llvm-svn: 276458
* CodeGen: avoid emitting unnecessary CFISaleem Abdulrasool2016-07-151-4/+5
| | | | | | | | | | | | Remove unnecessary clutter in assembly output. When using SjLj EH, the CFI is not actually used for anything. Do not emit the CFI needlessly. The minor test adjustments are interesting. The prologue test was just overzealous matcching. The interesting case is the LSDA change. It was originally added to ensure that various compilations did not mangle the name (it explicitly checked the name!). However, subsequent cleanups made it more reliant on the CFI to find the name. Parse the generated code flow to generically find the label still. llvm-svn: 275614
* [codeview] Shrink inlined call site line info tablesReid Kleckner2016-07-141-0/+3
| | | | | | | | | | | For a fully inlined call chain like a -> b -> c -> d, we were emitting line info for 'd' 3 separate times: once for d's actual InlineSite line table, and twice for 'b' and 'c'. This is particularly inefficient when all these functions are in different headers, because now we need to encode the file change. Windbg was coping with our suboptimal output, so this should not be noticeable from the debugger. llvm-svn: 275502
* [codeview] Improved array type support.Amjad Aboud2016-07-124-33/+87
| | | | | | | | | | | | Added support for: 1. Multi dimension array. 2. Array of structure type, which previously was declared incompletely. 3. Dynamic size array. 4. Array where element type is a typedef, volatile or constant (this should resolve PR28311). Differential Revision: http://reviews.llvm.org/D21526 llvm-svn: 275167
* [COFF, Dwarf] Don't emit DW_AT_location for dllimported entitiesDavid Majnemer2016-07-092-55/+66
| | | | | | | There exists no relocation which can describe the address of a dllimported variable: do not try to describe their location. llvm-svn: 274986
* AsmPrinter: Fix emitKill() not flush()ing a raw_string_ostreamMatthias Braun2016-07-091-1/+1
| | | | llvm-svn: 274951
* AsmPrinter: Avoid implicit iterator conversions in ↵Duncan P. N. Exon Smith2016-07-081-2/+2
| | | | | | DbgValueHistoryCalculator, NFC llvm-svn: 274911
* [CodeView] Implement support for thread-local variablesDavid Majnemer2016-07-071-4/+15
| | | | llvm-svn: 274734
* [CodeView] Emit an appropriate symbol kind for globalsDavid Majnemer2016-07-061-2/+12
| | | | | | | We emitted debug info for globals/functions as if they all had external linkage. Instead, emit local symbol records when appropriate. llvm-svn: 274676
* [CodeView] Unions are always sealedDavid Majnemer2016-07-061-1/+1
| | | | | | | It is impossible to inherit from a union. We are missing a way to represent this in IR for classes/structs... llvm-svn: 274675
* Retry: "Emit CodeView type records for nested classes."Adrian McCarthy2016-07-062-7/+29
| | | | | | | | | | Now with a corrected test to account for a recently supported properties bit in the debug info of a struct. Original review: http://reviews.llvm.org/D21939 This reverts commit 970c3fd497a28d25dd69526eb52594a696c37968. llvm-svn: 274661
* Revert "Emit CodeView type records for nested classes."Adrian McCarthy2016-07-062-29/+7
| | | | | | This reverts commit 256b29322c827a2d94da56468c936596f5509032. llvm-svn: 274632
* Emit CodeView type records for nested classes.Adrian McCarthy2016-07-062-7/+29
| | | | | | Differential Revision: http://reviews.llvm.org/D21939 llvm-svn: 274629
* [codeview] Set the Nested and Scoped ClassOptions based on the scope chainReid Kleckner2016-07-021-12/+31
| | | | | | These are set on both the declaration record and the definition record. llvm-svn: 274410
* [CodeView] Include the offset of nested membersDavid Majnemer2016-07-011-4/+5
| | | | | | | | | | | | | Given something like: struct S { int a; struct { int b; }; }; We would fail to give 'b' offset 4. Instead, we would give it the offset it has inside of it's struct. llvm-svn: 274400
* [CodeView] Pretty print anonymous scopesDavid Majnemer2016-07-011-14/+31
| | | | | | | | A namespace without a name should be written out as `anonymous namespace' while a tag type without a name should be written out as <unnamed-tag>. llvm-svn: 274399
* [codeview] Don't record UDTs for anonymous structsReid Kleckner2016-07-011-0/+4
| | | | | | | | MSVC makes up names for these anonymous structs, but we don't (yet). Eventually Clang should use getTypedefNameForAnonDecl() to put some name in the debug info, and we can update the test case when that happens. llvm-svn: 274391
* [codeview] Assert that our CV type records are validReid Kleckner2016-07-011-3/+27
| | | | | | | | | | | We were asserting that our type records were valid when emitting assembly, but not when emitting an object file. I've been seeing lots of LNK1285 errors (corrupt PDB) during incremental debug self-host builds with the MSVC linker, and hopefully this will catch some of them earlier. llvm-svn: 274373
* 80-column and comment fixups.Eric Christopher2016-07-011-5/+8
| | | | llvm-svn: 274335
* [codeview] Add DISubprogram::ThisAdjustmentReid Kleckner2016-07-011-24/+27
| | | | | | | | | | | | | | | | | | | | | Summary: This represents the adjustment applied to the implicit 'this' parameter in the prologue of a virtual method in the MS C++ ABI. The adjustment is always zero unless multiple inheritance is involved. This increases the size of DISubprogram by 8 bytes, unfortunately. The adjustment really is a signed 32-bit integer. If this size increase is too much, we could probably win it back by splitting out a subclass with info specific to virtual methods (virtuality, vindex, thisadjustment, containingType). Reviewers: aprantl, dexonsmith Subscribers: aaboud, amccarth, llvm-commits Differential Revision: http://reviews.llvm.org/D21614 llvm-svn: 274325
* [CodeView] Implement support for bitfields in LLVMDavid Majnemer2016-06-301-11/+21
| | | | | | | | | | | | | CodeView need to know the offset of the storage allocation for a bitfield. Encode this via the "extraData" field in DIDerivedType and introduced a new flag, DIFlagBitField, to indicate whether or not a member is a bitfield. This fixes PR28162. Differential Revision: http://reviews.llvm.org/D21782 llvm-svn: 274200
* CodeGen: Use MachineInstr& in TargetInstrInfo, NFCDuncan P. N. Exon Smith2016-06-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly a mechanical change to make TargetInstrInfo API take MachineInstr& (instead of MachineInstr* or MachineBasicBlock::iterator) when the argument is expected to be a valid MachineInstr. This is a general API improvement. Although it would be possible to do this one function at a time, that would demand a quadratic amount of churn since many of these functions call each other. Instead I've done everything as a block and just updated what was necessary. This is mostly mechanical fixes: adding and removing `*` and `&` operators. The only non-mechanical change is to split ARMBaseInstrInfo::getOperandLatencyImpl out from ARMBaseInstrInfo::getOperandLatency. Previously, the latter took a `MachineInstr*` which it updated to the instruction bundle leader; now, the latter calls the former either with the same `MachineInstr&` or the bundle leader. As a side effect, this removes a bunch of MachineInstr* to MachineBasicBlock::iterator implicit conversions, a necessary step toward fixing PR26753. Note: I updated WebAssembly, Lanai, and AVR (despite being off-by-default) since it turned out to be easy. I couldn't run tests for AVR since llc doesn't link with it turned on. llvm-svn: 274189
* Use isPositionIndependent in a few more places.Rafael Espindola2016-06-281-1/+1
| | | | | | | | | I think this converts all the simple cases that really just care about the generated code being position independent or not. The remaining uses are a bit more complicated and are checking things like "is this a library or executable" or "can this symbol be preempted". llvm-svn: 274055
* Move isPositionIndependent up to AsmPrinter.Rafael Espindola2016-06-271-0/+4
| | | | | | Use it in ppc too. llvm-svn: 273877
* Revert r273807 (and r273809, r273810), it caused PR28311Nico Weber2016-06-261-49/+3
| | | | llvm-svn: 273815
* Fixed build failure (due to unused variable error) in r273807.Amjad Aboud2016-06-261-0/+1
| | | | llvm-svn: 273810
* Fixed build failure (due to unused variable error) in r273807.Amjad Aboud2016-06-261-3/+1
| | | | llvm-svn: 273809
* [codeview] Improved array type support.Amjad Aboud2016-06-261-2/+49
| | | | | | | | | | | Added support for: 1. Multi dimension array. 2. Array of structure type, which previously was declared incompletely. 3. Dynamic size array. Differential Revision: http://reviews.llvm.org/D21526 llvm-svn: 273807
* Fix the type signature of DwarfExpression::Add.*Constant to support values ↵Adrian Prantl2016-06-242-4/+4
| | | | | | | | | | | >32 bits. This fixes an embarrassing bug when emitting .debug_loc entries for 64-bit+ constants, which were previously silently truncated to 32 bits. <rdar://problem/26843232> llvm-svn: 273736
* [codeview] Emit parameter variables in the right orderReid Kleckner2016-06-242-4/+25
| | | | | | | | | | Clang emits them in reverse order to conform to the ABI, which requires left-to-right destruction. As a result, the order doesn't fall out naturally, and we have to sort things out in the backend. Fixes PR28213 llvm-svn: 273696
* [codeview] Emit base class information from DW_TAG_inheritance nodesReid Kleckner2016-06-242-3/+49
| | | | | | | | | | | | | | | | There are two remaining issues here: 1. No vbptr information 2. Need to mention indirect virtual bases Getting indirect virtual bases is just a matter of adding an "indirect" flag, emitting them in the frontend, and ignoring them when appropriate for DWARF. All virtual bases use the same artificial vbptr field, so I think the vbptr offset will be best represented by an implicit __vbptr$ClassName member similar to our existing __vptr$ member. llvm-svn: 273688
OpenPOWER on IntegriCloud