Global

public final class Global : IRGlobal

A Global represents a region of memory allocated at compile time instead of at runtime. A global variable must either have an initializer, or make reference to an external definition that has an initializer.

  • Returns whether this global variable has no initializer because it makes reference to an initialized value in another translation unit.

    Declaration

    Swift

    public var isExternallyInitialized: Bool { get set }
  • Retrieves the initializer for this global variable, if it exists.

    Declaration

    Swift

    public var initializer: IRValue? { get set }
  • Returns whether this global variable is a constant, whether or not the final definition of the global is not.

    Declaration

    Swift

    public var isGlobalConstant: Bool { get set }
  • Returns whether this global variable is thread-local. That is, returns if this variable is not shared by multiple threads.

    Declaration

    Swift

    public var isThreadLocal: Bool { get set }
  • Accesses the model of reference for this global variable if it is thread-local.

    Declaration

    Swift

    public var threadLocalModel: ThreadLocalModel { get set }
  • Retrieves the previous global in the module, if there is one.

    Declaration

    Swift

    public func previous() -> Global?
  • Retrieves the next global in the module, if there is one.

    Declaration

    Swift

    public func next() -> Global?
  • Deletes the global variable from its containing module.

    Note

    This does not remove references to this global from the module. Ensure you have removed all instructions that reference this global before deleting it.

    Declaration

    Swift

    public func delete()
  • Retrieves the underlying LLVM value object.

    Declaration

    Swift

    public func asLLVM() -> LLVMValueRef