MachineOperand MO = ...; // Get a MachineOperand somehow unsigned SubRegIdx = MO.getSubReg(); // Get the sub-register index
MachineOperand MO = ...; // Get a MachineOperand somehow unsigned Reg = MO.getReg(); // Get the register number unsigned SubRegIdx = MO.getSubReg(); // Get the sub-register index unsigned SubReg = TRI.getSubReg(Reg, SubRegIdx); // Get the sub-register numberThis code gets both the register number and sub-register index of a MachineOperand, and then uses the LLVM Target Register Info (TRI) to get the sub-register number. Package/library: LLVM C++ Library.