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

34 lines
690 B
C++

#ifndef BUILDER_OPIMPL_
#define BUILDER_OPIMPL_
#include "Builder.h"
#include "llvm/Support/Casting.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/Types.h"
#include "mlir/IR/Value.h"
namespace builder {
class Op::Impl {
public:
Impl() : op_(nullptr), value_(){};
void SetOperation(mlir::Operation *Op) { op_ = Op; }
void SetValue(mlir::Value &value) { value_ = value; }
mlir::Value GetResult() {
if (op_ != nullptr)
return op_->getResult(0);
else
return value_;
}
private:
mlir::Operation *op_;
mlir::Value value_;
};
} // namespace builder
#endif