You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way I can retrieve the integer value from a ValueRef? I wrote this code:
from llvmlite import binding as llvm
asm_sum = r"""
define i32 @foo(i32 %arg) #0 {
%tmp = alloca i32, align 4
store i32 1, i32* %tmp, align 4
ret i32 %arg
}
"""
ref = llvm.parse_assembly(asm_sum, None)
fn = ref.get_function("foo")
for b in fn.blocks:
for i in b.instructions:
if i.opcode == "store":
ops = list(i.operands)
x = ops[0] + 1 # this generates an error
and would like to get the int 1 from it. In llvm's C++ bindings I'd call functions like getZExtValue. Is there a way to do so here? I've also tried ops[0].name but that didn't work either.
The text was updated successfully, but these errors were encountered:
Unfortunately I don't think there's a way to do that - a wrapper for getZExtValue would need to be added to the binding layer (in the ffi subdir then the Python layer in llvmlite/binding augmented to be able to access it.
(Marking this as a feature request - is this something you'd potentially be interested in contributing?)
Is there a way I can retrieve the integer value from a
ValueRef
? I wrote this code:and would like to get the int
1
from it. In llvm's C++ bindings I'd call functions likegetZExtValue
. Is there a way to do so here? I've also triedops[0].name
but that didn't work either.The text was updated successfully, but these errors were encountered: