Global

public struct 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
  • Retrieves the initializer for this global variable, if it exists.

    Declaration

    Swift

    public var initializer: IRValue?
  • 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
  • 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
  • Accesses the model of reference for this global variable if it is thread-local.

    Declaration

    Swift

    public var threadLocalMode: ThreadLocalModel
  • 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 insructions that reference this global before deleting it.

    Declaration

    Swift

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

    Declaration

    Swift

    public func asLLVM() -> LLVMValueRef