Daniel Dunbar
d806996191
Switch X86 assembly parser to using the generic lexer interface.
...
llvm-svn: 77341
2009-07-28 18:17:26 +00:00
Daniel Dunbar
6d1e79dded
Expose Tokens to target specific assembly parsers.
...
llvm-svn: 77337
2009-07-28 17:58:44 +00:00
Daniel Dunbar
bc79816f28
Switch AsmLexer::Lex to returning a reference to the current token.
...
llvm-svn: 77328
2009-07-28 16:56:42 +00:00
Daniel Dunbar
ee4465cf82
Drop some AsmLexer methods in favor of their AsmToken equivalents.
...
llvm-svn: 77323
2009-07-28 16:38:40 +00:00
Daniel Dunbar
f2dcd77253
llvm-mc: Sink token enum into AsmToken.
...
llvm-svn: 77322
2009-07-28 16:08:33 +00:00
Daniel Dunbar
8368f4e8a4
llvm-mc: Factor AsmToken class out of AsmLexer.
...
llvm-svn: 77292
2009-07-28 03:00:54 +00:00
Daniel Dunbar
5cf338ad60
llvm-mc: Stop uniqueing string tokens, nothing actually uses this.
...
llvm-svn: 77287
2009-07-28 00:58:50 +00:00
Daniel Dunbar
eb6bb32bef
llvm-mc: Implement .abort fully in the front end
...
llvm-svn: 77272
2009-07-27 23:20:52 +00:00
Daniel Dunbar
52d03b252e
llvm-mc: Move AsmLexer::getCurStrVal to StringRef based API.
...
- My DFS traversal of LLVM is, at least for now, nearly complete! :)
llvm-svn: 77258
2009-07-27 21:49:56 +00:00
Daniel Dunbar
ee01b242e8
Factor commonality in triple match routines into helper template for registering
...
classes, and migrate existing targets over.
llvm-svn: 77126
2009-07-26 05:03:33 +00:00
Daniel Dunbar
47d679151b
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.
llvm-svn: 77111
2009-07-26 02:12:58 +00:00
Daniel Dunbar
5bf72e20eb
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.
llvm-svn: 76888
2009-07-23 18:17:34 +00:00
Kevin Enderby
ee5513582d
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.
llvm-svn: 76462
2009-07-20 20:25:37 +00:00
Daniel Dunbar
2b11c7de4a
Add MCAsmLexer interface.
...
- This provides the AsmLexer interface to the target specific assembly parsers.
llvm-svn: 76460
2009-07-20 20:01:54 +00:00
Daniel Dunbar
3c2a893ac7
Add MCAsmParser interface.
...
- This provides the AsmParser interface to the target specific assembly
parsers.
llvm-svn: 76453
2009-07-20 18:55:04 +00:00
Daniel Dunbar
7b1a4c18ea
llvm-mc: Default -triple to LLVM_HOSTTRIPLE.
...
llvm-svn: 76260
2009-07-17 22:51:20 +00:00
Daniel Dunbar
8c6bad2f66
llvm-mc: Add -triple, and start fetching the target asm printer.
...
llvm-svn: 76257
2009-07-17 22:38:58 +00:00
Kevin Enderby
dd27e5e10a
Removed the SubsectionsViaSymbols MCStreamer API and replaced it with a generic
...
EmitAssemblerFlag API which takes a value from the added AssemblerFlag
enumerated constants.
llvm-svn: 76087
2009-07-16 17:56:39 +00:00
Kevin Enderby
7bef8bc320
Clean up the definition of Str in AsmParser::ParseDirectiveDarwinDumpOrLoad
...
so it is defined with a lifetime that is as short as possible.
llvm-svn: 76082
2009-07-16 17:17:46 +00:00
Chris Lattner
693fbb8fee
implement .include in the lexer/parser instead of passing it into the streamer.
...
llvm-svn: 75896
2009-07-16 06:14:39 +00:00
Kevin Enderby
09ea5709a2
Added llvm-mc support for parsing the .dump and .load directives.
...
llvm-svn: 75786
2009-07-15 15:30:11 +00:00
Kevin Enderby
d1ea5393c9
Added llvm-mc support for parsing the .include directive.
...
llvm-svn: 75711
2009-07-14 23:21:55 +00:00
Kevin Enderby
cbe475dfe8
Added llvm-mc support for parsing the .lsym directive.
...
llvm-svn: 75685
2009-07-14 21:35:03 +00:00
Kevin Enderby
4c21caa656
Added llvm-mc support for parsing the .desc directive.
...
llvm-svn: 75645
2009-07-14 18:17:10 +00:00
Kevin Enderby
56523ceba1
Added llvm-mc support for parsing the .abort directive.
...
llvm-svn: 75545
2009-07-13 23:15:14 +00:00
Kevin Enderby
c9d93ef2c6
add llvm-mc support for parsing the .subsections_via_symbols directive.
...
llvm-svn: 75500
2009-07-13 21:03:15 +00:00
Chris Lattner
a797d376de
silence vc++ warning.
...
llvm-svn: 75394
2009-07-11 22:32:37 +00:00
Chris Lattner
07cadaf113
add support for .zerofill, patch by Kevin Enderby!
...
llvm-svn: 75301
2009-07-10 22:20:30 +00:00
Chris Lattner
28ad7547d2
add llvm-mc support for parsing the .lcomm directive, patch by Kevin Enderby!
...
llvm-svn: 75148
2009-07-09 17:25:12 +00:00
Chris Lattner
a1e11f530e
Implement parsing support for the .comm directive. Patch by
...
Kevin Enderby!
llvm-svn: 74944
2009-07-07 20:30:46 +00:00
Chris Lattner
73f3611be9
implement error recovery in the llvm-mc parser. Feel the power!
...
llvm-svn: 74728
2009-07-02 21:53:43 +00:00
Daniel Dunbar
0224b65f0a
llvm-mc/x86: Fix various nit-picky bugs in displacement parsing.
...
- Test case to follow.
llvm-svn: 74687
2009-07-02 02:26:39 +00:00
Daniel Dunbar
9bff6531fd
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.
llvm-svn: 74685
2009-07-02 02:09:07 +00:00
Daniel Dunbar
36a2007059
llvm-mc/x86: Factor out ParseX86Register.
...
llvm-svn: 74684
2009-07-02 01:58:24 +00:00
Daniel Dunbar
142f104b29
llvm-mc/x86: Rename X86Operand::ScaleReg to IndexReg and make order consistent
...
with syntax.
llvm-svn: 74679
2009-07-02 00:51:52 +00:00
Daniel Dunbar
b442e04259
llvm-mc: Add some more doxyments.
...
llvm-svn: 74607
2009-07-01 15:14:50 +00:00
Daniel Dunbar
9c4809a887
llvm-mc: Fill in the rest of tokens for 'as-lex' mode.
...
llvm-svn: 74598
2009-07-01 06:56:54 +00:00
Daniel Dunbar
0d5fc9a5b0
Rename MCValue::isConstant to isAbsolute.
...
llvm-svn: 74596
2009-07-01 06:48:00 +00:00
Chris Lattner
e4dfc89615
add some of the new tokens, others are still missing.
...
llvm-svn: 74595
2009-07-01 06:36:49 +00:00
Daniel Dunbar
fc35841077
llvm-mc: Emit parsed instructions to the MCStreamer.
...
llvm-svn: 74594
2009-07-01 06:35:48 +00:00
Daniel Dunbar
d0a08e0430
llvm-mc: Introduce method to match a parsed x86 instruction into an MCInst.
...
llvm-svn: 74573
2009-06-30 23:38:38 +00:00
Daniel Dunbar
cfcdf5c1ac
llvm-mc: Accept relocatable expressions when parsing displacements and
...
immediates.
llvm-svn: 74568
2009-06-30 23:02:44 +00:00
Daniel Dunbar
8561b6aea0
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.
llvm-svn: 74565
2009-06-30 22:49:27 +00:00
Daniel Dunbar
3971273aa2
Suppress may-be-used-uninitialized warning.
...
llvm-svn: 74529
2009-06-30 16:02:47 +00:00
Douglas Gregor
16f652876f
Fix CMake build
...
llvm-svn: 74527
2009-06-30 14:37:26 +00:00
Daniel Dunbar
75630b355a
llvm-mc: Accept relocatable expressions for .org, assignments, .byte, etc.
...
llvm-svn: 74498
2009-06-30 02:10:03 +00:00
Daniel Dunbar
19f847fa68
llvm-mc: Rewrite binary subtraction for relocatable expressions, we can't always
...
legally negate an MCValue.
llvm-svn: 74497
2009-06-30 02:08:27 +00:00
Daniel Dunbar
bd4bf3d4f7
llvm-mc: Evaluation for relocatable expressions.
...
llvm-svn: 74496
2009-06-30 01:49:52 +00:00
Daniel Dunbar
c9dc78ae40
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): ...
llvm-svn: 74489
2009-06-30 00:49:23 +00:00
Daniel Dunbar
a5508c893a
llvm-mc: Parse symbol attribute directives.
...
llvm-svn: 74487
2009-06-30 00:33:19 +00:00
Daniel Dunbar
cc566a714b
llvm-mc: Parse .{,b,p2}align{,w,l} directives.
...
llvm-svn: 74478
2009-06-29 23:46:59 +00:00
Daniel Dunbar
ae7ac01059
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).
llvm-svn: 74476
2009-06-29 23:43:14 +00:00
Daniel Dunbar
5992b4a211
llvm-mc: Recognize C++ style comments.
...
llvm-svn: 74463
2009-06-29 22:00:57 +00:00
Daniel Dunbar
6b22f9ca45
llvm-mc: Recognize C++ style comments.
...
llvm-svn: 74462
2009-06-29 21:58:22 +00:00
Daniel Dunbar
231898baf5
Fix uninitialized variable warning.
...
llvm-svn: 74457
2009-06-29 21:14:21 +00:00
Daniel Dunbar
84bfd7b184
MC: Improve expression parsing and implement evaluation of absolute expressions
...
(missed files).
llvm-svn: 74450
2009-06-29 20:40:36 +00:00
Daniel Dunbar
7e8d6c7215
MC: Improve expression parsing and implement evaluation of absolute expressions.
...
llvm-svn: 74448
2009-06-29 20:37:27 +00:00
Daniel Dunbar
4a5a561a24
MC: Parse .org directives.
...
llvm-svn: 74218
2009-06-25 22:44:51 +00:00
Daniel Dunbar
2d2ee150eb
MC: Parse .set and assignments.
...
llvm-svn: 74208
2009-06-25 21:56:11 +00:00
Daniel Dunbar
a10e519e04
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.
llvm-svn: 74139
2009-06-24 23:30:00 +00:00
Chris Lattner
f7ebca4db6
implement a bunch of synonyms for section switching.
...
llvm-svn: 74062
2009-06-24 05:13:15 +00:00
Chris Lattner
bedf6c2995
add support for parsing and emitting .section directives. We can now parse
...
things like:
.section __TEXT,__cstring,cstring_literals
llvm-svn: 74058
2009-06-24 04:43:34 +00:00
Chris Lattner
3f5738d599
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.
llvm-svn: 74057
2009-06-24 04:31:49 +00:00
Chris Lattner
92ffdd15f8
create an MCStreamer and provide it to AsmParser.
...
llvm-svn: 74039
2009-06-24 00:52:40 +00:00
Chris Lattner
4c501fc196
make the lexer unique strings it lexes instead of passing them back as
...
std::strings.
llvm-svn: 74036
2009-06-24 00:33:19 +00:00
Daniel Dunbar
ca29e4d7f4
Start flushing out MCContext.
...
- Lives inside new library lib/MC (LLVMMC.a)
llvm-svn: 74013
2009-06-23 22:01:43 +00:00
Chris Lattner
3417d71ff4
refactor a bunch of X86 specific stuff out to its own file.
...
llvm-svn: 73982
2009-06-23 18:41:30 +00:00
Chris Lattner
f97d8bbe73
implement a trivial binary expression parser, we can now parse all of 176.gcc.llc.s
...
llvm-svn: 73950
2009-06-23 05:57:07 +00:00
Chris Lattner
9ec76a0b79
get a definition of strull on windows, thanks to Howard Su.
...
llvm-svn: 73929
2009-06-23 00:24:36 +00:00
Duncan Sands
376c6f16de
Include cstdio to get EOF, needed with gcc-4.4.
...
llvm-svn: 73879
2009-06-22 06:59:32 +00:00
Chris Lattner
1d1fe918de
process memory operands with a parenthesized expression for a displacement,
...
like "(4+5)(%eax)".
llvm-svn: 73878
2009-06-22 06:35:58 +00:00
Chris Lattner
7fdbce7a60
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
^
llvm-svn: 73877
2009-06-22 06:32:03 +00:00
Chris Lattner
a7b51ed5e6
implement parser support for '*' operands, as in "call *%eax".
...
llvm-svn: 73876
2009-06-22 06:02:13 +00:00
Chris Lattner
78db36271c
implement memory operand parsing.
...
llvm-svn: 73875
2009-06-22 05:51:26 +00:00
Chris Lattner
e5074c46b2
start implementing some simple operand parsing.
...
llvm-svn: 73867
2009-06-22 01:29:09 +00:00
Chris Lattner
2adc9e739c
rename SourceMgr::PrintError to PrintMessage.
...
llvm-svn: 73861
2009-06-21 21:22:11 +00:00
Chris Lattner
36e0212c16
set up the top-level parsing loop.
...
llvm-svn: 73860
2009-06-21 20:54:55 +00:00
Chris Lattner
b013345338
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).
llvm-svn: 73859
2009-06-21 20:16:42 +00:00
Chris Lattner
419a97491a
add string literals.
...
llvm-svn: 73858
2009-06-21 19:56:35 +00:00
Chris Lattner
99f0b60f45
hopefully fix the build on linux.
...
llvm-svn: 73857
2009-06-21 19:43:50 +00:00
Chris Lattner
d0765617d2
implement enough of a lexer to get through Olden/health/Output/health.llc.s
...
without errors.
llvm-svn: 73855
2009-06-21 19:21:25 +00:00
Chris Lattner
d485848229
oh yeah, cmake needs to be told explicitly about new files :)
...
llvm-svn: 73849
2009-06-21 07:19:34 +00:00
Chris Lattner
c8dfbcbb31
some baby steps.
...
llvm-svn: 73848
2009-06-21 07:19:10 +00:00
Chris Lattner
d70e15b46f
start wiring up support for asm parsing.
...
llvm-svn: 73846
2009-06-21 05:22:37 +00:00
Chris Lattner
2cce7d5988
fix build problem pointed out by John Thompson!
...
llvm-svn: 73739
2009-06-18 23:46:04 +00:00
Chris Lattner
c7ab953177
fix file header
...
llvm-svn: 73733
2009-06-18 23:05:21 +00:00
Chris Lattner
8dd8a52533
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.
llvm-svn: 73732
2009-06-18 23:04:45 +00:00