Return true if the specified instruction is known to be a constant, or a vector of constants.

Synopsis

Declared in <llvm/CodeGen/GlobalISel/Utils.h>

bool
isConstantOrConstantVector(
    MachineInstr const& MI,
    MachineRegisterInfo const& MRI,
    bool AllowFP = true,
    bool AllowOpaqueConstants = true);

Description

If AllowFP is true, this will consider G_FCONSTANT in addition to G_CONSTANT. If AllowOpaqueConstants is true, constant‐like instructions such as G_GLOBAL_VALUE will also be considered.

Return Value

True if MI is a constant or vector of constants.

Parameters

Name

Description

MI

Instruction to inspect.

MRI

Register information for the function.

AllowFP

Whether floating‐point constants are accepted.

AllowOpaqueConstants

Whether opaque constants like globals count.

Created with MrDocs