13 #ifndef MLIR_IR_IMPLICITLOCOPBUILDER_H
14 #define MLIR_IR_IMPLICITLOCOPBUILDER_H
27 template <
typename... T>
29 :
OpBuilder(std::forward<T>(operands)...), curLoc(loc) {}
50 assert(terminator !=
nullptr &&
"the block has no terminator");
65 template <
typename OpTy,
typename... Args>
67 return OpBuilder::create<OpTy>(curLoc, std::forward<Args>(args)...);
73 template <
typename OpTy,
typename... Args>
75 OpBuilder::createOrFold<OpTy>(results, curLoc, std::forward<Args>(args)...);
79 template <
typename OpTy,
typename... Args>
80 std::enable_if_t<OpTy::template hasTrait<mlir::OpTrait::OneResult>(),
Value>
82 return OpBuilder::createOrFold<OpTy>(curLoc, std::forward<Args>(args)...);
86 template <
typename OpTy,
typename... Args>
87 std::enable_if_t<OpTy::template hasTrait<mlir::OpTrait::ZeroResults>(), OpTy>
89 return OpBuilder::createOrFold<OpTy>(curLoc, std::forward<Args>(args)...);
94 emitError(
const llvm::Twine &message = llvm::Twine()) {
Block represents an ordered list of Operations.
OpListType::iterator iterator
Operation * getTerminator()
Get the terminator operation of this block.
ImplicitLocOpBuilder maintains a 'current location', allowing use of the create<> method without spec...
void setLoc(Location loc)
Location getLoc() const
Accessors for the implied location.
mlir::InFlightDiagnostic emitWarning(const llvm::Twine &message=llvm::Twine())
std::enable_if_t< OpTy::template hasTrait< mlir::OpTrait::ZeroResults >), OpTy > createOrFold(Args &&...args)
Overload to create or fold a zero result operation.
static ImplicitLocOpBuilder atBlockTerminator(Location loc, Block *block, Listener *listener=nullptr)
Create a builder and set the insertion point to before the block terminator.
ImplicitLocOpBuilder(Location loc, T &&...operands)
OpBuilder has a bunch of convenience constructors - we support them all with the additional Location.
std::enable_if_t< OpTy::template hasTrait< mlir::OpTrait::OneResult >), Value > createOrFold(Args &&...args)
Overload to create or fold a single result operation.
static ImplicitLocOpBuilder atBlockBegin(Location loc, Block *block, Listener *listener=nullptr)
Create a builder and set the insertion point to before the first operation in the block but still ins...
mlir::InFlightDiagnostic emitError(const llvm::Twine &message=llvm::Twine())
This builder can also be used to emit diagnostics to the current location.
mlir::InFlightDiagnostic emitRemark(const llvm::Twine &message=llvm::Twine())
OpTy create(Args &&...args)
Create an operation of specific op type at the current insertion point and location.
void createOrFold(llvm::SmallVectorImpl< Value > &results, Args &&...args)
Create an operation of specific op type at the current insertion point, and immediately try to fold i...
static ImplicitLocOpBuilder atBlockEnd(Location loc, Block *block, Listener *listener=nullptr)
Create a builder and set the insertion point to after the last operation in the block but still insid...
This class represents a diagnostic that is inflight and set to be reported.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class helps build Operations.
Listener * listener
The optional listener for events of this builder.
void createOrFold(SmallVectorImpl< Value > &results, Location location, Args &&...args)
Create an operation of specific op type at the current insertion point, and immediately try to fold i...
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Include the generated interface declarations.
InFlightDiagnostic emitWarning(Location loc)
Utility method to emit a warning message using this location.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
InFlightDiagnostic emitRemark(Location loc)
Utility method to emit a remark message using this location.
This class represents a listener that may be used to hook into various actions within an OpBuilder.