summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
Commit message (Collapse)AuthorAgeFilesLines
...
* MCParser: Update method names per coding guidelines.Jim Grosbach2013-02-205-270/+270
| | | | | | | | | | | | | | | | | | | s/AddDirectiveHandler/addDirectiveHandler/ s/ParseMSInlineAsm/parseMSInlineAsm/ s/ParseIdentifier/parseIdentifier/ s/ParseStringToEndOfStatement/parseStringToEndOfStatement/ s/ParseEscapedString/parseEscapedString/ s/EatToEndOfStatement/eatToEndOfStatement/ s/ParseExpression/parseExpression/ s/ParseParenExpression/parseParenExpression/ s/ParseAbsoluteExpression/parseAbsoluteExpression/ s/CheckForValidSection/checkForValidSection/ http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly No functional change intended. llvm-svn: 175675
* MCParser: Reject .balign with non-pow2 alignments.Benjamin Kramer2013-02-161-0/+4
| | | | | | | | GNU as rejects them and there are configure scripts in the wild that check if the assembler rejects ".align 3" to determine whether the alignment is in bytes or powers of two. llvm-svn: 175360
* Derive ELF section type from the name in some cases where GNU as doesJoerg Sonnenberger2013-02-161-1/+10
| | | | | | so. llvm-svn: 175327
* c[ms-inline asm] It's possible to have a SizeDirective rewrite and anChad Rosier2013-02-151-1/+16
| | | | | | | Input/Output rewrite to the same location. Make sure the SizeDirective rewrite is performed first. This also ensure the sort algorithm is stable. llvm-svn: 175317
* AsmParser: Reformat the MS asm parser to reduce nesting.Benjamin Kramer2013-02-151-85/+86
| | | | | | | While there postpone register name printing after uniquing. No intended functionality change. llvm-svn: 175292
* Revert r15266. This fixes llvm.org/pr15266.Rafael Espindola2013-02-141-40/+19
| | | | llvm-svn: 175173
* [ms-inline asm] Add a comment about the determinism of the rewrite sort.Chad Rosier2013-02-131-0/+2
| | | | llvm-svn: 175082
* [ms-inline-asm] Use an array_pod_sort, rather than a std:sort.Chad Rosier2013-02-131-3/+10
| | | | llvm-svn: 175063
* [ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.Chad Rosier2013-02-131-0/+5
| | | | | | rdar://13202662 llvm-svn: 175021
* [ms-inline-asm] Implement align directive (which is roughly equivalent to ↵Chad Rosier2013-02-121-9/+43
| | | | | | | | | | .align). Also, allow _EMIT and __EMIT for the emit directive. We already do the same for TYPE, SIZE, and LENGTH. rdar://13200215 llvm-svn: 175008
* Add static cast to unsigned char whenever a character classification ↵Guy Benyei2013-02-121-3/+6
| | | | | | function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. llvm-svn: 175006
* [ms-inline asm] Pass the length of the IDVal, so we can do a proper AsmRewrite.Chad Rosier2013-02-121-4/+5
| | | | llvm-svn: 174999
* [ms-inline asm] Accept the emit directive as either _emit or __emit.Chad Rosier2013-02-121-2/+2
| | | | llvm-svn: 174998
* [ms-inline asm] Add support for lexing binary integers with a [bB] suffix.Chad Rosier2013-02-121-19/+40
| | | | | | | | | | | | | | This is complicated by backward labels (e.g., 0b can be both a backward label and a binary zero). The current implementation assumes [0-9]b is always a label and thus it's possible for 0b and 1b to not be interpreted correctly for ms-style inline assembly. However, this is relatively simple to fix in the inline assembly (i.e., drop the [bB]). This patch also limits backward labels to [0-9]b, so that only 0b and 1b are ambiguous. Part of rdar://12470373 llvm-svn: 174983
* Update error message due to previous commit, r174926.Chad Rosier2013-02-121-1/+3
| | | | llvm-svn: 174927
* [ms-inline asm] Add support for lexing hexidecimal integers with a [hH] suffix.Chad Rosier2013-02-121-14/+47
| | | | | | Part of rdar://12470373 llvm-svn: 174926
* Add a warning when there is a macro defintion that has named parameters butKevin Enderby2013-01-221-0/+104
| | | | | | | | | | | | | the body does not use them and it appears the body has positional parameters. This can cause unexpected results as in the added test case. As the darwin version of gas(1) which only supported positional parameters, happened to ignore the named parameters. Now that we want to support both styles of macros we issue a warning in this specific case. rdar://12861644 llvm-svn: 173199
* Have the integrated assembler give an error if $1 is used as an identifier inKevin Enderby2013-01-221-2/+7
| | | | | | | | | an expression. Currently this bug causes the line to be ignored in a release build and an assert in a debug build. rdar://13062484 llvm-svn: 173195
* [MC/Mach-O] Add AsmParser support for .linker_option directive.Daniel Dunbar2013-01-181-0/+30
| | | | llvm-svn: 172778
* [MC] Expose ParseEscapedString to target AsmParser implementations.Daniel Dunbar2013-01-181-4/+1
| | | | llvm-svn: 172777
* [MC] Fix 80-col violas.Daniel Dunbar2013-01-181-41/+89
| | | | llvm-svn: 172776
* [ms-inline asm] Add support for the 'SIZE' and 'LENGTH' operators.Chad Rosier2013-01-171-2/+2
| | | | | | Part of rdar://12576868 llvm-svn: 172743
* Some small (and mostly cosmetic) fixes.Eli Bendersky2013-01-161-22/+17
| | | | llvm-svn: 172640
* Now that GenericAsmParser was folded into AsmParser, some methods and types canEli Bendersky2013-01-161-17/+57
| | | | | | return into the safe harbor of AsmParser's private areas. llvm-svn: 172637
* Use the ExtensionDirectiveHandler type in other places where it makes sense.Eli Bendersky2013-01-164-15/+16
| | | | | | | Since we already have this type it's a shame to keep dragging a pair of object and method around explicitly. llvm-svn: 172584
* [ms-inline asm] Address the FIXME in AsmParser.cpp.Chad Rosier2013-01-151-4/+2
| | | | | | | | | | // FIXME: Constraints are hard coded to 'm', but we need an 'r' // constraint for addressof. This needs to be cleaned up! Test cases are already in place. Specifically, clang/test/CodeGen/ms-inline-asm.c t15(), t16(), and t24(). llvm-svn: 172569
* Refactor generic Asm directive parsing.Eli Bendersky2013-01-151-790/+802
| | | | | | | | | | | | | | | | | | After discussing the refactoring with Jim and Daniel, the following changes were made: * All generic directive parsing is now done by AsmParser itself. The previous division between it and GenericAsmParser did not have clear boundaries and just produced unnatural code of GenericAsmParser juggling the internals of AsmParser through an interface. The division of responsibilities is now clear: target-specific directives, other extensions (used by platform-specific parseres), and generic directives. * Priority for directive parsing was reshuffled to ask extensions first and check the generic directives later. No change in functionality. llvm-svn: 172568
* Now GenericAsmParser and AsmParser are no longer friends, GenericAsmParser canEli Bendersky2013-01-141-4/+0
| | | | | | | | simply use the getParser method from MCAsmParserExtension, working through the MCAsmParser interface. There's no longer a need to overload that method to cast it to the concrete AsmParser. llvm-svn: 172491
* Properly encapsulate additional methods and data from AsmParser.Eli Bendersky2013-01-141-67/+72
| | | | | | | | | This finally allows AsmParser to no longer list GenericAsmParser as a friend. All member vars directly accessed by GenericAsmParser have been properly encapsulated and exposed through the MCAsmParser interface. This reduces the coupling between AsmParser and GenericAsmParser. llvm-svn: 172490
* Move CheckForValidSection to the MCAsmParser interface.Eli Bendersky2013-01-141-1/+1
| | | | | | | | | | | | | Now that it behaves itself in terms of streamer independence (r172450), this method can be moved to MCAsmParser to be available to all extensions, overriding, etc. -- -This line, and those below, will be ignored-- M lib/MC/MCParser/AsmParser.cpp M include/llvm/MC/MCParser/MCAsmParser.h llvm-svn: 172451
* Expose an InitToTextSection through MCStreamer.Eli Bendersky2013-01-141-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to fix the following piece of code in the platform-independent AsmParser: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.SwitchSection(Ctx.getMachOSection( "__TEXT", "__text", MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0, SectionKind::getText())); } } This was added for the "-n" option of llvm-mc. The proposed fix adds another virtual method to MCStreamer, called InitToTextSection. Conceptually, it's similar to the existing InitSections which initializes all common sections and switches to text. The new method is implemented by each platform streamer in a way that it sees fit. So AsmParser can now do this: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.InitToTextSection(); } } Which is much more reasonable. llvm-svn: 172450
* Move ParseMacroArgument to the MCAsmParser interfance.Eli Bendersky2013-01-141-12/+8
| | | | | | | | | | | | Since it's used by extensions. One further step to fully decoupling GenericAsmParser from an intimate knowledge of the internals of AsmParser, pointing it to the MCASmParser interface instead (like all other parser extensions do). Since this change moves the MacroArgument type to the interface header, it's renamed to be a bit more descriptive in a general context. llvm-svn: 172449
* Encapsulate the MacroEnabled flag in AsmParser behind accessor methods.Eli Bendersky2013-01-141-4/+7
| | | | | | | | The methods are also exposed via the MCAsmParser interface, which allows more than one client to control them. Previously, GenericAsmParser was playing with a member var in AsmParser directly (by virtue of being its friend). llvm-svn: 172440
* Stop hiding the interface-exposed EatToEndOfStatement (see r172276).Eli Bendersky2013-01-121-2/+1
| | | | llvm-svn: 172277
* Make ParseIdentifier a public method instead of private.Eli Bendersky2013-01-121-4/+4
| | | | | | | | | | | | | | | | | The MCAsmParser interface defines ParseIdentifier is public. There's no reason whatsoever for AsmParser (which implements the MCAsmParser interface) to hide this method. This is all part of a bigger scheme. Several asm parsing "extensions" use the main parser properly through the MCAsmParser interface. However, GenericAsmParser has much more exclusive access and uses implementation details from the concrete implementation - AsmParser, in which it is also declared as a friend. This makes for overly coupled code, and even makes it hard to split GenericAsmParser into a separate file. There's no reason why GenericAsmParser shouldn't be able to access AsmParser through an abstract interface, as long as it's actually registered as an extension. llvm-svn: 172276
* Proof of concept moving of generic directive parsing from AsmParser to theEli Bendersky2013-01-111-41/+38
| | | | | | | | GenericAsmParser extension, where a lot of directives are already being parsed. The end goal is having just a single place (and a single lookup table) for all directive parsing. llvm-svn: 172268
* Revert r172153, "llvm/lib/MC/MCParser/AsmParser.cpp: [ms-inline-asm] Fix a ↵NAKAMURA Takumi2013-01-111-4/+2
| | | | | | | | couple of undefined behaviors. Operand->needAddressOf() is not initialized at !Operand->isReg()." It has been redundant since r172157. llvm-svn: 172166
* llvm/lib/MC/MCParser/AsmParser.cpp: [ms-inline-asm] Fix a couple of ↵NAKAMURA Takumi2013-01-111-2/+4
| | | | | | undefined behaviors. Operand->needAddressOf() is not initialized at !Operand->isReg(). llvm-svn: 172153
* Rename enumerations s/VK/DK/ to conform to naming conventionEli Bendersky2013-01-101-153/+153
| | | | llvm-svn: 172149
* fix comments a bitEli Bendersky2013-01-101-2/+2
| | | | llvm-svn: 172146
* Remove a couple of if-else chains in parsing directives, replacing them by aEli Bendersky2013-01-101-149/+240
| | | | | | switch. Committed with Jim's and Chris's approval. llvm-svn: 172136
* [ms-inline asm] Add support for calling functions from inline assembly.Chad Rosier2013-01-101-12/+13
| | | | | | Part of rdar://12991541 llvm-svn: 172121
* These functions have default arguments of 0 for the last arg. UseEric Christopher2013-01-091-2/+2
| | | | | | them. llvm-svn: 171933
* Add the align_to_end option to .bundle_lock in the MC implementation of alignedEli Bendersky2013-01-071-4/+20
| | | | | | | | | bundling. The document describing this feature and the implementation has also been updated: https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm llvm-svn: 171797
* [ms-inline asm] Make sure the NullStreamParser doesn't try to emit labels whenChad Rosier2013-01-071-1/+2
| | | | | | parsing MS-style inline assembly. llvm-svn: 171784
* Change SMRange to be half-open (exclusive end) instead of closed (inclusive)Jordan Rose2013-01-072-11/+12
| | | | | | | | | | This is necessary not only for representing empty ranges, but for handling multibyte characters in the input. (If the end pointer in a range refers to a multibyte character, should it point to the beginning or the end of the character in a char array?) Some of the code in the asm parsers was already assuming this anyway. llvm-svn: 171765
* Aligned bundling support. Following the discussion here:Eli Bendersky2012-12-201-0/+67
| | | | | | | | | | | http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056754.html The proposal and implementation are fully documented here: https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm Tests will follow shortly. llvm-svn: 170718
* Add support for passing -main-file-name all the way through toEric Christopher2012-12-181-1/+2
| | | | | | | | the assembler. Part of PR14624 llvm-svn: 170390
* Cleanup formatting and whitespace.Eric Christopher2012-12-181-9/+10
| | | | llvm-svn: 170389
* fix indentationEli Bendersky2012-12-171-1/+1
| | | | llvm-svn: 170381
OpenPOWER on IntegriCloud