summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Canonicalise Windows target triple spellingsSaleem Abdulrasool2014-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Construct a uniform Windows target triple nomenclature which is congruent to the Linux counterpart. The old triples are normalised to the new canonical form. This cleans up the long-standing issue of odd naming for various Windows environments. There are four different environments on Windows: MSVC: The MS ABI, MSVCRT environment as defined by Microsoft GNU: The MinGW32/MinGW32-W64 environment which uses MSVCRT and auxiliary libraries Itanium: The MSVCRT environment + libc++ built with Itanium ABI Cygnus: The Cygwin environment which uses custom libraries for everything The following spellings are now written as: i686-pc-win32 => i686-pc-windows-msvc i686-pc-mingw32 => i686-pc-windows-gnu i686-pc-cygwin => i686-pc-windows-cygnus This should be sufficiently flexible to allow us to target other windows environments in the future as necessary. llvm-svn: 204977
* MachO: Emit a version-min load command when possible.Jim Grosbach2014-03-181-0/+19
| | | | | | | | | When deployment target version information is available, emit it to the target streamer for inclusion in the object file. rdar://11337778 llvm-svn: 204191
* Remove the linker_private and linker_private_weak linkages.Rafael Espindola2014-03-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These linkages were introduced some time ago, but it was never very clear what exactly their semantics were or what they should be used for. Some investigation found these uses: * utf-16 strings in clang. * non-unnamed_addr strings produced by the sanitizers. It turns out they were just working around a more fundamental problem. For some sections a MachO linker needs a symbol in order to split the section into atoms, and llvm had no idea that was the case. I fixed that in r201700 and it is now safe to use the private linkage. When the object ends up in a section that requires symbols, llvm will use a 'l' prefix instead of a 'L' prefix and things just work. With that, these linkages were already dead, but there was a potential future user in the objc metadata information. I am still looking at CGObjcMac.cpp, but at this point I am convinced that linker_private and linker_private_weak are not what they need. The objc uses are currently split in * Regular symbols (no '\01' prefix). LLVM already directly provides whatever semantics they need. * Uses of a private name (start with "\01L" or "\01l") and private linkage. We can drop the "\01L" and "\01l" prefixes as soon as llvm agrees with clang on L being ok or not for a given section. I have two patches in code review for this. * Uses of private name and weak linkage. The last case is the one that one could think would fit one of these linkages. That is not the case. The semantics are * the linker will merge these symbol by *name*. * the linker will hide them in the final DSO. Given that the merging is done by name, any of the private (or internal) linkages would be a bad match. They allow llvm to rename the symbols, and that is really not what we want. From the llvm point of view, these objects should really be (linkonce|weak)(_odr)?. For now, just keeping the "\01l" prefix is probably the best for these symbols. If we one day want to have a more direct support in llvm, IMHO what we should add is not a linkage, it is just a hidden_symbol attribute. It would be applicable to multiple linkages. For example, on weak it would produce the current behavior we have for objc metadata. On internal, it would be equivalent to private (and we should then remove private). llvm-svn: 203866
* Reject alias to undefined symbols in the verifier.Rafael Espindola2014-03-121-5/+1
| | | | | | | | | | | | | | | On ELF and COFF an alias is just another name for a position in the file. There is no way to refer to a position in another file, so an alias to undefined is meaningless. MachO currently doesn't support aliases. The spec has a N_INDR, which when implemented will have a different set of restrictions. Adding support for it shouldn't be harder than any other IR extension. For now, having the IR represent what is actually possible with current tools makes it easier to fix the design of GlobalAlias. llvm-svn: 203705
* Accept Twine's to AsmPrinter::getTempSymbol (refactoring for an incoming change)David Blaikie2014-03-111-2/+2
| | | | llvm-svn: 203617
* Replace PROLOG_LABEL with a new CFI_INSTRUCTION.Rafael Espindola2014-03-071-17/+8
| | | | | | | | | | | | | | | | | | | | | | | 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
* Move some dwarf emission routines to AsmPrinterDwarf.cpp.Eric Christopher2014-03-071-156/+0
| | | | llvm-svn: 203191
* 80-column fixups.Eric Christopher2014-03-071-6/+8
| | | | llvm-svn: 203190
* Remove shouldEmitUsedDirectiveFor.Rafael Espindola2014-03-061-1/+1
| | | | | | Clang now uses llvm.compiler.used for these cases. llvm-svn: 203174
* [Layering] Move DebugInfo.h into the IR library where its implementationChandler Carruth2014-03-061-1/+1
| | | | | | already lives. llvm-svn: 203046
* 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
* [cleanup] Re-sort all the includes with utils/sort_includes.py.Chandler Carruth2014-03-041-1/+1
| | | | llvm-svn: 202811
* Debug info: Remove ARMAsmPrinter::EmitDwarfRegOp(). AsmPrinter can nowAdrian Prantl2014-02-271-34/+83
| | | | | | | | | | scan the register file for sub- and super-registers. No functionality change intended. (Tests are updated because the comments in the assembler output are different.) llvm-svn: 202416
* Fix a type error that crept into r202313.Adrian Prantl2014-02-261-1/+1
| | | | llvm-svn: 202317
* Debug info: Refactor AsmPrinter::EmitDwarfRegOp to make the control flowAdrian Prantl2014-02-261-60/+90
| | | | | | more obvious. llvm-svn: 202313
* move getNameWithPrefix and getSymbol to TargetMachine.Rafael Espindola2014-02-191-2/+2
| | | | | | | | | | TargetLoweringBase is implemented in CodeGen, so before this patch we had a dependency fom Target to CodeGen. This would show up as a link failure of llvm-stress when building with -DBUILD_SHARED_LIBS=ON. This fixes pr18900. llvm-svn: 201711
* Add back r201608, r201622, r201624 and r201625Rafael Espindola2014-02-191-4/+11
| | | | | | | | | | | | | | r201608 made llvm corretly handle private globals with MachO. r201622 fixed a bug in it and r201624 and r201625 were changes for using private linkage, assuming that llvm would do the right thing. They all got reverted because r201608 introduced a crash in LTO. This patch includes a fix for that. The issue was that TargetLoweringObjectFile now has to be initialized before we can mangle names of private globals. This is trivially true during the normal codegen pipeline (the asm printer does it), but LTO has to do it manually. llvm-svn: 201700
* Revert r201622 and r201608.Daniel Jasper2014-02-191-11/+4
| | | | | | | This causes the LLVMgold plugin to segfault. More information on the replies to r201608. llvm-svn: 201669
* Fix PR18743.Rafael Espindola2014-02-181-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | The IR @foo = private constant i32 42 is valid, but before this patch we would produce an invalid MachO from it. It was invalid because it would use an L label in a section where the liker needs the labels in order to atomize it. One way of fixing it would be to just reject this IR in the backend, but that would not be very front end friendly. What this patch does is use an 'l' prefix in sections that we know the linker requires symbols for atomizing them. This allows frontends to just use private and not worry about which sections they go to or how the linker handles them. One small issue with this strategy is that now a symbol name depends on the section, which is not available before codegen. This is not a problem in practice. The reason is that it only happens with private linkage, which will be ignored by the non codegen users (llvm-nm and llvm-ar). llvm-svn: 201608
* Generate the DWARF stack frame decode operations in the function prologue ↵Artyom Skrobov2014-02-141-1/+4
| | | | | | | | for ARM/Thumb functions. Patch by Keith Walker! llvm-svn: 201423
* Debug info: Bugfix for r201190: DW_OP_piece takes bytes, not bits.Adrian Prantl2014-02-121-2/+3
| | | | | | rdar://problem/16015314 llvm-svn: 201253
* Reapply r201180 with an additional error path.Adrian Prantl2014-02-111-3/+27
| | | | | | | | | | | | Debug info: Emit values in subregisters that do not have a separate DWARF register number by emitting a super-register + DW_OP_bit_piece. This is necessary because on x86_64, there are no DWARF register numbers for i386-style subregisters. Fixes a bunch of FIXMEs. rdar://problem/16015314 llvm-svn: 201190
* Revert "Debug info: Emit values in subregisters that do not have a separate"Adrian Prantl2014-02-111-22/+3
| | | | | | This reverts commit r201179 for buildbot breakage. llvm-svn: 201188
* whitespaceAdrian Prantl2014-02-111-1/+1
| | | | llvm-svn: 201181
* Debug info: Emit values in subregisters that do not have a separateAdrian Prantl2014-02-111-3/+22
| | | | | | | | | | | DWARF register number by emitting a super-register + DW_OP_bit_piece. This is necessary because on x86_64, there are no DWARF register numbers for i386-style subregisters. Fixes a bunch of FIXMEs. rdar://problem/16015314 llvm-svn: 201180
* Use a consistent argument order in TargetLoweringObjectFile.Rafael Espindola2014-02-091-2/+2
| | | | | | | | | These methods normally call each other and it is really annoying if the arguments are in different order. The more common rule was that the arguments specific to call are first (GV, Encoding, Suffix) and the auxiliary objects (Mang, TM) come after. This patch changes the exceptions. llvm-svn: 201044
* Pass the Mangler by reference.Rafael Espindola2014-02-081-7/+9
| | | | | | | It is never null and it is not used in casts, so there is no reason to use a pointer. This matches how we pass TM. llvm-svn: 201025
* Fix a bug with .weak_def_can_be_hidden: Mutable variables cannot use it.Rafael Espindola2014-02-071-0/+12
| | | | | | Thanks to John McCall for noticing it. llvm-svn: 200977
* Refactor logic into a function predicate.Rafael Espindola2014-02-071-14/+19
| | | | | | No functionality change. llvm-svn: 200976
* Remove support for not using .loc directives.Rafael Espindola2014-02-051-3/+0
| | | | | | Clang itself was not using this. The only way to access it was via llc. llvm-svn: 200862
* Use the default values.Rafael Espindola2014-02-041-1/+1
| | | | llvm-svn: 200781
* Remove a redundant call to hasRawTextSupport.Rafael Espindola2014-01-311-1/+1
| | | | | | The code path it was guarding was already using emitRawComment. llvm-svn: 200591
* Reland r200340 - 'Add line table debug info to COFF files when using a win32 ↵Timur Iskhodzhanov2014-01-301-3/+11
| | | | | | | | triple' This incorporates a couple of fixes reviewed at http://llvm-reviews.chandlerc.com/D2651 llvm-svn: 200440
* Revert r200340, "Add line table debug info to COFF files when using a win32 ↵NAKAMURA Takumi2014-01-291-11/+3
| | | | | | | | triple." It was incompatible with --target=i686-win32. llvm-svn: 200375
* Change MCStreamer EmitInstruction interface to take subtarget infoDavid Woodhouse2014-01-281-1/+10
| | | | llvm-svn: 200345
* Add line table debug info to COFF files when using a win32 triple.Timur Iskhodzhanov2014-01-281-3/+11
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D2232 llvm-svn: 200340
* Simplify the logic for deciding when to initialize the sections.Rafael Espindola2014-01-241-1/+1
| | | | llvm-svn: 199971
* Add an emitRawComment function and use it to simplify some uses of EmitRawText.Rafael Espindola2014-01-161-5/+4
| | | | llvm-svn: 199397
* WinCOFF: Transform IR expressions featuring __ImageBase into image relative ↵David Majnemer2014-01-151-0/+4
| | | | | | | | | | | | | relocations MSVC on x64 requires that we create image relative symbol references to refer to RTTI data. Seeing as how there is no way to explicitly make reference to a given relocation type in LLVM IR, pattern match expressions of the form &foo - &__ImageBase. Differential Revision: http://llvm-reviews.chandlerc.com/D2523 llvm-svn: 199312
* Decouple dllexport/dllimport from linkageNico Rieck2014-01-141-2/+0
| | | | | | | | | | | | | | | | | | | Representing dllexport/dllimport as distinct linkage types prevents using these attributes on templates and inline functions. Instead of introducing further mixed linkage types to include linkonce and weak ODR, the old import/export linkage types are replaced with a new separate visibility-like specifier: define available_externally dllimport void @f() {} @Var = dllexport global i32 1, align 4 Linkage for dllexported globals and functions is now equal to their linkage without dllexport. Imported globals and functions must be either declarations with external linkage, or definitions with AvailableExternallyLinkage. llvm-svn: 199218
* Revert "Decouple dllexport/dllimport from linkage"Nico Rieck2014-01-141-0/+2
| | | | | | | | Revert this for now until I fix an issue in Clang with it. This reverts commit r199204. llvm-svn: 199207
* Decouple dllexport/dllimport from linkageNico Rieck2014-01-141-2/+0
| | | | | | | | | | | | | | | | | | | Representing dllexport/dllimport as distinct linkage types prevents using these attributes on templates and inline functions. Instead of introducing further mixed linkage types to include linkonce and weak ODR, the old import/export linkage types are replaced with a new separate visibility-like specifier: define available_externally dllimport void @f() {} @Var = dllexport global i32 1, align 4 Linkage for dllexported globals and functions is now equal to their linkage without dllexport. Imported globals and functions must be either declarations with external linkage, or definitions with AvailableExternallyLinkage. llvm-svn: 199204
* Handle bundled terminators in isBlockOnlyReachableByFallthrough.Jakob Stoklund Olesen2014-01-121-7/+7
| | | | | | | | | | Targets like SPARC and MIPS have delay slots and normally bundle the delay slot instruction with the corresponding terminator. Teach isBlockOnlyReachableByFallthrough to find any MBB operands on bundled terminators so SPARC doesn't need to specialize this function. llvm-svn: 199061
* Put the functionality for printing a value to a raw_ostream as anChandler Carruth2014-01-091-4/+3
| | | | | | | | | | | | operand into the Value interface just like the core print method is. That gives a more conistent organization to the IR printing interfaces -- they are all attached to the IR objects themselves. Also, update all the users. This removes the 'Writer.h' header which contained only a single function declaration. llvm-svn: 198836
* Move the llvm mangler to lib/IR.Rafael Espindola2014-01-071-1/+1
| | | | | | This makes it available to tools that don't link with target (like llvm-ar). llvm-svn: 198708
* Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth2014-01-071-1/+1
| | | | | | | | | | | | | | | | | are part of the core IR library in order to support dumping and other basic functionality. Rename the 'Assembly' include directory to 'AsmParser' to match the library name and the only functionality left their -- printing has been in the core IR library for quite some time. Update all of the #includes to match. All of this started because I wanted to have the layering in good shape before I started adding support for printing LLVM IR using the new pass infrastructure, and commandline support for the new pass infrastructure. llvm-svn: 198688
* Make the llvm mangler depend only on DataLayout.Rafael Espindola2014-01-031-6/+11
| | | | | | | | | | | | | | Before this patch any program that wanted to know the final symbol name of a GlobalValue had to link with Target. This patch implements a compromise solution where the mangler uses DataLayout. This way, any tool that already links with Target (llc, clang) gets the exact behavior as before and new IR files can be mangled without linking with Target. With this patch the mangler is constructed with just a DataLayout and DataLayout is extended to include the information the Mangler needs. llvm-svn: 198438
* Remove AsmPrinter::needsRelocationsForDwarfStringPool() since it'sEric Christopher2013-12-281-4/+0
| | | | | | | just calling into MAI and is only abstracting for a single interface that we actually need to check in multiple places. llvm-svn: 198092
* Remove weak vtables. No functional change.Juergen Ributzka2013-12-141-0/+3
| | | | llvm-svn: 197323
* On ELF and COFF treat linker_private like private.Rafael Espindola2013-12-111-1/+1
| | | | | | | | The linkers on these systems don't have anything special to do with these symbols. Since the intent is for them to be absent from the final object, just treat them as private. llvm-svn: 197080
OpenPOWER on IntegriCloud