Commit Graph

82 Commits

Author SHA1 Message Date
Chad Rosier
ec13022c39 [ms-inline asm] Perform field lookups with the dot operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166724 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 21:51:10 +00:00
Chad Rosier
5a719fcb5e [ms-inline asm] Add an implementation of the offset operator. This is a follow
on patch to r166433.
rdar://12470317

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166488 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-23 17:43:43 +00:00
Eli Friedman
2128aaebd8 [ms-inline-asm] Implement _emit directive (which is roughly equivalent to .byte).
<rdar://problem/12470345>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166451 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-22 23:58:19 +00:00
Chad Rosier
a703fb9e5e [ms-inline asm] Add the isOffsetOf() function.
Part of rdar://12470317


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166436 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-22 19:50:35 +00:00
Chad Rosier
96d58e64cf [ms-inline asm] Have the TargetParser callback to Sema to determine the size of
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
2012-10-19 20:57:14 +00:00
Nick Lewycky
0d7d11d57f Pacify -Wnon-virtual-dtor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166270 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 07:00:09 +00:00
Chad Rosier
3298959540 [ms-inline asm] Add a size argument to the LookupInlineAsmIdentifier() callback,
which will be used by the asm matcher in the near future.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166222 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 20:27:15 +00:00
Chad Rosier
c8dd27e583 [ms-inline asm] Have the LookupInlineAsmIdentifier() callback function return a
*NamedDecl.  In turn, build the expressions after we're finished parsing the
asm.  This avoids a crasher if the lookup fails.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166212 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 19:39:30 +00:00
Chad Rosier
b1f8c139c5 [ms-inline asm] Move most of the AsmParsing logic in clang back into the MC
layer.  Add the ParseMSInlineAsm() function, which is the new interface to 
clang.  Also expose the new MCAsmParserSemaCallback interface, which is used
by the back-end to do name lookup in Sema.  Finally, remove the now defunct
APIs introduced in r165946.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166183 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 15:49:34 +00:00
Chad Rosier
c5ac87d067 [ms-inline asm] Add the helper function, isParseringInlineAsm(). To be used in a future commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166054 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16 20:16:20 +00:00
Chad Rosier
8f138d1121 [ms-inline asm] Add a few new APIs to the AsmParser class in support of MS-Style
inline assembly.  For the time being, these will be called directly by clang.
However, in the near future I expect these to be sunk back into the MC layer
and more basic APIs (e.g., getClobbers(), getConstraints(), etc.) will be called
by clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165946 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15 17:19:13 +00:00
Chad Rosier
84125ca43c [ms-inline asm] Remove the MatchInstruction() function. Previously, this was
the interface between the front-end and the MC layer when parsing inline
assembly.  Unfortunately, this is too deep into the parsing stack. Specifically,
we're unable to handle target-independent assembly (i.e., assembly directives,
labels, etc.).  Note the MatchAndEmitInstruction() isn't the correct
abstraction either.  I'll be exposing target-independent hooks shortly, so this
is really just a cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165858 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-13 00:26:04 +00:00
Chad Rosier
0d218994f1 [ms-inline asm] Add a few data members and member functions to the
MCParsedAsmOperand class in support of ms-style inline assembly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165830 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-12 22:15:11 +00:00
Chad Rosier
f9e008bf67 Revert 165057, per Jim's request. This requires further discussion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165069 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02 23:38:50 +00:00
Chad Rosier
95707c90cc [ms-inline asm] Add basic support for wildcard MCParsedAsmOperands. This type
of operand is specific to MS-style inline assembly and should not be generated
when parsing normal assembly.

The purpose of the wildcard operands are to allow the AsmParser to match
multiple instructions (i.e., MCInsts) to a given ms-style asm statement.  For
the time being the matcher just returns the first match.  This patch only
implements wildcard matches for memory operands.  Support for register
wildcards will be added in the near future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165057 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02 21:49:07 +00:00
Chad Rosier
17be8a51b0 [ms-inline asm] Expose the getReg() function in the base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164969 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-01 20:53:03 +00:00
Preston Gurd
7b6f2034ac Add support for macro parameters/arguments delimited by spaces,
to improve compatibility with GNU as.

Based on a patch by PaX Team.

Fixed assertion failures on non-Darwin and added additional test cases.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164248 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 20:36:12 +00:00
Dmitri Gribenko
c5252da873 Fix Doxygen issues:
* wrap code blocks in \code ... \endcode;
* refer to parameter names in paragraphs correctly (\arg is not what most
  people want -- it starts a new paragraph);
* use \param instead of \arg to document parameters in order to be consistent
  with the rest of the codebase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163902 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14 14:57:36 +00:00
Chad Rosier
2a3fcb382e Add documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163658 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 23:20:20 +00:00
Chad Rosier
fde528fa2b Add a few virtual functions to the abstract MCParsedAsmOperand class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163655 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 23:03:44 +00:00
Craig Topper
1f7210e808 Make use of the LLVM_DELETED_FUNCTION macro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162828 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29 06:28:46 +00:00
Craig Topper
fb22ede033 Make member variables of AsmToken private. Remove unnecessary forward declarations. Remove an unnecessary include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154775 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-15 22:00:22 +00:00
Devang Patel
0db58bfece Add assembler dialect attribute in asm parser which lets target specific asm parser change dialect on the fly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149396 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-31 18:14:05 +00:00
Devang Patel
a005c3140d Let asm parser query asm syntax dialect.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147880 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10 21:49:42 +00:00
Benjamin Kramer
5efabcf01d Add AsmToken::getEndLoc and use it to add ranges to x86 asm register parsing.
<stdin>:1:12: error: register %rax is only available in 64-bit mode
   incl    %rax
           ^~~~

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16 12:10:27 +00:00
Chris Lattner
d8b7aa2613 Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang does. Enhance
the X86 asmparser to produce ranges in the one case that was annoying me, for example:

test.s:10:15: error: invalid operand for instruction
movl 0(%rax), 0(%edx)
              ^~~~~~~

It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use 
ranges where appropriate if someone is interested.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142106 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16 04:47:35 +00:00
Jim Grosbach
6148225b95 Move state var to private class member.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139697 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14 16:37:04 +00:00
Kevin Enderby
f1c21a8da6 First step in supporting #line directives in assembler. This step parses the
#line directives with the needed support in the lexer.  Next will be to build
a simple file/line# table mapping source SMLoc's for later use by diagnostics.
And the last step will be to get the diagnostics to use the mapping for file
and line numbers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139669 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 23:45:18 +00:00
Jim Grosbach
1b84cce77f Remove unused Target argument from AsmParser construction methods.
The argument is unused, and is a layering violation in any case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137735 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16 18:33:49 +00:00
Jim Grosbach
ac29c0af3d Remove unused forward declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137734 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16 18:31:36 +00:00
Evan Cheng
94b9550a32 Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to MCTargetAsmLexer; rename createAsmLexer to createMCAsmLexer and createAsmParser to createMCAsmParser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136027 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 00:24:13 +00:00
Jim Grosbach
b7f689bab9 Update MCParsedAsmOperand debug methods.
Update the debug output interface for MCParsedAsmOperand to have a print()
method which takes an output stream argument, an << operator which invokes
the print method using the given stream, and a dump() method which prints
the operand to the dbgs() stream. This makes the interface more consistent
with the rest of LLVM, and more convenient to use at the debugger command
line.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135043 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 15:34:57 +00:00
Rafael Espindola
6536644713 Basic support for macros with explicit arguments.
We still don't handle

* default values
* :req
* :vararg
* \()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132656 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-05 02:43:45 +00:00
Joerg Sonnenberger
f8cd708f14 Reapply 131644 including the missing header changes:
Introduce -fatal-assembler-warnings for the obvious purpose


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131655 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 18:00:13 +00:00
Jim Grosbach
d31d304f83 Clean up assembly statement separator support.
The MC asm lexer wasn't honoring a non-default (anything but ';') statement
separator. Fix that, and generalize a bit to support multi-character
statement separators.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128227 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24 18:46:34 +00:00
Joerg Sonnenberger
93c65e6e66 Restore r125595 (reverted in r126336) with modifications:
Introduce a variable in the AsmParserExtension whether [] is valid in an
expression. If it is true, parse them like (). Enable this for ELF only.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126443 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24 21:59:22 +00:00
Jim Grosbach
e5ec5a4177 Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125385 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 18:45:44 +00:00
Jim Grosbach
98311ecb4a Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 01:21:00 +00:00
Roman Divacky
7529b16410 Add support for lexing single quotes like 'c'.
This fixed 8615.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122150 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 08:56:37 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Daniel Dunbar
4f2afe3d39 MC/AsmParser: Handle exponents in floating point literals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114861 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 20:12:52 +00:00
Daniel Dunbar
54f0a625b0 MC/Lexer: Add 'Real' token type for floating point literals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114718 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-24 01:59:31 +00:00
Chris Lattner
cbf8a98c7c fix the asmparser so that the target is responsible for skipping to
the end of the line on a parser error, allowing skipping to happen
for syntactic errors but not for semantic errors.  Before we would
miss emitting a diagnostic about the second line, because we skipped
it due to the semantic error on the first line:

  foo %eax
  bar %al

This fixes rdar://8414033 - llvm-mc ignores lines after an invalid instruction mnemonic errors


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113688 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 16:18:25 +00:00
Daniel Dunbar
3c14ca47fc llvm-mc: Add -show-inst-operands, for dumping the parsed instruction representation before matching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 06:37:09 +00:00
Daniel Dunbar
b3cb696794 MCAsmParser: Add dump() hook to MCParsedAsmOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110790 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 06:37:04 +00:00
Daniel Dunbar
1edf6ca2cb MC/AsmParser: Stop playing unsafe member function pointer calls, this isn't
portable enough.
 - Downside is we now double dispatch through a stub function, but this isn't
   performance critical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108661 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 22:22:07 +00:00
Daniel Dunbar
6a46d571b4 MC/AsmParser: Fix .abort and .secure_log_unique to accept arbitrary token
sequences, not just strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108655 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 20:15:59 +00:00
Daniel Dunbar
f21e4e9326 MC/AsmParser: Fix TokError() to accept a Twine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108647 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 18:31:42 +00:00
Daniel Dunbar
aef87e3307 MC/AsmParser: Hide the AsmParser implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108646 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 18:31:38 +00:00
Daniel Dunbar
d1e3b44d6c MC/AsmParser: Lift Run() and TargetParser to base class.
Also, add constructor function for creating AsmParser instances.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 02:26:10 +00:00