summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* Better error location reporting for non-affine expressions.Uday Bondhugula2019-03-291-21/+27
| | | | | | | | | | | | | | | | | Pass op token location where necessary so that errors on non-affine expressions are reported with accurate/meaningful location pointers. Before: /tmp/parser-affine-map-single.mlir:2:39: error: non-affine expression: at least one of the multiply operands has to be either a constant or symbolic #hello_world = (i, j) [s0, s1] -> (i*j, j) ^ After: /tmp/parser-affine-map-single.mlir:2:37: error: non-affine expression: at least one of the multiply operands has to be either a constant or symbolic #hello_world = (i, j) [s0, s1] -> (i*j, j) ^ PiperOrigin-RevId: 205458508
* Teach the asmprinter to print out operands for OperationInst's. ThisChris Lattner2019-03-291-5/+3
| | | | | | | | | | is still limited in several ways, which i'll build out in subsequent patches. Rename the accessor for inst operands/results to make the Operand/Result versions of these more obscure, allowing getOperand/getResult to traffic in values (which is what - by far - most clients actually care about). PiperOrigin-RevId: 205408439
* Simplify affine binary op expression class hierarchyUday Bondhugula2019-03-291-1/+2
| | | | | | | | | | | | | | | - Drop sub-classing of affine binary op expressions. - Drop affine expr op kind sub. Represent it as multiply by -1 and add. This will also be in line with the math form when we'll need to represent a system of linear equalities/inequalities: the negative number goes into the coefficient of an affine form. (For eg. x_1 + (-1)*x_2 + 3*x_3 + (-2) >= 0). The folding simplification will transparently deal with multiplying the -1 with any other constants. This also means we won't need to simplify a multiply expression like in x_1 + (-2)*x_2 to a subtract expression (x_1 - 2*x_2) for canonicalization/uniquing. - When we print the IR, we will still pretty print to a subtract when possible. PiperOrigin-RevId: 205298958
* Rename isSymbolic to isSymbolicOrConstant to avoid confusion.Uday Bondhugula2019-03-291-4/+4
| | | | PiperOrigin-RevId: 205288794
* Parse ML function arguments, return statement operands, and for statement ↵Tatiana Shpeisman2019-03-293-22/+123
| | | | | | | | loop header. Loop bounds and presumed to be constants for now and are stored in ForStmt as affine constant expressions. ML function arguments, return statement operands and loop variable name are dropped for now. PiperOrigin-RevId: 205256208
* Add basic parser support for operands:Chris Lattner2019-03-291-62/+169
| | | | | | | | | | | - This introduces a new FunctionParser base class to handle logic common between the kinds of functions we have, e.g. ssa operand/def parsing. - This introduces a basic symbol table (without support for forward references!) and links defs and uses. - CFG functions now parse and build operand lists for operations. The printer isn't set up for them yet tho. PiperOrigin-RevId: 205246110
* Support for AffineMapAttr.MLIR Team2019-03-291-0/+5
| | | | PiperOrigin-RevId: 205157390
* Initial support for operands and results and SSA constructs, first onChris Lattner2019-03-291-5/+17
| | | | | | | | | | | the instruction side of the house. This has a number of limitations, including that we are still dropping operands on the floor in the parser. Also, most of the convenience methods aren't wired up yet. This is enough to get result type lists round tripping through. PiperOrigin-RevId: 205148223
* Adds ModuleState to support printing outlined AffineMaps.MLIR Team2019-03-291-1/+0
| | | | PiperOrigin-RevId: 204999887
* Parse operations in ML functions. Add builder class for ML functions.Tatiana Shpeisman2019-03-291-131/+151
| | | | | | | Refactors operation parsing to share functionality between CFG and ML functions. ML function construction now goes through a builder, similar to the way it is done for CFG functions. PiperOrigin-RevId: 204779279
* Adds MemRef type and adds support for parsing memref affine map composition.MLIR Team2019-03-291-9/+61
| | | | PiperOrigin-RevId: 204756982
* Switch the comment syntax from ; to // comments as discussed on Friday. ThereChris Lattner2019-03-291-1/+9
| | | | | | | is no strong reason to prefer one or the other, but // is nice for consistency given the rest of the compiler is written in C++. PiperOrigin-RevId: 204628476
* Refactor implementation of Statement class heirarchy to use statement block.Tatiana Shpeisman2019-03-291-35/+50
| | | | | | Use LLVM double-link with parent list to store statements within a block. PiperOrigin-RevId: 204515541
* Comment fixes for affine map range size parsing.Uday Bondhugula2019-03-291-2/+3
| | | | PiperOrigin-RevId: 204399402
* Parse affine map range sizes.Uday Bondhugula2019-03-292-2/+46
| | | | PiperOrigin-RevId: 204240947
* Remove const reference to errorReporter.Jacques Pienaar2019-03-293-12/+10
| | | | | | Fixes use-after-free ASAN failure. PiperOrigin-RevId: 204177796
* Fix setting errorReporter.Jacques Pienaar2019-03-291-1/+1
| | | | | | Previously the errorReporter was incorrectly moved post creating the Lexer. PiperOrigin-RevId: 204077155
* Add attributes and affine expr/map to the Builder, switch the parser over toChris Lattner2019-03-291-21/+20
| | | | | | | | | | use it. This also removes "operand" from the affine expr classes: it is unnecessary verbosity and "operand" will mean something very specific for SSA stuff (we will have an Operand type). PiperOrigin-RevId: 203976504
* Finish refactoring the parser into subunits, creating a ModuleParserChris Lattner2019-03-291-305/+303
| | | | | | | | and AffineMapParser to localize the parsing productions that only make sense at the top level of a module, and within an affine map, respectively. NFC. PiperOrigin-RevId: 203966841
* Refactor the parser a bit to split out the pieces that need their own localChris Lattner2019-03-291-140/+203
| | | | | | | | | | | | | | | | | state into their own specialized parser subclasses. This is important, because a monolithic parser grows very large very quickly and we're already getting big. Doing this requires splitting mutable parser state out from Parser to its own ParserState class or into transient subclasses like CFGParser. This works better than having things like CFGFuncParserState which gets passed around everywhere, because we can put the parser methods on the new classes. This patch just does CFGFunc and MLFunc, but I'll follow up with AffineMaps (unless someone else wants to take it). PiperOrigin-RevId: 203871695
* AffineMap/AffineExpr: delete copy constructor/assignment, refactorUday Bondhugula2019-03-291-27/+20
| | | | | | | | affine expr parsing. - also make error messages uniform PiperOrigin-RevId: 203822686
* Complete affine expr parsing supportUday Bondhugula2019-03-291-233/+243
| | | | | | | | | | - check for non-affine expressions - handle negative numbers and negation of id's, expressions - functions to check if a map is pure affine or semi-affine - simplify/clean up affine map parsing code - report more errors messages, more accurate error messages PiperOrigin-RevId: 203773633
* Introduce the start of IR builder APIs, which makes it easier and less errorChris Lattner2019-03-291-61/+55
| | | | | | prone to create things. PiperOrigin-RevId: 203703229
* Add basic lexing and parsing support for SSA operands and definitions. ThisChris Lattner2019-03-294-21/+117
| | | | | | | isn't actually constructing IR objects yet, it is eating the tokens and discarding them. PiperOrigin-RevId: 203616265
* Change to assert(0,x) to llvm_unreachable(x)Jacques Pienaar2019-03-291-1/+1
| | | | | | | This avoids fall-through error in opt mode: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] PiperOrigin-RevId: 203616256
* Implement a simple IR verifier, including support for custom ops adding theirChris Lattner2019-03-291-4/+20
| | | | | | own requirements. PiperOrigin-RevId: 203497491
* Implement Uday's suggestion to unique attribute lists across instructions,Chris Lattner2019-03-291-1/+1
| | | | | | | | | reducing the memory impact on Operation to one word instead of 3 from an std::vector. Implement Jacques' suggestion to merge OpImpl::Storage into OpImpl::Base. PiperOrigin-RevId: 203426518
* Add parsing for attributes and attibutes on operations. Add IR representationChris Lattner2019-03-294-35/+174
| | | | | | | for attributes on operations. Split Operation out from OperationInst so it can be shared with OperationStmt one day. PiperOrigin-RevId: 203325366
* Parsing support for affine maps and affine expressionsUday Bondhugula2019-03-293-161/+431
| | | | | | | | A recursive descent parser for affine maps/expressions with operator precedence and associativity. (While on this, sketch out uniqui'ing functionality for affine maps and affine binary op expressions (partly).) PiperOrigin-RevId: 203222063
* Basic representation and parsing of if and for statements. Loop headers and ↵Tatiana Shpeisman2019-03-292-7/+93
| | | | | | if statement conditions are not yet supported. PiperOrigin-RevId: 203211526
* Add default error reporter for parser.Jacques Pienaar2019-03-291-9/+13
| | | | | | Add a default error reporter for the parser that uses the SourceManager to print the error. Also and OptResult enum (mirroring ParseResult) to make the behavior self-documenting. PiperOrigin-RevId: 203173647
* Improve management of instructions and basic blocks by having their inclusionChris Lattner2019-03-291-39/+26
| | | | | | | in a container automatically maintain their parent pointers, and change storage from std::vector to the proper llvm::iplist type. PiperOrigin-RevId: 202889037
* Enhance the type system to support arbitrary precision integers, which areChris Lattner2019-03-295-34/+43
| | | | | | | | | important for low-bitwidth inference cases and hardware synthesis targets. Rename 'int' to 'affineint' to avoid confusion between "the integers" and "the int type". PiperOrigin-RevId: 202751508
* [WIP] Sketching IR and parsing support for affine maps, affine expressionsUday Bondhugula2019-03-295-12/+265
| | | | | | | | | | | Run test case: $ mlir-opt test/IR/parser-affine-map.mlir test/IR/parser-affine-map.mlir:3:30: error: expect '(' at start of map range #hello_world2 (i, j) [s0] -> i+s0, j) ^ PiperOrigin-RevId: 202736856
* Refactor information about tokens out into a new TokenKinds.def file. Use thisChris Lattner2019-03-296-80/+146
| | | | | | | | to share code a bit more, and fixes a diagnostic bug Uday pointed out where parseCommaSeparatedList would print the wrong diagnostic when the end signifier was not a ). PiperOrigin-RevId: 202676858
* Sketch out parser/IR support for OperationInst, and a new Instruction baseChris Lattner2019-03-295-22/+104
| | | | | | | | | | class. Introduce an Identifier class to MLIRContext to represent uniqued identifiers, introduce string literal support to the lexer, introducing parser and printer support etc. PiperOrigin-RevId: 202592007
* Introduce IR and parser support for ML functions.Tatiana Shpeisman2019-03-291-2/+61
| | | | | | | Representing function arguments is still TODO. Supporting instructions other than return is also TODO. PiperOrigin-RevId: 202570934
* Add some scaffolding for parsing affine maps:MLIR Team2019-03-294-0/+72
| | | | | | | | - parsing affine map identifiers - place-holder classes for AffineMap - module contains a list of affine maps (defined at the top level). PiperOrigin-RevId: 202336919
* Change Lexer and Parser to take diagnostic reporter function.Jacques Pienaar2019-03-293-21/+25
| | | | | | Add diagnostic reporter function to lexer/parser and use that from mlir-opt to report errors instead of having the lexer/parser print the errors. PiperOrigin-RevId: 201892004
* Add the unconditional branch instruction, improve diagnostics for blockChris Lattner2019-03-293-23/+80
| | | | | | references. PiperOrigin-RevId: 201872745
* Add tensor type.MLIR Team2019-03-291-3/+4
| | | | PiperOrigin-RevId: 201830793
* Implement parser/IR support for CFG functions, basic blocks and return ↵Chris Lattner2019-03-293-11/+137
| | | | | | | | | | instruction. This is pretty much minimal scaffolding for this step. Basic block arguments, instructions, other terminators, a proper IR representation for blocks/instructions, etc are all coming. PiperOrigin-RevId: 201826439
* Introduce IR support for MLIRContext, primitive types, function types, andChris Lattner2019-03-291-85/+97
| | | | | | | | | vector types. tensors and memref types are still TODO, and would be a good starter project for someone. PiperOrigin-RevId: 201782748
* Implement parser and lexer support for most of the type grammar.Chris Lattner2019-03-295-8/+446
| | | | | | | | Semi-affine maps and address spaces are not yet supported (someone want to take this on?). We also don't generate IR objects for types yet, which I plan to tackle next. PiperOrigin-RevId: 201754283
* Implement enough of a lexer and parser for MLIR to parse extfunc's withoutChris Lattner2019-03-295-0/+523
arguments. PiperOrigin-RevId: 201706570
OpenPOWER on IntegriCloud