Commit Graph

378 Commits

Author SHA1 Message Date
Chris Lattner
9898671a74 Split the TargetAsmParser "ParseInstruction" interface in half:
the new ParseInstruction method just parses and returns a list of
target operands.  A new MatchInstruction interface is used to
turn the operand list into an MCInst.

This requires new/deleting all the operands, but it also gives 
targets the ability to use polymorphic operands if they want to. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93469 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 22:21:20 +00:00
Chris Lattner
f007e853e2 prune #includes in TargetAsmParser.h
Pass in SMLoc of instr opcode into ParseInstruction.
Make AsmToken be a class, not a struct.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 21:32:45 +00:00
Bill Wendling
9bc0af847d Mark some debug variables as 'unused' to quiet compiler and analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 01:34:57 +00:00
Chris Lattner
a3dcfb1300 rename HexDisassembler -> Disassembler, it works on any input
integer encoding (0123, 0b10101, 42, etc).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 22:50:29 +00:00
Chris Lattner
f444c06f91 just discard the debug output from the disassembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 22:47:43 +00:00
Chris Lattner
a1aa8bba77 specify what is invalid about it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 07:03:21 +00:00
Chris Lattner
5a99615704 reject invalid input with a caret, e.g.:
simple-tests.txt:16:1: error: invalid instruction
0xff 0xff
^




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 06:58:29 +00:00
Chris Lattner
665e947740 various cleanups, make the disassemble reject lines with too much
data on them, for example:

	addb	%al, (%rax)
simple-tests.txt:11:5: error: excess data detected in input
0 0 0 0 0 
    ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 06:56:51 +00:00
Chris Lattner
c3de94fabf If you thought that it didn't make sense for the disassembler
to not produce caret diagnostics, you were right!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 06:45:48 +00:00
Chris Lattner
2adbef06a6 rewrite the file parser for the disassembler, implementing support for
comments.  Also, check in a simple testcase for the disassembler,
including a test for r91864


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 06:37:58 +00:00
Chris Lattner
222af46482 don't crash on blank lines, rename some variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 06:24:00 +00:00
Chandler Carruth
b5d3daba91 Update CMake build to include HexDisassembler.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91589 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 06:35:17 +00:00
Sean Callanan
ba847da571 Test harness for the LLVM disassembler. When invoked
with -disassemble, llvm-mc now accepts lines of the
form
0x00 0x00
and passes the resulting bytes to the disassembler for
the chosen (or default) target, printing the result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 01:49:59 +00:00
Nick Lewycky
f4e748bc3f Line this up as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 22:08:51 +00:00
Nick Lewycky
ed1f1687b7 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 22:07:54 +00:00
Chandler Carruth
8b67f774e9 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:35:46 +00:00
Daniel Dunbar
e00b011e6a MC: Remove unneeded context argument to MCExpr::Evaluate*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:57:52 +00:00
Daniel Dunbar
75773ff00d MC: Tweak variable assignment diagnostics, and make reassignment of non-absolute
variables and symbols invalid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:57:39 +00:00
Daniel Dunbar
fffff915d5 MC: When parsing a variable reference, substitute absolute variables immediately
since they are allowed to be redefined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:34:54 +00:00
Chris Lattner
ebb89b4186 add a new DirectiveMap stringmap, which allows more efficient dispatching
to directive handlers and allows for easier extensibility.

I only switched a few over for now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:16:52 +00:00
Chris Lattner
cec545097c avoid copying MCAsmInfo by value, add an (extremely low prio) fixme.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 19:38:39 +00:00
Chris Lattner
e895c61515 Add an intel syntax MCInstPrinter implementation. You can now
transcode from AT&T to intel syntax with "llvm-mc foo.s -output-asm-variant=1"



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 07:17:49 +00:00
Kevin Enderby
b5db830840 Fixed some problems with the logic of parsing line comments by adding
isAtStartOfComment and using that instead in two places where a loop
to check if the char was in MAI.getCommentString().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82059 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 18:08:00 +00:00
Chris Lattner
3b13d361d0 use an accessor to simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 04:12:47 +00:00
Chris Lattner
90edac0e8b Change MCAsmStreamer to take an MCInstPrinter instead of a
full AsmPrinter, and change TargetRegistry to keep track
of registered MCInstPrinters.

llvm-mc is still linking in the entire
target foo to get the code emitter stuff, but this is an
important step in the right direction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 03:02:37 +00:00
Kevin Enderby
9c656450d6 Added the ParseInstruction() hook for target specific assembler directives so
that things like .word can be parsed as target specific.  Moved parsing .word
out of AsmParser.cpp into X86AsmParser.cpp as it is 2 bytes on X86 and 4 bytes
for other targets that support the .word directive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81461 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 20:51:44 +00:00
Daniel Dunbar
b8b70521de MC: Give target specific parsers access to the MCStreamer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 00:59:15 +00:00
Benjamin Kramer
12fd767ed8 Fix an integer truncation noticed by MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81109 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 09:35:10 +00:00
Kevin Enderby
fb0f0dedd7 Added AsmToken enum constants to MCAsmLexer.h for '[', ']', '{', and '}' in
preparation of supporting other targets. Then changed the lexer to parse these
as tokens.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 22:40:31 +00:00
Kevin Enderby
9823ca971d Added the AsmToken::Hash enum constant to MCAsmLexer.h in preparation of
supporting other targets.  Changed the code to pass MCAsmInfo to the parser
and the lexer.  Then changed the lexer to use CommentString from MCAsmInfo
instead of a literal '#' character.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 21:45:34 +00:00
Kevin Enderby
7b4608dfa0 Removed the non-target independent AsmToken::Register enum constant
from MCAsmLexer.h in preparation of supporting other targets.  Changed the
X86AsmParser code to reflect this by removing AsmLexer::LexPercent and looking
for AsmToken::Percent when parsing in places that used AsmToken::Register.
Then changed X86ATTAsmParser::ParseRegister to parse out registers as an
AsmToken::Percent followed by an AsmToken::Identifier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 17:15:07 +00:00
Chris Lattner
a9eb359452 TAI -> MAI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80899 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 06:13:54 +00:00
Daniel Dunbar
821e3334ed llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:09:28 +00:00
Daniel Dunbar
e2ace509fc llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:09:09 +00:00
Daniel Dunbar
883f920acb llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:08:50 +00:00
Daniel Dunbar
c18274ba9c llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:08:17 +00:00
Daniel Dunbar
6ce004dc76 llvm-mc: Add MCAsmParser::getContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:07:44 +00:00
Daniel Dunbar
9643ac5514 llvm-mc: Switch MCExpr construction to using static member functions, and taking the MCContext (which now owns all MCExprs).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80569 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:07:22 +00:00
Daniel Dunbar
28c251b54b llvm-mc: Move AsmExpr into MC lib (as MCExpr).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:06:59 +00:00
Daniel Dunbar
7092c7e1dc llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now.
- Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80484 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 06:17:16 +00:00
Daniel Dunbar
e6cdbf2f92 llvm-mc: Emit .lcomm as .zerofill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:48:46 +00:00
Daniel Dunbar
2e15292659 llvm-mc: Unique zero fill sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:48:29 +00:00
Daniel Dunbar
bdee6dffa5 Revert r80305, I forgot a dependent change.
--- Reverse-merging r80305 into '.':
U    tools/llvm-mc/AsmParser.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 23:58:10 +00:00
Daniel Dunbar
58b5068b1a llvm-mc: Unique sections in .zerofill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 23:45:06 +00:00
Daniel Dunbar
4fac74950a llvm-mc/Mach-O: Add MCCodeEmitter support, for encoding instructions.
- No relocations yet, of course.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 08:17:51 +00:00
Daniel Dunbar
f2f6b0c0e9 llvm-mc: Only show instruction encodings with --show-encoding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 07:56:39 +00:00
Daniel Dunbar
04baf9094a llvm-mc: Tweak MCCodeEmitter skeleton.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 01:34:22 +00:00
Daniel Dunbar
4a0abd80f1 Sketch TargetRegistry support for MCCodeEmitter abstract interface.
- Of course, nothing actually can provide this interface yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 00:51:57 +00:00
Daniel Dunbar
7c0a3348fb llvm-mc/Mach-O: Unique sections properly, so we don't get duplicate text
sections, etc.
 - The quick and dirty way, just clone the TargetLoweringObjectFile
   code. Eventually this should be shared... somehow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 22:49:51 +00:00
Daniel Dunbar
959fd88334 llvm-mc/Mach-O: Don't put assembler temporary labels in the symbol table.
- I moved section creation back into AsmParser. I think policy decisions like
   this should be pushed higher, not lower, when possible (in addition the
   assembler has flags which change this behavior, for example).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 22:13:22 +00:00
Daniel Dunbar
d644c32a52 llvm-mc: Make MCValue take const MCSymbol*s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 09:16:46 +00:00
Daniel Dunbar
b58a804400 llvm-mc: Make non-sensical max bytes to .align an error.
Also, warn about overflow in alignment values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 09:16:34 +00:00
Dan Gohman
baa26395cc Make LLVM command-line tools overwrite their output files without -f.
This is conventional command-line tool behavior. -f now just means
"enable binary output on terminals".

Add a -f option to llvm-extract and llvm-link, for consistency.

Remove F_Force from raw_fd_ostream and enable overwriting and
truncating by default. Introduce an F_Excl flag to permit users to
enable a failure when the file already exists. This flag is
currently unused.

Update Makefiles and documentation accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 15:34:52 +00:00
Chris Lattner
17e9edc4a7 Change raw_fd_ostream to take flags as an optional bitmask
instead of as two bools.  Use this to add a F_Append flag
which has the obvious behavior.

Other unrelated changes conflated into this patch:

1. REmove EH stuff from llvm-dis and llvm-as, the try blocks
   are dead.
2. Simplify the filename inference code in llvm-as/llvm-dis,
   because raw_fd_ostream does the right thing with '-'.
3. Switch machine verifier to use raw_ostream instead of ostream
   (Which is the thing that needed append in the first place).




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 02:51:22 +00:00
Chris Lattner
af76e592c7 Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79763 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22 20:48:53 +00:00
Daniel Dunbar
8906ff1b9d llvm-mc: Clean up some handling of symbol/section association to be more correct
(external was really undefined and there wasn't an explicit representation for
absolute symbols).
 - This still needs some cleanup to how the absolute "pseudo" section is dealt
   with, but I haven't figured out the nicest approach yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22 07:22:36 +00:00
Daniel Dunbar
2330df6b66 llvm-mc: Improve handling of implicit alignment for magic section directives
(e.g., .objc_message_refs).
 - Just emit a .align when we see the directive; this isn't exactly what 'as'
   does but in practice it should be ok, at least for now. See FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 23:30:15 +00:00
Daniel Dunbar
0afb9f5ac2 llvm-mc: In a .fill directive, still honor .align even if invalid maximum bytes
count is given (this matches 'as').


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79683 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 23:01:53 +00:00
Daniel Dunbar
bc38ca7321 llvm-mc: Accept .fill size of 8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 15:43:35 +00:00
Daniel Dunbar
fb4a6b3976 llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.

 - MCAssembler is the actual assembler backend, which is designed to have a
   reasonable API. This will eventually grow to support multiple object file
   implementations, but for now its Mach-O/i386 only.

 - MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
   e.g. converting the various directives into fragments, managing state like
   the current section, and so on.

 - llvm-mc will use the new backend via '-filetype=obj', which may eventually
   be, but is not yet, since I hear that people like assemblers which actually
   assemble.

 - The only thing that works at the moment is changing sections. For the time
   being I have a Python Mach-O dumping tool in test/scripts so this stuff can
   be easily tested, eventually I expect to replace this with a real LLVM tool.

 - More doxyments to come.

I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 09:11:24 +00:00
Daniel Dunbar
b3f3c0387b llvm-mc: Various section parsing fixes.
- Add missing flags for various Objective-C sections.

 - Fix names for [non_]lazy_symbol_pointer (these are misspelled in the manual).

 - .symbol_stub does not have the self modifying code flag set (this appears to
   be wrong in the manual?).

 - Add implicit alignment values; not yet used.

Also, call MCStreamer::Finish at the end of a successful parse.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 08:34:18 +00:00
Daniel Dunbar
32223d3098 Don't install llvm-mc by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79604 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 07:28:33 +00:00
Daniel Dunbar
12a8a447a4 Fix a commento.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 16:25:53 +00:00
Chris Lattner
f3ce009fcb give MCAsmStreamer a TargetAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 04:23:44 +00:00
Daniel Dunbar
1ab7594946 llvm-mc: Support escaped characters in string literals (for .ascii and .asciz)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-14 18:19:52 +00:00
Daniel Dunbar
c22e0b2443 Update llvm-mc / MCAsmStreamer to print the instruction using the actual target
specific printer (this only works on x86, for now).
 - This makes it possible to do some correctness checking of the parsing and
   matching, since we can compare the results of 'as' on the original input, to
   those of 'as' on the output from llvm-mc.

 - In theory, we could now have an easy ATT -> Intel syntax converter. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-14 03:48:55 +00:00
Daniel Dunbar
7b7f51425e llvm-mc: Move MCAsmToken::getLoc() into MC library where it belongs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-14 02:18:40 +00:00
Daniel Dunbar
b27a41b440 llvm-mc: Fix a crash on invalid due to a typo in relocatable expression
evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78692 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:47:52 +00:00
Daniel Dunbar
1e840b2c61 llvm-mc: Accept .word as a synonym for .short
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 04:44:00 +00:00
Daniel Dunbar
bfc0f34e34 llvm-mc: Honor -o option (and add -f).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 04:34:48 +00:00
Daniel Dunbar
d0c14d6913 llvm-mc: Sketch parsing for .file, .line, and .loc. No streamer hooks for these
yet (I'm not even sure what they do).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 04:24:50 +00:00
Daniel Dunbar
ace63127bc llvm-mc: Fix darwin .section parsing. It was skipping the section name and a ','
(and outputting a diagnostic pointing at the wrong place), all of which lead to
much confusion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 03:42:33 +00:00
Chris Lattner
f9bdeddb96 split MachO section handling stuff out to its out .h/.cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 18:15:01 +00:00
Chris Lattner
e15c2d7ce5 add a fixme
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 18:05:55 +00:00
Chris Lattner
ff4bc460c5 Make the big switch: Change MCSectionMachO to represent a section *semantically*
instead of syntactically as a string.  This means that it keeps track of the 
segment, section, flags, etc directly and asmprints them in the right format.
This also includes parsing and validation support for llvm-mc and 
"attribute(section)", so we should now start getting errors about invalid 
section attributes from the compiler instead of the assembler on darwin.

Still todo: 
1) Uniquing of darwin mcsections
2) Move all the Darwin stuff out to MCSectionMachO.[cpp|h]
3) there are a few FIXMEs, for example what is the syntax to get the
   S_GB_ZEROFILL segment type?



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 01:39:42 +00:00
Chris Lattner
93b6db3de9 sink the 'name' and 'isdirective' state out of MCSection into its derived classes.
This totally optimizes PIC16 sections by not having an 'isdirective' bit anymore!! ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 23:39:42 +00:00
Chris Lattner
0aac30195c switch this to create coff sections for now, it doesn't really matter for
llvm-mc's purpose yet and we'll want to switch to creating semantic sections
at some point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 22:38:48 +00:00
Benjamin Kramer
9a86159a20 Always initialize AsmConds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 11:26:50 +00:00
Kevin Enderby
c114ed711e Added Mac OS X assembler style conditional assembly. I may come back and see if
I can clean this up a bit more and do way with the TheCondState and just use
the top element on the TheCondStack if not empty.  Also may tweak the code
around ParseConditionalAssemblyDirectives() to simplify the AsmParser code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07 22:46:00 +00:00
Daniel Dunbar
4bd03abe59 Remove now unused arguments from TargetRegistry::lookupTarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-03 04:20:57 +00:00
Chris Lattner
1ef9be2883 Make SectionKind::get() private.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 00:02:44 +00:00
Chris Lattner
5d6554255b update for API change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77804 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 21:14:30 +00:00
Chris Lattner
4a7bc1e5aa All MCSections are now required to have a SectionKind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 18:25:49 +00:00
Daniel Dunbar
a6b3c5db2e llvm-mc: More quoted identifier support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 00:48:30 +00:00
Daniel Dunbar
76c4d7696c llvm-mc: Support quoted identifiers.
- Uses MCAsmToken::getIdentifier which returns the (sub)string representing the
   meaningfull contents a string or identifier token.

 - Directives aren't done yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 21:55:09 +00:00
Chris Lattner
6bdd74ca38 fix some more issues where we expected GetSection to do "get or create"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77700 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 18:27:48 +00:00
Chris Lattner
56594f9884 fix a bunch of failing tests now that MCContext::GetSection doesn't create sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 17:47:16 +00:00
Daniel Dunbar
cf593a3f43 Update CMakeLists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 22:46:39 +00:00
Daniel Dunbar
16cdcb38b2 Move X86 instruction parsing into X86/AsmParser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 22:40:46 +00:00
Daniel Dunbar
e240beb065 Make expression parsing and error/warning reporting available through the
generic MCAsmParser interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77381 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 22:22:31 +00:00
Daniel Dunbar
a2edbabcb8 Provide generic MCAsmParser when constructing target specific parsers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 20:47:52 +00:00
Daniel Dunbar
8e7c38e17b Switch X86 assembly parser to using the generic lexer interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 18:17:26 +00:00
Daniel Dunbar
cbbe248441 Expose Tokens to target specific assembly parsers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 17:58:44 +00:00
Daniel Dunbar
a3c924f83a Switch AsmLexer::Lex to returning a reference to the current token.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 16:56:42 +00:00
Daniel Dunbar
419adedaa1 Drop some AsmLexer methods in favor of their AsmToken equivalents.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 16:38:40 +00:00
Daniel Dunbar
3f87233d70 llvm-mc: Sink token enum into AsmToken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 16:08:33 +00:00
Daniel Dunbar
cb358b63a7 llvm-mc: Factor AsmToken class out of AsmLexer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77292 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 03:00:54 +00:00
Daniel Dunbar
825e385ffe llvm-mc: Stop uniqueing string tokens, nothing actually uses this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77287 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 00:58:50 +00:00
Daniel Dunbar
f9507ffa5b llvm-mc: Implement .abort fully in the front end
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 23:20:52 +00:00
Daniel Dunbar
9a7e2ccf57 llvm-mc: Move AsmLexer::getCurStrVal to StringRef based API.
- My DFS traversal of LLVM is, at least for now, nearly complete! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 21:49:56 +00:00
Daniel Dunbar
8977d087c6 Factor commonality in triple match routines into helper template for registering
classes, and migrate existing targets over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 05:03:33 +00:00
Daniel Dunbar
a5881e3060 Add TargetRegistry::lookupTarget.
- This is a simplified mechanism which just looks up a target based on the
   target triple, with a few additional flags.

 - Remove getClosestStaticTargetForModule, the moral equivalent is now:
     lookupTarget(Mod->getTargetTriple, true, false, ...);

 - This no longer does the fuzzy matching with target data (based on endianness
   and pointer width) that getClosestStaticTargetForModule was doing, but this
   was deemed unnecessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 02:12:58 +00:00
Daniel Dunbar
6316fbcb04 Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications!

 - I kept StringMap::GetOrCreateValue for compatibility purposes, this can
   eventually go away. Likewise the StringMapEntry Create functions still follow
   the old style.

 - NIFC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 18:17:34 +00:00
Kevin Enderby
5026ae4514 Removed the DumpSymbolsandMacros and LoadSymbolsandMacros MCStreamer API as
the parsing of the .dump and .load should be done in the assembly parser and
not have any need for an MCStreamer API.  Changed the code for now so these
just produce an error saying these specific directives are not yet implemented
since they are likely no longer used and may never need to be implemented.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 20:25:37 +00:00
Daniel Dunbar
dbd692a66e Add MCAsmLexer interface.
- This provides the AsmLexer interface to the target specific assembly parsers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76460 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 20:01:54 +00:00
Daniel Dunbar
a3af370dc1 Add MCAsmParser interface.
- This provides the AsmParser interface to the target specific assembly
   parsers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76453 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 18:55:04 +00:00
Daniel Dunbar
867aadfedf llvm-mc: Default -triple to LLVM_HOSTTRIPLE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 22:51:20 +00:00
Daniel Dunbar
b4b53e5c13 llvm-mc: Add -triple, and start fetching the target asm printer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 22:38:58 +00:00
Kevin Enderby
f96db468fc Removed the SubsectionsViaSymbols MCStreamer API and replaced it with a generic
EmitAssemblerFlag API which takes a value from the added AssemblerFlag
enumerated constants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 17:56:39 +00:00
Kevin Enderby
358ab1dbb0 Clean up the definition of Str in AsmParser::ParseDirectiveDarwinDumpOrLoad
so it is defined with a lifetime that is as short as possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 17:17:46 +00:00
Chris Lattner
8e25e2d801 implement .include in the lexer/parser instead of passing it into the streamer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 06:14:39 +00:00
Kevin Enderby
6e68cd96b2 Added llvm-mc support for parsing the .dump and .load directives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 15:30:11 +00:00
Kevin Enderby
1f049b24c7 Added llvm-mc support for parsing the .include directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75711 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 23:21:55 +00:00
Kevin Enderby
711482476c Added llvm-mc support for parsing the .lsym directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 21:35:03 +00:00
Kevin Enderby
95cf30c444 Added llvm-mc support for parsing the .desc directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 18:17:10 +00:00
Kevin Enderby
5f1f0b8f7e Added llvm-mc support for parsing the .abort directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 23:15:14 +00:00
Kevin Enderby
a5c783280f add llvm-mc support for parsing the .subsections_via_symbols directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 21:03:15 +00:00
Chris Lattner
39750254e1 silence vc++ warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 22:32:37 +00:00
Chris Lattner
9be3fee2bd add support for .zerofill, patch by Kevin Enderby!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75301 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-10 22:20:30 +00:00
Chris Lattner
1fc3d75581 add llvm-mc support for parsing the .lcomm directive, patch by Kevin Enderby!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 17:25:12 +00:00
Chris Lattner
4e4db7adfc Implement parsing support for the .comm directive. Patch by
Kevin Enderby!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74944 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 20:30:46 +00:00
Chris Lattner
b717fb0fe0 implement error recovery in the llvm-mc parser. Feel the power!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 21:53:43 +00:00
Daniel Dunbar
5470e12c62 llvm-mc/x86: Fix various nit-picky bugs in displacement parsing.
- Test case to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 02:26:39 +00:00
Daniel Dunbar
2c3f00cd94 llvm-mc/x86: Fix bug in disambiguation of displacement operand, introduced by me
(I think).
 - We weren't properly parsing the leading parenthesized expression in something
   like 'push (4)(%eax)'.
 
 - Added ParseParenRelocatableExpression to support this. I suspect we should
   just use lookahead, though.

 - Test case to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 02:09:07 +00:00
Daniel Dunbar
46b6c5266e llvm-mc/x86: Factor out ParseX86Register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74684 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 01:58:24 +00:00
Daniel Dunbar
55a3c6c324 llvm-mc/x86: Rename X86Operand::ScaleReg to IndexReg and make order consistent
with syntax.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 00:51:52 +00:00
Daniel Dunbar
1aa14aac41 llvm-mc: Add some more doxyments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 15:14:50 +00:00
Daniel Dunbar
165e8344d8 llvm-mc: Fill in the rest of tokens for 'as-lex' mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74598 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 06:56:54 +00:00
Daniel Dunbar
80f62d0062 Rename MCValue::isConstant to isAbsolute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 06:48:00 +00:00
Chris Lattner
87380cb0e0 add some of the new tokens, others are still missing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 06:36:49 +00:00
Daniel Dunbar
0eebb0543f llvm-mc: Emit parsed instructions to the MCStreamer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 06:35:48 +00:00
Daniel Dunbar
d9627e11bf llvm-mc: Introduce method to match a parsed x86 instruction into an MCInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74573 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 23:38:38 +00:00
Daniel Dunbar
d870b2804b llvm-mc: Accept relocatable expressions when parsing displacements and
immediates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 23:02:44 +00:00
Daniel Dunbar
374d8bddac llvm-mc: Symbols in a relocatable expression of the (a - b + cst) form are
allowed to be undefined when the expression is seen, we cannot enforce the
same-section requirement until the entire assembly file has been seen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74565 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 22:49:27 +00:00
Daniel Dunbar
b79742cd47 Suppress may-be-used-uninitialized warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 16:02:47 +00:00
Douglas Gregor
892b507f7c Fix CMake build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 14:37:26 +00:00
Daniel Dunbar
f4b830f03f llvm-mc: Accept relocatable expressions for .org, assignments, .byte, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74498 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:10:03 +00:00
Daniel Dunbar
3597604e5e llvm-mc: Rewrite binary subtraction for relocatable expressions, we can't always
legally negate an MCValue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74497 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:08:27 +00:00
Daniel Dunbar
15d1707096 llvm-mc: Evaluation for relocatable expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74496 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 01:49:52 +00:00
Daniel Dunbar
3fb7683bec Normalize SourceMgr messages.
- Don't print "Parsing" in front of every message.

 - Take additional "type" argument which is prepended to the message (with ": ")
   if given.

 - Update clients to print errors (warnings) as:
<filename>:<line number>: error(warning): ...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74489 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 00:49:23 +00:00
Daniel Dunbar
d7b267bd90 llvm-mc: Parse symbol attribute directives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74487 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 00:33:19 +00:00
Daniel Dunbar
c29dfa786a llvm-mc: Parse .{,b,p2}align{,w,l} directives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74478 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 23:46:59 +00:00
Daniel Dunbar
dce0f3c556 llvm-mc: Diagnose misuse (mix) of defined symbols and labels.
- For example, we diagnose errors on:
--
a:
a = 10
--

 - For now we reject code like:
--
.long a
a = 10
--
   which "as" accepts (on Darwin).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74476 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 23:43:14 +00:00
Daniel Dunbar
1ad7edc212 llvm-mc: Recognize C++ style comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 22:00:57 +00:00
Daniel Dunbar
383a4a8db0 llvm-mc: Recognize C++ style comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 21:58:22 +00:00
Daniel Dunbar
513306395c Fix uninitialized variable warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74457 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 21:14:21 +00:00
Daniel Dunbar
fc6877aec9 MC: Improve expression parsing and implement evaluation of absolute expressions
(missed files).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 20:40:36 +00:00
Daniel Dunbar
475839e9a9 MC: Improve expression parsing and implement evaluation of absolute expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74448 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 20:37:27 +00:00
Daniel Dunbar
c238b584de MC: Parse .org directives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 22:44:51 +00:00
Daniel Dunbar
8f780cd789 MC: Parse .set and assignments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:56:11 +00:00
Daniel Dunbar
a0d1426af0 Basic .s parsing for .asci[iz], .fill, .space, {.byte, .short, ... }
- Includes some DG tests in test/MC/AsmParser, which are rather primitive since
   we don't have a -verify mode yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 23:30:00 +00:00
Chris Lattner
529fb545e7 implement a bunch of synonyms for section switching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74062 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 05:13:15 +00:00
Chris Lattner
9a023f70b4 add support for parsing and emitting .section directives. We can now parse
things like:
.section __TEXT,__cstring,cstring_literals




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 04:43:34 +00:00
Chris Lattner
c69485e34d add trivial support for passing label definitions through the MCStreamer.
This is suboptimal in several aspects, see the commented out assertion.
I need to talk to Daniel about this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 04:31:49 +00:00
Chris Lattner
cbc23f75cd create an MCStreamer and provide it to AsmParser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:52:40 +00:00
Chris Lattner
faf32c102d make the lexer unique strings it lexes instead of passing them back as
std::strings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74036 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:33:19 +00:00
Daniel Dunbar
ecc63f8687 Start flushing out MCContext.
- Lives inside new library lib/MC (LLVMMC.a)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 22:01:43 +00:00
Chris Lattner
29dfe7c5f7 refactor a bunch of X86 specific stuff out to its own file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:41:30 +00:00
Chris Lattner
8dfbe6c853 implement a trivial binary expression parser, we can now parse all of 176.gcc.llc.s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 05:57:07 +00:00
Chris Lattner
bcd0b8d2ef get a definition of strull on windows, thanks to Howard Su.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 00:24:36 +00:00
Duncan Sands
66b9f29df2 Include cstdio to get EOF, needed with gcc-4.4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73879 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 06:59:32 +00:00
Chris Lattner
7031806fe2 process memory operands with a parenthesized expression for a displacement,
like "(4+5)(%eax)".



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73878 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 06:35:58 +00:00
Chris Lattner
74ec1a3b11 Implement full support for parsing primary expressions. We can now parse
all of health and voronoi (ignoring directives).  We only get 409 lines into
176.gcc though because we don't have binary operators yet:

Parsing 176.gcc.llc.s:409: unexpected token in operand list
	movsbl	_arityvec+1(,%edi,8), %eax
	      	         ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 06:32:03 +00:00
Chris Lattner
be9c23fef4 implement parser support for '*' operands, as in "call *%eax".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 06:02:13 +00:00
Chris Lattner
c41938303b implement memory operand parsing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 05:51:26 +00:00
Chris Lattner
2cf5f14f20 start implementing some simple operand parsing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 01:29:09 +00:00
Chris Lattner
14ee48a5ba rename SourceMgr::PrintError to PrintMessage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73861 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 21:22:11 +00:00
Chris Lattner
b0789ed5a4 set up the top-level parsing loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 20:54:55 +00:00
Chris Lattner
27aa7d259b stub out parser for asm files. Change invariant on lexer to always
print its error message when it returns an asmtok::Error token.
Compute a proper error code for llvm-mc in 'lex' mode.  Add new
-as-lex option to enable lexing mode (vs parsing mode).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 20:16:42 +00:00
Chris Lattner
10a907d70f add string literals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 19:56:35 +00:00
Chris Lattner
4506bd2cfd hopefully fix the build on linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 19:43:50 +00:00
Chris Lattner
4651bca31b implement enough of a lexer to get through Olden/health/Output/health.llc.s
without errors.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73855 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 19:21:25 +00:00
Chris Lattner
4577bbaa12 oh yeah, cmake needs to be told explicitly about new files :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 07:19:34 +00:00
Chris Lattner
a59e877996 some baby steps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 07:19:10 +00:00
Chris Lattner
b23677e076 start wiring up support for asm parsing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 05:22:37 +00:00
Chris Lattner
f4a481505e fix build problem pointed out by John Thompson!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 23:46:04 +00:00
Chris Lattner
bb4688a9cf fix file header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 23:05:21 +00:00
Chris Lattner
f9f065e455 Add a skeleton driver for new machine code level fun. llvm-mc is meant
to be a test driver of other components in the system, which will develop
over time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 23:04:45 +00:00