Add ways to get the value of a ConstantInt
- property z_ext_value gets the zero-extended value using LLVMConstIntGetZExtValue - property s_ext_value gets the sign-extended value using LLVMConstIntGetSExtValue - add test case for both
This commit is contained in:
parent
3b22d5accf
commit
41953602bf
3 changed files with 28 additions and 2 deletions
12
llvm/core.py
12
llvm/core.py
|
|
@ -1193,7 +1193,17 @@ class ConstantDataVector(Constant):
|
|||
pass
|
||||
|
||||
class ConstantInt(Constant):
|
||||
pass
|
||||
@property
|
||||
def z_ext_value(self):
|
||||
'''Obtain the zero extended value for an integer constant value.'''
|
||||
# Warning: assertion failure when value does not fit in 64 bits
|
||||
return _core.LLVMConstIntGetZExtValue(self.ptr)
|
||||
|
||||
@property
|
||||
def s_ext_value(self):
|
||||
'''Obtain the sign extended value for an integer constant value.'''
|
||||
# Warning: assertion failure when value does not fit in 64 bits
|
||||
return _core.LLVMConstIntGetSExtValue(self.ptr)
|
||||
|
||||
|
||||
class ConstantFP(Constant):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue