1 #include "mlir/IR/Identifier.h"
2 #include "mlir/IR/Location.h"
3 #include "mlir/IR/MLIRContext.h"
4 #include "mlir/IR/OperationSupport.h"
5 #include "mlir/IR/StandardTypes.h"
6 
7 mlir::MLIRContext Context;
8 
9 auto Identifier = mlir::Identifier::get("foo", &Context);
10 mlir::OperationName OperationName("FooOp", &Context);
11 mlir::Value Value({reinterpret_cast<void *>(0x8),
12                    mlir::Value::Kind::TrailingOpResult});
13 
14 mlir::Type Type(nullptr);
15 mlir::Type IndexType = mlir::IndexType::get(&Context);
16 mlir::Type IntegerType =
17     mlir::IntegerType::get(3, mlir::IntegerType::Unsigned, &Context);
18 mlir::Type FloatType = mlir::Float32Type::get(&Context);
19 mlir::Type MemRefType = mlir::MemRefType::get({4, 5}, FloatType);
20 mlir::Type UnrankedMemRefType = mlir::UnrankedMemRefType::get(IntegerType, 6);
21 mlir::Type VectorType = mlir::VectorType::get({1, 2}, FloatType);
22 mlir::Type TupleType =
23     mlir::TupleType::get(mlir::TypeRange({IndexType, FloatType}), &Context);
24 
25 auto UnknownLoc = mlir::UnknownLoc::get(&Context);
26 auto FileLineColLoc = mlir::FileLineColLoc::get("file", 7, 8, &Context);
27 auto OpaqueLoc = mlir::OpaqueLoc::get<uintptr_t>(9, &Context);
28 auto NameLoc = mlir::NameLoc::get(Identifier, &Context);
29 auto CallSiteLoc = mlir::CallSiteLoc::get(FileLineColLoc, OpaqueLoc);
30 auto FusedLoc = mlir::FusedLoc::get({FileLineColLoc, NameLoc}, &Context);
31 
32 mlir::Attribute UnitAttr = mlir::UnitAttr::get(&Context);
33 mlir::Attribute FloatAttr = mlir::FloatAttr::get(FloatType, 1.0);
34 mlir::Attribute IntegerAttr = mlir::IntegerAttr::get(IntegerType, 10);
35 mlir::Attribute TypeAttr = mlir::TypeAttr::get(IndexType);
36 mlir::Attribute ArrayAttr = mlir::ArrayAttr::get({UnitAttr}, &Context);
37 mlir::Attribute StringAttr = mlir::StringAttr::get("foo", &Context);
38 mlir::Attribute ElementsAttr = mlir::DenseElementsAttr::get(
39     VectorType.cast<mlir::ShapedType>(), llvm::ArrayRef<float>{2.0f, 3.0f});
40 
main()41 int main() { return 0; }
42