diff options
| author | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2019-02-05 22:14:40 +0000 | 
|---|---|---|
| committer | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2019-02-05 22:14:40 +0000 | 
| commit | fef7619b05532530fb8277fca749e537a89a7745 (patch) | |
| tree | 322363c12ee09dca8e106a03e44545dd1139bbf1 /llvm/include | |
| parent | 4562f420cd4bb62a5d15f51e18e1bc60a217c62b (diff) | |
| download | bcm5719-llvm-fef7619b05532530fb8277fca749e537a89a7745.tar.gz bcm5719-llvm-fef7619b05532530fb8277fca749e537a89a7745.zip | |
[NFC][GlobalISel]: Add a convenience method to MachineInstrBuilder to simplify getOperand(i).getReg()
https://reviews.llvm.org/D57608
It's a common pattern in GISel to have a MachineInstrBuilder from which we get various regs
(commonly MIB->getOperand(0).getReg()). This adds a helper method and the above can be
replaced with MIB.getReg(0).
llvm-svn: 353223
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstrBuilder.h | 5 | 
1 files changed, 5 insertions, 0 deletions
| diff --git a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h index bbafeab1577..4a8cd6861a9 100644 --- a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h @@ -79,6 +79,11 @@ public:    /// explicitly.    MachineInstr *getInstr() const { return MI; } +  /// Get the register for the operand index. +  /// The operand at the index should be a register (asserted by +  /// MachineOperand). +  unsigned getReg(unsigned Idx) { return MI->getOperand(Idx).getReg(); } +    /// Add a new virtual register operand.    const MachineInstrBuilder &addReg(unsigned RegNo, unsigned flags = 0,                                      unsigned SubReg = 0) const { | 

