IRGlobal
public protocol IRGlobal : IRConstant
An IRGlobal is a value, alias, or function that exists at the top level of
an LLVM module.
-
metadataExtension 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
metadataThe metadata to attach to this global value.
kindThe 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
metadataThe metadata to attach to this global value.
kindThe 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
kindThe kind of the metadata to remove.
-
valueTypeExtension 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 } -
alignmentExtension methodRetrieves the alignment of this value.
Declaration
Swift
public var alignment: Alignment { get set } -
linkageExtension methodRetrieves the linkage information for this global.
Declaration
Swift
public var linkage: Linkage { get set } -
visibilityExtension methodRetrieves the visibility style for this global.
Declaration
Swift
public var visibility: Visibility { get set } -
storageClassExtension methodRetrieves the storage class for this global declaration. For use with Portable Executable files.
Declaration
Swift
public var storageClass: StorageClass { get set } -
unnamedAddressKindExtension methodRetrieves an indicator for the significance of a global value’s address.
Declaration
Swift
public var unnamedAddressKind: UnnamedAddressKind { get set } -
comdatExtension methodRetrieves the COMDAT section for this global, if it exists.
Declaration
Swift
public var comdat: Comdat? { get set } -
sectionExtension methodRetrieves the section associated with the symbol that will eventually be emitted for this global value.
Note
GlobalAliasvalues 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 } -
guidExtension 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()
IRGlobal Protocol Reference