Commit Graph

29 Commits

Author SHA1 Message Date
Chris Lattner 10a1cfd0f9 avoid copying MCAsmInfo by value, add an (extremely low prio) fixme.
llvm-svn: 82911
2009-09-27 19:38:39 +00:00
Kevin Enderby ecd879a2d5 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().

llvm-svn: 82059
2009-09-16 18:08:00 +00:00
Kevin Enderby 9c0f7fc746 Added AsmToken enum constants to MCAsmLexer.h for '[', ']', '{', and '}' in
preparation of supporting other targets. Then changed the lexer to parse these
as tokens.

llvm-svn: 81050
2009-09-04 22:40:31 +00:00
Kevin Enderby f92f9909c4 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.

llvm-svn: 81046
2009-09-04 21:45:34 +00:00
Kevin Enderby 7d91218c75 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.

llvm-svn: 80929
2009-09-03 17:15:07 +00:00
Daniel Dunbar cbf4faf48d llvm-mc: Move MCAsmToken::getLoc() into MC library where it belongs.
llvm-svn: 78980
2009-08-14 02:18:40 +00:00
Chris Lattner cb307a27bf 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?

llvm-svn: 78547
2009-08-10 01:39:42 +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 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 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
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
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 6b22f9ca45 llvm-mc: Recognize C++ style comments.
llvm-svn: 74462
2009-06-29 21:58:22 +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 2d2ee150eb MC: Parse .set and assignments.
llvm-svn: 74208
2009-06-25 21:56:11 +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
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 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 2adc9e739c rename SourceMgr::PrintError to PrintMessage.
llvm-svn: 73861
2009-06-21 21:22:11 +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 c8dfbcbb31 some baby steps.
llvm-svn: 73848
2009-06-21 07:19:10 +00:00