Commit Graph

124 Commits

Author SHA1 Message Date
Michael J. Spencer c8dbdfd4ba MC-COFF: Add COFFAsmParser. Completes PR8343.
llvm-svn: 116150
2010-10-09 11:01:07 +00:00
Michael J. Spencer 530ce85b3e Fix Whitespace.
llvm-svn: 116149
2010-10-09 11:00:50 +00:00
Michael J. Spencer 3d89823102 MC: Move ParseDirectiveELFType into ELFAsmParser. COFF uses .type for something else.
llvm-svn: 116142
2010-10-09 03:47:55 +00:00
Rafael Espindola b91bac6c96 Add support for a fill value in the .zero directive.
llvm-svn: 115655
2010-10-05 19:42:57 +00:00
Kevin Enderby a68d004d88 Incorporate suggestions by Daniel Dunbar after his review. Thanks Daniel!
1) Changed ValidateDwarfFileNumber() to isValidDwarfFileNumber() to be better
   named.  Since it is just a predicate and isn't actually changing any state.

2) Added a missing return in the comments for setCurrentDwarfLoc() in 
   include/llvm/MC/MCContext.h for fix formatting.

3) Changed clearDwarfLocSeen() to ClearDwarfLocSeen() since it does change
   state.

4) Simplified the last test in isValidDwarfFileNumber() to just a one line
   boolean test of MCDwarfFiles[FileNumber] != 0 for the final return statement.

llvm-svn: 115551
2010-10-04 20:17:24 +00:00
Jan Wen Voung 87f77b5f9a Add hook in MCSection to decide when to use "optimized nops", for each
section kind. Previously, optimized nops were only used for MachO.
Also added tests for ELF and COFF.

llvm-svn: 115523
2010-10-04 17:32:41 +00:00
Kevin Enderby e46564a4a8 This is the last major patch to implement support for the .loc directive
and output the dwarf line number tables.  This contains the code to emit and
encode the dwarf line tables from the previously gathered information in the
MCLineSection objects.  This contains all the details to encode the line and
address deltas into the dwarf line table.

To do this an MCDwarfLineAddrFragment has been added.

Also this moves the interface code out of Mach-O streamer into
MCDwarf so it should be useable by other object file formats.

There is now one call to be made from an MCObjectStreamer
EmitInstruction() method:
   MCLineEntry::Make(this, getCurrentSection());
to create a line entry after each instruction is assembled.

And one call call to be made from an MCObjectStreamer Finish() method:
   MCDwarfFileTable::Emit(this, DwarfLineSection);
when getContext().hasDwarfFiles() is true and is passed a object file specific
MCSection where to emit the dwarf file and the line tables.

This appears to now be correct for 32-bit targets, at least x86.  But the
relocation entries for 64-bit Darwin needs some further work which is next
up to work on.  So for now the 64-bit Mach-O target does not output the
dwarf file and line tables.

llvm-svn: 115157
2010-09-30 16:52:03 +00:00
Jan Wen Voung b96b2d8e4d Have ELFAsmParser.cpp use the already parsed "Size" (entry size) when
constructing a section. Test for a few cases also included.

llvm-svn: 115132
2010-09-30 02:41:46 +00:00
Jan Wen Voung c768287968 Test commit - Deleted some whitespace at the end of a line.
llvm-svn: 115122
2010-09-30 01:09:20 +00:00
Chris Lattner b44fd24fc1 change the protocol TargetAsmPArser::MatchInstruction method to take an
MCStreamer to emit into instead of an MCInst to fill in.  This allows the
matcher extra flexibility and is more convenient.

llvm-svn: 115014
2010-09-29 01:42:58 +00:00
Rafael Espindola 9ca41113f6 Make sure .text doesn't produce extra alignment.
llvm-svn: 114895
2010-09-27 21:40:27 +00:00
Daniel Dunbar d116d8a4e9 MC/AsmParser: Handle exponents in floating point literals.
llvm-svn: 114861
2010-09-27 20:12:52 +00:00
Benjamin Kramer c758311025 Push twines deeper into SourceMgr's error handling methods.
llvm-svn: 114847
2010-09-27 17:42:11 +00:00
Daniel Dunbar ce17f72c38 MC/AsmParser: Handle a missed case of floating literals in the lexer.
llvm-svn: 114733
2010-09-24 17:10:26 +00:00
Daniel Dunbar 2af1653032 MC/AsmParser: Support .single and .double for embedding floating point literals.
- I believe more modern 'gas' supports a more enhanced set of arithmetic on
   them, but for now the only thing we can do is emit them as data.

llvm-svn: 114719
2010-09-24 01:59:56 +00:00
Daniel Dunbar 3068a93dc1 MC/Lexer: Add 'Real' token type for floating point literals.
llvm-svn: 114718
2010-09-24 01:59:31 +00:00
Chris Lattner 2bb9504d1a fix rdar://8456417 - llvm-mc can't do basic math
llvm-svn: 114532
2010-09-22 05:05:16 +00:00
Rafael Espindola f0591c1642 Implement support for .local and its "interesting" interactions with .comm.
llvm-svn: 114382
2010-09-21 00:24:38 +00:00
Daniel Dunbar baad46c6ee Fix an MSVC warning.
llvm-svn: 114184
2010-09-17 16:34:24 +00:00
Daniel Dunbar 55f16678e4 MC/AsmParser: Add support for 'a + 4@GOTPCREL' and friends, by reconsing the
expression to include the modifier.
 - Gross, but this a corner case we don't expect to see often in practice, but
   it is worth accepting.
 - Also improves diagnostics on invalid modifiers.

llvm-svn: 114154
2010-09-17 02:47:07 +00:00
Rafael Espindola f7f433200b Make sure that names like .note.GNU-stack are accepted as valid section names.
llvm-svn: 114091
2010-09-16 17:05:55 +00:00
Rafael Espindola 922e3f454b Add support for the .zero directive.
llvm-svn: 114077
2010-09-16 15:03:59 +00:00
Rafael Espindola f667d929ce Add a InitSections method to the streamer interface.
The ELF implementation now creates text, data and bss to match the gnu as
behavior.

The text streamer still has the old MachO specific behavior since
the testsuite checks that it will error when a directive is given
before a setting the current section for example.

A nice benefit is that -n is not required anymore when producing
ELF files.

llvm-svn: 114027
2010-09-15 21:48:40 +00:00
Rafael Espindola 12d73d1f18 Add support for leb128 of absolute expressions.
llvm-svn: 113691
2010-09-11 16:45:15 +00:00
Chris Lattner a2a9d16b78 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

llvm-svn: 113688
2010-09-11 16:18:25 +00:00
Daniel Dunbar e5444a88cd llvm-mc: Don't crash when using -n and we see a directive before the initial section.
- This is annoying, because we have to scatter this check everywhere that could emit real data, but I see no better solution.

llvm-svn: 113552
2010-09-09 22:42:59 +00:00
Daniel Dunbar 43325c4a68 llvm-mc: Make sure we exit != 0 if any errors are encountered.
llvm-svn: 113551
2010-09-09 22:42:56 +00:00
Chris Lattner 91689c1d0f change the MC "ParseInstruction" interface to make it the
implementation's job to check for and lex the EndOfStatement
marker.

llvm-svn: 113347
2010-09-08 05:10:46 +00:00
Benjamin Kramer e39017cb97 Add AsmParser support for the ELF .previous directive. Patch by Roman Divacky.
llvm-svn: 112849
2010-09-02 18:53:37 +00:00
Kevin Enderby a71ab07e14 Change the parsing of .loc back to allow the LineNumber field to be optional as
it is with other assemblers.

llvm-svn: 111967
2010-08-24 21:14:47 +00:00
Kevin Enderby 1264b7cab8 First bit of support for the dwarf .loc directive. This patch updates the
needed parsing for the .loc directive and saves the current info from that
into the context.  The next patch will take the current loc info after an
instruction is assembled and save that info into a vector for each section for
use to build the line number tables.  The patch after that will encode the info
from those vectors into the output file as the dwarf line tables.

llvm-svn: 111956
2010-08-24 20:32:42 +00:00
Daniel Dunbar 2476432639 MC/AsmParser: Change ParseExpression to use ParseIdentifier(), to support
dollars in identifiers.

llvm-svn: 111946
2010-08-24 19:13:42 +00:00
Daniel Dunbar 3b96ffdac1 MC/Parser: Accept leading dollar signs in identifiers.
- Implemented by manually splicing the tokens. If this turns out to be
   problematically platform specific, a more elegant solution would be to
   implement some context dependent lexing support.

llvm-svn: 111934
2010-08-24 18:12:12 +00:00
Chris Lattner 02db8f6415 fix rdar://7997827 - Accept and ignore LL and ULL suffixes on integer literals.
Also fix 0b010 syntax to actually work while we're at it :-)

llvm-svn: 111876
2010-08-24 00:43:25 +00:00
Daniel Dunbar 2ecc3bb4f7 MC/AsmParser: Push the burdon of emitting diagnostics about unmatched
instructions onto the target specific parser, which can do a better job.

llvm-svn: 110889
2010-08-12 00:55:38 +00:00
Daniel Dunbar 2eca0252c3 llvm-mc: Add -show-inst-operands, for dumping the parsed instruction representation before matching.
llvm-svn: 110791
2010-08-11 06:37:09 +00:00
Daniel Dunbar ebace2248f MCAsmParser: Add dump() hook to MCParsedAsmOperand.
llvm-svn: 110790
2010-08-11 06:37:04 +00:00
Daniel Dunbar d215976208 MC/AsmParser: Fix a bug in macro argument parsing, which was dropping
parentheses from argument lists.

llvm-svn: 110692
2010-08-10 17:38:52 +00:00
Daniel Dunbar b759a13da8 MC: Destroy Macro instances.
llvm-svn: 109720
2010-07-29 01:51:55 +00:00
Kevin Enderby e5930f142a Added first bit of support for the dwarf .file directive. This patch collects
the info from the .file directive and makes file and directory tables that
will eventually be put out as part of the dwarf info in the output file.

llvm-svn: 109651
2010-07-28 20:55:35 +00:00
Matt Fleming a8f6c1cc26 Add some more handlers for ELF section directives.
llvm-svn: 108928
2010-07-20 21:12:46 +00:00
Daniel Dunbar eefe8616be TblGen/AsmMatcher: Add support for honoring instruction Requires<[]> attributes as part of the matcher.
- Currently includes a hack to limit ourselves to "In32BitMode" and "In64BitMode", because we don't have the other infrastructure to properly deal with setting SSE, etc. features on X86.

llvm-svn: 108677
2010-07-19 05:44:09 +00:00
Eli Friedman 20b026464e Make .align parse correctly on platforms where .align is measured in bytes.
llvm-svn: 108674
2010-07-19 04:17:25 +00:00
Daniel Dunbar 8897d479b5 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.

llvm-svn: 108661
2010-07-18 22:22:07 +00:00
Daniel Dunbar 40a564f09f MC/AsmParser: Fix .abort and .secure_log_unique to accept arbitrary token
sequences, not just strings.

llvm-svn: 108655
2010-07-18 20:15:59 +00:00
Daniel Dunbar 6fb1c3ad8a MC/AsmParser: Add macro argument substitution support.
llvm-svn: 108654
2010-07-18 19:00:10 +00:00
Daniel Dunbar 4323571efb MC/AsmParser: Add basic support for macro instantiation.
llvm-svn: 108653
2010-07-18 18:54:11 +00:00
Daniel Dunbar c1f58ec83c MC/AsmParser: Add basic parsing support for .macro definitions.
llvm-svn: 108652
2010-07-18 18:47:21 +00:00
Daniel Dunbar 828984ff4e MC/AsmParser: Add .macros_{off,on} support, not that makes sense since we don't
support macros.

llvm-svn: 108649
2010-07-18 18:38:02 +00:00
Daniel Dunbar d8a1845c31 MC/AsmParser: Use Error() instead of calling PrintMessage() directly.
llvm-svn: 108648
2010-07-18 18:31:45 +00:00