summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
Commit message (Collapse)AuthorAgeFilesLines
...
* Tentative fix for r351701 and gcc 6.2 build on ubuntuSerge Guelton2019-01-201-2/+3
| | | | llvm-svn: 351705
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1911-44/+33
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [WebAssembly] Fixed objdump not parsing function headers.Wouter van Oortmerssen2019-01-171-8/+15
| | | | | | | | | | | | | | | | | | | | | | | Summary: objdump was interpreting the function header containing the locals declaration as instructions. To parse these without injecting target specific code in objdump, MCDisassembler::onSymbolStart was added to be implemented by the WebAssembly implemention. WasmObjectFile now returns a code offset for the "address" of a symbol, rather than the index. This is also more in-line with what other targets do. Also ensured that the AsmParser correctly puts each function in its own segment to enable this test case. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, aheejin, sunfish, rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D56684 llvm-svn: 351460
* [WebAssembly] Make assembler check for proper nesting of control flow.Wouter van Oortmerssen2018-12-261-0/+3
| | | | | | | | | | | | | | | | | | | | | Summary: It does so using a simple nesting stack, and gives clear errors upon violation. This is unique to wasm, since most CPUs do not have any nested constructs. Had to add an end of file check to the general assembler for this. Note: if/else/end instructions are not currently supported in our tablegen defs, so these tests will be enabled in a follow-up. They already pass the nesting check. Reviewers: dschuff, aheejin Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55797 llvm-svn: 350078
* [MC] Enable .file support on COFF and diagnose it on unsupported targetsReid Kleckner2018-12-211-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The "single parameter" .file directive appears to be an ELF-only feature that is intended to insert the main source filename into the string table table. I noticed that if you assemble an ELF .s file for COFF, typically it will assert right away on a .file directive near the top of the file. My first change was to make this emit a proper error in the asm parser so that we don't assert so easily. However, COFF actually does have some support for this directive, and if you emit an object file, llvm-mc does not assert. When emitting a COFF object, MC will take those file names and create "debug" symbol table entries for them. I'm not familiar with these kinds of symbol table entries, and I'm not aware of any users of them, but @compnerd added them a while ago. They don't introduce absolute paths, and most main source file paths are short enough that this extra entry shouldn't cause any problems, so I enabled the flag in MCAsmInfoCOFF that indicates that it's supported. This has the side effect of adding an extra debug symbol to every object produced by clang, which is a pretty big functional change. My question is, should we keep the functionality or remove it in the name of symbol table minimalism? Reviewers: mstorsjo, compnerd Subscribers: hiraditya, compnerd, llvm-commits Differential Revision: https://reviews.llvm.org/D55900 llvm-svn: 349976
* [Dwarf/AArch64] Return address signing B key dwarf supportLuke Cheeseman2018-12-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - When signing return addresses with -msign-return-address=<scope>{+<key>}, either the A key instructions or the B key instructions can be used. To correctly authenticate the return address, the unwinder/debugger must know which key was used to sign the return address. - When and exception is thrown or a break point reached, it may be necessary to unwind the stack. To accomplish this, the unwinder/debugger must be able to first authenticate an the return address if it has been signed. - To enable this, the augmentation string of CIEs has been extended to allow inclusion of a 'B' character. Functions that are signed using the B key variant of the instructions should have and FDE whose associated CIE has a 'B' in the augmentation string. - One must also be able to preserve these semantics when first stepping from a high level language into assembly and then, as a second step, into an object file. To achieve this, I have introduced a new assembly directive '.cfi_b_key_frame ', that tells the assembler the current frame uses return address signing with the B key. - This ensures that the FDE is associated with a CIE that has 'B' in the augmentation string. Differential Revision: https://reviews.llvm.org/D51798 llvm-svn: 349895
* Add PLATFORM constants for iOS, tvOS, and watchOS simulatorsMichael Trent2018-12-201-1/+4
| | | | | | | | | | | | | | | | | | | Summary: Add PLATFORM constants for iOS, tvOS, and watchOS simulators, as well as human readable names for these constants, to the Mach-O file format header files. rdar://46854119 Reviewers: ab, davide Reviewed By: ab, davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D55905 llvm-svn: 349779
* [macho] save the SDK version stored in module metadata into the version min andAlex Lorenz2018-12-141-25/+82
| | | | | | | | | | | | | | | | | | | | | build version load commands in the object file This commit introduces a new metadata node called "SDK Version". It will be set by the frontend to mark the platform SDK (macOS/iOS/etc) version which was used during that particular compilation. This node is used when machine code is emitted, by either saving the SDK version into the appropriate macho load command (version min/build version), or by emitting the assembly for these load commands with the SDK version specified as well. The assembly for both load commands is extended by allowing it to contain the sdk_version X, Y [, Z] trailing directive to represent the SDK version respectively. rdar://45774000 Differential Revision: https://reviews.llvm.org/D55612 llvm-svn: 349119
* [MC] Support labels as offsets in .reloc directiveVladimir Stefanovic2018-11-211-9/+9
| | | | | | | | | | | | | | | | | Currently, expressions like .reloc 1f, R_MIPS_JALR, foo 1: nop are not allowed, ie. an offset in .reloc can only be absolute value. This patch adds support for labels as offsets. If offset is a forward declared label, MCObjectStreamer keeps the fixup locally and adds it to the fixups vector after the label (and its offset) is defined. label+number is not supported yet. Differential revision: https://reviews.llvm.org/D53990 llvm-svn: 347397
* [WebAssembly] replaced .param/.result by .functypeWouter van Oortmerssen2018-11-192-1/+7
| | | | | | | | | | | | | | | | | | | | | Summary: This makes it easier/cleaner to generate a single signature from this directive. Also: - Adds the symbol name, such that we don't depend on the location of this directive anymore. - Actually constructs the signature in the assembler, and make the assembler own it. - Refactor the use of MVT vs ValType in the streamer and assembler to require less conversions overall. - Changed 700 or so tests to use it. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, eraman, aheejin, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D54652 llvm-svn: 347228
* [WebAssembly] Added WasmAsmParser.Wouter van Oortmerssen2018-11-123-5/+149
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is to replace the ELFAsmParser that WebAssembly was using, which so far was a stub that didn't do anything, and couldn't work correctly with wasm. This new class is there to implement generic directives related to wasm as a binary format. Wasm target specific directives are still parsed in WebAssemblyAsmParser as before. The two classes now cooperate more correctly too. Also implemented .result which was missing. Any unknown directives will now result in errors. Reviewers: dschuff, sbc100 Subscribers: mgorny, jgravelle-google, eraman, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54360 llvm-svn: 346700
* [Hexagon] Handle Hexagon's SHF_HEX_GPREL section flagKrzysztof Parzyszek2018-11-091-0/+3
| | | | llvm-svn: 346494
* [MC] Separate masm integer literal lexer support from inline asmReid Kleckner2018-10-242-17/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This renames the IsParsingMSInlineAsm member variable of AsmLexer to LexMasmIntegers and moves it up to MCAsmLexer. This is the only behavior controlled by that variable. I added a public setter, so that it can be set from outside or from the llvm-mc command line. We may need to arrange things so that users can get this behavior from clang, but that's future work. I also put additional hex literal lexing functionality under this flag to fix PR32973. It appears that this hex literal parsing wasn't intended to be enabled in non-masm-style blocks. Now, masm integers (0b1101 and 0ABCh) work in __asm blocks from clang, but 0b label references work when using .intel_syntax in standalone .s files. However, 0b label references will *not* work from __asm blocks in clang. They will work from GCC inline asm blocks, which it sounds like is important for Crypto++ as mentioned in PR36144. Essentially, we only lex masm literals for inline asm blobs that use intel syntax. If the .intel_syntax directive is used inside a gnu-style inline asm statement, masm literals will not be lexed, which is compatible with gas and llvm-mc standalone .s assembly. This fixes PR36144 and PR32973. Reviewers: Gerolf, avt77 Subscribers: eraman, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D53535 llvm-svn: 345189
* [MC] Shrink MCAsmParser by grouping bools, add const, NFCReid Kleckner2018-10-221-1/+1
| | | | | | | | | | | | I was considering adding another boolean here. I standardized on bools since they allow default member initializers in the class definition. This makes ShowParsedOperands protected instead of private, but that's probably fine. Reduce the SmallVector size while we're at it, since the common case is that there is never a pending error. llvm-svn: 344967
* [MC][DWARF][AsmParser] Ensure nested CFI frames are diagnosed.Kristina Brooks2018-10-191-2/+7
| | | | | | | | | | | | | | | | | | This avoids a crash (with asserts) or bad codegen (without asserts) in Dwarf streamer later on. This patch fixes this condition in MCStreamer and propogates SMLoc down when it's available with an added bonus of source locations for those specific types of errors. Further patches could use similar improvements as currently most non-Windows CFI directives lack an SMLoc parameter. Modified an existing test to verify source location propogation and added an object-file version of it to verify that it does not crash in addition to a standalone test to only ensure it does not crash. Differential Revision: https://reviews.llvm.org/D51695 llvm-svn: 344781
* [AsmParser] Return an error in the case of empty symbol ref in an expressionFrancis Visoiu Mistrih2018-10-081-1/+1
| | | | | | | | | | | | | | The following instruction: > str q28, [x0, #1*6*4*@] contains a @ which is parsed as an empty symbol. The parser returns true but has no error, so the assembler continues by ignoring the instruction. Differential Revision: https://reviews.llvm.org/D52645 llvm-svn: 343961
* [MCAsmParser] Move AltMacroMode tracking out of MCAsmLexerCraig Topper2018-09-252-10/+9
| | | | | | | | The Lexer doesn't use this state itself. It is only set and used by AsmParser so it seems like it should just be part of AsmParser. Differential Revision: https://reviews.llvm.org/D52515 llvm-svn: 343027
* [MC] Return a std::string instead of taking it as an out parameter. Make two ↵Craig Topper2018-09-251-7/+5
| | | | | | parser methods into static functions at file scope. NFC llvm-svn: 343020
* [MC] Fix bad indentation and 80 column violations. Use StringRef::front ↵Craig Topper2018-09-251-29/+34
| | | | | | instead of dereferencing StringRef::begin. NFC llvm-svn: 343010
* [MC] Replace NULL constant in code with nullptr.Craig Topper2018-09-251-1/+1
| | | | llvm-svn: 343003
* Fix for bug 34002 - label generated before it block is finalized. ↵Maya Madhavan2018-09-201-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D52258 llvm-svn: 342615
* [MC] Avoid inlining constant symbols with variants.Nirav Dave2018-09-171-1/+1
| | | | | | | | | | | | | | Summary: Defer unnecessary early inlining of constants to symbol variants. Fixes PR38945. Reviewers: nickdesaulniers, rnk Subscribers: nemanjai, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D52188 llvm-svn: 342412
* [codeview] Add .cv_string directive for testing purposesReid Kleckner2018-09-071-1/+20
| | | | | | | | | | | The main use case for this directive is to allow assembly writers to write their own FPO data strings without going through the .cv_fpo* directive family. I'm experimenting with different RPN programs to fix PR38857, and I figured I should go ahead and make this directive permanent. llvm-svn: 341712
* [debuginfo] generate debug info with asm+.fileBrian Cain2018-08-281-8/+8
| | | | | | | | | | | | | | | Summary: For assembly input files, generate debug info even when the .file directive is present, provided it does not include a file-number argument. Fixes PR38695. Reviewers: probinson, sidneym Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D51315 llvm-svn: 340839
* [MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"'Ana Pazos2018-08-251-1/+1
| | | | | | | | | | | | | | | | | | Summary: Handle the case IDVal is an empty string. This bug was uncovered by a LLVM MC Assembler Protocol Buffer Fuzzer for the RISC-V assembly language. Reviewers: rnk Reviewed By: rnk Subscribers: rnk, niravd, pcc, peter.smith, asb, grosbach, llvm-commits, bcain, kito-cheng, shiva0217, rogfer01, PkmX Differential Revision: https://reviews.llvm.org/D50808 llvm-svn: 340678
* [MC] Remove unused variableBenjamin Kramer2018-08-161-1/+0
| | | | llvm-svn: 339896
* [MC][X86] Enhance X86 Register expression handling to more closely match GCC.Nirav Dave2018-08-161-13/+10
| | | | | | | | | | | | | | | | Allow the comparison of x86 registers in the evaluation of assembler directives. This generalizes and simplifies the extension from r334022 to catch another case found in the Linux kernel. Reviewers: rnk, void Reviewed By: rnk Subscribers: hiraditya, nickdesaulniers, llvm-commits Differential Revision: https://reviews.llvm.org/D50795 llvm-svn: 339895
* Revert "Add a warning if someone attempts to add extra section flags to ↵Eric Christopher2018-08-051-36/+16
| | | | | | | | | | | sections" There are a bunch of edge cases and inconsistencies in how we're emitting sections cause this warning to fire and it needs more work. This reverts commit r335558. llvm-svn: 338968
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338293
* [MC] Add support for the .rva assembler directive for COFF targetsMartin Storsjo2018-07-261-0/+33
| | | | | | | | | | | | | Even though gas doesn't document it, it has been supported there for a very long time. This produces the 32 bit relative virtual address (aka image relative address) for a given symbol. ".rva foo" is essentially equal to ".long foo@imgrel". Differential Revision: https://reviews.llvm.org/D49821 llvm-svn: 338063
* [MC] Fix nested macro body parsingNirav Dave2018-07-181-1/+2
| | | | | | Add missing .rep case in nestlevel checking for macro body parsing. llvm-svn: 337398
* MC: Implement support for new .addrsig and .addrsig_sym directives.Peter Collingbourne2018-07-171-0/+27
| | | | | | | | | Part of the address-significance tables proposal: http://lists.llvm.org/pipermail/llvm-dev/2018-May/123514.html Differential Revision: https://reviews.llvm.org/D47744 llvm-svn: 337328
* [WebAssembly] Remove ELF file support.Sam Clegg2018-07-161-2/+1
| | | | | | | | | This support was partial and temporary. Now that we have wasm object file support its no longer needed. Differential Revision: https://reviews.llvm.org/D48744 llvm-svn: 337222
* [MC] Error on a .zerofill directive in a non-virtual sectionFrancis Visoiu Mistrih2018-07-021-4/+6
| | | | | | | | | | | | | | | On darwin, all virtual sections have zerofill type, and having a .zerofill directive in a non-virtual section is not allowed. Instead of asserting, show a nicer error. In order to use the equivalent of .zerofill in a non-virtual section, the usage of .zero of .space is required. This patch replaces the assert with an error. Differential Revision: https://reviews.llvm.org/D48517 llvm-svn: 336127
* Add an entry for rodata constant merge sections to the defaultEric Christopher2018-07-021-0/+3
| | | | | | | | | | section flags in the ELF assembler. This matches the defaults given in the rest of MC. Fixes PR37997 where we couldn't assemble our own assembly output without warnings. llvm-svn: 336072
* Add a warning if someone attempts to add extra section flags to sectionsEric Christopher2018-06-251-16/+33
| | | | | | with well defined semantics like .rodata. llvm-svn: 335558
* [DWARFv5] Allow ".loc 0" to refer to the root file.Paul Robinson2018-06-221-1/+1
| | | | | | | | | DWARF v5 explicitly represents file #0 in the line table. Prior versions did not, so ".loc 0" is still an error in those cases. Differential Revision: https://reviews.llvm.org/D48452 llvm-svn: 335350
* [DWARF] Warn on and ignore ".file 0" for DWARF v4 and earlier.Paul Robinson2018-06-211-2/+4
| | | | | | | This had been messing with the directory table for prior versions, and also could induce a crash when generating asm output. llvm-svn: 335254
* Remove FIXME comment about WIP.Eric Christopher2018-06-211-1/+0
| | | | | | | This is the only line other than the function signature remaining of the original patch. llvm-svn: 335208
* Remove a redundant initialization. NFCPaul Robinson2018-06-201-1/+1
| | | | llvm-svn: 335143
* [DWARFv5] Tolerate files not all having an MD5 checksum.Paul Robinson2018-06-141-1/+14
| | | | | | | | | | | | | | | | | | In some cases, for example when compiling a preprocessed file, the front-end is not able to provide an MD5 checksum for all files. When that happens, omit the MD5 checksums from the final DWARF, because DWARF doesn't have a way to indicate that some but not all files have a checksum. When assembling a .s file, and some but not all .file directives provide an MD5 checksum, issue a warning and don't emit MD5 into the DWARF. Fixes PR37623. Differential Revision: https://reviews.llvm.org/D48135 llvm-svn: 334710
* [MC] Pass MCSubtargetInfo to fixupNeedsRelaxation and applyFixupPeter Smith2018-06-061-1/+3
| | | | | | | | | | | | | | | | | | On targets like Arm some relaxations may only be performed when certain architectural features are available. As functions can be compiled with differing levels of architectural support we must make a judgement on whether we can relax based on the MCSubtargetInfo for the function. This change passes through the MCSubtargetInfo for the function to fixupNeedsRelaxation so that the decision on whether to relax can be made per function. In this patch, only the ARM backend makes use of this information. We must also pass the MCSubtargetInfo to applyFixup because some fixups skip error checking on the assumption that relaxation has occurred, to prevent code-generation errors applyFixup must see the same MCSubtargetInfo as fixupNeedsRelaxation. Differential Revision: https://reviews.llvm.org/D44928 llvm-svn: 334078
* [MC][X86] Allow assembler variable assignment to register name.Nirav Dave2018-06-052-17/+23
| | | | | | | | | | | | | | | | | | | Summary: Allow extended parsing of variable assembler assignment syntax and modify X86 to permit VAR = register assignment. As we emit these as .set directives when possible, we inline such expressions in output assembly. Fixes PR37425. Reviewers: rnk, void, echristo Reviewed By: rnk Subscribers: nickdesaulniers, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D47545 llvm-svn: 334022
* [MC] Add assembler support for .cg_profile.Michael J. Spencer2018-06-021-0/+45
| | | | | | | | | | | | | | | Object FIle Representation At codegen time this is emitted into the ELF file a pair of symbol indices and a weight. In assembly it looks like: .cg_profile a, b, 32 .cg_profile freq, a, 11 .cg_profile freq, b, 20 When writing an ELF file these are put into a SHT_LLVM_CALL_GRAPH_PROFILE (0x6fff4c02) section as (uint32_t, uint32_t, uint64_t) tuples as (from symbol index, to symbol index, weight). Differential Revision: https://reviews.llvm.org/D44965 llvm-svn: 333823
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-012-40/+40
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* [MC] Change AsmParser to leverage Assembler during evaluationNirav Dave2018-04-301-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Teach AsmParser to check with Assembler for when evaluating constant expressions. This improves the handing of preprocessor expressions that must be resolved at parse time. This idiom can be found as assembling-time assertion checks in source-level assemblers. Note that this relies on the MCStreamer to keep sufficient tabs on Section / Fragment information which the MCAsmStreamer does not. As a result the textual output may fail where the equivalent object generation would pass. This can most easily be resolved by folding the MCAsmStreamer and MCObjectStreamer together which is planned for in a separate patch. Currently, this feature is only enabled for assembly input, keeping IR compilation consistent between assembly and object generation. Reviewers: echristo, rnk, probinson, espindola, peter.smith Reviewed By: peter.smith Subscribers: eraman, peter.smith, arichardson, jyknight, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45164 llvm-svn: 331218
* IWYU for llvm-config.h in llvm, additions.Nico Weber2018-04-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See r331124 for how I made a list of files missing the include. I then ran this Python script: for f in open('filelist.txt'): f = f.strip() fl = open(f).readlines() found = False for i in xrange(len(fl)): p = '#include "llvm/' if not fl[i].startswith(p): continue if fl[i][len(p):] > 'Config': fl.insert(i, '#include "llvm/Config/llvm-config.h"\n') found = True break if not found: print 'not found', f else: open(f, 'w').write(''.join(fl)) and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p` and tried to fix include ordering and whatnot. No intended behavior change. llvm-svn: 331184
* [MC] Undo spurious commit added into r331052.Nirav Dave2018-04-271-10/+7
| | | | llvm-svn: 331055
* [MC] Provide default value for IsResolved.Nirav Dave2018-04-271-7/+10
| | | | llvm-svn: 331052
* Reflow formatting after previous NFC commit.Eric Christopher2018-04-241-6/+6
| | | | llvm-svn: 330676
OpenPOWER on IntegriCloud