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 methodRetrieves all metadata entries attached to this global value.
Declaration
Swift
public var metadata: AttachedMetadata { get }
-
addMetadata(_:
Extension methodkind: ) 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(_:
Extension methodkind: ) 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 methodRemoves 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 methodRetrieves 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 methodRetrieves the alignment of this value.
Declaration
Swift
public var alignment: Alignment { get set }
-
linkage
Extension methodRetrieves the linkage information for this global.
Declaration
Swift
public var linkage: Linkage { get set }
-
visibility
Extension methodRetrieves the visibility style for this global.
Declaration
Swift
public var visibility: Visibility { get set }
-
storageClass
Extension methodRetrieves the storage class for this global declaration. For use with Portable Executable files.
Declaration
Swift
public var storageClass: StorageClass { get set }
-
unnamedAddressKind
Extension methodRetrieves an indicator for the significance of a global value’s address.
Declaration
Swift
public var unnamedAddressKind: UnnamedAddressKind { get set }
-
comdat
Extension methodRetrieves the COMDAT section for this global, if it exists.
Declaration
Swift
public var comdat: Comdat? { get set }
-
section
Extension methodRetrieves the section associated with the symbol that will eventually be emitted for this global value.
Note
GlobalAlias
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 methodRetrieves 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 methodRemoves 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()