forked from OSchip/llvm-project
1fa1251116
This adds a variable op, emitted as C/C++ locale variable, which can be used if the `emitc.constant` op is not sufficient. As an example, the canonicalization pass would transform ```mlir %0 = "emitc.constant"() {value = 0 : i32} : () -> i32 %1 = "emitc.constant"() {value = 0 : i32} : () -> i32 %2 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32> %3 = emitc.apply "&"(%1) : (i32) -> !emitc.ptr<i32> emitc.call "write"(%2, %3) : (!emitc.ptr<i32>, !emitc.ptr<i32>) -> () ``` into ```mlir %0 = "emitc.constant"() {value = 0 : i32} : () -> i32 %1 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32> %2 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32> emitc.call "write"(%1, %2) : (!emitc.ptr<i32>, !emitc.ptr<i32>) -> () ``` resulting in pointer aliasing, as %1 and %2 point to the same address. In such a case, the `emitc.variable` operation can be used instead. Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D120098 |
||
---|---|---|
.. | ||
attrs.mlir | ||
invalid_ops.mlir | ||
ops.mlir | ||
types.mlir |