Module expressions

Source
Expand description

Functions in this group operate on constants expressions.

This module provides a set of functions and methods for operating on constants expressions within the LLVM framework.

The functions in this module allow for various operations and manipulations of constant values, such as obtaining the alignment or size of a type, performing arithmetic operations, and creating constant expressions. These operations are essential for low-level programming tasks that require precise control over memory layout and arithmetic behavior.

The module includes:

  • Opcode Retrieval: Functions to get the opcode of a constant expression.
  • Type Information: Functions to obtain the alignment and size of a type.
  • Arithmetic Operations: Functions to perform negation, addition, subtraction, multiplication, and other arithmetic operations on constant values, with support for NSW (No Signed Wrap) and NUW (No Unsigned Wrap) flags.
  • Logical Operations: Functions to perform logical NOT and XOR operations on constant values.
  • Comparison Operations: Functions to perform integer and floating-point comparisons on constant values.
  • Bitwise Operations: Functions to perform bitwise operations such as left shift and bit-cast on constant values.
  • Pointer Operations: Functions to convert between pointers and integers, and to perform address space casts.
  • Vector Operations: Functions to extract and insert elements in vector constants, and to create shuffle vector operations.
  • Block Addressing: Functions to obtain the address of a basic block in a function.

These functions wrap the corresponding LLVM core library functions, providing a safe and idiomatic Rust interface for interacting with LLVM constants.

Functionsยง

align_of
Obtain the alignment of the specified type.
block_address
Obtain the address of a basic block in a function.
const_add
Create an addition operation on two constant values.
const_addr_space_cast
Perform an address space cast operation on a constant value to the specified type.
const_bit_cast
Perform a bitcast operation on a constant value to the specified type.
const_extract_element
Extract an element from a vector constant at the specified index.
const_gep2
Create a GEP (GetElementPtr) operation on a constant value.
const_in_bounds_gep2
Create an in-bounds GEP (GetElementPtr) operation on a constant value.
const_insert_element
Insert an element into a vector constant at the specified index.
const_int_to_ptr
Convert a constant integer to a pointer of the specified type.
const_mul
Create a multiplication operation on two constant values.
const_neg
Create a negation operation on a constant value.
const_not
Create a logical NOT operation on a constant value.
const_nsw_add
Create a NSW (No Signed Wrap) addition operation on two constant values.
const_nsw_mul
Create a NSW (No Signed Wrap) multiplication operation on two constant values.
const_nsw_neg
Create a NSW negation operation on a constant value.
const_nsw_sub
Create a NSW (No Signed Wrap) subtraction operation on two constant values.
const_nuw_add
Create a NUW (No Unsigned Wrap) addition operation on two constant values.
const_nuw_mul
Create a NUW (No Unsigned Wrap) multiplication operation on two constant values.
const_nuw_sub
Create a NUW (No Unsigned Wrap) subtraction operation on two constant values.
const_pointer_cast
Perform a pointer cast operation on a constant value to the specified type.
const_ptr_to_int
Convert a constant pointer to an integer of the specified type.
const_shuffle_vector
Create a shuffle vector operation on two vector constants.
const_sub
Create a subtraction operation on two constant values.
const_trunc
Truncate a constant value to the specified type.
const_trunc_or_bit_cast
Perform either a truncation or bitcast operation on a constant value to the specified type.
const_xor
Create a logical XOR operation on two constant values.
get_const_opcode
Get the opcode for a constant value.
size_of
Obtain the size of the specified type.