summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
Commit message (Collapse)AuthorAgeFilesLines
...
* Add missing includes. make_unique proliferated everywhere.Benjamin Kramer2015-03-011-0/+1
| | | | llvm-svn: 230909
* Optimize metadata node fields for CHECK-abilityDuncan P. N. Exon Smith2015-02-281-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While gaining practical experience hand-updating CHECK lines (for moving the new debug info hierarchy into place), I learnt a few things about CHECK-ability of the specialized node assembly output. - The first part of a `CHECK:` is to identify the "right" node (this is especially true if you intend to use the new `CHECK-SAME` feature, since the first CHECK needs to identify the node correctly before you can split the line). - If there's a `tag:`, it should go first. - If there's a `name:`, it should go next (followed by the `linkageName:`, if any). - If there's a `scope:`, it should follow after that. - When a node type supports multiple DW_TAGs, but one is implied by its name and is overwhelmingly more common, the `tag:` field is terribly uninteresting unless it's different. - `MDBasicType` is almost always `DW_TAG_base_type`. - `MDTemplateValueParameter` is almost always `DW_TAG_template_value_parameter`. - Printing `name: ""` doesn't improve CHECK-ability, and there are far more nodes than I realized that are commonly nameless. - There are a few other fields that similarly aren't very interesting when they're empty. This commit updates the `AsmWriter` as suggested above (and makes necessary changes in `LLParser` for round-tripping). llvm-svn: 230877
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-02-271-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | load instruction Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 llvm-svn: 230794
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-02-271-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getelementptr instruction One of several parallel first steps to remove the target type of pointers, replacing them with a single opaque pointer type. This adds an explicit type parameter to the gep instruction so that when the first parameter becomes an opaque pointer type, the type to gep through is still available to the instructions. * This doesn't modify gep operators, only instructions (operators will be handled separately) * Textual IR changes only. Bitcode (including upgrade) and changing the in-memory representation will be in separate changes. * geps of vectors are transformed as: getelementptr <4 x float*> %x, ... ->getelementptr float, <4 x float*> %x, ... Then, once the opaque pointer type is introduced, this will ultimately look like: getelementptr float, <4 x ptr> %x with the unambiguous interpretation that it is a vector of pointers to float. * address spaces remain on the pointer, not the type: getelementptr float addrspace(1)* %x ->getelementptr float, float addrspace(1)* %x Then, eventually: getelementptr float, ptr addrspace(1) %x Importantly, the massive amount of test case churn has been automated by same crappy python code. I had to manually update a few test cases that wouldn't fit the script's model (r228970,r229196,r229197,r229198). The python script just massages stdin and writes the result to stdout, I then wrapped that in a shell script to handle replacing files, then using the usual find+xargs to migrate all the files. update.py: import fileinput import sys import re ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") def conv(match, line): if not match: return line line = match.groups()[0] if len(match.groups()[5]) == 0: line += match.groups()[2] line += match.groups()[3] line += ", " line += match.groups()[1] line += "\n" return line for line in sys.stdin: if line.find("getelementptr ") == line.find("getelementptr inbounds"): if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("): line = conv(re.match(ibrep, line), line) elif line.find("getelementptr ") != line.find("getelementptr ("): line = conv(re.match(normrep, line), line) sys.stdout.write(line) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh After that, check-all (with llvm, clang, clang-tools-extra, lld, compiler-rt, and polly all checked out). The extra 'rm' in the apply.sh script is due to a few files in clang's test suite using interesting unicode stuff that my python script was throwing exceptions on. None of those files needed to be migrated, so it seemed sufficient to ignore those cases. Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7636 llvm-svn: 230786
* AsmParser: Check ConstantExpr insertvalue operands for type correctnessDavid Majnemer2015-02-231-1/+8
| | | | llvm-svn: 230206
* AsmParser: Call instructions can't have an alignmentDavid Majnemer2015-02-231-2/+10
| | | | llvm-svn: 230193
* AsmParser: Check ConstantExpr GEP operands for validityDavid Majnemer2015-02-221-2/+24
| | | | llvm-svn: 230188
* AsmParser/Writer: Handle symbolic constants in DI 'flags:'Duncan P. N. Exon Smith2015-02-213-5/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | Parse (and write) symbolic constants in debug info `flags:` fields. This prevents a readability (and CHECK-ability) regression with the new debug info hierarchy. Old (well, current) assembly, with pretty-printing: !{!"...\\0016387", ...} ; ... [public] [rvalue reference] Flags field without this change: !MDDerivedType(flags: 16387, ...) Flags field with this change: !MDDerivedType(flags: DIFlagPublic | DIFlagRValueReference, ...) As discussed in the review thread, this isn't a final state. Most of these flags correspond to `DW_AT_` symbolic constants, and we might eventually want to support arbitrary attributes in some form. However, as it stands now, some of the flags correspond to other concepts (like `FlagStaticMember`); until things are refactored this is the simplest way to move forward without regressing assembly. llvm-svn: 230111
* AsmParser: Use StringRef for keyword comparisons, NFCDuncan P. N. Exon Smith2015-02-211-10/+9
| | | | | | | | Leverage `StringRef` inside keyword comparison macros. There's no reason to be so low-level here, and I'm about to add another `startswith()` use, so let's make it easy to read. llvm-svn: 230100
* AsmParser: Use do{}while(false) in macros, NFCDuncan P. N. Exon Smith2015-02-201-11/+21
| | | | | | | | | | | | | | `do { ... } while (false)` is standard macro etiquette for forcing instantiations into a single statement and requiring a `;` afterwards, making statement-like macros easier to reason about (and harder to use incorrectly). I'm about to modify the macros in `LexIdentifier()`. I noticed that the `KEYWORD` macro *does* follow the rule, so I thought I'd clean up the other macros to match (otherwise might not be worth changing, since the benefits of this pattern are fairly irrelevant here). llvm-svn: 230095
* IR: Fix MDType fields from unsigned to uint64_tDuncan P. N. Exon Smith2015-02-191-8/+8
| | | | | | | | | When trying to match the current schema with the new debug info hierarchy, I downgraded `SizeInBits`, `AlignInBits` and `OffsetInBits` to 32-bits (oops!). Caught this while testing my upgrade script to move the hierarchy into place. Bump it back up to 64-bits and update tests. llvm-svn: 229933
* IR: Drop scope from MDTemplateParameterDuncan P. N. Exon Smith2015-02-191-10/+6
| | | | | | | | | | Follow-up to r229740, which removed `DITemplate*::getContext()` after my upgrade script revealed that scopes are always `nullptr` for template parameters. This is the other shoe: drop `scope:` from `MDTemplateParameter` and its two subclasses. (Note: a bitcode upgrade would be pointless, since the hierarchy hasn't been moved into place.) llvm-svn: 229791
* IR: Allow MDSubrange to have 'count: -1'Duncan P. N. Exon Smith2015-02-181-1/+1
| | | | | | | | | | | | | | It turns out that `count: -1` is a special value indicating an empty array, such as `Values` in: struct T { unsigned Count; int Values[]; }; Handle it. llvm-svn: 229769
* IR: Swap order of name and value in MDEnumDuncan P. N. Exon Smith2015-02-181-2/+2
| | | | | | | | | Put the name before the value in assembly for `MDEnum`. While working on the testcase upgrade script for the new hierarchy, I noticed that it "looks nicer" to have the name first, since it lines the names up in the (somewhat typical) case that they have a common prefix. llvm-svn: 229747
* AsmParser: extractvalue requires at least one index operandDavid Majnemer2015-02-161-0/+1
| | | | llvm-svn: 229365
* AsmParser: Make sure GlobalVariables have sane typesDavid Majnemer2015-02-161-1/+1
| | | | llvm-svn: 229364
* AsmParser: Reject alloca with function typeDavid Majnemer2015-02-161-4/+4
| | | | llvm-svn: 229363
* AsmWriter/Bitcode: MDImportedEntityDuncan P. N. Exon Smith2015-02-131-1/+16
| | | | llvm-svn: 229025
* AsmWriter/Bitcode: MDObjCPropertyDuncan P. N. Exon Smith2015-02-131-1/+19
| | | | llvm-svn: 229024
* AsmWriter/Bitcode: MDExpressionDuncan P. N. Exon Smith2015-02-133-5/+42
| | | | llvm-svn: 229023
* AsmWriter/Bitcode: MDLocalVariableDuncan P. N. Exon Smith2015-02-131-1/+22
| | | | llvm-svn: 229022
* AsmWriter/Bitcode: MDGlobalVariableDuncan P. N. Exon Smith2015-02-131-1/+25
| | | | llvm-svn: 229020
* AsmWriter/Bitcode: MDTemplate{Type,Value}ParameterDuncan P. N. Exon Smith2015-02-131-2/+31
| | | | llvm-svn: 229019
* AsmWriter/Bitcode: MDNamespaceDuncan P. N. Exon Smith2015-02-131-1/+14
| | | | llvm-svn: 229018
* AsmWriter/Bitcode: MDLexicalBlockFileDuncan P. N. Exon Smith2015-02-131-1/+13
| | | | llvm-svn: 229017
* AsmWriter/Bitcode: MDLexicalBlockDuncan P. N. Exon Smith2015-02-131-1/+14
| | | | llvm-svn: 229016
* AsmWriter: MDSubprogram: Recognize DW_VIRTUALITY in 'virtuality'Duncan P. N. Exon Smith2015-02-133-2/+27
| | | | llvm-svn: 229015
* AsmWriter/Bitcode: MDSubprogramDuncan P. N. Exon Smith2015-02-132-5/+62
| | | | llvm-svn: 229014
* AsmWriter/Bitcode: MDCompileUnitDuncan P. N. Exon Smith2015-02-131-1/+31
| | | | llvm-svn: 229013
* AsmWriter/Bitcode: MDSubroutineTypeDuncan P. N. Exon Smith2015-02-131-1/+8
| | | | llvm-svn: 229011
* AsmWriter: MDCompositeType: Recognize DW_LANG in 'runtimeLang'Duncan P. N. Exon Smith2015-02-133-1/+43
| | | | llvm-svn: 229010
* AsmWriter/Bitcode: MDDerivedType and MDCompositeTypeDuncan P. N. Exon Smith2015-02-131-2/+51
| | | | llvm-svn: 229009
* AsmWriter/Bitcode: MDFileDuncan P. N. Exon Smith2015-02-131-1/+12
| | | | llvm-svn: 229007
* AsmWriter: MDBasicType: Recognize DW_ATE in 'encoding'Duncan P. N. Exon Smith2015-02-133-6/+33
| | | | llvm-svn: 229006
* AsmWriter/Bitcode: MDBasicTypeDuncan P. N. Exon Smith2015-02-131-1/+15
| | | | llvm-svn: 229005
* AsmWriter/Bitcode: MDEnumeratorDuncan P. N. Exon Smith2015-02-131-1/+11
| | | | llvm-svn: 229004
* AsmWriter/Bitcode: MDSubrangeDuncan P. N. Exon Smith2015-02-131-1/+43
| | | | llvm-svn: 229003
* AsmParser: Validate alloca's typeDavid Majnemer2015-02-111-0/+3
| | | | | | An alloca's type should be weird things like metadata. llvm-svn: 228820
* AsmParser: Don't crash when insertvalue has bad operandsDavid Majnemer2015-02-111-1/+6
| | | | llvm-svn: 228813
* AsmParser: Switch some vectors to mapsDavid Majnemer2015-02-112-21/+12
| | | | | | This speeds up parsing .ll files with metadata nodes with large IDs. llvm-svn: 228812
* Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects.Zachary Turner2015-02-111-0/+3
| | | | | | | | | | This allows IDEs to recognize the entire set of header files for each of the core LLVM projects. Differential Revision: http://reviews.llvm.org/D7526 Reviewed By: Chris Bieneman llvm-svn: 228798
* AsmParser: Add stubs for specialized MDNodes, NFCDuncan P. N. Exon Smith2015-02-102-7/+65
| | | | | | Well, the exact error from the failed parse will change, but... llvm-svn: 228644
* IR: Allow 32-bits for lines in debug locationDuncan P. N. Exon Smith2015-02-061-1/+1
| | | | | | | | | | | | Remove unnecessary restriction of 24-bits for line numbers in `MDLocation`. The rest of the debug info schema (with the exception of local variables) uses 32-bits for line numbers. As I introduce the specialized nodes, it makes sense to canonicalize on one size or the other. llvm-svn: 228455
* AsmParser: Use DW_TAG_hi_user instead of magic constant, NFCDuncan P. N. Exon Smith2015-02-061-1/+1
| | | | llvm-svn: 228448
* AsmParser: Split out LineField, NFCDuncan P. N. Exon Smith2015-02-041-2/+17
| | | | | | | Split out `LineField`, which restricts the legal line numbers. This will make it easier to be consistent between different node parsers. llvm-svn: 228226
* Fix GCC error caused by r228211Duncan P. N. Exon Smith2015-02-041-0/+4
| | | | llvm-svn: 228213
* AsmParser: Move MDField details to source file, NFCDuncan P. N. Exon Smith2015-02-042-38/+44
| | | | | | | | Move all the types of `MDField` to an anonymous namespace in the source file. This also eliminates the duplication of `ParseMDField()` declarations in the header for each new field type. llvm-svn: 228211
* AsmParser: Simplify assertion, NFCDuncan P. N. Exon Smith2015-02-041-1/+1
| | | | llvm-svn: 228209
* AsmParser: Remove dead code, NFCDuncan P. N. Exon Smith2015-02-041-4/+0
| | | | | | This condition is checked in the generic `ParseMDField()`. llvm-svn: 228208
* AsmParser: Simplify MDUnsignedFieldDuncan P. N. Exon Smith2015-02-042-17/+14
| | | | | | We only need `uint64_t` for storage. llvm-svn: 228205
OpenPOWER on IntegriCloud