Value references

A value reference is a wrapper around an LLVM value for you to inspect. You cannot create a value reference yourself. You get them from methods of the ModuleRef and ValueRef classes.

Enumerations

class llvmlite.binding.Linkage

The linkage types allowed for global values are:

  • external
  • available_externally
  • linkonce_any
  • linkonce_odr
  • linkonce_odr_autohide
  • weak_any
  • weak_odr
  • appending
  • internal
  • private
  • dllimport
  • dllexport
  • external_weak
  • ghost
  • common
  • linker_private
  • linker_private_weak
class llvmlite.binding.Visibility

The visibility styles allowed for global values are:

  • default
  • hidden
  • protected
class llvmlite.binding.StorageClass

The storage classes allowed for global values are:

  • default
  • dllimport
  • dllexport

The ValueRef class

class llvmlite.binding.ValueRef

A wrapper around an LLVM value. The attributes available are:

  • is_declaration
    • True—The global value is a mere declaration.

    • False—The global value is defined in the given module.

  • linkage

    The linkage type—a Linkage instance—for this value. This attribute can be set.

  • module

    The module—a ModuleRef instance—that this value is defined in.

  • function

    The function—a ValueRef instance—that this value is defined in.

  • block

    The basic block—a ValueRef instance—that this value is defined in.

  • instruction

    The instruction—a ValueRef instance—that this value is defined in.

  • name

    This value’s name, as a string. This attribute can be set.

  • type

    This value’s LLVM type as TypeRef object.

  • storage_class

    The storage class—a StorageClass instance—for this value. This attribute can be set.

  • visibility

    The visibility style—a Visibility instance—for this value. This attribute can be set.

  • blocks

    An iterator over the basic blocks in this function. Each block is a ValueRef instance.

  • arguments

    An iterator over the arguments of this function. Each argument is a ValueRef instance.

  • instructions

    An iterator over the instructions in this basic block. Each instruction is a ValueRef instance.

  • operands

    An iterator over the operands in this instruction. Each operand is a ValueRef instance.

  • opcode

    The instruction’s opcode, as a string.

  • attributes

    An iterator over the attributes in this value. Each attribute is a bytes instance. Values that have attributes are: function, argument (and others for which attributes support has not been implemented)

  • is_global

    The value is a global variable.

  • is_function

    The value is a function.

  • is_argument

    The value is a function’s argument.

  • is_block

    The value is a function’s basic block.

  • is_instruction

    The value is a basic block’s instruction.

  • is_operand

    The value is a instruction’s operand.