Add scf-codegen tests

This commit is contained in:
Yan Da
2022-04-10 15:49:09 +08:00
parent 9c7b3d5173
commit 19f81b7dea
3 changed files with 402 additions and 1 deletions

View File

@@ -15,7 +15,8 @@
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Verifier.h"
#include <llvm-6.0/llvm/ADT/SmallVector.h>
#include "llvm/Support/raw_ostream.h"
#include <optional>
#include <pybind11/buffer_info.h>
#include <pybind11/functional.h>
@@ -715,6 +716,12 @@ void init_triton_ir(py::module &&m) {
return self.getBody(idx);
}, ret::reference)
.def("dump", [](mlir::OpState &self) { self->dump(); })
.def("str", [](mlir::OpState &self) -> std::string {
std::string str;
llvm::raw_string_ostream os(str);
self->print(os);
return str;
})
.def("append_operand", [](mlir::OpState &self, mlir::Value &val) {
self->insertOperands(self->getNumOperands(), val);
})