mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 17:26:35 +00:00

Add support for import and translate. MLIR does not support using basic block references outside a function (like LLVM does), This PR does not consider changes to MLIR to that respect. It instead introduces two new ops: `llvm.blockaddress` and `llvm.blocktag`. Here's an example: ``` llvm.func @ba() -> !llvm.ptr { %0 = llvm.blockaddress <function = @ba, tag = <id = 1>> : !llvm.ptr llvm.br ^bb1 ^bb1: // pred: ^bb0 llvm.blocktag <id = 1> llvm.return %0 : !llvm.ptr } ``` Value `%0` hold the address of block tagged as `id = 1` in function `@ba`. Block tags need to be unique within a function and use of `llvm.blockaddress` requires a matching tag in a `llvm.blocktag`.
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.