mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 11:02:04 +08:00
[MLIR][Python] expose translate_module_to_llvmir (#163881)
This PR exposes `translate_module_to_llvmir` in the Python bindings.
This commit is contained in:
@@ -150,3 +150,22 @@ def testIntrinsics():
|
||||
result = llvm.intr_memset(alloca, c_0, c_128, False)
|
||||
# CHECK: "llvm.intr.memset"(%[[ALLOCA]], %[[CST0]], %[[CST128]]) <{isVolatile = false}> : (!llvm.ptr, i8, i32) -> ()
|
||||
print(result)
|
||||
|
||||
|
||||
# CHECK-LABEL: testTranslateToLLVMIR
|
||||
@constructAndPrintInModule
|
||||
def testTranslateToLLVMIR():
|
||||
with Context(), Location.unknown():
|
||||
module = Module.parse(
|
||||
"""\
|
||||
llvm.func @add(%arg0: i64, %arg1: i64) -> i64 {
|
||||
%0 = llvm.add %arg0, %arg1 : i64
|
||||
llvm.return %0 : i64
|
||||
}
|
||||
"""
|
||||
)
|
||||
# CHECK: define i64 @add(i64 %0, i64 %1) {
|
||||
# CHECK: %3 = add i64 %0, %1
|
||||
# CHECK: ret i64 %3
|
||||
# CHECK: }
|
||||
print(llvm.translate_module_to_llvmir(module.operation))
|
||||
|
||||
Reference in New Issue
Block a user