KKazu HirataUse isa instead of dyn_cast (NFC)
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[mlir] Add support for VariadicOfVariadic operands This revision adds native ODS support for VariadicOfVariadic operand groups. An example of this is the SwitchOp, which has a variadic number of nested operand ranges for each of the case statements, where the number of case statements is variadic. Builtin ODS support allows for generating proper accessors for the nested operand ranges, builder support, and declarative format support. VariadicOfVariadic operands are supported by providing a segment attribute to use to store the operand groups, mapping similarly to the AttrSizedOperand trait (but with a user defined attribute name). build methods for VariadicOfVariadic operand expect inputs of the form ArrayRef<ValueRange>. Accessors for the variadic ranges return a new OperandRangeRange type, which represents a contiguous range of OperandRange. In the declarative assembly format, VariadicOfVariadic operands and types are by default formatted as a comma delimited list of value lists: (<value>, <value>), (), (<value>). Differential Revision: https://reviews.llvm.org/D107774 | 4 年前 | |
[mlir][ods] Remove warning in AttrOrTypeDef This warning was added because using attribute or type assembly formats with skipDefaultBuilders set could cause compilation errors, since the required builder prototype may not necessarily be generated and would need to be checked by hand. This patch removes the warning because a warning that the generated C++ "might" not compile is not particularly useful. Attempting to address the TODO (i.e. detect whether a builder of the correct prototype is provided) would be fragile since it would not be possible to account for implicit conversions, etc. In general, ODS should not be emitting warnings in cases like these. Reviewed By: rriddle, wrengr Differential Revision: https://reviews.llvm.org/D130102 | 3 年前 | |
[mlir][ods] Remove StructAttr Depends on D127373 Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D127375 | 3 年前 | |
[mlir][tblgen] Improving error messages This differential improves two error conditions, by detecting them earlier and by providing better messages to help users understand what went wrong. Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D128555 | 3 年前 | |
[mlir][ods] Cleanup of Class Codegen helper Depends on D113331 Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D113714 | 4 年前 | |
[mlir][ods] ODS ops get an extraClassDefinition Extra definitions are placed in the generated source file for each op class. The substitution $cppClass is replaced by the op's C++ class name. This is useful when declaring but not defining methods in TableGen base classes: class BaseOp<string mnemonic> : Op<MyDialect, mnemonic, [DeclareOpInterfaceMethods<SomeInterface>] { let extraClassDeclaration = [{ // ZOp is declared at at the bottom of the file and is incomplete here ZOp getParent(); }]; let extraClassDefinition = [{ int $cppClass::someInterfaceMethod() { return someUtilityFunction(*this); } ZOp $cppClass::getParent() { return dyn_cast<ZOp>(this->getParentOp()); } }]; } Certain things may prevent defining these functions inline, in the declaration. In this example, ZOp in the same dialect is incomplete at the function declaration because ops classes are declared in alphabetical order. Alternatively, functions may be too big to be desired as inlined, or they may require dependencies that create cyclic includes, or they may be calling a templated utility function that one may not want to expose in a header. If the functions are not inlined, then inheriting from the base class N times means that each function will need to be defined N times. With extraClassDefinitions, they only need to be defined once. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D115783 | 4 年前 | |
Use value_or instead of getValueOr (NFC) | 3 年前 | |
[mlir] Add extensible dialects Depends on D104534 Add support for extensible dialects, which are dialects that can be extended at runtime with new operations and types. These operations and types cannot at the moment implement traits or interfaces. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D104554 | 4 年前 | |
[llvm] Cleanup header dependencies in ADT and Support The cleanup was manual, but assisted by "include-what-you-use". It consists in 1. Removing unused forward declaration. No impact expected. 2. Removing unused headers in .cpp files. No impact expected. 3. Removing unused headers in .h files. This removes implicit dependencies and is generally considered a good thing, but this may break downstream builds. I've updated llvm, clang, lld, lldb and mlir deps, and included a list of the modification in the second part of the commit. 4. Replacing header inclusion by forward declaration. This has the same impact as 3. Notable changes: - llvm/Support/TargetParser.h no longer includes llvm/Support/AArch64TargetParser.h nor llvm/Support/ARMTargetParser.h - llvm/Support/TypeSize.h no longer includes llvm/Support/WithColor.h - llvm/Support/YAMLTraits.h no longer includes llvm/Support/Regex.h - llvm/ADT/SmallVector.h no longer includes llvm/Support/MemAlloc.h nor llvm/Support/ErrorHandling.h You may need to add some of these headers in your compilation units, if needs be. As an hint to the impact of the cleanup, running clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 8000919 lines after: 7917500 lines Reduced dependencies also helps incremental rebuilds and is more ccache friendly, something not shown by the above metric :-) Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831 | 4 年前 | |
[mlir][ods] Make Type- and AttrInterfaces also Types and Attrs By making TypeInterfaces and AttrInterfaces, Types and Attrs respectively it'd then be possible to use them anywhere where a Type or Attr may go. That is within the arguments and results of an Op definition, in a RewritePattern etc. Prior to this change users had to separately define a Type or Attr, with a predicate to check whether a type or attribute implements a given interface. Such code will be redundant now. Removing such occurrences in upstream dialects will be part of a separate patch. As part of implementing this patch, slight refactoring had to be done. In particular, Interfaces cppClassName field was renamed to cppInterfaceName as it "clashed" with TypeConstraints cppClassName. In particular Interfaces cppClassName expected just the class name, without any namespaces, while TypeConstraints cppClassName expected a fully qualified class name. Differential Revision: https://reviews.llvm.org/D129209 | 3 年前 | |
[mlir] Don't use Optional::hasValue (NFC) | 3 年前 | |
Fix more clang-tidy cleanups in mlir/ (NFC) | 4 年前 | |
Use isa instead of dyn_cast (NFC) | 3 年前 | |
[mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h These are used pervasively during parsing. Differential Revision: https://reviews.llvm.org/D118291 | 4 年前 | |
[mlir][ODS] Add support for variadic regions. Summary: This revision adds support for marking the last region as variadic in the ODS region list with the VariadicRegion directive. Differential Revision: https://reviews.llvm.org/D77455 | 6 年前 | |
[mlir] Add support for adding attribute+type traits/interfaces to tablegen defs This matches the current support provided to operations, and allows attaching traits, interfaces, and using the DeclareInterfaceMethods utility. This was missed when attribute/type generation was first added. Differential Revision: https://reviews.llvm.org/D100233 | 5 年前 | |
[llvm][ADT] Move TypeSwitch class from MLIR to LLVM This class implements a switch-like dispatch statement for a value of 'T' using dyn_cast functionality. Each Case<T> takes a callable to be invoked if the root value isa<T>, the callable is invoked with the result of dyn_cast<T>() as a parameter. Differential Revision: https://reviews.llvm.org/D78070 | 6 年前 | |
[mlir] Support verification order (2/3) This change gives explicit order of verifier execution and adds hasRegionVerifier and verifyWithRegions to increase the granularity of verifier classification. The orders are as below, 1. InternalOpTrait will be verified first, they can be run independently. 2. verifyInvariants which is constructed by ODS, it verifies the type, attributes, .etc. 3. Other Traits/Interfaces that have marked their verifier as verifyTrait or verifyWithRegions=0. 4. Custom verifier which is defined in the op and has marked hasVerifier=1 If an operation has regions, then it may have the second phase, 5. Traits/Interfaces that have marked their verifier as verifyRegionTrait or verifyWithRegions=1. This implies the verifier needs to access the operations in its regions. 6. Custom verifier which is defined in the op and has marked hasRegionVerifier=1 Note that the second phase will be run after the operations in the region are verified. Based on the verification order, you will be able to avoid verifying duplicate things. Reviewed By: Mogball Differential Revision: https://reviews.llvm.org/D116789 | 4 年前 | |
[mlir:PDLL] Add better support for providing Constraint/Pattern/Rewrite documentation This commit enables providing long-form documentation more seamlessly to the LSP by revamping decl documentation. For ODS imported constructs, we now also import descriptions and attach them to decls when possible. For PDLL constructs, the LSP will now try to provide documentation by parsing the comments directly above the decls location within the source file. This commit also adds a new parser flag enableDocumentation that gates the import and attachment of ODS documentation, which is unnecessary in the normal build process (i.e. it should only be used/consumed by tools). Differential Revision: https://reviews.llvm.org/D124881 | 4 年前 |