summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/AsmParser
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86] Make the instructions that use AdSize16/32/64 co-exist together ↵Craig Topper2015-01-023-72/+127
| | | | | | | | | | without using mode predicates. This is necessary to allow the disassembler to be able to handle AdSize32 instructions in 64-bit mode when address size prefix is used. Eventually we should probably also support 'addr32' and 'addr16' in the assembler to override the address size on some of these instructions. But for now we'll just use special operand types that will lookup the current mode size to select the right instruction. llvm-svn: 225075
* Use MCPhysReg for table of register encodings.Craig Topper2014-12-261-3/+3
| | | | llvm-svn: 224845
* [X86] Clean up whitespace as well as minor coding styleMichael Liao2014-12-041-14/+14
| | | | llvm-svn: 223339
* [X86][MC] Intel syntax: accept implicit memory operand sizes larger than 80.Ahmed Bougacha2014-12-031-1/+1
| | | | | | | | | | The X86AsmParser intel handling was refactored in r216481, making it try each different memory operand size to see which one matches. Operand sizes larger than 80 ("[xyz]mmword ptr") were forgotten, which led to an "invalid operand" error for code such as: movdqa [rax], xmm0 llvm-svn: 223187
* MCAsmParserExtension has a copy of the MCAsmParser. Use it.Rafael Espindola2014-11-111-12/+25
| | | | | | Base classes were storing a second copy. llvm-svn: 221667
* [asan-asm-instrumentation] Added comment describing how asm instrumentation ↵Yuri Gorshenin2014-10-271-0/+64
| | | | | | | | | | | | | | works. Summary: [asan-asm-instrumentation] Added comment describing how asm instrumentation works. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5970 llvm-svn: 220670
* X86AsmInstrumentation.cpp: Dissolve initializer-ranged-for. MSC17 disliked it.NAKAMURA Takumi2014-10-211-3/+3
| | | | llvm-svn: 220301
* [asan-asm-instrumentation] Fixed memory accesses with rbp as a base or an ↵Yuri Gorshenin2014-10-211-63/+121
| | | | | | | | | | | | | | index register. Summary: Fixed memory accesses with rbp as a base or an index register. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5819 llvm-svn: 220283
* [asan-asm-instrumentation] Follow-up fixes to r219602: asserts are moved intoYuri Gorshenin2014-10-131-8/+8
| | | | | | function. llvm-svn: 219610
* [asan-asm-instrumentation] Fixed memory references which includes %rsp as a ↵Yuri Gorshenin2014-10-131-111/+162
| | | | | | | | | | | | | | base or an index register. Summary: [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5599 llvm-svn: 219602
* [asan-asm-instrumentation] CFI directives are generated for .S files.Yuri Gorshenin2014-10-073-10/+51
| | | | | | | | | | | | Summary: CFI directives are generated for .S files. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5520 llvm-svn: 219199
* ms-inline-asm: Fix parsing label names inside bracket expressionsEhsan Akhgari2014-09-221-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This fixes a couple of issues. One is ensuring that AOK_Label rewrite rules have a lower priority than AOK_Skip rules, as AOK_Skip needs to be able to skip the brackets properly. The other part of the fix ensures that we don't overwrite Identifier when looking up the identifier, and that we use the locally available information to generate the AOK_Label rewrite in ParseIntelIdentifier. Doing that in CreateMemForInlineAsm would be problematic since the Start location there may point to the beginning of a bracket expression, and not necessarily the beginning of an identifier. This also means that we don't need to carry around the InternlName field, which helps simplify the code. Test Plan: This will be tested on the clang side. Reviewers: rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5445 llvm-svn: 218270
* ms-inline-asm: Add a sema callback for looking up label namesEhsan Akhgari2014-09-221-2/+18
| | | | | | | | | | | | | | | The implementation of the callback in clang's Sema will return an internal name for labels. Test Plan: Will be tested in clang. Reviewers: rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D4587 llvm-svn: 218229
* [asan-assembly-instrumentation] Added CFI directives to the generated ↵Yuri Gorshenin2014-09-103-1/+62
| | | | | | | | | | | | | | instrumentation code. Summary: [asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5189 llvm-svn: 217482
* [x86] Fix a pretty horrible bug and inconsistency in the x86 asmChandler Carruth2014-09-062-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parsing (and latent bug in the instruction definitions). This is effectively a revert of r136287 which tried to address a specific and narrow case of immediate operands failing to be accepted by x86 instructions with a pretty heavy hammer: it introduced a new kind of operand that behaved differently. All of that is removed with this commit, but the test cases are both preserved and enhanced. The core problem that r136287 and this commit are trying to handle is that gas accepts both of the following instructions: insertps $192, %xmm0, %xmm1 insertps $-64, %xmm0, %xmm1 These will encode to the same byte sequence, with the immediate occupying an 8-bit entry. The first form was fixed by r136287 but that broke the prior handling of the second form! =[ Ironically, we would still emit the second form in some cases and then be unable to re-assemble the output. The reason why the first instruction failed to be handled is because prior to r136287 the operands ere marked 'i32i8imm' which forces them to be sign-extenable. Clearly, that won't work for 192 in a single byte. However, making thim zero-extended or "unsigned" doesn't really address the core issue either because it breaks negative immediates. The correct fix is to make these operands 'i8imm' reflecting that they can be either signed or unsigned but must be 8-bit immediates. This patch backs out r136287 and then changes those places as well as some others to use 'i8imm' rather than one of the extended variants. Naturally, this broke something else. The custom DAG nodes had to be updated to have a much more accurate type constraint of an i8 node, and a bunch of Pat immediates needed to be specified as i8 values. The fallout didn't end there though. We also then ceased to be able to match the instruction-specific intrinsics to the instructions so modified. Digging, this is because they too used i32 rather than i8 in their signature. So I've also switched those intrinsics to i8 arguments in line with the instructions. In order to make the intrinsic adjustments of course, I also had to add auto upgrading for the intrinsics. I suspect that the intrinsic argument types may have led everything down this rabbit hole. Pretty happy with the result. llvm-svn: 217310
* [asan-assembly-instrumentation] Prologue and epilogue are moved out from ↵Yuri Gorshenin2014-09-014-173/+306
| | | | | | | | | | | | InstrumentMemOperand(). Reviewers: eugenis Subscribers: llvm-commits Differential revision: http://reviews.llvm.org/D4923 llvm-svn: 216879
* Revert "[asan-assembly-instrumentation] Prologue and epilogue are moved out ↵Yuri Gorshenin2014-09-013-305/+172
| | | | | | | | from InstrumentMemOperand()." This reverts commit 895aa397038b8de86d83ac0997a70949a486e112. llvm-svn: 216872
* [asan-assembly-instrumentation] Prologue and epilogue are moved out from ↵Yuri Gorshenin2014-09-013-172/+305
| | | | | | InstrumentMemOperand(). llvm-svn: 216869
* Remove 'virtual' keyword from methods markedwith 'override' keyword.Craig Topper2014-08-301-1/+1
| | | | llvm-svn: 216823
* X86 MC: Handle instructions like fxsave that match multiple operand sizesReid Kleckner2014-08-271-8/+18
| | | | | | | | | | | | | | | | Instructions like 'fxsave' and control flow instructions like 'jne' match any operand size. The loop I added to the Intel syntax matcher assumed that using a different size would give a different instruction. Now it handles the case where we get the same instruction for different memory operand sizes. This also allows us to remove the hack we had for unsized absolute memory operands, because we can successfully match things like 'jnz' without reporting ambiguity. Removing this hack uncovered test case involving 'fadd' that was ambiguous. The memory operand could have been single or double precision. llvm-svn: 216604
* Clang-format over X86AsmInstrumentation.* with LLVM style.Evgeniy Stepanov2014-08-272-129/+132
| | | | | | r216536 mistakenly used -style=Google instead of LLVM. llvm-svn: 216543
* Clang-format over X86AsmInstrumentation.*.Evgeniy Stepanov2014-08-272-183/+216
| | | | llvm-svn: 216536
* MC: Split the x86 asm matcher implementations by dialectReid Kleckner2014-08-262-33/+198
| | | | | | | | | | | | | | | | | | | The existing matcher has lots of AT&T assembly dialect assumptions baked into it. In particular, the hack for resolving the size of a memory operand by appending the four most common suffixes doesn't work at all. The Intel assembly dialect mnemonic table has ambiguous entries, so we need to try matching multiple times with different operand sizes, since that's the only way to choose different instruction variants. This makes us more compatible with gas's implementation of Intel assembly syntax. MSVC assumes you want byte-sized operations for the instructions that we reject as ambiguous. Reviewed By: grosbach Differential Revision: http://reviews.llvm.org/D4747 llvm-svn: 216481
* TableGen: allow use of uint64_t for available features mask.Tim Northover2014-08-181-8/+8
| | | | | | | | | | ARM in particular is getting dangerously close to exceeding 32 bits worth of possible subtarget features. When this happens, various parts of MC start to fail inexplicably as masks get truncated to "unsigned". Mostly just refactoring at present, and there's probably no way to test. llvm-svn: 215887
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-133-9/+9
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* MC X86: Accept ".att_syntax prefix" and diagnose noprefixReid Kleckner2014-08-061-1/+12
| | | | | | | | Fixes PR18916. I don't think we need to implement support for either hybrid syntax. Nobody should write Intel assembly with '%' prefixes on their registers or AT&T assembly without them. llvm-svn: 215031
* MS inline asm: Use memory constraints for functions instead of registersReid Kleckner2014-08-011-9/+21
| | | | | | | | | | | | | | | | | | | | | | This is consistent with how we parse them in a standalone .s file, and inline assembly shouldn't differ. This fixes errors about requiring more registers than available in cases like this: void f(); void __declspec(naked) g() { __asm pusha __asm call f __asm popa __asm ret } There are no registers available to pass the address of 'f' into the asm blob. The asm should now directly call 'f'. Tests will land in Clang shortly. llvm-svn: 214550
* MS inline asm: Fix null SMLoc when 'ptr' is missing after dword & coReid Kleckner2014-08-011-1/+1
| | | | | | | | This improves the diagnostics from the regular assembler, but more importantly it fixes an assertion when parsing inline assembly. Test landing in Clang. llvm-svn: 214468
* X86 MC: Don't crash on empty memory operand parensReid Kleckner2014-07-311-2/+4
| | | | | | | | Instead, create an absolute memory operand. Fixes PR20504. llvm-svn: 214457
* X86 MC: Reject invalid segment registers before a memory operand colonReid Kleckner2014-07-311-0/+3
| | | | | | Previously we would execute unreachable during object emission. llvm-svn: 214456
* [asan] Support x86 REP MOVS asm instrumentation.Evgeniy Stepanov2014-07-313-20/+153
| | | | | | Patch by Yuri Gorshenin. llvm-svn: 214395
* X86 asm parser: Avoid duplicating the list of aliased instructionsReid Kleckner2014-07-311-16/+11
| | | | | | No functional change. llvm-svn: 214364
* X86 asm parser: Use a loop to disambiguate suffixes instead of copy pasteReid Kleckner2014-07-301-38/+20
| | | | | | | | | This works towards making the Intel syntax asm matcher use a completely different disambiguation strategy. No functional change. llvm-svn: 214352
* [SKX] Enabling SKX target and AVX512BW, AVX512DQ, AVX512VL features.Robert Khasanov2014-07-211-0/+2
| | | | | | | | | | | | Enabling HasAVX512{DQ,BW,VL} predicates. Adding VK2, VK4, VK32, VK64 masked register classes. Adding new types (v64i8, v32i16) to VR512. Extending calling conventions for new types (v64i8, v32i16) Patch by Zinovy Nis <zinovy.y.nis@intel.com> Reviewed by Elena Demikhovsky <elena.demikhovsky@intel.com> llvm-svn: 213545
* ms inline asm: Don't add x86 segment registers to the clobber list.Nico Weber2014-07-171-0/+5
| | | | | | | Clang tries to check the clobber list but doesn't list segment registers in its x86 register list. This fixes PR20343. llvm-svn: 213303
* [asan] Generate asm instrumentation in MC.Evgeniy Stepanov2014-07-071-63/+308
| | | | | | | | | Generate entire ASan asm instrumentation in MC without relying on runtime helper functions. Patch by Yuri Gorshenin. llvm-svn: 212455
* Add support for parsing the not operator in Microsoft inline assemblyEhsan Akhgari2014-07-041-5/+36
| | | | | | This fixes http://llvm.org/PR20202 llvm-svn: 212352
* Revert "Introduce a string_ostream string builder facilty"Alp Toker2014-06-261-1/+2
| | | | | | Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
* Introduce a string_ostream string builder faciltyAlp Toker2014-06-261-2/+1
| | | | | | | | | | | | | | | | | | | | string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
* MS asm: Properly handle quoted symbol namesDavid Majnemer2014-06-191-2/+4
| | | | | | | | | | | | | We would get confused by '@' characters in symbol names, we would mistake the text following them for the variant kind. When an identifier a string, the variant kind will never show up inside of it. Instead, check to see if there is a variant following the string. This fixes PR19965. llvm-svn: 211249
* AsmMatchers: Use unique_ptr to manage ownership of MCParsedAsmOperandDavid Blaikie2014-06-084-183/+174
| | | | | | | | | | | | I saw at least a memory leak or two from inspection (on probably untested error paths) and r206991, which was the original inspiration for this change. I ran this idea by Jim Grosbach a few weeks ago & he was OK with it. Since it's a basically mechanical patch that seemed sufficient - usual post-commit review, revert, etc, as needed. llvm-svn: 210427
* [asan] Fix x86-32 asm instrumentation to preserve flags.Evgeniy Stepanov2014-05-211-2/+1
| | | | | | Patch by Yuri Gorshenin. llvm-svn: 209280
* [asan] Stop leaking X86Operands.Benjamin Kramer2014-05-091-4/+4
| | | | llvm-svn: 208400
* [asan] Preserve flags in asm instrumentation.Evgeniy Stepanov2014-05-081-8/+32
| | | | | | Patch by Yuri Gorshenin. llvm-svn: 208296
* [asan] Add a flag to control asm instrumentation.Evgeniy Stepanov2014-05-071-1/+8
| | | | | | With this change, asm instrumentation is disabled by default. llvm-svn: 208167
* [asan] Disable asm instrumentation on unsupported platforms.Evgeniy Stepanov2014-04-301-3/+6
| | | | | | | | | Only emit calls to compiler-rt asm routines on platforms where they are present (currently limited to linux i386/x86_64). Patch by Yuri Gorshenin. llvm-svn: 207651
* [C++] Use 'nullptr'.Craig Topper2014-04-281-3/+3
| | | | llvm-svn: 207394
* [C++] Use 'nullptr'. Target edition.Craig Topper2014-04-251-38/+39
| | | | llvm-svn: 207197
* [asan] Use MCInstrInfo in inline asm instrumentation.Evgeniy Stepanov2014-04-243-26/+17
| | | | | | Patch by Yuri Gorshenin. llvm-svn: 207115
* [asan] Fix instrumentation of x86 intel syntax inline assembly.Evgeniy Stepanov2014-04-241-15/+15
| | | | | | Patch by Yuri Gorshenin. llvm-svn: 207092
OpenPOWER on IntegriCloud