llvm-project/mlir/tools/mlir-tblgen
Michal Terepeta 54c9984207 [mlir][Python] Fix generation of accessors for Optional
Previously, in case there was only one `Optional` operand/result within
the list, we would always return `None` from the accessor, e.g., for a
single optional result we would generate:

```
return self.operation.results[0] if len(self.operation.results) > 1 else None
```

But what we really want is to return `None` only if the length of
`results` is smaller than the total number of element groups (i.e.,
the optional operand/result is in fact missing).

This commit also renames a few local variables in the generator to make
the distinction between `isVariadic()` and `isVariableLength()` a bit
more clear.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D113855
2021-11-18 09:42:57 +01:00
..
AttrOrTypeDefGen.cpp Use base class AsmParser/AsmPrinter in Types and Attribute print/parse method (NFC) 2021-11-11 06:26:33 +00:00
AttrOrTypeFormatGen.cpp Use base class AsmParser/AsmPrinter in Types and Attribute print/parse method (NFC) 2021-11-11 06:26:33 +00:00
AttrOrTypeFormatGen.h [MLIR] Attribute and type formats in ODS 2021-11-08 17:38:28 +00:00
CMakeLists.txt [MLIR] Attribute and type formats in ODS 2021-11-08 17:38:28 +00:00
CodeGenHelpers.cpp [mlir][ods] Fix unused uniqued attr constraint 2021-11-14 23:23:14 +00:00
DialectGen.cpp [mlir][ods] Cleanup of Class Codegen helper 2021-11-12 21:22:01 +00:00
DirectiveCommonGen.cpp [mlir][openacc] Use TableGen information for default enum 2021-01-12 09:42:42 -05:00
DocGenUtilities.h Mass update the MLIR license header to mention "Part of the LLVM project" 2020-01-26 03:58:30 +00:00
EnumsGen.cpp [mlir][ODS] Support specialized Attribute class for Enums 2021-03-17 16:44:24 +03:00
FormatGen.cpp [MLIR] Attribute and type formats in ODS 2021-11-08 17:38:28 +00:00
FormatGen.h [MLIR] Attribute and type formats in ODS 2021-11-08 17:38:28 +00:00
LLVMIRConversionGen.cpp [mlir] generate enum translation functions with unused attribute 2021-02-18 09:44:40 +01:00
LLVMIRIntrinsicGen.cpp Support alias.scope and noalias metadata lowering on intrinsics. 2021-09-01 16:54:20 +00:00
OpDefinitionsGen.cpp [mlir] Convert NamedAttribute to be a class 2021-11-18 05:39:29 +00:00
OpDocGen.cpp [mlir] Fix unused variable waraning in OpDocGen 2021-11-10 18:19:09 -08:00
OpFormatGen.cpp [mlir][ods] Fix incorrect name in comment (NFC) 2021-11-13 20:06:48 +00:00
OpFormatGen.h [mlir] Add initial support for parsing a declarative operation assembly format 2020-01-30 11:43:40 -08:00
OpGenHelpers.cpp [mlir] Hoist out getRequestedOpDefinitions helper 2021-04-06 12:53:28 -07:00
OpGenHelpers.h [mlir] Hoist out getRequestedOpDefinitions helper 2021-04-06 12:53:28 -07:00
OpInterfacesGen.cpp [mlir] Improve description of interface options 2021-07-22 19:35:56 +02:00
OpPythonBindingGen.cpp [mlir][Python] Fix generation of accessors for Optional 2021-11-18 09:42:57 +01:00
PassCAPIGen.cpp Add basic Python bindings for the PassManager and bind libTransforms 2020-11-10 19:55:21 +00:00
PassDocGen.cpp [mlir][Pass] Update the PassGen to generate base classes instead of utilities 2020-04-07 14:08:52 -07:00
PassGen.cpp [mlir][ODS] Fix copy ctor for generate Pass classes 2021-06-21 14:07:31 +03:00
RewriterGen.cpp [mlir][NFC] Replace references to Identifier with StringAttr 2021-11-16 17:36:26 +00:00
SPIRVUtilsGen.cpp [mlir] Convert NamedAttribute to be a class 2021-11-18 05:39:29 +00:00
StructsGen.cpp [mlir][NFC] Replace references to Identifier with StringAttr 2021-11-16 17:36:26 +00:00
mlir-tblgen.cpp Mass update the MLIR license header to mention "Part of the LLVM project" 2020-01-26 03:58:30 +00:00