mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
MachineInstr: introduce explicit_operands and implicit_operands ranges
Makes iteration over implicit and explicit machine operands more explicit (har har). Insipired by code review discussion for r205565. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205680 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
553e40036a
commit
b29a2b0c4c
@ -293,6 +293,22 @@ public:
|
||||
iterator_range<const_mop_iterator> operands() const {
|
||||
return iterator_range<const_mop_iterator>(operands_begin(), operands_end());
|
||||
}
|
||||
iterator_range<mop_iterator> explicit_operands() {
|
||||
return iterator_range<mop_iterator>(
|
||||
operands_begin(), operands_begin() + getNumExplicitOperands());
|
||||
}
|
||||
iterator_range<const_mop_iterator> explicit_operands() const {
|
||||
return iterator_range<const_mop_iterator>(
|
||||
operands_begin(), operands_begin() + getNumExplicitOperands());
|
||||
}
|
||||
iterator_range<mop_iterator> implicit_operands() {
|
||||
return iterator_range<mop_iterator>(explicit_operands().end(),
|
||||
operands_end());
|
||||
}
|
||||
iterator_range<const_mop_iterator> implicit_operands() const {
|
||||
return iterator_range<const_mop_iterator>(explicit_operands().end(),
|
||||
operands_end());
|
||||
}
|
||||
|
||||
/// Access to memory operands of the instruction
|
||||
mmo_iterator memoperands_begin() const { return MemRefs; }
|
||||
|
@ -50,13 +50,10 @@ char ARM64DeadRegisterDefinitions::ID = 0;
|
||||
bool ARM64DeadRegisterDefinitions::implicitlyDefinesSubReg(
|
||||
unsigned Reg,
|
||||
const MachineInstr *MI) {
|
||||
for (unsigned i = MI->getNumExplicitOperands(), e = MI->getNumOperands();
|
||||
i != e; ++i) {
|
||||
const MachineOperand &MO = MI->getOperand(i);
|
||||
for (const MachineOperand &MO : MI->implicit_operands())
|
||||
if (MO.isReg() && MO.isDef())
|
||||
if (TRI->isSubRegister(Reg, MO.getReg()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,7 @@ AMDGPUMCInstLower::AMDGPUMCInstLower(MCContext &ctx):
|
||||
void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
|
||||
OutMI.setOpcode(MI->getOpcode());
|
||||
|
||||
for (unsigned i = 0, e = MI->getNumExplicitOperands(); i != e; ++i) {
|
||||
const MachineOperand &MO = MI->getOperand(i);
|
||||
|
||||
for (const MachineOperand &MO : MI->explicit_operands()) {
|
||||
MCOperand MCOp;
|
||||
switch (MO.getType()) {
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user