llvm-project/mlir
Alex Zinenko 83e8db2193 EDSC: support branch instructions
The new implementation of blocks was designed to support blocks with arguments.
More specifically, StmtBlock can be constructed with a list of Bindables that
will be bound to block aguments upon construction.  Leverage this functionality
to implement branch instructions with arguments.

This additionally requires the statement storage to have a list of successors,
similarly to core IR operations.

Becauase successor chains can form loops, we need a possibility to decouple
block declaration, after which it becomes usable by branch instructions, from
block body definition.  This is achieved by creating an empty block and by
resetting its body with a new list of instructions.  Note that assigning a
block from another block will not affect any instructions that may have
designated this block as their successor (this behavior is necessary to make
value-type semantics of EDSC types consistent).  Combined, one can now write
generators like

    EDSCContext context;
    Type indexType = ...;
    Bindable i(indexType), ii(indexType), zero(indexType), one(indexType);
    StmtBlock loopBlock({i}, {});
    loopBlock.set({ii = i + one,
                   Branch(loopBlock, {ii})});
    MLIREmitter(&builder)
        .bindConstant<ConstantIndexOp>(zero, 0)
        .bindConstant<ConstantIndexOp>(one, 1)
	.emitStmt(Branch(loopBlock, {zero}));

where the emitter will emit the statement and its successors, if present.

PiperOrigin-RevId: 235541892
2019-03-29 16:40:50 -07:00
..
bindings/python EDSC: support branch instructions 2019-03-29 16:40:50 -07:00
g3doc Document the conversion into the LLVM IR dialect 2019-03-29 16:38:04 -07:00
include EDSC: support branch instructions 2019-03-29 16:40:50 -07:00
lib EDSC: support branch instructions 2019-03-29 16:40:50 -07:00
test EDSC: support branch instructions 2019-03-29 16:40:50 -07:00
tools Spike to define real math ops and lowering of one variant of add to corresponding integer ops. 2019-03-29 16:39:13 -07:00
utils Automated rollback of changelist 232728977. 2019-03-29 16:21:38 -07:00
.clang-format [mlir] add .clang-format 2019-03-29 12:41:43 -07:00
LICENSE.TXT Continue sketching out basic infrastructure, including an input and output 2019-03-29 12:23:51 -07:00