Skip to content

Commit 09f7a55

Browse files
committed
[mlir][Types][NFC] Move all of the builtin Type classes to BuiltinTypes.h
This is part of a larger refactoring the better congregates the builtin structures under the BuiltinDialect. This also removes the problematic "standard" naming that clashes with the "standard" dialect, which is not defined within IR/. A temporary forward is placed in StandardTypes.h to allow time for downstream users to replaced references. Differential Revision: https://reviews.llvm.org/D92435
1 parent e66c2e2 commit 09f7a55

File tree

122 files changed

+1135
-1127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1135
-1127
lines changed

debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#include "mlir/IR/BuiltinTypes.h"
12
#include "mlir/IR/Identifier.h"
23
#include "mlir/IR/Location.h"
34
#include "mlir/IR/MLIRContext.h"
45
#include "mlir/IR/OperationSupport.h"
5-
#include "mlir/IR/StandardTypes.h"
66

77
mlir::MLIRContext Context;
88

flang/include/flang/Lower/Mangler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef FORTRAN_LOWER_MANGLER_H
1414
#define FORTRAN_LOWER_MANGLER_H
1515

16-
#include "mlir/IR/StandardTypes.h"
16+
#include "mlir/IR/BuiltinTypes.h"
1717
#include "llvm/ADT/StringRef.h"
1818
#include <string>
1919

flang/lib/Lower/ConvertType.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "flang/Semantics/tools.h"
1414
#include "flang/Semantics/type.h"
1515
#include "mlir/IR/Builders.h"
16-
#include "mlir/IR/StandardTypes.h"
16+
#include "mlir/IR/BuiltinTypes.h"
1717

1818
#undef QUOTE
1919
#undef TODO

flang/lib/Lower/RTBuilder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
#include "flang/Lower/ConvertType.h"
2121
#include "flang/Optimizer/Dialect/FIRType.h"
22+
#include "mlir/IR/BuiltinTypes.h"
2223
#include "mlir/IR/MLIRContext.h"
23-
#include "mlir/IR/StandardTypes.h"
2424
#include "llvm/ADT/SmallVector.h"
2525
#include <functional>
2626

mlir/docs/Dialects/LLVM.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ constants must be created as SSA values before being used in other operations.
370370
`llvm.mlir.constant` creates such values for scalars and vectors. It has a
371371
mandatory `value` attribute, which may be an integer, floating point attribute;
372372
dense or sparse attribute containing integers or floats. The type of the
373-
attribute is one of the corresponding MLIR standard types. It may be omitted for
373+
attribute is one of the corresponding MLIR builtin types. It may be omitted for
374374
`i64` and `f64` types that are implied. The operation produces a new SSA value
375375
of the specified LLVM IR dialect type. The type of that value _must_ correspond
376376
to the attribute type converted to LLVM IR.

mlir/docs/Dialects/SPIR-V.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ instructions are represented in the SPIR-V dialect:
159159

160160
#### Model types with MLIR custom types
161161

162-
* Types are represented using MLIR standard types and SPIR-V dialect specific
162+
* Types are represented using MLIR builtin types and SPIR-V dialect specific
163163
types. There are no type declaration ops in the SPIR-V dialect. More
164164
discussions can be found in the [Types](#types) section later.
165165

@@ -247,9 +247,9 @@ encode them directly in the dialect-specific type.
247247
Theoretically we can define all SPIR-V types using MLIR extensible type system,
248248
but other than representational purity, it does not buy us more. Instead, we
249249
need to maintain the code and invest in pretty printing them. So we prefer to
250-
use builtin/standard types if possible.
250+
use builtin types if possible.
251251

252-
The SPIR-V dialect reuses standard integer, float, and vector types:
252+
The SPIR-V dialect reuses builtin integer, float, and vector types:
253253

254254
Specification | Dialect
255255
:----------------------------------: | :-------------------------------:
@@ -1005,10 +1005,10 @@ register other legality constraints into the returned `SPIRVConversionTarget`.
10051005
### `SPIRVTypeConverter`
10061006

10071007
The `mlir::SPIRVTypeConverter` derives from `mlir::TypeConverter` and provides
1008-
type conversion for standard types to SPIR-V types conforming to the [target
1009-
environment](#target-environment) it is constructed with. If the required
1010-
extension/capability for the resultant type is not available in the given
1011-
target environment, `convertType()` will return a null type.
1008+
type conversion for builtin types to SPIR-V types conforming to the
1009+
[target environment](#target-environment) it is constructed with. If the
1010+
required extension/capability for the resultant type is not available in the
1011+
given target environment, `convertType()` will return a null type.
10121012

10131013
Standard scalar types are converted to their corresponding SPIR-V scalar types.
10141014

mlir/docs/LangRef.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,15 @@ defines the relation between the region results and the operation results.
702702

703703
Each value in MLIR has a type defined by the type system below. There are a
704704
number of primitive types (like integers) and also aggregate types for tensors
705-
and memory buffers. MLIR [standard types](#standard-types) do not include
705+
and memory buffers. MLIR [builtin types](#builtin-types) do not include
706706
structures, arrays, or dictionaries.
707707

708708
MLIR has an open type system (i.e. there is no fixed list of types), and types
709709
may have application-specific semantics. For example, MLIR supports a set of
710710
[dialect types](#dialect-types).
711711

712712
```
713-
type ::= type-alias | dialect-type | standard-type
713+
type ::= type-alias | dialect-type | builtin-type
714714
715715
type-list-no-parens ::= type (`,` type)*
716716
type-list-parens ::= `(` `)`
@@ -807,13 +807,13 @@ characters.
807807

808808
See [here](Tutorials/DefiningAttributesAndTypes.md) to learn how to define dialect types.
809809

810-
### Standard Types
810+
### Builtin Types
811811

812-
Standard types are a core set of [dialect types](#dialect-types) that are
813-
defined in a builtin dialect and thus available to all users of MLIR.
812+
Builtin types are a core set of [dialect types](#dialect-types) that are defined
813+
in a builtin dialect and thus available to all users of MLIR.
814814

815815
```
816-
standard-type ::= complex-type
816+
builtin-type ::= complex-type
817817
| float-type
818818
| function-type
819819
| index-type

mlir/docs/Rationale/Rationale.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -439,23 +439,23 @@ understand. When types of a dialect are:
439439

440440
* In operations of other dialects
441441

442-
- For standard/builtin operations, only standard/builtin types are
443-
allowed. This restriction allows for operations to clearly understand
444-
the invariants that they are working under.
442+
- For standard/builtin operations, only builtin types are allowed. This
443+
restriction allows for operations to clearly understand the invariants
444+
that they are working under.
445445
- Outside of standard/builtin operations, dialects are expected to verify
446446
the allowable operation types per operation.
447447

448448
* In types of other dialects
449449

450-
- For standard/builtin types, these types are allowed to contain types
451-
from other dialects. This simplifies the type system and removes the
452-
need for dialects to redefine all of the standard aggregate types, e.g.
453-
tensor, as well as the memref type. Dialects are expected to verify that
454-
a specific type is valid within a standard type, e.g. if a type can be
455-
an element of a tensor.
450+
- For builtin types, these types are allowed to contain types from other
451+
dialects. This simplifies the type system and removes the need for
452+
dialects to redefine all of the builtin aggregate types, e.g. tensor, as
453+
well as the memref type. Dialects are expected to verify that a specific
454+
type is valid within a builtin type, e.g. if a type can be an element of
455+
a tensor.
456456
- For dialect types, the dialect is expected to verify any type
457-
invariants, e.g. if the standard tensor type can contain a specific type
458-
of that dialect.
457+
invariants, e.g. if the tensor type can contain a specific type of that
458+
dialect.
459459

460460
#### Separating builtin and standard types
461461

mlir/docs/ShapeInference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,4 @@ the shape function. The reference implementation is general and can support the
292292
arbitrary computations needed to specify output shapes.
293293

294294
[InferTypeOpInterface]: https://github.com/llvm/llvm-project/tree/master/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
295-
[ShapedType]: https://github.com/llvm/llvm-project/tree/master/mlir/include/mlir/IR/StandardTypes.h
295+
[ShapedType]: https://github.com/llvm/llvm-project/tree/master/mlir/include/mlir/IR/BuiltinTypes.h

mlir/examples/toy/Ch2/mlir/Dialect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "toy/Dialect.h"
1515

1616
#include "mlir/IR/Builders.h"
17+
#include "mlir/IR/BuiltinTypes.h"
1718
#include "mlir/IR/OpImplementation.h"
18-
#include "mlir/IR/StandardTypes.h"
1919

2020
using namespace mlir;
2121
using namespace mlir::toy;

mlir/examples/toy/Ch2/mlir/MLIRGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mlir/IR/Attributes.h"
1919
#include "mlir/IR/Builders.h"
2020
#include "mlir/IR/BuiltinOps.h"
21+
#include "mlir/IR/BuiltinTypes.h"
2122
#include "mlir/IR/MLIRContext.h"
22-
#include "mlir/IR/StandardTypes.h"
2323
#include "mlir/IR/Verifier.h"
2424

2525
#include "llvm/ADT/STLExtras.h"

mlir/examples/toy/Ch3/mlir/Dialect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "toy/Dialect.h"
1515

1616
#include "mlir/IR/Builders.h"
17+
#include "mlir/IR/BuiltinTypes.h"
1718
#include "mlir/IR/OpImplementation.h"
18-
#include "mlir/IR/StandardTypes.h"
1919

2020
using namespace mlir;
2121
using namespace mlir::toy;

mlir/examples/toy/Ch3/mlir/MLIRGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mlir/IR/Attributes.h"
1919
#include "mlir/IR/Builders.h"
2020
#include "mlir/IR/BuiltinOps.h"
21+
#include "mlir/IR/BuiltinTypes.h"
2122
#include "mlir/IR/MLIRContext.h"
22-
#include "mlir/IR/StandardTypes.h"
2323
#include "mlir/IR/Verifier.h"
2424

2525
#include "llvm/ADT/STLExtras.h"

mlir/examples/toy/Ch4/include/toy/Dialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#define MLIR_TUTORIAL_TOY_DIALECT_H_
1616

1717
#include "mlir/IR/BuiltinOps.h"
18+
#include "mlir/IR/BuiltinTypes.h"
1819
#include "mlir/IR/Dialect.h"
19-
#include "mlir/IR/StandardTypes.h"
2020
#include "mlir/Interfaces/SideEffectInterfaces.h"
2121
#include "toy/ShapeInferenceInterface.h"
2222

mlir/examples/toy/Ch4/mlir/Dialect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "toy/Dialect.h"
1515

1616
#include "mlir/IR/Builders.h"
17+
#include "mlir/IR/BuiltinTypes.h"
1718
#include "mlir/IR/OpImplementation.h"
18-
#include "mlir/IR/StandardTypes.h"
1919
#include "mlir/Transforms/InliningUtils.h"
2020

2121
using namespace mlir;

mlir/examples/toy/Ch4/mlir/MLIRGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mlir/IR/Attributes.h"
1919
#include "mlir/IR/Builders.h"
2020
#include "mlir/IR/BuiltinOps.h"
21+
#include "mlir/IR/BuiltinTypes.h"
2122
#include "mlir/IR/MLIRContext.h"
22-
#include "mlir/IR/StandardTypes.h"
2323
#include "mlir/IR/Verifier.h"
2424

2525
#include "llvm/ADT/STLExtras.h"

mlir/examples/toy/Ch5/include/toy/Dialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#define MLIR_TUTORIAL_TOY_DIALECT_H_
1616

1717
#include "mlir/IR/BuiltinOps.h"
18+
#include "mlir/IR/BuiltinTypes.h"
1819
#include "mlir/IR/Dialect.h"
19-
#include "mlir/IR/StandardTypes.h"
2020
#include "mlir/Interfaces/SideEffectInterfaces.h"
2121
#include "toy/ShapeInferenceInterface.h"
2222

mlir/examples/toy/Ch5/mlir/Dialect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "toy/Dialect.h"
1515

1616
#include "mlir/IR/Builders.h"
17+
#include "mlir/IR/BuiltinTypes.h"
1718
#include "mlir/IR/OpImplementation.h"
18-
#include "mlir/IR/StandardTypes.h"
1919
#include "mlir/Transforms/InliningUtils.h"
2020

2121
using namespace mlir;

mlir/examples/toy/Ch5/mlir/MLIRGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mlir/IR/Attributes.h"
1919
#include "mlir/IR/Builders.h"
2020
#include "mlir/IR/BuiltinOps.h"
21+
#include "mlir/IR/BuiltinTypes.h"
2122
#include "mlir/IR/MLIRContext.h"
22-
#include "mlir/IR/StandardTypes.h"
2323
#include "mlir/IR/Verifier.h"
2424

2525
#include "llvm/ADT/STLExtras.h"

mlir/examples/toy/Ch6/include/toy/Dialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#define MLIR_TUTORIAL_TOY_DIALECT_H_
1616

1717
#include "mlir/IR/BuiltinOps.h"
18+
#include "mlir/IR/BuiltinTypes.h"
1819
#include "mlir/IR/Dialect.h"
19-
#include "mlir/IR/StandardTypes.h"
2020
#include "mlir/Interfaces/SideEffectInterfaces.h"
2121
#include "toy/ShapeInferenceInterface.h"
2222

mlir/examples/toy/Ch6/mlir/Dialect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "toy/Dialect.h"
1515

1616
#include "mlir/IR/Builders.h"
17+
#include "mlir/IR/BuiltinTypes.h"
1718
#include "mlir/IR/OpImplementation.h"
18-
#include "mlir/IR/StandardTypes.h"
1919
#include "mlir/Transforms/InliningUtils.h"
2020

2121
using namespace mlir;

mlir/examples/toy/Ch6/mlir/MLIRGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mlir/IR/Attributes.h"
1919
#include "mlir/IR/Builders.h"
2020
#include "mlir/IR/BuiltinOps.h"
21+
#include "mlir/IR/BuiltinTypes.h"
2122
#include "mlir/IR/MLIRContext.h"
22-
#include "mlir/IR/StandardTypes.h"
2323
#include "mlir/IR/Verifier.h"
2424

2525
#include "llvm/ADT/STLExtras.h"

mlir/examples/toy/Ch7/include/toy/Dialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#define MLIR_TUTORIAL_TOY_DIALECT_H_
1616

1717
#include "mlir/IR/BuiltinOps.h"
18+
#include "mlir/IR/BuiltinTypes.h"
1819
#include "mlir/IR/Dialect.h"
19-
#include "mlir/IR/StandardTypes.h"
2020
#include "mlir/Interfaces/SideEffectInterfaces.h"
2121
#include "toy/ShapeInferenceInterface.h"
2222

mlir/examples/toy/Ch7/mlir/Dialect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#include "toy/Dialect.h"
1515

1616
#include "mlir/IR/Builders.h"
17+
#include "mlir/IR/BuiltinTypes.h"
1718
#include "mlir/IR/DialectImplementation.h"
1819
#include "mlir/IR/OpImplementation.h"
19-
#include "mlir/IR/StandardTypes.h"
2020
#include "mlir/Transforms/InliningUtils.h"
2121

2222
using namespace mlir;

mlir/examples/toy/Ch7/mlir/MLIRGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mlir/IR/Attributes.h"
1919
#include "mlir/IR/Builders.h"
2020
#include "mlir/IR/BuiltinOps.h"
21+
#include "mlir/IR/BuiltinTypes.h"
2122
#include "mlir/IR/MLIRContext.h"
22-
#include "mlir/IR/StandardTypes.h"
2323
#include "mlir/IR/Verifier.h"
2424

2525
#include "llvm/ADT/STLExtras.h"

mlir/include/mlir-c/StandardTypes.h mlir/include/mlir-c/BuiltinTypes.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- mlir-c/StandardTypes.h - C API for MLIR Standard types ----*- C -*-===//
1+
//===-- mlir-c/BuiltinTypes.h - C API for MLIR Builtin types ------*- C -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
44
// Exceptions.
@@ -7,8 +7,8 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#ifndef MLIR_C_STANDARDTYPES_H
11-
#define MLIR_C_STANDARDTYPES_H
10+
#ifndef MLIR_C_BUILTINTYPES_H
11+
#define MLIR_C_BUILTINTYPES_H
1212

1313
#include "mlir-c/AffineMap.h"
1414
#include "mlir-c/IR.h"
@@ -316,4 +316,4 @@ MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGetResult(MlirType type,
316316
}
317317
#endif
318318

319-
#endif // MLIR_C_STANDARDTYPES_H
319+
#endif // MLIR_C_BUILTINTYPES_H

mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class LLVMTypeConverter : public TypeConverter {
8989

9090
/// Promote the bare pointers in 'values' that resulted from memrefs to
9191
/// descriptors. 'stdTypes' holds the types of 'values' before the conversion
92-
/// to the LLVM-IR dialect (i.e., MemRefType, or any other Standard type).
92+
/// to the LLVM-IR dialect (i.e., MemRefType, or any other builtin type).
9393
void promoteBarePtrsToDescriptors(ConversionPatternRewriter &rewriter,
9494
Location loc, ArrayRef<Type> stdTypes,
9595
SmallVectorImpl<Value> &values);

mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#define MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
1515

1616
#include "mlir/IR/AffineMap.h"
17+
#include "mlir/IR/BuiltinTypes.h"
1718
#include "mlir/IR/OpDefinition.h"
18-
#include "mlir/IR/StandardTypes.h"
1919

2020
namespace mlir {
2121
#include "mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc"

mlir/include/mlir/Dialect/Affine/IR/AffineOps.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#include "mlir/Dialect/StandardOps/IR/Ops.h"
1919
#include "mlir/IR/AffineMap.h"
2020
#include "mlir/IR/Builders.h"
21+
#include "mlir/IR/BuiltinTypes.h"
2122
#include "mlir/IR/Dialect.h"
2223
#include "mlir/IR/OpDefinition.h"
23-
#include "mlir/IR/StandardTypes.h"
2424
#include "mlir/Interfaces/LoopLikeInterface.h"
2525
#include "mlir/Interfaces/SideEffectInterfaces.h"
2626

mlir/include/mlir/Dialect/Async/IR/Async.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#define MLIR_DIALECT_ASYNC_IR_ASYNC_H
1616

1717
#include "mlir/IR/Builders.h"
18+
#include "mlir/IR/BuiltinTypes.h"
1819
#include "mlir/IR/Dialect.h"
1920
#include "mlir/IR/OpDefinition.h"
2021
#include "mlir/IR/OpImplementation.h"
21-
#include "mlir/IR/StandardTypes.h"
2222
#include "mlir/Interfaces/ControlFlowInterfaces.h"
2323
#include "mlir/Interfaces/SideEffectInterfaces.h"
2424

mlir/include/mlir/Dialect/CommonFolders.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define MLIR_DIALECT_COMMONFOLDERS_H
1717

1818
#include "mlir/IR/Attributes.h"
19-
#include "mlir/IR/StandardTypes.h"
19+
#include "mlir/IR/BuiltinTypes.h"
2020
#include "llvm/ADT/ArrayRef.h"
2121
#include "llvm/ADT/STLExtras.h"
2222

0 commit comments

Comments
 (0)