[PATCH] [FastISel][X86] Constrain register operand class in foldOperandImpl

Keno Fischer kfischer at college.harvard.edu
Mon Jun 8 19:28:10 PDT 2015


The `i` in the for loop is actually required as it's passed into `constrainOperandRegClass`. For the other one, the success case of `constrainRegClass`, does also lead to the second return statement, so I think it's cleaner this way than

  unsigned MachineRegisterInfo::constrainOperandRegClass(
      MachineFunction &MF, MachineBasicBlock::iterator InsertPt, DebugLoc DL,
      const MCInstrDesc &II, unsigned Op, unsigned OpNum,
      const TargetInstrInfo &TII, const TargetRegisterInfo &TRI) {
    if (!TargetRegisterInfo::isVirtualRegister(Op))
      return Op;
    const TargetRegisterClass *RegClass = TII.getRegClass(II, OpNum, &TRI, MF);
    if (constrainRegClass(Op, RegClass))
      return Op;
    // If it's not legal to COPY between the register classes, something
    // has gone very wrong before we got here.
    unsigned NewOp = createVirtualRegister(RegClass);
    BuildMI(*InsertPt->getParent(), InsertPt, DL, TII.get(TargetOpcode::COPY),
            NewOp)
        .addReg(Op);
    return NewOp;
  }

but I have no strong opinion.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6262

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list