llvm::printReg

Prints virtual and physical registers with or without a TRI instance.

Synopsis

Declared in <llvm/CodeGen/TargetRegisterInfo.h>

Printable
printReg(
    Register Reg,
    TargetRegisterInfo const* TRI = nullptr,
    unsigned int SubIdx = 0,
    MachineRegisterInfo const* MRI = nullptr);

Description

The format is: %noreg - NoRegister %5 - a virtual register. %5:sub_8bit - a virtual register with sub-register index (with TRI). %eax - a physical register %physreg17 - a physical register when no TRI instance given.

Usage: OS << printReg(Reg, TRI, SubRegIdx) << ' ';

Return Value

Simple wrapper around std::function<void(raw_ostream&)>. This class is useful to construct print helpers for raw_ostream.

Parameters

NameDescription
RegWrapper class representing virtual and physical registers. Should be passed by value.
TRITargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDesc objects that represent all of the machine registers that the target has. As such, we simply have to track a pointer to this array so that we can turn register number into a register descriptor.
MRIMachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.