summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR/AsmPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement support for predecessor iterators on basic blocks, use them to printChris Lattner2019-03-291-1/+24
| | | | | | out predecessor information in the asmprinter. PiperOrigin-RevId: 206343174
* Add tf_control type and allow $ in bare-id.Jacques Pienaar2019-03-291-0/+3
| | | | | | | * Add tf_control as primitive type; * Allow $ in bare-id to allow attributes with $ (to make it trivially to mangle a TF attribute); PiperOrigin-RevId: 206342642
* Stmt visitors and walkers.Uday Bondhugula2019-03-291-2/+2
| | | | | | | | | | | | | | | | | | - Update InnermostLoopGatherer to use a post order traversal (linear time/single traversal). - Drop getNumNestedLoops(). - Update isInnermost() to use the StmtWalker. When using return values in conjunction with walkers, the StmtWalker CRTP pattern doesn't appear to be of any use. It just requires overriding nearly all of the methods, which is what InnermostLoopGatherer currently does. Please see FIXME/ENLIGHTENME comments. TODO: figure this out from this CL discussion. Note - Comments on visitor/walker base class are out of date; will update when this CL is finalized. PiperOrigin-RevId: 206340901
* Implement MLValue, statement operands, operation statement operands and ↵Tatiana Shpeisman2019-03-291-6/+28
| | | | | | values. ML functions now have full support for expressing operations. Induction variables, function arguments and return values are still todo. PiperOrigin-RevId: 206253643
* Implement a proper function list in module, which auto-maintain the parentChris Lattner2019-03-291-4/+4
| | | | | | | | | pointer, and ensure that functions are deleted when the module is destroyed. This exposed the fact that MLFunction had no dtor, and that the dtor in CFGFunction was broken with cyclic references. Fix both of these problems. PiperOrigin-RevId: 206051666
* Fix FIXME's/TODOs:Chris Lattner2019-03-291-5/+9
| | | | | | | | | | | - Enhance memref type to allow omission of mappings and address spaces (implying a default mapping). - Fix printing of function types to properly recurse with printType so mappings are printed by name. - Simplify parsing of AffineMaps a bit now that we have isSymbolicOrConstant() PiperOrigin-RevId: 206039755
* Expose custom asmprinter support to core operations and have them adopt it,Chris Lattner2019-03-291-47/+74
| | | | | | fixing the printing syntax for dim, constant, fadd, etc. PiperOrigin-RevId: 205908627
* [mlir] Implement conditional branchJames Molloy2019-03-291-2/+35
| | | | | | | | | This looks heavyweight but most of the code is in the massive number of operand accessors! We need to be able to iterate over all operands to the condbr (all live-outs) but also just the true/just the false operands too. PiperOrigin-RevId: 205897704
* [mlir] Fix a use-after-free iterator error found by asanJames Molloy2019-03-291-8/+7
| | | | | | | | While fixing this the parser-affine-map.mlir test started failing due to ordering of the printed affine maps. Even the existing CHECK-DAGs weren't enough to disambiguate; a partial match on one line precluded a total match on a following line. The fix for this was easy - print the affine maps in reference order rather than in DenseMap iteration order. PiperOrigin-RevId: 205843770
* [mlir] clang-formatJames Molloy2019-03-291-11/+11
| | | | | | Mostly whitespace changes, but this makes these files clang-format clean. PiperOrigin-RevId: 205697599
* Implement support for branch instruction operands.Chris Lattner2019-03-291-0/+14
| | | | PiperOrigin-RevId: 205666777
* Implement generic operand/result iterators that map through our implementationChris Lattner2019-03-291-39/+20
| | | | | | | | | details, returning things in terms of values (which is what most clients want). Implement support for operands and results on Operation, and simplify the asmprinter to use it. PiperOrigin-RevId: 205608853
* [mlir] Add basic block argumentsJames Molloy2019-03-291-5/+17
| | | | | | | | This patch adds support for basic block arguments including parsing and printing. In doing so noticed that `ssa-id-and-type` is undefined in the MLIR spec; suggested an implementation in the spec doc. PiperOrigin-RevId: 205593369
* Add support for operands to the return instructions, enhance verifier to ↵Chris Lattner2019-03-291-1/+13
| | | | | | report errors through the diagnostics system when invoked by the parser. It doesn't have perfect location info, but it is close enough to be testable. PiperOrigin-RevId: 205534392
* Add support for multiple results to the printer/parser, add supportChris Lattner2019-03-291-8/+24
| | | | | | | for forward references to the parser, add initial support for SSA use-list iteration and RAUW. PiperOrigin-RevId: 205484031
* Refactor the AsmParser to follow the pattern established in the parser:Chris Lattner2019-03-291-270/+274
| | | | | | | | | | | | there is now an explicit state class - which only has one instance per top level FooThing::print call. The FunctionPrinter's now subclass ModulePrinter so they can just call print on their types and other global stuff. This also makes the contract strict that the global FooThing::print calls are the public entrypoints and that the printer implementation is otherwise self contained. No Functionality Change. PiperOrigin-RevId: 205409317
* Teach the asmprinter to print out operands for OperationInst's. ThisChris Lattner2019-03-291-51/+104
| | | | | | | | | | 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-29/+47
| | | | | | | | | | | | | | | - 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
* Parse ML function arguments, return statement operands, and for statement ↵Tatiana Shpeisman2019-03-291-1/+6
| | | | | | | | 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-0/+2
| | | | | | | | | | | - 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-12/+85
| | | | PiperOrigin-RevId: 205157390
* Initial support for operands and results and SSA constructs, first onChris Lattner2019-03-291-1/+25
| | | | | | | | | | | 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
* Address AsmPrinter changes from last CL.MLIR Team2019-03-291-120/+95
| | | | PiperOrigin-RevId: 205096519
* Adds ModuleState to support printing outlined AffineMaps.MLIR Team2019-03-291-30/+297
| | | | PiperOrigin-RevId: 204999887
* Parse operations in ML functions. Add builder class for ML functions.Tatiana Shpeisman2019-03-291-4/+3
| | | | | | | 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-3/+6
| | | | PiperOrigin-RevId: 204756982
* Move newline printed with op to function/basic block printer.Jacques Pienaar2019-03-291-6/+11
| | | | | | Allows printing the instruction to string without trailing newline. Making it easier to reuse print to annotate instructions during lowering. And removes need for newline in the print functions of ops. PiperOrigin-RevId: 204630791
* Refactor implementation of Statement class heirarchy to use statement block.Tatiana Shpeisman2019-03-291-35/+29
| | | | | | Use LLVM double-link with parent list to store statements within a block. PiperOrigin-RevId: 204515541
* Parse affine map range sizes.Uday Bondhugula2019-03-291-0/+11
| | | | PiperOrigin-RevId: 204240947
* Add attributes and affine expr/map to the Builder, switch the parser over toChris Lattner2019-03-291-6/+6
| | | | | | | | | | 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
* Implement OperationStmt. Refactor function printing to use FunctionState ↵Tatiana Shpeisman2019-03-291-30/+53
| | | | | | class for operation printing. FunctionState class is a base class for CFGFunctionState and MLFunctionState classes. No parsing yet - will add once cl/203785893 is in. PiperOrigin-RevId: 203862427
* Complete affine expr parsing supportUday Bondhugula2019-03-291-3/+2
| | | | | | | | | | - 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
* 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
* Add the ability to have "Ops" defined as small C++ classes, with some niceChris Lattner2019-03-291-1/+12
| | | | | | | | | | | | | | | | | properties: - They allow type checked dynamic casting from their base Operation. - They allow nice accessors for C++ clients, e.g. a "getIndex()" method on 'dim' that returns an unsigned. - They work with both OperationInst/OperationStmt (once OperationStmt is implemented). - They get custom printing logic. They will eventually get custom parsing, verifier, and builder logic as well. - Out of tree clients can register their own operation set without having to change MLIR core, e.g. for TensorFlow or custom target instructions. This registers addf and dim as examples. PiperOrigin-RevId: 203382993
* Add parsing for attributes and attibutes on operations. Add IR representationChris Lattner2019-03-291-1/+21
| | | | | | | 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-291-5/+89
| | | | | | | | 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-291-13/+94
| | | | | | if statement conditions are not yet supported. PiperOrigin-RevId: 203211526
* Improve management of instructions and basic blocks by having their inclusionChris Lattner2019-03-291-7/+7
| | | | | | | in a container automatically maintain their parent pointers, and change storage from std::vector to the proper llvm::iplist type. PiperOrigin-RevId: 202889037
* [WIP] Sketching IR and parsing support for affine maps, affine expressionsUday Bondhugula2019-03-291-1/+14
| | | | | | | | | | | 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
* Sketch out parser/IR support for OperationInst, and a new Instruction baseChris Lattner2019-03-291-9/+28
| | | | | | | | | | 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-0/+21
| | | | | | | Representing function arguments is still TODO. Supporting instructions other than return is also TODO. PiperOrigin-RevId: 202570934
* Add the unconditional branch instruction, improve diagnostics for blockChris Lattner2019-03-291-0/+3
| | | | | | references. PiperOrigin-RevId: 201872745
* Implement parser/IR support for CFG functions, basic blocks and return ↵Chris Lattner2019-03-291-0/+175
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
OpenPOWER on IntegriCloud