2021-08-04 20:24:07 +08:00
|
|
|
#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:
|
2021-08-17 11:28:17 +08:00
|
|
|
Impl() : op_(nullptr), value_(){};
|
2021-08-13 15:05:10 +08:00
|
|
|
void SetOperation(mlir::Operation *Op) { op_ = Op; }
|
2021-08-17 11:28:17 +08:00
|
|
|
void SetValue(mlir::Value &value) { value_ = value; }
|
|
|
|
mlir::Value GetResult() {
|
|
|
|
if (op_ != nullptr)
|
|
|
|
return op_->getResult(0);
|
|
|
|
else
|
|
|
|
return value_;
|
|
|
|
}
|
2021-08-04 20:24:07 +08:00
|
|
|
|
|
|
|
private:
|
2021-08-13 15:05:10 +08:00
|
|
|
mlir::Operation *op_;
|
2021-08-17 11:28:17 +08:00
|
|
|
mlir::Value value_;
|
2021-08-04 20:24:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace builder
|
|
|
|
|
|
|
|
#endif
|