|
MLIR 22.0.0git
|
Implementation of CFGToSCFInterface used to lift Control Flow Dialect operations to SCF Dialect operations. More...
#include "mlir/Conversion/ControlFlowToSCF/ControlFlowToSCF.h"
Public Member Functions | |
| FailureOr< Operation * > | createStructuredBranchRegionOp (OpBuilder &builder, Operation *controlFlowCondOp, TypeRange resultTypes, MutableArrayRef< Region > regions) override |
| Creates an scf.if op if controlFlowCondOp is a cf.cond_br op or an scf.index_switch if controlFlowCondOp is a cf.switch. | |
| LogicalResult | createStructuredBranchRegionTerminatorOp (Location loc, OpBuilder &builder, Operation *branchRegionOp, Operation *replacedControlFlowOp, ValueRange results) override |
| Creates an scf.yield op returning the given results. | |
| FailureOr< Operation * > | createStructuredDoWhileLoopOp (OpBuilder &builder, Operation *replacedOp, ValueRange loopVariablesInit, Value condition, ValueRange loopVariablesNextIter, Region &&loopBody) override |
| Creates an scf.while op. | |
| Value | getCFGSwitchValue (Location loc, OpBuilder &builder, unsigned value) override |
| Creates an arith.constant with an i32 attribute of the given value. | |
| void | createCFGSwitchOp (Location loc, OpBuilder &builder, Value flag, ArrayRef< unsigned > caseValues, BlockRange caseDestinations, ArrayRef< ValueRange > caseArguments, Block *defaultDest, ValueRange defaultArgs) override |
| Creates a cf.switch op with the given cases and flag. | |
| Value | getUndefValue (Location loc, OpBuilder &builder, Type type) override |
| Creates a ub.poison op of the given type. | |
| FailureOr< Operation * > | createUnreachableTerminator (Location loc, OpBuilder &builder, Region ®ion) override |
| Creates a func.return op with poison for each of the return values of the function. | |
| Public Member Functions inherited from mlir::CFGToSCFInterface | |
| virtual | ~CFGToSCFInterface ()=default |
| void | createSingleDestinationBranch (Location loc, OpBuilder &builder, Value dummyFlag, Block *destination, ValueRange arguments) |
| Helper function to create an unconditional branch using createCFGSwitchOp. | |
| void | createConditionalBranch (Location loc, OpBuilder &builder, Value condition, Block *trueDest, ValueRange trueArgs, Block *falseDest, ValueRange falseArgs) |
| Helper function to create a conditional branch using createCFGSwitchOp. | |
Implementation of CFGToSCFInterface used to lift Control Flow Dialect operations to SCF Dialect operations.
Definition at line 25 of file ControlFlowToSCF.h.
|
overridevirtual |
Creates a cf.switch op with the given cases and flag.
Implements mlir::CFGToSCFInterface.
Definition at line 117 of file ControlFlowToSCF.cpp.
|
overridevirtual |
Creates an scf.if op if controlFlowCondOp is a cf.cond_br op or an scf.index_switch if controlFlowCondOp is a cf.switch.
Returns failure otherwise.
Implements mlir::CFGToSCFInterface.
Definition at line 31 of file ControlFlowToSCF.cpp.
References mlir::Operation::emitOpError(), mlir::Builder::getIndexType(), and mlir::Operation::getLoc().
|
overridevirtual |
Creates an scf.yield op returning the given results.
Implements mlir::CFGToSCFInterface.
Definition at line 76 of file ControlFlowToSCF.cpp.
References success().
|
overridevirtual |
Creates an scf.while op.
The loop body is made the before-region of the while op and terminated with an scf.condition op. The after-region does nothing but forward the iteration variables.
Implements mlir::CFGToSCFInterface.
Definition at line 84 of file ControlFlowToSCF.cpp.
References mlir::Block::addArguments(), mlir::OpBuilder::createBlock(), mlir::Block::getArguments(), mlir::Builder::getI1Type(), mlir::Operation::getLoc(), mlir::ValueRange::getTypes(), and mlir::OpBuilder::setInsertionPointToEnd().
|
overridevirtual |
Creates a func.return op with poison for each of the return values of the function.
It is guaranteed to be directly within the function body. TODO: This can be made independent of the func dialect once the UB dialect has a ub.unreachable op.
Implements mlir::CFGToSCFInterface.
Definition at line 134 of file ControlFlowToSCF.cpp.
References mlir::emitError(), mlir::Operation::getName(), and mlir::Region::getParentOp().
|
overridevirtual |
Creates an arith.constant with an i32 attribute of the given value.
Implements mlir::CFGToSCFInterface.
Definition at line 110 of file ControlFlowToSCF.cpp.
References mlir::Builder::getI32IntegerAttr().
|
overridevirtual |
Creates a ub.poison op of the given type.
Implements mlir::CFGToSCFInterface.
Definition at line 127 of file ControlFlowToSCF.cpp.