summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
Commit message (Collapse)AuthorAgeFilesLines
...
* [MC][AsmParser] Hook for post assembly file processingJack Carter2013-10-041-2/+5
| | | | | | | | | | | | | | | | | | | | | This patch handles LLVM standalone assembler (llvm-mc) ELF flag setting based on input file directive processing. Mips assembly requires processing inline directives that directly and indirectly affect the output ELF header flags. This patch handles one ".abicalls". To process these directives we are following the model the code generator uses by storing state in a container as we go through processing and when we detect the end of input file processing, AsmParser is notified and we update the ELF header flags through a MipsELFStreamer method with a call from MCTargetAsmParser::emitEndOfAsmFile(MCStreamer &OutStreamer). This patch will allow other targets the same functionality. Jack llvm-svn: 191982
* Add Support For .bss Named Section Directive For Darwin Targets.Rafael Espindola2013-10-021-0/+5
| | | | | | Patch by Nicholas White. llvm-svn: 191824
* MCParser/Debug info: Accept line number 0 as a legitimate value, sinceAdrian Prantl2013-09-261-2/+2
| | | | | | | | CFE produces it to indicate artificial locations. c.f.: DWARF standard, Table 6.2: line -- An unsigned integer indicating a source line number. Lines are numbered beginning at 1. The compiler may emit the value 0 in cases where an instruction cannot be attributed to any source line. llvm-svn: 191471
* Implements parsing and emitting of .cfi_window_save in MC.Venkatraman Govindaraju2013-09-261-1/+12
| | | | llvm-svn: 191431
* MC: Add support for treating $ as a reference to the PCDavid Majnemer2013-09-251-3/+13
| | | | | | | | | | | | | | | | | The binutils assembler supports a mode called DOLLAR_DOT which treats the dollar sign token as a reference to the current program counter if the dollar sign doesn't precede a constant or identifier. This commit adds a new MCAsmInfo flag stating whether or not a given target supports this interpretation of the dollar sign token; by default, this flag is not enabled. Further, enable this flag for PPC. The system assembler for AIX and binutils both support using the dollar sign in this manner. This fixes PR17353. llvm-svn: 191368
* Make the size and expr arguments of .fill directive optional.Roman Divacky2013-09-241-16/+21
| | | | llvm-svn: 191318
* Provide basic type safety for array_pod_sort comparators.Benjamin Kramer2013-09-221-3/+2
| | | | | | | | This makes using array_pod_sort significantly safer. The implementation relies on function pointer casting but that should be safe as we're dealing with void* here. llvm-svn: 191175
* ELF: Parse types in directives like binutils gasDavid Majnemer2013-09-211-20/+43
| | | | | | | | | | Allow binutils .type and .section directives to take the following forms: - @<type> - %<type> - "<type>" llvm-svn: 191134
* MC: Tidy up.Jim Grosbach2013-09-201-743/+723
| | | | | | | | Clean up some simple code quality issues. Bring internal naming conventions up to current standard, fix inconsistent formatting, and tidy up a couple of odd contructs. llvm-svn: 191117
* Use reference instead of copy.Jakub Staszak2013-09-161-1/+1
| | | | llvm-svn: 190813
* ELF: Add support for the exclude section bit for gas compat.Benjamin Kramer2013-09-151-5/+8
| | | | llvm-svn: 190769
* MC: Add support for '?' flags in .section directivesDavid Majnemer2013-09-151-2/+20
| | | | | | | | | | | | | | | | | | | Summary: The '?' flag uses the last section group if the last had a section group. We treat combining an explicit section group and the '?' as a hard error. This fixes PR17198. Reviewers: rafael, bkramer Reviewed By: bkramer CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1686 llvm-svn: 190768
* Remove unused StringRef that no compiler warned about, I wonder why.Benjamin Kramer2013-09-141-1/+0
| | | | llvm-svn: 190759
* Improve handling of .file, .include and .incbin directives toYunzhong Gao2013-09-051-12/+16
| | | | | | | | | allow escaped octal character sequences. The patch was discussed in Phabricator. See: http://llvm-reviews.chandlerc.com/D1289 llvm-svn: 190089
* The integrated darwin assembler can hang in an infinite loop (or get an assert Kevin Enderby2013-08-282-4/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | with a debug build) with this buggy .indirect_symbol directive usage: % cat test.s x: .indirect_symbol _y The assertion is because it is trying to get the symbol index for the symbol _y when it is writing out the indirect symbol table. This line of code in MachObjectWriter::WriteObject() : Write32(Asm.getSymbolData(*it->Symbol).getIndex()); And while there is a symbol _y it does not have any getSymbolData set which is only done in MachObjectWriter::BindIndirectSymbols() for pointer sections or stub sections. I added a check and an error in there to catch this in case something slips through. But to get a better error the parser should detect when a .indirect_symbol directive is used and it is not in a pointer section or stub section. To make that work I moved the handling of the indirect symbol out of the target independent AsmParser code into the DarwinAsmParser code that can check for the proper Mach-O section types. rdar://14825505 llvm-svn: 189497
* Given target assembler parsers a chance to handle variant expressionsJoerg Sonnenberger2013-08-271-0/+4
| | | | | | | first. Use this to turn the PPC modifiers into PPC specific expressions, allowing them to work on constants. llvm-svn: 189400
* Fix style issues in AsmParser.cppVladimir Medic2013-08-201-9/+11
| | | | llvm-svn: 188798
* Support C99 hexadecimal floating-point literals in assemblyTim Northover2013-08-141-1/+53
| | | | | | | | It's useful to be able to write down floating-point numbers without having to worry about what they'll be rounded to (as C99 discovered), this extends that ability to the MC assembly parsers. llvm-svn: 188370
* [CodeGen] prevent abnormal on invalid attributesSaleem Abdulrasool2013-08-091-1/+2
| | | | | | | | | | | Currently, when an invalid attribute is encountered on processing a .s file, clang will abort due to llvm_unreachable. Invalid user input should not cause an abnormal termination of the compiler. Change the interface to return a boolean to indicate the failure as a first step towards improving hanlding of malformed user input to clang. Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org> llvm-svn: 188047
* AsmParser: Store MacroLikeBodies on the side so they don't get leaked.Benjamin Kramer2013-08-041-1/+5
| | | | llvm-svn: 187702
* Add a wrapper for open.Rafael Espindola2013-07-161-1/+1
| | | | | | | This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). llvm-svn: 186447
* MC: Implement COFF .linkonce directiveNico Rieck2013-07-061-0/+60
| | | | llvm-svn: 185753
* MC: Add .section directive to COFFNico Rieck2013-07-041-0/+172
| | | | | | | | Supports GAS flags "abdnrswxy". No support for alignment or subsections. Fixes PR16366. llvm-svn: 185669
* Remove address spaces from MC.Rafael Espindola2013-07-021-10/+9
| | | | | | | | This is dead code since PIC16 was removed in 2010. The result was an odd mix, where some parts would carefully pass it along and others would assert it was zero (most of the object streamer for example). llvm-svn: 185436
* Improve the time it takes to generating dwarf for assembly source filesKevin Enderby2013-06-211-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | that have been run through the 'C' pre-processor. The implementation of SrcMgr.FindLineNumber() is slow but OK if it uses its cache when called multiple times with an SMLoc that is forward of the previous call. In the case of generating dwarf for assembly source files that have been run through the 'C' pre-processor we need to calculate the logical line number based on the last parsed cpp hash file line comment. And the current code calls SrcMgr.FindLineNumber() twice to do this causing its cache not to work and results in very slow compile times: % time /Volumes/SandBox/build-llvm/Debug+Asserts/bin/llvm-mc -triple thumbv7-apple-ios -filetype=obj -o /tmp/x.o mscorlib.dll.E -g 672.542u 0.299s 11:13.15 99.9% 0+0k 0+2io 2106pf+0w So we save the info from the last parsed cpp hash file line comment to avoid making the second call to SrcMgr.FindLineNumber() most times and end up with compile times like: % time /Volumes/SandBox/build-llvm/Debug+Asserts/bin/llvm-mc -triple thumbv7-apple-ios -filetype=obj -o /tmp/x.o mscorlib.dll.E -g 3.404u 0.104s 0:03.80 92.1% 0+0k 0+3io 2105pf+0w rdar://14156934 llvm-svn: 184592
* [MC] Support @ variants with directional labelsUlrich Weigand2013-06-201-2/+12
| | | | | | | | | | | The assembler parser common code supports recognizing symbol variants using the @ modifer. On PowerPC, it should also be possible to use (some of) those modifiers with directional labels, like "1f@l". This patch adds support for accepting symbol variants on directional labels as well. llvm-svn: 184437
* Use pointers to the MCAsmInfo and MCRegInfo.Bill Wendling2013-06-182-5/+5
| | | | | | | | | Someone may want to do something crazy, like replace these objects if they change or something. No functionality change intended. llvm-svn: 184175
* Fix two typoSylvestre Ledru2013-05-141-1/+1
| | | | llvm-svn: 181848
* Fix a bug in the MC asm parser evaluating expressions. It was treating:Kevin Enderby2013-05-071-1/+1
| | | | | | | | | A = 9 B = 3 * A - 2 * A + 1 as B = 3 * A - (2 * A + 1) rdar://13816516 llvm-svn: 181366
* Add ArrayRef constructor from None, and do the cleanups that this ↵Dmitri Gribenko2013-05-051-3/+3
| | | | | | | | constructor enables Patch by Robert Wilhelm. llvm-svn: 181138
* [ms-inline asm] Get the OpDecl and remove a redundant lookup.Chad Rosier2013-04-221-2/+1
| | | | | | Part of rdar://13663589 llvm-svn: 180057
* [ms-inline asm] Refactor/clean up the SemaLookup interface. No functionalChad Rosier2013-04-221-5/+2
| | | | | | | change indended. Part of rdar://13663589 llvm-svn: 180028
* Fix indentation. No functional change.Craig Topper2013-04-221-5/+5
| | | | llvm-svn: 179994
* Put 'else' on same line as preceding curly brace per coding standards. No ↵Craig Topper2013-04-221-12/+6
| | | | | | functional change. llvm-svn: 179993
* Remove an unreachable 'break' following a 'return'.Craig Topper2013-04-221-1/+0
| | | | llvm-svn: 179991
* Add support for subsections to the ELF assembler. Fixes PR8717.Peter Collingbourne2013-04-173-16/+52
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D598 llvm-svn: 179725
* [ms-inline asm] Add the implementation for the AOK_Delete kind, which was addedChad Rosier2013-04-121-3/+5
| | | | | | | in r179325. Test case coming shortly on the clang side. Part of rdar://13453209 llvm-svn: 179383
* [ms-inline asm] Remove brackets from around a symbol reference in the targetChad Rosier2013-04-111-10/+1
| | | | | | | | specific logic. This makes the code much less fragile. Test case coming on the clang side in a moment. rdar://13634327 llvm-svn: 179323
* Reapply r179115, but use parsePrimaryExpression a little more judiciously.Chad Rosier2013-04-101-0/+5
| | | | | | | | | | | | | | | | | Test cases that regressed due to r179115, plus a few more, were added in r179182. Original commit message below: [ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need to parse an identifier. Otherwise, parseExpression may parse multiple tokens, which makes it impossible to properly compute an immediate displacement. An example of such a case is the source operand (i.e., [Symbol + ImmDisp]) in the below example: __asm mov eax, [Symbol + ImmDisp] Part of rdar://13611297 llvm-svn: 179187
* Revert r179115 as it looks to have killed the ASan tests.Chad Rosier2013-04-091-5/+0
| | | | llvm-svn: 179120
* [ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need toChad Rosier2013-04-091-0/+5
| | | | | | | | | | | | | | parse an identifier. Otherwise, parseExpression may parse multiple tokens, which makes it impossible to properly compute an immediate displacement. An example of such a case is the source operand (i.e., [Symbol + ImmDisp]) in the below example: __asm mov eax, [Symbol + ImmDisp] The existing test cases exercise this patch. rdar://13611297 llvm-svn: 179115
* [ms-inline asm] Maintain a StringRef to reference a symbol in a parsed operand,Chad Rosier2013-04-091-5/+8
| | | | | | | | | | | rather than deriving the StringRef from the Start and End SMLocs. Using the Start and End SMLocs works fine for operands such as [Symbol], but not for operands such as [Symbol + ImmDisp]. All existing test cases that reference a variable exercise this patch. rdar://13602265 llvm-svn: 179109
* [ms-inline asm] Add support for ImmDisp [ Symbol ] memory operands.Chad Rosier2013-04-081-11/+9
| | | | | | rdar://13521249 llvm-svn: 179030
* Dead code.Chad Rosier2013-03-191-2/+0
| | | | llvm-svn: 177451
* [ms-inline asm] Move the immediate asm rewrite into the target specificChad Rosier2013-03-191-5/+1
| | | | | | | logic as a QOI cleanup. No functional change. Tests already in place. rdar://13456414 llvm-svn: 177446
* [ms-inline asm] Remove the brackets from X86Operand in the IR. These will beChad Rosier2013-03-191-8/+19
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 177440
* [ms-inline asm] Move the size directive asm rewrite into the target specificChad Rosier2013-03-191-12/+4
| | | | | | | logic as a QOI cleanup. rdar://13445327 llvm-svn: 177413
* Debug Info: use SmallVector instead of std::vector in MCDwarfDirsCUMap and ↵Manman Ren2013-03-121-2/+2
| | | | | | MCDwarfFilesCUMap llvm-svn: 176893
* AsmParser: More generic support for integer type suffices.Jim Grosbach2013-02-261-6/+9
| | | | | | | | | | 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 llvm-svn: 176118
* 'Hexadecimal' has two 'a's and only one 'i'.Matt Beaumont-Gay2013-02-251-1/+1
| | | | llvm-svn: 176031
OpenPOWER on IntegriCloud