值引用
值引用是对 LLVM 值的包装,供您检查。您无法自行创建值引用。您可以从 ModuleRef
和 ValueRef
类的方法中获取它们。
枚举
- class llvmlite.binding.Linkage
全局值允许的链接类型包括
- class llvmlite.binding.ValueKind
允许的值类型包括
- argument
- basic_block
- memory_use
- memory_def
- memory_phi
- function
- global_alias
- global_ifunc
- global_variable
- block_address
- constant_expr
- constant_array
- constant_struct
- constant_vector
- undef_value
- constant_aggregate_zero
- constant_data_array
- constant_data_vector
- constant_int
- constant_fp
- constant_pointer_null
- constant_token_none
- metadata_as_value
- inline_asm
- instruction
- poison_value
ValueRef 类
- class llvmlite.binding.ValueRef
LLVM 值的包装器。可用属性包括
- is_declaration
True
—全局值仅是一个声明。False
—全局值在给定模块中定义。
- name
此值的名称,为字符串。此属性可设置。
- storage_class
此值的存储类别——一个
StorageClass
实例。此属性可设置。
- visibility
此值的可见性样式——一个
Visibility
实例。此属性可设置。
- opcode
指令的操作码,为字符串。
- is_global
该值是一个全局变量。
- is_function
该值是一个函数。
- is_argument
该值是函数的参数。
- is_block
该值是函数的基本块。
- is_instruction
该值是基本块的指令。
- is_operand
该值是指令的操作数。
- is_constant
该值是一个常量。
- get_constant_value(self, signed_int=False, round_fp=False)
返回常量值,如果支持,则以字面量(例如,整数或浮点数)形式返回,否则以字符串形式返回。关键字参数指定转换时的偏好设置
如果
signed_int
为 True 且常量为整数,则返回有符号整数。如果
round_fp
为 True 且常量为浮点值,则在精度丢失时(例如,查询 fp128 值时)对结果进行四舍五入。默认情况下,精度丢失时会引发异常。