mirror of https://github.com/llvm/torch-mlir
Add sample for ast extraction.
parent
0cc0a7165e
commit
7b95d860e9
|
@ -0,0 +1,17 @@
|
|||
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
from npcomp.compiler.frontend import *
|
||||
|
||||
def binary_expression():
|
||||
a = 1
|
||||
b = 100
|
||||
c = a * b + 4
|
||||
return c
|
||||
|
||||
fe = ImportFrontend()
|
||||
try:
|
||||
f = fe.import_global_function(binary_expression)
|
||||
finally:
|
||||
print(fe.ir_module.to_asm(debug_info=True))
|
Loading…
Reference in New Issue