layout: page
title: GlobalValue (llvm.core)

The class llvm.core.GlobalValue represents module-scope aliases, variables and functions. Global variables are represented by the sub-class llvm.core.GlobalVariable and functions by llvm.core.Function.

Global values have the read-write properties linkage, section, visibility and alignment. Use one of the following constants (from llvm.core) as values for linkage (see LLVM documentaion for details on each):

Value | Equivalent LLVM Assembly Keyword | ——|———————————-| LINKAGE_EXTERNAL | externally_visible | LINKAGE_AVAILABLE_EXTERNALLY | available_externally | LINKAGE_LINKONCE_ANY | linkonce | LINKAGE_LINKONCE_ODR | linkonce_odr | LINKAGE_WEAK_ANY | weak | LINKAGE_WEAK_ODR | weak_odr | LINKAGE_APPENDING | appending | LINKAGE_INTERNAL | internal | LINKAGE_PRIVATE | private | LINKAGE_DLLIMPORT | dllimport | LINKAGE_DLLEXPORT | dllexport | LINKAGE_EXTERNAL_WEAK | extern_weak | LINKAGE_GHOST | deprecated – do not use | LINKAGE_COMMON | common | LINKAGE_LINKER_PRIVATE | linker_private |

The section property can be assigned strings (like ”.rodata”), which will be used if the target supports it. Visibility property can be set to one of thse constants (from llvm.core, see also LLVM docs):

Value | Equivalent LLVM Assembly Keyword | ——|———————————-| VISIBILITY_DEFAULT | default | VISIBILITY_HIDDEN | hidden | VISIBILITY_PROTECTED | protected |

The alignment property can be 0 (default), or can be set to a power of 2. The read-only property is_declaration can be used to check if the global is a declaration or not. The module to which the global belongs to can be retrieved using the module property (read-only).

llvm.core.GlobalValue

  • This will become a table of contents (this text will be scraped). {:toc}

Properties

linkage

The linkage type, takes one of the constants listed above (LINKAGE_*).

section

A string like ”.rodata”, indicating the section into which the global is placed into.

visibility

The visibility type, takes one of the constants listed above (VISIBILITY_*).

alignment

A power-of-2 integer indicating the boundary to align to.

is_declaration

[read-only]

True if the global is a declaration, False otherwise.

module

[read-only]

The module object to which this global belongs to.

Automatically Generated Documentation

class llvm.core.GlobalValue(builder, ptr)
alignment
is_declaration
linkage
module
section
visibility

Table Of Contents

Previous topic

llvm.core.FunctionType

Next topic

llvm.core.GlobalVariable