MLIR
20.0.0git
lib
IR
BuiltinTypeInterfaces.cpp
Go to the documentation of this file.
1
//===- BuiltinTypeInterfaces.cpp ------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "
mlir/IR/BuiltinTypes.h
"
10
#include "
mlir/IR/Diagnostics.h
"
11
#include "llvm/ADT/Sequence.h"
12
13
using namespace
mlir
;
14
using namespace
mlir::detail
;
15
16
//===----------------------------------------------------------------------===//
17
/// Tablegen Interface Definitions
18
//===----------------------------------------------------------------------===//
19
20
#include "mlir/IR/BuiltinTypeInterfaces.cpp.inc"
21
22
//===----------------------------------------------------------------------===//
23
// ShapedType
24
//===----------------------------------------------------------------------===//
25
26
constexpr int64_t ShapedType::kDynamic;
27
28
int64_t
ShapedType::getNumElements
(
ArrayRef<int64_t>
shape) {
29
int64_t num = 1;
30
for
(int64_t dim : shape) {
31
num *= dim;
32
assert(num >= 0 &&
"integer overflow in element count computation"
);
33
}
34
return
num;
35
}
getNumElements
static int64_t getNumElements(Type t)
Compute the total number of elements in the given type, also taking into account nested types.
Definition:
LLVMDialect.cpp:2848
llvm::ArrayRef
Definition:
LLVM.h:48
Diagnostics.h
BuiltinTypes.h
mlir::detail
AttrTypeReplacer.
Definition:
AliasAnalysis.h:174
mlir
Include the generated interface declarations.
Definition:
LocalAliasAnalysis.h:20
Generated on Tue Nov 19 2024 04:32:31 for MLIR by
1.9.1