IRGlobal

public protocol IRGlobal : IRConstant

An IRGlobal is a value, alias, or function that exists at the top level of an LLVM module.

  • metadata Extension method

    Retrieves all metadata entries attached to this global value.

    Declaration

    Swift

    public var metadata: AttachedMetadata { get }
  • addMetadata(_:kind:) Extension method

    Sets a metadata attachment, erasing the existing metadata attachment if it already exists for the given kind.

    Declaration

    Swift

    public func addMetadata(_ metadata: IRMetadata, kind: AttachedMetadata.PinnedKind)

    Parameters

    metadata

    The metadata to attach to this global value.

    kind

    The kind of metadata to attach.

  • addMetadata(_:kind:) Extension method

    Sets a metadata attachment, erasing the existing metadata attachment if it already exists for the given kind.

    Declaration

    Swift

    public func addMetadata(_ metadata: IRMetadata, kind: UInt32)

    Parameters

    metadata

    The metadata to attach to this global value.

    kind

    The kind of metadata to attach.

  • removeAllMetadata() Extension method

    Removes all metadata attachments from this value.

    Declaration

    Swift

    public func removeAllMetadata()
  • eraseAllMetadata(of:) Extension method

    Erases a metadata attachment of the given kind if it exists.

    Declaration

    Swift

    public func eraseAllMetadata(of kind: UInt32)

    Parameters

    kind

    The kind of the metadata to remove.

  • valueType Extension method

    Retrieves the “value type” of this global value.

    The formal type of a global value is always a pointer type. The value type, in contrast, is the type of the value the global points to.

    Declaration

    Swift

    public var valueType: IRType { get }
  • alignment Extension method

    Retrieves the alignment of this value.

    Declaration

    Swift

    public var alignment: Alignment { get set }
  • linkage Extension method

    Retrieves the linkage information for this global.

    Declaration

    Swift

    public var linkage: Linkage { get set }
  • visibility Extension method

    Retrieves the visibility style for this global.

    Declaration

    Swift

    public var visibility: Visibility { get set }
  • storageClass Extension method

    Retrieves the storage class for this global declaration. For use with Portable Executable files.

    Declaration

    Swift

    public var storageClass: StorageClass { get set }
  • unnamedAddressKind Extension method

    Retrieves an indicator for the significance of a global value’s address.

    Declaration

    Swift

    public var unnamedAddressKind: UnnamedAddressKind { get set }
  • comdat Extension method

    Retrieves the COMDAT section for this global, if it exists.

    Declaration

    Swift

    public var comdat: Comdat? { get set }
  • section Extension method

    Retrieves the section associated with the symbol that will eventually be emitted for this global value.

    Note

    Global Alias values may or may not be resolvable to any particular section given the state of the IR in an arbitrary module. A return value of the empty string indicates a failed section lookup.

    Declaration

    Swift

    public var section: String { get set }
  • guid Extension method

    Retrieves a global unique identifier for this global value.

    This is a 64 bits hash that is used by PGO and ThinLTO to have a compact unique way to identify a symbol.

    Declaration

    Swift

    public var guid: UInt64 { get }
  • eraseFromParent() Extension method

    Removes this global value from the module and deallocates it.

    Note

    To ensure correct removal of the global value, you must invalidate any references to it - usually by performing an “Replace All Uses With” (RAUW) operation.

    Warning

    The native Swift object wrapping this global becomes a dangling reference once this function has been invoked. It is recommended that all references to it be dropped immediately.

    Declaration

    Swift

    public func eraseFromParent()