[#llvm-GIConstant] = xref:llvm.adoc[llvm]::GIConstant :relfileprefix: ../ :mrdocs: An integer‐like constant. == Synopsis Declared in `<llvm/CodeGen/GlobalISel/Utils.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class GIConstant; ---- == Description It abstracts over scalar, fixed‐length vectors, and scalable vectors. In the common case, it provides a common API and feels like an APInt, while still providing low‐level access. It can be used for constant‐folding. bool isZero() abstracts over the kind. switch(const.getKind()) { } provides low‐level access. == Enums [cols="1,4"] |=== | Name| Description | xref:llvm/GIConstant/GIConstantKind.adoc[`GIConstantKind`] | Shape of the integer‐like constant. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/GIConstant/2constructor-09.adoc[`GIConstant`] [.small]#[constructor]# | Constructors | xref:llvm/GIConstant/getKind.adoc[`getKind`] | Returns the kind of of this constant, e.g, Scalar. | xref:llvm/GIConstant/getScalarValue.adoc[`getScalarValue`] | Returns the value, if this constant is a scalar. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/GIConstant/getConstant.adoc[`getConstant`] | Build a GIConstant from a register if it is a known integer constant. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#