summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
Commit message (Collapse)AuthorAgeFilesLines
* Reverting r199886 (Prevent repetitive warnings for unrecognized processors ↵Artyom Skrobov2014-01-252-38/+27
| | | | | | and features) llvm-svn: 200083
* Fix known typosAlp Toker2014-01-241-4/+4
| | | | | | | Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. llvm-svn: 200018
* Simplify the logic for deciding when to initialize the sections.Rafael Espindola2014-01-244-6/+10
| | | | llvm-svn: 199971
* Most streamers' InitSections just create a text section. Make that the defaultRafael Espindola2014-01-245-17/+5
| | | | llvm-svn: 199969
* Inline trivial functions called only once or twice.Rafael Espindola2014-01-241-32/+14
| | | | llvm-svn: 199967
* Inline functions that are only called once.Rafael Espindola2014-01-241-17/+8
| | | | llvm-svn: 199965
* InitToTextSection is redundant with InitSections. Remove it.Rafael Espindola2014-01-237-27/+1
| | | | llvm-svn: 199955
* Remove duplicated info on what .text, .data and .bss look like.Rafael Espindola2014-01-233-41/+15
| | | | llvm-svn: 199951
* Prevent repetitive warnings for unrecognized processors and featuresArtyom Skrobov2014-01-232-27/+38
| | | | llvm-svn: 199886
* Fix inline assembly that switches between ARM and Thumb modesGreg Fitzgerald2014-01-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch restores the ARM mode if the user's inline assembly does not. In the object streamer, it ensures that instructions following the inline assembly are encoded correctly and that correct mapping symbols are emitted. For the asm streamer, it emits a .arm or .thumb directive. This patch does not ensure that the inline assembly contains the ADR instruction to switch modes at runtime. The problem we need to solve is code like this: int foo(int a, int b) { int r = a + b; asm volatile( ".align 2 \n" ".arm \n" "add r0,r0,r0 \n" : : "r"(r)); return r+1; } If we compile this function in thumb mode then the inline assembly will switch to arm mode. We need to make sure that we switch back to thumb mode after emitting the inline assembly or we will incorrectly encode the instructions that follow (i.e. the assembly instructions for return r+1). Based on patch by David Peixotto Change-Id: Ib57f6d2d78a22afad5de8693fba6230ff56ba48b llvm-svn: 199818
* Tweak the MCExternalSymbolizer to not use the SymbolLookUp() call backKevin Enderby2014-01-211-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to not guess at a symbol name in some cases. The problem is that in object files assembled starting at address 0, when trying to symbolicate something that starts like this: % cat x.s _t1: vpshufd $0x0, %xmm1, %xmm0 the symbolic disassembly can end up like this: % otool -tV x.o x.o: (__TEXT,__text) section _t1: 0000000000000000 vpshufd $_t1, %xmm1, %xmm0 Which is in this case produced incorrect symbolication. But it is useful in some cases to use the SymbolLookUp() call back to guess at some immediate values. For example one like this that does not have an external relocation entry: % cat y.s _t1: movl $_d1, %eax .data _d1: .long 0 % clang -c -arch i386 y.s % otool -tV y.o y.o: (__TEXT,__text) section _t1: 0000000000000000 movl $_d1, %eax % otool -rv y.o y.o: Relocation information (__TEXT,__text) 1 entries address pcrel length extern type scattered symbolnum/value 00000001 False long False VANILLA False 2 (__DATA,__data) So the change is based on it is not likely that an immediate Value coming from an instruction field of a width of 1 byte, other than branches and items with relocation, are not likely symbol addresses. With the change the first case above simply becomes: % otool -tV x.o x.o: (__TEXT,__text) section _t1: 0000000000000000 vpshufd $0x0, %xmm1, %xmm0 and the second case continues to work as expected. rdar://14863405 llvm-svn: 199698
* ARM: add tlsldo relocationKai Nacke2014-01-201-0/+3
| | | | | | | | | Add support for the symbol(tlsldo) relocation. This is required in order to solve PR18554. Reviewed by R. Golin, A. Korobeynikov. llvm-svn: 199644
* Tweak the MCExternalSymbolizer to print references to C string literalsKevin Enderby2014-01-161-2/+5
| | | | | | | | | | | | | | | with raw_ostream's write_escaped() method. For example darwin's otool(1) program that uses the llvm disassembler now produces disassembly like this: leaq 0x7b(%rip), %rdi ## literal pool for: "%f\ntoto\n" and not print the new lines which messes up the output. rdar://15145300 llvm-svn: 199407
* Add an emitRawComment function and use it to simplify some uses of EmitRawText.Rafael Espindola2014-01-162-0/+11
| | | | llvm-svn: 199397
* CommentColumn is always 40. Simplify.Rafael Espindola2014-01-161-1/+0
| | | | llvm-svn: 199357
* Fix parsing of .symver directive on ARMDavid Peixotto2014-01-151-0/+7
| | | | | | | | | | | | | | | ARM assembly syntax uses @ for a comment, execpt for the second parameter of the .symver directive which requires @ as part of the symbol name. This commit fixes the parsing of this directive by adding a special case for ARM for this one argumnet. To make the change we had to move the AllowAtInIdentifier variable to the MCAsmLexer interface (from AsmLexer) and expose a setter for the value. The ELFAsmParser then toggles this value when parsing the second argument to the .symver directive for a target that uses @ as a comment symbol llvm-svn: 199339
* Replace .mips_hack_stocg with ".set micromips" and ".set nomicromips".Rafael Espindola2014-01-141-0/+5
| | | | | | | This matches what gnu as does and implementing this is easier than arguing about it. llvm-svn: 199181
* Fix indentation.Joerg Sonnenberger2014-01-131-11/+11
| | | | llvm-svn: 199118
* Revert "Revert r198851, "Prototype of skeleton type units for fission""David Blaikie2014-01-101-2/+3
| | | | | | | | | This reverts commit r198865 which reverts r198851. ASan identified a use-of-uninitialized of the DwarfTypeUnit::Ty variable in skeleton type units. llvm-svn: 198908
* Revert r198851, "Prototype of skeleton type units for fission"NAKAMURA Takumi2014-01-091-3/+2
| | | | | | It caused undefined behavior. DwarfTypeUnit::Ty might not be initialized properly, I guess. llvm-svn: 198865
* Prototype of skeleton type units for fissionDavid Blaikie2014-01-091-2/+3
| | | | llvm-svn: 198851
* Force emit a relocation for @gnu_indirect_function symbols so that the indirectRoman Divacky2014-01-081-1/+1
| | | | | | resolution works. llvm-svn: 198780
* [patch] Adjust behavior of FDE cross-section relocs for targets that don't ↵Iain Sandoe2014-01-082-6/+11
| | | | | | | | | | | | support abs-differences. Modern versions of OSX/Darwin's ld (ld64 > 97.17) have an optimisation present that allows the back end to omit relocations (and replace them with an absolute difference) for FDE some text section refs. This patch allows a backend to opt-in to this behaviour by setting "DwarfFDESymbolsUseAbsDiff". At present, this is only enabled for modern x86 OSX ports. test changes by David Fang. llvm-svn: 198744
* In the ELFWriter when writing aliased (.set) symbols dont blindlyRoman Divacky2014-01-071-1/+36
| | | | | | | | | | | | take type from the new symbol but merge them so that the type is never "downgraded". This is probably quite rare, except for IFUNC symbols which we used to misassemble, losing the IFUNC type. Fixes #18372. llvm-svn: 198706
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-077-8/+7
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* MCParser: introduce Note and use it for ARM AsmParserSaleem Abdulrasool2014-01-071-0/+6
| | | | | | | | Introduce a new virtual method Note into the AsmParser. This completements the existing Warning and Error methods. Use the new method to clean up the output of the unwind routines in the ARM AsmParser. llvm-svn: 198661
* For the 'C' disassembler API, add a new ReferenceType for theKevin Enderby2014-01-062-0/+4
| | | | | | | | | | | | | | | | | | | SymbolLookUp() call back to return a demangled C++ name to be used as a comment. For example darwin's otool(1) program the uses the llvm disassembler now can produce disassembly like: callq __ZNK4llvm6Target20createMCDisassemblerERKNS_15MCSubtargetInfoE ## llvm::Target::createMCDisassembler(llvm::MCSubtargetInfo const&) const Also fix a bug in LLVMDisasmInstruction() that was not flushing the raw_svector_ostream for the disassembled instruction string before copying it to the output buffer that was causing truncation of the output. rdar://10173828 llvm-svn: 198637
* MC: Fatally error if subtraction operand is badDavid Majnemer2014-01-062-5/+22
| | | | | | | | | Instead of crashing, raise an error when a subtraction expression involves an undefined symbol. This fixes PR18375. llvm-svn: 198590
* Revert "For disassembly when adding a symbolic operand that is a C++ symbol ↵Reid Kleckner2014-01-032-10/+0
| | | | | | | | | | | | | | name, also put the human readable name in a comment." This reverts commit r198441. This change doesn't build on Windows, and doesn't do the right thing on Linux and other platforms that don't use a _Z prefix instead of __Z for C++ names. It also had no tests, so it wasn't clear how to fix it forward. llvm-svn: 198445
* For disassembly when adding a symbolic operand that is a C++Kevin Enderby2014-01-032-0/+10
| | | | | | | | | | | | | symbol name, also put the human readable name in a comment. Also fix a bug in LLVMDisasmInstruction() that was not flushing the raw_svector_ostream for the disassembled instruction string before copying it to the output buffer that was causing truncation of the output. rdar://10173828 llvm-svn: 198441
* Make the llvm mangler depend only on DataLayout.Rafael Espindola2014-01-033-7/+0
| | | | | | | | | | | | | | 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
* AsmParser: cleanup diagnostics for .rep/.reptSaleem Abdulrasool2013-12-281-3/+10
| | | | | | | Avoid double diagnostics for invalid expressions for count. Improve caret location for negative count. llvm-svn: 198099
* IAS: support .rep as an alias for .reptSaleem Abdulrasool2013-12-281-5/+8
| | | | | | | The GNU assembler supports .rep as an alias for .rept. This simply creates the alias for it and introduces a test for both .rept and .rep. llvm-svn: 198097
* clang-format a couple of mis-formatted functionsTimur Iskhodzhanov2013-12-201-14/+8
| | | | llvm-svn: 197831
* [COFF] Add support for the .secidx directiveTimur Iskhodzhanov2013-12-204-2/+41
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D2445 llvm-svn: 197826
* Add a finishParse() callback to the targer asm parserDavid Peixotto2013-12-191-0/+4
| | | | | | | | This callback is invoked when the parse has finished successfuly. It will be used to write out ARM constant pools to implement the ldr pseudo. llvm-svn: 197706
* AsmParser: add support for .end directiveSaleem Abdulrasool2013-12-181-1/+22
| | | | | | | | | | | | | The .end directive indicates the end of the file. No further instructions are processed after a .end directive is encountered. One potential (glaringly obvious) optimisation that could be pursued here is to extend MCAsmParser with a DiscardRemainder method to avoid processing lexemes to the end of the file. It was unclear at this point if that would be worth adding, and could easily be added in a follow on change. Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org> llvm-svn: 197547
* MC COFF: Emit the 'b' section flag for .bss sections in GNU assemblyReid Kleckner2013-12-171-0/+2
| | | | | | | | | Without this, assembling clang's disassembly would produce an object file with the IMAGE_SCN_CNT_INITIALIZED_DATA section characteristic rather than the uninitialized one. link.exe would warn when merging comdats with different flags. llvm-svn: 197529
* DebugInfo: Move type units into the debug_types section with appropriate ↵David Blaikie2013-12-131-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | comdat grouping and type unit headers This commit does not complete the type units feature - there are issues around fission support (skeletal type units, pubtypes/pubnames) and hashing of some types including those containing references to types in other type units. Originally committed as r197073 and reverted in r197079. Recommitted as r197197 to reproduce the failure and reverted as r197199 Turns out there was unstable ordering in the type unit dumping code. Fixed by using MapVector in DWARFContext to store the debug_types comdat sections. Recommitted as r197210 with a fix to dumping and reverted as r197211 because I was a bit gun shy and thought I saw a failure that turned out to be unrelated. So here we go - once more with feeling! \o/ llvm-svn: 197275
* Revert "DebugInfo: Move type units into the debug_types section with ↵David Blaikie2013-12-131-12/+0
| | | | | | | | appropriate comdat grouping and type unit headers" This reverts commit r197210. llvm-svn: 197211
* DebugInfo: Move type units into the debug_types section with appropriate ↵David Blaikie2013-12-131-0/+12
| | | | | | | | | | | | | | | | | | comdat grouping and type unit headers This commit does not complete the type units feature - there are issues around fission support (skeletal type units, pubtypes/pubnames) and hashing of some types including those containing references to types in other type units. Originally committed as r197073 and reverted in r197079. Recommitted as r197197 to reproduce the failure and reverted as r197199 Turns out there was unstable ordering in the type unit dumping code. Fixed by using MapVector in DWARFContext to store the debug_types comdat sections. llvm-svn: 197210
* Revert "DebugInfo: Move type units into the debug_types section with ↵David Blaikie2013-12-131-12/+0
| | | | | | | | appropriate comdat grouping and type unit headers" This reverts commit r197197. llvm-svn: 197199
* DebugInfo: Move type units into the debug_types section with appropriate ↵David Blaikie2013-12-131-0/+12
| | | | | | | | | | | | | | | | | | | comdat grouping and type unit headers This commit does not complete the type units feature - there are issues around fission support (skeletal type units, pubtypes/pubnames) and hashing of some types including those containing references to types in other type units. Originally committed as r197073 and reverted in r197079. This commit originally got jumbled up with another build-breaking commit and I can't find the failures I thought this caused anymore. Recommitting to hopefully get some clean buildbot results to work from. I have a sneaking suspicion there's unstable output in the comdat group output of MCStreamer... llvm-svn: 197197
* Revert "DebugInfo: Move type units into the debug_types section with ↵David Blaikie2013-12-111-12/+0
| | | | | | | | | | | | appropriate comdat grouping and type unit headers" This reverts commit r197073. The test seems to be failing on some buildbots for unknown reasons. Reverting until I can figure that out. If anyone's got a reproduction (.s and .o together would be great) - I'd really appreciate it. llvm-svn: 197079
* DebugInfo: Move type units into the debug_types section with appropriate ↵David Blaikie2013-12-111-0/+12
| | | | | | | | | | | comdat grouping and type unit headers This commit does not complete the type units feature - there are issues around fission support (skeletal type units, pubtypes/pubnames) and hashing of some types including those containing references to types in other type units. llvm-svn: 197073
* Prune redundant dependencies in LLVMBuild.txt.NAKAMURA Takumi2013-12-111-1/+1
| | | | llvm-svn: 196988
* on darwin<10, fallback to .weak_definition (PPC,X86)David Fang2013-12-102-0/+2
| | | | | | .weak_def_can_be_hidden was not yet supported by the system assembler llvm-svn: 196970
* Reland "Fix miscompile of MS inline assembly with stack realignment"Reid Kleckner2013-12-101-0/+5
| | | | | | | | | | | This re-lands commit r196876, which was reverted in r196879. The tests have been fixed to pass on platforms with a stack alignment larger than 4. Update to clang side tests will land shortly. llvm-svn: 196939
* Revert "Fix miscompile of MS inline assembly with stack realignment"Reid Kleckner2013-12-101-5/+0
| | | | | | | This reverts commit r196876. Its tests failed on the bots, so I'll figure it out tomorrow. llvm-svn: 196879
* Fix miscompile of MS inline assembly with stack realignmentReid Kleckner2013-12-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | For stack frames requiring realignment, three pointers may be needed: - ebp to address incoming arguments - esi (could be any callee-saved register) to address locals - esp to address outgoing arguments We would use esi unconditionally without verifying that it did not conflict with inline assembly. This change doesn't do the verification, it simply emits a fatal error on functions that use stack realignment, dynamic SP adjustments, and inline assembly. Because stack realignment is common on Windows, we also no longer assume that MS inline assembly clobbers esp. Instead, we analyze the inline instructions for implicit definitions and check if esp is there. If so, we require the use of a base pointer and consider it in the condition above. Mostly fixes PR16830, but we could try harder to find a non-conflicting base pointer. Reviewers: sunfish Differential Revision: http://llvm-reviews.chandlerc.com/D1317 llvm-svn: 196876
OpenPOWER on IntegriCloud