aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCParser
AgeCommit message (Collapse)Author
2013-03-19Dead code.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177451 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19[ms-inline asm] Move the immediate asm rewrite into the target specificChad Rosier
logic as a QOI cleanup. No functional change. Tests already in place. rdar://13456414 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177446 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19[ms-inline asm] Remove the brackets from X86Operand in the IR. These will beChad Rosier
added back in by X86AsmPrinter::printIntelMemReference() during codegen. Previously, this following example void t() { int i; __asm mov eax, [i] } would generate the below assembly mov eax, dword ptr [[eax]] which resulted in a fatal error when compiling. Test case coming on the clang side. rdar://13444264 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177440 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19[ms-inline asm] Move the size directive asm rewrite into the target specificChad Rosier
logic as a QOI cleanup. rdar://13445327 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177413 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12Debug Info: use SmallVector instead of std::vector in MCDwarfDirsCUMap and ↵Manman Ren
MCDwarfFilesCUMap git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176893 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26AsmParser: More generic support for integer type suffices.Jim Grosbach
For integer constants, allow 'L', 'UL' as well as 'ULL' and 'LL'. This provides better support for shared headers between .s and .c files that define bunches of constant values. rdar://9321056 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176118 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25'Hexadecimal' has two 'a's and only one 'i'.Matt Beaumont-Gay
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176031 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20MCParser: Update method names per coding guidelines.Jim Grosbach
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175675 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-16MCParser: Reject .balign with non-pow2 alignments.Benjamin Kramer
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175360 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-16Derive ELF section type from the name in some cases where GNU as doesJoerg Sonnenberger
so. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175327 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15c[ms-inline asm] It's possible to have a SizeDirective rewrite and anChad Rosier
Input/Output rewrite to the same location. Make sure the SizeDirective rewrite is performed first. This also ensure the sort algorithm is stable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175317 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15AsmParser: Reformat the MS asm parser to reduce nesting.Benjamin Kramer
While there postpone register name printing after uniquing. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175292 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-14Revert r15266. This fixes llvm.org/pr15266.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175173 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-13[ms-inline asm] Add a comment about the determinism of the rewrite sort.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175082 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-13[ms-inline-asm] Use an array_pod_sort, rather than a std:sort.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175063 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-13[ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.Chad Rosier
rdar://13202662 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175021 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12[ms-inline-asm] Implement align directive (which is roughly equivalent to ↵Chad Rosier
.align). Also, allow _EMIT and __EMIT for the emit directive. We already do the same for TYPE, SIZE, and LENGTH. rdar://13200215 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175008 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Add static cast to unsigned char whenever a character classification ↵Guy Benyei
function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175006 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12[ms-inline asm] Pass the length of the IDVal, so we can do a proper AsmRewrite.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174999 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12[ms-inline asm] Accept the emit directive as either _emit or __emit.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174998 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12[ms-inline asm] Add support for lexing binary integers with a [bB] suffix.Chad Rosier
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174983 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Update error message due to previous commit, r174926.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174927 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12[ms-inline asm] Add support for lexing hexidecimal integers with a [hH] suffix.Chad Rosier
Part of rdar://12470373 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174926 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22Add a warning when there is a macro defintion that has named parameters butKevin Enderby
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173199 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22Have the integrated assembler give an error if $1 is used as an identifier inKevin Enderby
an expression. Currently this bug causes the line to be ignored in a release build and an assert in a debug build. rdar://13062484 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173195 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18[MC/Mach-O] Add AsmParser support for .linker_option directive.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172778 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18[MC] Expose ParseEscapedString to target AsmParser implementations.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172777 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18[MC] Fix 80-col violas.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172776 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-17[ms-inline asm] Add support for the 'SIZE' and 'LENGTH' operators.Chad Rosier
Part of rdar://12576868 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172743 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16Some small (and mostly cosmetic) fixes.Eli Bendersky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172640 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16Now that GenericAsmParser was folded into AsmParser, some methods and types canEli Bendersky
return into the safe harbor of AsmParser's private areas. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172637 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16Use the ExtensionDirectiveHandler type in other places where it makes sense.Eli Bendersky
Since we already have this type it's a shame to keep dragging a pair of object and method around explicitly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172584 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15[ms-inline asm] Address the FIXME in AsmParser.cpp.Chad Rosier
// 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(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172569 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15Refactor generic Asm directive parsing.Eli Bendersky
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172568 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Now GenericAsmParser and AsmParser are no longer friends, GenericAsmParser canEli Bendersky
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172491 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Properly encapsulate additional methods and data from AsmParser.Eli Bendersky
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172490 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Move CheckForValidSection to the MCAsmParser interface.Eli Bendersky
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172451 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Expose an InitToTextSection through MCStreamer.Eli Bendersky
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172450 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Move ParseMacroArgument to the MCAsmParser interfance.Eli Bendersky
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Encapsulate the MacroEnabled flag in AsmParser behind accessor methods.Eli Bendersky
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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172440 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12Stop hiding the interface-exposed EatToEndOfStatement (see r172276).Eli Bendersky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172277 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12Make ParseIdentifier a public method instead of private.Eli Bendersky
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172276 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11Proof of concept moving of generic directive parsing from AsmParser to theEli Bendersky
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172268 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11Revert r172153, "llvm/lib/MC/MCParser/AsmParser.cpp: [ms-inline-asm] Fix a ↵NAKAMURA Takumi
couple of undefined behaviors. Operand->needAddressOf() is not initialized at !Operand->isReg()." It has been redundant since r172157. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172166 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11llvm/lib/MC/MCParser/AsmParser.cpp: [ms-inline-asm] Fix a couple of ↵NAKAMURA Takumi
undefined behaviors. Operand->needAddressOf() is not initialized at !Operand->isReg(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172153 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10Rename enumerations s/VK/DK/ to conform to naming conventionEli Bendersky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172149 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10fix comments a bitEli Bendersky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172146 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10Remove a couple of if-else chains in parsing directives, replacing them by aEli Bendersky
switch. Committed with Jim's and Chris's approval. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172136 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10[ms-inline asm] Add support for calling functions from inline assembly.Chad Rosier
Part of rdar://12991541 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172121 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09These functions have default arguments of 0 for the last arg. UseEric Christopher
them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171933 91177308-0d34-0410-b5e6-96231b3b80d8