2021-06-23 20:34:57 +01:00
|
|
|
/*
|
2021-10-12 20:51:03 +01:00
|
|
|
* Serene Programming Language
|
2021-06-23 20:34:57 +01:00
|
|
|
*
|
2022-01-27 11:44:44 +00:00
|
|
|
* Copyright (c) 2019-2022 Sameer Rahmani <lxsameer@gnu.org>
|
2021-06-23 20:34:57 +01:00
|
|
|
*
|
2021-10-12 20:51:03 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 2.
|
2021-06-23 20:34:57 +01:00
|
|
|
*
|
2021-10-12 20:51:03 +01:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2021-06-23 20:34:57 +01:00
|
|
|
*
|
2021-10-12 20:51:03 +01:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2021-06-23 20:34:57 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "serene/slir/dialect.h"
|
|
|
|
|
|
|
|
#include <llvm/Support/FormatVariadic.h>
|
2021-09-28 17:11:50 +01:00
|
|
|
#include <mlir/IR/Attributes.h>
|
2021-06-23 20:34:57 +01:00
|
|
|
#include <mlir/IR/Builders.h>
|
2021-09-28 17:11:50 +01:00
|
|
|
#include <mlir/IR/BuiltinAttributes.h>
|
2021-06-23 20:34:57 +01:00
|
|
|
#include <mlir/IR/OperationSupport.h>
|
|
|
|
|
|
|
|
namespace serene::slir {
|
2021-06-25 21:47:24 +01:00
|
|
|
// void FnOp::build(mlir::OpBuilder &odsBuilder, mlir::OperationState &odsState,
|
|
|
|
// llvm::StringRef name, mlir::FunctionType type,
|
|
|
|
// llvm::ArrayRef<mlir::NamedAttribute> attrs,
|
|
|
|
// llvm::ArrayRef<mlir::DictionaryAttr> argAttrs) {
|
|
|
|
// odsState.addAttribute("name", odsBuilder.getStringAttr(name));
|
|
|
|
// llvm::SmallVector<mlir::NamedAttribute> args;
|
2021-06-23 20:34:57 +01:00
|
|
|
|
2021-06-25 21:47:24 +01:00
|
|
|
// for (unsigned int i = 0; i <= type.getNumInputs(); i++) {
|
|
|
|
// odsState.addAttribute(attrName, mlir::TypeAttr::get(type.getResult(i)));
|
|
|
|
// args.push_back(odsBuilder.getNamedAttr(,
|
|
|
|
// mlir::IntegerAttr::get(odsBuilder.getI64Type(), type.getNumInputs())));
|
|
|
|
// }
|
2021-06-23 20:34:57 +01:00
|
|
|
|
2021-06-25 21:47:24 +01:00
|
|
|
// odsState.addAttribute("xxx",
|
|
|
|
// mlir::DictionaryAttr::get(odsBuilder.getContext(), p));
|
|
|
|
// odsState.addAttribute("input_count",
|
|
|
|
// mlir::IntegerAttr::get(odsBuilder.getI64Type(),
|
|
|
|
// type.getNumInputs()));
|
|
|
|
// // if (sym_visibility) {
|
|
|
|
// // odsState.addAttribute("sym_visibility", sym_visibility);
|
|
|
|
// // }
|
|
|
|
// (void)odsState.addRegion();
|
|
|
|
// odsState.addTypes(type);
|
|
|
|
// };
|
2021-06-23 20:34:57 +01:00
|
|
|
|
|
|
|
} // namespace serene::slir
|