mlir-hlo/tools/mlir-tblgen-builder/Builder/AttributeImpl.h

58 lines
1.1 KiB
C++

#ifndef BUILDER_TYPEIMPL_
#define BUILDER_TYPEIMPL_
#include "Builder.h"
#include "llvm/Support/Casting.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/Types.h"
#include "mlir/IR/Value.h"
namespace builder {
class Integer::Impl {
public:
Impl(){};
Impl(int value) {
GetAttr = [=](mlir::MLIRContext *context) -> mlir::IntegerAttr {
auto int32_type = mlir::IntegerType::get(context, 32);
return mlir::IntegerAttr::get(int32_type, value);
};
};
Impl(int64_t value)
: GetAttr([=](mlir::MLIRContext *context) -> mlir::IntegerAttr {
auto int32_type = mlir::IntegerType::get(context, 64);
return mlir::IntegerAttr::get(int32_type, value);
}){};
std::function<mlir::IntegerAttr(mlir::MLIRContext *context)> GetAttr;
private:
};
class Array::Impl {
public:
Impl() = default;
private:
};
class Type::Impl {
public:
Impl() = default;
private:
};
// class DenseIntElementsAttr::Impl {
// public:
// Impl() = default;
// private:
// };
} // namespace builder
#endif