summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is ↵River Riddle2020-01-111-36/+36
| | | | | | | | | | properly value-typed. Summary: These were temporary methods used to simplify the transition. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D72548
* NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.River Riddle2019-12-231-15/+15
| | | | | | ValuePtr was a temporary typedef during the transition to a value-typed Value. PiperOrigin-RevId: 286945714
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-231-13/+4
| | | | PiperOrigin-RevId: 286906740
* NFC: Introduce new ValuePtr/ValueRef typedefs to simplify the transition to ↵River Riddle2019-12-221-13/+13
| | | | | | | | | | Value being value-typed. This is an initial step to refactoring the representation of OpResult as proposed in: https://groups.google.com/a/tensorflow.org/g/mlir/c/XXzzKhqqF_0/m/v6bKb08WCgAJ This change will make it much simpler to incrementally transition all of the existing code to use value-typed semantics. PiperOrigin-RevId: 286844725
* LLVMFuncOp: implement addEntryBlockAlex Zinenko2019-12-191-1/+15
| | | | | | | | | This function has been declared as a part of the LLVMFuncOp interface but never implemented. Closes tensorflow/mlir#325. PiperOrigin-RevId: 286439619
* NFC: Remove unnecessary 'llvm::' prefix from uses of llvm symbols declared ↵River Riddle2019-12-181-2/+2
| | | | | | | | in `mlir` namespace. Aside from being cleaner, this also makes the codebase more consistent. PiperOrigin-RevId: 286206974
* Replace code with equivalent satisfiesLLVMModule() function call.Tres Popp2019-12-171-3/+1
| | | | | | This is a general code cleanup and should be a NFC. PiperOrigin-RevId: 285972718
* Remove LLVM dependency on mlir::Module and instead check Traits.Tres Popp2019-12-161-3/+13
| | | | PiperOrigin-RevId: 285724678
* NFC: Cleanup the various Op::print methods.River Riddle2019-12-121-11/+5
| | | | | | This cleans up the implementation of the various operation print methods. This is done via a combination of code cleanup, adding new streaming methods to the printer(e.g. operand ranges), etc. PiperOrigin-RevId: 285285181
* LLVM::GlobalOp: take address space as builder argumentAlex Zinenko2019-12-061-1/+4
| | | | | | | | | Accept the address space of the global as a builder argument when constructing an LLVM::GlobalOp instance. This decreases the reliance of LLVM::GlobalOp users on the internal name of the attribute used for this purpose. Update several uses of the address space in GPU to NVVM conversion. PiperOrigin-RevId: 284233254
* LLVM::AddressOfOp: properly take into account the address spaceAlex Zinenko2019-12-061-1/+2
| | | | | | | | | | The AddressOf operation in the LLVM dialect return a pointer to a global variable. The latter may be in a non-default address space as indicated by the "addr_space" attribute. Check that the address space of the pointer returned by AddressOfOp matches that of the referenced GlobalOp. Update the AddressOfOp builder to respect this constraint. PiperOrigin-RevId: 284138860
* Add linkage support to LLVMFuncOpAlex Zinenko2019-12-031-41/+125
| | | | | | | | | A recent commit introduced the Linkage attribute to the LLVM dialect and used it in the Global Op. Also use it in LLVMFuncOp. As per LLVM Language Reference, if the linkage attribute is omitted, the function is assumed to have external linkage. PiperOrigin-RevId: 283493299
* Introduce Linkage attribute to the LLVM dialectAlex Zinenko2019-12-021-7/+87
| | | | | | | | | | | LLVM IR supports linkage on global objects such as global variables and functions. Introduce the Linkage attribute into the LLVM dialect, backed by an integer storage. Use this attribute on LLVM::GlobalOp and make it mandatory. Implement parsing/printing of the attribute and conversion to LLVM IR. See tensorflow/mlir#277. PiperOrigin-RevId: 283309328
* Split out FunctionLike printing/parsing into FunctionImplementation.{h,cpp}Alex Zinenko2019-11-281-0/+1
| | | | | | | | | | | Helper utilies for parsing and printing FunctionLike Ops are only relevant to the implementation of the Op, not its definition. They depend on OpImplementation.h and increase the inclusion footprint of FunctionSupport.h, and do so only to provide some utilities in the "impl" namespace. Move them to a separate files, similarly to OpDefinition/OpImplementation distinction, and make only Op implementations use them while keeping headers cleaner. NFC. PiperOrigin-RevId: 282964556
* Allow LLVM::ExtractElementOp to have non-i32 indices.MLIR Team2019-11-251-17/+14
| | | | | | Also change the text format a bit, so that indices are braced by squares. PiperOrigin-RevId: 282437095
* [llvm] Allow GlobalOp to take a region for complex initializersJames Molloy2019-11-051-1/+23
| | | | | | | | | | | | | | | This allows GlobalOp to either take a value attribute (for simple constants) or a region that can contain IR instructions (that must be constant-foldable) to create a ConstantExpr initializer. Example: // A complex initializer is constructed with an initializer region. llvm.mlir.global constant @int_gep() : !llvm<"i32*"> { %0 = llvm.mlir.addressof @g2 : !llvm<"i32*"> %1 = llvm.mlir.constant(2 : i32) : !llvm.i32 %2 = llvm.getelementptr %0[%1] : (!llvm<"i32*">, !llvm.i32) -> !llvm<"i32*"> llvm.return %2 : !llvm<"i32*"> } PiperOrigin-RevId: 278717836
* NFC: Rename parseOptionalAttributeDict -> parseOptionalAttrDict to match the ↵River Riddle2019-11-051-24/+22
| | | | | | name of the print method. PiperOrigin-RevId: 278696668
* Remove the need for passing a location to parseAttribute/parseType.River Riddle2019-11-011-2/+3
| | | | | | | | Now that a proper parser is passed to these methods, there isn't a need to explicitly pass a source location. The source location can be recovered from the parser as necessary. This removes the need to explicitly decode an SMLoc in the case where we don't need to, which can be expensive. This requires adding some basic nesting support to the parser for supporting nested parsers to allow for remapping source locations of the nested parsers to the top level parser for accurate diagnostics. This is due to the fact that the attribute and type parsers use different source buffers than the top level parser, as they may be represented in string form. PiperOrigin-RevId: 278014858
* Add DialectAsmParser/Printer classes to simplify dialect attribute and type ↵River Riddle2019-11-011-3/+6
| | | | | | | | | | | | | | parsing. These classes are functionally similar to the OpAsmParser/Printer classes and provide hooks for parsing attributes/tokens/types/etc. This change merely sets up the base infrastructure and updates the parser hooks, followups will add hooks as needed to simplify existing handrolled dialect parsers. This has various different benefits: *) Attribute/Type parsing is much simpler to define. *) Dialect attributes/types that contain other attributes/types can now use aliases. *) It provides a 'spec' with which we may use in the future to auto-generate parsers/printers. *) Error messages emitted by attribute/type parsers can provide character exact locations rather than "beginning of the string" PiperOrigin-RevId: 278005322
* Fix minor spelling tweaks (NFC)Kazuaki Ishizaki2019-10-201-3/+3
| | | | | | Closes tensorflow/mlir#177 PiperOrigin-RevId: 275692653
* Get active source lane predicate from shuffle instruction.Christian Sigg2019-10-191-0/+3
| | | | | | | | nvvm.shfl.sync.bfly optionally returns a predicate whether source lane was active. Support for this was added to clang in https://reviews.llvm.org/D68892. Add an optional 'pred' unit attribute to the instruction to return this predicate. Specify this attribute in the partial warp reduction so we don't need to manually compute the predicate. PiperOrigin-RevId: 275616564
* Add support for function result attributes.Sean Silva2019-10-181-0/+15
| | | | | | | | | | | | | | | | | | | | | | This allows dialect-specific attributes to be attached to func results. (or more specifically, FunctionLike ops). For example: ``` func @f() -> (i32 {my_dialect.some_attr = 3}) ``` This attaches my_dialect.some_attr with value 3 to the first result of func @f. Another more complex example: ``` func @g() -> (i32, f32 {my_dialect.some_attr = "foo", other_dialect.some_other_attr = [1,2,3]}, i1) ``` Here, the second result has two attributes attached. PiperOrigin-RevId: 275564165
* NFC: Remove trivial builder get methods.River Riddle2019-10-171-3/+3
| | | | | | These don't add any value, and some are even more restrictive than the respective static 'get' method. PiperOrigin-RevId: 275391240
* Add LLVM IR dialect hooks for FP128 and X86_FP80 typesEric Schweitz2019-10-111-1/+10
| | | | | | | Closes tensorflow/mlir#184 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/184 from schweitzpgi:more-float-types ca27d00510a86ffc9c79c65fb3a0193b5ea097a0 PiperOrigin-RevId: 274288813
* LLVM Dialect: introduce llvm.mlir.null operationAlex Zinenko2019-10-111-0/+27
| | | | | | | | Similarly to `llvm.mlir.undef`, this auxiliary operation creates an SSA value that corresponds to `null` in LLVM IR. This operation is necessary to model sizeof(<...>) behavior when allocating memory. PiperOrigin-RevId: 274158760
* Add support for parsing/printing non bare-identifier SymbolRefs.River Riddle2019-10-081-2/+3
| | | | | | The restriction that symbols can only have identifier names is arbitrary, and artificially limits the names that a symbol may have. This change adds support for parsing and printing symbols that don't fit in the 'bare-identifier' grammar by printing the reference in quotes, e.g. @"0_my_reference" can now be used as a symbol name. PiperOrigin-RevId: 273644768
* Allow null Attribute for value when building GlobalOp.Christian Sigg2019-09-241-1/+2
| | | | PiperOrigin-RevId: 270853596
* Make GlobalOp's value attribute optional.Christian Sigg2019-09-211-11/+19
| | | | | | Make GlobalOp's value attribute an OptionalAttr. Change code that uses the value to handle 'nullopt'. Translate an unitialized value attribute to llvm::UndefValue. PiperOrigin-RevId: 270423646
* NFC: Pass OpAsmPrinter by reference instead of by pointer.River Riddle2019-09-201-103/+103
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270401378
* NFC: Pass OperationState by reference instead of by pointer.River Riddle2019-09-201-107/+107
| | | | | | MLIR follows the LLVM convention of passing by reference instead of by pointer. PiperOrigin-RevId: 270396945
* NFC: Pass OpAsmParser by reference instead of by pointer.River Riddle2019-09-201-182/+180
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270315612
* LLVM dialect: prefix auxiliary operations with "mlir."Alex Zinenko2019-09-031-5/+6
| | | | | | | | | | Some of the operations in the LLVM dialect are required to model the LLVM IR in MLIR, for example "constant" operations are needed to declare a constant value since MLIR, unlike LLVM, does not support immediate values as operands. To avoid confusion with actual LLVM operations, we prefix such axuiliary operations with "mlir.". PiperOrigin-RevId: 266942838
* ConvertLaunchFuncToCudaCalls: use LLVM dialect globalsAlex Zinenko2019-08-201-0/+31
| | | | | | | | | | | | This conversion has been using a stack-allocated array of i8 to store the null-terminated kernel name in order to pass it to the CUDA wrappers expecting a C string because the LLVM dialect was missing support for globals. Now that the suport is introduced, use a global instead. Refactor global string construction from GenerateCubinAccessors into a common utility function living in the LLVM namespace. PiperOrigin-RevId: 264382489
* Add support for LLVM lowering of binary ops on n-D vector typesNicolas Vasilache2019-08-201-0/+5
| | | | | | This CL allows binary operations on n-D vector types to be lowered to LLVMIR by performing an (n-1)-D extractvalue, 1-D vector operation and an (n-1)-D insertvalue. PiperOrigin-RevId: 264339118
* NFC: Move LLVMIR, SDBM, and StandardOps to the Dialect/ directory.River Riddle2019-08-191-0/+1394
PiperOrigin-RevId: 264193915
OpenPOWER on IntegriCloud