summaryrefslogtreecommitdiff
path: root/lib/Target/X86/AsmParser/X86AsmParser.cpp
Commit message (Collapse)AuthorAge
...
* Cleanup. No functional change intended.Chad Rosier2013-04-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179129 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup. No functional change intended.Chad Rosier2013-04-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179125 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r179115 as it looks to have killed the ASan tests.Chad Rosier2013-04-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179120 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need toChad Rosier2013-04-09
| | | | | | | | | | | | | | | parse an identifier. Otherwise, parseExpression may parse multiple tokens, which makes it impossible to properly compute an immediate displacement. An example of such a case is the source operand (i.e., [Symbol + ImmDisp]) in the below example: __asm mov eax, [Symbol + ImmDisp] The existing test cases exercise this patch. rdar://13611297 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179115 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Maintain a StringRef to reference a symbol in a parsed operand,Chad Rosier2013-04-09
| | | | | | | | | | | | | rather than deriving the StringRef from the Start and End SMLocs. Using the Start and End SMLocs works fine for operands such as [Symbol], but not for operands such as [Symbol + ImmDisp]. All existing test cases that reference a variable exercise this patch. rdar://13602265 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179109 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for ImmDisp [ Symbol ] memory operands.Chad Rosier2013-04-08
| | | | | | | rdar://13521249 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179030 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for numeric displacement expressions in bracketedChad Rosier2013-04-05
| | | | | | | | | | | | | | | | | | | | | | | memory operands. Essentially, this layers an infix calculator on top of the parsing state machine. The scale on the index register is still expected to be an immediate __asm mov eax, [eax + ebx*4] and will not work with more complex expressions. For example, __asm mov eax, [eax + ebx*(2*2)] The plus and minus binary operators assume the numeric value of a register is zero so as to not change the displacement. Register operands should never be an operand for a multiply or divide operation; the scale*indexreg expression is always replaced with a zero on the operand stack to prevent such a case. rdar://13521380 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178881 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for parsing variables with namespace aliasChad Rosier2013-04-02
| | | | | | | | | | | | | | qualifiers. This patch only adds support for parsing these identifiers in the X86AsmParser. The front-end interface isn't capable of looking up these identifiers at this point in time. The end result is the compiler now errors during object file emission, rather than at parse time. Test case coming shortly. Part of rdar://13499009 and PR13340 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178566 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support of imm displacement before bracketed memoryChad Rosier2013-03-27
| | | | | | | | | | | | | | | expression. Specifically, this syntax: ImmDisp [ BaseReg + Scale*IndexReg + Disp ] We don't currently support: ImmDisp [ Symbol ] rdar://13518671 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178186 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Move the immediate asm rewrite into the target specificChad Rosier2013-03-19
| | | | | | | logic as a QOI cleanup. No functional change. Tests already in place. rdar://13456414 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177446 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Create a helper function, CreateMemForInlineAsm, that createsChad Rosier2013-03-19
| | | | | | | | | | an X86Operand, but also performs a Sema lookup and adds the sizing directive when appropriate. Use this when parsing a bracketed statement. This is necessary to get the instruction matching correct as well. Test case coming on clang side. rdar://13455408 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177439 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Move the size directive asm rewrite into the target specificChad Rosier2013-03-19
| | | | | | | logic as a QOI cleanup. rdar://13445327 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177413 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Avoid emitting a redundant sizing directive, if we've alreadyChad Rosier2013-03-18
| | | | | | | parsed one. Test case coming shortly. rdar://13446980 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177347 91177308-0d34-0410-b5e6-96231b3b80d8
* Post process ADC/SBB and use a shorter encoding if they use a sign extended ↵Craig Topper2013-03-18
| | | | | | immediate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177243 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor some duplicated code into helper functions.Craig Topper2013-03-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177242 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence anonymous type in anonymous union warnings.Eric Christopher2013-03-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177135 91177308-0d34-0410-b5e6-96231b3b80d8
* GCC thinks that this variable might be used uninitialized (it isn't).Duncan Sands2013-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176341 91177308-0d34-0410-b5e6-96231b3b80d8
* MCParser: Update method names per coding guidelines.Jim Grosbach2013-02-20
| | | | | | | | | | | | | | | | | | | s/AddDirectiveHandler/addDirectiveHandler/ s/ParseMSInlineAsm/parseMSInlineAsm/ s/ParseIdentifier/parseIdentifier/ s/ParseStringToEndOfStatement/parseStringToEndOfStatement/ s/ParseEscapedString/parseEscapedString/ s/EatToEndOfStatement/eatToEndOfStatement/ s/ParseExpression/parseExpression/ s/ParseParenExpression/parseParenExpression/ s/ParseAbsoluteExpression/parseAbsoluteExpression/ s/CheckForValidSection/checkForValidSection/ http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175675 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Adjust the EndLoc to account for the ']'.Chad Rosier2013-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175312 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Make the error message more generic now that we support the Chad Rosier2013-01-18
| | | | | | | 'SIZE' and 'LENGTH' operators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172773 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for the 'SIZE' and 'LENGTH' operators.Chad Rosier2013-01-17
| | | | | | | Part of rdar://12576868 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172743 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Extend support for parsing Intel bracketed memory operands thatChad Rosier2013-01-14
| | | | | | | | have an arbitrary ordering of the base register, index register and displacement. rdar://12527141 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172484 91177308-0d34-0410-b5e6-96231b3b80d8
* X86AsmParser.cpp: Fix up r172148, to add initializer in another CreateMem().NAKAMURA Takumi2013-01-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172157 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Make sure we set a default value for AddressOf. Follow on toChad Rosier2013-01-10
| | | | | | | r172121. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172148 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for calling functions from inline assembly.Chad Rosier2013-01-10
| | | | | | Part of rdar://12991541 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172121 91177308-0d34-0410-b5e6-96231b3b80d8
* Last in the series of removing unnecessary '0' arguments forEric Christopher2013-01-09
| | | | | | | address space. Reordered the EmitULEB128IntValue arguments to make this easier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171949 91177308-0d34-0410-b5e6-96231b3b80d8
* Change SMRange to be half-open (exclusive end) instead of closed (inclusive)Jordan Rose2013-01-07
| | | | | | | | | | This is necessary not only for representing empty ranges, but for handling multibyte characters in the input. (If the end pointer in a range refers to a multibyte character, should it point to the beginning or the end of the character in a char array?) Some of the code in the asm parsers was already assuming this anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171765 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove MCTargetAsmLexer and its derived classes now that edis,Roman Divacky2012-12-20
| | | | | | | its only user, is gone. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170699 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* X86: Better diagnostics for 32-bit vs. 64-bit mode mismatches.Jim Grosbach2012-11-14
| | | | | | | | | | When an instruction as written requires 32-bit mode and we're assembling in 64-bit mode, or vice-versa, issue a more specific diagnostic about what's wrong. rdar://12700702 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167937 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for the [] operator. Essentially, [expr1][expr2] isChad Rosier2012-10-29
| | | | | | | equivalent to [expr1 + expr2]. See test cases for more examples. rdar://12470392 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166949 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add a comment.Chad Rosier2012-10-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166819 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Emit an error for unsupported SIZE and LENGTH directives.Chad Rosier2012-10-26
| | | | | | | Part of rdar://12576868 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166792 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for the TYPE operator.Chad Rosier2012-10-26
| | | | | | | Part of rdar://12576868 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166790 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Have the target AsmParser create the asmrewrite for the offsetofChad Rosier2012-10-26
| | | | | | operator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166779 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Perform field lookups with the dot operator.Chad Rosier2012-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166724 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for creating AsmRewrites in the target specificChad Rosier2012-10-25
| | | | | | AsmParser logic. To be used/tested in a subsequent commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166714 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add error handling to the ParseIntelDotOperator() function.Chad Rosier2012-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166698 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for parsing the '.' operator. Given,Chad Rosier2012-10-24
| | | | | | | | | | | | | | [register].field The operator returns the value at the location pointed to by register plus the offset of field within its structure or union. This patch only handles immediate fields (i.e., [eax].4). The original displacement has to be a MCConstantExpr as well. Part of rdar://12470415 and rdar://12470514 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166632 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up. No functional change intended.Chad Rosier2012-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166630 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Create a register operand, rather than a memory operand when weChad Rosier2012-10-24
| | | | | | | | | | | | see the offsetof operator. Previously, we were matching something like MOVrm in the front-end and later matching MOVrr in the back-end. This change makes things more consistent. It also fixes cases where we can't match against a memory operand as the source (test cases coming). Part of rdar://12470317 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166592 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Offset operator - the size should be based on the size of aChad Rosier2012-10-23
| | | | | | | | | pointer, not the size of the variable. Part of rdar://12470317 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166526 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Clean up comment.Chad Rosier2012-10-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166525 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] When parsing inline assembly we set the base register to aChad Rosier2012-10-23
| | | | | | | | | non-zero value as we don't know the actual value at this point. This is necessary to get the matching correct in some cases. However, the actual value set as the base register doesn't matter, since we're just matching not emitting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166523 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add an implementation of the offset operator. This is a followChad Rosier2012-10-23
| | | | | | | on patch to r166433. rdar://12470317 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166488 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add the isOffsetOf() function.Chad Rosier2012-10-22
| | | | | | | Part of rdar://12470317 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166436 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Add support for parsing the offset operator. Callback for Chad Rosier2012-10-22
| | | | | | | | CodeGen in the front-end not implemented yet. rdar://12470317 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166433 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Reset the opcode prior to parsing a statement.Chad Rosier2012-10-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166349 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] Have the TargetParser callback to Sema to determine the size ofChad Rosier2012-10-19
| | | | | | | | | a memory operand. Retain this information and then add the sizing directives to the IR. This allows the backend to do proper instruction selection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166316 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms-inline asm] If we parsed a statement and the opcode is valid, then it's ↵Chad Rosier2012-10-15
| | | | | | an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165955 91177308-0d34-0410-b5e6-96231b3b80d8